diff options
| author | Damien George <damien.p.george@gmail.com> | 2017-09-22 10:28:56 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2017-09-22 10:28:56 +1000 |
| commit | db7f4aa2cb5848942c421785770831bd9be7b9b6 (patch) | |
| tree | c5ebefcba6fe7884c5f7a95e5568c04899e49e88 /ports/stm32/usbdev | |
| parent | dbff0164b3ce7293d9de05c14fba6481c316c2e8 (diff) | |
stm32/usbdev: Make device descriptor callbacks take a state pointer.
Diffstat (limited to 'ports/stm32/usbdev')
| -rw-r--r-- | ports/stm32/usbdev/core/inc/usbd_def.h | 16 | ||||
| -rw-r--r-- | ports/stm32/usbdev/core/src/usbd_ctlreq.c | 14 |
2 files changed, 16 insertions, 14 deletions
diff --git a/ports/stm32/usbdev/core/inc/usbd_def.h b/ports/stm32/usbdev/core/inc/usbd_def.h index bd913a286..888d426ef 100644 --- a/ports/stm32/usbdev/core/inc/usbd_def.h +++ b/ports/stm32/usbdev/core/inc/usbd_def.h @@ -193,16 +193,18 @@ typedef enum { USBD_FAIL,
}USBD_StatusTypeDef;
+struct _USBD_HandleTypeDef;
+
/* USB Device descriptors structure */
typedef struct
{
- uint8_t *(*GetDeviceDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetLangIDStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetManufacturerStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetProductStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetSerialStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetConfigurationStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
- uint8_t *(*GetInterfaceStrDescriptor)( USBD_SpeedTypeDef speed , uint16_t *length);
+ uint8_t *(*GetDeviceDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetLangIDStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetManufacturerStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetProductStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetSerialStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetConfigurationStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
+ uint8_t *(*GetInterfaceStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
} USBD_DescriptorsTypeDef;
/* USB Device handle structure */
diff --git a/ports/stm32/usbdev/core/src/usbd_ctlreq.c b/ports/stm32/usbdev/core/src/usbd_ctlreq.c index 15d9b6ec4..5fba322fa 100644 --- a/ports/stm32/usbdev/core/src/usbd_ctlreq.c +++ b/ports/stm32/usbdev/core/src/usbd_ctlreq.c @@ -330,7 +330,7 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev , switch (req->wValue >> 8)
{
case USB_DESC_TYPE_DEVICE:
- pbuf = pdev->pDesc->GetDeviceDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetDeviceDescriptor(pdev, &len);
break;
case USB_DESC_TYPE_CONFIGURATION:
@@ -350,27 +350,27 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev , switch ((uint8_t)(req->wValue))
{
case USBD_IDX_LANGID_STR:
- pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev, &len);
break;
case USBD_IDX_MFC_STR:
- pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev, &len);
break;
case USBD_IDX_PRODUCT_STR:
- pbuf = pdev->pDesc->GetProductStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetProductStrDescriptor(pdev, &len);
break;
case USBD_IDX_SERIAL_STR:
- pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev, &len);
break;
case USBD_IDX_CONFIG_STR:
- pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev, &len);
break;
case USBD_IDX_INTERFACE_STR:
- pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev, &len);
break;
default:
|
