forked from stm/stm32-mw-usb-device
Release v2.8.0
This commit is contained in:
@@ -157,7 +157,7 @@ __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALI
|
||||
/* Configuration 1 */
|
||||
0x09, /* bLength */
|
||||
USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType */
|
||||
LOBYTE(USB_AUDIO_CONFIG_DESC_SIZ), /* wTotalLength 109 bytes*/
|
||||
LOBYTE(USB_AUDIO_CONFIG_DESC_SIZ), /* wTotalLength */
|
||||
HIBYTE(USB_AUDIO_CONFIG_DESC_SIZ),
|
||||
0x02, /* bNumInterfaces */
|
||||
0x01, /* bConfigurationValue */
|
||||
@@ -167,7 +167,7 @@ __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALI
|
||||
#else
|
||||
0x80, /* bmAttributes: Bus Powered according to user configuration */
|
||||
#endif
|
||||
USBD_MAX_POWER, /* bMaxPower = 100 mA */
|
||||
USBD_MAX_POWER, /* MaxPower (mA) */
|
||||
/* 09 byte*/
|
||||
|
||||
/* USB Speaker Standard interface descriptor */
|
||||
@@ -188,7 +188,7 @@ __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALI
|
||||
AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */
|
||||
0x00, /* 1.00 */ /* bcdADC */
|
||||
0x01,
|
||||
0x27, /* wTotalLength = 39*/
|
||||
0x27, /* wTotalLength */
|
||||
0x00,
|
||||
0x01, /* bInCollection */
|
||||
0x01, /* baInterfaceNr */
|
||||
@@ -219,22 +219,22 @@ __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALI
|
||||
AUDIO_CONTROL_MUTE, /* bmaControls(0) */
|
||||
0, /* bmaControls(1) */
|
||||
0x00, /* iTerminal */
|
||||
/* 09 byte*/
|
||||
/* 09 byte */
|
||||
|
||||
/*USB Speaker Output Terminal Descriptor */
|
||||
/* USB Speaker Output Terminal Descriptor */
|
||||
0x09, /* bLength */
|
||||
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||
AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */
|
||||
0x03, /* bTerminalID */
|
||||
0x01, /* wTerminalType 0x0301*/
|
||||
0x01, /* wTerminalType 0x0301 */
|
||||
0x03,
|
||||
0x00, /* bAssocTerminal */
|
||||
0x02, /* bSourceID */
|
||||
0x00, /* iTerminal */
|
||||
/* 09 byte*/
|
||||
/* 09 byte */
|
||||
|
||||
/* USB Speaker Standard AS Interface Descriptor - Audio Streaming Zero Bandwidth */
|
||||
/* Interface 1, Alternate Setting 0 */
|
||||
/* Interface 1, Alternate Setting 0 */
|
||||
AUDIO_INTERFACE_DESC_SIZE, /* bLength */
|
||||
USB_DESC_TYPE_INTERFACE, /* bDescriptorType */
|
||||
0x01, /* bInterfaceNumber */
|
||||
@@ -292,7 +292,7 @@ __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALI
|
||||
0x00, /* bSynchAddress */
|
||||
/* 09 byte*/
|
||||
|
||||
/* Endpoint - Audio Streaming Descriptor*/
|
||||
/* Endpoint - Audio Streaming Descriptor */
|
||||
AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
|
||||
AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||
AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
|
||||
@@ -339,7 +339,7 @@ static uint8_t USBD_AUDIO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
USBD_AUDIO_HandleTypeDef *haudio;
|
||||
|
||||
/* Allocate Audio structure */
|
||||
haudio = USBD_malloc(sizeof(USBD_AUDIO_HandleTypeDef));
|
||||
haudio = (USBD_AUDIO_HandleTypeDef *)USBD_malloc(sizeof(USBD_AUDIO_HandleTypeDef));
|
||||
|
||||
if (haudio == NULL)
|
||||
{
|
||||
@@ -791,10 +791,11 @@ static void AUDIO_REQ_GetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
|
||||
return;
|
||||
}
|
||||
|
||||
(void)USBD_memset(haudio->control.data, 0, 64U);
|
||||
(void)USBD_memset(haudio->control.data, 0, USB_MAX_EP0_SIZE);
|
||||
|
||||
/* Send the current mute state */
|
||||
(void)USBD_CtlSendData(pdev, haudio->control.data, req->wLength);
|
||||
(void)USBD_CtlSendData(pdev, haudio->control.data,
|
||||
MIN(req->wLength, USB_MAX_EP0_SIZE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -816,12 +817,12 @@ static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
|
||||
|
||||
if (req->wLength != 0U)
|
||||
{
|
||||
/* Prepare the reception of the buffer over EP0 */
|
||||
(void)USBD_CtlPrepareRx(pdev, haudio->control.data, req->wLength);
|
||||
|
||||
haudio->control.cmd = AUDIO_REQ_SET_CUR; /* Set the request value */
|
||||
haudio->control.len = (uint8_t)req->wLength; /* Set the request data length */
|
||||
haudio->control.len = (uint8_t)MIN(req->wLength, USB_MAX_EP0_SIZE); /* Set the request data length */
|
||||
haudio->control.unit = HIBYTE(req->wIndex); /* Set the request target unit */
|
||||
|
||||
/* Prepare the reception of the buffer over EP0 */
|
||||
(void)USBD_CtlPrepareRx(pdev, haudio->control.data, haudio->control.len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user