Add optional double-banking support to the Device mode Class Drivers, on a per-endpoint, per-interface level.

pull/1469/head
Dean Camera 15 years ago
parent 1c7aa68596
commit f7ab433c67

@ -44,16 +44,19 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{ {
.Config = .Config =
{ {
.ControlInterfaceNumber = 0, .ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM, .DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM, .DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
}, },
}; };

@ -44,16 +44,19 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{ {
.Config = .Config =
{ {
.ControlInterfaceNumber = 0, .ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM, .DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM, .DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
}, },
}; };
@ -68,13 +71,14 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = MOUSE_EPNUM, .ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE, .ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevMouseHIDReportBuffer, .PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
}, },
}; };

@ -45,16 +45,19 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface =
{ {
.Config = .Config =
{ {
.ControlInterfaceNumber = 0, .ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC1_TX_EPNUM, .DataINEndpointNumber = CDC1_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC1_RX_EPNUM, .DataOUTEndpointNumber = CDC1_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM, .NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
}, },
}; };
@ -67,16 +70,19 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface =
{ {
.Config = .Config =
{ {
.ControlInterfaceNumber = 2, .ControlInterfaceNumber = 2,
.DataINEndpointNumber = CDC2_TX_EPNUM, .DataINEndpointNumber = CDC2_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC2_RX_EPNUM, .DataOUTEndpointNumber = CDC2_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM, .NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
}, },
}; };

@ -55,13 +55,14 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = GENERIC_IN_EPNUM, .ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE, .ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevHIDReportBuffer, .PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
}, },
}; };

@ -47,13 +47,14 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = JOYSTICK_EPNUM, .ReportINEndpointNumber = JOYSTICK_EPNUM,
.ReportINEndpointSize = JOYSTICK_EPSIZE, .ReportINEndpointSize = JOYSTICK_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevJoystickHIDReportBuffer, .PrevReportINBuffer = PrevJoystickHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevJoystickHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevJoystickHIDReportBuffer),
}, },
}; };

@ -48,13 +48,14 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_EPNUM, .ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE, .ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer, .PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
}, },
}; };

@ -52,13 +52,14 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_IN_EPNUM, .ReportINEndpointNumber = KEYBOARD_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE, .ReportINEndpointSize = HID_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer, .PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
}, },
}; };

@ -46,11 +46,13 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
{ {
.StreamingInterfaceNumber = 1, .StreamingInterfaceNumber = 1,
.DataINEndpointNumber = MIDI_STREAM_IN_EPNUM, .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
.DataINEndpointSize = MIDI_STREAM_EPSIZE, .DataINEndpointSize = MIDI_STREAM_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM, .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
.DataOUTEndpointSize = MIDI_STREAM_EPSIZE, .DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
.DataOUTEndpointDoubleBank = false,
}, },
}; };

@ -44,15 +44,17 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM, .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE, .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM, .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE, .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.TotalLUNs = TOTAL_LUNS, .TotalLUNs = TOTAL_LUNS,
}, },
}; };

@ -37,46 +37,49 @@
#include "MassStorageKeyboard.h" #include "MassStorageKeyboard.h"
/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */ /** LUFA Mass Storage Class driver interface configuration and state information. This structure is
uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)]; * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
/** LUFA HID Class driver interface configuration and state information. This structure is
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another. * within a device can be differentiated from one another.
*/ */
USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = USB_ClassInfo_MS_Device_t Disk_MS_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 1, .InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_EPNUM, .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE, .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer, .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer), .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.TotalLUNs = TOTAL_LUNS,
}, },
}; };
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is /** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */
* passed to all Mass Storage Class driver functions, so that multiple instances of the same class uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];
/** LUFA HID Class driver interface configuration and state information. This structure is
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another. * within a device can be differentiated from one another.
*/ */
USB_ClassInfo_MS_Device_t Disk_MS_Interface = USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 1,
.DataINEndpointNumber = MASS_STORAGE_IN_EPNUM, .ReportINEndpointNumber = KEYBOARD_EPNUM,
.DataINEndpointSize = MASS_STORAGE_IO_EPSIZE, .ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINEndpointDoubleBank = false,
.DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM, .PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE, .PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
.TotalLUNs = TOTAL_LUNS,
}, },
}; };
/** Main program entry point. This routine contains the overall program flow, including initial /** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop. * setup of all components and the main program loop.

@ -47,13 +47,14 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = MOUSE_EPNUM, .ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE, .ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevMouseHIDReportBuffer, .PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
}, },
}; };

@ -44,19 +44,22 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
{ {
.Config = .Config =
{ {
.ControlInterfaceNumber = 0, .ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM, .DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM, .DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
.AdapterVendorDescription = "LUFA RNDIS Demo Adapter", .AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDRESS}, .AdapterMACAddress = {ADAPTER_MAC_ADDRESS},
}, },
}; };

@ -47,13 +47,14 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface =
{ {
.Config = .Config =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = MOUSE_EPNUM, .ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE, .ReportINEndpointSize = MOUSE_EPSIZE,
.ReportINEndpointDoubleBank = false,
.PrevReportINBuffer = PrevMouseHIDReportBuffer, .PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer), .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
}, },
}; };

@ -57,14 +57,10 @@
/* Includes: */ /* Includes: */
#include <avr/io.h> #include <avr/io.h>
#include <stdio.h>
#include <avr/version.h>
#include "FunctionAttributes.h" #include "FunctionAttributes.h"
#include "BoardTypes.h" #include "BoardTypes.h"
#include <alloca.h>
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
/** Macro for encasing other multi-statement macros. This should be used along with an opening brace /** Macro for encasing other multi-statement macros. This should be used along with an opening brace

@ -66,21 +66,21 @@
const struct const struct
{ {
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this
* structure controls. * structure controls
*/ */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available
* (zero if unused). * (zero if unused)
*/ */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available
* (zero if unused). * (zero if unused)
*/ */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
* (zero if unused). * (zero if unused)
*/ */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
* (zero if unused). * (zero if unused)
*/ */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } 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. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.

@ -91,21 +91,21 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.DataINEndpointSize, ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE))) CDCInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_OUT, CDCInterfaceInfo->Config.DataOUTEndpointSize, ENDPOINT_DIR_OUT, CDCInterfaceInfo->Config.DataOUTEndpointSize,
ENDPOINT_BANK_SINGLE))) CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT, if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.NotificationEndpointSize, ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.NotificationEndpointSize,
ENDPOINT_BANK_SINGLE))) CDCInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }

@ -69,12 +69,15 @@
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } 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. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */

@ -134,7 +134,8 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
HIDInterfaceInfo->State.IdleCount = 500; HIDInterfaceInfo->State.IdleCount = 500;
if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT, if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize, ENDPOINT_BANK_SINGLE))) ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize,
HIDInterfaceInfo->Config.ReportINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }

@ -73,6 +73,7 @@
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */ 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 */ 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 */
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be 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 * stored by the driver, for comparison purposes to detect report changes that

@ -46,7 +46,7 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{ {
if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, MIDIInterfaceInfo->Config.DataINEndpointSize, ENDPOINT_DIR_IN, MIDIInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE))) MIDIInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
@ -56,7 +56,7 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{ {
if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_OUT, MIDIInterfaceInfo->Config.DataOUTEndpointSize, ENDPOINT_DIR_OUT, MIDIInterfaceInfo->Config.DataOUTEndpointSize,
ENDPOINT_BANK_SINGLE))) MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }

@ -70,9 +70,11 @@
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */ uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */ uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI 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 data, if available (zero if unused) */ uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
bool DataOUTEndpointDoubleBank; /** Indicates if the MIDI interface's IN data endpoint should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } 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. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */

@ -78,14 +78,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, MSInterfaceInfo->Config.DataINEndpointSize, ENDPOINT_DIR_IN, MSInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE))) MSInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_OUT, MSInterfaceInfo->Config.DataOUTEndpointSize, ENDPOINT_DIR_OUT, MSInterfaceInfo->Config.DataOUTEndpointSize,
ENDPOINT_BANK_SINGLE))) MSInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }

@ -69,9 +69,11 @@
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */ 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 */ 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 */ 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 */ 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 */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */ 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 } Config; /**< Config data for the USB class interface within the device. All elements in this section

@ -116,21 +116,21 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.DataINEndpointSize, ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE))) RNDISInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_OUT, RNDISInterfaceInfo->Config.DataOUTEndpointSize, ENDPOINT_DIR_OUT, RNDISInterfaceInfo->Config.DataOUTEndpointSize,
ENDPOINT_BANK_SINGLE))) RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }
if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT, if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.NotificationEndpointSize, ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.NotificationEndpointSize,
ENDPOINT_BANK_SINGLE))) RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{ {
return false; return false;
} }

@ -70,12 +70,15 @@
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */ 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 */ uint16_t DataINEndpointSize; /**< Size in bytes of the CDC 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 CDC interface's OUT data endpoint */ 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 */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC 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 CDC interface's IN notification endpoint, if used */ 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 */ uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
bool NotificationEndpointDoubleBank; /** Indicates if the RNDIS interface's notification endpoint should use double banking */
char* AdapterVendorDescription; /**< String description of the adapter vendor */ char* AdapterVendorDescription; /**< String description of the adapter vendor */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */ MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */

@ -18,6 +18,7 @@
* - Added new Joystick Host ClassDriver and LowLevel demos * - Added new Joystick Host ClassDriver and LowLevel demos
* - Added new Printer Host mode Class driver * - Added new Printer Host mode Class driver
* - Added new Printer Host mode ClassDriver demo * - Added new Printer Host mode ClassDriver demo
* - Added optional support for double banked endpoints in the Device mode Class drivers
* *
* <b>Changed:</b> * <b>Changed:</b>
* - Removed mostly useless "TestApp" demo, as it was mainly useful only for checking for sytax errors in the library * - Removed mostly useless "TestApp" demo, as it was mainly useful only for checking for sytax errors in the library

@ -24,6 +24,7 @@
* - Add RNDIS Host Class driver * - Add RNDIS Host Class driver
* - Add unit testing to APIs * - Add unit testing to APIs
* - Add board overviews * - Add board overviews
* - Add resume interrupt support
* - Make new demos * - Make new demos
* -# Keyboard/Mouse Dual Class Host * -# Keyboard/Mouse Dual Class Host
* -# Multiple-Report HID device * -# Multiple-Report HID device

Loading…
Cancel
Save