23#ifdef USE_USBD_COMPOSITE
24#include "usbd_composite_builder.h"
49#ifndef USBD_MAX_STR_DESC_SIZ
50#define USBD_MAX_STR_DESC_SIZ 64U
116 switch (req->bRequest)
207 if ((req->wLength == 0U) && (ret ==
USBD_OK))
246 ep_addr =
LOBYTE(req->wIndex);
266 switch (req->bRequest)
272 if ((ep_addr != 0x00U) && (ep_addr != 0x80U))
286 if ((ep_addr != 0x00U) && (ep_addr != 0x80U) && (req->wLength == 0x00U))
306 if ((ep_addr != 0x00U) && (ep_addr != 0x80U))
320 if ((ep_addr & 0x7FU) != 0x00U)
350 if ((ep_addr != 0x00U) && (ep_addr != 0x80U))
355 pep = ((ep_addr & 0x80U) == 0x80U) ? &pdev->
ep_in[ep_addr & 0x7FU] : \
356 &pdev->
ep_out[ep_addr & 0x7FU];
364 if ((ep_addr & 0x80U) == 0x80U)
381 pep = ((ep_addr & 0x80U) == 0x80U) ? &pdev->
ep_in[ep_addr & 0x7FU] : \
382 &pdev->
ep_out[ep_addr & 0x7FU];
384 if ((ep_addr == 0x00U) || (ep_addr == 0x80U))
431 uint8_t *pbuf =
NULL;
434 switch (req->wValue >> 8)
436#if ((USBD_LPM_ENABLED == 1U) || (USBD_CLASS_BOS_ENABLED == 1U))
438 if (pdev->
pDesc->GetBOSDescriptor !=
NULL)
456#ifdef USE_USBD_COMPOSITE
459 pbuf = (uint8_t *)USBD_CMPSIT.GetHSConfigDescriptor(&len);
470#ifdef USE_USBD_COMPOSITE
473 pbuf = (uint8_t *)USBD_CMPSIT.GetFSConfigDescriptor(&len);
485 switch ((uint8_t)(req->wValue))
560#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
563 for (uint32_t idx = 0U; (idx < pdev->
NumClasses); idx++)
565 if (pdev->
pClass[idx]->GetUsrStrDescriptor !=
NULL)
568 pbuf = pdev->
pClass[idx]->GetUsrStrDescriptor(pdev,
LOBYTE(req->wValue), &len);
582#if (USBD_CLASS_USER_STRING_DESC == 1U)
583 if (pdev->
pDesc->GetUserStrDescriptor !=
NULL)
594#if ((USBD_CLASS_USER_STRING_DESC == 0U) && (USBD_SUPPORT_USER_STRING_DESC == 0U))
605#ifdef USE_USBD_COMPOSITE
608 pbuf = (uint8_t *)USBD_CMPSIT.GetDeviceQualifierDescriptor(&len);
626#ifdef USE_USBD_COMPOSITE
629 pbuf = (uint8_t *)USBD_CMPSIT.GetOtherSpeedConfigDescriptor(&len);
656 if (req->wLength != 0U)
660 len =
MIN(len, req->wLength);
686 if ((req->wIndex == 0U) && (req->wLength == 0U) && (req->wValue < 128U))
688 dev_addr = (uint8_t)(req->wValue) & 0x7FU;
726 static uint8_t cfgidx;
728 cfgidx = (uint8_t)(req->wValue);
755#if (USBD_USER_REGISTER_CALLBACK == 1U)
756 if (pdev->DevStateCallback !=
NULL)
823 if (req->wLength != 1U)
862 if (req->wLength != 0x2U)
868#if (USBD_SELF_POWERED == 1U)
952 uint8_t *pbuff = pdata;
954 req->bmRequest = *(uint8_t *)(pbuff);
957 req->bRequest = *(uint8_t *)(pbuff);
1009 unicode[idx] = *(uint8_t *)len;
1014 while (*pdesc != (uint8_t)
'\0')
1016 unicode[idx] = *pdesc;
1035 uint8_t *pbuff = buf;
1037 while (*pbuff != (uint8_t)
'\0')
USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_ClrClassConfig Clear current configuration.
USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_SetClassConfig Configure device and start the interface.
uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Returns Stall condition.
uint8_t USBD_CoreFindEP(USBD_HandleTypeDef *pdev, uint8_t index)
USBD_CoreFindEP return the class index relative to the selected endpoint.
uint8_t USBD_CoreFindIF(USBD_HandleTypeDef *pdev, uint8_t index)
USBD_CoreFindIF return the class index relative to the selected interface.
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Sets a Stall condition on an endpoint of the Low Level Driver.
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr)
Assigns a USB address to the device.
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Clears a Stall condition on an endpoint of the Low Level Driver.
__STATIC_INLINE uint16_t SWAPBYTE(uint8_t *addr)
struct _USBD_HandleTypeDef USBD_HandleTypeDef
struct usb_setup_req USBD_SetupReqTypedef
USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
USBD_CtlSendStatus send zero lzngth packet on the ctl pipe.
USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint32_t len)
USBD_CtlSendData send data on the ctl pipe.
#define USBD_MAX_STR_DESC_SIZ
static void USBD_SetAddress(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_SetAddress Set device address.
static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_GetConfig Handle Get device configuration request.
static uint8_t USBD_GetLen(uint8_t *buf)
USBD_GetLen return the string length.
static USBD_StatusTypeDef USBD_SetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_SetConfig Handle Set device configuration request.
static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_GetDescriptor Handle Get Descriptor requests.
static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_SetFeature Handle Set device feature request.
static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_GetStatus Handle Get Status request.
static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_ClrFeature Handle clear device feature request.
USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_StdEPReq Handle standard usb endpoint requests.
void USBD_CtlError(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_CtlError Handle USB low level Error.
void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
USBD_ParseSetupRequest Copy buffer into setup structure.
void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
USBD_GetString Convert Ascii string into unicode one.
USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_StdItfReq Handle standard usb interface requests.
USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_StdDevReq Handle standard usb device requests.
#define USBD_IDX_INTERFACE_STR
#define USBD_MAX_NUM_INTERFACES
#define USB_DESC_TYPE_DEVICE
#define USB_FEATURE_REMOTE_WAKEUP
#define USB_REQ_SET_FEATURE
#define USB_DESC_TYPE_CONFIGURATION
#define USB_REQ_TYPE_STANDARD
#define USBD_IDX_CONFIG_STR
#define USBD_STATE_DEFAULT
#define USB_REQ_CLEAR_FEATURE
#define USBD_STATE_CONFIGURED
#define USB_REQ_TYPE_VENDOR
#define USBD_IDX_LANGID_STR
#define USB_REQ_SET_CONFIGURATION
#define USB_CONFIG_REMOTE_WAKEUP
#define USBD_IDX_PRODUCT_STR
#define USBD_IDX_SERIAL_STR
#define USB_REQ_TYPE_MASK
#define USB_CONFIG_SELF_POWERED
#define USB_FEATURE_TEST_MODE
#define USB_FEATURE_EP_HALT
#define USB_DESC_TYPE_BOS
#define USB_REQ_GET_STATUS
#define USB_REQ_SET_ADDRESS
#define USB_DESC_TYPE_STRING
#define USBD_MAX_SUPPORTED_CLASS
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION
#define USB_REQ_GET_DESCRIPTOR
#define USB_REQ_GET_CONFIGURATION
#define USBD_STATE_ADDRESSED
#define USBD_MAX_NUM_CONFIGURATION
#define USB_DESC_TYPE_DEVICE_QUALIFIER
#define USB_REQ_TYPE_CLASS
uint8_t *(* GetInterfaceStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length)
uint8_t *(* GetSerialStrDescriptor)(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 *(* GetConfigurationStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length)
uint8_t *(* GetDeviceDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length)
uint8_t *(* GetFSConfigDescriptor)(uint16_t *length)
uint8_t *(* GetHSConfigDescriptor)(uint16_t *length)
uint8_t *(* GetDeviceQualifierDescriptor)(uint16_t *length)
uint8_t(* Setup)(struct _USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
uint8_t *(* GetOtherSpeedConfigDescriptor)(uint16_t *length)
uint32_t dev_default_config
uint32_t dev_config_status
USBD_EndpointTypeDef ep_in[16]
USBD_EndpointTypeDef ep_out[16]
uint32_t dev_remote_wakeup
USBD_DescriptorsTypeDef * pDesc
USBD_SpeedTypeDef dev_speed
USBD_ClassTypeDef * pClass[USBD_MAX_SUPPORTED_CLASS]
Header file for the usbd_ioreq.c file.