Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc591a6

Browse files
committed
chore(usb): update to stm32_mw_usb_device v2.11.3
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parenta192198 commitbc591a6

File tree

16 files changed

+682
-270
lines changed

16 files changed

+682
-270
lines changed

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src/usbd_audio.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,19 @@ static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnu
742742
*/
743743
staticuint8_tUSBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef*pdev,uint8_tepnum)
744744
{
745-
UNUSED(pdev);
746-
UNUSED(epnum);
745+
USBD_AUDIO_HandleTypeDef*haudio;
746+
747+
if (pdev->pClassDataCmsit[pdev->classId]==NULL)
748+
{
749+
return (uint8_t)USBD_FAIL;
750+
}
751+
752+
haudio= (USBD_AUDIO_HandleTypeDef*)pdev->pClassDataCmsit[pdev->classId];
753+
754+
/* Prepare Out endpoint to receive next audio packet */
755+
(void)USBD_LL_PrepareReceive(pdev,epnum,
756+
&haudio->buffer[haudio->wr_ptr],
757+
AUDIO_OUT_PACKET);
747758

748759
return (uint8_t)USBD_OK;
749760
}

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c

Lines changed: 12 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ EndBSPDependencies */
4545
/* Includes ------------------------------------------------------------------*/
4646
#include"usbd_customhid.h"
4747
#include"usbd_ctlreq.h"
48-
#include"usbd_def.h"
4948

5049

5150
/** @addtogroup STM32_USB_DEVICE_LIBRARY
@@ -168,7 +167,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_
168167
0x11,/* bCUSTOM_HIDUSTOM_HID: CUSTOM_HID Class Spec release number */
169168
0x01,
170169
0x00,/* bCountryCode: Hardware target country */
171-
0x01,/* bNumDescriptors: Number of CUSTOM_HID class descriptors to follow */
170+
0x01,/* bNumDescriptors: Number of CUSTOM_HID class descriptors
171+
to follow */
172172
0x22,/* bDescriptorType */
173173
LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),/* wItemLength: Total length of Report descriptor */
174174
HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),
@@ -193,128 +193,6 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_
193193
CUSTOM_HID_FS_BINTERVAL,/* bInterval: Polling Interval */
194194
/* 41 */
195195
};
196-
197-
/* USB CUSTOM_HID device HS Configuration Descriptor */
198-
__ALIGN_BEGINstaticuint8_tUSBD_CUSTOM_HID_CfgHSDesc[USB_CUSTOM_HID_CONFIG_DESC_SIZ]__ALIGN_END=
199-
{
200-
0x09,/* bLength: Configuration Descriptor size */
201-
USB_DESC_TYPE_CONFIGURATION,/* bDescriptorType: Configuration */
202-
LOBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ),/* wTotalLength: Bytes returned */
203-
HIBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ),
204-
0x01,/* bNumInterfaces: 1 interface */
205-
0x01,/* bConfigurationValue: Configuration value */
206-
0x00,/* iConfiguration: Index of string descriptor describing the configuration */
207-
#if (USBD_SELF_POWERED==1U)
208-
0xC0,/* bmAttributes: Bus Powered according to user configuration */
209-
#else
210-
0x80,/* bmAttributes: Bus Powered according to user configuration */
211-
#endif
212-
USBD_MAX_POWER,/* MaxPower (mA) */
213-
214-
/************** Descriptor of CUSTOM HID interface ****************/
215-
/* 09 */
216-
0x09,/* bLength: Interface Descriptor size */
217-
USB_DESC_TYPE_INTERFACE,/* bDescriptorType: Interface descriptor type */
218-
0x00,/* bInterfaceNumber: Number of Interface */
219-
0x00,/* bAlternateSetting: Alternate setting */
220-
0x02,/* bNumEndpoints */
221-
0x03,/* bInterfaceClass: CUSTOM_HID */
222-
0x00,/* bInterfaceSubClass : 1=BOOT, 0=no boot */
223-
0x00,/* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
224-
0,/* iInterface: Index of string descriptor */
225-
/******************** Descriptor of CUSTOM_HID *************************/
226-
/* 18 */
227-
0x09,/* bLength: CUSTOM_HID Descriptor size */
228-
CUSTOM_HID_DESCRIPTOR_TYPE,/* bDescriptorType: CUSTOM_HID */
229-
0x11,/* bCUSTOM_HIDUSTOM_HID: CUSTOM_HID Class Spec release number */
230-
0x01,
231-
0x00,/* bCountryCode: Hardware target country */
232-
0x01,/* bNumDescriptors: Number of CUSTOM_HID class descriptors to follow */
233-
0x22,/* bDescriptorType */
234-
LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),/* wItemLength: Total length of Report descriptor */
235-
HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),
236-
/******************** Descriptor of Custom HID endpoints ********************/
237-
/* 27 */
238-
0x07,/* bLength: Endpoint Descriptor size */
239-
USB_DESC_TYPE_ENDPOINT,/* bDescriptorType */
240-
241-
CUSTOM_HID_EPIN_ADDR,/* bEndpointAddress: Endpoint Address (IN) */
242-
0x03,/* bmAttributes: Interrupt endpoint */
243-
LOBYTE(CUSTOM_HID_EPIN_SIZE),/* wMaxPacketSize: 2 Bytes max */
244-
HIBYTE(CUSTOM_HID_EPIN_SIZE),
245-
CUSTOM_HID_HS_BINTERVAL,/* bInterval: Polling Interval */
246-
/* 34 */
247-
248-
0x07,/* bLength: Endpoint Descriptor size */
249-
USB_DESC_TYPE_ENDPOINT,/* bDescriptorType: */
250-
CUSTOM_HID_EPOUT_ADDR,/* bEndpointAddress: Endpoint Address (OUT) */
251-
0x03,/* bmAttributes: Interrupt endpoint */
252-
LOBYTE(CUSTOM_HID_EPOUT_SIZE),/* wMaxPacketSize: 2 Bytes max */
253-
HIBYTE(CUSTOM_HID_EPOUT_SIZE),
254-
CUSTOM_HID_HS_BINTERVAL,/* bInterval: Polling Interval */
255-
/* 41 */
256-
};
257-
258-
/* USB CUSTOM_HID device Other Speed Configuration Descriptor */
259-
__ALIGN_BEGINstaticuint8_tUSBD_CUSTOM_HID_OtherSpeedCfgDesc[USB_CUSTOM_HID_CONFIG_DESC_SIZ]__ALIGN_END=
260-
{
261-
0x09,/* bLength: Configuration Descriptor size */
262-
USB_DESC_TYPE_CONFIGURATION,/* bDescriptorType: Configuration */
263-
LOBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ),/* wTotalLength: Bytes returned */
264-
HIBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ),
265-
0x01,/* bNumInterfaces: 1 interface */
266-
0x01,/* bConfigurationValue: Configuration value */
267-
0x00,/* iConfiguration: Index of string descriptor describing the configuration */
268-
#if (USBD_SELF_POWERED==1U)
269-
0xC0,/* bmAttributes: Bus Powered according to user configuration */
270-
#else
271-
0x80,/* bmAttributes: Bus Powered according to user configuration */
272-
#endif
273-
USBD_MAX_POWER,/* MaxPower (mA) */
274-
275-
/************** Descriptor of CUSTOM HID interface ****************/
276-
/* 09 */
277-
0x09,/* bLength: Interface Descriptor size */
278-
USB_DESC_TYPE_INTERFACE,/* bDescriptorType: Interface descriptor type */
279-
0x00,/* bInterfaceNumber: Number of Interface */
280-
0x00,/* bAlternateSetting: Alternate setting */
281-
0x02,/* bNumEndpoints */
282-
0x03,/* bInterfaceClass: CUSTOM_HID */
283-
0x00,/* bInterfaceSubClass : 1=BOOT, 0=no boot */
284-
0x00,/* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
285-
0,/* iInterface: Index of string descriptor */
286-
/******************** Descriptor of CUSTOM_HID *************************/
287-
/* 18 */
288-
0x09,/* bLength: CUSTOM_HID Descriptor size */
289-
CUSTOM_HID_DESCRIPTOR_TYPE,/* bDescriptorType: CUSTOM_HID */
290-
0x11,/* bCUSTOM_HIDUSTOM_HID: CUSTOM_HID Class Spec release number */
291-
0x01,
292-
0x00,/* bCountryCode: Hardware target country */
293-
0x01,/* bNumDescriptors: Number of CUSTOM_HID class descriptors to follow */
294-
0x22,/* bDescriptorType */
295-
LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),/* wItemLength: Total length of Report descriptor */
296-
HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),
297-
/******************** Descriptor of Custom HID endpoints ********************/
298-
/* 27 */
299-
0x07,/* bLength: Endpoint Descriptor size */
300-
USB_DESC_TYPE_ENDPOINT,/* bDescriptorType: */
301-
302-
CUSTOM_HID_EPIN_ADDR,/* bEndpointAddress: Endpoint Address (IN) */
303-
0x03,/* bmAttributes: Interrupt endpoint */
304-
LOBYTE(CUSTOM_HID_EPIN_SIZE),/* wMaxPacketSize: 2 Bytes max */
305-
HIBYTE(CUSTOM_HID_EPIN_SIZE),
306-
CUSTOM_HID_FS_BINTERVAL,/* bInterval: Polling Interval */
307-
/* 34 */
308-
309-
0x07,/* bLength: Endpoint Descriptor size */
310-
USB_DESC_TYPE_ENDPOINT,/* bDescriptorType: */
311-
CUSTOM_HID_EPOUT_ADDR,/* bEndpointAddress: Endpoint Address (OUT) */
312-
0x03,/* bmAttributes: Interrupt endpoint */
313-
LOBYTE(CUSTOM_HID_EPOUT_SIZE),/* wMaxPacketSize: 2 Bytes max */
314-
HIBYTE(CUSTOM_HID_EPOUT_SIZE),
315-
CUSTOM_HID_FS_BINTERVAL,/* bInterval: Polling Interval */
316-
/* 41 */
317-
};
318196
#endif/* USE_USBD_COMPOSITE */
319197

320198
/* USB CUSTOM_HID device Configuration Descriptor */
@@ -329,7 +207,7 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_Desc[USB_CUSTOM_HID_DESC_SIZ] __ALI
329207
0x01,/* bNumDescriptors: Number of CUSTOM_HID class descriptors
330208
to follow */
331209
0x22,/* bDescriptorType */
332-
LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),/* wItemLength: Total length of Report descriptor */
210+
LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),/* wItemLength: Total length of Report descriptor */
333211
HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE),
334212
};
335213

@@ -601,7 +479,15 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev,
601479
}
602480
}
603481

604-
(void)USBD_CtlSendData(pdev,pbuf,len);
482+
if (pbuf!=NULL)
483+
{
484+
(void)USBD_CtlSendData(pdev,pbuf,len);
485+
}
486+
else
487+
{
488+
USBD_CtlError(pdev,req);
489+
ret=USBD_FAIL;
490+
}
605491
break;
606492

607493
caseUSB_REQ_GET_INTERFACE:

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Inc/usbd_dfu.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ extern "C" {
6565

6666
#defineDFU_DESCRIPTOR_TYPE 0x21U
6767

68+
#defineDFU_VENDOR_CMD_MAX 32U
69+
6870

6971
/**************************************************/
7072
/* DFU Requests DFU states */
@@ -126,6 +128,11 @@ extern "C" {
126128
#defineDFU_MANIFEST_MASK (1U << 2)
127129
#defineDFU_STATUS_DEPTH 6U
128130

131+
#defineIS_DFU_DOWNLOAD 0x0DFDFU
132+
#defineIS_DFU_UPLOAD 0x1DFDFU
133+
#defineIS_DFU_SETADDRESSPOINTER 0x2DFDFU
134+
#defineIS_DFU_PHY_ADDRESS 0x3DFDFU
135+
129136
typedefenum
130137
{
131138
DFU_DETACH=0U,
@@ -176,6 +183,7 @@ typedef struct
176183
uint32_twblock_num;
177184
uint32_twlength;
178185
uint32_tdata_ptr;
186+
uint32_tapp_addr_ptr;
179187
uint32_talt_setting;
180188

181189
uint8_tdev_status[DFU_STATUS_DEPTH];
@@ -193,6 +201,17 @@ typedef struct
193201
uint16_t (*Write)(uint8_t*src,uint8_t*dest,uint32_tLen);
194202
uint8_t*(*Read)(uint8_t*src,uint8_t*dest,uint32_tLen);
195203
uint16_t (*GetStatus)(uint32_tAdd,uint8_tcmd,uint8_t*buff);
204+
#if (USBD_DFU_VENDOR_CMD_ENABLED==1U)
205+
uint16_t (*GetVendorCMD)(uint8_t*cmd,uint8_t*cmdlength);
206+
uint16_t (*VendorDownloadCMD)(uint8_t*pbuf,uint32_tBlockNumber,uint32_twlength,uint32_t*status);
207+
uint16_t (*VendorUploadCMD)(uint32_tAdd,uint32_tBlockNumber,uint32_t*status);
208+
#endif/* USBD_DFU_VENDOR_CMD_ENABLED */
209+
#if (USBD_DFU_VENDOR_CHECK_ENABLED==1U)
210+
uint16_t (*VendorCheck)(uint8_t*pbuf,uint32_tReqType,uint32_t*status);
211+
#endif/* USBD_DFU_VENDOR_CHECK_ENABLED */
212+
#if (USBD_DFU_VENDOR_EXIT_ENABLED==1U)
213+
uint16_t (*LeaveDFU)(uint32_tAdd);
214+
#endif/* USBD_DFU_VENDOR_EXIT_ENABLED */
196215
}USBD_DFU_MediaTypeDef;
197216

198217
typedefstruct

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp