Add branch for the conversion of demos to use standard C header files for configuration, rather than makefile defined macros.

pull/1469/head
Dean Camera 13 years ago
parent e8570c4a37
commit 359fbfe14d

@ -56,6 +56,28 @@ static uint32_t CurrAddress;
*/
static bool RunBootloader = true;
/** Magic lock for forced application start. If the HWBE fuse is programmed and BOOTRST is unprogrammed, the bootloader
* will start if the /HWB line of the AVR is held low and the system is reset. However, if the /HWB line is still held
* low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value
* \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start.
*/
uint32_t MagicBootKey ATTR_NO_INIT;
/** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application
* start key has been loaded into \ref MagicBootKey. If the bootloader started via the watchdog and the key is valid,
* this will force the user application to start via a software jump.
*/
void Application_Jump_Check(void)
{
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
MagicBootKey = 0;
// cppcheck-suppress constStatement
((void (*)(void))0x0000)();
}
}
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
@ -80,6 +102,9 @@ int main(void)
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
@ -122,17 +147,12 @@ ISR(TIMER1_OVF_vect, ISR_BLOCK)
void EVENT_USB_Device_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints */
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
ENDPOINT_BANK_SINGLE);
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT,
CDC_NOTIFICATION_EPSIZE, 1);
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
ENDPOINT_BANK_SINGLE);
Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
ENDPOINT_BANK_SINGLE);
Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
@ -303,7 +323,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
static uint8_t FetchNextCommandByte(void)
{
/* Select the OUT endpoint so that the next data byte can be read */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
Endpoint_SelectEndpoint(CDC_RX_EPADDR);
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
while (!(Endpoint_IsReadWriteAllowed()))
@ -329,7 +349,7 @@ static uint8_t FetchNextCommandByte(void)
static void WriteNextResponseByte(const uint8_t Response)
{
/* Select the IN endpoint so that the next data byte can be written */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
Endpoint_SelectEndpoint(CDC_TX_EPADDR);
/* If IN endpoint full, clear it and wait until ready for the next packet to the host */
if (!(Endpoint_IsReadWriteAllowed()))
@ -353,7 +373,7 @@ static void WriteNextResponseByte(const uint8_t Response)
static void CDC_Task(void)
{
/* Select the OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
Endpoint_SelectEndpoint(CDC_RX_EPADDR);
/* Check if endpoint has a command in it sent from the host */
if (!(Endpoint_IsOUTReceived()))
@ -549,7 +569,7 @@ static void CDC_Task(void)
}
/* Select the IN endpoint */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
Endpoint_SelectEndpoint(CDC_TX_EPADDR);
/* Remember if the endpoint is completely full before clearing it */
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
@ -577,7 +597,7 @@ static void CDC_Task(void)
}
/* Select the OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
Endpoint_SelectEndpoint(CDC_RX_EPADDR);
/* Acknowledge the command from the host */
Endpoint_ClearOUT();

@ -67,6 +67,9 @@
/** Eight character bootloader firmware identifier reported to the host when requested */
#define SOFTWARE_IDENTIFIER "LUFACDC"
/** Magic bootloader key to unlock forced application start mode. */
#define MAGIC_BOOT_KEY 0xDC42CACA
/* Type Defines: */
/** Type define for a non-returning pointer to the start of the loaded application in flash memory. */
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;
@ -75,6 +78,8 @@
static void CDC_Task(void);
static void SetupHardware(void);
void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
void EVENT_USB_Device_ConfigurationChanged(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)

@ -47,9 +47,9 @@
* This bootloader enumerates to the host as a CDC Class device (virtual serial port), allowing for AVR109
* protocol compatible programming software to load firmware onto the AVR.
*
* Out of the box this bootloader builds for the USB1287, and will fit into 4KB of bootloader space. If
* you wish to enlarge this space and/or change the AVR model, you will need to edit the BOOT_START and MCU
* values in the accompanying makefile.
* Out of the box this bootloader builds for the AT90USB1287 with an 8KB bootloader section size, and will fit
* into 4KB of bootloader space. If you wish to alter this size and/or change the AVR model, you will need to
* edit the MCU, FLASH_SIZE_KB and BOOT_SECTION_SIZE_KB values in the accompanying makefile.
*
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
* bootloader from the normal user application.

@ -0,0 +1,50 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Library Configuration Header File
*
* This is a header file which is be used to configure LUFA's
* compile time options, as an alternative to the compile time
* constants supplied through a makefile.
*
* For information on what each token does, refer to the LUFA
* manual section "Summary of Compile Tokens".
*/
#ifndef _APP_CONFIG_H_
#define _APP_CONFIG_H_
#define NO_BLOCK_SUPPORT
#define NO_EEPROM_BYTE_SUPPORT
#define NO_FLASH_BYTE_SUPPORT
#define NO_LOCK_BYTE_WRITE_SUPPORT
#endif

@ -0,0 +1,93 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Library Configuration Header File
*
* This is a header file which is be used to configure LUFA's
* compile time options, as an alternative to the compile time
* constants supplied through a makefile.
*
* For information on what each token does, refer to the LUFA
* manual section "Summary of Compile Tokens".
*/
#ifndef _LUFA_CONFIG_H_
#define _LUFA_CONFIG_H_
#if (ARCH == ARCH_AVR8)
/* Non-USB Related Configuration Tokens: */
// #define DISABLE_TERMINAL_CODES
/* USB Class Driver Related Tokens: */
// #define HID_HOST_BOOT_PROTOCOL_ONLY
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
// #define HID_MAX_COLLECTIONS {Insert Value Here}
// #define HID_MAX_REPORTITEMS {Insert Value Here}
// #define HID_MAX_REPORT_IDS {Insert Value Here}
// #define NO_CLASS_DRIVER_AUTOFLUSH
/* General USB Driver Related Tokens: */
#define ORDERED_EP_CONFIG
#define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
#define USB_DEVICE_ONLY
// #define USB_HOST_ONLY
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
// #define NO_LIMITED_CONTROLLER_CONNECT
#define NO_SOF_EVENTS
/* USB Device Mode Driver Related Tokens: */
#define USE_RAM_DESCRIPTORS
// #define USE_FLASH_DESCRIPTORS
// #define USE_EEPROM_DESCRIPTORS
#define NO_INTERNAL_SERIAL
#define FIXED_CONTROL_ENDPOINT_SIZE 8
#define DEVICE_STATE_AS_GPIOR 0
#define FIXED_NUM_CONFIGURATIONS 1
// #define CONTROL_ONLY_DEVICE
// #define INTERRUPT_CONTROL_ENDPOINT
#define NO_DEVICE_REMOTE_WAKEUP
#define NO_DEVICE_SELF_POWER
/* USB Host Mode Driver Related Tokens: */
// #define HOST_STATE_AS_GPIOR {Insert Value Here}
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
// #define NO_AUTO_VBUS_MANAGEMENT
// #define INVERTED_VBUS_ENABLE_LINE
#else
#error Unsupported architecture for this LUFA configuration file.
#endif
#endif

@ -131,7 +131,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -157,20 +157,20 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -92,14 +92,14 @@
#error The selected AVR part is not currently supported by this bootloader.
#endif
/** Endpoint number for the CDC control interface event notification endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address for the CDC control interface event notification endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number for the CDC data interface TX (data IN) endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address for the CDC data interface TX (data IN) endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number for the CDC data interface RX (data OUT) endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address for the CDC data interface RX (data OUT) endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size of the CDC data interface TX and RX data endpoint banks, in bytes. */
#define CDC_TXRX_EPSIZE 16

@ -95,7 +95,7 @@ F_USB = $(F_CPU)
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 4
BOOT_SECTION_SIZE_KB = 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application
@ -124,22 +124,7 @@ LUFA_PATH = ../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
LUFA_OPTS += -D ORDERED_EP_CONFIG
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_RAM_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_INTERNAL_SERIAL
LUFA_OPTS += -D NO_DEVICE_SELF_POWER
LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
LUFA_OPTS += -D NO_SOF_EVENTS
#LUFA_OPTS += -D NO_BLOCK_SUPPORT
#LUFA_OPTS += -D NO_EEPROM_BYTE_SUPPORT
#LUFA_OPTS += -D NO_FLASH_BYTE_SUPPORT
#LUFA_OPTS += -D NO_LOCK_BYTE_WRITE_SUPPORT
LUFA_OPTS = -D USE_LUFA_CONFIG_HEADER
# Create the LUFA source path variables by including the LUFA root makefile
@ -184,7 +169,7 @@ DEBUG = dwarf-2
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/
EXTRAINCDIRS = $(LUFA_PATH)/ Config/
# Compiler flag to set the C Standard level.

@ -92,6 +92,27 @@ static uint16_t StartAddr = 0x0000;
*/
static uint16_t EndAddr = 0x0000;
/** Magic lock for forced application start. If the HWBE fuse is programmed and BOOTRST is unprogrammed, the bootloader
* will start if the /HWB line of the AVR is held low and the system is reset. However, if the /HWB line is still held
* low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value
* \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start.
*/
uint32_t MagicBootKey ATTR_NO_INIT;
/** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application
* start key has been loaded into \ref MagicBootKey. If the bootloader started via the watchdog and the key is valid,
* this will force the user application to start via a software jump.
*/
void Application_Jump_Check(void)
{
// If the reset source was the bootloader and the key is correct, clear it and jump to the application
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
MagicBootKey = 0;
AppStartPtr();
}
}
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
@ -695,6 +716,9 @@ static void ProcessWriteCommand(void)
{
if (SentCommand.Data[1] == 0x00) // Start via watchdog
{
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Start the watchdog to reset the AVR once the communications are finalized */
wdt_enable(WDTO_250MS);
}

@ -66,6 +66,9 @@
/** Minor bootloader version number. */
#define BOOTLOADER_VERSION_REV 0
/** Magic bootloader key to unlock forced application start mode. */
#define MAGIC_BOOT_KEY 0xDC42CACA
/** Complete bootloader version number expressed as a packed byte, constructed from the
* two individual bootloader version macros.
@ -206,6 +209,8 @@
static void ProcessWriteCommand(void);
static void ProcessReadCommand(void);
#endif
void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
#endif

@ -47,9 +47,9 @@
* This bootloader enumerates to the host as a DFU Class device, allowing for DFU-compatible programming
* software to load firmware onto the AVR.
*
* Out of the box this bootloader builds for the USB1287, and should fit into 4KB of bootloader space. If
* you wish to enlarge this space and/or change the AVR model, you will need to edit the BOOT_START and MCU
* values in the accompanying makefile.
* Out of the box this bootloader builds for the AT90USB1287 with an 8KB bootloader section size, and will fit
* into 4KB of bootloader space. If you wish to alter this size and/or change the AVR model, you will need to
* edit the MCU, FLASH_SIZE_KB and BOOT_SECTION_SIZE_KB values in the accompanying makefile.
*
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
* bootloader from the normal user application.

@ -111,7 +111,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
.DetachTimeout = 0x0000,
.TransferSize = 0x0C00,
.DFUSpecification = VERSION_BCD(01.01)
.DFUSpecification = VERSION_BCD(01.10)
}
};

@ -95,7 +95,7 @@ F_USB = $(F_CPU)
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 4
BOOT_SECTION_SIZE_KB = 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application

@ -41,6 +41,29 @@
*/
static bool RunBootloader = true;
/** Magic lock for forced application start. If the HWBE fuse is programmed and BOOTRST is unprogrammed, the bootloader
* will start if the /HWB line of the AVR is held low and the system is reset. However, if the /HWB line is still held
* low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value
* \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start.
*/
uint32_t MagicBootKey ATTR_NO_INIT;
/** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application
* start key has been loaded into \ref MagicBootKey. If the bootloader started via the watchdog and the key is valid,
* this will force the user application to start via a software jump.
*/
void Application_Jump_Check(void)
{
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
MagicBootKey = 0;
// cppcheck-suppress constStatement
((void (*)(void))0x0000)();
}
}
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit.
*/
@ -58,6 +81,9 @@ int main(void)
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
@ -85,9 +111,7 @@ static void SetupHardware(void)
void EVENT_USB_Device_ConfigurationChanged(void)
{
/* Setup HID Report Endpoint */
Endpoint_ConfigureEndpoint(HID_IN_EPNUM, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, HID_IN_EPSIZE,
ENDPOINT_BANK_SINGLE);
Endpoint_ConfigureEndpoint(HID_IN_EPADDR, EP_TYPE_INTERRUPT, HID_IN_EPSIZE, 1);
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to

@ -52,9 +52,14 @@
/** Bootloader special address to start the user application */
#define COMMAND_STARTAPPLICATION 0xFFFF
/** Magic bootloader key to unlock forced application start mode. */
#define MAGIC_BOOT_KEY 0xDC42CACA
/* Function Prototypes: */
static void SetupHardware(void);
void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);

@ -51,10 +51,10 @@
* from PJRC (used with permission). This bootloader is deliberatley non-compatible with the properietary PJRC
* HalfKay bootloader GUI; only the command line interface software accompanying this bootloader will work with it.
*
* Out of the box this bootloader builds for the USB1287, and will fit into 2KB of bootloader space for the
* Series 2 USB AVRs (ATMEGAxxU2, AT90USBxx2) or 4KB of bootloader space for all other models. If you wish to
* enlarge this space and/or change the AVR model, you will need to edit the BOOT_START and MCU values in the
* accompanying makefile.
* Out of the box this bootloader builds for the AT90USB1287 with an 8KB bootloader section size, and will fit
* into 2KB of bootloader space for the Series 2 USB AVRs (ATMEGAxxU2, AT90USBxx2) or 4KB of bootloader space for
* all other models. If you wish to alter this size and/or change the AVR model, you will need to edit the MCU,
* FLASH_SIZE_KB and BOOT_SECTION_SIZE_KB values in the accompanying makefile.
*
* \section Sec_Installation Driver Installation
*

@ -137,10 +137,10 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | HID_IN_EPNUM),
.EndpointAddress = HID_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_IN_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -55,8 +55,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the HID data IN endpoint. */
#define HID_IN_EPNUM 1
/** Endpoint address of the HID data IN endpoint. */
#define HID_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the HID reporting IN endpoint. */
#define HID_IN_EPSIZE 64

@ -970,13 +970,9 @@ void parse_options(int argc, char **argv)
} else if (strncmp(arg, "-mmcu=", 6) == 0) {
arg += 6;
uint8_t valid_prefix = 0;
if (strncmp(arg, "at90usb", 7) == 0) {
valid_prefix = 1;
arg += 7;
} else if (strncmp(arg, "atmega", 6) == 0) {
valid_prefix = 1;
arg += 6;
} else {
die("Unknown MCU type\n");

@ -95,7 +95,7 @@ F_USB = $(F_CPU)
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 4
BOOT_SECTION_SIZE_KB = 8
# Formulas used to calculate the starting address of the Bootloader section. These formulas

@ -0,0 +1,90 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Custom Board Button Hardware Driver (Template)
*
* This is a stub driver header file, for implementing custom board
* layout hardware with compatible LUFA board specific drivers. If
* the library is configured to use the BOARD_USER board mode, this
* driver file should be completed and copied into the "/Board/" folder
* inside the application's folder.
*
* This stub is for the board-specific component of the LUFA Buttons driver,
* for the control of physical board-mounted GPIO pushbuttons.
*/
#ifndef __BUTTONS_USER_H__
#define __BUTTONS_USER_H__
/* Includes: */
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 0)
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
{
}
static inline void Buttons_Disable(void)
{
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void)
{
return 0;
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

@ -0,0 +1,195 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Custom Board Dataflash Hardware Driver (Template)
*
* This is a stub driver header file, for implementing custom board
* layout hardware with compatible LUFA board specific drivers. If
* the library is configured to use the BOARD_USER board mode, this
* driver file should be completed and copied into the "/Board/" folder
* inside the application's folder.
*
* This stub is for the board-specific component of the LUFA Dataflash
* driver.
*/
#ifndef __DATAFLASH_USER_H__
#define __DATAFLASH_USER_H__
/* Includes: */
// TODO: Add any required includes here
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all Dataflashes
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
#define DATAFLASH_TOTALCHIPS 1 // TODO: Replace with the number of Dataflashes on the board, max 2
/** Mask for no dataflash chip selected. */
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 // TODO: Replace with mask to hold /CS of first Dataflash low, and all others high
/** Mask for the second dataflash chip selected. */
#define DATAFLASH_CHIP2 // TODO: Replace with mask to hold /CS of second Dataflash low, and all others high
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
/** Total number of pages inside each of the board's dataflash ICs. */
#define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs
/* Inline Functions: */
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
* The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
*/
static inline void Dataflash_Init(void)
{
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
*
* \param[in] Byte Byte of data to send to the dataflash
*
* \return Last response byte from the dataflash
*/
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
{
return 0;
}
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
*
* \param[in] Byte Byte of data to send to the dataflash
*/
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SendByte(const uint8_t Byte)
{
}
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
*
* \return Last response byte from the dataflash
*/
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Dataflash_ReceiveByte(void)
{
return 0;
}
/** Determines the currently selected dataflash chip.
*
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
* or a DATAFLASH_CHIPn mask (where n is the chip number).
*/
static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Dataflash_GetSelectedChip(void)
{
return 0;
}
/** Selects the given dataflash chip.
*
* \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is
* the chip number).
*/
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
{
}
/** Deselects the current dataflash chip, so that no dataflash is selected. */
static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE;
static inline void Dataflash_DeselectChip(void)
{
}
/** Selects a dataflash IC from the given page number, which should range from 0 to
* ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one
* dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside
* the total number of pages contained in the boards dataflash ICs, all dataflash ICs
* are deselected.
*
* \param[in] PageAddress Address of the page to manipulate, ranging from
* 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1).
*/
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
}
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
* a new command.
*/
static inline void Dataflash_ToggleSelectedChipCS(void)
{
}
/** Spin-loops while the currently selected dataflash is busy executing a command, such as a main
* memory page program or main memory to buffer transfer.
*/
static inline void Dataflash_WaitWhileBusy(void)
{
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
* dataflash commands which require a complete 24-bit address.
*
* \param[in] PageAddress Page address within the selected dataflash IC
* \param[in] BufferByte Address within the dataflash's buffer
*/
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte)
{
}
#endif

@ -0,0 +1,102 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Custom Board Joystick Hardware Driver (Template)
*
* This is a stub driver header file, for implementing custom board
* layout hardware with compatible LUFA board specific drivers. If
* the library is configured to use the BOARD_USER board mode, this
* driver file should be completed and copied into the "/Board/" folder
* inside the application's folder.
*
* This stub is for the board-specific component of the LUFA Joystick
* driver, for a digital four-way (plus button) joystick.
*/
#ifndef __JOYSTICK_USER_H__
#define __JOYSTICK_USER_H__
/* Includes: */
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_JOYSTICK_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
#define JOY_LEFT // TODO: Add mask to indicate joystick left position here
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT // TODO: Add mask to indicate joystick right position here
/** Mask for the joystick being pushed in the upward direction. */
#define JOY_UP // TODO: Add mask to indicate joystick up position here
/** Mask for the joystick being pushed in the downward direction. */
#define JOY_DOWN // TODO: Add mask to indicate joystick down position here
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
{
}
static inline void Joystick_Disable(void)
{
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
return 0;
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

@ -0,0 +1,130 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Custom Board LED Hardware Driver (Template)
*
* This is a stub driver header file, for implementing custom board
* layout hardware with compatible LUFA board specific drivers. If
* the library is configured to use the BOARD_USER board mode, this
* driver file should be completed and copied into the "/Board/" folder
* inside the application's folder.
*
* This stub is for the board-specific component of the LUFA LEDs driver,
* for the LEDs (up to four) mounted on most development boards.
*/
#ifndef __LEDS_USER_H__
#define __LEDS_USER_H__
/* Includes: */
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 (1 << 0)
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 1)
/** LED mask for the third LED on the board. */
#define LEDS_LED3 (1 << 2)
/** LED mask for the fourth LED on the board. */
#define LEDS_LED4 (1 << 3)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
}
static inline void LEDs_Disable(void)
{
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
}
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return 0;
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

@ -0,0 +1,51 @@
# BOARD DEFINE = {ARCH} : {MCU} :
BOARD_USER = avr8 : at90usb1287 :
BOARD_NONE = avr8 : at90usb1287 :
BOARD_USBKEY = avr8 : at90usb1287 :
BOARD_STK525 = avr8 : at90usb647 :
BOARD_STK526 = avr8 : at90usb162 :
BOARD_RZUSBSTICK = avr8 : at90usb1287 :
BOARD_ATAVRUSBRF01 = avr8 : at90usb1287 :
BOARD_BUMBLEB = avr8 : at90usb162 :
BOARD_XPLAIN = avr8 : at90usb1287 :
BOARD_XPLAIN_REV1 = avr8 : at90usb1287 :
BOARD_EVK527 = avr8 : atmega32u4 :
BOARD_TEENSY = avr8 : at90usb162 :
BOARD_USBTINYMKII = avr8 : at90usb162 :
BOARD_BENITO = avr8 : at90usb162 :
BOARD_JMDBU2 = avr8 : atmega32u2 :
BOARD_OLIMEX162 = avr8 : at90usb162 :
BOARD_UDIP = avr8 : atmega32u2 :
BOARD_BUI = avr8 : at90usb646 :
BOARD_UNO = avr8 : atmega8u2 :
BOARD_CULV3 = avr8 : atmega32u4 :
BOARD_BLACKCAT = avr8 : at90usb162 :
BOARD_MAXIMUS = avr8 : at90usb162 :
BOARD_MINIMUS = avr8 : atmega32u2 :
BOARD_ADAFRUITU4 = avr8 : atmega32u4 :
BOARD_MICROSIN162 = avr8 : atmega162 :
BOARD_USBFOO = avr8 : atmega162 :
BOARD_SPARKFUN8U2 = avr8 : atmega8u2 :
BOARD_EVK1101 = uc3 : uc3b0256 :
BOARD_TUL = avr8 : atmega32u4 :
BOARD_EVK1100 = uc3 : uc3a0512 :
BOARD_EVK1104 = uc3 : uc3a3256 :
BOARD_A3BU_XPLAINED = xmega : atxmega256a3bu :
BOARD_TEENSY2 = avr8 : at90usb646 :
BOARD_USB2AX = avr8 : atmega32u4 :
BOARD_USB2AX_V3 = avr8 : atmega32u4 :
BOARD_MICROPENDOUS_32U2 = avr8 : atmega32u2 :
BOARD_MICROPENDOUS_A = avr8 : at90usb1287 :
BOARD_MICROPENDOUS_1 = avr8 : at90usb162 :
BOARD_MICROPENDOUS_2 = avr8 : atmega32u4 :
BOARD_MICROPENDOUS_3 = avr8 : at90usb1287 :
BOARD_MICROPENDOUS_4 = avr8 : at90usb1287 :
BOARD_MICROPENDOUS_DIP = avr8 : at90usb1287 :
BOARD_MICROPENDOUS_REV1 = avr8 : at90usb1287 :
BOARD_MICROPENDOUS_REV2 = avr8 : at90usb1287 :
BOARD_B1_XPLAINED = xmega : atxmega128b1 :
BOARD_MULTIO = avr8 : at90usb162 :
BOARD_BIGMULTIO = avr8 : atmega32u4 :
BOARD_DUCE = avr8 : atmega32u2 :
BOARD_OLIMEX32U4 = avr8 : atmega32u4 :
BOARD_OLIMEXT32U4 = avr8 : atmega32u4 :

@ -0,0 +1,77 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include <LUFA/Common/Common.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Dataflash.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
int main(void)
{
uint_reg_t Dummy;
/* Buttons Compile Check */
Buttons_Init();
Dummy = Buttons_GetStatus();
Buttons_Disable();
/* Dataflash Compile Check */
Dataflash_Init();
Dataflash_TransferByte(0);
Dataflash_SendByte(0);
Dummy = Dataflash_ReceiveByte();
Dummy = Dataflash_GetSelectedChip();
Dataflash_SelectChip(0);
Dataflash_DeselectChip();
Dataflash_SelectChipFromPage(0);
Dataflash_ToggleSelectedChipCS();
Dataflash_WaitWhileBusy();
Dataflash_SendAddressBytes(0, 0);
/* LEDs Compile Check */
LEDs_Init();
LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
LEDs_TurnOffLEDs(LEDS_ALL_LEDS);
LEDs_SetAllLEDs(LEDS_ALL_LEDS);
LEDs_ChangeLEDs(LEDS_ALL_LEDS, LEDS_NO_LEDS);
LEDs_ToggleLEDs(LEDS_ALL_LEDS);
Dummy = LEDs_GetLEDs();
LEDs_Disable();
/* Joystick Compile Check */
Joystick_Init();
Dummy = Joystick_GetStatus();
Joystick_Disable();
(void)Dummy;
}

@ -0,0 +1,63 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2011.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# Makefile for the board driver build test. This
# test attempts to build a dummy project with all
# possible board targets using their respective
# compiler.
# Path to the root of the LUFA tree to scan
LUFA_ROOT_PATH = ../..
all: begin makeboardlist testboards clean end
begin:
@echo Executing build test "BoardDriverTest".
@echo
end:
@echo Build test "BoardDriverTest" complete.
@echo
makeboardlist:
@grep "BOARD_" $(LUFA_ROOT_PATH)/LUFA/Common/BoardTypes.h | cut -d'#' -f2 | cut -d' ' -f2 | grep "BOARD_" > BoardList.txt
testboards:
echo "buildtest:" > BuildMakefile
@while read line; \
do \
build_cfg=`grep "$$line " BoardDeviceMap.cfg | sed 's/ //g' | cut -d'=' -f2-`; \
\
build_board=$$line; \
build_arch=`echo $$build_cfg | cut -d':' -f1`; \
build_mcu=`echo $$build_cfg | cut -d':' -f2`; \
\
if ( test -z "$$build_cfg" ); then \
echo "No matching information set for board $$build_board"; \
else \
echo "Found board configuration for $$build_board - $$build_arch, $$build_mcu"; \
\
printf "\t@echo Building dummy project for $$build_board...\n" >> BuildMakefile; \
printf "\tmake -s -f makefile.%s clean\n" $$build_arch >> BuildMakefile; \
printf "\tmake -s -f makefile.%s MCU=%s BOARD=%s elf\n\n" $$build_arch $$build_mcu $$build_board >> BuildMakefile; \
fi; \
done < BoardList.txt
$(MAKE) -f BuildMakefile buildtest
clean:
rm -f BuildMakefile
rm -f BoardList.txt
$(MAKE) -f makefile.avr8 clean
$(MAKE) -f makefile.xmega clean
$(MAKE) -f makefile.uc3 clean
%:

@ -0,0 +1,722 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = at90usb1287
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = NONE
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = Test
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = .
# Path to the LUFA library
LUFA_PATH = ../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS =
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.)
SRC = Test.c
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=c99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_USB=$(F_USB)UL
CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH)
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_USB=$(F_USB)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_USB=$(F_USB)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CPPDEFS += $(LUFA_OPTS)
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections
CFLAGS += -fno-inline-small-functions
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -fno-strict-aliasing
CFLAGS += -fno-split-wide-types
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
#CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x
#---------------- Programming Options (avrdude) ----------------
# Programming hardware
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = jtagmkII
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $(TARGET).hex
dfu-programmer $(MCU) reset
flip-ee: $(TARGET).hex $(TARGET).eep
$(COPY) $(TARGET).eep $(TARGET)eep.hex
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(TARGET)eep.hex
dfu-ee: $(TARGET).hex $(TARGET).eep
dfu-programmer $(MCU) eeprom-flash $(TARGET).eep
dfu-programmer $(MCU) reset
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation \($(TARGET)\)...
@if ( doxygen Doxygen.conf 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \
exit 1; \
fi;
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
checksource:
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
if [ -f $$f ]; then \
echo "Found Source File: $$f" ; \
else \
echo "Source File Not Found: $$f" ; \
fi; done
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config checksource

@ -0,0 +1,485 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = uc3a3256
# Targeted chip architecture (see library "Architectures" documentation)
ARCH = UC3
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = NONE
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This should be the frequency the system core runs at, after the system clock
# has been set up correctly and started.
F_CPU = 12000000
# USB controller master clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency of the USB controller's clock generator in Hz.
#
# For the UC3 chips, this should be equal to 48MHz or 96MHz.
F_USB = 48000000
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = Test
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = .
# Path to the LUFA library
LUFA_PATH = ../..
# LUFA library compile-time options and predefined tokens (add '-D' before each token)
LUFA_OPTS =
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.)
SRC = Test.c
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_USB=$(F_USB)UL
CDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DARCH=ARCH_$(ARCH)
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_USB=$(F_USB)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
ADEFS += -DARCH=ARCH_$(ARCH)
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_USB=$(F_USB)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CPPDEFS += -DARCH=ARCH_$(ARCH)
CPPDEFS += $(LUFA_OPTS)
# Debugging level.
DEBUG = 3
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections
CFLAGS += -fno-strict-aliasing
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -masm-addr-pseudos
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -ffunction-sections
CPPFLAGS += -fno-strict-aliasing
CPPFLAGS += -fno-exceptions
CPPFLAGS += -masm-addr-pseudos
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--gc-sections --rodata-writable
LDFLAGS += -Wl,--direct-data
#LDFLAGS += -T linker_script.x
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr32-gcc
OBJCOPY = avr32-objcopy
OBJDUMP = avr32-objdump
SIZE = avr32-size
AR = avr32-ar rcs
NM = avr32-nm
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $(TARGET).hex
dfu-programmer $(MCU) reset
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation \($(TARGET)\)...
@if ( doxygen Doxygen.conf 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \
exit 1; \
fi;
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
checksource:
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
if [ -f $$f ]; then \
echo "Found Source File: $$f" ; \
else \
echo "Source File Not Found: $$f" ; \
fi; done
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex lss sym doxygen clean clean_list clean_doxygen \
dfu flip checksource

@ -0,0 +1,704 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = atxmega128a1u
# Targeted chip architecture (see library "Architectures" documentation)
ARCH = XMEGA
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = NONE
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This should be the frequency the system core runs at, after the system clock
# has been set up correctly and started.
F_CPU = 24000000
# USB controller master clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency of the USB controller's clock generator in Hz.
#
# For the XMEGA chips, this should be equal to a multiple of 6MHz for Low
# Speed USB mode, or a multiple of 48MHz for Full Speed USB mode.
F_USB = 48000000
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = Test
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = .
# Path to the LUFA library
LUFA_PATH = ../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS =
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.)
SRC = Test.c
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_USB=$(F_USB)UL
CDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DARCH=ARCH_$(ARCH)
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_USB=$(F_USB)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
ADEFS += -DARCH=ARCH_$(ARCH)
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_USB=$(F_USB)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CPPDEFS += -DARCH=ARCH_$(ARCH)
CPPDEFS += $(LUFA_OPTS)
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections
CFLAGS += -fno-inline-small-functions
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -fno-strict-aliasing
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -ffunction-sections
CPPFLAGS += -fno-strict-aliasing
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x
#---------------- Programming Options (avrdude) ----------------
# Programming hardware
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = jtagmkII
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $(TARGET).hex
dfu-programmer $(MCU) reset
flip-ee: $(TARGET).hex $(TARGET).eep
$(COPY) $(TARGET).eep $(TARGET)eep.hex
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(TARGET)eep.hex
dfu-ee: $(TARGET).hex $(TARGET).eep
dfu-programmer $(MCU) eeprom-flash $(TARGET).eep
dfu-programmer $(MCU) reset
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation \($(TARGET)\)...
@if ( doxygen Doxygen.conf 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \
exit 1; \
fi;
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
checksource:
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
if [ -f $$f ]; then \
echo "Found Source File: $$f" ; \
else \
echo "Source File Not Found: $$f" ; \
fi; done
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config checksource

@ -15,7 +15,7 @@
# List of device families per architecture, one device per architecture sub-family
AVR8_FAMILIES = at90usb1287 at90usb1286 atmega16u4 atmega16u2 at90usb162
XMEGA_FAMILIES = atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3
XMEGA_FAMILIES = atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega32c4
UC3_FAMILIES = uc3a0256 uc3a1256 uc3a3256 uc3a4256 uc3b0256 uc3b1256
# List of all device families, with a family postfix
@ -24,6 +24,10 @@ DEVICE_FAMILIES = $(AVR8_FAMILIES:%=%.avr8) $(XMEGA_FAMILIES:%=%.xmega) $(UC3_FA
all: begin $(DEVICE_FAMILIES) clean end
arch_avr8: begin $(AVR8_FAMILIES:%=%.avr8) end
arch_xmega: begin $(XMEGA_FAMILIES:%=%.xmega) end
arch_uc3: begin $(UC3_FAMILIES:%=%.uc3) end
begin:
@echo Executing build test "ModuleTest".
@echo
@ -33,21 +37,21 @@ end:
@echo
%.avr8:
$(MAKE) -f makefile.avr8 clean -s
$(MAKE) -f makefile.avr8 all MCU=$(@:%.avr8=%) -s
$(MAKE) -s -f makefile.avr8 clean
$(MAKE) -s -f makefile.avr8 all MCU=$(@:%.avr8=%) elf
%.xmega:
$(MAKE) -f makefile.xmega clean -s
$(MAKE) -f makefile.xmega all MCU=$(@:%.xmega=%) -s
$(MAKE) -s -f makefile.xmega clean
$(MAKE) -s -f makefile.xmega all MCU=$(@:%.xmega=%) elf
%.uc3:
$(MAKE) -f makefile.uc3 clean -s
$(MAKE) -f makefile.uc3 all MCU=$(@:%.uc3=%) -s
$(MAKE) -s -f makefile.uc3 clean
$(MAKE) -s -f makefile.uc3 all MCU=$(@:%.uc3=%) elf
clean:
$(MAKE) -f makefile.avr8 clean -s
$(MAKE) -f makefile.xmega clean -s
$(MAKE) -f makefile.uc3 clean -s
$(MAKE) -s -f makefile.avr8 clean
$(MAKE) -s -f makefile.xmega clean
$(MAKE) -s -f makefile.uc3 clean
%:

@ -23,23 +23,23 @@ end:
@echo
compile:
$(MAKE) -f makefile.avr8 clean -s
$(MAKE) -f makefile.avr8 LUFA_OPTS='-D USB_DEVICE_ONLY' -s
$(MAKE) -f makefile.avr8 clean -s
$(MAKE) -f makefile.avr8 LUFA_OPTS='-D USB_HOST_ONLY' -s
$(MAKE) -f makefile.xmega clean -s
$(MAKE) -f makefile.xmega LUFA_OPTS='-D USB_DEVICE_ONLY' -s
$(MAKE) -f makefile.uc3 clean -s
$(MAKE) -f makefile.uc3 LUFA_OPTS='-D USB_DEVICE_ONLY' -s
$(MAKE) -f makefile.uc3 clean -s
$(MAKE) -f makefile.uc3 LUFA_OPTS='-D USB_HOST_ONLY' -s
$(MAKE) -s -f makefile.avr8 clean
$(MAKE) -s -f makefile.avr8 LUFA_OPTS='-D USB_DEVICE_ONLY' elf
$(MAKE) -s -f makefile.avr8 clean
$(MAKE) -s -f makefile.avr8 LUFA_OPTS='-D USB_HOST_ONLY' elf
$(MAKE) -s -f makefile.xmega clean
$(MAKE) -s -f makefile.xmega LUFA_OPTS='-D USB_DEVICE_ONLY' elf
$(MAKE) -s -f makefile.uc3 clean
$(MAKE) -s -f makefile.uc3 LUFA_OPTS='-D USB_DEVICE_ONLY' elf
$(MAKE) -s -f makefile.uc3 clean
$(MAKE) -s -f makefile.uc3 LUFA_OPTS='-D USB_HOST_ONLY' elf
clean:
$(MAKE) -f makefile.avr8 clean -s
$(MAKE) -f makefile.xmega clean -s
$(MAKE) -f makefile.uc3 clean -s
$(MAKE) -s -f makefile.avr8 clean
$(MAKE) -s -f makefile.xmega clean
$(MAKE) -s -f makefile.uc3 clean
%:

@ -24,7 +24,8 @@ SUPPRESS_WARNINGS = variableScope \
missingInclude
# Extra paths to search for include files
INCLUDE_PATHS = $(LUFA_ROOT_PATH)/LUFA/CodeTemplates/
INCLUDE_PATHS = $(LUFA_ROOT_PATH)/LUFA/CodeTemplates/ \
$(LUFA_ROOT_PATH)/Projects/AVRISP-MKII/
# Configuration options to pass to cppcheck
CPPCHECK_OPTIONS = --template=$(MESSAGE_TEMPLATE) $(INCLUDE_PATHS:%=-I%) $(EXCLUDE_LIST:%=-i%) --inline-suppr --force --error-exitcode=1 --std=c99

@ -11,11 +11,8 @@
# not intended to be modified or compiled by non-developers.
all:
$(MAKE) -C ModuleTest all
$(MAKE) -C SingleUSBModeTest all
$(MAKE) -C StaticAnalysisTest all
%:
$(MAKE) -C BoardDriverTest $@
$(MAKE) -C ModuleTest $@
$(MAKE) -C SingleUSBModeTest $@
$(MAKE) -C StaticAnalysisTest $@

@ -46,9 +46,12 @@ USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface =
{
.ControlInterfaceNumber = 0,
.StreamingInterfaceNumber = 1,
.DataINEndpointNumber = AUDIO_STREAM_EPNUM,
.DataINEndpointSize = AUDIO_STREAM_EPSIZE,
.DataINEndpoint =
{
.Address = AUDIO_STREAM_EPADDR,
.Size = AUDIO_STREAM_EPSIZE,
.Banks = 2,
},
},
};
@ -197,7 +200,7 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t*
uint8_t* Data)
{
/* Check the requested endpoint to see if a supported endpoint is being manipulated */
if (EndpointAddress == (ENDPOINT_DIR_IN | Microphone_Audio_Interface.Config.DataINEndpointNumber))
if (EndpointAddress == Microphone_Audio_Interface.Config.DataINEndpoint.Address)
{
/* Check the requested control to see if a supported control is being manipulated */
if (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)

@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM),
.EndpointAddress = AUDIO_STREAM_EPADDR,
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 0x01

@ -42,14 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
/** Endpoint address of the Audio isochronous streaming data IN endpoint. */
#define AUDIO_STREAM_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPSIZE 256
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -46,9 +46,12 @@ USB_ClassInfo_Audio_Device_t Speaker_Audio_Interface =
{
.ControlInterfaceNumber = 0,
.StreamingInterfaceNumber = 1,
.DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,
.DataOUTEndpointSize = AUDIO_STREAM_EPSIZE,
.DataOUTEndpoint =
{
.Address = AUDIO_STREAM_EPADDR,
.Size = AUDIO_STREAM_EPSIZE,
.Banks = 2,
},
},
};
@ -234,7 +237,7 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t*
uint8_t* Data)
{
/* Check the requested endpoint to see if a supported endpoint is being manipulated */
if (EndpointAddress == (ENDPOINT_DIR_OUT | Speaker_Audio_Interface.Config.DataOUTEndpointNumber))
if (EndpointAddress == Speaker_Audio_Interface.Config.DataOUTEndpoint.Address)
{
/* Check the requested control to see if a supported control is being manipulated */
if (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)

@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM),
.EndpointAddress = AUDIO_STREAM_EPADDR,
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 0x01

@ -42,14 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
/** Endpoint address of the Audio isochronous streaming data OUT endpoint. */
#define AUDIO_STREAM_EPADDR (ENDPOINT_DIR_OUT | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPSIZE 256
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC1_NOTIFICATION_EPNUM),
.EndpointAddress = CDC1_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -183,20 +183,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC1_RX_EPNUM),
.EndpointAddress = CDC1_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC1_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC1_TX_EPNUM),
.EndpointAddress = CDC1_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC2_IAD =
@ -258,7 +258,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC2_NOTIFICATION_EPNUM),
.EndpointAddress = CDC2_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -284,20 +284,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC2_RX_EPNUM),
.EndpointAddress = CDC2_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC2_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC2_TX_EPNUM),
.EndpointAddress = CDC2_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,23 +42,23 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPNUM 1
/** Endpoint address of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPNUM 2
/** Endpoint address of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint address of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPNUM 4
/** Endpoint address of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPADDR (ENDPOINT_DIR_IN | 4)
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPNUM 5
/** Endpoint address of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPADDR (ENDPOINT_DIR_OUT | 5)
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 6
/** Endpoint address of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -45,19 +45,25 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC1_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC1_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC1_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC1_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC1_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
@ -70,19 +76,26 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 2,
.DataINEndpointNumber = CDC2_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC2_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.ControlInterfaceNumber = 2,
.DataINEndpoint =
{
.Address = CDC2_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC2_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC2_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
.NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
},
};

@ -135,10 +135,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | GENERIC_IN_EPNUM),
.EndpointAddress = GENERIC_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPNUM 1
/** Endpoint address of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = GENERIC_IN_EPADDR,
.Size = GENERIC_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},

@ -135,10 +135,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | JOYSTICK_EPNUM),
.EndpointAddress = JOYSTICK_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = JOYSTICK_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPNUM 1
/** Endpoint address of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPSIZE 8

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = JOYSTICK_EPNUM,
.ReportINEndpointSize = JOYSTICK_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = JOYSTICK_EPADDR,
.Size = JOYSTICK_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevJoystickHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevJoystickHIDReportBuffer),
},

@ -131,10 +131,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_EPNUM),
.EndpointAddress = KEYBOARD_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPNUM 1
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPSIZE 8

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = KEYBOARD_EPADDR,
.Size = KEYBOARD_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},

@ -147,10 +147,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
.EndpointAddress = KEYBOARD_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID2_MouseInterface =
@ -184,10 +184,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
.EndpointAddress = MOUSE_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -62,11 +62,11 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_IN_EPNUM 3
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Size in bytes of each of the HID reporting IN endpoints. */
#define HID_EPSIZE 8

@ -52,11 +52,12 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = KEYBOARD_IN_EPADDR,
.Size = HID_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},
@ -72,10 +73,12 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
.Config =
{
.InterfaceNumber = 1,
.ReportINEndpointNumber = MOUSE_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE,
.ReportINEndpoint =
{
.Address = MOUSE_IN_EPADDR,
.Size = HID_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
},

@ -194,10 +194,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | HID_IN_EPNUM),
.EndpointAddress = HID_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the HID reporting IN endpoint. */
#define HID_IN_EPNUM 1
/** Endpoint address of the HID reporting IN endpoint. */
#define HID_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of each of the HID reporting IN endpoint. */
#define HID_EPSIZE 8

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Device_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = HID_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = HID_IN_EPADDR,
.Size = HID_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},

@ -199,10 +199,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
.EndpointAddress = MIDI_STREAM_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,
@ -224,10 +224,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM),
.EndpointAddress = MIDI_STREAM_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,

@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 2
/** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPNUM 1
/** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64

@ -45,14 +45,18 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
.Config =
{
.StreamingInterfaceNumber = 1,
.DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
.DataINEndpointSize = MIDI_STREAM_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
.DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MIDI_STREAM_IN_EPADDR,
.Size = MIDI_STREAM_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MIDI_STREAM_OUT_EPADDR,
.Size = MIDI_STREAM_EPSIZE,
.Banks = 1,
},
},
};
@ -74,7 +78,7 @@ int main(void)
MIDI_EventPacket_t ReceivedMIDIEvent;
while (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
{
if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (ReceivedMIDIEvent.Data3 > 0))
if ((ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) && (ReceivedMIDIEvent.Data3 > 0))
LEDs_SetAllLEDs(ReceivedMIDIEvent.Data2 > 64 ? LEDS_LED1 : LEDS_LED2);
else
LEDs_SetAllLEDs(LEDS_NO_LEDS);
@ -151,8 +155,7 @@ void CheckJoystickMovement(void)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
.Event = MIDI_EVENT(0, MIDICommand),
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,

@ -118,20 +118,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,11 +42,11 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

@ -45,15 +45,18 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
.Config =
{
.InterfaceNumber = 0,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = TOTAL_LUNS,
},
};

@ -133,20 +133,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID_KeyboardInterface =
@ -180,10 +180,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_EPNUM),
.EndpointAddress = KEYBOARD_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -43,17 +43,17 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPNUM 1
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPSIZE 8
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

@ -46,15 +46,18 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
.Config =
{
.InterfaceNumber = 0,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = TOTAL_LUNS,
},
};
@ -71,11 +74,12 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.Config =
{
.InterfaceNumber = 1,
.ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = KEYBOARD_EPADDR,
.Size = KEYBOARD_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},

@ -136,10 +136,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_EPNUM),
.EndpointAddress = MOUSE_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -41,6 +41,13 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@ -56,13 +63,6 @@
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = MOUSE_EPADDR,
.Size = MOUSE_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
},

@ -131,7 +131,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -157,20 +157,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.RNDIS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -45,19 +45,24 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
.AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDRESS},
},

@ -143,7 +143,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -169,20 +169,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -44,19 +44,25 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};

@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -183,20 +183,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_Interface =
@ -219,20 +219,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 1
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 2
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 3
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 3)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@ -57,11 +57,11 @@
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 4
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 4)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 5
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 5)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

@ -45,18 +45,24 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
@ -69,15 +75,18 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
.Config =
{
.InterfaceNumber = 2,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = TOTAL_LUNS,
},
};

@ -176,7 +176,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -202,20 +202,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID_Interface =
@ -249,10 +249,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_EPNUM),
.EndpointAddress = MOUSE_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@ -57,8 +57,8 @@
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8

@ -45,18 +45,24 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
@ -72,11 +78,12 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
.Config =
{
.InterfaceNumber = 2,
.ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = MOUSE_EPADDR,
.Size = MOUSE_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
},

@ -89,7 +89,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
Header: {Size: sizeof(USB_Descriptor_Endpoint_t), Type: DTYPE_Endpoint},
EndpointAddress: (ENDPOINT_DIR_IN | SIDESHOW_IN_EPNUM),
EndpointAddress: SIDESHOW_IN_EPADDR,
Attributes: EP_TYPE_BULK,
EndpointSize: SIDESHOW_IO_EPSIZE,
PollingIntervalMS: 0x00
@ -99,7 +99,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
Header: {Size: sizeof(USB_Descriptor_Endpoint_t), Type: DTYPE_Endpoint},
EndpointAddress: (ENDPOINT_DIR_OUT | SIDESHOW_OUT_EPNUM),
EndpointAddress: SIDESHOW_OUT_EPADDR,
Attributes: EP_TYPE_BULK,
EndpointSize: SIDESHOW_IO_EPSIZE,
PollingIntervalMS: 0x00

@ -39,8 +39,8 @@
#include "Sideshow.h"
/* Macros: */
#define SIDESHOW_IN_EPNUM 3
#define SIDESHOW_OUT_EPNUM 4
#define SIDESHOW_IN_EPADDR 3
#define SIDESHOW_OUT_EPADDR 4
#define SIDESHOW_IO_EPSIZE 64
/* Type Defines: */

@ -47,7 +47,7 @@ void Sideshow_ProcessCommandPacket(void)
{
SideShow_PacketHeader_t PacketHeader;
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPADDR);
Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
PacketHeader.Type.TypeFields.Response = true;
@ -110,7 +110,7 @@ void Sideshow_ProcessCommandPacket(void)
PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
PacketHeader.Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
@ -122,7 +122,7 @@ static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader)
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -137,7 +137,7 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader)
if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID)))
PacketHeader->Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t), NULL);
Endpoint_ClearIN();
@ -149,7 +149,7 @@ static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + UserSID.LengthInBytes;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
SideShow_Write_Unicode_String(&UserSID);
Endpoint_ClearIN();
@ -162,7 +162,7 @@ static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -254,7 +254,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
Property.PropertyGUID.Chunks[2], Property.PropertyGUID.Chunks[3]);
}
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
if (!(PacketHeader->Type.TypeFields.NAK))
@ -288,7 +288,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
SideShow_Write_Unicode_String(UnicodeStruct);
Endpoint_ClearIN();
@ -309,7 +309,7 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHe
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t));
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_32_LE(TotalApplications);
@ -330,7 +330,7 @@ static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const Packet
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_32_LE(1);
Endpoint_Write_Stream_LE(&SupportedEndpointGUID, sizeof(GUID_t), NULL);
@ -377,7 +377,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -398,7 +398,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -410,7 +410,7 @@ static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* const Packet
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
InstalledApplications[App].InUse = false;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -440,7 +440,7 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -465,7 +465,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -488,7 +488,7 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPADDR);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}

@ -101,10 +101,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Sideshow Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(SIDESHOW_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
SIDESHOW_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(SIDESHOW_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
SIDESHOW_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(SIDESHOW_IN_EPADDR, EP_TYPE_BULK, SIDESHOW_IO_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(SIDESHOW_OUT_EPADDR, EP_TYPE_BULK, SIDESHOW_IO_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -142,7 +140,7 @@ void SideShow_Task(void)
return;
/* Select the SideShow data out endpoint */
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPADDR);
/* Check to see if a new SideShow message has been received */
if (Endpoint_IsReadWriteAllowed())

@ -119,27 +119,27 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | TMC_OUT_EPNUM),
.EndpointAddress = TMC_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.TM_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | TMC_IN_EPNUM),
.EndpointAddress = TMC_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.TM_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | TMC_NOTIFICATION_EPNUM),
.EndpointAddress = TMC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF

@ -43,20 +43,20 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the TMC notification IN endpoint. */
#define TMC_NOTIFICATION_EPNUM 2
/** Endpoint address of the TMC notification IN endpoint. */
#define TMC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the TMC device-to-host data IN endpoint. */
#define TMC_IN_EPNUM 3
/** Endpoint address of the TMC device-to-host data IN endpoint. */
#define TMC_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the TMC host-to-device data OUT endpoint. */
#define TMC_OUT_EPNUM 4
/** Endpoint address of the TMC host-to-device data OUT endpoint. */
#define TMC_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the TMC data endpoints. */
#define TMC_IO_EPSIZE 64
#define TMC_IO_EPSIZE 64
/** Size in bytes of the TMC notification endpoint. */
#define TMC_NOTIFICATION_EPSIZE 8
#define TMC_NOTIFICATION_EPSIZE 8
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -129,12 +129,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup TMC In, Out and Notification Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, TMC_IO_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_IN_EPADDR, EP_TYPE_BULK, TMC_IO_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_OUT_EPADDR, EP_TYPE_BULK, TMC_IO_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -418,7 +415,7 @@ bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader)
uint8_t ErrorCode;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(TMC_OUT_EPNUM);
Endpoint_SelectEndpoint(TMC_OUT_EPADDR);
/* Abort if no command has been sent from the host */
if (!(Endpoint_IsOUTReceived()))
@ -450,7 +447,7 @@ bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader)
MessageHeader->InverseTag = ~CurrentTransferTag;
/* Select the Data In endpoint */
Endpoint_SelectEndpoint(TMC_IN_EPNUM);
Endpoint_SelectEndpoint(TMC_IN_EPADDR);
/* Send the command header to the host */
BytesTransferred = 0;

@ -118,8 +118,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Audio Stream Endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, ENDPOINT_DIR_IN,
AUDIO_STREAM_EPSIZE, ENDPOINT_BANK_DOUBLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPADDR, EP_TYPE_ISOCHRONOUS, AUDIO_STREAM_EPSIZE, 2);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -165,7 +164,7 @@ void EVENT_USB_Device_ControlRequest(void)
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */
if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
@ -190,7 +189,7 @@ void EVENT_USB_Device_ControlRequest(void)
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */
if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
@ -215,7 +214,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
/* Select the audio stream endpoint */
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
Endpoint_SelectEndpoint(AUDIO_STREAM_EPADDR);
/* Check if the current endpoint can be written to and that the audio interface is enabled */
if (Endpoint_IsINReady() && StreamingAudioInterfaceSelected)

@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM),
.EndpointAddress = AUDIO_STREAM_EPADDR,
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 0x01

@ -42,14 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
/** Endpoint address of the Audio isochronous streaming data IN endpoint. */
#define AUDIO_STREAM_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPSIZE 256
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -144,8 +144,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Audio Stream Endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, ENDPOINT_DIR_OUT,
AUDIO_STREAM_EPSIZE, ENDPOINT_BANK_DOUBLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPADDR, EP_TYPE_ISOCHRONOUS, AUDIO_STREAM_EPSIZE, 2);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -191,7 +190,7 @@ void EVENT_USB_Device_ControlRequest(void)
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */
if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
@ -216,7 +215,7 @@ void EVENT_USB_Device_ControlRequest(void)
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */
if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
@ -241,7 +240,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
/* Select the audio stream endpoint */
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
Endpoint_SelectEndpoint(AUDIO_STREAM_EPADDR);
/* Check if the current endpoint can be read from (contains a packet) and the host is sending data */
if (Endpoint_IsOUTReceived() && StreamingAudioInterfaceSelected)

@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM),
.EndpointAddress = AUDIO_STREAM_EPADDR,
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 0x01

@ -42,14 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
/** Endpoint address of the Audio isochronous streaming data OUT endpoint. */
#define AUDIO_STREAM_EPADDR (ENDPOINT_DIR_OUT | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPSIZE 256
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC1_NOTIFICATION_EPNUM),
.EndpointAddress = CDC1_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -183,20 +183,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC1_RX_EPNUM),
.EndpointAddress = CDC1_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC1_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC1_TX_EPNUM),
.EndpointAddress = CDC1_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC2_IAD =
@ -258,7 +258,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC2_NOTIFICATION_EPNUM),
.EndpointAddress = CDC2_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -284,20 +284,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC2_RX_EPNUM),
.EndpointAddress = CDC2_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC2_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC2_TX_EPNUM),
.EndpointAddress = CDC2_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,23 +42,23 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPNUM 1
/** Endpoint address of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPNUM 2
/** Endpoint address of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint address of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPNUM 4
/** Endpoint address of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPADDR (ENDPOINT_DIR_IN | 4)
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPNUM 5
/** Endpoint address of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPADDR (ENDPOINT_DIR_OUT | 5)
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 6
/** Endpoint address of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -123,20 +123,14 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup first CDC Interface's Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1);
/* Setup second CDC Interface's Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1);
/* Reset line encoding baud rates so that the host knows to send new values */
LineEncoding1.BaudRateBPS = 0;
@ -224,7 +218,7 @@ void CDC1_Task(void)
ActionSent = true;
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC1_TX_EPNUM);
Endpoint_SelectEndpoint(CDC1_TX_EPADDR);
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString), NULL);
@ -240,7 +234,7 @@ void CDC1_Task(void)
}
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC1_RX_EPNUM);
Endpoint_SelectEndpoint(CDC1_RX_EPADDR);
/* Throw away any received data from the host */
if (Endpoint_IsOUTReceived())
@ -257,7 +251,7 @@ void CDC2_Task(void)
return;
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC2_RX_EPNUM);
Endpoint_SelectEndpoint(CDC2_RX_EPADDR);
/* Check to see if any data has been received */
if (Endpoint_IsOUTReceived())
@ -275,7 +269,7 @@ void CDC2_Task(void)
Endpoint_ClearOUT();
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC2_TX_EPNUM);
Endpoint_SelectEndpoint(CDC2_TX_EPADDR);
/* Write the received data to the endpoint */
Endpoint_Write_Stream_LE(&Buffer, DataLength, NULL);

@ -143,20 +143,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | GENERIC_IN_EPNUM),
.EndpointAddress = GENERIC_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | GENERIC_OUT_EPNUM),
.EndpointAddress = GENERIC_OUT_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -58,11 +58,11 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPNUM 1
/** Endpoint address of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the Generic HID reporting OUT endpoint. */
#define GENERIC_OUT_EPNUM 2
/** Endpoint address of the Generic HID reporting OUT endpoint. */
#define GENERIC_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8

@ -95,10 +95,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup HID Report Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
GENERIC_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
GENERIC_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_IN_EPADDR, EP_TYPE_INTERRUPT, GENERIC_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(GENERIC_OUT_EPADDR, EP_TYPE_INTERRUPT, GENERIC_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -200,7 +198,7 @@ void HID_Task(void)
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM);
Endpoint_SelectEndpoint(GENERIC_OUT_EPADDR);
/* Check to see if a packet has been sent from the host */
if (Endpoint_IsOUTReceived())
@ -222,7 +220,7 @@ void HID_Task(void)
Endpoint_ClearOUT();
}
Endpoint_SelectEndpoint(GENERIC_IN_EPNUM);
Endpoint_SelectEndpoint(GENERIC_IN_EPADDR);
/* Check to see if the host is ready to accept another packet */
if (Endpoint_IsINReady())

@ -155,10 +155,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | JOYSTICK_EPNUM),
.EndpointAddress = JOYSTICK_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = JOYSTICK_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPNUM 1
/** Endpoint address of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPSIZE 8

@ -96,8 +96,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup HID Report Endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
JOYSTICK_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(JOYSTICK_EPADDR, EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -183,7 +182,7 @@ void HID_Task(void)
return;
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_EPNUM);
Endpoint_SelectEndpoint(JOYSTICK_EPADDR);
/* Check to see if the host is ready for another packet */
if (Endpoint_IsINReady())

@ -160,20 +160,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
.EndpointAddress = KEYBOARD_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | KEYBOARD_OUT_EPNUM),
.EndpointAddress = KEYBOARD_OUT_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -59,11 +59,11 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the Keyboard HID reporting OUT endpoint. */
#define KEYBOARD_OUT_EPNUM 2
/** Endpoint address of the Keyboard HID reporting OUT endpoint. */
#define KEYBOARD_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8

@ -117,10 +117,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup HID Report Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1);
/* Turn on Start-of-Frame events for tracking HID report period expiry */
USB_Device_EnableSOFEvents();
@ -315,7 +313,7 @@ void SendNextReport(void)
}
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
Endpoint_SelectEndpoint(KEYBOARD_IN_EPADDR);
/* Check if Keyboard Endpoint Ready for Read/Write and if we should send a new report */
if (Endpoint_IsReadWriteAllowed() && SendReport)
@ -335,7 +333,7 @@ void SendNextReport(void)
void ReceiveNextReport(void)
{
/* Select the Keyboard LED Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_OUT_EPNUM);
Endpoint_SelectEndpoint(KEYBOARD_OUT_EPADDR);
/* Check if Keyboard LED Endpoint contains a packet */
if (Endpoint_IsOUTReceived())

@ -195,20 +195,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
.EndpointAddress = KEYBOARD_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID1_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | KEYBOARD_OUT_EPNUM),
.EndpointAddress = KEYBOARD_OUT_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID2_MouseInterface =
@ -242,10 +242,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
.EndpointAddress = MOUSE_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -65,14 +65,14 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the Keyboard HID reporting OUT endpoint. */
#define KEYBOARD_OUT_EPNUM 2
/** Endpoint address of the Keyboard HID reporting OUT endpoint. */
#define KEYBOARD_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_IN_EPNUM 3
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Size in bytes of each of the HID reporting IN and OUT endpoints. */
#define HID_EPSIZE 8

@ -104,14 +104,11 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Keyboard HID Report Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPADDR, EP_TYPE_INTERRUPT, HID_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPADDR, EP_TYPE_INTERRUPT, HID_EPSIZE, 1);
/* Setup Mouse HID Report Endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_IN_EPADDR, EP_TYPE_INTERRUPT, HID_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -236,7 +233,7 @@ void Keyboard_HID_Task(void)
}
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
Endpoint_SelectEndpoint(KEYBOARD_IN_EPADDR);
/* Check if Keyboard Endpoint Ready for Read/Write */
if (Endpoint_IsReadWriteAllowed())
@ -252,7 +249,7 @@ void Keyboard_HID_Task(void)
}
/* Select the Keyboard LED Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_OUT_EPNUM);
Endpoint_SelectEndpoint(KEYBOARD_OUT_EPADDR);
/* Check if Keyboard LED Endpoint Ready for Read/Write */
if (Endpoint_IsReadWriteAllowed())
@ -294,7 +291,7 @@ void Mouse_HID_Task(void)
}
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
Endpoint_SelectEndpoint(MOUSE_IN_EPADDR);
/* Check if Mouse Endpoint Ready for Read/Write */
if (Endpoint_IsReadWriteAllowed())

@ -199,10 +199,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
.EndpointAddress = MIDI_STREAM_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,
@ -224,10 +224,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM),
.EndpointAddress = MIDI_STREAM_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,

@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 1
/** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPNUM 2
/** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64

@ -94,10 +94,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup MIDI Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -114,7 +112,7 @@ void MIDI_Task(void)
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPNUM);
Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPADDR);
if (Endpoint_IsINReady())
{
@ -162,8 +160,7 @@ void MIDI_Task(void)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
.Event = MIDI_EVENT(0, MIDICommand),
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
@ -182,7 +179,7 @@ void MIDI_Task(void)
}
/* Select the MIDI OUT stream */
Endpoint_SelectEndpoint(MIDI_STREAM_OUT_EPNUM);
Endpoint_SelectEndpoint(MIDI_STREAM_OUT_EPADDR);
/* Check if a MIDI command has been received */
if (Endpoint_IsOUTReceived())
@ -193,7 +190,7 @@ void MIDI_Task(void)
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
/* Check to see if the sent command is a note on message with a non-zero velocity */
if ((MIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (MIDIEvent.Data3 > 0))
if ((MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) && (MIDIEvent.Data3 > 0))
{
/* Change LEDs depending on the pitch of the sent note */
LEDs_SetAllLEDs(MIDIEvent.Data2 > 64 ? LEDS_LED1 : LEDS_LED2);

@ -118,20 +118,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

@ -118,10 +118,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Mass Storage Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
MASS_STORAGE_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
MASS_STORAGE_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPADDR, EP_TYPE_BULK, MASS_STORAGE_IO_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPADDR, EP_TYPE_BULK, MASS_STORAGE_IO_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -180,7 +178,7 @@ void MassStorage_Task(void)
/* Check direction of command, select Data IN endpoint if data is from the device */
if (CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
/* Decode the received SCSI command, set returned status code */
CommandStatus.Status = SCSI_DecodeSCSICommand() ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
@ -206,13 +204,13 @@ void MassStorage_Task(void)
if (IsMassStoreReset)
{
/* Reset the data endpoint banks */
Endpoint_ResetEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_ResetEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_ResetEndpoint(MASS_STORAGE_OUT_EPADDR);
Endpoint_ResetEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
@ -231,7 +229,7 @@ static bool ReadInCommandBlock(void)
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
/* Abort if no command has been sent from the host */
if (!(Endpoint_IsOUTReceived()))
@ -256,7 +254,7 @@ static bool ReadInCommandBlock(void)
{
/* Stall both data pipes until reset by host */
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_StallTransaction();
return false;
@ -286,7 +284,7 @@ static void ReturnCommandStatus(void)
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
/* While data pipe is stalled, wait until the host issues a control request to clear the stall */
while (Endpoint_IsStalled())
@ -297,7 +295,7 @@ static void ReturnCommandStatus(void)
}
/* Select the Data In endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
/* While data pipe is stalled, wait until the host issues a control request to clear the stall */
while (Endpoint_IsStalled())

@ -155,10 +155,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_EPNUM),
.EndpointAddress = MOUSE_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -41,6 +41,13 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@ -56,13 +63,6 @@
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -116,8 +116,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup HID Report Endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_EPADDR, EP_TYPE_INTERRUPT, MOUSE_EPSIZE, 1);
/* Turn on Start-of-Frame events for tracking HID report period expiry */
USB_Device_EnableSOFEvents();
@ -271,7 +270,7 @@ void SendNextReport(void)
}
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_EPNUM);
Endpoint_SelectEndpoint(MOUSE_EPADDR);
/* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */
if (Endpoint_IsReadWriteAllowed() && SendReport)

@ -131,7 +131,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -157,20 +157,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.RNDIS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3)
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 64

@ -104,12 +104,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup RNDIS Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -170,7 +167,7 @@ void EVENT_USB_Device_ControlRequest(void)
void RNDIS_Task(void)
{
/* Select the notification endpoint */
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPADDR);
/* Check if a message response is ready for the host */
if (Endpoint_IsINReady() && ResponseReady)
@ -201,7 +198,7 @@ void RNDIS_Task(void)
RNDIS_Packet_Message_t RNDISPacketHeader;
/* Select the data OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
Endpoint_SelectEndpoint(CDC_RX_EPADDR);
/* Check if the data OUT endpoint contains data, and that the IN buffer is empty */
if (Endpoint_IsOUTReceived() && !(FrameIN.FrameLength))
@ -227,7 +224,7 @@ void RNDIS_Task(void)
}
/* Select the data IN endpoint */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
Endpoint_SelectEndpoint(CDC_TX_EPADDR);
/* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */
if (Endpoint_IsINReady() && FrameOUT.FrameLength)

@ -143,7 +143,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -169,20 +169,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -109,12 +109,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup CDC Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
/* Reset line encoding baud rate so that the host knows to send new values */
LineEncoding.BaudRateBPS = 0;
@ -201,7 +198,7 @@ void CDC_Task(void)
ActionSent = true;
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
Endpoint_SelectEndpoint(CDC_TX_EPADDR);
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString), NULL);
@ -225,7 +222,7 @@ void CDC_Task(void)
}
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
Endpoint_SelectEndpoint(CDC_RX_EPADDR);
/* Throw away any received data from the host */
if (Endpoint_IsOUTReceived())

@ -136,10 +136,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_EPNUM),
.EndpointAddress = MOUSE_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -57,8 +57,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
/** Endpoint address of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = MOUSE_EPADDR,
.Size = MOUSE_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
},

@ -44,9 +44,16 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Host_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataOUTPipeNumber = 2,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataINPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_MouseBootProtocol,
},
};

@ -44,12 +44,16 @@ USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.PropertyStrings =
{
[AOA_STRING_Manufacturer] = "Dean Camera",

@ -44,7 +44,10 @@ USB_ClassInfo_Audio_Host_t Microphone_Audio_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
},
},
};
@ -179,7 +182,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
}
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
if (Audio_Host_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipeNumber,
if (Audio_Host_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipe.Address,
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
{

@ -44,7 +44,10 @@ USB_ClassInfo_Audio_Host_t Speaker_Audio_Interface =
{
.Config =
{
.DataOUTPipeNumber = 1,
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
},
},
};
@ -187,7 +190,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
}
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
if (Audio_Host_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipeNumber,
if (Audio_Host_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipe.Address,
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
{

@ -47,14 +47,17 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
};

@ -44,12 +44,16 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_KeyboardBootProtocol,
},
};

@ -47,14 +47,17 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
};

@ -44,11 +44,16 @@ USB_ClassInfo_MIDI_Host_t Keyboard_MIDI_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
},
};
@ -106,8 +111,8 @@ void JoystickHost_Task(void)
MIDI_EventPacket_t MIDIEvent;
while (MIDI_Host_ReceiveEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent))
{
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
bool NoteOnEvent = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON));
bool NoteOffEvent = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_OFF));
/* Display note events from the host */
if (NoteOnEvent || NoteOffEvent)
@ -168,8 +173,7 @@ void CheckJoystickMovement(void)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
.Event = MIDI_EVENT(0, MIDICommand),
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,

@ -44,11 +44,16 @@ USB_ClassInfo_MS_Host_t FlashDisk_MS_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
},
};

@ -44,12 +44,16 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_MouseBootProtocol,
},
};

@ -47,14 +47,17 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
};

@ -44,11 +44,16 @@ USB_ClassInfo_PRNT_Host_t Printer_PRNT_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
},
};

@ -47,16 +47,22 @@ USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
.HostMaxPacketSize = sizeof(PacketBuffer),
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.NotificationPipe =
{
.Address = (PIPE_DIR_IN | 3),
.Banks = 1,
},
.HostMaxPacketSize = sizeof(PacketBuffer),
},
};

@ -44,14 +44,21 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.EventsPipeNumber = 3,
.EventsPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.EventsPipe =
{
.Address = (PIPE_DIR_IN | 3),
.Banks = 1,
},
},
};

@ -44,14 +44,21 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.NotificationPipe =
{
.Address = (PIPE_DIR_IN | 3),
.Banks = 1,
},
},
};

@ -105,16 +105,13 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the Bluetooth data IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the Bluetooth data OUT pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(BLUETOOTH_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Configure the Bluetooth events pipe */
Pipe_ConfigurePipe(BLUETOOTH_EVENTS_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(BLUETOOTH_EVENTS_PIPE, EP_TYPE_INTERRUPT, EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(EventsEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -40,9 +40,9 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#define BLUETOOTH_DATA_IN_PIPE 1
#define BLUETOOTH_DATA_OUT_PIPE 2
#define BLUETOOTH_EVENTS_PIPE 3
#define BLUETOOTH_DATA_IN_PIPE (PIPE_DIR_IN | 1)
#define BLUETOOTH_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
#define BLUETOOTH_EVENTS_PIPE (PIPE_DIR_IN | 3)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -95,12 +95,10 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the Android Accessory data IN pipe */
Pipe_ConfigurePipe(ANDROID_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(ANDROID_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the Android Accessory data OUT pipe */
Pipe_ConfigurePipe(ANDROID_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(ANDROID_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -40,8 +40,11 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#define ANDROID_DATA_IN_PIPE 1
#define ANDROID_DATA_OUT_PIPE 2
/** Pipe address of the Android Accessory data IN pipe. */
#define ANDROID_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe address of the Android Accessory data OUT pipe. */
#define ANDROID_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -130,8 +130,7 @@ uint8_t ProcessConfigurationDescriptor(void)
StreamingEndpointAddress = DataINEndpoint->EndpointAddress;
/* Configure the Audio data IN pipe */
Pipe_ConfigurePipe(AUDIO_DATA_IN_PIPE, EP_TYPE_ISOCHRONOUS, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_DOUBLE);
Pipe_ConfigurePipe(AUDIO_DATA_IN_PIPE, EP_TYPE_ISOCHRONOUS, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 2);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -42,8 +42,8 @@
#include "AudioInputHost.h"
/* Macros: */
/** Pipe number for the Audio data IN pipe. */
#define AUDIO_DATA_IN_PIPE 1
/** Pipe address for the Audio data IN pipe. */
#define AUDIO_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - Audio Input Host"
PROJECT_NAME = "LUFA Library - Audio Input Host Demo"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -130,8 +130,7 @@ uint8_t ProcessConfigurationDescriptor(void)
StreamingEndpointAddress = DataOUTEndpoint->EndpointAddress;
/* Configure the Audio data OUT pipe */
Pipe_ConfigurePipe(AUDIO_DATA_OUT_PIPE, EP_TYPE_ISOCHRONOUS, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_DOUBLE);
Pipe_ConfigurePipe(AUDIO_DATA_OUT_PIPE, EP_TYPE_ISOCHRONOUS, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 2);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -42,8 +42,8 @@
#include "AudioOutputHost.h"
/* Macros: */
/** Pipe number for the Audio data OUT pipe. */
#define AUDIO_DATA_OUT_PIPE 1
/** Pipe address for the Audio data OUT pipe. */
#define AUDIO_DATA_OUT_PIPE (PIPE_DIR_OUT | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - Audio Output Host"
PROJECT_NAME = "LUFA Library - Audio Output Host Demo"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -109,16 +109,14 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Check if the HID interface contained an optional OUT data endpoint */
if (DataOUTEndpoint)
{
/* Configure the HID data OUT pipe */
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
}
/* Valid data found, return success */

@ -42,11 +42,11 @@
#include "GenericHIDHost.h"
/* Macros: */
/** Pipe number for the HID data IN pipe. */
#define HID_DATA_IN_PIPE 1
/** Pipe address for the HID data IN pipe. */
#define HID_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE 2
/** Pipe address for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -110,8 +110,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(JOYSTICK_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(JOYSTICK_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Get the HID report size from the HID report descriptor */

@ -42,8 +42,8 @@
#include "HIDReport.h"
/* Macros: */
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1
/** Pipe address for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - Joystick Host (Using HID Descriptor Parser)"
PROJECT_NAME = "LUFA Library - Joystick Host Demo (Using HID Descriptor Parser)"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -98,8 +98,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -42,8 +42,8 @@
#include "KeyboardHost.h"
/* Macros: */
/** Pipe number for the keyboard data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
/** Pipe address for the keyboard data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -110,8 +110,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Get the HID report size from the HID report descriptor */

@ -42,8 +42,8 @@
#include "HIDReport.h"
/* Macros: */
/** Pipe number for the keyboard report data pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
/** Pipe address for the keyboard report data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - Keyboard Host (Using HID Descriptor Parser)"
PROJECT_NAME = "LUFA Library - Keyboard Host Demo (Using HID Descriptor Parser)"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -105,12 +105,10 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the MIDI data IN pipe */
Pipe_ConfigurePipe(MIDI_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MIDI_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the MIDI data OUT pipe */
Pipe_ConfigurePipe(MIDI_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MIDI_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -42,11 +42,11 @@
#include "MIDIHost.h"
/* Macros: */
/** Pipe number for the MIDI data IN pipe. */
#define MIDI_DATA_IN_PIPE 1
/** Pipe address for the MIDI data IN pipe. */
#define MIDI_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number for the MIDI data OUT pipe. */
#define MIDI_DATA_OUT_PIPE 2
/** Pipe address for the MIDI data OUT pipe. */
#define MIDI_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -177,8 +177,8 @@ void MIDIHost_Task(void)
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
bool NoteOnEvent = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON));
bool NoteOffEvent = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_OFF));
if (NoteOnEvent || NoteOffEvent)
{
@ -237,8 +237,7 @@ void MIDIHost_Task(void)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
.Event = MIDI_EVENT(0, MIDICommand),
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,

@ -105,12 +105,10 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the Mass Storage data IN pipe */
Pipe_ConfigurePipe(MASS_STORE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MASS_STORE_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the Mass Storage data OUT pipe */
Pipe_ConfigurePipe(MASS_STORE_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MASS_STORE_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -51,11 +51,11 @@
/** Interface Protocol value for the Bulk Only transport protocol. */
#define MASS_STORE_PROTOCOL 0x50
/** Pipe number of the Mass Storage data IN pipe. */
#define MASS_STORE_DATA_IN_PIPE 1
/** Pipe address of the Mass Storage data IN pipe. */
#define MASS_STORE_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number of the Mass Storage data OUT pipe. */
#define MASS_STORE_DATA_OUT_PIPE 2
/** Pipe address of the Mass Storage data OUT pipe. */
#define MASS_STORE_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -98,8 +98,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -42,8 +42,8 @@
#include "MouseHost.h"
/* Macros: */
/** Pipe number for the mouse data IN pipe. */
#define MOUSE_DATA_IN_PIPE 1
/** Pipe address for the mouse data IN pipe. */
#define MOUSE_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -110,8 +110,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Get the HID report size from the HID report descriptor */

@ -42,8 +42,8 @@
#include "HIDReport.h"
/* Macros: */
/** Pipe number for the mouse report data pipe. */
#define MOUSE_DATA_IN_PIPE 1
/** Pipe address for the mouse report data IN pipe. */
#define MOUSE_DATA_IN_PIPE (ENDPOINT_DIR_IN | 1)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - Mouse Host (Using HID Descriptor Parser)"
PROJECT_NAME = "LUFA Library - Mouse Host Demo (Using HID Descriptor Parser)"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -108,12 +108,10 @@ uint8_t ProcessConfigurationDescriptor(void)
PrinterAltSetting = PrinterInterface->AlternateSetting;
/* Configure the Printer data IN pipe */
Pipe_ConfigurePipe(PRINTER_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(PRINTER_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the Printer data OUT pipe */
Pipe_ConfigurePipe(PRINTER_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(PRINTER_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Valid data found, return success */
return SuccessfulConfigRead;

@ -38,11 +38,11 @@
#include "Lib/PrinterCommands.h"
/* Macros: */
/** Pipe number of the Printer data IN pipe. */
#define PRINTER_DATA_IN_PIPE 1
/** Pipe address of the Printer data IN pipe. */
#define PRINTER_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number of the Printer data OUT pipe. */
#define PRINTER_DATA_OUT_PIPE 2
/** Pipe address of the Printer data OUT pipe. */
#define PRINTER_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -131,16 +131,13 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the RNDIS data IN pipe */
Pipe_ConfigurePipe(RNDIS_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(RNDIS_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the RNDIS data OUT pipe */
Pipe_ConfigurePipe(RNDIS_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(RNDIS_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Configure the RNDIS notification pipe */
Pipe_ConfigurePipe(RNDIS_NOTIFICATION_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(RNDIS_NOTIFICATION_PIPE, EP_TYPE_INTERRUPT, NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(NotificationEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -42,14 +42,14 @@
#include "RNDISEthernetHost.h"
/* Macros: */
/** Pipe number for the RNDIS data IN pipe. */
#define RNDIS_DATA_IN_PIPE 1
/** Pipe address for the RNDIS data IN pipe. */
#define RNDIS_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number for the RNDIS data OUT pipe. */
#define RNDIS_DATA_OUT_PIPE 2
/** Pipe address for the RNDIS data OUT pipe. */
#define RNDIS_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/** Pipe number for the RNDIS notification pipe. */
#define RNDIS_NOTIFICATION_PIPE 3
/** Pipe address for the RNDIS notification IN pipe. */
#define RNDIS_NOTIFICATION_PIPE (PIPE_DIR_IN | 3)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -115,16 +115,13 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the Still Image data IN pipe */
Pipe_ConfigurePipe(SIMAGE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(SIMAGE_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the Still Image data OUT pipe */
Pipe_ConfigurePipe(SIMAGE_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(SIMAGE_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Configure the Still Image events pipe */
Pipe_ConfigurePipe(SIMAGE_EVENTS_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(SIMAGE_EVENTS_PIPE, EP_TYPE_INTERRUPT, EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(EventsEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -42,14 +42,14 @@
#include "StillImageHost.h"
/* Macros: */
/** Pipe number of the Still Image data IN pipe. */
#define SIMAGE_DATA_IN_PIPE 1
/** Pipe address of the Still Image data IN pipe. */
#define SIMAGE_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number of the Still Image data OUT pipe. */
#define SIMAGE_DATA_OUT_PIPE 2
/** Pipe address of the Still Image data OUT pipe. */
#define SIMAGE_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/** Pipe number of the Still Image events pipe. */
#define SIMAGE_EVENTS_PIPE 3
/** Pipe address of the Still Image events IN pipe. */
#define SIMAGE_EVENTS_PIPE (PIPE_DIR_IN | 3)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -131,16 +131,13 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the CDC data IN pipe */
Pipe_ConfigurePipe(CDC_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(CDC_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
/* Configure the CDC data OUT pipe */
Pipe_ConfigurePipe(CDC_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(CDC_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
/* Configure the CDC notification pipe */
Pipe_ConfigurePipe(CDC_NOTIFICATION_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(CDC_NOTIFICATION_PIPE, EP_TYPE_INTERRUPT, NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(NotificationEndpoint->PollingIntervalMS);
/* Valid data found, return success */

@ -42,14 +42,14 @@
#include "VirtualSerialHost.h"
/* Macros: */
/** Pipe number for the CDC data IN pipe. */
#define CDC_DATA_IN_PIPE 1
/** Pipe address for the CDC data IN pipe. */
#define CDC_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number for the CDC data OUT pipe. */
#define CDC_DATA_OUT_PIPE 2
/** Pipe address for the CDC data OUT pipe. */
#define CDC_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/** Pipe number for the CDC notification pipe. */
#define CDC_NOTIFICATION_PIPE 3
/** Pipe address for the CDC notification IN pipe. */
#define CDC_NOTIFICATION_PIPE (PIPE_DIR_IN | 3)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

File diff suppressed because one or more lines are too long

@ -157,6 +157,10 @@
// #define NO_AUTO_VBUS_MANAGEMENT
// #define INVERTED_VBUS_ENABLE_LINE
#else
#error Unsupported architecture for this LUFA configuration file.
#endif
#endif

@ -63,25 +63,27 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
#if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__)
/** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG
* status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO
* mode.
*
* \note This macro is not available for all architectures.
*/
#define JTAG_DISABLE() MACROS{ \
__asm__ __volatile__ ( \
"in __tmp_reg__,__SREG__" "\n\t" \
"cli" "\n\t" \
"out %1, %0" "\n\t" \
"out __SREG__, __tmp_reg__" "\n\t" \
"out %1, %0" "\n\t" \
: \
: "r" (1 << JTD), \
"M" (_SFR_IO_ADDR(MCUCR)) \
: "r0"); \
}MACROE
#if (ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA) || defined(__DOXYGEN__)
#if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__)
/** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG
* status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO
* mode.
*
* \note This macro is not available for all architectures.
*/
#define JTAG_DISABLE() MACROS{ \
__asm__ __volatile__ ( \
"in __tmp_reg__,__SREG__" "\n\t" \
"cli" "\n\t" \
"out %1, %0" "\n\t" \
"out __SREG__, __tmp_reg__" "\n\t" \
"out %1, %0" "\n\t" \
: \
: "r" (1 << JTD), \
"M" (_SFR_IO_ADDR(MCUCR)) \
: "r0"); \
}MACROE
#endif
/** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer
@ -116,9 +118,10 @@
*
* \param[in] Condition Condition that will be evaluated,
*/
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #Condition); } }MACROE
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { \
printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #Condition); } }MACROE
#if !defined(pgm_read_ptr) || defined(__DOXYGEN__)
/** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the
@ -135,6 +138,14 @@
*/
#define pgm_read_ptr(Address) (void*)pgm_read_word(Address)
#endif
#elif (ARCH == ARCH_UC3)
#define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::)
#define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("breakpoint" ::)
#define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { \
printf("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #Condition); } }MACROE
#endif
/* Disable C linkage for C++ Compilers: */

@ -204,6 +204,16 @@
/** Selects the Bitwizard Big-Multio specific board drivers, including the driver for the board LEDs. */
#define BOARD_BIGMULTIO 46
/** Selects the DorkbotPDX Duce specific board drivers, including the driver for the board LEDs. */
#define BOARD_DUCE 47
/** Selects the Olimex AVR-USB-32U4 specific board drivers, including the Button and LED drivers. */
#define BOARD_OLIMEX32U4 48
/** Selects the Olimex AVR-USB-T32U4 specific board drivers, including the Button and LED drivers. */
#define BOARD_OLIMEXT32U4 49
#if !defined(__DOXYGEN__)
#define BOARD_ BOARD_NONE

@ -10,9 +10,15 @@
* <b>New:</b>
* - Core:
* - Added support for the BitWizard Multio and Big-Multio boards
* - Added support for the DorkbotPDX Duce board
* - Added support for the Olimex AVR-USB-32U4 board
* - Added support for the Olimex AVR-USB-T32U4 board
* - Added new Endpoint_ConfigureEndpointTable() function
* - Added new Pipe_ConfigurePipeTable() function
* - Library Applications:
* - Modified the CDC Host demos to set a default CDC Line Encoding on enumerated devices
* - Added Dataflash operational checks and aborts to all projects using the Dataflash to ensure it is working correctly before use
* - Added new SerialToLCD user project contributed by Simon Foster
*
* <b>Changed:</b>
* - Core:
@ -20,10 +26,26 @@
* - Audio Device Class driver changed to also require the index of the Audio Control interface within the device, for SET/GET/CUR/MIN/MAX/RES property adjustments
* - Removed variable axis support from the HID_DESCRIPTOR_JOYSTICK() macro due to OS incompatibilities, replaced with fixed 3-axis joystick report structure
* - Removed the old pseudo-scheduler from the library as it was unused and deprecated since the 090810 release
* - Endpoint indexes are now specified as full endpoint addresses within the device in device mode, rather than a logical index
* - The Endpoint_ConfigureEndpoint() function no longer takes an endpoint direction as a parameter, as this is now deduced from the specified full endpoint
* address and type
* - The Endpoint_ConfigureEndpoint() function no longer takes a number of banks as a special mask; the number of banks is now specified as an integer parameter
* - Endpoints are now configured via instances of a new struct USB_Endpoint_Table_t in all device mode class drivers, rather than a list of endpoint parameters
* - Pipe indexes are now specified as full pipe addresses within the host in host mode, rather than a logical index
* - The Pipe_ConfigurePipe() function no longer takes an pipe token as a parameter, as this is now deduced from the specified full pipe address and type
* - The Pipe_ConfigurePipe() function no longer takes a number of banks as a special mask; the number of banks is now specified as an integer parameter
* - Pipes are now configured via instances of a new struct USB_Pipe_Table_t in all host mode class drivers, rather than a list of pipe parameters
* - Added support for various assert and debugging macros for the UC3 devices
* - Changed MIDI event structure MIDI_EventPacket_t to use a single field for the combined virtual cable index and command ID, to prevent bitfield packing issues
* on some architectures (thanks to Darren Gibbs)
* - Changed board LED driver implementations of LEDs_ToggleLEDs() for the AVR8 architecture to use the fast PIN register toggle alternative function for speed
* - Library Applications:
* - Raised the guard bits in the AVRISP-MKII clone project when in PDI and TPI to 32, to prevent communication errors on low quality connections to a target
* - Added additional bootloader API data to expose the bootloader start address and class to the DFU and CDC class bootloaders
* - Reverted AVRISP-MKII clone project watchdog based command timeout patch in favour of a hardware timer, to allow for use in devices with WDTRST fuse programmed
* - The library bootloaders will now correctly start the user application after a watchdog-based application start, even if the /HWB line is held low externally
* during the reset phase
* - Increased endpoint polling interval for all demos and projects to 5ms, as 1ms was causing some enumeration issues on some machines (thanks to Riku Salminen)
*
* <b>Fixed:</b>
* - Core:
@ -33,11 +55,19 @@
* - Fixed compile error for the UC3 architecture when INTERRUPT_CONTROL_ENDPOINT is specified (thanks to Andrus Aaslaid)
* - Fixed compile error if LEDs_Disable() is called and BOARD=NONE is set (thanks to Sam Lin)
* - Fixed inverted LED logic in the OLIMEX162 board LED driver
* - Fixed incorrect reponse to GET STATUS requests in device mode if NO_DEVICE_SELF_POWER or NO_DEVICE_REMOTE_WAKEUP tokens are defined (thanks to Georg Glock)
* - Fixed inverted LED logic in the USB2AX board LED driver
* - Fixed possible deadlock in the CDC device driver if the USB connection is dropped while the CDC_REQ_SetLineEncoding control request is being processed by
* the stack (thanks to Jonathan Hudgins)
* - Fixed broken MIDI host driver MIDI_Host_ReceiveEventPacket() function due to not unfreezing the MIDI data IN pipe before use (thanks to Michael Brown)
* - Library Applications:
* - Fixed error in the AVRISP-MKII programmer when ISP mode is used at 64KHz (thanks to Ben R. Porter)
* - Fixed AVRISP-MKII programmer project failing to compile for the U4 chips when VTARGET_ADC_CHANNEL is defined to an invalid channel and NO_VTARGET_DETECT is
* defined (thanks to Steven Morehouse)
* - Fixed AVRISP-MKII programmer project reset line polarity inverted when the generated EEP file is loaded into the USB AVR's EEPROM and avr-dude is used
* - Fixed CDC and DFU bootloaders failing to compile when the bootloader section size is 8KB or more (thanks to Georg Glock)
* - Fixed incorrect DFU version number reported to the host in the DFU bootloader descriptors (thanks to Georg Glock)
* - Fixed incorrect version hundredths value encoding in VERSION_BCD() macro (thanks to Georg Glock)
*
* \section Sec_ChangeLog120219 Version 120219
* <b>New:</b>

@ -106,6 +106,7 @@
* - Busware BUI
* - Busware CUL V3
* - Busware TUL
* - DorkbotPDX Duce
* - Fletchtronics Bumble-B (using manufacturer recommended peripheral layout)
* - Kernel Concepts USBFOO
* - Linnix UDIP
@ -115,6 +116,8 @@
* - Microsin AVR-USB162
* - Minimus USB
* - Olimex AVR-USB-162
* - Olimex AVR-USB-32U4
* - Olimex AVR-USB-T32U4
* - Paranoid Studio's US2AX (V1, V2 and V3 hardware revisions)
* - PJRC Teensy (1.x and 2.x versions)
* - Sparkfun U2 Breakout Board
@ -377,6 +380,41 @@
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA64C3</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA128C3</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA192C3</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA256C3</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA384C3</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA16C4</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* <tr>
* <td>ATXMEGA32C4</td>
* <td bgcolor="#00EE00">Yes</td>
* <td bgcolor="#EE0000">No</td>
* </tr>
* </table>
*
* \section Sec_XMEGASupport_Boards Supported Atmel Boards

@ -22,12 +22,10 @@
* -# Pull out third party libraries into a separate folder and reference them as required
* -# Add a LUFA_YIELD macro for integration into a third-party RTOS
* -# Abstract out Mass Storage byte send/receive to prevent low level API use in projects
* -# Consider switch from endpoint numbers to full endpoint addresses to ease future architecture expansion
* -# Fix HID report parser usage support for array types
* -# Make HOST_DEVICE_SETTLE_DELAY_MS a global variable that can be changed
* -# Add MANDATORY_EVENT_FUNCTIONS compile time option
* -# Add watchdog support to the library and apps/bootloaders
* -# Fix Still Image Host class driver - missing reqs, parameters
* - Testing/Verification
* -# Re-run USBIF test suite on all classes to formally verify operation
* -# Implement automated functional testing of all demos

@ -0,0 +1,40 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \page Page_KnownIssues Known Issues
* The following are known issues present in each official LUFA release. This list should contain all known
* issues in the library. Most of these issues should be corrected in the future release - see
* \ref Page_FutureChanges for a list of planned changes in future releases.
*
* \section Sec_KnownIssuesXXXXXX Version XXXXXX
* - AVR8 Architecture
* - No known issues.
* - XMEGA Architecture
* - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release,
* although the architecture is supported in the LUFA core library.
* - Endpoints of more than 64 bytes are not currently supported in this release.
* - Isochronous endpoints are not currently supported in this release. As a result, the audio class
* cannot be used on XMEGA devices.
* - Multiple-bank endpoints are not currently supported in this release.
* - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata
* relating to the USB controller.
* - UC3 Architecture
* - No demos, bootloaders or projects have been ported for the UC3 devices in the current release,
* although the architecture is supported in the LUFA core library.
* - DMA transfers to and from the USB controller are not yet implemented for this release.
* - The UC3C, UC3D and UC3L sub-families of UC3 are not currently supported by the library due to their
* altered USB controller design.
* - The various \c CreateStream() functions for creating standard \c <stdio.h> compatible virtual file
* streams are not available on the UC3 architecture, due to a lack of suitable library support.
* - Architecture Independant
* - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element
* in the array will receive a unique incrementing usage from the MIN value, up to MAX.
* - The current application makefiles do not work if the output directory is not the same directory
* as the makefile itself.
* - The LUFA library is not watchdog aware, and thus timeouts are possible if short periods are used
* and a lengthy USB operation is initiated.
*/

@ -20,6 +20,7 @@
*
* \li AVR-USB-162, a USBKEY-like development board for the AT90USB162: http://olimex.com/dev/avr-usb-162.html
* \li Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
* \li Duce, the sucessor to the Benito #7: http://dorkbotpdx.org/wiki/duce
* \li JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html
* \li Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/
* \li Microsin AVR-USB162 breakout board, a DIY AT90USB162 development board: http://microsin.ru/content/view/685/44/
@ -36,6 +37,7 @@
* The following are known hobbyist projects using LUFA. Most are open source, and show off interesting ways that the LUFA library
* can be incorporated into many different applications.
*
* \li Accelerometer Game Joystick: http://www.crictor.co.il/he/episodes/joystick/
* \li Arcade Controller: http://fletchtronics.net/arcade-controller-made-petunia
* \li Arcade Joystick: http://jamie.lentin.co.uk/embedded/arcade-joystick/
* \li AttoBasic AVR BASIC interpreter: http://www.cappels.org/dproj/AttoBasic2_1/AttoBasic_2.1_with_USB_and_Arduino_support.html

@ -9,6 +9,7 @@
*
* \section Sec_UnofficialResources Unofficial Resources
* Unofficial Russian LUFA documentation translation: http://microsin.ru/Download.cnt/doc/LUFA/ \n
* Tutorial for LUFA USB Control Transfers: http://www.avrbeginners.net/new/tutorials/usb-control-transfers-with-lufa/
*
* \section Sec_ProjectPages LUFA Related Webpages
* Project Homepage: http://www.lufa-lib.org \n
@ -22,8 +23,8 @@
*
* \section Sec_InDevelopment Latest In-Development Source Code
* Issue Tracker: http://www.lufa-lib.org/tracker \n
* SVN Access: http://www.lufa-lib.org/svn \n
* GIT Access: http://www.lufa-lib.org/git \n
* Public SVN Repository: http://www.lufa-lib.org/svn \n
* Public GIT Repository: http://www.lufa-lib.org/git \n
* Latest Repository Source Archive: http://www.lufa-lib.org/latest-archive \n
* Commit RSS Feed: http://www.lufa-lib.org/rss \n
*

@ -42,6 +42,7 @@
* \li \subpage Page_Donating - Donating to support this project
* \li \subpage Page_DeviceSupport - Current Device and Hardware Support
* \li \subpage Page_ChangeLog - Project Changelog
* \li \subpage Page_KnownIssues - Known Issues
* \li \subpage Page_FutureChanges - Planned Changes to the Library
* \li \subpage Page_GettingStarted - Getting started with LUFA
* \li \subpage Page_DevelopingWithLUFA - Developing with LUFA

@ -17,10 +17,33 @@
* - The HID_DESCRIPTOR_JOYSTICK() macro no longer takes a variable number of axis as a parameter, due to OS incompatibilities; this macro now uses a fixed
* 3 axis of data. User applications should update their calls to this macro and their report structures to suit a fixed 3-axis joystick report. If a user
* application requires more than 3 axis' of data, a custom report descriptor will need to be constructed by hand.
* - The \ref Endpoint_ConfigureEndpoint() function no longer takes in masks for the banks and direction; the number of banks is now an integer argument, and
* the direction is obtained from the full endpoint address within the device. Applications calling Endpoint_ConfigureEndpoint() should update their API
* call to use a full endpoint address (including ENDPOINT_DIR_IN or ENDPOINT_DIR_OUT direction in the MSB of the endpoint address) and an integer number
* of banks.
* - All endpoint functions now operate on full endpoint addresses within the device, rather than a directionless endpoint index. Applications should update
* their API calls to use full endpoint addresses when required within the device.
* - All device mode class drivers have been updated to use a new unified endpoint description structure for all endpoints; existing applications will need
* to update their class driver struct instantiation to match the new scheme (see \ref USB_Endpoint_Table_t).
* - The \c ENDPOINT_BANKS_SUPPORTED() and \c ENDPOINT_MAX_ENDPOINT_SIZE() macros have been removed, as these do not function correctly with the new addressing
* scheme for the endpoint APIs. Please refer to the target device's datasheet for the maximum bank size of each endpoint.
* - The MIDI class driver \ref MIDI_EventPacket_t event packet no longer contains seperate \c CableIndex and \c Command entries; these have been combined
* into a single \c Event element which can be contructed using the new macro \ref MIDI_EVENT(). Existing applications should use the new macro and structure
* element name.
*
* <b>Host Mode</b>
* - The Android Accessory Host class driver property strings are now a array of \c char* rather than a struct of named pointers. Existing applications
* should use C99 Designated Initializers with the property string indexes located in \ref AOA_Strings_t instead.
* - The \ref Pipe_ConfigurePipe() function no longer takes in masks for the banks and token; the number of banks is now an integer argument, and the token
* is now inferred from the full pipe address within the device, and the pipe type. Applications calling Pipe_ConfigurePipe() should update their API
* call to use a full pipe address (including PIPE_DIR_IN or PIPE_DIR_OUT direction in the MSB of the pipe address) and an integer number of banks.
* - All pipe functions now operate on full pipe addresses within the device, rather than a directionless pipe index. Applications should update their API
* calls to use full pipe addresses when required within the device.
* - All host mode class drivers have been updated to use a new unified pipe description structure for all pipes; existing applications will need to update
* their class driver struct instantiation to match the new scheme (see \ref USB_Pipe_Table_t).
* - The MIDI class driver \ref MIDI_EventPacket_t event packet no longer contains seperate \c CableIndex and \c Command entries; these have been combined
* into a single \c Event element which can be contructed using the new macro \ref MIDI_EVENT(). Existing applications should use the new macro and structure
* element name.
*
* \section Sec_Migration120219 Migrating from 111009 to 120219
* <b>USB Core</b>
@ -130,7 +153,7 @@
* eliminate any casting of descriptor pointers to a non \c const pointer.
* - The names of the class specific descriptor type defines in the USB Class drivers have changed - refer to the driver documentation
* for each class driver for the new class specific descriptor type names.
* - The \c ENDPOINT_DOUBLEBANK_SUPPORTED() macro is has been renamed \ref ENDPOINT_BANKS_SUPPORTED() and now returns the total number of
* - The \c ENDPOINT_DOUBLEBANK_SUPPORTED() macro is has been renamed \c ENDPOINT_BANKS_SUPPORTED() and now returns the total number of
* banks supported by the given endpoint. Existing code should switch to the new naming scheme, and test that the return value of the
* macro is equal to or greater than 2 to regain the previous functionality.
* - The \c EVENT_USB_Device_UnhandledControlRequest() event is now named \ref EVENT_USB_Device_ControlRequest() and fires before (not after)

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Adafruit U4 Breakout board (http://ladyada.net/products/atmega32u4breakout).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTE.6</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTE ^= LEDMask;
PINE = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel ATAVRUSBRF01.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,12 @@
*
* Board specific LED driver header for the Atmel ATAVRUSBRF01.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>RX LED</td><td>High</td><td>PORTD.0</td></tr>
* <tr><td>LEDS_LED2</td><td>Red</td><td>TX LED</td><td>High</td><td>PORTD.1</td></tr>
* </table>
*
* @{
*/
@ -61,15 +67,6 @@
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED2)
#define LEDS_PORTE_LEDS (LEDS_LED3 | LEDS_LED4)
#define LEDS_PORTE_MASK_SHIFT 4
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
@ -121,7 +118,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,12 @@
*
* Board specific LED driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX LED</td><td>Low</td><td>PORTC.7</td></tr>
* <tr><td>LEDS_LED2</td><td>Red</td><td>RX LED</td><td>Low</td><td>PORTC.6</td></tr>
* </table>
*
* @{
*/
@ -112,7 +118,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTC ^= LEDMask;
PINC = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,13 @@
*
* Board specific LED driver header for the Bitwizard Big-Multio (http://www.bitwizard.nl/wiki/index.php/Usbbigmultio).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Unknown</td><td>LED0</td><td>High</td><td>PORTF.6</td></tr>
* <tr><td>LEDS_LED2</td><td>Unknown</td><td>LED1</td><td>High</td><td>PORTF.7</td></tr>
* <tr><td>LEDS_LED3</td><td>Unknown</td><td>LED2</td><td>High</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/
@ -132,8 +139,8 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTF ^= (LEDMask & LEDS_PORTF_LEDS);
PORTE ^= (LEDMask & LEDS_PORTE_LEDS);
PINF = (LEDMask & LEDS_PORTF_LEDS);
PINE = (LEDMask & LEDS_PORTE_LEDS);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -40,7 +40,13 @@
* \defgroup Group_LEDs_BLACKCAT BLACKCAT
* \brief Board specific LED driver header for the BLACKCAT USB JTAG.
*
* Board specific LED driver header for the TCNISO Blackcat USB JTAG (http://www.embeddedcomputers.net/products/BlackcatUSB/.
* Board specific LED driver header for the TCNISO Blackcat USB JTAG (http://www.embeddedcomputers.net/products/BlackcatUSB).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Unknown</td><td>LED0</td><td>High</td><td>PORTD.6</td></tr>
* <tr><td>LEDS_LED2</td><td>Unknown</td><td>LED1</td><td>High</td><td>PORTD.3</td></tr>
* </table>
*
* @{
*/
@ -112,7 +118,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,13 @@
*
* Board specific LED driver header for the Busware BUI (http://www.busware.de/tiki-index.php?page=BUI).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>RGB LED</td><td>High</td><td>PORTC.2</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>RGB LED</td><td>High</td><td>PORTC.3</td></tr>
* <tr><td>LEDS_LED3</td><td>Blue</td><td>RGB LED</td><td>High</td><td>PORTC.4</td></tr>
* </table>
*
* @{
*/
@ -115,7 +122,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTC ^= LEDMask;
PINC = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -44,6 +44,11 @@
* third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral
* layout for buttons, LEDs and a Joystick.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -44,6 +44,11 @@
* third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral
* layout for buttons, LEDs and a Joystick.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>PORTD.2</td><td>PORTD.3</td><td>PORTD.0</td><td>PORTD.1</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/

@ -44,6 +44,14 @@
* third-party board does not include any on-board peripherals, but does have an officially recommended external
* peripheral layout for buttons, LEDs and a Joystick.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.4</td></tr>
* <tr><td>LEDS_LED2</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.5</td></tr>
* <tr><td>LEDS_LED3</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.6</td></tr>
* <tr><td>LEDS_LED4</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.7</td></tr>
* </table>
*
* @{
*/
@ -120,7 +128,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
PINB = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>High</td><td>PORTE.6</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTE ^= LEDMask;
PINE = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -0,0 +1,147 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific LED driver header for the DorkbotPDX Duce.
* \copydetails Group_LEDs_DUCE
*
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
*/
/** \ingroup Group_LEDs
* \defgroup Group_LEDs_DUCE DUCE
* \brief Board specific LED driver header for the DorkbotPDX Duce.
*
* Board specific LED driver header for the DorkbotPDX Duce (http://dorkbotpdx.org/wiki/duce).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTC.4</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTC.5</td></tr>
* <tr><td>LEDS_LED3</td><td>Red</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTC.6</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTC.7</td></tr>
* </table>
*
* @{
*/
#ifndef __LEDS_DUCE_H__
#define __LEDS_DUCE_H__
/* Includes: */
#include "../../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 (1 << 4)
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 5)
/** LED mask for the third LED on the board. */
#define LEDS_LED3 (1 << 6)
/** LED mask for the fourth LED on the board. */
#define LEDS_LED4 (1 << 7)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
DDRC |= LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_Disable(void)
{
DDRC &= ~LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTC |= LEDMask;
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
PORTC &= ~LEDMask;
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask);
}
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTC = ((PORTC & ~LEDMask) | ActiveMask);
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PINC = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return (PORTC & LEDS_ALL_LEDS);
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel EVK527.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Dataflash driver header for the Atmel EVK527.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB321C (4MB)</td><td>PORTE.6</td><td>SPI0</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel EVK527.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>PORTF.4</td><td>PORTF.5</td><td>PORTF.7</td><td>PORTC.6</td><td>PORTF.6</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,13 @@
*
* Board specific LED driver header for the Atmel EVK527.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/
@ -115,7 +122,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,12 @@
*
* Board specific LED driver header for the Maximus (http://www.avrusb.com/).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>LG</td><td>High</td><td>PORTB.6</td></tr>
* <tr><td>LEDS_LED2</td><td>Red</td><td>LR</td><td>High</td><td>PORTB.7</td></tr>
* </table>
*
* @{
*/
@ -112,7 +118,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
PINB = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -100,6 +100,18 @@
*
* Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2).
*
* <b>BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2</b>:
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* <b>Other Revisions</b>:
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -56,6 +56,18 @@
*
* Board specific LED driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2).
*
* <b>BOARD_MICROPENDOUS_32U2</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
* </table>
*
* <b>Other Revisions</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTB.1</td></tr>
* </table>
*
* @{
*/
@ -92,6 +104,7 @@
#define _BOARD_LED_CONCAT(Reg, Letter) _BOARD_LED_CONCAT2(Reg, Letter)
#define _BOARD_LED_PORT _BOARD_LED_CONCAT(PORT, _BOARD_LED_PORTLETTER)
#define _BOARD_LED_PIN _BOARD_LED_CONCAT(PIN, _BOARD_LED_PORTLETTER)
#define _BOARD_LED_DDR _BOARD_LED_CONCAT(DDR, _BOARD_LED_PORTLETTER)
#endif
@ -143,7 +156,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
_BOARD_LED_PORT ^= LEDMask;
_BOARD_LED_PIN = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the MINIMUS.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,13 @@
*
* Board specific LED driver header for the Minimus USB (http://www.minimususb.com/).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>General Indicator</td><td>Low</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.6</td></tr>
* <tr><td>LEDS_LED3</td><td>Blue</td><td>General Indicator</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/
@ -69,11 +76,14 @@
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 6)
/** LED mask for the third LED on the board. */
#define LEDS_LED3 (1 << 7)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2)
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
/** LED mask for the none of the board LEDs. */
#define LEDS_NO_LEDS 1
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
@ -112,7 +122,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,13 @@
*
* Board specific LED driver header for the Bitwizard Multio (http://www.bitwizard.nl/wiki/index.php/USB-multio).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.0</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTC.2</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/
@ -132,8 +139,8 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
PORTC ^= (LEDMask & LEDS_PORTC_LEDS);
PIND = (LEDMask & LEDS_PORTD_LEDS);
PINC = (LEDMask & LEDS_PORTC_LEDS);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board (http://www.olimex.com/dev/avr-usb-162.html).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Olimex AVR-USB-162 (http://www.olimex.com/dev/avr-usb-162.html).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -0,0 +1,103 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
* \copydetails Group_Buttons_OLIMEX32U4
*
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
/** \ingroup Group_Buttons
* \defgroup Group_Buttons_OLIMEX32U4 OLIMEX32U4
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
*
* Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board (http://www.olimex.com/dev/olimexino-32u4.html).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/
#ifndef __BUTTONS_OLIMEX32U4_H__
#define __BUTTONS_OLIMEX32U4_H__
/* Includes: */
#include "../../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE |= BUTTONS_BUTTON1;
}
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void)
{
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,179 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific LED driver header for the Olimex AVR-USB-32U4.
* \copydetails Group_LEDs_OLIMEX32U4
*
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
*/
/** \ingroup Group_LEDs
* \defgroup Group_LEDs_OLIMEX32U4 OLIMEX32U4
* \brief Board specific LED driver header for the Olimex AVR-USB-32U4.
*
* Board specific LED driver header for the Olimex AVR-USB-32U4 (http://www.olimex.com/dev/olimexino-32u4.html).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>RX</td><td>High</td><td>PORTB.0</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator (Default Unconnected)</td><td>High</td><td>PORTE.6</td></tr>
* <tr><td>LEDS_LED4</td><td>Yellow</td><td>General Indicator (Default Unconnected)</td><td>High</td><td>PORTB.5</td></tr>
* </table>
*
* @{
*/
#ifndef __LEDS_OLIMEX32U4_H__
#define __LEDS_OLIMEX32U4_H__
/* Includes: */
#include "../../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define LEDS_PORTB_LEDS (LEDS_LED2 | LEDS_LED4)
#define LEDS_PORTD_LEDS (LEDS_LED1)
#define LEDS_PORTE_LEDS (LEDS_LED3)
#define LEDS_PORTD_MASK_SHIFT 1
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 ((1 << 5) >> LEDS_PORTD_MASK_SHIFT)
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 0)
/** LED mask for the third LED on the board. */
#define LEDS_LED3 (1 << 5)
/** LED mask for the fourth LED on the board. */
#define LEDS_LED4 (1 << 6)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
DDRB |= LEDS_PORTB_LEDS;
PORTB &= ~LEDS_PORTB_LEDS;
DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
DDRE |= LEDS_PORTE_LEDS;
PORTE &= ~LEDS_PORTE_LEDS;
}
static inline void LEDs_Disable(void)
{
DDRB &= LEDS_PORTB_LEDS;
PORTB &= ~LEDS_PORTB_LEDS;
DDRD &= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
DDRE &= LEDS_PORTE_LEDS;
PORTE &= ~LEDS_PORTE_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTB |= (LEDMask & LEDS_PORTB_LEDS);
PORTD |= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
PORTE |= (LEDMask & LEDS_PORTE_LEDS);
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
PORTB &= ~(LEDMask & LEDS_PORTB_LEDS);
PORTD &= ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
PORTE &= ~(LEDMask & LEDS_PORTE_LEDS);
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS));
PORTD = ((PORTD & ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) |
((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT));
PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS));
}
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS));
PORTD = ((PORTD & ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)) |
((ActiveMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT));
PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS));
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PINB = (LEDMask & LEDS_PORTB_LEDS);
PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
PINE = (LEDMask & LEDS_PORTE_LEDS);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return ((PORTB & LEDS_PORTB_LEDS) |
((PORTD & (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) >> LEDS_PORTD_MASK_SHIFT) |
(PORTE & LEDS_PORTE_LEDS));
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,103 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board.
* \copydetails Group_Buttons_OLIMEXT32U4
*
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
/** \ingroup Group_Buttons
* \defgroup Group_Buttons_OLIMEXT32U4 OLIMEXT32U4
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
*
* Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board (http://www.olimex.com/dev/avr-t32u4.html).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/
#ifndef __BUTTONS_OLIMEXT32U4_H__
#define __BUTTONS_OLIMEXT32U4_H__
/* Includes: */
#include "../../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE |= BUTTONS_BUTTON1;
}
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void)
{
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,169 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Board specific LED driver header for the Olimex AVR-USB-T32U4.
* \copydetails Group_LEDs_OLIMEXT32U4
*
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
*/
/** \ingroup Group_LEDs
* \defgroup Group_LEDs_OLIMEXT32U4 OLIMEXT32U4
* \brief Board specific LED driver header for the Olimex AVR-USB-T32U4.
*
* Board specific LED driver header for the Olimex AVR-USB-T32U4 (http://www.olimex.com/dev/avr-t32u4.html).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>RX</td><td>High</td><td>PORTB.0</td></tr>
* <tr><td>LEDS_LED3</td><td>N/A</td><td>General Indicator (Not Mounted)</td><td>High</td><td>PORTE.6</td></tr>
* </table>
*
* @{
*/
#ifndef __LEDS_OLIMEXT32U4_H__
#define __LEDS_OLIMEXT32U4_H__
/* Includes: */
#include "../../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define LEDS_PORTB_LEDS (LEDS_LED2)
#define LEDS_PORTD_LEDS (LEDS_LED1)
#define LEDS_PORTE_LEDS (LEDS_LED3)
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 (1 << 5)
/** LED mask for the second LED on the board. */
#define LEDS_LED2 (1 << 0)
/** LED mask for the third LED on the board. */
#define LEDS_LED3 (1 << 6)
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
DDRB |= LEDS_PORTB_LEDS;
PORTB &= ~LEDS_PORTB_LEDS;
DDRD |= LEDS_PORTD_LEDS;
PORTD &= ~LEDS_PORTD_LEDS;
DDRE |= LEDS_PORTE_LEDS;
PORTE &= ~LEDS_PORTE_LEDS;
}
static inline void LEDs_Disable(void)
{
DDRB &= LEDS_PORTB_LEDS;
PORTB &= ~LEDS_PORTB_LEDS;
DDRD &= LEDS_PORTD_LEDS;
PORTD &= ~LEDS_PORTD_LEDS;
DDRE &= LEDS_PORTE_LEDS;
PORTE &= ~LEDS_PORTE_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTB |= (LEDMask & LEDS_PORTB_LEDS);
PORTD |= (LEDMask & LEDS_PORTD_LEDS);
PORTE |= (LEDMask & LEDS_PORTE_LEDS);
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
PORTB &= ~(LEDMask & LEDS_PORTB_LEDS);
PORTD &= ~(LEDMask & LEDS_PORTD_LEDS);
PORTE &= ~(LEDMask & LEDS_PORTE_LEDS);
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS));
PORTD = ((PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS));
PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS));
}
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS));
PORTD = ((PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS));
PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS));
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PINB = (LEDMask & LEDS_PORTB_LEDS);
PIND = (LEDMask & LEDS_PORTD_LEDS);
PINE = (LEDMask & LEDS_PORTE_LEDS);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return ((PORTB & LEDS_PORTB_LEDS) | (PORTD & LEDS_PORTD_LEDS) | (PORTE & LEDS_PORTE_LEDS));
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel RZUSBSTICK.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Blue</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>General Indicator</td><td>Low</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTE.6</td></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>Low</td><td>PORTE.7</td></tr>
* </table>
*
* @{
*/
@ -144,8 +152,8 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
PORTE ^= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
PIND = (LEDMask & LEDS_PORTD_LEDS);
PINE = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board (http://www.sparkfun.com/products/10277).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTB.4</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
PINB = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel STK525.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Dataflash driver header for the Atmel STK525.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB321C (4MB)</td><td>PORTB.4</td><td>SPI0</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel STK525.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>PORTB.6</td><td>PORTB.7</td><td>PORTE.4</td><td>PORTE.5</td><td>PORTB.5</td></tr>
* </table>
*
* @{
*/
@ -76,7 +81,7 @@
#define JOY_LEFT (1 << 6)
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT ((1 << 4) >> 1)
#define JOY_RIGHT ((1 << 4) >> JOY_PORTE_MASK_SHIFT)
/** Mask for the joystick being pushed in the upward direction. */
#define JOY_UP (1 << 7)

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel STK525.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/
@ -118,7 +126,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel STK526.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Dataflash driver header for the Atmel STK525.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTC.2</td><td>SPI0</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel STK526.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>PORTB.4</td><td>PORTB.5</td><td>PORTB.6</td><td>PORTB.7</td><td>PORTB.0</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel STK526.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.1</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.0</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -118,7 +126,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -51,6 +51,18 @@
*
* Board specific LED driver header for the PJRC Teensy boards (http://www.pjrc.com/teensy/index.html).
*
* <b>TEENSY</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
* </table>
*
* <b>TEENSY2</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.6</td></tr>
* </table>
*
* @{
*/
@ -139,7 +151,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTF.0</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTF ^= LEDMask;
PINF = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Linnix UDIP (http://linnix.com/udip/).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Linnix UDIP (http://linnix.com/udip/).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.6</td></tr>
* <tr><td>LEDS_LED2</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.5</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED4</td><td>Red</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -133,8 +141,8 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
PORTD ^= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
PINB = (LEDMask & LEDS_PORTB_LEDS);
PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,12 @@
*
* Board specific LED driver header for the Arduino Uno (http://arduino.cc/en/Main/ArduinoBoardUno).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>RX</td><td>Low</td><td>PORTD.4</td></tr>
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>TX</td><td>Low</td><td>PORTD.5</td></tr>
* </table>
*
* @{
*/
@ -112,7 +118,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -51,6 +51,11 @@
*
* Board specific Buttons driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -51,6 +51,18 @@
*
* Board specific LED driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX).
*
* <b>USB2AX</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTC.6</td></tr>
* </table>
*
* <b>USB2AX_V3</b>:
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.1</td></tr>
* </table>
*
* @{
*/
@ -96,11 +108,11 @@
static inline void LEDs_Init(void)
{
#if (BOARD == BOARD_USB2AX)
DDRC |= LEDS_ALL_LEDS;
PORTC |= LEDS_ALL_LEDS;
DDRC |= LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
#else
DDRD |= LEDS_ALL_LEDS;
PORTD |= LEDS_ALL_LEDS;
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
#endif
}
@ -118,27 +130,27 @@
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
#if (BOARD == BOARD_USB2AX)
PORTC &= ~LEDMask;
PORTC |= LEDMask;
#else
PORTD &= ~LEDMask;
PORTD |= LEDMask;
#endif
}
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
#if (BOARD == BOARD_USB2AX)
PORTC |= LEDMask;
PORTC &= ~LEDMask;
#else
PORTD |= LEDMask;
PORTD &= ~LEDMask;
#endif
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
#if (BOARD == BOARD_USB2AX)
PORTC = ((PORTC | LEDS_ALL_LEDS) & ~LEDMask);
PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask);
#else
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
#endif
}
@ -146,18 +158,18 @@
const uint8_t ActiveMask)
{
#if (BOARD == BOARD_USB2AX)
PORTC = ((PORTC | LEDMask) & ~ActiveMask);
PORTC = ((PORTC & ~LEDMask) | ActiveMask);
#else
PORTD = ((PORTD | LEDMask) & ~ActiveMask);
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
#endif
}
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
#if (BOARD == BOARD_USB2AX)
PORTC ^= LEDMask;
PINC = LEDMask;
#else
PORTD ^= LEDMask;
PIND = LEDMask;
#endif
}
@ -165,9 +177,9 @@
static inline uint8_t LEDs_GetLEDs(void)
{
#if (BOARD == BOARD_USB2AX)
return (~PORTC & LEDS_ALL_LEDS);
return (PORTC & LEDS_ALL_LEDS);
#else
return (~PORTD & LEDS_ALL_LEDS);
return (PORTD & LEDS_ALL_LEDS);
#endif
}
#endif

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific LED driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.4</td></tr>
* </table>
*
* @{
*/
@ -109,7 +114,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel USBKEY.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,12 @@
*
* Board specific Dataflash driver header for the Atmel USBKEY board.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTE.0</td><td>SPI0</td></tr>
* <tr><td>DATAFLASH_CHIP2</td><td>AT45DB642D (8MB)</td><td>PORTE.1</td><td>SPI0</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel USBKEY.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>PORTB.6</td><td>PORTB.7</td><td>PORTE.4</td><td>PORTE.5</td><td>PORTB.5</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel USBKEY.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>Low</td><td>PORTD.4</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>Low</td><td>PORTD.5</td></tr>
* <tr><td>LEDS_LED3</td><td>Red</td><td>Bicolor Indicator 2</td><td>Low</td><td>PORTD.6</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>Bicolor Indicator 2</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/
@ -118,7 +126,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
PIND = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/).
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,13 @@
*
* Board specific LED driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/).
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.6</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.7</td></tr>
* <tr><td>LEDS_LED3</td><td>Red</td><td>Target Power</td><td>High</td><td>PORTB.5</td></tr>
* </table>
*
* @{
*/
@ -115,7 +122,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
PINB = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -51,6 +51,18 @@
*
* Board specific Dataflash driver header for the Atmel XPLAIN.
*
* <b>Revision 1 Boards</b>:
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB041D (512KB)</td><td>PORTB.5</td><td>SPI0</td></tr>
* </table>
*
* <b>Other Board Revisions</b>:
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTB.5</td><td>SPI0</td></tr>
* </table>
*
* @{
*/
@ -59,6 +71,7 @@
/* Includes: */
#include "../../../../Common/Common.h"
#include "../../../Misc/AT45DB642D.h"
#include "../../../Peripheral/SPI.h"

@ -49,6 +49,11 @@
*
* Board specific LED driver header for the Atmel XPLAIN.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTB.6</td></tr>
* </table>
*
* @{
*/
@ -116,7 +121,7 @@
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
PINB = LEDMask;
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;

@ -143,6 +143,10 @@
#include "AVR8/MICROPENDOUS/Buttons.h"
#elif (BOARD == BOARD_B1_XPLAINED)
#include "XMEGA/B1_XPLAINED/Buttons.h"
#elif (BOARD == BOARD_OLIMEX32U4)
#include "AVR8/OLIMEX32U4/Buttons.h"
#elif (BOARD == BOARD_OLIMEXT32U4)
#include "AVR8/OLIMEXT32U4/Buttons.h"
#else
#include "Board/Buttons.h"
#endif

@ -80,11 +80,11 @@
* // Turn on each of the four LEDs in turn
* LEDs_SetAllLEDs(LEDS_LED1);
* Delay_MS(500);
* LEDs_SetAllLEDs(LEDS_LED1);
* LEDs_SetAllLEDs(LEDS_LED2);
* Delay_MS(500);
* LEDs_SetAllLEDs(LEDS_LED1);
* LEDs_SetAllLEDs(LEDS_LED3);
* Delay_MS(500);
* LEDs_SetAllLEDs(LEDS_LED1);
* LEDs_SetAllLEDs(LEDS_LED4);
* Delay_MS(500);
*
* // Turn on all LEDs
@ -185,6 +185,12 @@
#include "AVR8/MULTIO/LEDs.h"
#elif (BOARD == BOARD_BIGMULTIO)
#include "AVR8/BIGMULTIO/LEDs.h"
#elif (BOARD == BOARD_DUCE)
#include "AVR8/DUCE/LEDs.h"
#elif (BOARD == BOARD_OLIMEX32U4)
#include "AVR8/OLIMEX32U4/LEDs.h"
#elif (BOARD == BOARD_OLIMEXT32U4)
#include "AVR8/OLIMEXT32U4/LEDs.h"
#else
#include "Board/LEDs.h"
#endif

@ -42,6 +42,13 @@
*
* Board specific Buttons driver header for the Atmel EVK1100.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO88</td></tr>
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>GPIO85</td></tr>
* <tr><td>BUTTONS_BUTTON3</td><td>SW2 Button</td><td>Low</td><td>GPIO82</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel EVK1100.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>GPIO25</td><td>GPIO26</td><td>GPIO28</td><td>GPIO27</td><td>GPIO20</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,18 @@
*
* Board specific LED driver header for the Atmel EVK1100.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO51</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO52</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO53</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO54</td></tr>
* <tr><td>LEDS_LED5</td><td>Green</td><td>LED4 LED</td><td>Low</td><td>GPIO59</td></tr>
* <tr><td>LEDS_LED6</td><td>Green</td><td>LED5 LED</td><td>Low</td><td>GPIO60</td></tr>
* <tr><td>LEDS_LED7</td><td>Green</td><td>LED6 LED</td><td>Low</td><td>GPIO61</td></tr>
* <tr><td>LEDS_LED8</td><td>Green</td><td>LED7 LED</td><td>Low</td><td>GPIO62</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,12 @@
*
* Board specific Buttons driver header for the Atmel EVK1101.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO34</td></tr>
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>GPIO35</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific joystick driver header for the Atmel EVK1101.
*
* <table>
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
* <tr><td>GPIO38</td><td>GPIO39</td><td>GPIO41</td><td>GPIO40</td><td>GPIO13</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel EVK1101.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO7</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO8</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO21</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO22</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Buttons driver header for the Atmel EVK1104.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO42</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific LED driver header for the Atmel EVK1104.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO67</td></tr>
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO101</td></tr>
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO102</td></tr>
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO105</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,13 @@
*
* Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>PORTE.5</td></tr>
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>PORTF.1</td></tr>
* <tr><td>BUTTONS_BUTTON3</td><td>SW2 Button</td><td>Low</td><td>PORTF.2</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained board.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTF.4</td><td>USARTD0 (In SPI Mode)</td></tr>
* </table>
*
* @{
*/
@ -71,10 +76,10 @@
#define DATAFLASH_TOTALCHIPS 1
/** Mask for no dataflash chip selected. */
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
#define DATAFLASH_NO_CHIP 0
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 0
#define DATAFLASH_CHIP1 (1 << 4)
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE 1024
@ -88,8 +93,10 @@
*/
static inline void Dataflash_Init(void)
{
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.OUTSET = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
@ -143,7 +150,8 @@
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
{
DATAFLASH_CHIPCS_PORT.OUT = ((DATAFLASH_CHIPCS_PORT.OUT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.OUTSET = ChipMask;
}
/** Deselects the current dataflash chip, so that no dataflash is selected. */

@ -42,6 +42,12 @@
*
* Board specific LED driver header for the Atmel XMEGA A3BU Xplained.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>LED0 LED</td><td>Low</td><td>PORTR.0</td></tr>
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>LED1 LED</td><td>Low</td><td>PORTR.1</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,14 @@
*
* Board specific Buttons driver header for the Atmel XMEGA B1 Xplained.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>BUTTONS_BUTTON1</td><td>Touch CS0 Button</td><td>Low</td><td>PORTE.0</td></tr>
* <tr><td>BUTTONS_BUTTON2</td><td>Touch CS1 Button</td><td>Low</td><td>PORTE.1</td></tr>
* <tr><td>BUTTONS_BUTTON3</td><td>Touch CS2 Button</td><td>Low</td><td>PORTE.2</td></tr>
* <tr><td>BUTTONS_BUTTON4</td><td>Touch CS3 Button</td><td>Low</td><td>PORTE.3</td></tr>
* </table>
*
* @{
*/

@ -42,6 +42,11 @@
*
* Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained board.
*
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTD.2</td><td>USARTC0 (In SPI Mode, Remapped)</td></tr>
* </table>
*
* @{
*/
@ -71,10 +76,10 @@
#define DATAFLASH_TOTALCHIPS 1
/** Mask for no dataflash chip selected. */
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
#define DATAFLASH_NO_CHIP 0
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 0
#define DATAFLASH_CHIP1 (1 << 2)
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE 1024
@ -88,10 +93,12 @@
*/
static inline void Dataflash_Init(void)
{
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.OUTSET = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
PORTE.REMAP |= PORT_USART0_bm;
PORTC.REMAP |= PORT_USART0_bm;
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
@ -103,7 +110,7 @@
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
{
return SerialSPI_TransferByte(&USARTE0, Byte);
return SerialSPI_TransferByte(&USARTC0, Byte);
}
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
@ -113,7 +120,7 @@
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SendByte(const uint8_t Byte)
{
SerialSPI_SendByte(&USARTE0, Byte);
SerialSPI_SendByte(&USARTC0, Byte);
}
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
@ -123,7 +130,7 @@
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Dataflash_ReceiveByte(void)
{
return SerialSPI_ReceiveByte(&USARTE0);
return SerialSPI_ReceiveByte(&USARTC0);
}
/** Determines the currently selected dataflash chip.
@ -145,7 +152,8 @@
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
{
DATAFLASH_CHIPCS_PORT.OUT = ((DATAFLASH_CHIPCS_PORT.OUT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.OUTSET = (ChipMask & DATAFLASH_CHIPCS_MASK);
}
/** Deselects the current dataflash chip, so that no dataflash is selected. */

@ -42,6 +42,15 @@
*
* Board specific LED driver header for the Atmel XMEGA B1 Xplained.
*
* <table>
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>LED0 LED</td><td>High</td><td>PORTB.4</td></tr>
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>LED1 LED</td><td>High</td><td>PORTB.5</td></tr>
* <tr><td>LEDS_LED3</td><td>Yellow</td><td>LED2 LED</td><td>High</td><td>PORTB.6</td></tr>
* <tr><td>LEDS_LED4</td><td>Yellow</td><td>LED3 LED</td><td>High</td><td>PORTB.7</td></tr>
* <tr><td>LEDS_LED5</td><td>Green</td><td>USB LED</td><td>Low</td><td>PORTE.4</td></tr>
* </table>
*
* @{
*/

@ -176,9 +176,7 @@
*/
static inline void SerialSPI_SendByte(const uint8_t DataByte)
{
UDR1 = DataByte;
while (!(UCSR1A & (1 << TXC1)));
UCSR1A = (1 << TXC1);
SerialSPI_TransferByte(DataByte);
}
/** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response
@ -188,10 +186,7 @@
*/
static inline uint8_t SerialSPI_ReceiveByte(void)
{
UDR1 = 0;
while (!(UCSR1A & (1 << TXC1)));
UCSR1A = (1 << TXC1);
return UDR1;
return SerialSPI_TransferByte(0);
}
/* Disable C linkage for C++ Compilers: */

@ -52,7 +52,7 @@
*
* \code
* // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud
* SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_ORDER_MSB_FIRST), 1000000);
* SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), 1000000);
*
* // Send several bytes, ignoring the returned data
* SerialSPI_SendByte(&USARTD0, 0x01);
@ -177,9 +177,7 @@
static inline void SerialSPI_SendByte(USART_t* const USART,
const uint8_t DataByte)
{
USART->DATA = DataByte;
while (!(USART->STATUS & USART_TXCIF_bm));
USART->STATUS = USART_TXCIF_bm;
SerialSPI_TransferByte(USART, DataByte);
}
/** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response
@ -191,10 +189,7 @@
*/
static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART)
{
USART->DATA = 0;
while (!(USART->STATUS & USART_TXCIF_bm));
USART->STATUS = USART_TXCIF_bm;
return USART->DATA;
return SerialSPI_TransferByte(USART, 0);
}
/* Disable C linkage for C++ Compilers: */

@ -84,8 +84,20 @@
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
* \param[in] channel MIDI channel number to address.
*
* \return Constructed MIDI channel ID.
*/
#define MIDI_CHANNEL(channel) ((channel) - 1)
/** Constructs a MIDI event ID from a given MIDI command and a virtual MIDI cable index. This can then be
* used to create and decode \ref MIDI_EventPacket_t MIDI event packets.
*
* \param[in] virtualcable Index of the virtual MIDI cable the event relates to
* \param[in] command MIDI command to send through the virtual MIDI cable
*
* \return Constructed MIDI event ID.
*/
#define MIDI_EVENT(virtualcable, command) ((virtualcable << 4) | (command >> 4))
/* Enums: */
/** Enum for the possible MIDI jack types in a MIDI device jack descriptor. */
@ -290,8 +302,7 @@
*/
typedef struct
{
unsigned Command : 4; /**< Upper nibble of the MIDI command being sent or received in the event packet. */
unsigned CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface. */
uint8_t Event; /**< MIDI event type, constructed with the \ref MIDI_EVENT() macro. */
uint8_t Data1; /**< First byte of data in the MIDI event. */
uint8_t Data2; /**< Second byte of data in the MIDI event. */

@ -48,15 +48,16 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
if ((InterfaceIndex != AudioInterfaceInfo->Config.ControlInterfaceNumber) &&
(InterfaceIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber))
return;
{
return;
}
}
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
{
uint8_t EndpointIndex = (USB_ControlRequest.wIndex & 0xFF);
uint8_t EndpointAddress = (USB_ControlRequest.wIndex & 0xFF);
if ((EndpointIndex != (ENDPOINT_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber)) &&
(EndpointIndex != (ENDPOINT_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber)))
if ((EndpointAddress != AudioInterfaceInfo->Config.DataINEndpoint.Address) &&
(EndpointAddress != AudioInterfaceInfo->Config.DataOUTEndpoint.Address))
{
return;
}
@ -88,7 +89,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
case AUDIO_REQ_SetMinimum:
case AUDIO_REQ_SetMaximum:
case AUDIO_REQ_SetResolution:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
{
uint8_t EndpointProperty = USB_ControlRequest.bRequest;
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
@ -108,7 +109,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
EndpointControl, &ValueLength, Value);
}
}
else if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE)
{
uint8_t Property = USB_ControlRequest.bRequest;
uint8_t Entity = (USB_ControlRequest.wIndex >> 8);
@ -134,7 +135,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
case AUDIO_REQ_GetMinimum:
case AUDIO_REQ_GetMaximum:
case AUDIO_REQ_GetResolution:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
{
uint8_t EndpointProperty = USB_ControlRequest.bRequest;
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
@ -150,7 +151,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
Endpoint_ClearOUT();
}
}
else if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE)
{
uint8_t Property = USB_ControlRequest.bRequest;
uint8_t Entity = (USB_ControlRequest.wIndex >> 8);
@ -174,39 +175,15 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{
memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State));
AudioInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_ISOCHRONOUS;
AudioInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_ISOCHRONOUS;
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataINEndpoint, 1)))
return false;
if (EndpointNum == AudioInterfaceInfo->Config.DataINEndpointNumber)
{
Size = AudioInterfaceInfo->Config.DataINEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_ISOCHRONOUS;
DoubleBanked = true;
}
else if (EndpointNum == AudioInterfaceInfo->Config.DataOUTEndpointNumber)
{
Size = AudioInterfaceInfo->Config.DataOUTEndpointSize;
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_ISOCHRONOUS;
DoubleBanked = true;
}
else
{
continue;
}
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataOUTEndpoint, 1)))
return false;
return true;
}

@ -86,19 +86,8 @@
* structure controls.
*/
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming Audio Streaming data, if available
* (zero if unused).
*/
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming Audio Streaming data endpoint, if available
* (zero if unused).
*/
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
* (zero if unused).
*/
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
* (zero if unused).
*/
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -226,7 +215,7 @@
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpoint.Address);
return Endpoint_IsOUTReceived();
}
@ -247,7 +236,7 @@
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpoint.Address);
return Endpoint_IsINReady();
}
@ -341,7 +330,7 @@
{
Endpoint_Write_8(Sample);
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}
@ -360,7 +349,7 @@
{
Endpoint_Write_16_LE(Sample);
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}
@ -380,7 +369,7 @@
Endpoint_Write_16_LE(Sample);
Endpoint_Write_8(Sample >> 16);
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}

@ -69,8 +69,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
{
Endpoint_ClearSETUP();
while (!(Endpoint_IsOUTReceived()));
while (!(Endpoint_IsOUTReceived()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE();
CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8();
CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8();
@ -112,45 +116,18 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
{
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
CDCInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
CDCInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
CDCInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT;
if (EndpointNum == CDCInterfaceInfo->Config.DataINEndpointNumber)
{
Size = CDCInterfaceInfo->Config.DataINEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataINEndpointDoubleBank;
}
else if (EndpointNum == CDCInterfaceInfo->Config.DataOUTEndpointNumber)
{
Size = CDCInterfaceInfo->Config.DataOUTEndpointSize;
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank;
}
else if (EndpointNum == CDCInterfaceInfo->Config.NotificationEndpointNumber)
{
Size = CDCInterfaceInfo->Config.NotificationEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = CDCInterfaceInfo->Config.NotificationEndpointDoubleBank;
}
else
{
continue;
}
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataINEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataOUTEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.NotificationEndpoint, 1)))
return false;
return true;
}
@ -171,7 +148,7 @@ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_RWSTREAM_DeviceDisconnected;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
return Endpoint_Write_Stream_LE(String, strlen(String), NULL);
}
@ -182,7 +159,7 @@ uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_RWSTREAM_DeviceDisconnected;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
return Endpoint_Write_Stream_LE(Buffer, Length, NULL);
}
@ -192,7 +169,7 @@ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_RWSTREAM_DeviceDisconnected;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
if (!(Endpoint_IsReadWriteAllowed()))
{
@ -215,7 +192,7 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
uint8_t ErrorCode;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
if (!(Endpoint_BytesInEndpoint()))
return ENDPOINT_READYWAIT_NoError;
@ -240,7 +217,7 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return 0;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address);
if (Endpoint_IsOUTReceived())
{
@ -267,7 +244,7 @@ int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInf
int16_t ReceivedByte = -1;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address);
if (Endpoint_IsOUTReceived())
{
@ -286,7 +263,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpoint.Address);
USB_Request_Header_t Notification = (USB_Request_Header_t)
{

@ -99,19 +99,11 @@
{
struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the CDC interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the CDC interface's OUT data endpoint should use double banking. */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
bool NotificationEndpointDoubleBank; /**< Indicates if the CDC interface's notification endpoint should use double banking. */
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/

@ -141,13 +141,11 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
HIDInterfaceInfo->State.UsingReportProtocol = true;
HIDInterfaceInfo->State.IdleCount = 500;
if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize,
HIDInterfaceInfo->Config.ReportINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT;
if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1)))
return false;
return true;
}
@ -159,7 +157,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber())
return;
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
if (Endpoint_IsReadWriteAllowed())
{
@ -184,7 +182,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{
HIDInterfaceInfo->State.IdleMSRemaining = HIDInterfaceInfo->State.IdleCount;
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
if (ReportID)
Endpoint_Write_8(ReportID);

@ -85,9 +85,7 @@
{
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint. */
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking. */
USB_Endpoint_Table_t ReportINEndpoint; /**< Data IN HID report endpoint configuration table. */
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be
* stored by the driver, for comparison purposes to detect report changes that

@ -41,38 +41,14 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
if (EndpointNum == MIDIInterfaceInfo->Config.DataINEndpointNumber)
{
Size = MIDIInterfaceInfo->Config.DataINEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataINEndpointDoubleBank;
}
else if (EndpointNum == MIDIInterfaceInfo->Config.DataOUTEndpointNumber)
{
Size = MIDIInterfaceInfo->Config.DataOUTEndpointSize;
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank;
}
else
{
continue;
}
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
MIDIInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1)))
return false;
return true;
}
@ -95,7 +71,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
uint8_t ErrorCode;
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError)
return ErrorCode;
@ -113,7 +89,7 @@ uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
uint8_t ErrorCode;
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
if (Endpoint_BytesInEndpoint())
{
@ -132,7 +108,7 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
if (USB_DeviceState != DEVICE_STATE_Configured)
return false;
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address);
if (!(Endpoint_IsReadWriteAllowed()))
return false;

@ -81,13 +81,8 @@
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming MIDI IN data, if available (zero if unused). */
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming MIDI IN data endpoint, if available (zero if unused). */
bool DataINEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI OUT data, if available (zero if unused). */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI OUT data endpoint, if available (zero if unused). */
bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's OUT data endpoint should use double banking. */
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/

@ -75,38 +75,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
MSInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
MSInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
if (EndpointNum == MSInterfaceInfo->Config.DataINEndpointNumber)
{
Size = MSInterfaceInfo->Config.DataINEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataINEndpointDoubleBank;
}
else if (EndpointNum == MSInterfaceInfo->Config.DataOUTEndpointNumber)
{
Size = MSInterfaceInfo->Config.DataOUTEndpointSize;
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataOUTEndpointDoubleBank;
}
else
{
continue;
}
if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataINEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataOUTEndpoint, 1)))
return false;
return true;
}
@ -116,14 +92,14 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
if (Endpoint_IsReadWriteAllowed())
if (Endpoint_IsOUTReceived())
{
if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
{
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo);
@ -141,13 +117,13 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
if (MSInterfaceInfo->State.IsMassStoreReset)
{
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
@ -159,8 +135,8 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
{
uint16_t BytesProcessed;
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
BytesProcessed = 0;
while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
(sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) ==
@ -175,9 +151,9 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) ||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength > 16))
{
{
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
Endpoint_StallTransaction();
return false;
@ -199,7 +175,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
while (Endpoint_IsStalled())
{
@ -211,7 +187,7 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
return;
}
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
while (Endpoint_IsStalled())
{

@ -81,13 +81,8 @@
{
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the Mass Storage interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the Mass Storage interface's OUT data endpoint should use double banking. */
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section

@ -115,45 +115,18 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
{
memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State));
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
if (EndpointNum == RNDISInterfaceInfo->Config.DataINEndpointNumber)
{
Size = RNDISInterfaceInfo->Config.DataINEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataINEndpointDoubleBank;
}
else if (EndpointNum == RNDISInterfaceInfo->Config.DataOUTEndpointNumber)
{
Size = RNDISInterfaceInfo->Config.DataOUTEndpointSize;
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank;
}
else if (EndpointNum == RNDISInterfaceInfo->Config.NotificationEndpointNumber)
{
Size = RNDISInterfaceInfo->Config.NotificationEndpointSize;
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank;
}
else
{
continue;
}
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
RNDISInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
RNDISInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
RNDISInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT;
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataINEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataOUTEndpoint, 1)))
return false;
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.NotificationEndpoint, 1)))
return false;
return true;
}
@ -163,7 +136,7 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber);
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpoint.Address);
if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.ResponseReady)
{
@ -454,7 +427,7 @@ bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInte
return false;
}
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address);
return Endpoint_IsOUTReceived();
}
@ -468,7 +441,7 @@ uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfa
return ENDPOINT_RWSTREAM_DeviceDisconnected;
}
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address);
*PacketLength = 0;
@ -505,7 +478,7 @@ uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfa
return ENDPOINT_RWSTREAM_DeviceDisconnected;
}
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpoint.Address);
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
return ErrorCode;

@ -81,17 +81,9 @@
{
uint8_t ControlInterfaceNumber; /**< Interface number of the RNDIS control interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the RNDIS interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the RNDIS interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the RNDIS interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the RNDIS interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the RNDIS interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the RNDIS interface's OUT data endpoint should use double banking. */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the RNDIS interface's IN notification endpoint, if used. */
uint16_t NotificationEndpointSize; /**< Size in bytes of the RNDIS interface's IN notification endpoint, if used. */
bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking. */
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */
char* AdapterVendorDescription; /**< String description of the adapter vendor. */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */

@ -89,45 +89,19 @@ uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
bool DoubleBanked;
if (PipeNum == AOAInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = AOAInterfaceInfo->Config.DataINPipeDoubleBank;
AOAInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == AOAInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = AOAInterfaceInfo->Config.DataOUTPipeDoubleBank;
AOAInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return AOA_ENUMERROR_PipeConfigurationFailed;
}
}
AOAInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
AOAInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
AOAInterfaceInfo->State.IsActive = true;
AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber;
@ -260,7 +234,7 @@ uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL);
@ -277,7 +251,7 @@ uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL);
@ -294,7 +268,7 @@ uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_IsReadWriteAllowed()))
@ -316,7 +290,7 @@ uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo
if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive))
return 0;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -348,7 +322,7 @@ int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
int16_t ReceivedByte = -1;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -372,7 +346,7 @@ uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
uint8_t ErrorCode;
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_BytesInPipe()))

@ -85,11 +85,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the AOA interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the AOA interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the AOA interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the AOA interface's OUT data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
char* PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the
* Android device is switched into Open Accessory mode. */
@ -103,9 +100,6 @@
* Configured state.
*/
uint8_t InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the AOA interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the AOA interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.

@ -51,8 +51,8 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return AUDIO_ENUMERROR_InvalidConfigDescriptor;
while ((AudioInterfaceInfo->Config.DataINPipeNumber && !(DataINEndpoint)) ||
(AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint)))
while ((AudioInterfaceInfo->Config.DataINPipe.Address && !(DataINEndpoint)) ||
(AudioInterfaceInfo->Config.DataOUTPipe.Address && !(DataOUTEndpoint)))
{
if (!(AudioControlInterface) ||
USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
@ -93,45 +93,21 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
bool DoubleBanked;
if (PipeNum == AudioInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_ISOCHRONOUS;
DoubleBanked = true;
AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == AudioInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_ISOCHRONOUS;
DoubleBanked = true;
AudioInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return AUDIO_ENUMERROR_PipeConfigurationFailed;
}
}
AudioInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
AudioInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
AudioInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_ISOCHRONOUS;
AudioInterfaceInfo->Config.DataINPipe.Banks = 2;
AudioInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
AudioInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
AudioInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_ISOCHRONOUS;
AudioInterfaceInfo->Config.DataOUTPipe.Banks = 2;
if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
AudioInterfaceInfo->State.ControlInterfaceNumber = AudioControlInterface->InterfaceNumber;
AudioInterfaceInfo->State.StreamingInterfaceNumber = AudioStreamingInterface->InterfaceNumber;

@ -79,14 +79,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not
* bind to an IN endpoint, this may be set to 0 to disable audio input streaming for
* this driver instance.
*/
uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not
* bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for
* this driver instance.
*/
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -100,9 +94,6 @@
uint8_t StreamingInterfaceNumber; /**< Interface index of the Audio Streaming interface within the attached device. */
uint8_t EnabledStreamingAltIndex; /**< Alternative setting index of the Audio Streaming interface when the stream is enabled. */
uint16_t DataINPipeSize; /**< Size in bytes of the Audio interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Audio interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
@ -201,7 +192,7 @@
bool SampleReceived = false;
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
SampleReceived = Pipe_IsINReceived();
Pipe_Freeze();
@ -226,7 +217,7 @@
if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
return false;
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipe.Address);
return Pipe_IsOUTReady();
}

@ -99,62 +99,26 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
}
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
uint8_t InterruptPeriod;
bool DoubleBanked;
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber)
{
Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
EndpointAddress = NotificationEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = CDCInterfaceInfo->Config.NotificationPipeDoubleBank;
InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
CDCInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return CDC_ENUMERROR_PipeConfigurationFailed;
}
if (InterruptPeriod)
Pipe_SetInterruptPeriod(InterruptPeriod);
}
CDCInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
CDCInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
CDCInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
CDCInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
CDCInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
CDCInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT;
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.NotificationPipe, 1)))
return false;
CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber;
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR);
@ -231,7 +195,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -321,7 +285,7 @@ uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL);
@ -338,7 +302,7 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL);
@ -355,7 +319,7 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_IsReadWriteAllowed()))
@ -377,7 +341,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return 0;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -409,7 +373,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
int16_t ReceivedByte = -1;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -433,7 +397,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
uint8_t ErrorCode;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_BytesInPipe()))

@ -81,14 +81,9 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the CDC interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -100,10 +95,6 @@
*/
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe. */
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used. */
struct
{
uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_*

@ -94,55 +94,19 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
uint8_t InterruptPeriod;
bool DoubleBanked;
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = HIDInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = DataINEndpoint->PollingIntervalMS;
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
{
if (DataOUTEndpoint == NULL)
continue;
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = HIDInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = DataOUTEndpoint->PollingIntervalMS;
HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return HID_ENUMERROR_PipeConfigurationFailed;
}
if (InterruptPeriod)
Pipe_SetInterruptPeriod(InterruptPeriod);
}
HIDInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
HIDInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
HIDInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_INTERRUPT;
HIDInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
HIDInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT;
if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
HIDInterfaceInfo->State.HIDReportSize = LE16_TO_CPU(HIDDescriptor->HIDReportLength);
@ -227,7 +191,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
uint16_t ReportSize;
@ -277,7 +241,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
{
uint8_t ErrorCode;
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (ReportID)
@ -320,7 +284,7 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
bool ReportReceived;
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
ReportReceived = Pipe_IsINReceived();

@ -83,11 +83,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the HID interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific
* boot subclass protocol is required, a protocol value from the
@ -112,9 +109,6 @@
*/
uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe. */
bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot
* Protocol when enabled via \ref HID_Host_SetBootProtocol().
*/

@ -78,45 +78,19 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
bool DoubleBanked;
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataINPipeDoubleBank;
MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank;
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return MIDI_ENUMERROR_PipeConfigurationFailed;
}
}
MIDIInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
MIDIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
MIDIInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
MIDIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
MIDIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
MIDIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber;
MIDIInterfaceInfo->State.IsActive = true;
@ -181,7 +155,7 @@ uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo)
uint8_t ErrorCode;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
if (Pipe_BytesInPipe())
{
@ -202,7 +176,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
uint8_t ErrorCode;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@ -218,18 +192,27 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
bool DataReady = false;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber);
if (!(Pipe_IsReadWriteAllowed()))
return false;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL);
if (!(Pipe_IsReadWriteAllowed()))
Pipe_ClearIN();
if (Pipe_IsINReceived())
{
if (Pipe_BytesInPipe())
{
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL);
DataReady = true;
}
return true;
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
}
Pipe_Freeze();
return DataReady;
}
#endif

@ -79,11 +79,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -94,9 +91,6 @@
* Configured state.
*/
uint8_t InterfaceNumber; /**< Interface index of the MIDI interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.

@ -78,45 +78,19 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
bool DoubleBanked;
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataINPipeDoubleBank;
MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataOUTPipeDoubleBank;
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return MS_ENUMERROR_PipeConfigurationFailed;
}
}
MSInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
MSInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
MSInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
MSInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
MSInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
MSInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber;
MSInterfaceInfo->State.IsActive = true;
@ -178,7 +152,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
SCSICommandBlock->Signature = CPU_TO_LE32(MS_CBW_SIGNATURE);
SCSICommandBlock->Tag = cpu_to_le32(MSInterfaceInfo->State.TransactionTag);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t),
@ -212,7 +186,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
uint16_t TimeoutMSRem = MS_COMMAND_DATA_TIMEOUT_MS;
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
while (!(Pipe_IsINReceived()))
@ -228,7 +202,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
}
Pipe_Freeze();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsStalled())
@ -238,7 +212,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
}
Pipe_Freeze();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsStalled())
@ -251,10 +225,10 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
return PIPE_RWSTREAM_DeviceDisconnected;
};
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
Pipe_Freeze();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
@ -275,7 +249,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
return ErrorCode;
}
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
@ -285,7 +259,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
}
else
{
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
@ -313,7 +287,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),
@ -349,12 +323,12 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address);
if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful)
return ErrorCode;
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address);
if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful)
return ErrorCode;

@ -83,11 +83,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Mass Storage interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Mass Storage interface's OUT data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -99,9 +96,6 @@
*/
uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe. */
uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when

@ -78,45 +78,19 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
DataOUTEndpoint = EndpointData;
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
bool DoubleBanked;
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = PRNTInterfaceInfo->Config.DataINPipeDoubleBank;
PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank;
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return PRNT_ENUMERROR_PipeConfigurationFailed;
}
}
PRNTInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
PRNTInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
PRNTInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
PRNTInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
PRNTInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
PRNTInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber;
PRNTInterfaceInfo->State.AlternateSetting = PrinterInterface->AlternateSetting;
@ -229,7 +203,7 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
uint8_t ErrorCode;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_BytesInPipe()))
@ -260,7 +234,7 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
uint8_t ErrorCode;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_IsReadWriteAllowed()))
@ -285,7 +259,7 @@ uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL)) != PIPE_RWSTREAM_NoError)
@ -309,7 +283,7 @@ uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL)) != PIPE_RWSTREAM_NoError)
@ -329,7 +303,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return 0;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
@ -361,7 +335,7 @@ int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
int16_t ReceivedByte = -1;
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())

@ -79,11 +79,8 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Printer interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Printer interface's OUT data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -95,9 +92,6 @@
*/
uint8_t InterfaceNumber; /**< Interface index of the Printer interface within the attached device. */
uint8_t AlternateSetting; /**< Alternate setting within the Printer Interface in the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the Printer interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Printer interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.

@ -101,62 +101,26 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
}
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
uint8_t InterruptPeriod;
bool DoubleBanked;
if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
{
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
RNDISInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber)
{
Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
EndpointAddress = NotificationEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = RNDISInterfaceInfo->Config.NotificationPipeDoubleBank;
InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
RNDISInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return CDC_ENUMERROR_PipeConfigurationFailed;
}
RNDISInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
RNDISInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
RNDISInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
RNDISInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
RNDISInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
RNDISInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT;
if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
if (InterruptPeriod)
Pipe_SetInterruptPeriod(InterruptPeriod);
}
if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.NotificationPipe, 1)))
return false;
RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber;
RNDISInterfaceInfo->State.IsActive = true;
@ -419,7 +383,7 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
return false;
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
PacketWaiting = Pipe_IsINReceived();
@ -437,7 +401,7 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
return PIPE_READYWAIT_DeviceDisconnected;
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (!(Pipe_IsReadWriteAllowed()))
@ -491,7 +455,7 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
DeviceMessage.DataOffset = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
DeviceMessage.DataLength = cpu_to_le32(PacketLength);
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),

@ -80,14 +80,9 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the RNDIS interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the RNDIS interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking. */
uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */
uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
@ -101,10 +96,6 @@
*/
uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe. */
uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */
uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */

@ -87,63 +87,27 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
}
}
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
uint16_t Size;
uint8_t Type;
uint8_t Token;
uint8_t EndpointAddress;
uint8_t InterruptPeriod;
bool DoubleBanked;
if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber)
{
Size = DataINEndpoint->EndpointSize;
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = SIInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == SIInterfaceInfo->Config.DataOUTPipeNumber)
{
Size = DataOUTEndpoint->EndpointSize;
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = SIInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
SIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else if (PipeNum == SIInterfaceInfo->Config.EventsPipeNumber)
{
Size = EventsEndpoint->EndpointSize;
EndpointAddress = EventsEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
DoubleBanked = SIInterfaceInfo->Config.EventsPipeDoubleBank;
InterruptPeriod = EventsEndpoint->PollingIntervalMS;
SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize;
}
else
{
continue;
}
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
{
return SI_ENUMERROR_PipeConfigurationFailed;
}
if (InterruptPeriod)
Pipe_SetInterruptPeriod(InterruptPeriod);
}
SIInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
SIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
SIInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
SIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
SIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
SIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
SIInterfaceInfo->Config.EventsPipe.Size = le16_to_cpu(EventsEndpoint->EndpointSize);
SIInterfaceInfo->Config.EventsPipe.EndpointAddress = EventsEndpoint->EndpointAddress;
SIInterfaceInfo->Config.EventsPipe.Type = EP_TYPE_INTERRUPT;
if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataINPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataOUTPipe, 1)))
return false;
if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.EventsPipe, 1)))
return false;
SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;
SIInterfaceInfo->State.IsActive = true;
@ -204,7 +168,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if (SIInterfaceInfo->State.IsSessionOpen)
PIMAHeader->TransactionID = cpu_to_le32(SIInterfaceInfo->State.TransactionID++);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL)) != PIPE_RWSTREAM_NoError)
@ -233,7 +197,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
while (!(Pipe_IsINReceived()))
@ -249,7 +213,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
}
Pipe_Freeze();
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsStalled())
@ -259,7 +223,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
}
Pipe_Freeze();
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsStalled())
@ -298,7 +262,7 @@ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL);
@ -318,7 +282,7 @@ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL);
@ -335,7 +299,7 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return false;
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address);
Pipe_Unfreeze();
if (Pipe_BytesInPipe())
@ -354,7 +318,7 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NULL);

@ -83,14 +83,9 @@
{
struct
{
uint8_t DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Still Image interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking. */
uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
bool EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking. */
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
USB_Pipe_Table_t EventsPipe; /**< Event notification IN Pipe configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@ -102,10 +97,6 @@
*/
uint8_t InterfaceNumber; /**< Interface index of the Still Image interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe. */
uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe. */
bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */
uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */
} State; /**< State data for the USB class interface within the device. All elements in this section

@ -42,6 +42,21 @@
uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE;
#endif
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries)
{
for (uint8_t i = 0; i < Entries; i++)
{
if (!(Table[i].Address))
continue;
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
return false;
}
return true;
}
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
const uint8_t UECFG0XData,
const uint8_t UECFG1XData)

@ -89,35 +89,6 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define _ENDPOINT_GET_MAXSIZE(EPIndex) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## EPIndex)
#define _ENDPOINT_GET_MAXSIZE2(EPDetails) _ENDPOINT_GET_MAXSIZE3(EPDetails)
#define _ENDPOINT_GET_MAXSIZE3(MaxSize, Banks) (MaxSize)
#define _ENDPOINT_GET_BANKS(EPIndex) _ENDPOINT_GET_BANKS2(ENDPOINT_DETAILS_EP ## EPIndex)
#define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails)
#define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks)
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define ENDPOINT_DETAILS_MAXEP 7
#define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 256, 2
#define ENDPOINT_DETAILS_EP2 64, 2
#define ENDPOINT_DETAILS_EP3 64, 2
#define ENDPOINT_DETAILS_EP4 64, 2
#define ENDPOINT_DETAILS_EP5 64, 2
#define ENDPOINT_DETAILS_EP6 64, 2
#else
#define ENDPOINT_DETAILS_MAXEP 5
#define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 64, 1
#define ENDPOINT_DETAILS_EP2 64, 1
#define ENDPOINT_DETAILS_EP3 64, 2
#define ENDPOINT_DETAILS_EP4 64, 2
#endif
/* Inline Functions: */
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST
ATTR_ALWAYS_INLINE;
@ -145,23 +116,6 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have one single bank, which requires less USB FIFO memory but results
* in slower transfers as only one USB device (the AVR or the host) can access the endpoint's
* bank at the one time.
*/
#define ENDPOINT_BANK_SINGLE (0 << EPBK0)
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have two banks, which requires more USB FIFO memory but results
* in faster transfers as one USB device (the AVR or the host) can access one bank while the other
* accesses the second bank.
*/
#define ENDPOINT_BANK_DOUBLE (1 << EPBK0)
//@}
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
* value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined.
@ -169,30 +123,16 @@
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
#endif
/** Retrieves the maximum bank size in bytes of a given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex)
/** Retrieves the total number of banks supported by the given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_BANKS_SUPPORTED(EPIndex) _ENDPOINT_GET_BANKS(EPIndex)
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different USB AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define ENDPOINT_TOTAL_ENDPOINTS 7
#else
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different USB AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS 5
#endif
#else
#define ENDPOINT_TOTAL_ENDPOINTS 1
#endif
@ -222,28 +162,20 @@
};
/* Inline Functions: */
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
* and banking mode. Once configured, the endpoint may be read from or written to, depending
* on its direction.
/** Configures the specified endpoint address with the given endpoint type, bank size and number of hardware
* banks. Once configured, the endpoint may be read from or written to, depending on its direction.
*
* \param[in] Number Endpoint number to configure. This must be more than 0 and less than
* \ref ENDPOINT_TOTAL_ENDPOINTS.
* \param[in] Address Endpoint address to configure.
*
* \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types
* are available on Low Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] Direction Endpoint data direction, either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN.
* All endpoints (except Control type) are unidirectional - data may only be read
* from or written to the endpoint bank based on its direction, not both.
*
* \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted
* to the USB host, or after they have been received from the USB host (depending on
* the endpoint's data direction). The bank size must indicate the maximum packet size
* that the endpoint can handle.
*
* \param[in] Banks Number of banks to use for the endpoint being configured, an \c ENDPOINT_BANK_* mask.
* More banks uses more USB DPRAM, but offers better performance. Isochronous type
* endpoints <b>must</b> have at least two banks.
* \param[in] Banks Number of banks to use for the endpoint being configured.
*
* \attention When the \c ORDERED_EP_CONFIG compile time option is used, Endpoints <b>must</b> be configured in
* ascending order, or bank corruption will occur.
@ -261,19 +193,18 @@
*
* \return Boolean \c true if the configuration succeeded, \c false otherwise.
*/
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks) ATTR_ALWAYS_INLINE;
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks)
{
return Endpoint_ConfigureEndpoint_Prv(Number, ((Type << EPTYPE0) | (Direction ? (1 << EPDIR) : 0)),
((1 << ALLOC) | Banks | Endpoint_BytesToEPSizeMask(Size)));
return Endpoint_ConfigureEndpoint_Prv((Address & ENDPOINT_EPNUM_MASK),
((Type << EPTYPE0) | ((Address & ENDPOINT_DIR_IN) ? (1 << EPDIR) : 0)),
((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Endpoint_BytesToEPSizeMask(Size)));
}
/** Indicates the number of bytes currently stored in the current endpoint's selected bank.
@ -294,9 +225,19 @@
#endif
}
/** Determines the currently selected endpoint's direction.
*
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
*/
static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetEndpointDirection(void)
{
return (UECFG0X & (1 << EPDIR)) ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT;
}
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
* the currently selected endpoint number so that it can be restored after another endpoint has
* been manipulated.
* the currently selected endpoint so that it can be restored after another endpoint has been
* manipulated.
*
* \return Index of the currently selected endpoint.
*/
@ -304,38 +245,36 @@
static inline uint8_t Endpoint_GetCurrentEndpoint(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
return (UENUM & ENDPOINT_EPNUM_MASK);
return ((UENUM & ENDPOINT_EPNUM_MASK) | Endpoint_GetEndpointDirection());
#else
return ENDPOINT_CONTROLEP;
#endif
}
/** Selects the given endpoint number. If the address from the device descriptors is used, the
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint
* number (and discarding the endpoint direction bit).
/** Selects the given endpoint address.
*
* Any endpoint operations which do not require the endpoint number to be indicated will operate on
* Any endpoint operations which do not require the endpoint address to be indicated will operate on
* the currently selected endpoint.
*
* \param[in] EndpointNumber Endpoint number to select.
* \param[in] Address Endpoint address to select.
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_SelectEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t Address)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
UENUM = (Address & ENDPOINT_EPNUM_MASK);
#endif
}
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
* data In and Out pointers to the bank's contents.
*
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
* \param[in] Address Endpoint address whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t Address)
{
UERST = (1 << EndpointNumber);
UERST = (1 << (Address & ENDPOINT_EPNUM_MASK));
UERST = 0;
}
@ -441,14 +380,14 @@
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
* endpoints).
*
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested.
* \param[in] Address Address of the endpoint whose interrupt flag should be tested.
*
* \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise.
*/
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber)
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address)
{
return ((Endpoint_GetEndpointInterrupts() & (1 << EndpointNumber)) ? true : false);
return ((Endpoint_GetEndpointInterrupts() & (1 << (Address & ENDPOINT_EPNUM_MASK))) ? true : false);
}
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
@ -576,16 +515,6 @@
UECONX |= (1 << RSTDT);
}
/** Determines the currently selected endpoint's direction.
*
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
*/
static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetEndpointDirection(void)
{
return (UECFG0X & (1 << EPDIR)) ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT;
}
/** Sets the direction of the currently selected endpoint.
*
* \param[in] DirectionMask New endpoint direction, as a \c ENDPOINT_DIR_* mask.
@ -841,6 +770,20 @@
#endif
/* Function Prototypes: */
/** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple
* endpoints at the same time.
*
* \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the
* control endpoint.
*
* \param[in] Table Pointer to a table of endpoint descriptions.
* \param[in] Entries Number of entries in the endpoint table to configure.
*
* \return Boolean \c true if all endpoints configured successfully, \c false otherwise.
*/
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries);
/** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,
* with respect to the data direction. This is a convenience function which can be used to
* simplify user control request handling.

@ -114,9 +114,7 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe);
break;
case HOST_STATE_Powered_ConfigPipe:
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE)))
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, PIPE_CONTROLPIPE_DEFAULT_SIZE, 1)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
@ -151,9 +149,7 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
break;
case HOST_STATE_Default_PostReset:
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
USB_Host_ControlPipeSize, PIPE_BANK_SINGLE)))
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, USB_Host_ControlPipeSize, 1)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;

@ -40,21 +40,43 @@
uint8_t USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
bool Pipe_ConfigurePipe(const uint8_t Number,
bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table,
const uint8_t Entries)
{
for (uint8_t i = 0; i < Entries; i++)
{
if (!(Table[i].Address))
continue;
if (!(Pipe_ConfigurePipe(Table[i].Address, Table[i].Type, Table[i].EndpointAddress, Table[i].Size, Table[i].Banks)))
{
return false;
}
}
return true;
}
bool Pipe_ConfigurePipe(const uint8_t Address,
const uint8_t Type,
const uint8_t Token,
const uint8_t EndpointNumber,
const uint8_t EndpointAddress,
const uint16_t Size,
const uint8_t Banks)
{
uint8_t Number = (Address & PIPE_EPNUM_MASK);
uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT;
if (Type == EP_TYPE_CONTROL)
Token = PIPE_TOKEN_SETUP;
#if defined(ORDERED_EP_CONFIG)
Pipe_SelectPipe(Number);
Pipe_EnablePipe();
UPCFG1X = 0;
UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1X = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1X = ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Pipe_BytesToEPSizeMask(Size));
Pipe_SetInfiniteINRequests();
@ -71,7 +93,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG2XTemp = 0;
UPIENXTemp = 0;

@ -124,38 +124,22 @@
/** \name Pipe Token Masks */
//@{
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a SETUP token (for CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a SETUP token (for CONTROL type pipes),
* which will trigger a control request on the attached device when data is written to the pipe.
*/
#define PIPE_TOKEN_SETUP (0 << PTOKEN0)
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a IN token (for non-CONTROL type pipes),
* indicating that the pipe data will flow from device to host.
*/
#define PIPE_TOKEN_IN (1 << PTOKEN0)
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a OUT token (for non-CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a OUT token (for non-CONTROL type pipes),
* indicating that the pipe data will flow from host to device.
*/
#define PIPE_TOKEN_OUT (2 << PTOKEN0)
//@}
/** \name Pipe Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the pipe
* should have one single bank, which requires less USB FIFO memory but results in slower transfers as
* only one USB device (the AVR or the attached device) can access the pipe's bank at the one time.
*/
#define PIPE_BANK_SINGLE (0 << EPBK0)
/** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the pipe
* should have two banks, which requires more USB FIFO memory but results in faster transfers as one
* USB device (the AVR or the attached device) can access one bank while the other accesses the second
* bank.
*/
#define PIPE_BANK_DOUBLE (1 << EPBK0)
//@}
/** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
* in the device descriptor of the attached device.
*/
@ -203,36 +187,46 @@
return UPBCX;
}
/** Determines the currently selected pipe's direction.
*
* \return The currently selected pipe's direction, as a \c PIPE_DIR_* mask.
*/
static inline uint8_t Pipe_GetPipeDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetPipeDirection(void)
{
return (UPCFG0X & (1 << EPDIR)) ? PIPE_DIR_IN : PIPE_DIR_OUT;
}
/** Returns the pipe address of the currently selected pipe. This is typically used to save the
* currently selected pipe number so that it can be restored after another pipe has been manipulated.
* currently selected pipe address so that it can be restored after another pipe has been manipulated.
*
* \return Index of the currently selected pipe.
*/
static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetCurrentPipe(void)
{
return (UPNUM & PIPE_PIPENUM_MASK);
return ((UPNUM & PIPE_PIPENUM_MASK) | Pipe_GetPipeDirection());
}
/** Selects the given pipe number. Any pipe operations which do not require the pipe number to be
/** Selects the given pipe address. Any pipe operations which do not require the pipe address to be
* indicated will operate on the currently selected pipe.
*
* \param[in] PipeNumber Index of the pipe to select.
* \param[in] Address Address of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
static inline void Pipe_SelectPipe(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t Address)
{
UPNUM = PipeNumber;
UPNUM = (Address & PIPE_PIPENUM_MASK);
}
/** Resets the desired pipe, including the pipe banks and flags.
*
* \param[in] PipeNumber Index of the pipe to reset.
* \param[in] Address Address of the pipe to reset.
*/
static inline void Pipe_ResetPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_ResetPipe(const uint8_t PipeNumber)
static inline void Pipe_ResetPipe(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Pipe_ResetPipe(const uint8_t Address)
{
UPRST = (1 << PipeNumber);
UPRST = (1 << (Address & PIPE_PIPENUM_MASK));
UPRST = 0;
}
@ -326,8 +320,9 @@
static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetBoundEndpointAddress(void)
{
return (((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK) |
((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? PIPE_EPDIR_MASK : 0));
uint8_t UPCFG0X_Temp = UPCFG0X;
return (((UPCFG0X_Temp >> PEPNUM0) & PIPE_EPNUM_MASK) | ((UPCFG0X_Temp & PEPNUM1) ? ENDPOINT_DIR_OUT : ENDPOINT_DIR_IN));
}
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
@ -351,17 +346,17 @@
return UPINT;
}
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
/** Determines if the specified pipe address has interrupted (valid only for INTERRUPT type
* pipes).
*
* \param[in] PipeNumber Index of the pipe whose interrupt flag should be tested.
* \param[in] Address Address of the pipe whose interrupt flag should be tested.
*
* \return Boolean \c true if the specified pipe has interrupted, \c false otherwise.
*/
static inline bool Pipe_HasPipeInterrupted(const uint8_t PipeNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_HasPipeInterrupted(const uint8_t PipeNumber)
static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_HasPipeInterrupted(const uint8_t Address)
{
return ((UPINT & (1 << PipeNumber)) ? true : false);
return ((UPINT & (1 << (Address & PIPE_PIPENUM_MASK))) ? true : false);
}
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
@ -810,8 +805,22 @@
extern uint8_t USB_Host_ControlPipeSize;
/* Function Prototypes: */
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the
* attached device, bank size and banking mode.
/** Configures a table of pipe descriptions, in sequence. This function can be used to configure multiple
* pipes at the same time.
*
* \note Pipe with a zero address will be ignored, thus this function cannot be used to configure the
* control pipe.
*
* \param[in] Table Pointer to a table of pipe descriptions.
* \param[in] Entries Number of entries in the pipe table to configure.
*
* \return Boolean \c true if all pipes configured successfully, \c false otherwise.
*/
bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table,
const uint8_t Entries);
/** Configures the specified pipe address with the given pipe type, endpoint address within the attached device, bank size
* and number of hardware banks.
*
* A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze()
* before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or
@ -819,25 +828,19 @@
* numbers of IN requests without automatic freezing - this can be overridden by a call to
* \ref Pipe_SetFiniteINRequests().
*
* \param[in] Number Pipe number to configure. This must be more than 0 and less than \ref PIPE_TOTAL_PIPES.
*
* \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low
* Speed USB devices - refer to the USB 2.0 specification.
* \param[in] Address Pipe address to configure.
*
* \param[in] Token Pipe data token, either \ref PIPE_TOKEN_SETUP, \ref PIPE_TOKEN_OUT or \ref PIPE_TOKEN_IN.
* All pipes (except Control type) are unidirectional - data may only be read from or
* written to the pipe bank based on its direction, not both.
* \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low
* Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] EndpointNumber Endpoint index within the attached device that the pipe should interface to.
* \param[in] EndpointAddress Endpoint address within the attached device that the pipe should interface to.
*
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
* the USB device, or after they have been received from the USB device (depending on
* the pipe's data direction). The bank size must indicate the maximum packet size that
* the pipe can handle.
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
* the USB device, or after they have been received from the USB device (depending on
* the pipe's data direction). The bank size must indicate the maximum packet size that
* the pipe can handle.
*
* \param[in] Banks Number of banks to use for the pipe being configured, a \c PIPE_BANK_* mask. More banks
* uses more USB DPRAM, but offers better performance. Isochronous type pipes <b>must</b>
* have at least two banks.
* \param[in] Banks Number of banks to use for the pipe being configured.
*
* \attention When the \c ORDERED_EP_CONFIG compile time option is used, Pipes <b>must</b> be configured in ascending order,
* or bank corruption will occur.
@ -855,10 +858,9 @@
*
* \return Boolean \c true if the configuration succeeded, \c false otherwise.
*/
bool Pipe_ConfigurePipe(const uint8_t Number,
bool Pipe_ConfigurePipe(const uint8_t Address,
const uint8_t Type,
const uint8_t Token,
const uint8_t EndpointNumber,
const uint8_t EndpointAddress,
const uint16_t Size,
const uint8_t Banks);

@ -232,8 +232,7 @@ static void USB_Init_Device(void)
#endif
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
USB_INT_Clear(USB_INT_SUSPI);
USB_INT_Enable(USB_INT_SUSPI);

@ -171,8 +171,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Enable(USB_INT_WAKEUPI);
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
#if defined(INTERRUPT_CONTROL_ENDPOINT)
USB_INT_Enable(USB_INT_RXSTPI);

@ -289,7 +289,6 @@ static void USB_Device_GetStatus(void)
switch (USB_ControlRequest.bmRequestType)
{
#if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
#if !defined(NO_DEVICE_SELF_POWER)
if (USB_Device_CurrentlySelfPowered)
@ -301,17 +300,16 @@ static void USB_Device_GetStatus(void)
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
#endif
break;
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
#if !defined(CONTROL_ONLY_DEVICE)
Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
CurrentStatus = Endpoint_IsStalled();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
#endif
break;
#endif
default:
return;
}

@ -87,6 +87,18 @@
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Type define for a endpoint table entry, used to configure endpoints in groups via
* \ref Endpoint_ConfigureEndpointTable().
*/
typedef struct
{
uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */
uint16_t Size; /**< Size of the endpoint bank, in bytes. */
uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */
uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */
} USB_Endpoint_Table_t;
/* Macros: */
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
* numerical address in the device.

@ -97,6 +97,19 @@
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** Type define for a pipe table entry, used to configure pipes in groups via
* \ref Pipe_ConfigurePipeTable().
*/
typedef struct
{
uint8_t Address; /**< Address of the pipe to configure, or zero if the table entry is to be unused. */
uint16_t Size; /**< Size of the pipe bank, in bytes. */
uint8_t EndpointAddress; /** Address of the endpoint in the connected device. */
uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */
uint8_t Banks; /**< Number of hardware banks to use for the pipe. */
} USB_Pipe_Table_t;
/* Macros: */
/** Pipe address for the default control pipe, which always resides in address 0. This is
* defined for convenience to give more readable code when used with the pipe macros.
@ -113,11 +126,6 @@
*/
#define PIPE_EPNUM_MASK 0x0F
/** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
* direction for comparing with the \c ENDPOINT_DIR_* masks.
*/
#define PIPE_EPDIR_MASK 0x80
/* Architecture Includes: */
#if (ARCH == ARCH_AVR8)
#include "AVR8/Pipe_AVR8.h"

@ -94,8 +94,8 @@
*
* \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number.
*/
#define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
#define VERSION_BCD(x) CPU_TO_LE16((VERSION_TENS(x) << 12) | (VERSION_ONES(x) << 8) | \
(VERSION_TENTHS(x) << 4) | (VERSION_HUNDREDTHS(x) << 0) )
/** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors
* to indicate that the English language is supported by the device in its string descriptors.
@ -722,10 +722,10 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define VERSION_TENS(x) (int)((x) / 10)
#define VERSION_ONES(x) (int)((x) - (10 * VERSION_TENS(x)))
#define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10)
#define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))
#define VERSION_TENS(x) (int)((int)(x) / 10)
#define VERSION_ONES(x) (int)((int)(x) % 10)
#define VERSION_TENTHS(x) (int)(((x * 1) - ((int)(x * 1))) * 10)
#define VERSION_HUNDREDTHS(x) (int)(((x * 10) - ((int)(x * 10))) * 10)
#endif
/* Disable C linkage for C++ Compilers: */

@ -45,6 +45,23 @@ uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE;
volatile uint32_t USB_Endpoint_SelectedEndpoint = ENDPOINT_CONTROLEP;
volatile uint8_t* USB_Endpoint_FIFOPos[ENDPOINT_TOTAL_ENDPOINTS];
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries)
{
for (uint8_t i = 0; i < Entries; i++)
{
if (!(Table[i].Address))
continue;
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
{
return false;
}
}
return true;
}
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
const uint32_t UECFG0Data)
{

@ -90,47 +90,6 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define _ENDPOINT_GET_MAXSIZE(EPIndex) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## EPIndex)
#define _ENDPOINT_GET_MAXSIZE2(EPDetails) _ENDPOINT_GET_MAXSIZE3(EPDetails)
#define _ENDPOINT_GET_MAXSIZE3(MaxSize, Banks) (MaxSize)
#define _ENDPOINT_GET_BANKS(EPIndex) _ENDPOINT_GET_BANKS2(ENDPOINT_DETAILS_EP ## EPIndex)
#define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails)
#define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks)
#if defined(USB_SERIES_UC3A0_AVR32) || defined(USB_SERIES_UC3A1_AVR32)
#define ENDPOINT_DETAILS_MAXEP 7
#define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 256, 2
#define ENDPOINT_DETAILS_EP2 256, 2
#define ENDPOINT_DETAILS_EP3 64, 2
#define ENDPOINT_DETAILS_EP4 64, 2
#define ENDPOINT_DETAILS_EP5 256, 2
#define ENDPOINT_DETAILS_EP6 256, 2
#elif defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32)
#define ENDPOINT_DETAILS_MAXEP 8
#define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 512, 3
#define ENDPOINT_DETAILS_EP2 512, 3
#define ENDPOINT_DETAILS_EP3 512, 3
#define ENDPOINT_DETAILS_EP4 512, 3
#define ENDPOINT_DETAILS_EP5 512, 3
#define ENDPOINT_DETAILS_EP6 512, 3
#define ENDPOINT_DETAILS_EP7 512, 3
#elif defined(USB_SERIES_UC3B0_AVR32) || defined(USB_SERIES_UC3B1_AVR32)
#define ENDPOINT_DETAILS_MAXEP 7
#define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 64, 2
#define ENDPOINT_DETAILS_EP2 64, 2
#define ENDPOINT_DETAILS_EP3 64, 2
#define ENDPOINT_DETAILS_EP4 64, 2
#define ENDPOINT_DETAILS_EP5 256, 2
#define ENDPOINT_DETAILS_EP6 256, 2
#endif
#define ENDPOINT_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL)
/* Inline Functions: */
@ -162,34 +121,6 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have one single bank, which requires less USB FIFO memory but results
* in slower transfers as only one USB device (the AVR or the host) can access the endpoint's
* bank at the one time.
*/
#define ENDPOINT_BANK_SINGLE AVR32_USBB_UECFG0_EPBK_SINGLE
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have two banks, which requires more USB FIFO memory but results
* in faster transfers as one USB device (the AVR or the host) can access one bank while the other
* accesses the second bank.
*/
#define ENDPOINT_BANK_DOUBLE AVR32_USBB_UECFG0_EPBK_DOUBLE
#if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || defined(__DOXYGEN__)
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have three banks, which requires more USB FIFO memory but results
* in faster transfers as one USB device (the AVR or the host) can access one bank while the other
* accesses the remaining banks.
*
* \note Not available on all AVR models.
*/
#define ENDPOINT_BANK_TRIPLE AVR32_USBB_UECFG0_EPBK_TRIPLE
#endif
//@}
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
* value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined.
@ -197,30 +128,16 @@
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
#endif
/** Retrieves the maximum bank size in bytes of a given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex)
/** Retrieves the total number of banks supported by the given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_BANKS_SUPPORTED(EPIndex) _ENDPOINT_GET_BANKS(EPIndex)
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP
#if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32)
#define ENDPOINT_TOTAL_ENDPOINTS 8
#else
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS 7
#endif
#else
#define ENDPOINT_TOTAL_ENDPOINTS 1
#endif
@ -250,28 +167,21 @@
};
/* Inline Functions: */
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
/** Configures the specified endpoint address with the given endpoint type, direction, bank size
* and banking mode. Once configured, the endpoint may be read from or written to, depending
* on its direction.
*
* \param[in] Number Endpoint number to configure. This must be more than 0 and less than
* \ref ENDPOINT_TOTAL_ENDPOINTS.
* \param[in] Address Endpoint address to configure.
*
* \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types
* are available on Low Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] Direction Endpoint data direction, either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN.
* All endpoints (except Control type) are unidirectional - data may only be read
* from or written to the endpoint bank based on its direction, not both.
*
* \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted
* to the USB host, or after they have been received from the USB host (depending on
* the endpoint's data direction). The bank size must indicate the maximum packet size
* that the endpoint can handle.
*
* \param[in] Banks Number of banks to use for the endpoint being configured, an \c ENDPOINT_BANK_* mask.
* More banks uses more USB DPRAM, but offers better performance. Isochronous type
* endpoints <b>must</b> have at least two banks.
* \param[in] Banks Number of hardware banks to use for the endpoint being configured.
*
* \attention When the \c ORDERED_EP_CONFIG compile time option is used, Endpoints <b>must</b> be configured in
* ascending order, or bank corruption will occur.
@ -289,22 +199,21 @@
*
* \return Boolean \c true if the configuration succeeded, \c false otherwise.
*/
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks) ATTR_ALWAYS_INLINE;
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks)
{
return Endpoint_ConfigureEndpoint_Prv(Number, (AVR32_USBB_ALLOC_MASK |
((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) |
((uint32_t)(Direction ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) |
((uint32_t)Banks << AVR32_USBB_EPBK_OFFSET) |
Endpoint_BytesToEPSizeMask(Size))));
return Endpoint_ConfigureEndpoint_Prv((Address & ENDPOINT_EPNUM_MASK),
(AVR32_USBB_ALLOC_MASK |
((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) |
((uint32_t)(Address & ENDPOINT_DIR_IN) ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) |
((uint32_t)Banks << AVR32_USBB_EPBK_OFFSET) |
Endpoint_BytesToEPSizeMask(Size)));
}
/** Indicates the number of bytes currently stored in the current endpoint's selected bank.
@ -319,41 +228,51 @@
return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].byct;
}
/** Determines the currently selected endpoint's direction.
*
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
*/
static inline uint32_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_GetEndpointDirection(void)
{
return ((&AVR32_USBB.UECFG0)[USB_Endpoint_SelectedEndpoint].epdir ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT);
}
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
* the currently selected endpoint number so that it can be restored after another endpoint has
* been manipulated.
* the currently selected endpoint so that it can be restored after another endpoint has been
* manipulated.
*
* \return Index of the currently selected endpoint.
*/
static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetCurrentEndpoint(void)
{
return USB_Endpoint_SelectedEndpoint;
return (USB_Endpoint_SelectedEndpoint | Endpoint_GetEndpointDirection());
}
/** Selects the given endpoint number. If the address from the device descriptors is used, the
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint
* number (and discarding the endpoint direction bit).
/** Selects the given endpoint address.
*
* Any endpoint operations which do not require the endpoint number to be indicated will operate on
* Any endpoint operations which do not require the endpoint address to be indicated will operate on
* the currently selected endpoint.
*
* \param[in] EndpointNumber Endpoint number to select.
* \param[in] Address Endpoint address to select.
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_SelectEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t Address)
{
USB_Endpoint_SelectedEndpoint = EndpointNumber;
USB_Endpoint_SelectedEndpoint = (Address & ENDPOINT_EPNUM_MASK);
}
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
* data In and Out pointers to the bank's contents.
*
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
* \param[in] Address Endpoint number whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t Address)
{
uint32_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK);
AVR32_USBB.uerst |= (AVR32_USBB_EPRST0_MASK << EndpointNumber);
AVR32_USBB.uerst &= ~(AVR32_USBB_EPRST0_MASK << EndpointNumber);
USB_Endpoint_FIFOPos[EndpointNumber] = &AVR32_USBB_SLAVE[EndpointNumber * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];
@ -452,8 +371,8 @@
*
* \return Mask whose bits indicate which endpoints have interrupted.
*/
static inline uint8_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetEndpointInterrupts(void)
static inline uint32_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_GetEndpointInterrupts(void)
{
return ((AVR32_USBB.udint & (AVR32_USBB_EP6INT_MASK | AVR32_USBB_EP5INT_MASK |
AVR32_USBB_EP4INT_MASK | AVR32_USBB_EP3INT_MASK |
@ -464,14 +383,14 @@
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
* endpoints).
*
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested.
* \param[in] Address Address of the endpoint whose interrupt flag should be tested.
*
* \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise.
*/
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber)
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address)
{
return ((Endpoint_GetEndpointInterrupts() & (AVR32_USBB_EP0INT_MASK << EndpointNumber)) ? true : false);
return ((Endpoint_GetEndpointInterrupts() & (AVR32_USBB_EP0INT_MASK << (Address & ENDPOINT_EPNUM_MASK))) ? true : false);
}
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
@ -596,16 +515,6 @@
(&AVR32_USBB.UECON0SET)[USB_Endpoint_SelectedEndpoint].rstdts = true;
}
/** Determines the currently selected endpoint's direction.
*
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
*/
static inline uint32_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_GetEndpointDirection(void)
{
return ((&AVR32_USBB.UECFG0)[USB_Endpoint_SelectedEndpoint].epdir ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT);
}
/** Sets the direction of the currently selected endpoint.
*
* \param[in] DirectionMask New endpoint direction, as a \c ENDPOINT_DIR_* mask.
@ -837,6 +746,20 @@
#endif
/* Function Prototypes: */
/** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple
* endpoints at the same time.
*
* \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the
* control endpoint.
*
* \param[in] Table Pointer to a table of endpoint descriptions.
* \param[in] Entries Number of entries in the endpoint table to configure.
*
* \return Boolean \c true if all endpoints configured successfully, \c false otherwise.
*/
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries);
/** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,
* with respect to the data direction. This is a convenience function which can be used to
* simplify user control request handling.

@ -114,9 +114,7 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe);
break;
case HOST_STATE_Powered_ConfigPipe:
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE)))
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, PIPE_CONTROLPIPE_DEFAULT_SIZE, 1)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
@ -151,9 +149,7 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
break;
case HOST_STATE_Default_PostReset:
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
USB_Host_ControlPipeSize, PIPE_BANK_SINGLE)))
if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, USB_Host_ControlPipeSize, 1)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;

@ -43,13 +43,35 @@ uint8_t USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
volatile uint32_t USB_Pipe_SelectedPipe = PIPE_CONTROLPIPE;
volatile uint8_t* USB_Pipe_FIFOPos[PIPE_TOTAL_PIPES];
bool Pipe_ConfigurePipe(const uint8_t Number,
bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table,
const uint8_t Entries)
{
for (uint8_t i = 0; i < Entries; i++)
{
if (!(Table[i].Address))
continue;
if (!(Pipe_ConfigurePipe(Table[i].Address, Table[i].Type, Table[i].EndpointAddress, Table[i].Size, Table[i].Banks)))
{
return false;
}
}
return true;
}
bool Pipe_ConfigurePipe(const uint8_t Address,
const uint8_t Type,
const uint8_t Token,
const uint8_t EndpointNumber,
const uint8_t EndpointAddress,
const uint16_t Size,
const uint8_t Banks)
{
uint8_t Number = (Address & PIPE_EPNUM_MASK);
uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT;
if (Type == EP_TYPE_CONTROL)
Token = PIPE_TOKEN_SETUP;
USB_Pipe_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * 0x10000];
#if defined(ORDERED_EP_CONFIG)
@ -60,7 +82,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
(&AVR32_USBB.upcfg0)[Number] = (AVR32_USBB_ALLOC_MASK |
((uint32_t)Type << AVR32_USBB_PTYPE_OFFSET) |
((uint32_t)Token << AVR32_USBB_PTOKEN_OFFSET) |
((uint32_t)Banks << AVR32_USBB_PBK_OFFSET) |
((Banks > 1) ? AVR32_USBB_PBK_MASK : 0) |
Pipe_BytesToEPSizeMask(Size) |
((EndpointNumber & PIPE_EPNUM_MASK) << AVR32_USBB_PEPNUM_OFFSET));
@ -79,9 +101,9 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
UPCFG0Temp = (AVR32_USBB_ALLOC_MASK |
((uint32_t)Type << AVR32_USBB_PTYPE_OFFSET) |
((uint32_t)Token << AVR32_USBB_PTOKEN_OFFSET) |
((uint32_t)Banks << AVR32_USBB_PBK_OFFSET) |
((Banks > 1) ? AVR32_USBB_PBK_MASK : 0) |
Pipe_BytesToEPSizeMask(Size) |
((EndpointNumber & PIPE_EPNUM_MASK) << AVR32_USBB_PEPNUM_OFFSET));
((EndpointAddress & PIPE_EPNUM_MASK) << AVR32_USBB_PEPNUM_OFFSET));
}
else
{

@ -131,49 +131,22 @@
/** \name Pipe Token Masks */
//@{
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a SETUP token (for CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a SETUP token (for CONTROL type pipes),
* which will trigger a control request on the attached device when data is written to the pipe.
*/
#define PIPE_TOKEN_SETUP AVR32_USBB_UPCFG0_PTOKEN_SETUP
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a IN token (for non-CONTROL type pipes),
* indicating that the pipe data will flow from device to host.
*/
#define PIPE_TOKEN_IN AVR32_USBB_UPCFG0_PTOKEN_IN
/** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a OUT token (for non-CONTROL type pipes),
/** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a OUT token (for non-CONTROL type pipes),
* indicating that the pipe data will flow from host to device.
*/
#define PIPE_TOKEN_OUT AVR32_USBB_UPCFG0_PTOKEN_OUT
//@}
/** \name Pipe Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the pipe
* should have one single bank, which requires less USB FIFO memory but results in slower transfers as
* only one USB device (the AVR or the attached device) can access the pipe's bank at the one time.
*/
#define PIPE_BANK_SINGLE AVR32_USBB_UPCFG0_PBK_SINGLE
/** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the pipe
* should have two banks, which requires more USB FIFO memory but results in faster transfers as one
* USB device (the AVR or the attached device) can access one bank while the other accesses the second
* bank.
*/
#define PIPE_BANK_DOUBLE AVR32_USBB_UPCFG0_PBK_DOUBLE
#if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || defined(__DOXYGEN__)
/** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the
* pipe should have three banks, which requires more USB FIFO memory but results in faster transfers
* as one USB device (the AVR or the attached device) can access one bank while the other accesses the
* remaining banks.
*
* \note Not available on all AVR models.
*/
#define PIPE_BANK_TRIPLE AVR32_USBB_UPCFG0_PBK_TRIPLE
#endif
//@}
/** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
* in the device descriptor of the attached device.
*/
@ -224,6 +197,16 @@
return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].pbyct;
}
/** Determines the currently selected pipe's direction.
*
* \return The currently selected pipe's direction, as a \c PIPE_DIR_* mask.
*/
static inline uint8_t Pipe_GetPipeDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetPipeDirection(void)
{
return (((&AVR32_USBB.UPCFG0)[USB_Endpoint_SelectedEndpoint].ptoken == PIPE_TOKEN_OUT) ? PIPE_DIR_OUT : PIPE_DIR_IN);
}
/** Returns the pipe address of the currently selected pipe. This is typically used to save the
* currently selected pipe number so that it can be restored after another pipe has been manipulated.
*
@ -232,30 +215,32 @@
static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetCurrentPipe(void)
{
return USB_Pipe_SelectedPipe;
return (USB_Pipe_SelectedPipe | Pipe_GetPipeDirection());
}
/** Selects the given pipe number. Any pipe operations which do not require the pipe number to be
/** Selects the given pipe address. Any pipe operations which do not require the pipe address to be
* indicated will operate on the currently selected pipe.
*
* \param[in] PipeNumber Index of the pipe to select.
* \param[in] Address Address of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
static inline void Pipe_SelectPipe(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t Address)
{
USB_Pipe_SelectedPipe = PipeNumber;
USB_Pipe_SelectedPipe = (Address & PIPE_EPNUM_MASK);
}
/** Resets the desired pipe, including the pipe banks and flags.
*
* \param[in] PipeNumber Index of the pipe to reset.
* \param[in] Address Index of the pipe to reset.
*/
static inline void Pipe_ResetPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_ResetPipe(const uint8_t PipeNumber)
static inline void Pipe_ResetPipe(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Pipe_ResetPipe(const uint8_t Address)
{
uint32_t PipeNumber = (Address & PIPE_EPNUM_MASK);
AVR32_USBB.uprst |= (AVR32_USBB_PRST0_MASK << PipeNumber);
AVR32_USBB.uprst &= ~(AVR32_USBB_PRST0_MASK << PipeNumber);
USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE];
USB_Pipe_FIFOPos[PipeNumber] = &AVR32_USBB_SLAVE[PipeNumber * PIPE_HSB_ADDRESS_SPACE_SIZE];
}
/** Enables the currently selected pipe so that data can be sent and received through it to and from
@ -349,7 +334,7 @@
static inline uint8_t Pipe_GetBoundEndpointAddress(void)
{
return ((&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].pepnum |
((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? PIPE_EPDIR_MASK : 0));
((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? PIPE_DIR_IN : PIPE_DIR_OUT));
}
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
@ -376,17 +361,17 @@
AVR32_USBB_P0INT_MASK)) >> AVR32_USBB_P0INT_OFFSET);
}
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
/** Determines if the specified pipe address has interrupted (valid only for INTERRUPT type
* pipes).
*
* \param[in] PipeNumber Index of the pipe whose interrupt flag should be tested.
* \param[in] Address Address of the pipe whose interrupt flag should be tested.
*
* \return Boolean \c true if the specified pipe has interrupted, \c false otherwise.
*/
static inline bool Pipe_HasPipeInterrupted(const uint8_t PipeNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_HasPipeInterrupted(const uint8_t PipeNumber)
static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_HasPipeInterrupted(const uint8_t Address)
{
return ((AVR32_USBB.uhint & (AVR32_USBB_P0INTES_MASK << PipeNumber)) ? true : false);
return ((AVR32_USBB.uhint & (AVR32_USBB_P0INTES_MASK << (Address & PIPE_EPNUM_MASK))) ? true : false);
}
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
@ -821,8 +806,22 @@
extern uint8_t USB_Host_ControlPipeSize;
/* Function Prototypes: */
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the
* attached device, bank size and banking mode.
/** Configures a table of pipe descriptions, in sequence. This function can be used to configure multiple
* pipes at the same time.
*
* \note Pipe with a zero address will be ignored, thus this function cannot be used to configure the
* control pipe.
*
* \param[in] Table Pointer to a table of pipe descriptions.
* \param[in] Entries Number of entries in the pipe table to configure.
*
* \return Boolean \c true if all pipes configured successfully, \c false otherwise.
*/
bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table,
const uint8_t Entries);
/** Configures the specified pipe address with the given pipe type, endpoint address within the attached device, bank size
* and number of hardware banks.
*
* A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze()
* before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or
@ -830,25 +829,19 @@
* numbers of IN requests without automatic freezing - this can be overridden by a call to
* \ref Pipe_SetFiniteINRequests().
*
* \param[in] Number Pipe number to configure. This must be more than 0 and less than \ref PIPE_TOTAL_PIPES.
*
* \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low
* Speed USB devices - refer to the USB 2.0 specification.
* \param[in] Address Pipe address to configure.
*
* \param[in] Token Pipe data token, either \ref PIPE_TOKEN_SETUP, \ref PIPE_TOKEN_OUT or \ref PIPE_TOKEN_IN.
* All pipes (except Control type) are unidirectional - data may only be read from or
* written to the pipe bank based on its direction, not both.
* \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low
* Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] EndpointNumber Endpoint index within the attached device that the pipe should interface to.
* \param[in] EndpointAddress Endpoint address within the attached device that the pipe should interface to.
*
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
* the USB device, or after they have been received from the USB device (depending on
* the pipe's data direction). The bank size must indicate the maximum packet size that
* the pipe can handle.
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
* the USB device, or after they have been received from the USB device (depending on
* the pipe's data direction). The bank size must indicate the maximum packet size that
* the pipe can handle.
*
* \param[in] Banks Number of banks to use for the pipe being configured, a \c PIPE_BANK_* mask. More banks
* uses more USB DPRAM, but offers better performance. Isochronous type pipes <b>must</b>
* have at least two banks.
* \param[in] Banks Number of banks to use for the pipe being configured.
*
* \note When the \c ORDERED_EP_CONFIG compile time option is used, Pipes <b>must</b> be configured in ascending order,
* or bank corruption will occur.
@ -867,10 +860,9 @@
*
* \return Boolean \c true if the configuration succeeded, \c false otherwise.
*/
bool Pipe_ConfigurePipe(const uint8_t Number,
bool Pipe_ConfigurePipe(const uint8_t Address,
const uint8_t Type,
const uint8_t Token,
const uint8_t EndpointNumber,
const uint8_t EndpointAddress,
const uint16_t Size,
const uint8_t Banks);

@ -191,8 +191,7 @@ static void USB_Init_Device(void)
USB_INT_Enable(USB_INT_VBUSTI);
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
USB_INT_Clear(USB_INT_SUSPI);
USB_INT_Enable(USB_INT_SUSPI);

@ -121,8 +121,7 @@ ISR(USB_GEN_vect)
USB_Device_SetDeviceAddress(0);
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
#if defined(INTERRUPT_CONTROL_ENDPOINT)
USB_INT_Enable(USB_INT_RXSTPI);

@ -81,6 +81,24 @@
#define ENDPOINT_DIR_IN 0x80
//@}
/** \name Pipe Direction Masks */
//@{
/** Pipe direction mask, for masking against pipe addresses to retrieve the pipe's
* direction for comparing with the \c PIPE_DIR_* masks.
*/
#define PIPE_DIR_MASK 0x80
/** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with
* the index of the address within a device to obtain the full endpoint address.
*/
#define PIPE_DIR_OUT 0x00
/** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with
* the index of the address within a device to obtain the full endpoint address.
*/
#define PIPE_DIR_IN 0x80
//@}
/** \name Endpoint/Pipe Type Masks */
//@{
/** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared

@ -137,6 +137,16 @@
*/
#define USB_SERIES_B3_XMEGA
/** Indicates that the target AVR microcontroller belongs to the XMEGA C3 Series USB controller
* (i.e. ATXMEGA*C3) when defined.
*/
#define USB_SERIES_C3_XMEGA
/** Indicates that the target AVR microcontroller belongs to the XMEGA C4 Series USB controller
* (i.e. ATXMEGA*C4) when defined.
*/
#define USB_SERIES_C4_XMEGA
/** Indicates that the target microcontroller and compilation settings allow for the
* target to be configured in USB Device mode when defined.
*/
@ -219,6 +229,14 @@
#elif (defined(__AVR_ATxmega128B3__) || defined(__AVR_ATxmega64B3__))
#define USB_SERIES_B3_XMEGA
#define USB_CAN_BE_DEVICE
#elif (defined(__AVR_ATxmega128C3__) || defined(__AVR_ATxmega64C3__) || \
defined(__AVR_ATxmega192C3__) || defined(__AVR_ATxmega256C3__) || \
defined(__AVR_ATxmega384C3__))
#define USB_SERIES_C3_XMEGA
#define USB_CAN_BE_DEVICE
#elif (defined(__AVR_ATxmega16C4__) || defined(__AVR_ATxmega32C4__))
#define USB_SERIES_C4_XMEGA
#define USB_CAN_BE_DEVICE
#endif
#if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST))

@ -92,10 +92,12 @@
*/
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
* USB interface should be initialized in full speed (12Mb/s) mode.
*/
#define USB_DEVICE_OPT_FULLSPEED (0 << 0)
#if (F_USB > 6000000)
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
* USB interface should be initialized in full speed (12Mb/s) mode.
*/
#define USB_DEVICE_OPT_FULLSPEED (0 << 0)
#endif
//@}
#if (!defined(NO_INTERNAL_SERIAL) || defined(__DOXYGEN__))
@ -157,7 +159,7 @@
static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint16_t USB_Device_GetFrameNumber(void)
{
return USB_EndpointTable.FrameNum;
return ((USB_EndpointTable_t*)USB.EPPTR)->FrameNum;
}
#if !defined(NO_SOF_EVENTS)

@ -48,20 +48,36 @@ volatile uint8_t USB_Endpoint_SelectedEndpoint;
volatile USB_EP_t* USB_Endpoint_SelectedHandle;
volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO;
bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Number,
const uint8_t Direction,
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries)
{
for (uint8_t i = 0; i < Entries; i++)
{
if (!(Table[i].Address))
continue;
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
{
return false;
}
}
return true;
}
bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address,
const uint8_t Config,
const uint8_t Size)
{
Endpoint_SelectEndpoint(Number | Direction);
Endpoint_SelectEndpoint(Address);
USB_Endpoint_SelectedHandle->CTRL = 0;
USB_Endpoint_SelectedHandle->STATUS = (Direction == ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0;
USB_Endpoint_SelectedHandle->STATUS = (Address & ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0;
USB_Endpoint_SelectedHandle->CTRL = Config;
USB_Endpoint_SelectedHandle->CNT = 0;
USB_Endpoint_SelectedHandle->DATAPTR = (intptr_t)USB_Endpoint_SelectedFIFO->Data;
USB_Endpoint_SelectedFIFO->Length = (Direction == ENDPOINT_DIR_IN) ? Size : 0;
USB_Endpoint_SelectedFIFO->Length = (Address & ENDPOINT_DIR_IN) ? Size : 0;
USB_Endpoint_SelectedFIFO->Position = 0;
return true;
@ -71,8 +87,8 @@ void Endpoint_ClearEndpoints(void)
{
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
{
USB_EndpointTable.Endpoints[EPNum].IN.CTRL = 0;
USB_EndpointTable.Endpoints[EPNum].OUT.CTRL = 0;
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
}
}

@ -88,14 +88,20 @@
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Public Interface - May be used in end-application: */
/* Macros: */
#define _ENDPOINT_GET_MAXSIZE(EPIndex) 1023
#define _ENDPOINT_GET_BANKS(EPIndex) 2
#define ENDPOINT_DETAILS_MAXEP 16
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different USB AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS 16
#else
#define ENDPOINT_TOTAL_ENDPOINTS 1
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Type Defines: */
typedef struct
{
@ -112,7 +118,7 @@
} Endpoint_FIFOPair_t;
/* External Variables: */
extern Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_DETAILS_MAXEP];
extern Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_TOTAL_ENDPOINTS];
extern volatile uint8_t USB_Endpoint_SelectedEndpoint;
extern volatile USB_EP_t* USB_Endpoint_SelectedHandle;
extern volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO;
@ -135,8 +141,7 @@
}
/* Function Prototypes: */
bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Number,
const uint8_t Direction,
bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address,
const uint8_t Config,
const uint8_t Size);
void Endpoint_ClearEndpoints(void);
@ -144,23 +149,6 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have one single bank, which requires less USB FIFO memory but results
* in slower transfers as only one USB device (the AVR or the host) can access the endpoint's
* bank at the one time.
*/
#define ENDPOINT_BANK_SINGLE 0
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
* that the endpoint should have two banks, which requires more USB FIFO memory but results
* in faster transfers as one USB device (the AVR or the host) can access one bank while the other
* accesses the second bank.
*/
#define ENDPOINT_BANK_DOUBLE USB_EP_PINGPONG_bm
//@}
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
* value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined.
@ -168,34 +156,6 @@
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
#endif
/** Retrieves the maximum bank size in bytes of a given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex)
/** Retrieves the total number of banks supported by the given endpoint.
*
* \attention This macro will only work correctly on endpoint indexes that are compile-time constants
* defined by the preprocessor.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1)
*/
#define ENDPOINT_BANKS_SUPPORTED(EPIndex) _ENDPOINT_GET_BANKS(EPIndex)
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different USB AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
*/
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP
#else
#define ENDPOINT_TOTAL_ENDPOINTS 1
#endif
/* Enums: */
/** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function.
*
@ -221,54 +181,47 @@
};
/* Inline Functions: */
/** Selects the given endpoint number. If the address from the device descriptors is used, the
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint
* number (and discarding the endpoint direction bit).
/** Selects the given endpoint address.
*
* Any endpoint operations which do not require the endpoint number to be indicated will operate on
* Any endpoint operations which do not require the endpoint address to be indicated will operate on
* the currently selected endpoint.
*
* \param[in] EndpointNumber Endpoint number to select.
* \param[in] Address Endpoint address to select.
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber);
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_SelectEndpoint(const uint8_t Address);
static inline void Endpoint_SelectEndpoint(const uint8_t Address)
{
USB_Endpoint_SelectedEndpoint = EndpointNumber;
uint8_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK);
USB_Endpoint_SelectedEndpoint = Address;
if (EndpointNumber & ENDPOINT_DIR_IN)
if (Address & ENDPOINT_DIR_IN)
{
USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber & ENDPOINT_EPNUM_MASK].IN;
USB_Endpoint_SelectedHandle = &USB_EndpointTable.Endpoints[EndpointNumber & ENDPOINT_EPNUM_MASK].IN;
USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber].IN;
USB_Endpoint_SelectedHandle = &((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EndpointNumber].IN;
}
else
{
USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber & ENDPOINT_EPNUM_MASK].OUT;
USB_Endpoint_SelectedHandle = &USB_EndpointTable.Endpoints[EndpointNumber & ENDPOINT_EPNUM_MASK].OUT;
USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber].OUT;
USB_Endpoint_SelectedHandle = &((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EndpointNumber].OUT;
}
}
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
/** Configures the specified endpoint address with the given endpoint type, direction, bank size
* and banking mode. Once configured, the endpoint may be read from or written to, depending
* on its direction.
*
* \param[in] Number Endpoint number to configure. This must be more than 0 and less than
* \ref ENDPOINT_TOTAL_ENDPOINTS.
* \param[in] Address Endpoint address to configure.
*
* \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types
* are available on Low Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] Direction Endpoint data direction, either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN.
* All endpoints (except Control type) are unidirectional - data may only be read
* from or written to the endpoint bank based on its direction, not both.
*
* \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted
* to the USB host, or after they have been received from the USB host (depending on
* the endpoint's data direction). The bank size must indicate the maximum packet size
* that the endpoint can handle.
*
* \param[in] Banks Number of banks to use for the endpoint being configured, an \c ENDPOINT_BANK_* mask.
* More banks uses more USB DPRAM, but offers better performance. Isochronous type
* endpoints <b>must</b> have at least two banks.
* \param[in] Banks Number of hardware banks to use for the endpoint being configured.
*
* \note The default control endpoint should not be manually configured by the user application, as
* it is automatically configured by the library internally.
@ -278,21 +231,19 @@
*
* \return Boolean \c true if the configuration succeeded, \c false otherwise.
*/
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks) ATTR_ALWAYS_INLINE;
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number,
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks)
{
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | Banks | Endpoint_BytesToEPSizeMask(Size));
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
// TODO - Fix once limitations are lifted
if ((Banks != ENDPOINT_BANK_SINGLE) || (Size > 64))
if ((Banks > 1) || (Size > 64))
return false;
switch (Type)
@ -309,9 +260,9 @@
}
if (Type == EP_TYPE_CONTROL)
Endpoint_ConfigureEndpoint_PRV(Number, (Direction ^ ENDPOINT_DIR_IN), EPConfigMask, Size);
Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size);
return Endpoint_ConfigureEndpoint_PRV(Number, Direction, EPConfigMask, Size);
return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size);
}
/** Indicates the number of bytes currently stored in the current endpoint's selected bank.
@ -327,8 +278,8 @@
}
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
* the currently selected endpoint number so that it can be restored after another endpoint has
* been manipulated.
* the currently selected endpoint so that it can be restored after another endpoint has been
* manipulated.
*
* \return Index of the currently selected endpoint.
*/
@ -341,15 +292,15 @@
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
* data In and Out pointers to the bank's contents.
*
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
* \param[in] Address Endpoint address whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber)
static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetEndpoint(const uint8_t Address)
{
if (EndpointNumber & ENDPOINT_DIR_IN)
USB_Endpoint_FIFOs[EndpointNumber & ENDPOINT_EPNUM_MASK].IN.Position = 0;
if (Address & ENDPOINT_DIR_IN)
USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].IN.Position = 0;
else
USB_Endpoint_FIFOs[EndpointNumber & ENDPOINT_EPNUM_MASK].OUT.Position = 0;
USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].OUT.Position = 0;
}
/** Determines if the currently selected endpoint is enabled, but not necessarily configured.
@ -388,10 +339,7 @@
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsReadWriteAllowed(void)
{
if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN)
return (USB_Endpoint_SelectedFIFO->Position < USB_Endpoint_SelectedFIFO->Length);
else
return (USB_Endpoint_SelectedFIFO->Position > 0);
return (USB_Endpoint_SelectedFIFO->Position < USB_Endpoint_SelectedFIFO->Length);
}
/** Determines if the currently selected endpoint is configured.
@ -404,32 +352,6 @@
return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) ? true : false);
}
/** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their
* interrupt duration has elapsed. Which endpoints have interrupted can be determined by
* masking the return value against <tt>(1 << <i>{Endpoint Number}</i>)</tt>.
*
* \return Mask whose bits indicate which endpoints have interrupted.
*/
static inline uint8_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetEndpointInterrupts(void)
{
return 0; // TODO
}
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
* endpoints).
*
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested.
*
* \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise.
*/
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber)
{
(void)EndpointNumber;
return 0; // TODO
}
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
*
* \ingroup Group_EndpointPacketManagement_XMEGA
@ -800,6 +722,20 @@
#endif
/* Function Prototypes: */
/** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple
* endpoints at the same time.
*
* \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the
* control endpoint.
*
* \param[in] Table Pointer to a table of endpoint descriptions.
* \param[in] Entries Number of entries in the endpoint table to configure.
*
* \return Boolean \c true if all endpoints configured successfully, \c false otherwise.
*/
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
const uint8_t Entries);
/** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,
* with respect to the data direction. This is a convenience function which can be used to
* simplify user control request handling.

@ -43,7 +43,8 @@ volatile uint8_t USB_CurrentMode = USB_MODE_None;
volatile uint8_t USB_Options;
#endif
USB_EndpointTable_t USB_EndpointTable ATTR_ALIGNED(4);
/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */
uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1];
void USB_Init(
#if defined(USB_CAN_BE_BOTH)
@ -75,8 +76,9 @@ void USB_Init(
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
NVM.CMD = 0;
USB.EPPTR = (intptr_t)&USB_EndpointTable;
USB.CTRLA = (USB_STFRNUM_bm | USB_MAXEP_gm);
/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */
USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0));
USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp));
if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH)
USB.INTCTRLA = (3 << USB_INTLVL_gp);
@ -103,13 +105,17 @@ void USB_Disable(void)
void USB_ResetInterface(void)
{
#if defined(USB_DEVICE_OPT_FULLSPEED)
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
else
CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp);
#else
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
#endif
if (USB_Options & USB_OPT_PLLCLKSRC)
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
else
CLK.USBCTRL |= (CLK_USBSRC_RC32M_gc | CLK_USBSEN_bm);
@ -172,8 +178,7 @@ static void USB_Init_Device(void)
USB_Device_SetFullSpeed();
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
USB_INT_Enable(USB_INT_BUSEVENTI);

@ -69,7 +69,7 @@
} ATTR_PACKED USB_EndpointTable_t;
/* External Variables: */
extern USB_EndpointTable_t USB_EndpointTable;
extern uint8_t USB_EndpointTable[];
#endif
@ -95,7 +95,7 @@
#error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile.
#endif
#if (F_USB % 6000000)
#if ((F_USB % 6000000) || (F_USB < 6000000))
#error Invalid F_USB specified. F_USB must be a multiple of 6MHz for USB Low Speed operation, and a multiple of 48MHz for Full Speed operation.
#endif

@ -97,8 +97,7 @@ ISR(USB_BUSEVENT_vect)
Endpoint_ClearEndpoints();
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_Device_ControlEndpointSize, 1);
EVENT_USB_Device_Reset();
}

@ -166,9 +166,12 @@
* .Config =
* {
* .StreamingInterfaceNumber = 1,
*
* .DataINEndpointNumber = 1,
* .DataINEndpointSize = 256,
* .DataINEndpoint =
* {
* .Address = (ENDPOINT_DIR_IN | 1),
* .Size = 64,
* .Banks = 1,
* },
* },
* };
* \endcode
@ -262,11 +265,18 @@
* {
* .Config =
* {
* .DataINPipeNumber = 1,
* .DataINPipeDoubleBank = false,
*
* .DataOUTPipeNumber = 2,
* .DataOUTPipeDoubleBank = false,
* .DataINPipe =
* {
* .Address = (PIPE_DIR_IN | 1),
* .Size = 64,
* .Banks = 1,
* },
* .DataOUTPipe =
* {
* .Address = (PIPE_DIR_OUT | 2),
* .Size = 64,
* .Banks = 1,
* },
* },
* };
* \endcode

@ -53,13 +53,13 @@
*
* void main(void)
* {
* // Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it
* XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, 32000000);
* XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL, F_CPU);
* // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it
* XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
* XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
*
* // Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference
* // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference
* XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
* XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, 48000000);
* XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
* }
* \endcode
*
@ -117,6 +117,26 @@
};
/* Inline Functions: */
/** Write a value to a location protected by the XMEGA CCP protection mechanism. This function uses inline assembly to ensure that
* the protected address is written to within four clock cycles of the CCP key being written.
*
* \param[in] Address Address to write to, a memory address protected by the CCP mechanism
* \param[in] Value Value to write to the protected location
*/
static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_ALWAYS_INLINE;
static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value)
{
__asm__ __volatile__ (
"out %0, __zero_reg__" "\n\t" /* Zero RAMPZ using fixed zero value register */
"movw r30, %1" "\n\t" /* Copy address to Z register pair */
"out %2, %3" "\n\t" /* Write key to CCP register */
"st Z, %4" "\n\t" /* Indirectly write value to address */
: /* No output operands */
: /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value)
: /* Clobbered registers: */ "r30", "r31"
);
}
/** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until
* the oscillator is ready for use.
*
@ -219,6 +239,9 @@
if (SourceFreq > Frequency)
return false;
if (MulFactor > 31)
return false;
switch (Source)
{
@ -355,8 +378,7 @@
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
GlobalInterruptDisable();
CCP = CCP_IOREG_gc;
CLK_CTRL = ClockSourceMask;
XMEGACLK_CCP_Write(&CLK.CTRL, ClockSourceMask);
SetGlobalInterruptMask(CurrentGlobalInt);

@ -8,11 +8,12 @@
# Maintenance scripts not required by general LUFA users, used for project development purposes.
# Path to the root of the LUFA tree
LUFA_ROOT = ../
all:
# Update all Doxygen configuration files to the latest Doxygen version - force Markdown support to be disabled
upgrade-doxygen:
@echo Upgrading Doxygen.conf files...
@ -36,13 +37,6 @@ check-documentation-placeholders:
fi;
@echo Done.
# Test all generated documentation for any bad links
check-documentation-links:
@for html_file in `find $(LUFA_ROOT) -name *.html`; do \
echo Checking $$html_file...; \
cat $$html_file | grep -v "doxygen.org" | grep -v "fourwalledcubicle.com" | wget -nv --referer=www.lufa-lib.org --user-agent="lufa-link-check-script" -B $(dir $$html_file) --spider --force-html --input-file=-; \
done;
# Validate the working branch - compile all documentation, demos/projects/examples and run build tests
validate-branch:
make -s -C $(LUFA_ROOT) doxygen

@ -93,12 +93,10 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup AVRISP Data Endpoint(s) */
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
#if defined(LIBUSB_DRIVER_COMPAT)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
#endif
/* Indicate endpoint configuration success or failure */
@ -114,7 +112,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPADDR);
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())

@ -106,7 +106,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | AVRISP_DATA_IN_EPNUM),
.EndpointAddress = AVRISP_DATA_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
.PollingIntervalMS = 0x0A
@ -116,7 +116,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
.EndpointAddress = AVRISP_DATA_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
.PollingIntervalMS = 0x0A

@ -42,18 +42,15 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#if !defined(LIBUSB_DRIVER_COMPAT)
/** Endpoint number of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPNUM 2
#if !defined(LIBUSB_DRIVER_COMPAT) || defined(__DOXYGEN__)
/** Endpoint address of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPNUM 2
/** Endpoint address of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPADDR (ENDPOINT_DIR_IN | 2)
#else
/** Endpoint number of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPNUM 2
/** Endpoint number of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPNUM 3
#define AVRISP_DATA_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
#define AVRISP_DATA_IN_EPADDR (ENDPOINT_DIR_IN | 3)
#endif
/** Size in bytes of the AVRISP data endpoint. */

@ -57,7 +57,7 @@ void ISPProtocol_EnterISPMode(void)
Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ResponseStatus = STATUS_CMD_FAILED;
@ -115,7 +115,7 @@ void ISPProtocol_LeaveISPMode(void)
Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
/* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
@ -154,7 +154,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(V2Command);
@ -175,7 +175,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
}
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ProgrammingStatus = STATUS_CMD_OK;
@ -295,7 +295,7 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(V2Command);
@ -368,7 +368,7 @@ void ISPProtocol_ChipErase(void)
Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ResponseStatus = STATUS_CMD_OK;
@ -404,7 +404,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ResponseBytes[4];
@ -435,7 +435,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
/* Send the Fuse or Lock byte program commands as given by the host to the device */
@ -463,7 +463,7 @@ void ISPProtocol_SPIMulti(void)
Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(CMD_SPI_MULTI);

@ -150,7 +150,7 @@ void V2Protocol_ProcessCommand(void)
TCCR0B = 0;
Endpoint_WaitUntilReady();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
}
@ -169,7 +169,7 @@ static void V2Protocol_UnknownCommand(const uint8_t V2Command)
}
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(V2Command);
@ -181,7 +181,7 @@ static void V2Protocol_UnknownCommand(const uint8_t V2Command)
static void V2Protocol_SignOn(void)
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(CMD_SIGN_ON);
@ -197,7 +197,7 @@ static void V2Protocol_SignOn(void)
static void V2Protocol_ResetProtection(void)
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(CMD_RESET_PROTECTION);
@ -220,7 +220,7 @@ static void V2Protocol_GetSetParam(const uint8_t V2Command)
ParamValue = Endpoint_Read_8();
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(V2Command);
@ -254,7 +254,7 @@ static void V2Protocol_LoadAddress(void)
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
if (CurrentAddress & (1UL << 31))

@ -37,7 +37,7 @@
#include "V2ProtocolParams.h"
/* Non-Volatile Parameter Values for EEPROM storage */
static uint8_t EEMEM EEPROM_Reset_Polarity = 0x00;
static uint8_t EEMEM EEPROM_Reset_Polarity = 0x01;
/* Volatile Parameter Values for RAM storage */
static ParameterItem_t ParameterTable[] =

@ -174,6 +174,8 @@ void XMEGANVM_DisablePDI(void)
*/
bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
{
*CRCDest = 0;
/* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
return false;

@ -65,7 +65,7 @@ void XPROGProtocol_SetMode(void)
Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;
@ -112,7 +112,7 @@ void XPROGProtocol_Command(void)
static void XPROGProtocol_EnterXPROGMode(void)
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
bool NVMBusEnabled = false;
@ -134,7 +134,7 @@ static void XPROGProtocol_EnterXPROGMode(void)
static void XPROGProtocol_LeaveXPROGMode(void)
{
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
@ -169,7 +169,7 @@ static void XPROGProtocol_Erase(void)
Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t EraseCommand;
@ -260,7 +260,7 @@ static void XPROGProtocol_WriteMemory(void)
}
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
@ -342,7 +342,7 @@ static void XPROGProtocol_ReadMemory(void)
ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ReadBuffer[256];
@ -385,7 +385,7 @@ static void XPROGProtocol_ReadCRC(void)
Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint32_t MemoryCRC;
@ -467,7 +467,7 @@ static void XPROGProtocol_SetParam(void)
}
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_Write_8(CMD_XPROG);

@ -51,7 +51,7 @@
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
/* On the XPLAIN board, we only need PDI programming
for the ATXMEGA128A1 - disable ISP to prevent hardware
damage.
damage and force-enable XPROG.
*/
#undef ENABLE_ISP_PROTOCOL

@ -78,7 +78,7 @@ void XPROGTarget_EnableTargetTPI(void)
DDRD |= (1 << 5) | (1 << 3);
DDRD &= ~(1 << 2);
/* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
/* Set up the synchronous USART for TPI communications - 8 data bits, even parity, 2 stop bits */
UBRR1 = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
UCSR1B = (1 << TXEN1);
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);

@ -62,19 +62,25 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};

@ -131,7 +131,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -157,20 +157,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -47,14 +47,17 @@ USB_ClassInfo_HID_Host_t Device_HID_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
};

@ -120,20 +120,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 5
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 5)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@ -57,11 +57,11 @@
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

@ -40,15 +40,18 @@ USB_ClassInfo_MS_Device_t DiskDevice_MS_Interface =
.Config =
{
.InterfaceNumber = 0,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = 1,
},
};

@ -39,11 +39,16 @@ USB_ClassInfo_MS_Host_t DiskHost_MS_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
},
};

@ -5,7 +5,7 @@
#include "diskio.h"
#include <string.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/USB/USB.h>
#include "../DataflashManager.h"
#include "../../DiskHost.h"

@ -143,7 +143,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -169,20 +169,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -44,19 +44,25 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};

@ -199,10 +199,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
.EndpointAddress = MIDI_STREAM_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,
@ -224,10 +224,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM),
.EndpointAddress = MIDI_STREAM_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.Refresh = 0,

@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 2
/** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPNUM 1
/** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64

@ -45,14 +45,18 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
.Config =
{
.StreamingInterfaceNumber = 1,
.DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
.DataINEndpointSize = MIDI_STREAM_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
.DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MIDI_STREAM_IN_EPADDR,
.Size = MIDI_STREAM_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MIDI_STREAM_OUT_EPADDR,
.Size = MIDI_STREAM_EPSIZE,
.Banks = 1,
},
},
};
@ -96,7 +100,7 @@ int main(void)
MIDI_EventPacket_t ReceivedMIDIEvent;
if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
{
if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
if ((ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
{
DDSNoteData* LRUNoteStruct = &NoteData[0];
@ -130,7 +134,7 @@ int main(void)
/* Turn on indicator LED to indicate note generation activity */
LEDs_SetAllLEDs(LEDS_LED1);
}
else if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_OFF >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
else if ((ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_OFF)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
{
bool FoundActiveNote = false;

@ -132,10 +132,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_EPNUM),
.EndpointAddress = KEYBOARD_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -58,8 +58,8 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the keyboard key press reporting endpoint. */
#define KEYBOARD_EPNUM 1
/** Endpoint address of the keyboard key press reporting endpoint. */
#define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size of the keyboard report endpoints, in bytes. */
#define KEYBOARD_EPSIZE 8

@ -57,11 +57,12 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINEndpointDoubleBank = KEYBOARD_EPSIZE,
.ReportINEndpoint =
{
.Address = KEYBOARD_EPADDR,
.Size = KEYBOARD_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},

@ -149,10 +149,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MEDIACONTROL_HID_EPNUM),
.EndpointAddress = MEDIACONTROL_HID_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MEDIACONTROL_HID_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -57,11 +57,11 @@
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint number of the Media Control HID reporting IN endpoint. */
#define MEDIACONTROL_HID_EPNUM 1
/** Endpoint address of the Media Control HID reporting IN endpoint. */
#define MEDIACONTROL_HID_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Media Control HID reporting IN and OUT endpoints. */
#define MEDIACONTROL_HID_EPSIZE 8
/** Size in bytes of the Media Control HID reporting IN endpoint. */
#define MEDIACONTROL_HID_EPSIZE 8
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,

@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t MediaControl_HID_Interface =
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpointNumber = MEDIACONTROL_HID_EPNUM,
.ReportINEndpointSize = MEDIACONTROL_HID_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = MEDIACONTROL_HID_EPADDR,
.Size = MEDIACONTROL_HID_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevMediaControlHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMediaControlHIDReportBuffer),
},

@ -109,16 +109,14 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
/* Check if the HID interface contained an optional OUT data endpoint */
if (DataOUTEndpoint)
{
/* Configure the HID data OUT pipe */
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1);
}
/* Valid data found, return success */

@ -45,11 +45,11 @@
/** Interface Class value for the Human Interface Device class. */
#define HID_CLASS 0x03
/** Pipe number for the HID data IN pipe. */
#define HID_DATA_IN_PIPE 1
/** Pipe address for the HID data IN pipe. */
#define HID_DATA_IN_PIPE (PIPE_DIR_IN | 1)
/** Pipe number for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE 2
/** Pipe address for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE (PIPE_DIR_OUT | 2)
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "OB's Dual-Relay outlet control using a Teensy2++"
PROJECT_NAME = "OB's Dual-Relay Outlet Control Project"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -0,0 +1,272 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
* the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
* This allows the host to track a device across insertions on different ports, allowing them to retain allocated
* resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
* so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
* from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
* port location).
*/
#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
#endif
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_NoSpecificSubclass,
.Protocol = CDC_CSCP_NoSpecificProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x204B,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
.TotalEndpoints = 1,
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_ACMSubclass,
.Protocol = CDC_CSCP_ATCommandProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
.CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
.CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
.TotalEndpoints = 2,
.Class = CDC_CSCP_CDCDataClass,
.SubClass = CDC_CSCP_NoDataSubclass,
.Protocol = CDC_CSCP_NoDataProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
}
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String},
.UnicodeString = L"Simon Foster"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(19), .Type = DTYPE_String},
.UnicodeString = L"USB-HD44780 Adapter"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
}
*DescriptorAddress = Address;
return Size;
}

@ -0,0 +1,90 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Command Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

@ -0,0 +1,1814 @@
# Doxyfile 1.8.0
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ").
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or sequence of words) that should
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "Simon Foster's USB Serial to HD44780 LCD Project"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify an logo or icon that is
# included in the documentation. The maximum height of the logo should not
# exceed 55 pixels and the maximum width should not exceed 200 pixels.
# Doxygen will copy the logo to the output directory.
PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = ./Documentation/
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is
# used as the annotated text. Otherwise, the brief description is used as-is.
# If left blank, the following values are used ("$name" is automatically
# replaced with the name of the entity): "The $name class" "The $name widget"
# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = YES
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful if your file system
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
# comment as the brief description. If set to NO, the comments
# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 4
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
# "class=itcl::class" will allow you to use the command class in the
# itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for
# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this
# tag. The format is ext=language, where ext is a file extension, and language
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING =
# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
# comments according to the Markdown format, which allows for more readable
# documentation. See http://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you
# can mix doxygen, HTML, and XML commands with Markdown formatting.
# Disable only in case of backward compatibilities issues.
MARKDOWN_SUPPORT = NO
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
# func(std::string) {}). This also makes the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
# unions are shown inside the group in which they are included (e.g. using
# @ingroup) instead of on a separate page (for HTML and Man pages) or
# section (for LaTeX and RTF).
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
# unions with only public data fields will be shown inline in the documentation
# of the scope in which they are defined (i.e. file, namespace, or group
# documentation), provided this scope is documented. If set to NO (the default),
# structs, classes, and unions are shown on a separate page (for HTML and Man
# pages) or section (for LaTeX and RTF).
INLINE_SIMPLE_STRUCTS = NO
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penalty.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
SYMBOL_CACHE_SIZE = 0
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
# their name and scope. Since this can be an expensive process and often the
# same symbol appear multiple times in the code, doxygen keeps a cache of
# pre-resolved symbols. If the cache is too small doxygen will become slower.
# If the cache is too large, memory is wasted. The cache size is given by this
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
EXTRACT_PACKAGE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespaces are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
# will list include files with double quotes in the documentation
# rather than with sharp brackets.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that
# constructors and destructors are listed first. If set to NO (the default)
# the constructors will appear in the respective orders defined by
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
SORT_BY_SCOPE_NAME = NO
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
# do proper type resolution of all parameters of a function it will reject a
# match between the prototype and the implementation of a member function even
# if there is only one candidate or it is obvious which candidate to choose
# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
# will still accept a match between prototype and implementation in such cases.
STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = NO
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = NO
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = NO
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or macro consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and macros in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = YES
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page.
# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. The create the layout file
# that represents doxygen's defaults, run doxygen with the -l option.
# You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file.
LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files
# containing the references data. This must be a list of .bib files. The
# .bib extension is automatically appended if omitted. Using this command
# requires the bibtex tool to be installed. See also
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
# feature you need bibtex and perl available in the search path.
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# The WARN_NO_PARAMDOC option can be enabled to get warnings for
# functions that are documented, but have no documentation for their parameters
# or return value. If set to NO (the default) doxygen will only warn about
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text. Optionally the format may contain
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ./
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
# *.f90 *.f *.for *.vhd *.vhdl
FILE_PATTERNS = *.h \
*.c \
*.txt
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = Documentation/
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories. Note that the wildcards are matched
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS = __* \
INCLUDE_FROM_*
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS = *
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis.
# Doxygen will compare the file name with each pattern and apply the
# filter if there is a match.
# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
# info on how filters are used. If FILTER_PATTERNS is empty or if
# non of the patterns match the file name, INPUT_FILTER is applied.
FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
# and it is also possible to disable source filtering for a specific pattern
# using *.ext= (so without naming a filter). This option only has effect when
# FILTER_SOURCE_FILES is enabled.
FILTER_SOURCE_PATTERNS =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = NO
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = NO
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code.
# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = NO
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header. Note that when using a custom header you are responsible
# for the proper inclusion of any scripts and style sheets that doxygen
# needs, which is dependent on the configuration options used.
# It is advised to generate a default header using "doxygen -w html
# header.html footer.html stylesheet.css YourConfigFile" and then modify
# that header. Note that the header is subject to change so you typically
# have to redo this when upgrading to a newer version of doxygen or when
# changing the value of configuration settings such as GENERATE_TREEVIEW!
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# style sheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
# the files will be copied as-is; there are no commands or markers available.
HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the style sheet and background images
# according to this color. Hue is specified as an angle on a colorwheel,
# see http://en.wikipedia.org/wiki/Hue for more information.
# For instance the value 0 represents red, 60 is yellow, 120 is green,
# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
# The allowed range is 0 to 359.
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
# the colors in the HTML output. For a value of 0 the output will use
# grayscales only. A value of 255 will produce the most vivid colors.
HTML_COLORSTYLE_SAT = 100
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
# the luminance component of the colors in the HTML output. Values below
# 100 gradually make the output lighter, whereas values above 100 make
# the output darker. The value divided by 100 is the actual gamma applied,
# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
# and 100 does not change the gamma.
HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.
HTML_TIMESTAMP = NO
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = YES
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
GENERATE_DOCSET = NO
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = YES
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
# that can be used as input for Qt's qhelpgenerator to generate a
# Qt Compressed Help (.qch) of the generated HTML documentation.
GENERATE_QHP = NO
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = doc
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
# filter section matches.
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
# Qt Help Project / Filter Attributes</a>.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
# plugin. To install this plugin and make it available under the help contents
# menu in Eclipse, the contents of the directory containing the HTML and XML
# files needs to be copied into the plugins directory of eclipse. The name of
# the directory within the plugins directory should be the same as
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have
# this name.
ECLIPSE_DOC_ID = org.doxygen.Project
# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
# at top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. Since the tabs have the same information as the
# navigation tree you can set this option to NO if you already set
# GENERATE_TREEVIEW to YES.
DISABLE_INDEX = NO
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
# Since the tree basically has the same information as the tab index you
# could consider to set DISABLE_INDEX to NO when enabling this option.
GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
# documentation. Note that a value of 0 will completely suppress the enum
# values from appearing in the overview section.
ENUM_VALUES_PER_LINE = 1
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
# links to external symbols imported via tag files in a separate window.
EXT_LINKS_IN_WINDOW = NO
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are
# not supported properly for IE 6.0, but are supported on all modern browsers.
# Note that when changing this option you need to delete any form_*.png files
# in the HTML output before the changes have effect.
FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
# (see http://www.mathjax.org) which uses client side Javascript for the
# rendering instead of using prerendered bitmaps. Use this if you do not
# have LaTeX installed or if you want to formulas look prettier in the HTML
# output. When enabled you may also need to install MathJax separately and
# configure the path to it using the MATHJAX_RELPATH option.
USE_MATHJAX = NO
# When MathJax is enabled you need to specify the location relative to the
# HTML output directory using the MATHJAX_RELPATH option. The destination
# directory should contain the MathJax.js script. For instance, if the mathjax
# directory is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be ../mathjax. The default value points to
# the MathJax Content Delivery Network so you can quickly see the result without
# installing MathJax.
# However, it is strongly recommended to install a local
# copy of MathJax from http://www.mathjax.org before deployment.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
# names that should be enabled during MathJax rendering.
MATHJAX_EXTENSIONS =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
# (GENERATE_DOCSET) there is already a search function so this one should
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
# full text search. The disadvantages are that it is more difficult to setup
# and does not have live searching capabilities.
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
# Note that when enabling USE_PDFLATEX this option is only used for
# generating bitmaps for formulas in the HTML output, but not in the
# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
# the generated latex document. The footer should contain everything after
# the last chapter. If it is left blank doxygen will generate a
# standard footer. Notice: only use this tag if you know what you are doing!
LATEX_FOOTER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info.
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load style sheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader.
# This is useful
# if you want to understand what is going on.
# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# pointed to by INCLUDE_PATH will be searched when a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = __DOXYGEN__ \
PROGMEM
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition that
# overrules the definition found in the source code.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all references to function-like macros
# that are alone on a line, have an all uppercase name, and do not end with a
# semicolon, because these will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles. For each
# tag file the location of the external documentation should be added. The
# format of a tag file without this location is as follows:
#
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
#
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths
# or URLs. Note that each tag file must have a unique name (where the name does
# NOT include the path). If a tag file is not located in the directory in which
# doxygen is run, you must also specify the path to the tagfile here.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
# this option also works with HAVE_DOT disabled, but it is recommended to
# install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = NO
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
# allowed to run in parallel. When set to 0 (the default) doxygen will
# base this on the number of processors available in the system. You can set it
# explicitly to a value larger than 0 to get control over the balance
# between CPU load and processing speed.
DOT_NUM_THREADS = 0
# By default doxygen will use the Helvetica font for all dot files that
# doxygen generates. When you want a differently looking font you can specify
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
# the font, which can be done by putting it in a standard location or by setting
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
# directory containing the font.
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the Helvetica font.
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
# set the path where dot can find it.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = NO
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = NO
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = NO
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If the UML_LOOK tag is enabled, the fields and methods are shown inside
# the class node. If there are many fields or methods and many nodes the
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
# threshold limits the number of items for each type to make the size more
# managable. Set this to 0 for no limit. Note that the threshold may be
# exceeded by 50% before the limit is enforced.
UML_LIMIT_NUM_FIELDS = 10
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will generate a graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = NO
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = NO
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are svg, png, jpg, or gif.
# If left blank png will be used. If you choose svg you need to set
# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible in IE 9+ (other browsers do not have this requirement).
DOT_IMAGE_FORMAT = png
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
# Note that this requires a modern browser other than Internet Explorer.
# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible. Older versions of IE do not have SVG support.
INTERACTIVE_SVG = NO
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the
# \mscfile command).
MSCFILE_DIRS =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the
# number of direct children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 15
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 2
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = YES
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES

@ -0,0 +1,127 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "HD44780.h"
static void HD44780_WriteNibble(const uint8_t nib)
{
/* Read PORTD and clear the ENABLE and PD0..3 bits
then OR in the data */
PORTD = (PORTD & ~(ENABLE | LO4_MASK)) | (nib & LO4_MASK);
/* Enforce address setup time (tAS) 60ns
60 @ 16MHz = <1
Let's us a few NOPs for good measure */
asm volatile("nop\n\t"
"nop\n\t"
:: );
/* Take enable high and enforce Enable High time (tEH=450ns)
450ns @ 16MHz = 7.2 => 7 NOPs */
PORTD |= ENABLE;
asm volatile("nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
:: );
/* Take enable low and enforce Enable Low time (tEL=500ns)
500ns @ 16MHz = 8.0 => 7 NOPs */
PORTD &= ~ENABLE;
asm volatile("nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
:: );
}
static void HD44780_WriteByte(const uint8_t c)
{
HD44780_WriteNibble(HI4(c));
HD44780_WriteNibble(LO4(c));
}
static void HD44780_PowerUp4Bit(void)
{
/* Wait for more than 40 ms after VCC rises to 2.7 V */
_delay_ms(40);
HD44780_WriteNibble(0x03); // FN_SET 8-bit
/* Wait for more than 4.1 ms */
_delay_ms(5);
HD44780_WriteNibble(0x03); // FN_SET 8-bit
/* Wait for more than 100 µs */
_delay_us(100);
HD44780_WriteNibble(0x03); // FN_SET 8-bit
/* From now on we must allow 40us for each command */
_delay_us(50);
HD44780_WriteNibble(0x02); // FN_SET 4-bit
/* The LCD is now in 4-bit mode so we can continue
using the 4-bit API */
_delay_us(50);
}
void HD44780_Initialise(void)
{
PORTD &= ~ALL_BITS;
DDRD |= ALL_BITS;
HD44780_PowerUp4Bit();
}
void HD44780_WriteCommand(const uint8_t c)
{
PORTD &= ~RS;
HD44780_WriteByte(c);
_delay_us(50);
}
void HD44780_WriteData(const uint8_t c)
{
PORTD |= RS;
HD44780_WriteByte(c);
PORTD &= ~RS;
_delay_us(50);
}

@ -0,0 +1,64 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for HD44780.c.
*/
#ifndef _HD44780_H_
#define _HD44780_H_
/* Includes: */
#include <avr/io.h>
#include <util/delay.h>
#include <avr/power.h>
/* Macros: */
#define RS (1 << 4) /* PD4 */
#define ENABLE (1 << 7) /* PD7 */
#define HI4_MASK 0xF0
#define LO4_MASK 0x0F /* PD0-PD3 */
#define ALL_BITS (RS | ENABLE | LO4_MASK)
#define HI4(c) ((c & HI4_MASK) >> 4)
#define LO4(c) ((c & LO4_MASK) >> 0)
#define CMD_DISPLAY_ON 0x0C
/* Function Prototypes: */
void HD44780_Initialise(void);
void HD44780_WriteData(const uint8_t c);
void HD44780_WriteCommand(const uint8_t c);
#endif

@ -0,0 +1,168 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Main source file for the SerialToLCD program. This file contains the main tasks of
* the project and is responsible for the initial application hardware configuration.
*/
#include "SerialToLCD.h"
/** Circular buffer to hold data from the host before it is sent to the LCD */
static RingBuffer_t FromHost_Buffer;
/** Underlying data buffer for \ref FromHost_Buffer, where the stored bytes are located. */
static uint8_t FromHost_Buffer_Data[128];
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
RingBuffer_InitBuffer(&FromHost_Buffer, FromHost_Buffer_Data, sizeof(FromHost_Buffer_Data));
sei();
for (;;)
{
/* Only try to read in bytes from the CDC interface if the transmit buffer is not full */
if (!(RingBuffer_IsFull(&FromHost_Buffer)))
{
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
if (!(ReceivedByte < 0))
RingBuffer_Insert(&FromHost_Buffer, ReceivedByte);
}
while (RingBuffer_GetCount(&FromHost_Buffer) > 0)
{
static uint8_t EscapePending = 0;
int16_t HD44780Byte = RingBuffer_Remove(&FromHost_Buffer);
if (HD44780Byte == COMMAND_ESCAPE)
{
if (EscapePending)
{
HD44780_WriteData(HD44780Byte);
EscapePending = 0;
}
else
{
/* Next received character is the command byte */
EscapePending = 1;
}
}
else
{
if (EscapePending)
{
HD44780_WriteCommand(HD44780Byte);
EscapePending = 0;
}
else
{
HD44780_WriteData(HD44780Byte);
}
}
}
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the application's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
USB_Init();
/* Power up the HD44780 Interface */
HD44780_Initialise();
HD44780_WriteCommand(CMD_DISPLAY_ON);
/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
TCCR0B = (1 << CS02);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}

@ -0,0 +1,63 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for SerialToLCD.c.
*/
#ifndef _SERIALTOLCD_H_
#define _SERIALTOLCD_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <avr/power.h>
#include "Descriptors.h"
#include "Lib/HD44780.h"
#include <LUFA/Version.h>
#include <LUFA/Drivers/Misc/RingBuffer.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#define COMMAND_ESCAPE 0x1B
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
#endif

@ -0,0 +1,97 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \mainpage Simon Foster's USB Serial to HD44780 LCD Project
*
* \section Sec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this project.
*
* - AT90USB162
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF CDC Class Standard</td>
* </tr>
* <tr>
* <td><b>Usable Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Firmware for a USB Virtual Serial to HD44780 LCD controller project, by Simon Foster. This
* project connects a standard HD7780 compatible LCD controller to a PC via a virtual serial
* link, so that data supplied by the host can be written to the display. This project is
* designed to use the Minimum USB AVR board, however it can be modified to suit other hardware
* if desired.
*
* LCD Datasheet: http://www.sparkfun.com/datasheets/LCD/HD44780.pdf \n
* More Information: http://en.wikipedia.org/wiki/HD44780_Character_LCD \n
*
* Below are the connections between the AVR Minimus board and LCD.
*
* <table>
* <tr>
* <td><b>AVR Pin:</b></td>
* <td><b>HD44780 LCD Pin:</b></td>
* </tr>
* <tr>
* <td>VCC</td>
* <td>VCC</td>
* </tr>
* <tr>
* <td>GND</td>
* <td>GND</td>
* </tr>
* <tr>
* <td>PD0</td>
* <td>DB4</td>
* </tr>
* <tr>
* <td>PD1</td>
* <td>DB5</td>
* </tr>
* <tr>
* <td>PD2</td>
* <td>DB6</td>
* </tr>
* <tr>
* <td>PD3</td>
* <td>DB7</td>
* </tr>
* <tr>
* <td>PD4</td>
* <td>/RS</td>
* </tr>
* <tr>
* <td>GND</td>
* <td>/RW</td>
* </tr>
* <tr>
* <td>PD7</td>
* <td>/E</td>
* </tr>
* </table>
*/

@ -0,0 +1,731 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
# >> Modified for use with the LUFA project. <<
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
# Dean Camera
# Opendous Inc.
# Denver Gingerich
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = at90usb162
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = MINIMUS
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = SerialToLCD
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = .
# Path to the LUFA library
LUFA_PATH = ../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
LUFA_OPTS += -D ORDERED_EP_CONFIG
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
Lib/HD44780.c \
Descriptors.c \
$(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS)
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(LUFA_PATH)/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_USB=$(F_USB)UL
CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH)
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_USB=$(F_USB)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_USB=$(F_USB)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CPPDEFS += $(LUFA_OPTS)
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections
CFLAGS += -fno-inline-small-functions
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -fno-strict-aliasing
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
#CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS =
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x
#---------------- Programming Options (avrdude) ----------------
# Programming hardware
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = jtagmkII
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
AR = avr-ar rcs
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
REMOVEDIR = rm -rf
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_CPP = Compiling C++:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
build: elf hex eep lss sym
#build: lib
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation erase f
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
dfu: $(TARGET).hex
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $(TARGET).hex
dfu-programmer $(MCU) reset
flip-ee: $(TARGET).hex $(TARGET).eep
$(COPY) $(TARGET).eep $(TARGET)eep.hex
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(TARGET)eep.hex
dfu-ee: $(TARGET).hex $(TARGET).eep
dfu-programmer $(MCU) eeprom-flash $(TARGET).eep
dfu-programmer $(MCU) reset
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT = $(OBJCOPY) --debugging
COFFCONVERT += --change-section-address .data-0x800000
COFFCONVERT += --change-section-address .bss-0x800000
COFFCONVERT += --change-section-address .noinit-0x800000
COFFCONVERT += --change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Create library from object files.
.SECONDARY : $(TARGET).a
.PRECIOUS : $(OBJ)
%.a: $(OBJ)
@echo
@echo $(MSG_CREATING_LIBRARY) $@
$(AR) $@ $(OBJ)
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C++ source files.
%.s : %.cpp
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVEDIR) .dep
doxygen:
@echo Generating Project Documentation \($(TARGET)\)...
@if ( doxygen Doxygen.conf 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then \
exit 1; \
fi;
@echo Documentation Generation Complete.
clean_doxygen:
rm -rf Documentation
checksource:
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
if [ -f $$f ]; then \
echo "Found Source File: $$f" ; \
else \
echo "Source File Not Found: $$f" ; \
fi; done
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config checksource

@ -136,20 +136,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.HID_Interface =
@ -183,10 +183,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | GENERIC_IN_EPNUM),
.EndpointAddress = GENERIC_IN_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
};

@ -17,17 +17,17 @@
#include "TempDataLogger.h"
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
/** Endpoint number of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPNUM 1
/** Endpoint address of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 16

@ -45,15 +45,18 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
.Config =
{
.InterfaceNumber = 0,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = 1,
},
};
@ -70,11 +73,12 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.Config =
{
.InterfaceNumber = 1,
.ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
.ReportINEndpoint =
{
.Address = GENERIC_IN_EPADDR,
.Size = GENERIC_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},

@ -143,7 +143,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -169,20 +169,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -57,18 +57,24 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};

@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -183,20 +183,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.RNDIS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_Interface =
@ -219,20 +219,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,23 +42,23 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 5
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 5)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -45,19 +45,24 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = true,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = true,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = true,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
.AdapterVendorDescription = "LUFA RNDIS Adapter",
.AdapterMACAddress = {{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}},
},
@ -71,16 +76,19 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
{
.Config =
{
.InterfaceNumber = 2,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.InterfaceNumber = 2,
.DataINEndpoint =
{
.Address = MASS_STORAGE_IN_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = MASS_STORAGE_OUT_EPADDR,
.Size = MASS_STORAGE_IO_EPSIZE,
.Banks = 1,
},
.TotalLUNs = 1,
},
};

@ -44,16 +44,22 @@ USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface_Host =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
.HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
.DataINPipe =
{
.Address = (PIPE_DIR_IN | 1),
.Banks = 1,
},
.DataOUTPipe =
{
.Address = (PIPE_DIR_OUT | 2),
.Banks = 1,
},
.NotificationPipe =
{
.Address = (PIPE_DIR_IN | 3),
.Banks = 1,
},
.HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
},
};

@ -106,7 +106,7 @@ const AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescript
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | AVRISP_DATA_IN_EPNUM),
.EndpointAddress = AVRISP_DATA_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
.PollingIntervalMS = 0x0A
@ -116,7 +116,7 @@ const AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescript
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
.EndpointAddress = AVRISP_DATA_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
.PollingIntervalMS = 0x0A

@ -42,18 +42,15 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#if !defined(LIBUSB_DRIVER_COMPAT)
/** Endpoint number of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPNUM 2
#if !defined(LIBUSB_DRIVER_COMPAT) || defined(__DOXYGEN__)
/** Endpoint address of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
/** Endpoint number of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPNUM 2
/** Endpoint address of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPADDR (ENDPOINT_DIR_IN | 2)
#else
/** Endpoint number of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPNUM 2
/** Endpoint number of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPNUM 3
#define AVRISP_DATA_OUT_EPADDR (ENDPOINT_DIR_OUT | 2)
#define AVRISP_DATA_IN_EPADDR (ENDPOINT_DIR_IN | 3)
#endif
/** Size in bytes of the AVRISP data endpoint. */

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "LUFA Library - XPLAIN Serial Bridge/PDI Programmer Device Demo"
PROJECT_NAME = "LUFA Library - XPLAIN Serial Bridge/PDI Programmer Project"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or

@ -143,7 +143,7 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
@ -169,20 +169,20 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

@ -42,14 +42,14 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 3
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 4
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8

@ -48,18 +48,24 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = true,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = true,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
@ -105,7 +111,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPADDR);
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())
@ -213,12 +219,10 @@ void EVENT_USB_Device_ConfigurationChanged(void)
}
else
{
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
#if defined(LIBUSB_DRIVER_COMPAT)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
#endif
/* Configure the V2 protocol packet handler */

@ -46,9 +46,7 @@
#include "AVRISPDescriptors.h"
#include "USARTDescriptors.h"
// cppcheck-suppress missingInclude
#include "Lib/V2Protocol.h"
// cppcheck-suppress missingInclude
#include "Lib/SoftUART.h"
#include <LUFA/Version.h>

@ -79,11 +79,6 @@
* <td><b>Description:</b></td>
* </tr>
* <tr>
* <td>BUFFER_SIZE</td>
* <td>LightweightRingBuff.h</td>
* <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer when in serial bridge mode.</td>
* </tr>
* <tr>
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making

@ -41,6 +41,9 @@ all:
$(MAKE) -C RelayBoard clean
$(MAKE) -C RelayBoard all
$(MAKE) -C SerialToLCD clean
$(MAKE) -C SerialToLCD all
$(MAKE) -C TempDataLogger clean
$(MAKE) -C TempDataLogger all
@ -63,6 +66,7 @@ all:
$(MAKE) -C MIDIToneGenerator $@
$(MAKE) -C MissileLauncher $@
$(MAKE) -C RelayBoard $@
$(MAKE) -C SerialToLCD $@
$(MAKE) -C TempDataLogger $@
$(MAKE) -C USBtoSerial $@
$(MAKE) -C Webserver $@

Loading…
Cancel
Save