Reintegrate the FullEPAddresses development branch into trunk.
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 14 Apr 2012 14:41:17 +0000 (14:41 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 14 Apr 2012 14:41:17 +0000 (14:41 +0000)
265 files changed:
Bootloaders/CDC/BootloaderCDC.c
Bootloaders/CDC/Descriptors.c
Bootloaders/CDC/Descriptors.h
Bootloaders/HID/BootloaderHID.c
Bootloaders/HID/Descriptors.c
Bootloaders/HID/Descriptors.h
BuildTests/ModuleTest/makefile
Demos/Device/ClassDriver/AudioInput/AudioInput.c
Demos/Device/ClassDriver/AudioInput/Descriptors.c
Demos/Device/ClassDriver/AudioInput/Descriptors.h
Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
Demos/Device/ClassDriver/AudioOutput/Descriptors.c
Demos/Device/ClassDriver/AudioOutput/Descriptors.h
Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c
Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c
Demos/Device/ClassDriver/GenericHID/Descriptors.c
Demos/Device/ClassDriver/GenericHID/Descriptors.h
Demos/Device/ClassDriver/GenericHID/GenericHID.c
Demos/Device/ClassDriver/Joystick/Descriptors.c
Demos/Device/ClassDriver/Joystick/Descriptors.h
Demos/Device/ClassDriver/Joystick/Joystick.c
Demos/Device/ClassDriver/Keyboard/Descriptors.c
Demos/Device/ClassDriver/Keyboard/Descriptors.h
Demos/Device/ClassDriver/Keyboard/Keyboard.c
Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c
Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c
Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h
Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c
Demos/Device/ClassDriver/MIDI/Descriptors.c
Demos/Device/ClassDriver/MIDI/Descriptors.h
Demos/Device/ClassDriver/MIDI/MIDI.c
Demos/Device/ClassDriver/MassStorage/Descriptors.c
Demos/Device/ClassDriver/MassStorage/Descriptors.h
Demos/Device/ClassDriver/MassStorage/MassStorage.c
Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
Demos/Device/ClassDriver/Mouse/Descriptors.c
Demos/Device/ClassDriver/Mouse/Descriptors.h
Demos/Device/ClassDriver/Mouse/Mouse.c
Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c
Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c
Demos/Device/ClassDriver/VirtualSerial/Descriptors.c
Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c
Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c
Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h
Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c
Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c
Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c
Demos/Device/Incomplete/Sideshow/Descriptors.c
Demos/Device/Incomplete/Sideshow/Descriptors.h
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
Demos/Device/Incomplete/Sideshow/Sideshow.c
Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c
Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h
Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
Demos/Device/LowLevel/AudioInput/AudioInput.c
Demos/Device/LowLevel/AudioInput/Descriptors.c
Demos/Device/LowLevel/AudioInput/Descriptors.h
Demos/Device/LowLevel/AudioOutput/AudioOutput.c
Demos/Device/LowLevel/AudioOutput/Descriptors.c
Demos/Device/LowLevel/AudioOutput/Descriptors.h
Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
Demos/Device/LowLevel/GenericHID/Descriptors.c
Demos/Device/LowLevel/GenericHID/Descriptors.h
Demos/Device/LowLevel/GenericHID/GenericHID.c
Demos/Device/LowLevel/Joystick/Descriptors.c
Demos/Device/LowLevel/Joystick/Descriptors.h
Demos/Device/LowLevel/Joystick/Joystick.c
Demos/Device/LowLevel/Keyboard/Descriptors.c
Demos/Device/LowLevel/Keyboard/Descriptors.h
Demos/Device/LowLevel/Keyboard/Keyboard.c
Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
Demos/Device/LowLevel/MIDI/Descriptors.c
Demos/Device/LowLevel/MIDI/Descriptors.h
Demos/Device/LowLevel/MIDI/MIDI.c
Demos/Device/LowLevel/MassStorage/Descriptors.c
Demos/Device/LowLevel/MassStorage/Descriptors.h
Demos/Device/LowLevel/MassStorage/MassStorage.c
Demos/Device/LowLevel/Mouse/Descriptors.c
Demos/Device/LowLevel/Mouse/Descriptors.h
Demos/Device/LowLevel/Mouse/Mouse.c
Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
Demos/Device/LowLevel/VirtualSerial/Descriptors.c
Demos/Device/LowLevel/VirtualSerial/Descriptors.h
Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c
Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h
Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c
Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c
Demos/Host/ClassDriver/AndroidAccessoryHost/AndroidAccessoryHost.c
Demos/Host/ClassDriver/AudioInputHost/AudioInputHost.c
Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.c
Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
Demos/Host/ClassDriver/MouseHost/MouseHost.c
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c
Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c
Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h
Demos/Host/LowLevel/AudioInputHost/ConfigDescriptor.c
Demos/Host/LowLevel/AudioInputHost/ConfigDescriptor.h
Demos/Host/LowLevel/AudioInputHost/Doxygen.conf
Demos/Host/LowLevel/AudioOutputHost/ConfigDescriptor.c
Demos/Host/LowLevel/AudioOutputHost/ConfigDescriptor.h
Demos/Host/LowLevel/AudioOutputHost/Doxygen.conf
Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
Demos/Host/LowLevel/JoystickHostWithParser/Doxygen.conf
Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
Demos/Host/LowLevel/KeyboardHostWithParser/Doxygen.conf
Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
Demos/Host/LowLevel/MouseHostWithParser/Doxygen.conf
Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
LUFA/Common/ArchitectureSpecific.h
LUFA/DoxygenPages/ChangeLog.txt
LUFA/DoxygenPages/DeviceSupport.txt
LUFA/DoxygenPages/FutureChanges.txt
LUFA/DoxygenPages/LUFAPoweredProjects.txt
LUFA/DoxygenPages/MigrationInformation.txt
LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
LUFA/Drivers/USB/Class/Device/AudioClassDevice.c
LUFA/Drivers/USB/Class/Device/AudioClassDevice.h
LUFA/Drivers/USB/Class/Device/CDCClassDevice.c
LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
LUFA/Drivers/USB/Class/Device/HIDClassDevice.c
LUFA/Drivers/USB/Class/Device/HIDClassDevice.h
LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c
LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h
LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c
LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h
LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c
LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h
LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c
LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h
LUFA/Drivers/USB/Class/Host/AudioClassHost.c
LUFA/Drivers/USB/Class/Host/AudioClassHost.h
LUFA/Drivers/USB/Class/Host/CDCClassHost.c
LUFA/Drivers/USB/Class/Host/CDCClassHost.h
LUFA/Drivers/USB/Class/Host/HIDClassHost.c
LUFA/Drivers/USB/Class/Host/HIDClassHost.h
LUFA/Drivers/USB/Class/Host/MIDIClassHost.c
LUFA/Drivers/USB/Class/Host/MIDIClassHost.h
LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c
LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h
LUFA/Drivers/USB/Class/Host/PrinterClassHost.c
LUFA/Drivers/USB/Class/Host/PrinterClassHost.h
LUFA/Drivers/USB/Class/Host/RNDISClassHost.c
LUFA/Drivers/USB/Class/Host/RNDISClassHost.h
LUFA/Drivers/USB/Class/Host/StillImageClassHost.c
LUFA/Drivers/USB/Class/Host/StillImageClassHost.h
LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c
LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c
LUFA/Drivers/USB/Core/Endpoint.h
LUFA/Drivers/USB/Core/Pipe.h
LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
LUFA/Drivers/USB/Core/UC3/Host_UC3.c
LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c
LUFA/Drivers/USB/Core/USBController.h
LUFA/Drivers/USB/Core/USBMode.h
LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c
LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c
LUFA/Drivers/USB/USB.h
LUFA/Platform/XMEGA/ClockManagement.h
Projects/AVRISP-MKII/AVRISP-MKII.c
Projects/AVRISP-MKII/Descriptors.c
Projects/AVRISP-MKII/Descriptors.h
Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
Projects/AVRISP-MKII/Lib/V2Protocol.c
Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
Projects/Benito/Benito.c
Projects/Benito/Descriptors.c
Projects/Benito/Descriptors.h
Projects/HIDReportViewer/HIDReportViewer.c
Projects/Incomplete/StandaloneProgrammer/Descriptors.c
Projects/Incomplete/StandaloneProgrammer/Descriptors.h
Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
Projects/Incomplete/StandaloneProgrammer/DiskHost.c
Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
Projects/LEDNotifier/Descriptors.c
Projects/LEDNotifier/Descriptors.h
Projects/LEDNotifier/LEDNotifier.c
Projects/MIDIToneGenerator/Descriptors.c
Projects/MIDIToneGenerator/Descriptors.h
Projects/MIDIToneGenerator/MIDIToneGenerator.c
Projects/Magstripe/Descriptors.c
Projects/Magstripe/Descriptors.h
Projects/Magstripe/Magstripe.c
Projects/MediaController/Descriptors.c
Projects/MediaController/Descriptors.h
Projects/MediaController/MediaController.c
Projects/MissileLauncher/ConfigDescriptor.c
Projects/MissileLauncher/ConfigDescriptor.h
Projects/RelayBoard/Doxygen.conf
Projects/TempDataLogger/Descriptors.c
Projects/TempDataLogger/Descriptors.h
Projects/TempDataLogger/TempDataLogger.c
Projects/USBtoSerial/Descriptors.c
Projects/USBtoSerial/Descriptors.h
Projects/USBtoSerial/USBtoSerial.c
Projects/Webserver/Descriptors.c
Projects/Webserver/Descriptors.h
Projects/Webserver/USBDeviceMode.c
Projects/Webserver/USBHostMode.c
Projects/XPLAINBridge/AVRISPDescriptors.c
Projects/XPLAINBridge/AVRISPDescriptors.h
Projects/XPLAINBridge/Doxygen.conf
Projects/XPLAINBridge/USARTDescriptors.c
Projects/XPLAINBridge/USARTDescriptors.h
Projects/XPLAINBridge/XPLAINBridge.c

index e9ea8ae..a7fc883 100644 (file)
@@ -122,17 +122,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 +298,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 +324,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 +348,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 +544,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 +572,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();
index 4bf3ece..4b769c2 100644 (file)
@@ -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,7 +157,7 @@ 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
@@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
                {
                        .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
index e5ef641..0010fc6 100644 (file)
                        #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
index 928000f..d8f0186 100644 (file)
@@ -85,9 +85,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
index 5d4271e..a531015 100644 (file)
@@ -137,7 +137,7 @@ 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
index 41c4ee4..ad21603 100644 (file)
@@ -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
index 974a3dd..c0d3ec0 100644 (file)
@@ -15,7 +15,7 @@
 \r
 # List of device families per architecture, one device per architecture sub-family\r
 AVR8_FAMILIES  = at90usb1287 at90usb1286 atmega16u4 atmega16u2 at90usb162\r
-XMEGA_FAMILIES = atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3\r
+XMEGA_FAMILIES = atxmega128a1u atxmega128a3u atxmega256a3bu atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega32c4\r
 UC3_FAMILIES   = uc3a0256 uc3a1256 uc3a3256 uc3a4256 uc3b0256 uc3b1256\r
 \r
 # List of all device families, with a family postfix\r
@@ -24,6 +24,10 @@ DEVICE_FAMILIES = $(AVR8_FAMILIES:%=%.avr8) $(XMEGA_FAMILIES:%=%.xmega) $(UC3_FA
 \r
 all: begin $(DEVICE_FAMILIES) clean end\r
 \r
+arch_avr8:  begin $(AVR8_FAMILIES:%=%.avr8) end\r
+arch_xmega: begin $(XMEGA_FAMILIES:%=%.xmega) end\r
+arch_uc3:   begin $(UC3_FAMILIES:%=%.uc3) end\r
+\r
 begin:\r
        @echo Executing build test "ModuleTest".\r
        @echo\r
index 382446a..867a09e 100644 (file)
@@ -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)
index 6b7593f..8557e18 100644 (file)
@@ -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
index ac0a536..359a287 100644 (file)
                #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
index 78d81f5..82f664a 100644 (file)
@@ -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)
index 06cc5ca..0df2745 100644 (file)
@@ -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
index ac0a536..d5c8a2b 100644 (file)
                #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
index 5df6808..7542ab9 100644 (file)
@@ -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,7 +183,7 @@ 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
@@ -193,7 +193,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -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,7 +284,7 @@ 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
@@ -294,7 +294,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 01d10f2..dc3aa0b 100644 (file)
                #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
index 8f1eb96..a07967c 100644 (file)
@@ -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,
                        },
        };
 
index ee1ba49..f8bb128 100644 (file)
@@ -135,7 +135,7 @@ 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
index ddeef24..0b9ec8f 100644 (file)
@@ -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
index 36eb8f7..aa365bd 100644 (file)
@@ -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),
                        },
index da6fc3d..d0a469f 100644 (file)
@@ -135,7 +135,7 @@ 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
index f0ad9c2..d2e2943 100644 (file)
@@ -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
index 3c1913f..4f361da 100644 (file)
@@ -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),
                        },
index cb78526..84ec47a 100644 (file)
@@ -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 | KEYBOARD_EPNUM),
+                       .EndpointAddress        = KEYBOARD_EPADDR,
                        .Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                        .EndpointSize           = KEYBOARD_EPSIZE,
                        .PollingIntervalMS      = 0x01
index 3704895..f032b72 100644 (file)
@@ -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
index 15a7f17..24bf8d5 100644 (file)
@@ -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),
                        },
index d6471d6..207e782 100644 (file)
@@ -147,7 +147,7 @@ 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
@@ -184,7 +184,7 @@ 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
index fe41f92..e35e266 100644 (file)
                } 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
index cb2eebf..7b5caa4 100644 (file)
@@ -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),
                        },
index f08cdc7..fc2eafc 100644 (file)
@@ -194,7 +194,7 @@ 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
index f579edf..5632aa8 100644 (file)
@@ -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
index 7197959..c0526ab 100644 (file)
@@ -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),
                        },
index 9ad0e86..84898ac 100644 (file)
@@ -199,7 +199,7 @@ 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
@@ -224,7 +224,7 @@ 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
index c5dc2e2..8384444 100644 (file)
                #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
index 317c37d..a55c6a7 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index fb82942..0ab09b6 100644 (file)
@@ -118,7 +118,7 @@ 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
@@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 813f995..84879e8 100644 (file)
                #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
index 6a720f9..0ba06a5 100644 (file)
@@ -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,
                        },
        };
index 2790903..e7c9486 100644 (file)
@@ -133,7 +133,7 @@ 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
@@ -143,7 +143,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -180,7 +180,7 @@ 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
index 86f6cc4..fb1a379 100644 (file)
                #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
index bfdf09c..7e12a5d 100644 (file)
@@ -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),
                        },
index 1a7af87..93bd02d 100644 (file)
@@ -136,7 +136,7 @@ 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
index da78dd0..abcd938 100644 (file)
 
                #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
                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,
index 04d4268..00cadb4 100644 (file)
@@ -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),
                        },
index 41bc4b5..86cc420 100644 (file)
@@ -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,7 +157,7 @@ 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
@@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 7c40d87..6301b83 100644 (file)
                #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
index 2a8ba97..37fb817 100644 (file)
@@ -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},
                        },
index f4e9fb3..0858bc4 100644 (file)
@@ -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,7 +169,7 @@ 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
@@ -179,7 +179,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index fb69344..af9183e 100644 (file)
                #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
index c3e16ed..8b11c29 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 299ddbd..a373865 100644 (file)
@@ -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,7 +183,7 @@ 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
@@ -193,7 +193,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -219,7 +219,7 @@ 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
@@ -229,7 +229,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index b4b5ef6..544a2b5 100644 (file)
                #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
                /** 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
index d8ffea8..14d6abd 100644 (file)
@@ -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,
                        },
        };
index af67456..0a40b4f 100644 (file)
@@ -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,7 +202,7 @@ 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
@@ -212,7 +212,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -249,7 +249,7 @@ 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
index 2509314..06cfd45 100644 (file)
                #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
index f2d6754..dbbc8e7 100644 (file)
@@ -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),
                        },
index 533c921..cc1a094 100644 (file)
@@ -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
index 6c9c6e3..1725a79 100644 (file)
@@ -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: */
index 4634036..3e23924 100644 (file)
@@ -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();
 }
index 3bc58d3..41009f3 100644 (file)
@@ -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())
index 14be2ec..2a60a74 100644 (file)
@@ -119,7 +119,7 @@ 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
@@ -129,7 +129,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -139,7 +139,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 8876f73..e45654a 100644 (file)
                #include <LUFA/Drivers/USB/USB.h>\r
 \r
        /* Macros: */\r
-               /** Endpoint number of the TMC notification IN endpoint. */\r
-               #define TMC_NOTIFICATION_EPNUM  2       \r
+               /** Endpoint address of the TMC notification IN endpoint. */\r
+               #define TMC_NOTIFICATION_EPADDR  (ENDPOINT_DIR_IN  | 2)\r
 \r
-               /** Endpoint number of the TMC device-to-host data IN endpoint. */\r
-               #define TMC_IN_EPNUM            3       \r
+               /** Endpoint address of the TMC device-to-host data IN endpoint. */\r
+               #define TMC_IN_EPADDR            (ENDPOINT_DIR_IN  | 3)\r
 \r
-               /** Endpoint number of the TMC host-to-device data OUT endpoint. */\r
-               #define TMC_OUT_EPNUM           4       \r
+               /** Endpoint address of the TMC host-to-device data OUT endpoint. */\r
+               #define TMC_OUT_EPADDR           (ENDPOINT_DIR_OUT | 4)\r
 \r
                /** Size in bytes of the TMC data endpoints. */\r
-               #define TMC_IO_EPSIZE           64\r
+               #define TMC_IO_EPSIZE            64\r
 \r
                /** Size in bytes of the TMC notification endpoint. */\r
-               #define TMC_NOTIFICATION_EPSIZE 8\r
+               #define TMC_NOTIFICATION_EPSIZE  8\r
 \r
        /* Type Defines: */\r
                /** Type define for the device configuration descriptor structure. This must be defined in the\r
index c77b01e..5102f10 100644 (file)
@@ -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;
index 60eeaf6..eb9c4b5 100644 (file)
@@ -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)
index 0b16522..ee37aff 100644 (file)
@@ -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
index ac0a536..4680294 100644 (file)
                #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
index 813108a..ebf4ad5 100644 (file)
@@ -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)
index 7f12fc7..12a5a15 100644 (file)
@@ -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
index ac0a536..e0c7567 100644 (file)
                #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
index 5df6808..7542ab9 100644 (file)
@@ -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,7 +183,7 @@ 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
@@ -193,7 +193,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -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,7 +284,7 @@ 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
@@ -294,7 +294,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 0a172d8..fee2c85 100644 (file)
                #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
index 9208b2c..2db6f4e 100644 (file)
@@ -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);
index 2dcdcf0..1d8765b 100644 (file)
@@ -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 | GENERIC_IN_EPNUM),
+                       .EndpointAddress        = GENERIC_IN_EPADDR,
                        .Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                        .EndpointSize           = GENERIC_EPSIZE,
                        .PollingIntervalMS      = 0x01
@@ -153,7 +153,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 4647a05..e47220a 100644 (file)
                } 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
index 4d61acf..c36c33f 100644 (file)
@@ -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())
index 272595d..74f388c 100644 (file)
@@ -155,7 +155,7 @@ 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
index 93b315b..bc90fb7 100644 (file)
@@ -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
index 9e84b61..cfdfaae 100644 (file)
@@ -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())
index 46b9fde..2de04d3 100644 (file)
@@ -160,7 +160,7 @@ 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
@@ -170,7 +170,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 3c0ea17..2e1fe3c 100644 (file)
                } 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
index 45bf010..3755d09 100644 (file)
@@ -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())
index 9d02fa4..9d592f7 100644 (file)
@@ -195,7 +195,7 @@ 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
@@ -205,7 +205,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -242,7 +242,7 @@ 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
index 573cb65..178f5ed 100644 (file)
                } 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
index 4de6f64..a916659 100644 (file)
@@ -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())
index 9ad0e86..84898ac 100644 (file)
@@ -199,7 +199,7 @@ 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
@@ -224,7 +224,7 @@ 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
index 5415a31..7947a46 100644 (file)
                #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
index a29a8c8..f8bc4e9 100644 (file)
@@ -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())
        {
@@ -182,7 +180,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())
index fb82942..0ab09b6 100644 (file)
@@ -118,7 +118,7 @@ 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
@@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 0e7a91f..34a85f6 100644 (file)
                #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
index 947636c..0e8e108 100644 (file)
@@ -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())
index d42fb83..bd0cb61 100644 (file)
@@ -155,7 +155,7 @@ 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
index da78dd0..abcd938 100644 (file)
 
                #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
                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,
index 98da9be..e9f92e4 100644 (file)
@@ -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)
index 41bc4b5..86cc420 100644 (file)
@@ -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,7 +157,7 @@ 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
@@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 9ffa526..6337335 100644 (file)
                #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
index a36ecf4..c041bb9 100644 (file)
@@ -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)
index f4e9fb3..0858bc4 100644 (file)
@@ -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,7 +169,7 @@ 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
@@ -179,7 +179,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 765345b..36ec8f9 100644 (file)
                #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
index 93fd435..7d18548 100644 (file)
@@ -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())
index 2ee35de..33a825d 100644 (file)
@@ -136,7 +136,7 @@ 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
index da78dd0..14cb8e9 100644 (file)
@@ -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
index 16fc3fb..39a682a 100644 (file)
@@ -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),
                        },
index a71e85b..29def30 100644 (file)
@@ -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,
                        },
        };
index d0737ac..4c53cc2 100644 (file)
@@ -44,12 +44,16 @@ USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface =
        {\r
                .Config =\r
                        {\r
-                               .DataINPipeNumber           = 1,\r
-                               .DataINPipeDoubleBank       = false,\r
-\r
-                               .DataOUTPipeNumber          = 2,\r
-                               .DataOUTPipeDoubleBank      = false,\r
-                               \r
+                               .DataINPipe             =\r
+                                       {\r
+                                               .Address        = (PIPE_DIR_IN  | 1),\r
+                                               .Banks          = 1,\r
+                                       },\r
+                               .DataOUTPipe            =\r
+                                       {\r
+                                               .Address        = (PIPE_DIR_OUT | 2),\r
+                                               .Banks          = 1,\r
+                                       },                              \r
                                .PropertyStrings =\r
                                        {\r
                                                [AOA_STRING_Manufacturer] = "Dean Camera",\r
index 3e4a69a..aa27493 100644 (file)
@@ -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)
        {
index 783b0a5..833be1b 100644 (file)
@@ -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)
        {
index 5d91249..18c02d7 100644 (file)
@@ -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
                        },
        };
index f67cd11..6949908 100644 (file)
@@ -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,
                        },
        };
index 4247e9e..6ef1820 100644 (file)
@@ -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
                        },
        };
index 8293fbd..129bd3d 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 10c7f79..aacc078 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 4272591..1290e48 100644 (file)
@@ -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,
                        },
        };
index 857d494..8004b5c 100644 (file)
@@ -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
                        },
        };
index 3df0eed..51157a3 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index f03ee49..d27aab1 100644 (file)
@@ -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),
                        },
        };
 
index eeac14d..9a89452 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 631925e..bce7804 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 7d10506..fa19052 100644 (file)
@@ -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 */
index 9c40fcd..c46add7 100644 (file)
@@ -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. */
index 1b8613b..6db8532 100644 (file)
@@ -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;
index 05e1b91..53b7280 100644 (file)
                #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. */
index b26dbb8..9274e63 100644 (file)
@@ -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;
index a5f4259..84d27c7 100644 (file)
@@ -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. */
index b98cf1f..44513ef 100644 (file)
@@ -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
index 99980fd..cc25062 100644 (file)
@@ -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;
index dcf367e..0c4f067 100644 (file)
@@ -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. */
index 55c9bb5..9cb0e55 100644 (file)
@@ -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
index 6df253c..9067450 100644 (file)
@@ -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 */
index 4614893..547f154 100644 (file)
                #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. */
index 4f7a0d6..be6eb09 100644 (file)
@@ -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 */
index 69fdfed..fba5713 100644 (file)
@@ -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. */
index 4366e6e..65c6086 100644 (file)
@@ -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
index cfcee7b..73dc5df 100644 (file)
@@ -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 */
index 5b44d3f..eb09f69 100644 (file)
@@ -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. */
index 765b325..ddd4359 100644 (file)
@@ -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 */
index ffa2afd..c40211c 100644 (file)
@@ -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. */
index 9f76d7e..3e48157 100644 (file)
@@ -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
index 39e513c..70381ea 100644 (file)
@@ -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;
index d41513e..40d4dc9 100644 (file)
                #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. */
index 566cdb1..0e967f9 100644 (file)
@@ -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;
index a40debd..eb0746b 100644 (file)
                /** 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. */
index c33e087..4992e3a 100644 (file)
@@ -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 */
index 9619c44..14051a6 100644 (file)
@@ -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. */
index c664700..7d63d2b 100644 (file)
@@ -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 */
index 799761b..0a2582b 100644 (file)
@@ -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. */
index fcf8356..b41e8d8 100644 (file)
@@ -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
index f259c1f..922734f 100644 (file)
@@ -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;
index cc9e2cb..d5a32cd 100644 (file)
                #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. */
index 0493000..df317ef 100644 (file)
@@ -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 */
index e9cf19f..19f26b4 100644 (file)
                #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. */
index 269dc3b..c5c78ce 100644 (file)
@@ -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 */
index 04b81a2..93dcfc6 100644 (file)
                #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. */
index 4126d76..552b02a 100644 (file)
@@ -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 */
index c5a60b4..e9f12dc 100644 (file)
                #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. */
index 3ba7a5c..f7dca66 100644 (file)
 
        /* 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
                                 *
                                 *  \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
                                         */
                                        #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: */
index b35a39c..c0193f2 100644 (file)
@@ -10,6 +10,8 @@
   *  <b>New:</b>
   *  - Core:
   *   - Added support for the BitWizard Multio and Big-Multio boards
+  *   - 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
   *   - 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
   *  - 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
index c8083d2..214938f 100644 (file)
  *   <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>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
index b75e94d..3e7a217 100644 (file)
@@ -22,7 +22,6 @@
   *      -# 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
index ea08705..5179850 100644 (file)
@@ -36,6 +36,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
index 93082bb..fe04732 100644 (file)
  *    - 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.
  *
  *  <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).
  *
  *  \section Sec_Migration120219 Migrating from 111009 to 120219
  *  <b>USB Core</b>
  *      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)
index abc8d85..df35761 100644 (file)
                        #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
                         */
                        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.
                        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. */
index f1e6da5..0b8a261 100644 (file)
                        #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
                         */
                        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;
                                
-                               PORTE.REMAP |= PORT_USART0_bm;
+                               PORTCFG.MPCMASK                = DATAFLASH_CHIPCS_MASK;
+                               DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm; 
+                               
+                               PORTC.REMAP |= PORT_USART0_bm;
                        }
 
                        /** Sends a byte to the currently selected dataflash IC, and returns a 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 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.
                        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.
                        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.
                        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. */
index 0126630..562aaec 100644 (file)
                         */
                        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
                         */
                        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: */
index 6f8251f..a0e9e33 100644 (file)
@@ -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);
                        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
                         */
                        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: */
index 15fcd58..ad79e9b 100644 (file)
@@ -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;
 }
index 2391266..a8bfc78 100644 (file)
                                                                                                                *   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.
                                           */
                                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();
                        }
 
                                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();
                        }
 
                        {
                                Endpoint_Write_8(Sample);
 
-                               if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
+                               if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
                                  Endpoint_ClearIN();
                        }
 
                        {
                                Endpoint_Write_16_LE(Sample);
 
-                               if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
+                               if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
                                  Endpoint_ClearIN();
                        }
 
                                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();
                        }
 
index 5b53438..a16949c 100644 (file)
@@ -112,45 +112,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 +144,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 +155,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 +165,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 +188,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 +213,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 +240,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 +259,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)
                {
index cc0dd1b..508c234 100644 (file)
                        {
                                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.
                                           */
index 5c8d878..e4b5653 100644 (file)
@@ -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);
index a6361c6..e358dec 100644 (file)
@@ -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
index 9f0506e..c9553a4 100644 (file)
@@ -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;
index 4fe49af..2703600 100644 (file)
                                {
                                        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.
                                           */
index 6294a0a..153ebbc 100644 (file)
@@ -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())
        {
index c2d536c..6b490ec 100644 (file)
                                {
                                        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
index f78a5ab..e5aa40c 100644 (file)
@@ -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;
index ccd20e3..33b807d 100644 (file)
                                {
                                        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. */
index eb4c253..7c564e0 100644 (file)
@@ -89,45 +89,19 @@ uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo
                  DataOUTEndpoint = EndpointData;\r
        }\r
 \r
-       for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)\r
-       {\r
-               uint16_t Size;\r
-               uint8_t  Type;\r
-               uint8_t  Token;\r
-               uint8_t  EndpointAddress;\r
-               bool     DoubleBanked;\r
-\r
-               if (PipeNum == AOAInterfaceInfo->Config.DataINPipeNumber)\r
-               {\r
-                       Size            = le16_to_cpu(DataINEndpoint->EndpointSize);\r
-                       EndpointAddress = DataINEndpoint->EndpointAddress;\r
-                       Token           = PIPE_TOKEN_IN;\r
-                       Type            = EP_TYPE_BULK;\r
-                       DoubleBanked    = AOAInterfaceInfo->Config.DataINPipeDoubleBank;\r
-\r
-                       AOAInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;\r
-               }\r
-               else if (PipeNum == AOAInterfaceInfo->Config.DataOUTPipeNumber)\r
-               {\r
-                       Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize);\r
-                       EndpointAddress = DataOUTEndpoint->EndpointAddress;\r
-                       Token           = PIPE_TOKEN_OUT;\r
-                       Type            = EP_TYPE_BULK;\r
-                       DoubleBanked    = AOAInterfaceInfo->Config.DataOUTPipeDoubleBank;\r
-\r
-                       AOAInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;\r
-               }\r
-               else\r
-               {\r
-                       continue;\r
-               }\r
-               \r
-               if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,\r
-                                        DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))\r
-               {\r
-                       return AOA_ENUMERROR_PipeConfigurationFailed;\r
-               }\r
-       }\r
+       AOAInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize);\r
+       AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;\r
+       AOAInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK;\r
+       \r
+       AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);\r
+       AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;\r
+       AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;\r
+       \r
+       if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1)))\r
+         return false;\r
+       \r
+       if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1)))\r
+         return false;\r
 \r
        AOAInterfaceInfo->State.IsActive        = true;\r
        AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber;\r
@@ -260,7 +234,7 @@ uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
 \r
        uint8_t ErrorCode;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);\r
 \r
        Pipe_Unfreeze();\r
        ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL);\r
@@ -277,7 +251,7 @@ uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
 \r
        uint8_t ErrorCode;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);\r
 \r
        Pipe_Unfreeze();\r
        ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL);\r
@@ -294,7 +268,7 @@ uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
 \r
        uint8_t ErrorCode;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);\r
        Pipe_Unfreeze();\r
 \r
        if (!(Pipe_IsReadWriteAllowed()))\r
@@ -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))\r
          return 0;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);\r
        Pipe_Unfreeze();\r
 \r
        if (Pipe_IsINReceived())\r
@@ -348,7 +322,7 @@ int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
 \r
        int16_t ReceivedByte = -1;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);\r
        Pipe_Unfreeze();\r
 \r
        if (Pipe_IsINReceived())\r
@@ -372,7 +346,7 @@ uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
 \r
        uint8_t ErrorCode;\r
 \r
-       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);\r
+       Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);\r
        Pipe_Unfreeze();\r
 \r
        if (!(Pipe_BytesInPipe()))\r
index 0ec44e7..678feda 100644 (file)
                        {\r
                                struct\r
                                {\r
-                                       uint8_t  DataINPipeNumber; /**< Pipe number of the AOA interface's IN data pipe. */\r
-                                       bool     DataINPipeDoubleBank; /**< Indicates if the AOA interface's IN data pipe should use double banking. */\r
-\r
-                                       uint8_t  DataOUTPipeNumber; /**< Pipe number of the AOA interface's OUT data pipe. */\r
-                                       bool     DataOUTPipeDoubleBank; /**< Indicates if the AOA interface's OUT data pipe should use double banking. */\r
+                                       USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */\r
+                                       USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */\r
                                        \r
                                        char*    PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the\r
                                                                                             *   Android device is switched into Open Accessory mode. */\r
                                                        *   Configured state.\r
                                                        */\r
                                        uint8_t  InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */\r
-\r
-                                       uint16_t DataINPipeSize; /**< Size in bytes of the AOA interface's IN data pipe. */\r
-                                       uint16_t DataOUTPipeSize;  /**< Size in bytes of the AOA interface's OUT data pipe. */\r
                                } State; /**< State data for the USB class interface within the device. All elements in this section\r
                                                  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when\r
                                                  *   the interface is enumerated.\r
index e5591ec..12783a6 100644 (file)
@@ -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;
index a6e425d..2d39aa9 100644 (file)
                        {
                                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.
                                           */
                                        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.
 
                                bool SampleReceived = false;
 
-                               Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber);
+                               Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipe.Address);
                                Pipe_Unfreeze();
                                SampleReceived = Pipe_IsINReceived();
                                Pipe_Freeze();
                                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();
                        }
 
index 63df6b0..8c79e9c 100644 (file)
@@ -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()))
index 5a8df24..4d79ed9 100644 (file)
                        {
                                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.
                                           */
                                                        */
                                        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_*
index f51bdf7..dad6a5a 100644 (file)
@@ -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();
index 7bdaad1..882cc31 100644 (file)
                        {
                                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
                                                        */
                                        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().
                                                                    */
index 5aadbcc..0d33bfe 100644 (file)
@@ -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;
@@ -219,7 +193,7 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
        if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
          return HOST_SENDCONTROL_DeviceDisconnected;
 
-       Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber);
+       Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipe.Address);
 
        if (!(Pipe_IsReadWriteAllowed()))
          return false;
index e934dda..b9e8611 100644 (file)
                        {
                                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.
index 24b4edc..f145881 100644 (file)
@@ -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;
index 25d7e1e..a8763dd 100644 (file)
                        {
                                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
index 379ccb0..dd33b11 100644 (file)
@@ -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())
index c8c997f..2587827 100644 (file)
                        {
                                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.
index a03011d..e457b5d 100644 (file)
@@ -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),
index 085bde2..57087ed 100644 (file)
                        {
                                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
                                                        */
                                        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. */
index 2b5514a..5c18d75 100644 (file)
@@ -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);
index 4cda70d..be616b4 100644 (file)
                        {
                                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.
                                           */
                                                            */
                                        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
index bcf904d..4440b76 100644 (file)
 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)
index 10f69a8..37ff220 100644 (file)
 
        /* 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;
 
        /* 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.
                                #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
                        };
 
                /* 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.
                         *
                         *  \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.
                                #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.
                         */
                        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;
                        }
 
                        /** 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.
                                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.
                        #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.
index 3f27c76..a1e0fd3 100644 (file)
@@ -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;
index 5e68cc7..1ddffb5 100644 (file)
 
 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;
index 86792bf..1012fa0 100644 (file)
 
                        /** \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.
                         */
                                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;
                        }
 
                        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.
                                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. */
                        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
                         *  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.
                         *
                         *  \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);
 
index e31b88d..1f37dfd 100644 (file)
@@ -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);
index f63cf3e..e26c86f 100644 (file)
@@ -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);
index 1fcc6b6..b349adf 100644 (file)
                #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.
index bb56b81..faa803b 100644 (file)
                #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.
                         */
                        #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"
index fc1b18a..c027585 100644 (file)
@@ -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)
 {
index c919eff..84801a1 100644 (file)
        /* 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: */
 
        /* 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.
                                #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
                        };
 
                /* 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.
                         *
                         *  \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.
                                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];
                         *
                         *  \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 |
                        /** 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.
                                (&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.
                        #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.
index 49d43f9..932381a 100644 (file)
@@ -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;
index 4e77a28..787244b 100644 (file)
@@ -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
                {
index f17fa53..837afe8 100644 (file)
 
                        /** \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.
                         */
                                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.
                         *
                        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
                        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.
                                                             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. */
                        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
                         *  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.
                         *
                         *  \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);
 
index 95ca7d9..3277244 100644 (file)
@@ -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);
index d411a93..a2a5c4a 100644 (file)
@@ -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);
index a91e18c..44a10e3 100644 (file)
                #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
index bc2f86d..56e5b5e 100644 (file)
                 */
                #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.
                 */
                        #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__))
+                               #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))
index 85be0f1..268fe95 100644 (file)
                        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)
index 98e35e5..1aeb985 100644 (file)
@@ -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;
        }
 }
 
index 7828f30..720b5f3 100644 (file)
                        #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
                        {
                        } 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;
                        }
 
                /* 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);
 
        /* 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.
                                #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.
                         *
                        };
 
                /* 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.
                         *
                         *  \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)
                                }
 
                                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.
                        }
 
                        /** 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.
                         */
                        /** 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.
                        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.
                                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
                        #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.
index 387e8e4..ffdca3a 100644 (file)
@@ -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);
@@ -109,7 +111,7 @@ void USB_ResetInterface(void)
          CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp);
 
        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 +174,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);
 
index 2f14f75..1cdb6f0 100644 (file)
@@ -69,7 +69,7 @@
                        } ATTR_PACKED USB_EndpointTable_t;
 
                /* External Variables: */
-                       extern USB_EndpointTable_t USB_EndpointTable;
+                       extern uint8_t USB_EndpointTable[];
 
        #endif
 
index b0e52d0..3554165 100644 (file)
@@ -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();
        }
index 35b285c..c99c1d2 100644 (file)
  *      .Config =
  *          {
  *              .StreamingInterfaceNumber = 1,
- *
- *              .DataINEndpointNumber     = 1,
- *              .DataINEndpointSize       = 256,
+ *              .DataINEndpoint           =
+ *                  {
+ *                      .Address          = (ENDPOINT_DIR_IN | 1),
+ *                      .Size             = 64,
+ *                      .Banks            = 1,
+ *                  },
  *          },
  *  };
  *  \endcode
  *  {
  *      .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
index dcde7dc..9b3b562 100644 (file)
  *
  *     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
  *
                        };
 
                /* 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.
                         *
 
                                if (SourceFreq > Frequency)
                                  return false;
+                                 
+                               if (MulFactor > 31)
+                                 return false;
 
                                switch (Source)
                                {
                                uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
                                GlobalInterruptDisable();
 
-                               CCP      = CCP_IOREG_gc;
-                               CLK_CTRL = ClockSourceMask;
+                               XMEGACLK_CCP_Write(&CLK.CTRL, ClockSourceMask);
 
                                SetGlobalInterruptMask(CurrentGlobalInt);
 
index 760193a..eaf04cb 100644 (file)
@@ -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())
index 12f44f9..da57b71 100644 (file)
@@ -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
index 5a994ba..1b140f3 100644 (file)
                #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. */
index f757ac1..445e088 100644 (file)
@@ -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);
index f485810..e7c43cd 100644 (file)
@@ -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))
index d342730..ad8cd53 100644 (file)
@@ -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);
index 8d9ac53..d68cee3 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 86d8c4d..2990848 100644 (file)
@@ -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,7 +157,7 @@ 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
@@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 03f4e5e..e481793 100644 (file)
                #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
index c0cc11f..fa44c08 100644 (file)
@@ -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
                        },
        };
index a3319e4..e674c93 100644 (file)
@@ -120,7 +120,7 @@ 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
@@ -130,7 +130,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 250fcf7..c0e8f46 100644 (file)
                #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
                /** 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
index bc70910..73bf554 100644 (file)
@@ -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,
                        },
        };
index 1dafda4..c93029c 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index cac0bd9..d953875 100644 (file)
@@ -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"
 
index e362857..9dda9e6 100644 (file)
@@ -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,7 +169,7 @@ 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
@@ -179,7 +179,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 03f4e5e..e481793 100644 (file)
                #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
index 34f29e1..dd3a8ae 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 9ad0e86..84898ac 100644 (file)
@@ -199,7 +199,7 @@ 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
@@ -224,7 +224,7 @@ 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
index c5dc2e2..8384444 100644 (file)
                #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
index 4062bff..2a9d5c3 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index aec8b88..b031d54 100644 (file)
@@ -132,7 +132,7 @@ 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
index 27ea9a1..f90816a 100644 (file)
@@ -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
index 6e41ce6..ecdf68b 100644 (file)
@@ -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),
                        },
index fc862aa..7ba467c 100644 (file)
@@ -149,7 +149,7 @@ 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
index ec9b330..3844e31 100644 (file)
                } 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,
index 0140527..24f0258 100644 (file)
@@ -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),
                        },
index efcd2be..e287d78 100644 (file)
@@ -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 */
index b05f7ef..c857bf7 100644 (file)
                /** 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. */
index 953c2af..7dc0279 100644 (file)
@@ -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
index d930137..f75d788 100644 (file)
@@ -136,7 +136,7 @@ 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
@@ -146,7 +146,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -183,7 +183,7 @@ 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
index 87ed01e..5f98143 100644 (file)
                #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
index 83590b3..9ead42e 100644 (file)
@@ -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),
                        },
index e623a54..66f81b8 100644 (file)
@@ -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,7 +169,7 @@ 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
@@ -179,7 +179,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index 03f4e5e..e481793 100644 (file)
                #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
index 194f6b0..7fe67da 100644 (file)
@@ -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,
+                                       },
                        },
        };
 
index 54cec1c..fb19a08 100644 (file)
@@ -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,7 +183,7 @@ 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
@@ -193,7 +193,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
@@ -219,7 +219,7 @@ 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
@@ -229,7 +229,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .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
index b0e0c11..591947c 100644 (file)
                #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
index 591ee92..158e759 100644 (file)
@@ -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,
                        },
        };
index e7091fc..601ebda 100644 (file)
@@ -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,
                        },
        };
 
index 5f2071e..a901e09 100644 (file)
@@ -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
index 9487f68..c0eeedf 100644 (file)
                #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. */
index 6b9c96d..5628d23 100644 (file)
@@ -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
index 30039aa..d058aea 100644 (file)
@@ -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,7 +169,7 @@ 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
@@ -179,7 +179,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_TX_EPNUM),
+                       .EndpointAddress        = CDC_TX_EPADDR,
                        .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                        .EndpointSize           = CDC_TXRX_EPSIZE,
                        .PollingIntervalMS      = 0x01
index 2569a72..4bb771b 100644 (file)
                #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
index bee770a..071c13e 100644 (file)
@@ -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 */