From f7ab433c67b86723385ec05ee9c7b96dd18e6dde Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 6 Nov 2009 13:43:18 +0000 Subject: Add optional double-banking support to the Device mode Class Drivers, on a per-endpoint, per-interface level. --- LUFA/Drivers/USB/Class/Device/Audio.h | 10 +++++----- LUFA/Drivers/USB/Class/Device/CDC.c | 6 +++--- LUFA/Drivers/USB/Class/Device/CDC.h | 3 +++ LUFA/Drivers/USB/Class/Device/HID.c | 3 ++- LUFA/Drivers/USB/Class/Device/HID.h | 1 + LUFA/Drivers/USB/Class/Device/MIDI.c | 4 ++-- LUFA/Drivers/USB/Class/Device/MIDI.h | 2 ++ LUFA/Drivers/USB/Class/Device/MassStorage.c | 4 ++-- LUFA/Drivers/USB/Class/Device/MassStorage.h | 2 ++ LUFA/Drivers/USB/Class/Device/RNDIS.c | 6 +++--- LUFA/Drivers/USB/Class/Device/RNDIS.h | 3 +++ 11 files changed, 28 insertions(+), 16 deletions(-) (limited to 'LUFA/Drivers/USB') diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h index 0d8e0ec88..0200cf428 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.h +++ b/LUFA/Drivers/USB/Class/Device/Audio.h @@ -66,21 +66,21 @@ const struct { 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 - * (zero if unused). + * (zero if unused) */ 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 - * (zero if unused). + * (zero if unused) */ 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 * must be set or the interface will fail to enumerate and operate correctly. diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index c968d7f0c..dfee2bb1b 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -91,21 +91,21 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.DataINEndpointSize, - ENDPOINT_BANK_SINGLE))) + CDCInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_OUT, CDCInterfaceInfo->Config.DataOUTEndpointSize, - ENDPOINT_BANK_SINGLE))) + CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.NotificationEndpointSize, - ENDPOINT_BANK_SINGLE))) + CDCInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h index 3e7dbb08f..c3304f099 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.h +++ b/LUFA/Drivers/USB/Class/Device/CDC.h @@ -69,12 +69,15 @@ 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 */ } Config; /**< Config data for the USB class interface within the device. All elements in this section * must be set or the interface will fail to enumerate and operate correctly. */ diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index 26f5697d2..0bf1f7020 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -134,7 +134,8 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac HIDInterfaceInfo->State.IdleCount = 500; 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; } diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index 545b38d14..7bcc263a8 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -73,6 +73,7 @@ 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 */ 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 diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c index eede4806b..2685ab0ae 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.c +++ b/LUFA/Drivers/USB/Class/Device/MIDI.c @@ -46,7 +46,7 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter { if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_IN, MIDIInterfaceInfo->Config.DataINEndpointSize, - ENDPOINT_BANK_SINGLE))) + MIDIInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { 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, ENDPOINT_DIR_OUT, MIDIInterfaceInfo->Config.DataOUTEndpointSize, - ENDPOINT_BANK_SINGLE))) + MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h index c7f67e20c..c17b72ad7 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.h +++ b/LUFA/Drivers/USB/Class/Device/MIDI.h @@ -70,9 +70,11 @@ 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) */ + 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) */ 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 * must be set or the interface will fail to enumerate and operate correctly. */ diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c index 04c63fca7..fce864386 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c @@ -78,14 +78,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_IN, MSInterfaceInfo->Config.DataINEndpointSize, - ENDPOINT_BANK_SINGLE))) + MSInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_OUT, MSInterfaceInfo->Config.DataOUTEndpointSize, - ENDPOINT_BANK_SINGLE))) + MSInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.h b/LUFA/Drivers/USB/Class/Device/MassStorage.h index 4dca793c5..3de5fd396 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.h @@ -69,9 +69,11 @@ 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 */ 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 diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c index 09352143c..8ba46c7ac 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c @@ -116,21 +116,21 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.DataINEndpointSize, - ENDPOINT_BANK_SINGLE))) + RNDISInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK, ENDPOINT_DIR_OUT, RNDISInterfaceInfo->Config.DataOUTEndpointSize, - ENDPOINT_BANK_SINGLE))) + RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.NotificationEndpointSize, - ENDPOINT_BANK_SINGLE))) + RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE))) { return false; } diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.h b/LUFA/Drivers/USB/Class/Device/RNDIS.h index 7d7a0f5b9..7521f0741 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.h @@ -70,12 +70,15 @@ 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 RNDIS 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 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 */ 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 */ MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */ -- cgit v1.2.3