diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-07-31 18:09:42 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-07-31 18:09:42 +0200 |
commit | 30a5b024c3485ba4de1271ffc3eedbf14c55bf71 (patch) | |
tree | 00838f53187bc86dc29a87142e89d90add0c2527 /at91lib | |
parent | cfe1806207a60775f699a78ec9d8c0cf4a709b56 (diff) |
USBD: Add support for up to 4 configurations per device
This is implemented by using a pointer array for the config descriptors
Diffstat (limited to 'at91lib')
-rw-r--r-- | at91lib/usb/device/ccid/cciddriver.c | 8 | ||||
-rw-r--r-- | at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c | 8 | ||||
-rw-r--r-- | at91lib/usb/device/composite/COMPOSITEDDriverDescriptors.c | 8 | ||||
-rw-r--r-- | at91lib/usb/device/core/USBDDriver.c | 8 | ||||
-rw-r--r-- | at91lib/usb/device/core/USBDDriverDescriptors.h | 10 |
5 files changed, 22 insertions, 20 deletions
diff --git a/at91lib/usb/device/ccid/cciddriver.c b/at91lib/usb/device/ccid/cciddriver.c index 989345e..3db9065 100644 --- a/at91lib/usb/device/ccid/cciddriver.c +++ b/at91lib/usb/device/ccid/cciddriver.c @@ -597,14 +597,14 @@ static const unsigned char *stringDescriptors[] = { const USBDDriverDescriptors ccidDriverDescriptors = {
&deviceDescriptor, // FS
- (USBConfigurationDescriptor *) &configurationDescriptorsFS,
+ { (USBConfigurationDescriptor *) &configurationDescriptorsFS },
#ifdef BOARD_USB_UDPHS
(USBDeviceQualifierDescriptor *) &deviceQualifierDescriptor, // FS
- (USBConfigurationDescriptor *) &sOtherSpeedConfigurationFS,
+ { (USBConfigurationDescriptor *) &sOtherSpeedConfigurationFS },
&deviceDescriptor, // HS
- (USBConfigurationDescriptor *) &configurationDescriptorsHS,
+ { (USBConfigurationDescriptor *) &configurationDescriptorsHS },
(USBDeviceQualifierDescriptor *) &deviceQualifierDescriptor, // HS
- (USBConfigurationDescriptor *) &sOtherSpeedConfigurationHS,
+ { (USBConfigurationDescriptor *) &sOtherSpeedConfigurationHS },
#else
0, // No qualifier descriptor FS
0, // No other-speed configuration FS
diff --git a/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c index 349380c..dd3f38e 100644 --- a/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c +++ b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c @@ -608,14 +608,14 @@ const unsigned char *stringDescriptors[] = { USBDDriverDescriptors cdcdSerialDriverDescriptors = {
&deviceDescriptor,
- (USBConfigurationDescriptor *) &(configurationDescriptors),
+ { (USBConfigurationDescriptor *) &(configurationDescriptors) },
#ifdef BOARD_USB_UDPHS
&qualifierDescriptor,
- (USBConfigurationDescriptor *) &(otherSpeedDescriptorsFS),
+ { (USBConfigurationDescriptor *) &(otherSpeedDescriptorsFS) },
&deviceDescriptor,
- (USBConfigurationDescriptor *) &(configurationDescriptorsHS),
+ { (USBConfigurationDescriptor *) &(configurationDescriptorsHS) },
&qualifierDescriptor,
- (USBConfigurationDescriptor *) &(otherSpeedDescriptorsHS),
+ { (USBConfigurationDescriptor *) &(otherSpeedDescriptorsHS) },
#else
0, // No full-speed device qualifier descriptor
0, // No full-speed other speed configuration
diff --git a/at91lib/usb/device/composite/COMPOSITEDDriverDescriptors.c b/at91lib/usb/device/composite/COMPOSITEDDriverDescriptors.c index 1769769..3229385 100644 --- a/at91lib/usb/device/composite/COMPOSITEDDriverDescriptors.c +++ b/at91lib/usb/device/composite/COMPOSITEDDriverDescriptors.c @@ -884,14 +884,14 @@ const unsigned char *stringDescriptors[] = { const USBDDriverDescriptors compositedDriverDescriptors = {
&deviceDescriptor,
- (const USBConfigurationDescriptor *) &configurationDescriptors,
+ { (const USBConfigurationDescriptor *) &configurationDescriptors },
#ifdef BOARD_USB_UDPHS
&qualifierDescriptor,
- (const USBConfigurationDescriptor *) &configurationDescriptors,
+ { (const USBConfigurationDescriptor *) &configurationDescriptors },
&deviceDescriptor,
- (const USBConfigurationDescriptor *) &configurationDescriptors,
+ { (const USBConfigurationDescriptor *) &configurationDescriptors },
&qualifierDescriptor,
- (const USBConfigurationDescriptor *) &configurationDescriptors,
+ { (const USBConfigurationDescriptor *) &configurationDescriptors },
#else
0, 0, 0, 0, 0, 0,
#endif
diff --git a/at91lib/usb/device/core/USBDDriver.c b/at91lib/usb/device/core/USBDDriver.c index 83cbd9e..f84f6c6 100644 --- a/at91lib/usb/device/core/USBDDriver.c +++ b/at91lib/usb/device/core/USBDDriver.c @@ -58,9 +58,9 @@ static const USBConfigurationDescriptor *GetCurConfigDesc(USBDDriver *pDriver) // Use different descriptor depending on device speed
if (USBD_IsHighSpeed())
- return &pDriver->pDescriptors->pHsConfiguration[cfgidx];
+ return pDriver->pDescriptors->pHsConfiguration[cfgidx];
else
- return &pDriver->pDescriptors->pFsConfiguration[cfgidx];
+ return pDriver->pDescriptors->pFsConfiguration[cfgidx];
}
static const USBConfigurationDescriptor *GetCurOtherSpeedDesc(USBDDriver *pDriver)
@@ -72,9 +72,9 @@ static const USBConfigurationDescriptor *GetCurOtherSpeedDesc(USBDDriver *pDrive // Use different descriptor depending on device speed
if (USBD_IsHighSpeed())
- return &pDriver->pDescriptors->pHsOtherSpeed[cfgidx];
+ return pDriver->pDescriptors->pHsOtherSpeed[cfgidx];
else
- return &pDriver->pDescriptors->pFsOtherSpeed[cfgidx];
+ return pDriver->pDescriptors->pFsOtherSpeed[cfgidx];
}
diff --git a/at91lib/usb/device/core/USBDDriverDescriptors.h b/at91lib/usb/device/core/USBDDriverDescriptors.h index f1064e4..29e5eb7 100644 --- a/at91lib/usb/device/core/USBDDriverDescriptors.h +++ b/at91lib/usb/device/core/USBDDriverDescriptors.h @@ -47,6 +47,8 @@ #include <usb/common/core/USBConfigurationDescriptor.h>
#include <usb/common/core/USBDeviceQualifierDescriptor.h>
+#define USBD_NUM_CONFIGS 4
+
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
@@ -62,19 +64,19 @@ typedef struct { /// Pointer to the full-speed device descriptor.
const USBDeviceDescriptor *pFsDevice;
/// Pointer to the full-speed configuration descriptor.
- const USBConfigurationDescriptor *pFsConfiguration;
+ const USBConfigurationDescriptor *pFsConfiguration[USBD_NUM_CONFIGS];
/// Pointer to the full-speed qualifier descriptor.
const USBDeviceQualifierDescriptor *pFsQualifier;
/// Pointer to the full-speed other speed configuration descriptor.
- const USBConfigurationDescriptor *pFsOtherSpeed;
+ const USBConfigurationDescriptor *pFsOtherSpeed[USBD_NUM_CONFIGS];
/// Pointer to the high-speed device descriptor.
const USBDeviceDescriptor *pHsDevice;
/// Pointer to the high-speed configuration descriptor.
- const USBConfigurationDescriptor *pHsConfiguration;
+ const USBConfigurationDescriptor *pHsConfiguration[USBD_NUM_CONFIGS];
/// Pointer to the high-speed qualifier descriptor.
const USBDeviceQualifierDescriptor *pHsQualifier;
/// Pointer to the high-speed other speed configuration descriptor.
- const USBConfigurationDescriptor *pHsOtherSpeed;
+ const USBConfigurationDescriptor *pHsOtherSpeed[USBD_NUM_CONFIGS];
/// Pointer to the list of string descriptors.
const unsigned char **pStrings;
/// Number of string descriptors in list.
|