Skip to content

Commit a2f0488

Browse files
authored
chore(radio): stm32_mw_usb_device v2.11.2 catchup (#4757)
1 parent fe8e092 commit a2f0488

File tree

18 files changed

+341
-202
lines changed

18 files changed

+341
-202
lines changed

radio/src/targets/common/arm/stm32/usbd_hid_joystick.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static uint8_t USBD_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
312312
(void)USBD_LL_OpenEP(pdev, HIDInEpAdd, USBD_EP_TYPE_INTR, hid_in_pkt_size);
313313
pdev->ep_in[HIDInEpAdd & 0xFU].is_used = 1U;
314314

315-
hhid->state = HID_IDLE;
315+
hhid->state = USBD_HID_IDLE;
316316

317317
return (uint8_t)USBD_OK;
318318
}
@@ -373,19 +373,19 @@ static uint8_t USBD_HID_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re
373373
case USB_REQ_TYPE_CLASS :
374374
switch (req->bRequest)
375375
{
376-
case HID_REQ_SET_PROTOCOL:
376+
case USBD_HID_REQ_SET_PROTOCOL:
377377
hhid->Protocol = (uint8_t)(req->wValue);
378378
break;
379379

380-
case HID_REQ_GET_PROTOCOL:
380+
case USBD_HID_REQ_GET_PROTOCOL:
381381
(void)USBD_CtlSendData(pdev, (uint8_t *)&hhid->Protocol, 1U);
382382
break;
383383

384-
case HID_REQ_SET_IDLE:
384+
case USBD_HID_REQ_SET_IDLE:
385385
hhid->IdleState = (uint8_t)(req->wValue >> 8);
386386
break;
387387

388-
case HID_REQ_GET_IDLE:
388+
case USBD_HID_REQ_GET_IDLE:
389389
(void)USBD_CtlSendData(pdev, (uint8_t *)&hhid->IdleState, 1U);
390390
break;
391391

@@ -507,9 +507,9 @@ uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t
507507

508508
if (pdev->dev_state == USBD_STATE_CONFIGURED)
509509
{
510-
if (hhid->state == HID_IDLE)
510+
if (hhid->state == USBD_HID_IDLE)
511511
{
512-
hhid->state = HID_BUSY;
512+
hhid->state = USBD_HID_BUSY;
513513
(void)USBD_LL_Transmit(pdev, HIDInEpAdd, report, len);
514514
} else {
515515
return (uint8_t)USBD_BUSY;
@@ -625,7 +625,7 @@ static uint8_t USBD_HID_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
625625
UNUSED(epnum);
626626
/* Ensure that the FIFO is empty before a new transfer, this condition could
627627
be caused by a new transfer before the end of the previous transfer */
628-
((USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId])->state = HID_IDLE;
628+
((USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId])->state = USBD_HID_IDLE;
629629

630630
return (uint8_t)USBD_OK;
631631
}

radio/src/thirdparty/STM32_USB_Device_Library/Class/CompositeBuilder/Inc/usbd_composite_builder.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ typedef struct
172172
#if (USBD_CMPSIT_ACTIVATE_CDC == 1) || (USBD_CMPSIT_ACTIVATE_RNDIS == 1) || (USBD_CMPSIT_ACTIVATE_CDC_ECM == 1)
173173
typedef struct
174174
{
175-
/*
176-
* CDC Class specification revision 1.2
177-
* Table 15: Class-Specific Descriptor Header Format
178-
*/
175+
/*
176+
* CDC Class specification revision 1.2
177+
* Table 15: Class-Specific Descriptor Header Format
178+
*/
179179
/* Header Functional Descriptor */
180180
uint8_t bLength;
181181
uint8_t bDescriptorType;
@@ -204,10 +204,10 @@ typedef struct
204204

205205
typedef struct
206206
{
207-
/*
208-
* CDC Class specification revision 1.2
209-
* Table 16: Union Interface Functional Descriptor
210-
*/
207+
/*
208+
* CDC Class specification revision 1.2
209+
* Table 16: Union Interface Functional Descriptor
210+
*/
211211
/* Union Functional Descriptor */
212212
uint8_t bLength;
213213
uint8_t bDescriptorType;
@@ -249,7 +249,7 @@ uint8_t USBD_CMPST_ClearConfDesc(USBD_HandleTypeDef *pdev);
249249
pEpDesc->bDescriptorType = USB_DESC_TYPE_ENDPOINT; \
250250
pEpDesc->bEndpointAddress = (epadd); \
251251
pEpDesc->bmAttributes = (eptype); \
252-
pEpDesc->wMaxPacketSize = (epsize); \
252+
pEpDesc->wMaxPacketSize = (uint16_t)(epsize); \
253253
if(speed == (uint8_t)USBD_SPEED_HIGH) \
254254
{ \
255255
pEpDesc->bInterval = HSinterval; \

radio/src/thirdparty/STM32_USB_Device_Library/Class/CompositeBuilder/Src/usbd_composite_builder.c

+20-19
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ static void USBD_CMPSIT_HIDMouseDesc(USBD_HandleTypeDef *pdev, uint32_t pConf,
844844

845845
/* Update Config Descriptor and IAD descriptor */
846846
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
847-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
847+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
848848
}
849849
#endif /* USBD_CMPSIT_ACTIVATE_HID == 1 */
850850

@@ -881,7 +881,7 @@ static void USBD_CMPSIT_MSCDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
881881

882882
/* Update Config Descriptor and IAD descriptor */
883883
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
884-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
884+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
885885
}
886886
#endif /* USBD_CMPSIT_ACTIVATE_MSC == 1 */
887887

@@ -979,7 +979,7 @@ static void USBD_CMPSIT_CDCDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
979979

980980
/* Update Config Descriptor and IAD descriptor */
981981
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U;
982-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
982+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
983983
}
984984
#endif /* USBD_CMPSIT_ACTIVATE_CDC == 1 */
985985

@@ -1018,7 +1018,7 @@ static void USBD_CMPSIT_DFUDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
10181018

10191019
/* Update Config Descriptor and IAD descriptor */
10201020
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
1021-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1021+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
10221022

10231023
UNUSED(idx);
10241024
}
@@ -1113,7 +1113,7 @@ static void USBD_CMPSIT_CDC_ECMDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, _
11131113

11141114
/* Update Config Descriptor and IAD descriptor */
11151115
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U;
1116-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1116+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
11171117
}
11181118
#endif /* USBD_CMPSIT_ACTIVATE_CDC_ECM */
11191119

@@ -1249,7 +1249,7 @@ static void USBD_CMPSIT_AUDIODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
12491249
pSpEpDesc->bDescriptorType = USB_DESC_TYPE_ENDPOINT;
12501250
pSpEpDesc->bEndpointAddress = pdev->tclasslist[pdev->classId].Eps[0].add;
12511251
pSpEpDesc->bmAttributes = USBD_EP_TYPE_ISOC;
1252-
pSpEpDesc->wMaxPacketSize = USBD_AUDIO_GetEpPcktSze(pdev, 0U, 0U);
1252+
pSpEpDesc->wMaxPacketSize = (uint16_t)USBD_AUDIO_GetEpPcktSze(pdev, 0U, 0U);
12531253
pSpEpDesc->bInterval = 0x01U;
12541254
pSpEpDesc->bRefresh = 0x00U;
12551255
pSpEpDesc->bSynchAddress = 0x00U;
@@ -1267,7 +1267,7 @@ static void USBD_CMPSIT_AUDIODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
12671267

12681268
/* Update Config Descriptor and IAD descriptor */
12691269
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U;
1270-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1270+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
12711271
}
12721272
#endif /* USBD_CMPSIT_ACTIVATE_AUDIO */
12731273

@@ -1363,7 +1363,7 @@ static void USBD_CMPSIT_RNDISDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
13631363

13641364
/* Update Config Descriptor and IAD descriptor */
13651365
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U;
1366-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1366+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
13671367
}
13681368
#endif /* USBD_CMPSIT_ACTIVATE_RNDIS == 1 */
13691369

@@ -1407,7 +1407,7 @@ static void USBD_CMPSIT_CUSTOMHIDDesc(USBD_HandleTypeDef *pdev, uint32_t pConf,
14071407

14081408
/* Update Config Descriptor and IAD descriptor */
14091409
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
1410-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1410+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
14111411
}
14121412
#endif /* USBD_CMPSIT_ACTIVATE_CUSTOMHID == 1U */
14131413

@@ -1585,8 +1585,7 @@ static void USBD_CMPSIT_VIDEODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
15851585

15861586
/* USB Standard VS Interface Descriptor - data transfer mode */
15871587
/* Interface 1, Alternate Setting 1*/
1588-
__USBD_CMPSIT_SET_IF(1U, 1U, 1U, UVC_CC_VIDEO, \
1589-
SC_VIDEOSTREAMING, PC_PROTOCOL_UNDEFINED, 0U);
1588+
__USBD_CMPSIT_SET_IF(1U, 1U, 1U, UVC_CC_VIDEO, SC_VIDEOSTREAMING, PC_PROTOCOL_UNDEFINED, 0U);
15901589

15911590
/* Standard VS (Video Streaming) data Endpoint */
15921591
pSVCDEP = ((USBD_StandardVCDataEPDescTypeDef *)(pConf + *Sze));
@@ -1609,7 +1608,7 @@ static void USBD_CMPSIT_VIDEODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
16091608

16101609
/* Update Config Descriptor and IAD descriptor */
16111610
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U;
1612-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1611+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
16131612
}
16141613
#endif /* USBD_CMPSIT_ACTIVATE_VIDEO == 1 */
16151614

@@ -1645,7 +1644,7 @@ static void USBD_CMPSIT_PRNTDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
16451644

16461645
/* Update Config Descriptor and IAD descriptor */
16471646
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
1648-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1647+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
16491648
}
16501649
#endif /* USBD_CMPSIT_ACTIVATE_PRINTER == 1 */
16511650

@@ -1715,7 +1714,7 @@ static void USBD_CMPSIT_CCIDDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
17151714

17161715
/* Update Config Descriptor and IAD descriptor */
17171716
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
1718-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1717+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
17191718
}
17201719
#endif /* USBD_CMPSIT_ACTIVATE_CCID == 1 */
17211720

@@ -1735,8 +1734,8 @@ static void USBD_CMPSIT_MTPDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
17351734

17361735
/* Append MTP Interface descriptor */
17371736
__USBD_CMPSIT_SET_IF((pdev->tclasslist[pdev->classId].Ifs[0]), (0U), \
1738-
(uint8_t)(pdev->tclasslist[pdev->classId].NumEps), USB_MTP_INTRERFACE_CLASS, USB_MTP_INTRERFACE_SUB_CLASS,
1739-
USB_MTP_INTRERFACE_PROTOCOL, (0U));
1737+
(uint8_t)(pdev->tclasslist[pdev->classId].NumEps), USB_MTP_INTRERFACE_CLASS, \
1738+
USB_MTP_INTRERFACE_SUB_CLASS, USB_MTP_INTRERFACE_PROTOCOL, (0U));
17401739

17411740
if (speed == (uint8_t)USBD_SPEED_HIGH)
17421741
{
@@ -1757,7 +1756,7 @@ static void USBD_CMPSIT_MTPDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
17571756

17581757
/* Update Config Descriptor and IAD descriptor */
17591758
((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U;
1760-
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze;
1759+
((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze);
17611760
}
17621761
#endif /* USBD_CMPSIT_ACTIVATE_MTP == 1 */
17631762

@@ -1778,7 +1777,8 @@ uint32_t USBD_CMPSIT_SetClassID(USBD_HandleTypeDef *pdev, USBD_CompositeClassTy
17781777
for (idx = 0U; idx < pdev->NumClasses; idx++)
17791778
{
17801779
/* Check if the class correspond to the requested type and if it is active */
1781-
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) && ((pdev->tclasslist[idx].Active) == 1U))
1780+
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) &&
1781+
((pdev->tclasslist[idx].Active) == 1U))
17821782
{
17831783
if (inst == Instance)
17841784
{
@@ -1817,7 +1817,8 @@ uint32_t USBD_CMPSIT_GetClassID(USBD_HandleTypeDef *pdev, USBD_CompositeClassTy
18171817
for (idx = 0U; idx < pdev->NumClasses; idx++)
18181818
{
18191819
/* Check if the class correspond to the requested type and if it is active */
1820-
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) && ((pdev->tclasslist[idx].Active) == 1U))
1820+
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) &&
1821+
((pdev->tclasslist[idx].Active) == 1U))
18211822
{
18221823
if (inst == Instance)
18231824
{

radio/src/thirdparty/STM32_USB_Device_Library/Class/CustomHID/Inc/usbd_customhid.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ typedef struct _USBD_CUSTOM_HID_Itf
106106
int8_t (* Init)(void);
107107
int8_t (* DeInit)(void);
108108
int8_t (* OutEvent)(uint8_t event_idx, uint8_t state);
109-
109+
#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED
110+
int8_t (* CtrlReqComplete)(uint8_t request, uint16_t wLength);
111+
#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */
112+
#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED
113+
uint8_t *(* GetReport)(uint16_t *ReportLength);
114+
#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */
110115
} USBD_CUSTOM_HID_ItfTypeDef;
111116

112117
typedef struct
@@ -162,9 +167,13 @@ extern USBD_ClassTypeDef USBD_CUSTOM_HID;
162167
/** @defgroup USB_CORE_Exported_Functions
163168
* @{
164169
*/
170+
#ifdef USE_USBD_COMPOSITE
171+
uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev,
172+
uint8_t *report, uint16_t len, uint8_t ClassId);
173+
#else
165174
uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev,
166175
uint8_t *report, uint16_t len);
167-
176+
#endif /* USE_USBD_COMPOSITE */
168177
uint8_t USBD_CUSTOM_HID_ReceivePacket(USBD_HandleTypeDef *pdev);
169178

170179
uint8_t USBD_CUSTOM_HID_RegisterInterface(USBD_HandleTypeDef *pdev,

0 commit comments

Comments
 (0)