mirror of
https://github.com/STMicroelectronics/stm32-mw-usb-device.git
synced 2026-02-08 20:18:07 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b06460a43 | ||
|
|
7b5e6886d2 | ||
|
|
bd79085c18 | ||
|
|
dccc30a45a | ||
|
|
2022e75b01 |
@@ -742,8 +742,19 @@ static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnu
|
||||
*/
|
||||
static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
{
|
||||
UNUSED(pdev);
|
||||
UNUSED(epnum);
|
||||
USBD_AUDIO_HandleTypeDef *haudio;
|
||||
|
||||
if (pdev->pClassDataCmsit[pdev->classId] == NULL)
|
||||
{
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
|
||||
haudio = (USBD_AUDIO_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
|
||||
/* Prepare Out endpoint to receive next audio packet */
|
||||
(void)USBD_LL_PrepareReceive(pdev, epnum,
|
||||
&haudio->buffer[haudio->wr_ptr],
|
||||
AUDIO_OUT_PACKET);
|
||||
|
||||
return (uint8_t)USBD_OK;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ static void SC_SendData(SC_ADPU_CommandsTypeDef *SCADPU, SC_ADPU_ResponseTypeDef
|
||||
*/
|
||||
void SC_Handler(SC_State *SCState, SC_ADPU_CommandsTypeDef *SC_ADPU, SC_ADPU_ResponseTypeDef *SC_Response)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint32_t i;
|
||||
uint32_t j;
|
||||
|
||||
switch (*SCState)
|
||||
{
|
||||
@@ -316,8 +317,11 @@ static void SC_AnswerReq(SC_State *SC_state, uint8_t *atr_buffer, uint8_t length
|
||||
*/
|
||||
static uint8_t SC_decode_Answer2reset(uint8_t *card)
|
||||
{
|
||||
uint32_t i, flag = 0U, protocol;
|
||||
uint8_t index = 0U, level = 0U;
|
||||
uint32_t i = 0U;
|
||||
uint32_t flag = 0U;
|
||||
uint32_t protocol;
|
||||
uint8_t index = 0U;
|
||||
uint8_t level = 0U;
|
||||
|
||||
/******************************TS/T0 Decode************************************/
|
||||
index++;
|
||||
|
||||
@@ -109,7 +109,6 @@ static uint8_t USBD_CDC_EP0_RxReady(USBD_HandleTypeDef *pdev);
|
||||
static uint8_t *USBD_CDC_GetFSCfgDesc(uint16_t *length);
|
||||
static uint8_t *USBD_CDC_GetHSCfgDesc(uint16_t *length);
|
||||
static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc(uint16_t *length);
|
||||
static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc(uint16_t *length);
|
||||
uint8_t *USBD_CDC_GetDeviceQualifierDescriptor(uint16_t *length);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
|
||||
@@ -364,7 +364,8 @@ static uint8_t USBD_CDC_ECM_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
hcdc->TxLength = 0U;
|
||||
hcdc->LinkStatus = 0U;
|
||||
hcdc->NotificationStatus = 0U;
|
||||
hcdc->MaxPcktLen = (pdev->dev_speed == USBD_SPEED_HIGH) ? CDC_ECM_DATA_HS_MAX_PACKET_SIZE : CDC_ECM_DATA_FS_MAX_PACKET_SIZE;
|
||||
hcdc->MaxPcktLen = (pdev->dev_speed == USBD_SPEED_HIGH) ? CDC_ECM_DATA_HS_MAX_PACKET_SIZE : \
|
||||
CDC_ECM_DATA_FS_MAX_PACKET_SIZE;
|
||||
|
||||
if (hcdc->RxBuffer == NULL)
|
||||
{
|
||||
@@ -427,8 +428,7 @@ static uint8_t USBD_CDC_ECM_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
* @param req: usb requests
|
||||
* @retval status
|
||||
*/
|
||||
static uint8_t USBD_CDC_ECM_Setup(USBD_HandleTypeDef *pdev,
|
||||
USBD_SetupReqTypedef *req)
|
||||
static uint8_t USBD_CDC_ECM_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *) pdev->pClassDataCmsit[pdev->classId];
|
||||
USBD_CDC_ECM_ItfTypeDef *EcmInterface = (USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId];
|
||||
@@ -449,8 +449,7 @@ static uint8_t USBD_CDC_ECM_Setup(USBD_HandleTypeDef *pdev,
|
||||
{
|
||||
if ((req->bmRequest & 0x80U) != 0U)
|
||||
{
|
||||
EcmInterface->Control(req->bRequest,
|
||||
(uint8_t *)hcdc->data, req->wLength);
|
||||
EcmInterface->Control(req->bRequest, (uint8_t *)hcdc->data, req->wLength);
|
||||
|
||||
len = MIN(CDC_ECM_DATA_BUFFER_SIZE, req->wLength);
|
||||
(void)USBD_CtlSendData(pdev, (uint8_t *)hcdc->data, len);
|
||||
@@ -561,7 +560,8 @@ static uint8_t USBD_CDC_ECM_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
hcdc->TxState = 0U;
|
||||
if (((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt != NULL)
|
||||
{
|
||||
((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
|
||||
((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt(hcdc->TxBuffer,
|
||||
&hcdc->TxLength, epnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -569,8 +569,7 @@ static uint8_t USBD_CDC_ECM_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
{
|
||||
if (hcdc->NotificationStatus != 0U)
|
||||
{
|
||||
(void)USBD_CDC_ECM_SendNotification(pdev, CONNECTION_SPEED_CHANGE,
|
||||
0U, (uint8_t *)ConnSpeedTab);
|
||||
(void)USBD_CDC_ECM_SendNotification(pdev, CONNECTION_SPEED_CHANGE, 0U, (uint8_t *)ConnSpeedTab);
|
||||
|
||||
hcdc->NotificationStatus = 0U;
|
||||
}
|
||||
@@ -807,7 +806,10 @@ static uint8_t *USBD_CDC_ECM_USRStringDescriptor(USBD_HandleTypeDef *pdev, uint8
|
||||
/* Check if the requested string interface is supported */
|
||||
if (index == CDC_ECM_MAC_STRING_INDEX)
|
||||
{
|
||||
USBD_GetString((uint8_t *)((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId])->pStrDesc, USBD_StrDesc, length);
|
||||
USBD_GetString((uint8_t *)((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData[pdev->classId])->pStrDesc,
|
||||
USBD_StrDesc,
|
||||
length);
|
||||
|
||||
return USBD_StrDesc;
|
||||
}
|
||||
/* Not supported Interface Descriptor index */
|
||||
@@ -834,7 +836,7 @@ uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint3
|
||||
uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
|
||||
{
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
#endif
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
if (hcdc == NULL)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ static int8_t CDC_ECM_Itf_Init(void)
|
||||
(void)USBD_CDC_ECM_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U, 0U);
|
||||
#else
|
||||
(void)USBD_CDC_ECM_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U);
|
||||
#endif
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
(void)USBD_CDC_ECM_SetRxBuffer(&USBD_Device, UserRxBuffer);
|
||||
|
||||
return (0);
|
||||
@@ -104,7 +104,8 @@ static int8_t CDC_ECM_Itf_Init(void)
|
||||
static int8_t CDC_ECM_Itf_DeInit(void)
|
||||
{
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
@@ -126,7 +127,8 @@ static int8_t CDC_ECM_Itf_DeInit(void)
|
||||
static int8_t CDC_ECM_Itf_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
|
||||
{
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
@@ -201,7 +203,8 @@ static int8_t CDC_ECM_Itf_Receive(uint8_t *Buf, uint32_t *Len)
|
||||
{
|
||||
/* Get the CDC_ECM handler pointer */
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_ECM_HandleTypeDef *hcdc_cdc_ecm = (USBD_CDC_ECM_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
@@ -427,7 +427,8 @@ static uint8_t USBD_CDC_RNDIS_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
hcdc->TxLength = 0U;
|
||||
hcdc->LinkStatus = 0U;
|
||||
hcdc->NotificationStatus = 0U;
|
||||
hcdc->MaxPcktLen = (pdev->dev_speed == USBD_SPEED_HIGH) ? CDC_RNDIS_DATA_HS_MAX_PACKET_SIZE : CDC_RNDIS_DATA_FS_MAX_PACKET_SIZE;
|
||||
hcdc->MaxPcktLen = (pdev->dev_speed == USBD_SPEED_HIGH) ? CDC_RNDIS_DATA_HS_MAX_PACKET_SIZE : \
|
||||
CDC_RNDIS_DATA_FS_MAX_PACKET_SIZE;
|
||||
|
||||
if (hcdc->RxBuffer == NULL)
|
||||
{
|
||||
@@ -664,7 +665,8 @@ static uint8_t USBD_CDC_RNDIS_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
|
||||
if (((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt != NULL)
|
||||
{
|
||||
((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
|
||||
((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData[pdev->classId])->TransmitCplt(hcdc->TxBuffer, \
|
||||
&hcdc->TxLength, epnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1614,7 +1616,8 @@ static uint8_t USBD_CDC_RNDIS_ProcessResetMsg(USBD_HandleTypeDef *pdev,
|
||||
static uint8_t USBD_CDC_RNDIS_ProcessPacketMsg(USBD_HandleTypeDef *pdev,
|
||||
USBD_CDC_RNDIS_PacketMsgTypeDef *Msg)
|
||||
{
|
||||
uint32_t tmp1, tmp2;
|
||||
uint32_t tmp1;
|
||||
uint32_t tmp2;
|
||||
|
||||
/* Get the CDC_RNDIS handle pointer */
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
|
||||
@@ -114,7 +114,8 @@ static int8_t CDC_RNDIS_Itf_Init(void)
|
||||
static int8_t CDC_RNDIS_Itf_DeInit(void)
|
||||
{
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
@@ -140,7 +141,8 @@ static int8_t CDC_RNDIS_Itf_DeInit(void)
|
||||
static int8_t CDC_RNDIS_Itf_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
|
||||
{
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
@@ -187,7 +189,8 @@ static int8_t CDC_RNDIS_Itf_Receive(uint8_t *Buf, uint32_t *Len)
|
||||
{
|
||||
/* Get the CDC_RNDIS handler pointer */
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *) \
|
||||
(USBD_Device.pClassDataCmsit[USBD_Device.classId]);
|
||||
#else
|
||||
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassData);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
@@ -1585,8 +1585,7 @@ static void USBD_CMPSIT_VIDEODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I
|
||||
|
||||
/* USB Standard VS Interface Descriptor - data transfer mode */
|
||||
/* Interface 1, Alternate Setting 1*/
|
||||
__USBD_CMPSIT_SET_IF(1U, 1U, 1U, UVC_CC_VIDEO, \
|
||||
SC_VIDEOSTREAMING, PC_PROTOCOL_UNDEFINED, 0U);
|
||||
__USBD_CMPSIT_SET_IF(1U, 1U, 1U, UVC_CC_VIDEO, SC_VIDEOSTREAMING, PC_PROTOCOL_UNDEFINED, 0U);
|
||||
|
||||
/* Standard VS (Video Streaming) data Endpoint */
|
||||
pSVCDEP = ((USBD_StandardVCDataEPDescTypeDef *)(pConf + *Sze));
|
||||
@@ -1735,8 +1734,8 @@ static void USBD_CMPSIT_MTPDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO
|
||||
|
||||
/* Append MTP Interface descriptor */
|
||||
__USBD_CMPSIT_SET_IF((pdev->tclasslist[pdev->classId].Ifs[0]), (0U), \
|
||||
(uint8_t)(pdev->tclasslist[pdev->classId].NumEps), USB_MTP_INTRERFACE_CLASS, USB_MTP_INTRERFACE_SUB_CLASS,
|
||||
USB_MTP_INTRERFACE_PROTOCOL, (0U));
|
||||
(uint8_t)(pdev->tclasslist[pdev->classId].NumEps), USB_MTP_INTRERFACE_CLASS, \
|
||||
USB_MTP_INTRERFACE_SUB_CLASS, USB_MTP_INTRERFACE_PROTOCOL, (0U));
|
||||
|
||||
if (speed == (uint8_t)USBD_SPEED_HIGH)
|
||||
{
|
||||
@@ -1778,7 +1777,8 @@ uint32_t USBD_CMPSIT_SetClassID(USBD_HandleTypeDef *pdev, USBD_CompositeClassTy
|
||||
for (idx = 0U; idx < pdev->NumClasses; idx++)
|
||||
{
|
||||
/* Check if the class correspond to the requested type and if it is active */
|
||||
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) && ((pdev->tclasslist[idx].Active) == 1U))
|
||||
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) &&
|
||||
((pdev->tclasslist[idx].Active) == 1U))
|
||||
{
|
||||
if (inst == Instance)
|
||||
{
|
||||
@@ -1817,7 +1817,8 @@ uint32_t USBD_CMPSIT_GetClassID(USBD_HandleTypeDef *pdev, USBD_CompositeClassTy
|
||||
for (idx = 0U; idx < pdev->NumClasses; idx++)
|
||||
{
|
||||
/* Check if the class correspond to the requested type and if it is active */
|
||||
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) && ((pdev->tclasslist[idx].Active) == 1U))
|
||||
if (((USBD_CompositeClassTypeDef)(pdev->tclasslist[idx].ClassType) == Class) &&
|
||||
((pdev->tclasslist[idx].Active) == 1U))
|
||||
{
|
||||
if (inst == Instance)
|
||||
{
|
||||
|
||||
@@ -426,7 +426,8 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev,
|
||||
{
|
||||
/* Let the application decide what to do, keep EP0 data phase in NAK state and
|
||||
use USBD_CtlSendData() when data become available or stall the EP0 data phase */
|
||||
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete(req->bRequest, req->wLength);
|
||||
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete(req->bRequest,
|
||||
req->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -478,7 +479,15 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev,
|
||||
}
|
||||
}
|
||||
|
||||
(void)USBD_CtlSendData(pdev, pbuf, len);
|
||||
if (pbuf != NULL)
|
||||
{
|
||||
(void)USBD_CtlSendData(pdev, pbuf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
USBD_CtlError(pdev, req);
|
||||
ret = USBD_FAIL;
|
||||
}
|
||||
break;
|
||||
|
||||
case USB_REQ_GET_INTERFACE:
|
||||
|
||||
@@ -65,6 +65,8 @@ extern "C" {
|
||||
|
||||
#define DFU_DESCRIPTOR_TYPE 0x21U
|
||||
|
||||
#define DFU_VENDOR_CMD_MAX 32U
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* DFU Requests DFU states */
|
||||
@@ -126,6 +128,11 @@ extern "C" {
|
||||
#define DFU_MANIFEST_MASK (1U << 2)
|
||||
#define DFU_STATUS_DEPTH 6U
|
||||
|
||||
#define IS_DFU_DOWNLOAD 0x0DFDFU
|
||||
#define IS_DFU_UPLOAD 0x1DFDFU
|
||||
#define IS_DFU_SETADDRESSPOINTER 0x2DFDFU
|
||||
#define IS_DFU_PHY_ADDRESS 0x3DFDFU
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DFU_DETACH = 0U,
|
||||
@@ -176,6 +183,7 @@ typedef struct
|
||||
uint32_t wblock_num;
|
||||
uint32_t wlength;
|
||||
uint32_t data_ptr;
|
||||
uint32_t app_addr_ptr;
|
||||
uint32_t alt_setting;
|
||||
|
||||
uint8_t dev_status[DFU_STATUS_DEPTH];
|
||||
@@ -193,6 +201,17 @@ typedef struct
|
||||
uint16_t (* Write)(uint8_t *src, uint8_t *dest, uint32_t Len);
|
||||
uint8_t *(* Read)(uint8_t *src, uint8_t *dest, uint32_t Len);
|
||||
uint16_t (* GetStatus)(uint32_t Add, uint8_t cmd, uint8_t *buff);
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
uint16_t (* GetVendorCMD)(uint8_t *cmd, uint8_t *cmdlength);
|
||||
uint16_t (* VendorDownloadCMD)(uint8_t *pbuf, uint32_t BlockNumber, uint32_t wlength, uint32_t *status);
|
||||
uint16_t (* VendorUploadCMD)(uint32_t Add, uint32_t BlockNumber, uint32_t *status);
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
uint16_t (* VendorCheck)(uint8_t *pbuf, uint32_t ReqType, uint32_t *status);
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_EXIT_ENABLED == 1U)
|
||||
uint16_t (* LeaveDFU)(uint32_t Add);
|
||||
#endif /* USBD_DFU_VENDOR_EXIT_ENABLED */
|
||||
} USBD_DFU_MediaTypeDef;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -512,6 +512,7 @@ static uint8_t USBD_DFU_EP0_RxReady(USBD_HandleTypeDef *pdev)
|
||||
|
||||
return (uint8_t)USBD_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USBD_DFU_EP0_TxReady
|
||||
* handle EP0 TRx Ready event
|
||||
@@ -521,9 +522,13 @@ static uint8_t USBD_DFU_EP0_RxReady(USBD_HandleTypeDef *pdev)
|
||||
static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
USBD_SetupReqTypedef req;
|
||||
uint32_t app_addr_ptr;
|
||||
uint32_t addr;
|
||||
USBD_DFU_HandleTypeDef *hdfu = (USBD_DFU_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U) || (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
uint32_t VendorStatus = 0U;
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
|
||||
if (hdfu == NULL)
|
||||
{
|
||||
@@ -541,11 +546,43 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
/* Nothing to do */
|
||||
}
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
else
|
||||
{
|
||||
/* Vendor specific DFU CMD */
|
||||
if (DfuInterface->VendorDownloadCMD(hdfu->buffer.d8, hdfu->wblock_num,
|
||||
hdfu->wlength, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
}
|
||||
else if (hdfu->wlength == 5U)
|
||||
{
|
||||
if (hdfu->buffer.d8[0] == DFU_CMD_SETADDRESSPOINTER)
|
||||
{
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_SETADDRESSPOINTER, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
hdfu->data_ptr = hdfu->buffer.d8[1];
|
||||
hdfu->data_ptr += (uint32_t)hdfu->buffer.d8[2] << 8;
|
||||
hdfu->data_ptr += (uint32_t)hdfu->buffer.d8[3] << 16;
|
||||
@@ -553,30 +590,114 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
|
||||
}
|
||||
else if (hdfu->buffer.d8[0] == DFU_CMD_ERASE)
|
||||
{
|
||||
hdfu->data_ptr = hdfu->buffer.d8[1];
|
||||
hdfu->data_ptr += (uint32_t)hdfu->buffer.d8[2] << 8;
|
||||
hdfu->data_ptr += (uint32_t)hdfu->buffer.d8[3] << 16;
|
||||
hdfu->data_ptr += (uint32_t)hdfu->buffer.d8[4] << 24;
|
||||
|
||||
if (DfuInterface->Erase(hdfu->data_ptr) != USBD_OK)
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_DOWNLOAD, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
app_addr_ptr = hdfu->buffer.d8[1];
|
||||
app_addr_ptr += (uint32_t)hdfu->buffer.d8[2] << 8;
|
||||
app_addr_ptr += (uint32_t)hdfu->buffer.d8[3] << 16;
|
||||
app_addr_ptr += (uint32_t)hdfu->buffer.d8[4] << 24;
|
||||
|
||||
if (DfuInterface->Erase(app_addr_ptr) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = DFU_ERROR_VENDOR;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
}
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
else
|
||||
{
|
||||
/* Vendor specific DFU CMD */
|
||||
if (DfuInterface->VendorDownloadCMD(hdfu->buffer.d8, hdfu->wblock_num,
|
||||
hdfu->wlength, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
else
|
||||
{
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
if (hdfu->wlength > 0U)
|
||||
{
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_DOWNLOAD, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
/* Vendor specific DFU CMD */
|
||||
if (DfuInterface->VendorDownloadCMD(hdfu->buffer.d8, hdfu->wblock_num,
|
||||
hdfu->wlength, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (uint8_t)USBD_FAIL;
|
||||
/* Reset the block number */
|
||||
hdfu->wblock_num = 0U;
|
||||
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
req.bmRequest = 0U;
|
||||
req.wLength = 1U;
|
||||
USBD_CtlError(pdev, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#else
|
||||
/* Reset the global length and block number */
|
||||
hdfu->wlength = 0U;
|
||||
hdfu->wblock_num = 0U;
|
||||
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
req.bmRequest = 0U;
|
||||
req.wLength = 1U;
|
||||
USBD_CtlError(pdev, &req);
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
}
|
||||
}
|
||||
/* Regular Download Command */
|
||||
@@ -584,12 +705,33 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
if (hdfu->wblock_num > 1U)
|
||||
{
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_DOWNLOAD, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
/* Decode the required address */
|
||||
addr = ((hdfu->wblock_num - 2U) * USBD_DFU_XFER_SIZE) + hdfu->data_ptr;
|
||||
|
||||
/* Perform the write operation */
|
||||
if (DfuInterface->Write(hdfu->buffer.d8, (uint8_t *)addr, hdfu->wlength) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = DFU_ERROR_VENDOR;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
return (uint8_t)USBD_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -670,7 +812,7 @@ static uint8_t *USBD_DFU_GetUsrStringDesc(USBD_HandleTypeDef *pdev, uint8_t inde
|
||||
else
|
||||
{
|
||||
/* Not supported Interface Descriptor index */
|
||||
length = 0U;
|
||||
*length = 0U;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -758,6 +900,11 @@ static void DFU_Download(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
USBD_DFU_HandleTypeDef *hdfu = (USBD_DFU_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
|
||||
uint32_t VendorStatus = 0U;
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
if (hdfu == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -789,15 +936,30 @@ static void DFU_Download(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
/* 0 Data DNLOAD request */
|
||||
else
|
||||
{
|
||||
/* End of DNLOAD operation*/
|
||||
/* End of DNLOAD operation */
|
||||
if ((hdfu->dev_state == DFU_STATE_DNLOAD_IDLE) || (hdfu->dev_state == DFU_STATE_IDLE))
|
||||
{
|
||||
hdfu->manif_state = DFU_MANIFEST_IN_PROGRESS;
|
||||
hdfu->dev_state = DFU_STATE_MANIFEST_SYNC;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_SETADDRESSPOINTER, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_STATE_ERROR;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
}
|
||||
else
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
{
|
||||
hdfu->manif_state = DFU_MANIFEST_IN_PROGRESS;
|
||||
hdfu->dev_state = DFU_STATE_MANIFEST_SYNC;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -820,6 +982,13 @@ static void DFU_Upload(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
|
||||
uint8_t *phaddr;
|
||||
uint32_t addr;
|
||||
uint32_t CmdLength;
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
uint32_t VendorStatus = 0U;
|
||||
uint8_t VendorCmdLength = 0U;
|
||||
uint8_t VendorCmdBuffer[DFU_VENDOR_CMD_MAX];
|
||||
uint8_t idx;
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
|
||||
if (hdfu == NULL)
|
||||
{
|
||||
@@ -851,8 +1020,24 @@ static void DFU_Upload(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
hdfu->buffer.d8[1] = DFU_CMD_SETADDRESSPOINTER;
|
||||
hdfu->buffer.d8[2] = DFU_CMD_ERASE;
|
||||
|
||||
CmdLength = 3U;
|
||||
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
if (DfuInterface->GetVendorCMD != NULL)
|
||||
{
|
||||
(void)DfuInterface->GetVendorCMD(VendorCmdBuffer, (uint8_t *)&VendorCmdLength);
|
||||
|
||||
for (idx = 0U; idx < MIN(VendorCmdLength, DFU_VENDOR_CMD_MAX); idx++)
|
||||
{
|
||||
hdfu->buffer.d8[idx + 3U] = VendorCmdBuffer[idx];
|
||||
}
|
||||
|
||||
CmdLength += MIN(VendorCmdLength, DFU_VENDOR_CMD_MAX);
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
|
||||
/* Send the status data over EP0 */
|
||||
(void)USBD_CtlSendData(pdev, (uint8_t *)(&(hdfu->buffer.d8[0])), 3U);
|
||||
(void)USBD_CtlSendData(pdev, (uint8_t *)(&(hdfu->buffer.d8[0])), CmdLength);
|
||||
}
|
||||
else if (hdfu->wblock_num > 1U)
|
||||
{
|
||||
@@ -863,13 +1048,48 @@ static void DFU_Upload(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
|
||||
addr = ((hdfu->wblock_num - 2U) * USBD_DFU_XFER_SIZE) + hdfu->data_ptr;
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
/* Vendor specific DFU CMD */
|
||||
if (DfuInterface->VendorUploadCMD(hdfu->data_ptr, hdfu->wblock_num, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
hdfu->dev_state = DFU_ERROR_STALLEDPKT;
|
||||
hdfu->dev_status[0] = (uint8_t)VendorStatus;
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
|
||||
/* Return the physical address where data are stored */
|
||||
phaddr = DfuInterface->Read((uint8_t *)addr, hdfu->buffer.d8, hdfu->wlength);
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
USBD_CtlError(pdev, req);
|
||||
}
|
||||
|
||||
/* Send the status data over EP0 */
|
||||
(void)USBD_CtlSendData(pdev, phaddr, hdfu->wlength);
|
||||
if (VendorStatus == IS_DFU_PHY_ADDRESS)
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
{
|
||||
addr = ((hdfu->wblock_num - 2U) * USBD_DFU_XFER_SIZE) + hdfu->data_ptr;
|
||||
|
||||
/* Return the physical address where data are stored */
|
||||
phaddr = DfuInterface->Read((uint8_t *)addr, hdfu->buffer.d8, hdfu->wlength);
|
||||
|
||||
if (phaddr == NULL)
|
||||
{
|
||||
hdfu->dev_state = DFU_ERROR_STALLEDPKT;
|
||||
|
||||
hdfu->dev_status[1] = 0U;
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
USBD_CtlError(pdev, req);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send the status data over EP0 */
|
||||
(void)USBD_CtlSendData(pdev, phaddr, hdfu->wlength);
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* unsupported hdfu->wblock_num */
|
||||
{
|
||||
@@ -880,7 +1100,7 @@ static void DFU_Upload(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
|
||||
/* Call the error management function (command will be NAKed */
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
USBD_CtlError(pdev, req);
|
||||
}
|
||||
}
|
||||
@@ -890,7 +1110,7 @@ static void DFU_Upload(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
hdfu->wlength = 0U;
|
||||
hdfu->wblock_num = 0U;
|
||||
|
||||
/* Call the error management function (command will be NAKed */
|
||||
/* Call the error management function (command will be NAKed) */
|
||||
USBD_CtlError(pdev, req);
|
||||
}
|
||||
}
|
||||
@@ -944,7 +1164,7 @@ static void DFU_GetStatus(USBD_HandleTypeDef *pdev)
|
||||
DfuInterface->GetStatus(hdfu->data_ptr, DFU_MEDIA_PROGRAM, hdfu->dev_status);
|
||||
}
|
||||
}
|
||||
else /* (hdfu->wlength==0)*/
|
||||
else /* (hdfu->wlength == 0U) */
|
||||
{
|
||||
hdfu->dev_state = DFU_STATE_DNLOAD_IDLE;
|
||||
|
||||
@@ -960,7 +1180,7 @@ static void DFU_GetStatus(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
hdfu->dev_state = DFU_STATE_MANIFEST;
|
||||
|
||||
hdfu->dev_status[1] = 1U; /*bwPollTimeout = 1ms*/
|
||||
hdfu->dev_status[1] = 1U; /* bwPollTimeout = 1ms */
|
||||
hdfu->dev_status[2] = 0U;
|
||||
hdfu->dev_status[3] = 0U;
|
||||
hdfu->dev_status[4] = hdfu->dev_state;
|
||||
@@ -1088,9 +1308,10 @@ static void DFU_Abort(USBD_HandleTypeDef *pdev)
|
||||
static void DFU_Leave(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
USBD_DFU_HandleTypeDef *hdfu = (USBD_DFU_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
|
||||
USBD_DFUFuncDescTypeDef *pDfuFunc = (USBD_DFUFuncDescTypeDef *)USBD_DFU_GetDfuFuncDesc(pdev->pConfDesc);
|
||||
|
||||
if ((hdfu == NULL) || (pDfuFunc == NULL))
|
||||
if ((hdfu == NULL) || (DfuInterface == NULL) || (pDfuFunc == NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1119,8 +1340,13 @@ static void DFU_Leave(USBD_HandleTypeDef *pdev)
|
||||
/* Disconnect the USB device */
|
||||
(void)USBD_Stop(pdev);
|
||||
|
||||
#if (USBD_DFU_VENDOR_EXIT_ENABLED == 1U)
|
||||
/* Jump should be ensured by user application */
|
||||
DfuInterface->LeaveDFU(hdfu->data_ptr);
|
||||
#else
|
||||
/* Generate system reset to allow jumping to the user code */
|
||||
NVIC_SystemReset();
|
||||
#endif /* USBD_DFU_VENDOR_EXIT_ENABLED */
|
||||
|
||||
/* The next instructions will not be reached (system reset) */
|
||||
}
|
||||
|
||||
@@ -38,6 +38,17 @@ uint16_t MEM_If_Write(uint8_t *src, uint8_t *dest, uint32_t Len);
|
||||
uint8_t *MEM_If_Read(uint8_t *src, uint8_t *dest, uint32_t Len);
|
||||
uint16_t MEM_If_DeInit(void);
|
||||
uint16_t MEM_If_GetStatus(uint32_t Add, uint8_t Cmd, uint8_t *buffer);
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
uint16_t MEM_If_GetVendorCMD(uint8_t *cmd, uint8_t *cmdlength);
|
||||
uint16_t MEM_If_VendorDownloadCMD(uint8_t *pbuf, uint32_t BlockNumber, uint32_t wlength, uint32_t *status);
|
||||
uint16_t MEM_If_VendorUploadCMD(uint32_t Add, uint32_t BlockNumber, uint32_t *status);
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
uint16_t MEM_If_VendorCheck(uint8_t *pbuf, uint32_t ReqType, uint32_t *status);
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_EXIT_ENABLED == 1U)
|
||||
uint16_t MEM_If_LeaveDFU(uint32_t Add);
|
||||
#endif /* USBD_DFU_VENDOR_EXIT_ENABLED */
|
||||
|
||||
USBD_DFU_MediaTypeDef USBD_DFU_MEDIA_Template_fops =
|
||||
{
|
||||
@@ -48,8 +59,19 @@ USBD_DFU_MediaTypeDef USBD_DFU_MEDIA_Template_fops =
|
||||
MEM_If_Write,
|
||||
MEM_If_Read,
|
||||
MEM_If_GetStatus,
|
||||
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
MEM_If_GetVendorCMD,
|
||||
MEM_If_VendorDownloadCMD,
|
||||
MEM_If_VendorUploadCMD,
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
MEM_If_VendorCheck,
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
#if (USBD_DFU_VENDOR_EXIT_ENABLED == 1U)
|
||||
MEM_If_LeaveDFU
|
||||
#endif /* USBD_DFU_VENDOR_EXIT_ENABLED */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief MEM_If_Init
|
||||
* Memory initialization routine.
|
||||
@@ -115,7 +137,7 @@ uint8_t *MEM_If_Read(uint8_t *src, uint8_t *dest, uint32_t Len)
|
||||
UNUSED(Len);
|
||||
|
||||
/* Return a valid address to avoid HardFault */
|
||||
return (uint8_t *)(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,3 +166,85 @@ uint16_t MEM_If_GetStatus(uint32_t Add, uint8_t Cmd, uint8_t *buffer)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
|
||||
/**
|
||||
* @brief Get supported vendor specific commands
|
||||
* @param pointer to supported vendor commands
|
||||
* @param pointer to length of supported vendor commands
|
||||
* @retval 0 if operation is successful
|
||||
*/
|
||||
uint16_t MEM_If_GetVendorCMD(uint8_t *cmd, uint8_t *cmdlength)
|
||||
{
|
||||
UNUSED(cmd);
|
||||
UNUSED(cmdlength);
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Vendor specific download commands
|
||||
* @param pbuf DFU data buffer
|
||||
* @param BlockNumber DFU memory block number
|
||||
* @param wLength DFU request length
|
||||
* @param pointer to DFU status
|
||||
* @retval 0 if operation is successful
|
||||
*/
|
||||
uint16_t MEM_If_VendorDownloadCMD(uint8_t *pbuf, uint32_t BlockNumber, uint32_t wlength, uint32_t *status)
|
||||
{
|
||||
UNUSED(pbuf);
|
||||
UNUSED(BlockNumber);
|
||||
UNUSED(wlength);
|
||||
UNUSED(status);
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Vendor specific upload commands
|
||||
* @param Add memory Address
|
||||
* @param BlockNumber DFU memory block number
|
||||
* @param pointer to DFU status
|
||||
* @retval 0 if operation is successful
|
||||
*/
|
||||
uint16_t MEM_If_VendorUploadCMD(uint32_t Add, uint32_t BlockNumber, uint32_t *status)
|
||||
{
|
||||
UNUSED(Add);
|
||||
UNUSED(BlockNumber);
|
||||
UNUSED(status);
|
||||
|
||||
return 0U;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
|
||||
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
/**
|
||||
* @brief Vendor memory check
|
||||
* @param pbuf DFU data buffer
|
||||
* @param ReqType IS_DFU_SETADDRESSPOINTER/DOWNLOAD/UPLOAD
|
||||
* @param pointer to DFU status
|
||||
* @retval 0 if operation is successful
|
||||
*/
|
||||
uint16_t MEM_If_VendorCheck(uint8_t *pbuf, uint32_t ReqType, uint32_t *status)
|
||||
{
|
||||
UNUSED(pbuf);
|
||||
UNUSED(ReqType);
|
||||
UNUSED(status);
|
||||
|
||||
return 0U;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */
|
||||
|
||||
#if (USBD_DFU_VENDOR_EXIT_ENABLED == 1U)
|
||||
/**
|
||||
* @brief Vendor Leave DFU
|
||||
* @param Application address
|
||||
* @retval 0 if operation is successful
|
||||
*/
|
||||
uint16_t MEM_If_LeaveDFU(uint32_t Add)
|
||||
{
|
||||
UNUSED(Add);
|
||||
|
||||
return 0U;
|
||||
}
|
||||
#endif /* USBD_DFU_VENDOR_EXIT_ENABLED */
|
||||
|
||||
@@ -39,8 +39,8 @@ extern "C" {
|
||||
/** @defgroup USB_INFO_Exported_Defines
|
||||
* @{
|
||||
*/
|
||||
#define MODE_SENSE6_LEN 0x17U
|
||||
#define MODE_SENSE10_LEN 0x1BU
|
||||
#define MODE_SENSE6_LEN 0x04U
|
||||
#define MODE_SENSE10_LEN 0x08U
|
||||
#define LENGTH_INQUIRY_PAGE00 0x06U
|
||||
#define LENGTH_INQUIRY_PAGE80 0x08U
|
||||
#define LENGTH_FORMAT_CAPACITIES 0x14U
|
||||
|
||||
@@ -91,62 +91,32 @@ uint8_t MSC_Page80_Inquiry_Data[LENGTH_INQUIRY_PAGE80] =
|
||||
/* USB Mass storage sense 6 Data */
|
||||
uint8_t MSC_Mode_Sense6_data[MODE_SENSE6_LEN] =
|
||||
{
|
||||
0x22,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x08,
|
||||
0x12,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
0x03, /* MODE DATA LENGTH. The number of bytes that follow. */
|
||||
0x00, /* MEDIUM TYPE. 00h for SBC devices. */
|
||||
0x00, /* DEVICE-SPECIFIC PARAMETER. For SBC devices:
|
||||
* bit 7: WP. Set to 1 if the media is write-protected.
|
||||
* bits 6..5: reserved
|
||||
* bit 4: DPOFUA. Set to 1 if the device supports the DPO and FUA bits
|
||||
* bits 3..0: reserved */
|
||||
0x00 /* BLOCK DESCRIPTOR LENGTH */
|
||||
};
|
||||
|
||||
|
||||
/* USB Mass storage sense 10 Data */
|
||||
/* USB Mass storage sense 10 Data */
|
||||
uint8_t MSC_Mode_Sense10_data[MODE_SENSE10_LEN] =
|
||||
{
|
||||
0x00,
|
||||
0x26,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x08,
|
||||
0x12,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
0x00, /* MODE DATA LENGTH MSB. */
|
||||
0x06, /* MODE DATA LENGTH LSB. The number of bytes that follow. */
|
||||
0x00, /* MEDIUM TYPE. 00h for SBC devices. */
|
||||
0x00, /* DEVICE-SPECIFIC PARAMETER. For SBC devices:
|
||||
* bit 7: WP. Set to 1 if the media is write-protected.
|
||||
* bits 6..5: reserved
|
||||
* bit 4: DPOFUA. Set to 1 if the device supports the DPO and FUA bits
|
||||
* bits 3..0: reserved */
|
||||
0x00, /* LONGLBA Set to zero */
|
||||
0x00, /* Reserved */
|
||||
0x00, /* BLOCK DESCRIPTOR LENGTH MSB. */
|
||||
0x00 /* BLOCK DESCRIPTOR LENGTH LSB. */
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -291,7 +291,8 @@ static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param
|
||||
else
|
||||
{
|
||||
|
||||
pPage = (uint8_t *) & ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN];
|
||||
pPage = (uint8_t *) & ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId]) \
|
||||
->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN];
|
||||
len = (uint16_t)pPage[4] + 5U;
|
||||
|
||||
if (params[4] <= len)
|
||||
@@ -324,7 +325,8 @@ static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetCapacity(lun, &hmsc->scsi_blk_nbr, &hmsc->scsi_blk_size);
|
||||
ret = ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetCapacity(lun, &hmsc->scsi_blk_nbr,
|
||||
&hmsc->scsi_blk_size);
|
||||
|
||||
if ((ret != 0) || (hmsc->scsi_medium_state == SCSI_MEDIUM_EJECTED))
|
||||
{
|
||||
@@ -359,7 +361,7 @@ static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
|
||||
static int8_t SCSI_ReadCapacity16(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
|
||||
{
|
||||
UNUSED(params);
|
||||
uint8_t idx;
|
||||
uint32_t idx;
|
||||
int8_t ret;
|
||||
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
|
||||
@@ -368,7 +370,8 @@ static int8_t SCSI_ReadCapacity16(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetCapacity(lun, &hmsc->scsi_blk_nbr, &hmsc->scsi_blk_size);
|
||||
ret = ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetCapacity(lun, &hmsc->scsi_blk_nbr,
|
||||
&hmsc->scsi_blk_size);
|
||||
|
||||
if ((ret != 0) || (hmsc->scsi_medium_state == SCSI_MEDIUM_EJECTED))
|
||||
{
|
||||
@@ -474,6 +477,12 @@ static int8_t SCSI_ModeSense6(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *pa
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check If media is write-protected */
|
||||
if (((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->IsWriteProtected(lun) != 0)
|
||||
{
|
||||
MSC_Mode_Sense6_data[2] |= 0x80U;
|
||||
}
|
||||
|
||||
if (params[4] <= len)
|
||||
{
|
||||
len = params[4];
|
||||
@@ -503,6 +512,12 @@ static int8_t SCSI_ModeSense10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *p
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check If media is write-protected */
|
||||
if (((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->IsWriteProtected(lun) != 0)
|
||||
{
|
||||
MSC_Mode_Sense10_data[3] |= 0x80U;
|
||||
}
|
||||
|
||||
if (params[8] <= len)
|
||||
{
|
||||
len = params[8];
|
||||
|
||||
@@ -377,7 +377,8 @@ typedef struct
|
||||
{
|
||||
uint32_t interface;
|
||||
uint32_t uvc_state;
|
||||
uint8_t buffer[UVC_TOTAL_BUF_SIZE];
|
||||
uint32_t uvc_size;
|
||||
uint8_t *uvc_buffer;
|
||||
VIDEO_OffsetTypeDef offset;
|
||||
USBD_VIDEO_ControlTypeDef control;
|
||||
} USBD_VIDEO_HandleTypeDef;
|
||||
|
||||
@@ -498,6 +498,11 @@ static uint8_t USBD_VIDEO_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *
|
||||
uint16_t len;
|
||||
uint8_t *pbuf;
|
||||
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
/* Get the Endpoints addresses allocated for this class instance */
|
||||
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
/* Class Requests -------------------------------*/
|
||||
@@ -640,7 +645,13 @@ static uint8_t USBD_VIDEO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
static uint16_t PcktSze = UVC_PACKET_SIZE;
|
||||
static uint8_t payload_header[2] = {0x02U, 0x00U};
|
||||
uint8_t i = 0U;
|
||||
uint32_t RemainData, DataOffset = 0U;
|
||||
uint32_t RemainData = 0U;
|
||||
uint32_t DataOffset = 0U;
|
||||
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
/* Get the Endpoints addresses allocated for this class instance */
|
||||
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
/* Check if the Streaming has already been started */
|
||||
if (hVIDEO->uvc_state == UVC_PLAY_STATUS_STREAMING)
|
||||
@@ -691,9 +702,12 @@ static uint8_t USBD_VIDEO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
packet[1] = payload_header[1];
|
||||
}
|
||||
|
||||
hVIDEO->uvc_buffer = (uint8_t *)&packet;
|
||||
hVIDEO->uvc_size = (uint32_t)PcktSze;
|
||||
|
||||
/* Transmit the packet on Endpoint */
|
||||
(void)USBD_LL_Transmit(pdev, (uint8_t)(epnum | 0x80U),
|
||||
(uint8_t *)&packet, (uint32_t)PcktSze);
|
||||
hVIDEO->uvc_buffer, hVIDEO->uvc_size);
|
||||
}
|
||||
|
||||
/* Exit with no error code */
|
||||
@@ -711,11 +725,19 @@ static uint8_t USBD_VIDEO_SOF(USBD_HandleTypeDef *pdev)
|
||||
USBD_VIDEO_HandleTypeDef *hVIDEO = (USBD_VIDEO_HandleTypeDef *) pdev->pClassDataCmsit[pdev->classId];
|
||||
uint8_t payload[2] = {0x02U, 0x00U};
|
||||
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
/* Get the Endpoints addresses allocated for this class instance */
|
||||
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
/* Check if the Streaming has already been started by SetInterface AltSetting 1 */
|
||||
if (hVIDEO->uvc_state == UVC_PLAY_STATUS_READY)
|
||||
{
|
||||
hVIDEO->uvc_buffer = (uint8_t *)&payload;
|
||||
hVIDEO->uvc_size = 2U;
|
||||
|
||||
/* Transmit the first packet indicating that Streaming is starting */
|
||||
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, (uint8_t *)payload, 2U);
|
||||
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, hVIDEO->uvc_buffer, hVIDEO->uvc_size);
|
||||
|
||||
/* Enable Streaming state */
|
||||
hVIDEO->uvc_state = UVC_PLAY_STATUS_STREAMING;
|
||||
@@ -734,8 +756,17 @@ static uint8_t USBD_VIDEO_SOF(USBD_HandleTypeDef *pdev)
|
||||
*/
|
||||
static uint8_t USBD_VIDEO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||
{
|
||||
UNUSED(pdev);
|
||||
UNUSED(epnum);
|
||||
USBD_VIDEO_HandleTypeDef *hVIDEO = (USBD_VIDEO_HandleTypeDef *) pdev->pClassDataCmsit[pdev->classId];
|
||||
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
/* Get the Endpoints addresses allocated for this class instance */
|
||||
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
if (epnum == (VIDEOinEpAdd & 0xFU))
|
||||
{
|
||||
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, hVIDEO->uvc_buffer, hVIDEO->uvc_size);
|
||||
}
|
||||
|
||||
return (uint8_t)USBD_OK;
|
||||
}
|
||||
|
||||
@@ -234,14 +234,16 @@ static int8_t VIDEO_Itf_Data(uint8_t **pbuf, uint16_t *psize, uint16_t *pcktidx)
|
||||
*psize = (uint16_t)UVC_PACKET_SIZE;
|
||||
|
||||
/* Get the pointer to the next packet to be transmitted */
|
||||
*pbuf = (uint8_t *)(*(ImagePtr + img_count) + (packet_index * ((uint16_t)(UVC_PACKET_SIZE - (UVC_HEADER_PACKET_CNT * 2U)))));
|
||||
*pbuf = (uint8_t *)(*(ImagePtr + img_count) + \
|
||||
(packet_index * ((uint16_t)(UVC_PACKET_SIZE - (UVC_HEADER_PACKET_CNT * 2U)))));
|
||||
}
|
||||
else if ((packet_index == packet_count))
|
||||
{
|
||||
if (packet_remainder != 0U)
|
||||
{
|
||||
/* Get the pointer to the next packet to be transmitted */
|
||||
*pbuf = (uint8_t *)(*(ImagePtr + img_count) + (packet_index * ((uint16_t)(UVC_PACKET_SIZE - (UVC_HEADER_PACKET_CNT * 2U)))));
|
||||
*pbuf = (uint8_t *)(*(ImagePtr + img_count) + \
|
||||
(packet_index * ((uint16_t)(UVC_PACKET_SIZE - (UVC_HEADER_PACKET_CNT * 2U)))));
|
||||
|
||||
/* Set the current packet size */
|
||||
*psize = (uint16_t)(packet_remainder + (UVC_HEADER_PACKET_CNT * 2U));
|
||||
|
||||
@@ -48,6 +48,7 @@ extern "C" {
|
||||
#define USBD_MAX_STR_DESC_SIZ 0x100U
|
||||
#define USBD_SELF_POWERED 1U
|
||||
#define USBD_DEBUG_LEVEL 2U
|
||||
/* #define USBD_USER_REGISTER_CALLBACK 1U */
|
||||
|
||||
/* ECM, RNDIS, DFU Class Config */
|
||||
#define USBD_SUPPORT_USER_STRING_DESC 1U
|
||||
@@ -64,6 +65,8 @@ extern "C" {
|
||||
#define USBD_CDC_INTERVAL 2000U
|
||||
|
||||
/* DFU Class Config */
|
||||
/* #define USBD_DFU_VENDOR_CMD_ENABLED 1U */
|
||||
/* #define USBD_DFU_VENDOR_EXIT_ENABLED 1U */
|
||||
#define USBD_DFU_MAX_ITF_NUM 1U
|
||||
#define USBD_DFU_XFERS_IZE 1024U
|
||||
|
||||
|
||||
@@ -86,6 +86,9 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev);
|
||||
USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev);
|
||||
USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev);
|
||||
USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass);
|
||||
#if (USBD_USER_REGISTER_CALLBACK == 1U)
|
||||
USBD_StatusTypeDef USBD_RegisterDevStateCallback(USBD_HandleTypeDef *pdev, USBD_DevStateCallbackTypeDef pUserCallback);
|
||||
#endif /* USBD_USER_REGISTER_CALLBACK */
|
||||
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass,
|
||||
|
||||
@@ -390,8 +390,15 @@ typedef struct _USBD_HandleTypeDef
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
USBD_CompositeElementTypeDef tclasslist[USBD_MAX_SUPPORTED_CLASS];
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_USER_REGISTER_CALLBACK == 1U)
|
||||
void (* DevStateCallback)(uint8_t dev_state, uint8_t cfgidx); /*!< User Notification callback */
|
||||
#endif /* USBD_USER_REGISTER_CALLBACK */
|
||||
} USBD_HandleTypeDef;
|
||||
|
||||
#if (USBD_USER_REGISTER_CALLBACK == 1U)
|
||||
typedef void (*USBD_DevStateCallbackTypeDef)(uint8_t dev_state, uint8_t cfgidx); /*!< pointer to User callback function */
|
||||
#endif /* USBD_USER_REGISTER_CALLBACK */
|
||||
|
||||
/* USB Device endpoint direction */
|
||||
typedef enum
|
||||
{
|
||||
@@ -416,7 +423,9 @@ typedef enum
|
||||
*/
|
||||
__STATIC_INLINE uint16_t SWAPBYTE(uint8_t *addr)
|
||||
{
|
||||
uint16_t _SwapVal, _Byte1, _Byte2;
|
||||
uint16_t _SwapVal;
|
||||
uint16_t _Byte1;
|
||||
uint16_t _Byte2;
|
||||
uint8_t *_pbuff = addr;
|
||||
|
||||
_Byte1 = *(uint8_t *)_pbuff;
|
||||
|
||||
@@ -256,6 +256,7 @@ USBD_StatusTypeDef USBD_LL_SetTestMode(USBD_HandleTypeDef *pdev, uint8_t testmod
|
||||
*/
|
||||
void *USBD_static_malloc(uint32_t size)
|
||||
{
|
||||
UNUSED(size);
|
||||
static uint32_t mem[(sizeof(USBD_HID_HandleTypeDef) / 4) + 1]; /* On 32-bit boundary */
|
||||
return mem;
|
||||
}
|
||||
@@ -267,7 +268,7 @@ void *USBD_static_malloc(uint32_t size)
|
||||
*/
|
||||
void USBD_static_free(void *p)
|
||||
{
|
||||
|
||||
UNUSED(p);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,11 +83,11 @@
|
||||
|
||||
/**
|
||||
* @brief USBD_Init
|
||||
* Initializes the device stack and load the class driver
|
||||
* Initialize the device stack and load the class driver
|
||||
* @param pdev: device instance
|
||||
* @param pdesc: Descriptor structure address
|
||||
* @param id: Low level core index
|
||||
* @retval None
|
||||
* @retval status: USBD Status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,
|
||||
USBD_DescriptorsTypeDef *pdesc, uint8_t id)
|
||||
@@ -142,9 +142,9 @@ USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,
|
||||
|
||||
/**
|
||||
* @brief USBD_DeInit
|
||||
* Re-Initialize the device library
|
||||
* De-Initialize the device library
|
||||
* @param pdev: device instance
|
||||
* @retval status: status
|
||||
* @retval status: USBD Status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
|
||||
/**
|
||||
* @brief USBD_RegisterClass
|
||||
* Link class driver to Device Core.
|
||||
* @param pDevice : Device Handle
|
||||
* @param pdev: Device Handle
|
||||
* @param pclass: Class handle
|
||||
* @retval USBD Status
|
||||
*/
|
||||
@@ -228,7 +228,7 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDe
|
||||
#endif /* USE_USB_FS */
|
||||
|
||||
/* Increment the NumClasses */
|
||||
pdev->NumClasses ++;
|
||||
pdev->NumClasses++;
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
@@ -243,10 +243,10 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDe
|
||||
* @param EpAddr: Endpoint Address handle
|
||||
* @retval USBD Status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass,
|
||||
USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr)
|
||||
USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass,
|
||||
USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr)
|
||||
{
|
||||
USBD_StatusTypeDef ret = USBD_OK;
|
||||
USBD_StatusTypeDef ret = USBD_OK;
|
||||
uint16_t len = 0U;
|
||||
|
||||
if ((pdev->classId < USBD_MAX_SUPPORTED_CLASS) && (pdev->NumClasses < USBD_MAX_SUPPORTED_CLASS))
|
||||
@@ -291,7 +291,7 @@ USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_C
|
||||
/**
|
||||
* @brief USBD_UnRegisterClassComposite
|
||||
* UnLink all composite class drivers from Device Core.
|
||||
* @param pDevice : Device Handle
|
||||
* @param pdev: Device Handle
|
||||
* @retval USBD Status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev)
|
||||
@@ -358,10 +358,23 @@ USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
|
||||
#if (USBD_USER_REGISTER_CALLBACK == 1U)
|
||||
/**
|
||||
* @brief USBD_RegisterDevStateCallback
|
||||
* @param pdev : Device Handle
|
||||
* @param pUserCallback: User Callback
|
||||
* @retval USBD Status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_RegisterDevStateCallback(USBD_HandleTypeDef *pdev, USBD_DevStateCallbackTypeDef pUserCallback)
|
||||
{
|
||||
pdev->DevStateCallback = pUserCallback;
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
#endif /* USBD_USER_REGISTER_CALLBACK */
|
||||
|
||||
/**
|
||||
* @brief USBD_Start
|
||||
* Start the USB Device Core.
|
||||
@@ -487,7 +500,7 @@ USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
* Clear current configuration
|
||||
* @param pdev: device instance
|
||||
* @param cfgidx: configuration index
|
||||
* @retval status: USBD_StatusTypeDef
|
||||
* @retval status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
{
|
||||
@@ -527,6 +540,7 @@ USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
* @brief USBD_LL_SetupStage
|
||||
* Handle the setup stage
|
||||
* @param pdev: device instance
|
||||
* @param psetup: setup packet buffer pointer
|
||||
* @retval status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
|
||||
@@ -629,19 +643,6 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
|
||||
(void)USBD_CtlSendStatus(pdev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
if (pdev->ep0_state == USBD_EP0_STATUS_OUT)
|
||||
{
|
||||
/*
|
||||
* STATUS PHASE completed, update ep0_state to idle
|
||||
*/
|
||||
pdev->ep0_state = USBD_EP0_IDLE;
|
||||
(void)USBD_LL_StallEP(pdev, 0U);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -674,6 +675,7 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
|
||||
* Handle data in stage
|
||||
* @param pdev: device instance
|
||||
* @param epnum: endpoint index
|
||||
* @param pdata: data pointer
|
||||
* @retval status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
|
||||
@@ -726,16 +728,6 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
if ((pdev->ep0_state == USBD_EP0_STATUS_IN) ||
|
||||
(pdev->ep0_state == USBD_EP0_IDLE))
|
||||
{
|
||||
(void)USBD_LL_StallEP(pdev, 0x80U);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pdev->dev_test_mode != 0U)
|
||||
{
|
||||
@@ -776,7 +768,6 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
|
||||
* @param pdev: device instance
|
||||
* @retval status
|
||||
*/
|
||||
|
||||
USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
USBD_StatusTypeDef ret = USBD_OK;
|
||||
@@ -859,10 +850,13 @@ USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev,
|
||||
* @param pdev: device instance
|
||||
* @retval status
|
||||
*/
|
||||
|
||||
USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
pdev->dev_old_state = pdev->dev_state;
|
||||
if (pdev->dev_state != USBD_STATE_SUSPENDED)
|
||||
{
|
||||
pdev->dev_old_state = pdev->dev_state;
|
||||
}
|
||||
|
||||
pdev->dev_state = USBD_STATE_SUSPENDED;
|
||||
|
||||
return USBD_OK;
|
||||
@@ -874,7 +868,6 @@ USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
|
||||
* @param pdev: device instance
|
||||
* @retval status
|
||||
*/
|
||||
|
||||
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
if (pdev->dev_state == USBD_STATE_SUSPENDED)
|
||||
@@ -891,7 +884,6 @@ USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
|
||||
* @param pdev: device instance
|
||||
* @retval status
|
||||
*/
|
||||
|
||||
USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
/* The SOF event can be distributed for all classes that support it */
|
||||
@@ -932,6 +924,7 @@ USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
|
||||
* @brief USBD_LL_IsoINIncomplete
|
||||
* Handle iso in incomplete event
|
||||
* @param pdev: device instance
|
||||
* @param epnum: Endpoint number
|
||||
* @retval status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev,
|
||||
@@ -957,6 +950,7 @@ USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev,
|
||||
* @brief USBD_LL_IsoOUTIncomplete
|
||||
* Handle iso out incomplete event
|
||||
* @param pdev: device instance
|
||||
* @param epnum: Endpoint number
|
||||
* @retval status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev,
|
||||
|
||||
@@ -46,7 +46,9 @@
|
||||
/** @defgroup USBD_REQ_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef USBD_MAX_STR_DESC_SIZ
|
||||
#define USBD_MAX_STR_DESC_SIZ 64U
|
||||
#endif /* USBD_MAX_STR_DESC_SIZ */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -421,7 +423,7 @@ USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
|
||||
* Handle Get Descriptor requests
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -454,7 +456,7 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
if ((uint8_t)(pdev->NumClasses) > 0U)
|
||||
{
|
||||
pbuf = (uint8_t *)USBD_CMPSIT.GetHSConfigDescriptor(&len);
|
||||
pbuf = (uint8_t *)USBD_CMPSIT.GetHSConfigDescriptor(&len);
|
||||
}
|
||||
else
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
@@ -468,12 +470,12 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
|
||||
#ifdef USE_USBD_COMPOSITE
|
||||
if ((uint8_t)(pdev->NumClasses) > 0U)
|
||||
{
|
||||
pbuf = (uint8_t *)USBD_CMPSIT.GetFSConfigDescriptor(&len);
|
||||
pbuf = (uint8_t *)USBD_CMPSIT.GetFSConfigDescriptor(&len);
|
||||
}
|
||||
else
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
{
|
||||
pbuf = (uint8_t *)pdev->pClass[0]->GetFSConfigDescriptor(&len);
|
||||
pbuf = (uint8_t *)pdev->pClass[0]->GetFSConfigDescriptor(&len);
|
||||
}
|
||||
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
|
||||
}
|
||||
@@ -558,7 +560,6 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
pbuf = NULL;
|
||||
|
||||
|
||||
for (uint32_t idx = 0U; (idx < pdev->NumClasses); idx++)
|
||||
{
|
||||
if (pdev->pClass[idx]->GetUsrStrDescriptor != NULL)
|
||||
@@ -576,13 +577,12 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
|
||||
#if (USBD_CLASS_USER_STRING_DESC == 1U)
|
||||
if (pdev->pDesc->GetUserStrDescriptor != NULL)
|
||||
{
|
||||
pbuf = pdev->pDesc->GetUserStrDescriptor(pdev->dev_speed, (req->wValue), &len);
|
||||
pbuf = pdev->pDesc->GetUserStrDescriptor(pdev->dev_speed, LOBYTE(req->wValue), &len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -677,7 +677,7 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
|
||||
* Set device address
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_SetAddress(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -751,6 +751,13 @@ static USBD_StatusTypeDef USBD_SetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReq
|
||||
{
|
||||
(void)USBD_CtlSendStatus(pdev);
|
||||
pdev->dev_state = USBD_STATE_CONFIGURED;
|
||||
|
||||
#if (USBD_USER_REGISTER_CALLBACK == 1U)
|
||||
if (pdev->DevStateCallback != NULL)
|
||||
{
|
||||
pdev->DevStateCallback(USBD_STATE_CONFIGURED, cfgidx);
|
||||
}
|
||||
#endif /* USBD_USER_REGISTER_CALLBACK */
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -809,7 +816,7 @@ static USBD_StatusTypeDef USBD_SetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReq
|
||||
* Handle Get device configuration request
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -843,7 +850,7 @@ static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
* Handle Get Status request
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -884,7 +891,7 @@ static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
* Handle Set device feature request
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -910,7 +917,7 @@ static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
* Handle clear device feature request
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @retval status
|
||||
* @retval None
|
||||
*/
|
||||
static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
{
|
||||
@@ -936,8 +943,8 @@ static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
/**
|
||||
* @brief USBD_ParseSetupRequest
|
||||
* Copy buffer into setup structure
|
||||
* @param pdev: device instance
|
||||
* @param req: usb request
|
||||
* @param pdata: setup data pointer
|
||||
* @retval None
|
||||
*/
|
||||
void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
|
||||
@@ -997,7 +1004,7 @@ void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
|
||||
}
|
||||
|
||||
pdesc = desc;
|
||||
*len = ((uint16_t)USBD_GetLen(pdesc) * 2U) + 2U;
|
||||
*len = MIN(USBD_MAX_STR_DESC_SIZ, ((uint16_t)USBD_GetLen(pdesc) * 2U) + 2U);
|
||||
|
||||
unicode[idx] = *(uint8_t *)len;
|
||||
idx++;
|
||||
|
||||
@@ -374,7 +374,9 @@ uint8_t *USBD_Class_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *le
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
{
|
||||
uint32_t deviceserial0, deviceserial1, deviceserial2;
|
||||
uint32_t deviceserial0;
|
||||
uint32_t deviceserial1;
|
||||
uint32_t deviceserial2;
|
||||
|
||||
deviceserial0 = *(uint32_t *)DEVICE_ID1;
|
||||
deviceserial1 = *(uint32_t *)DEVICE_ID2;
|
||||
|
||||
86
LICENSE.txt
86
LICENSE.txt
@@ -1,86 +0,0 @@
|
||||
This software component is provided to you as part of a software package and
|
||||
applicable license terms are in the Package_license file. If you received this
|
||||
software component outside of a package or without applicable license terms,
|
||||
the terms of the SLA0044 license shall apply and are fully reproduced below:
|
||||
|
||||
SLA0044 Rev5/February 2018
|
||||
|
||||
Software license agreement
|
||||
|
||||
ULTIMATE LIBERTY SOFTWARE LICENSE AGREEMENT
|
||||
|
||||
BY INSTALLING, COPYING, DOWNLOADING, ACCESSING OR OTHERWISE USING THIS SOFTWARE
|
||||
OR ANY PART THEREOF (AND THE RELATED DOCUMENTATION) FROM STMICROELECTRONICS
|
||||
INTERNATIONAL N.V, SWISS BRANCH AND/OR ITS AFFILIATED COMPANIES
|
||||
(STMICROELECTRONICS), THE RECIPIENT, ON BEHALF OF HIMSELF OR HERSELF, OR ON
|
||||
BEHALF OF ANY ENTITY BY WHICH SUCH RECIPIENT IS EMPLOYED AND/OR ENGAGED AGREES
|
||||
TO BE BOUND BY THIS SOFTWARE LICENSE AGREEMENT.
|
||||
|
||||
Under STMicroelectronics’ intellectual property rights, the redistribution,
|
||||
reproduction and use in source and binary forms of the software or any part
|
||||
thereof, with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
1. Redistribution of source code (modified or not) must retain any copyright
|
||||
notice, this list of conditions and the disclaimer set forth below as items 10
|
||||
and 11.
|
||||
|
||||
2. Redistributions in binary form, except as embedded into microcontroller or
|
||||
microprocessor device manufactured by or for STMicroelectronics or a software
|
||||
update for such device, must reproduce any copyright notice provided with the
|
||||
binary code, this list of conditions, and the disclaimer set forth below as
|
||||
items 10 and 11, in documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. Neither the name of STMicroelectronics nor the names of other contributors to
|
||||
this software may be used to endorse or promote products derived from this
|
||||
software or part thereof without specific written permission.
|
||||
|
||||
4. This software or any part thereof, including modifications and/or derivative
|
||||
works of this software, must be used and execute solely and exclusively on or in
|
||||
combination with a microcontroller or microprocessor device manufactured by or
|
||||
for STMicroelectronics.
|
||||
|
||||
5. No use, reproduction or redistribution of this software partially or totally
|
||||
may be done in any manner that would subject this software to any Open Source
|
||||
Terms. “Open Source Terms” shall mean any open source license which requires as
|
||||
part of distribution of software that the source code of such software is
|
||||
distributed therewith or otherwise made available, or open source license that
|
||||
substantially complies with the Open Source definition specified at
|
||||
www.opensource.org and any other comparable open source license such as for
|
||||
example GNU General Public License (GPL), Eclipse Public License (EPL), Apache
|
||||
Software License, BSD license or MIT license.
|
||||
|
||||
6. STMicroelectronics has no obligation to provide any maintenance, support or
|
||||
updates for the software.
|
||||
|
||||
7. The software is and will remain the exclusive property of STMicroelectronics
|
||||
and its licensors. The recipient will not take any action that jeopardizes
|
||||
STMicroelectronics and its licensors' proprietary rights or acquire any rights
|
||||
in the software, except the limited rights specified hereunder.
|
||||
|
||||
8. The recipient shall comply with all applicable laws and regulations affecting
|
||||
the use of the software or any part thereof including any applicable export
|
||||
control law or regulation.
|
||||
|
||||
9. Redistribution and use of this software or any part thereof other than as
|
||||
permitted under this license is void and will automatically terminate your
|
||||
rights under this license.
|
||||
|
||||
10. THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS, WHICH ARE
|
||||
DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL
|
||||
STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
11. EXCEPT AS EXPRESSLY PERMITTED HEREUNDER, NO LICENSE OR OTHER RIGHTS, WHETHER
|
||||
EXPRESS OR IMPLIED, ARE GRANTED UNDER ANY PATENT OR OTHER INTELLECTUAL PROPERTY
|
||||
RIGHTS OF STMICROELECTRONICS OR ANY THIRD PARTY.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for STM32GK Firmware Package</title>
|
||||
<title>Release Notes for STM32Cube USB Device Library</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
@@ -59,9 +59,135 @@ Page</a> : STM32Cube USB Wiki Page</li>
|
||||
<section id="update-history" class="col-sm-12 col-lg-8">
|
||||
<h1>Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section22" checked aria-hidden="true">
|
||||
<label for="collapse-section22" aria-hidden="true">V2.11.0 /
|
||||
<input type="checkbox" id="collapse-section23" checked aria-hidden="true">
|
||||
<label for="collapse-section23" aria-hidden="true">V2.11.3 /
|
||||
20-December-2023</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB Core:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Minor enhancement; add a check on device string descriptor length</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB DFU Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Improve DFU Vendor Commands support</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section23" aria-hidden="true">
|
||||
<label for="collapse-section23" aria-hidden="true">V2.11.2 /
|
||||
17-April-2023</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB Core:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Adding user callback to get device configuration state</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB DFU Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Adding DFU Vendor Commands support</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB MSC Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">fix data sense response to be aligned with SBC-3 specification</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB AUDIO Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">restart AUDIO ISO endpoint during ISO incomplete event</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB VIDEO Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">restart VIDEO ISO endpoint during ISO incomplete event</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section22" aria-hidden="true">
|
||||
<label for="collapse-section22" aria-hidden="true">V2.11.1 /
|
||||
27-September-2022</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"> Improvement of the memory management
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB Core:</strong></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Fix some compilation warnings related
|
||||
to unused parameters</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Improve some code parts style</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Add check on the USB Device status in
|
||||
USBD_LL_Suspend before suspending it</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB CDC-ACM Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Remove redundant prototype declaration of
|
||||
USBD_CDC_GetOtherSpeedCfgDesc()</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB CompositeBuilder, CCID, CDC_ECM, CDC_RNDIS,
|
||||
CustomHID, MSC & Video Classes:</strong></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"> Improve some code parts style </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section21" aria-hidden="true">
|
||||
<label for="collapse-section21" aria-hidden="true">V2.11.0 /
|
||||
25-March-2022</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -75,7 +201,7 @@ Page</a> : STM32Cube USB Wiki Page</li>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Correction of the support of
|
||||
VS_PROBE_CONTROL & VS_COMMIT_CONTROL requets</td>
|
||||
VS_PROBE_CONTROL & VS_COMMIT_CONTROL requests</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB AUDIO Class:</strong></td>
|
||||
@@ -130,10 +256,12 @@ style</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section21" checked aria-hidden="true">
|
||||
<label for="collapse-section21" aria-hidden="true">V2.10.0 /
|
||||
<input type="checkbox" id="collapse-section20" aria-hidden="true">
|
||||
<label for="collapse-section20" aria-hidden="true">V2.10.0 /
|
||||
03-Sept-2021</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -169,10 +297,12 @@ selected</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section20" aria-hidden="true">
|
||||
<label for="collapse-section20" aria-hidden="true">V2.9.0 /
|
||||
<input type="checkbox" id="collapse-section19" aria-hidden="true">
|
||||
<label for="collapse-section19" aria-hidden="true">V2.9.0 /
|
||||
06-July-2021</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -215,10 +345,12 @@ missing casting during class handler allocation</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section19" aria-hidden="true">
|
||||
<label for="collapse-section19" aria-hidden="true">V2.8.0 /
|
||||
<input type="checkbox" id="collapse-section18" aria-hidden="true">
|
||||
<label for="collapse-section18" aria-hidden="true">V2.8.0 /
|
||||
10-Mars-2021</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -265,10 +397,12 @@ format support</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section17" aria-hidden="true">
|
||||
<label for="collapse-section17" aria-hidden="true">V2.7.1 /
|
||||
18-August-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -284,10 +418,12 @@ check to Class handler</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section16" aria-hidden="true">
|
||||
<label for="collapse-section16" aria-hidden="true">V2.7.0 /
|
||||
12-August-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-5">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -369,10 +505,12 @@ user code</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section15" aria-hidden="true">
|
||||
<label for="collapse-section15" aria-hidden="true">V2.6.1 /
|
||||
05-June-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-6">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -409,10 +547,12 @@ compatibility with device library version below v2.6.0</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section14" aria-hidden="true">
|
||||
<label for="collapse-section14" aria-hidden="true">V2.6.0 /
|
||||
27-December-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-7">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -492,10 +632,12 @@ transfer: USBD_CUSTOM_HID_ReceivePacket()</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section13" aria-hidden="true">
|
||||
<label for="collapse-section13" aria-hidden="true">V2.5.3 /
|
||||
30-April-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-8">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -531,10 +673,12 @@ device state only if the current state is USBD_STATE_SUSPENDED</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section12" aria-hidden="true">
|
||||
<label for="collapse-section12" aria-hidden="true">V2.5.2 /
|
||||
27-Mars-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-9">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -551,10 +695,12 @@ NVIC_SystemReset() prototype change</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section11" aria-hidden="true">
|
||||
<label for="collapse-section11" aria-hidden="true">V2.5.1 /
|
||||
03-August-2018</label>
|
||||
<div>
|
||||
<h2 id="main-changes-10">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -586,10 +732,12 @@ Break on USBD_Template_Setup API</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section10" aria-hidden="true">
|
||||
<label for="collapse-section10" aria-hidden="true">V2.5.0 /
|
||||
15-December-2017</label>
|
||||
<div>
|
||||
<h2 id="main-changes-11">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -636,10 +784,12 @@ machine</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section9" aria-hidden="true">
|
||||
<label for="collapse-section9" aria-hidden="true">V2.4.2 /
|
||||
11-December-2015</label>
|
||||
<div>
|
||||
<h2 id="main-changes-12">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -658,10 +808,12 @@ by #include “usbd_cdc.h”</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section8" aria-hidden="true">
|
||||
<label for="collapse-section8" aria-hidden="true">V2.4.1 /
|
||||
19-June-2015</label>
|
||||
<div>
|
||||
<h2 id="main-changes-13">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -697,10 +849,12 @@ DMA half transfer</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section7" aria-hidden="true">
|
||||
<label for="collapse-section7" aria-hidden="true">V2.4.0 /
|
||||
28-February-2015</label>
|
||||
<div>
|
||||
<h2 id="main-changes-14">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -755,10 +909,12 @@ CDC_SET_CONTROL_LINE_STATE and similar no-data setup requests.</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section6" aria-hidden="true">
|
||||
<label for="collapse-section6" aria-hidden="true">V2.3.0 /
|
||||
04-November-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-15">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -789,10 +945,12 @@ update</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section5" aria-hidden="true">
|
||||
<label for="collapse-section5" aria-hidden="true">V2.2.0 /
|
||||
13-June-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-16">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -844,10 +1002,12 @@ USBD_HID_CLASS)</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true">
|
||||
<label for="collapse-section4" aria-hidden="true">V2.1.0 /
|
||||
22-April-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-17">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -891,10 +1051,12 @@ usbd_customhid_if_template.c/h</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" aria-hidden="true">
|
||||
<label for="collapse-section3" aria-hidden="true">V2.0.0 /
|
||||
18-February-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-18">Main Changes</h2>
|
||||
<p>Major update based on STM32Cube specification.</p>
|
||||
<table>
|
||||
@@ -914,10 +1076,12 @@ compatible.</td>
|
||||
<p><strong>This version has to be used only with STM32Cube based
|
||||
development</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true">
|
||||
<label for="collapse-section2" aria-hidden="true">V1.1.0 /
|
||||
19-March-2012</label>
|
||||
<div>
|
||||
<h2 id="main-changes-19">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -951,15 +1115,18 @@ to take into account error during Control OUT stage</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true">
|
||||
<label for="collapse-section1" aria-hidden="true">V1.0.0 /
|
||||
22-July-2011</label>
|
||||
<div>
|
||||
<h2 id="main-changes-20">Main Changes</h2>
|
||||
<p>First official version for STM32F105/7xx and STM32F2xx devices</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
<div class="columns">
|
||||
<div class="column" style="width:95%;">
|
||||
|
||||
496
Release_Notes.md
496
Release_Notes.md
@@ -1,496 +0,0 @@
|
||||
---
|
||||
pagetitle: Release Notes for STM32GK Firmware Package
|
||||
lang: en
|
||||
header-includes: <link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
|
||||
---
|
||||
|
||||
::: {.row}
|
||||
::: {.col-sm-12 .col-lg-4}
|
||||
|
||||
<center>
|
||||
# Release Notes for <mark>STM32Cube USB Device Library</mark>
|
||||
Copyright © 2015 STMicroelectronics\
|
||||
|
||||
[](https://www.st.com){.logo}
|
||||
</center>
|
||||
|
||||
# Purpose
|
||||
|
||||
The USB device library comes on top of the STM32Cube™ USB device HAL driver and
|
||||
offers all the APIs required to develop an USB device application.
|
||||
|
||||
The main USB device library features are:
|
||||
|
||||
- Support of multi packet transfer features allowing sending big amount of data without
|
||||
splitting it into max packet size transfers.
|
||||
- Support of most common USB Class drivers (HID, MSC, DFU, CDC-ACM, CDC-ECM, RNDIS, MTP, AUDIO1.0, Printer, Video, Composite)
|
||||
- Configuration files to interface with Cube HAL and change the library configuration without changing
|
||||
the library code (Read Only).
|
||||
- 32-bits aligned data structures to handle DMA based transfer in High speed modes.
|
||||
|
||||
Here is the list of references to user documents:
|
||||
|
||||
- [UM1734](https://www.st.com/resource/en/user_manual/DM00108129.pdf) : STM32Cube USB device library User Manual
|
||||
- [Wiki Page](https://wiki.st.com/stm32mcu/wiki/USB_overview) : STM32Cube USB Wiki Page
|
||||
|
||||
:::
|
||||
|
||||
::: {.col-sm-12 .col-lg-8}
|
||||
# Update History
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section22" checked aria-hidden="true">
|
||||
<label for="collapse-section22" aria-hidden="true">V2.11.0 / 25-March-2022</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**USB VIDEO Class:**
|
||||
Correction of the support of VS_PROBE_CONTROL & VS_COMMIT_CONTROL requets
|
||||
**USB AUDIO Class:**
|
||||
Correction of the check on AUDIO_TOTAL_BUF_SIZE to avoid vulnerabilities
|
||||
**USB HID Class:**
|
||||
Modification of some constants names to avoid duplication versus USB host library
|
||||
**USB CustomHID Class:**
|
||||
Add support of Get Report control request
|
||||
Allow disabling EP OUT prepare receive using a dedicated macros that can be defined in usbd_conf.h application file
|
||||
Add support of Report Descriptor with length greater than 255 bytes
|
||||
**USB CCID Class:**
|
||||
Fix minor Code Spelling warning
|
||||
**USB All Classes:**
|
||||
Update all classes to support composite multi-instance using the class id parameter
|
||||
Fix code spelling and improve code style
|
||||
fix misraC 2012 rule 10.3
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section21" checked aria-hidden="true">
|
||||
<label for="collapse-section21" aria-hidden="true">V2.10.0 / 03-Sept-2021</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**Integration of new USB device Class driver:**
|
||||
Adding support of Composite devices with an auto generation of composite device configuration descriptors
|
||||
**USB All Classes:**
|
||||
Fix Code Spelling and improve Code Style
|
||||
Update device class drivers to support Composite devices
|
||||
Improve declaration of USB configuration descriptor table which is allocated if the composite builder is not selected
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section20" aria-hidden="true">
|
||||
<label for="collapse-section20" aria-hidden="true">V2.9.0 / 06-July-2021</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**Integration of new USB device Class driver:**
|
||||
USB CCID Class driver based on Universal Serial Bus Device Class Definition for Integrated Circuit(s) Cards Interface Devices Revision 1.1
|
||||
USB MTP Class driver based on Universal Serial Bus Device Class Media Transfer Protocol Revision 1.1
|
||||
**USB All Classes:**
|
||||
Fix Code Spelling and improve Code Style
|
||||
Update the way to declare licenses
|
||||
**USB CDC/RNDIS/ECM Classes:**
|
||||
Fix compilation warning with C++ due to missing casting during class handler allocation
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section19" aria-hidden="true">
|
||||
<label for="collapse-section19" aria-hidden="true">V2.8.0 / 10-Mars-2021</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**Integration of new USB device Class driver:**
|
||||
USB Printer Class driver based on Universal Serial Bus Device Class Definition for Printing Devices Version 1.1
|
||||
**USB All Classes:**
|
||||
Fix USB buffer overflow vulnerability for CDC, CDC-ECM, CDC-RNDIS, DFU, AUDIO, CustomHID, and Video Classes
|
||||
Fix compilation warning with C++ due to missing casting during class handler allocation
|
||||
Enhance comments of USB configuration descriptors fields
|
||||
**USB Video Class:**
|
||||
Fix missing closing bracket for extern "C" in usbd_video.h
|
||||
Fix USBCV test with Uncompressed video format support
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section17" aria-hidden="true">
|
||||
<label for="collapse-section17" aria-hidden="true">V2.7.1 / 18-August-2020</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
USB All Class: Add NULL pointer access check to Class handler
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section16" aria-hidden="true">
|
||||
<label for="collapse-section16" aria-hidden="true">V2.7.0 / 12-August-2020</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**Integration of new USB device Class driver:**
|
||||
USB video Class driver based on USB-IF video class definition version 1.1
|
||||
**USB Core:**
|
||||
Enhance NULL pointer check in Core APIs
|
||||
Allow supporting both USER and USER Class string desc
|
||||
Add support of USB controller which handles packet-size splitting by hardware
|
||||
Avoid compilation warning due macro redefinition
|
||||
change added to USBD_HandleTypeDef structure: dev_state, old_dev_state and ep0_state declaration become volatile to disable compiler optimization
|
||||
Word spelling correction and file indentation improved
|
||||
usbd_conf.h/c Template file updated to suggest using by default a static memory allocation for Class handler
|
||||
**USB All Classes:**
|
||||
Word spelling correction and file indentation improved
|
||||
Allow updating device config descriptor Max power from user code usbd_conf.h using USBD_MAX_POWER define
|
||||
Fix device config descriptor bmAttributes value which depends on user code define USBD_SELF_POWERED
|
||||
**USB CDC Class:**
|
||||
Class specific request, add protection to limit the maximum data length to be sent by the CDC device
|
||||
**USB CustomHID Class:**
|
||||
Allow changing CustomHID data EP size from user code
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section15" aria-hidden="true">
|
||||
<label for="collapse-section15" aria-hidden="true">V2.6.1 / 05-June-2020</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Fix minor misra-c 2012 violations
|
||||
**USB Core:**
|
||||
minor rework on USBD_Init() USBD_DeInit()
|
||||
Fix warning issue with Keil due to missing return value of setup API
|
||||
**USB CDC Class:**
|
||||
Fix file indentation
|
||||
Avoid accessing to NULL pointer in case TransmitCplt() user fops is not defined to allow application compatibility with device library version below v2.6.0
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section14" aria-hidden="true">
|
||||
<label for="collapse-section14" aria-hidden="true">V2.6.0 / 27-December-2019</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Integration of three new USB device Class drivers:CDC ECM , CDC RNDIS Microsoft, USB Billboard
|
||||
Fix mandatory misra-c 2012 violations
|
||||
update user core and class template files
|
||||
**USB Core:**
|
||||
Fix unexpected EP0 stall during enumeration phase
|
||||
Improve APIs error management and prevent accessing NULL pointers
|
||||
**USB MSC Class:**
|
||||
Fix USBCV specific class tests
|
||||
Fix multiple error with SCSI commands handling
|
||||
Protect medium access when host ask for medium ejection
|
||||
**USB CDC Class:**
|
||||
Add new function to inform user that current IN transfer is completed
|
||||
update transmit and receive APIs to transfer up to 64KB
|
||||
**USB AUDIO Class:**
|
||||
Fix audio sync start buffer size
|
||||
update user callback periodicTC args by adding pointer to user buffer and size
|
||||
**USB CustomHID Class:**
|
||||
Rework the OUT transfer complete and prevent automatically re-enabling the OUT EP
|
||||
Add new user API to restart the OUT transfer: USBD_CUSTOM_HID_ReceivePacket()
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section13" aria-hidden="true">
|
||||
<label for="collapse-section13" aria-hidden="true">V2.5.3 / 30-April-2019</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Fix misra-c 2012 high severity violations
|
||||
**Core driver:**
|
||||
protect shared macros __ALIGN_BEGIN, __ALIGN_END with C directive #ifndef
|
||||
update Core driver and DFU Class driver to use USBD_SUPPORT_USER_STRING_DESC instead of USBD_SUPPORT_USER_STRING
|
||||
prevent accessing to NULL pointer if the get descriptor functions are not defined
|
||||
Update on USBD_LL_Resume(), restore the device state only if the current state is USBD_STATE_SUSPENDED
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section12" aria-hidden="true">
|
||||
<label for="collapse-section12" aria-hidden="true">V2.5.2 / 27-Mars-2019</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
DFU Class: fix compilation warning due to unreachable instruction code introduced with CMSIS V5.4.0 NVIC_SystemReset() prototype change
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section11" aria-hidden="true">
|
||||
<label for="collapse-section11" aria-hidden="true">V2.5.1 / 03-August-2018</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Update license section by adding path to get copy of ST Ultimate Liberty license
|
||||
Core: Fix unexpected stall during status OUT phase
|
||||
DFU Class: rework hdfu struct to prevent unaligned addresses
|
||||
MSC Class: fix lba address overflow during large file transfers greater than 4Go
|
||||
Template Class: add missing Switch case Break on USBD_Template_Setup API
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section10" aria-hidden="true">
|
||||
<label for="collapse-section10" aria-hidden="true">V2.5.0 / 15-December-2017</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Update license section
|
||||
Update some functions to be MISRAC 2004 compliant
|
||||
Add HS and OtherSpeed configuration descriptor for HID and CustomHID classes
|
||||
Correct error handling in all class setup function
|
||||
Add usbd_desc_template.c/ usbd_desc_template.h templates files
|
||||
Add support of class and vendor request
|
||||
CDC Class: fix zero-length packet issue in bulk IN transfer
|
||||
Fix compilation warning with unused arguments for some functions
|
||||
Improve USB Core enumeration state machine
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section9" aria-hidden="true">
|
||||
<label for="collapse-section9" aria-hidden="true">V2.4.2 / 11-December-2015</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**CDC Class**
|
||||
usbd_cdc.c: change #include "USBD_CDC.h" by #include "usbd_cdc.h"
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section8" aria-hidden="true">
|
||||
<label for="collapse-section8" aria-hidden="true">V2.4.1 / 19-June-2015</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**CDC Class**
|
||||
usbd_cdc.c: comments update
|
||||
**MSC Class**
|
||||
usbd_msc_bot.h: update to be C++ compliant
|
||||
**AUDIO Class**
|
||||
usbd_audio.c: fix issue when Host sends GetInterface command it gets a wrong value
|
||||
usbd_audio.c: remove useless management of DMA half transfer
|
||||
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section7" aria-hidden="true">
|
||||
<label for="collapse-section7" aria-hidden="true">V2.4.0 / 28-February-2015</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
**Core Driver**
|
||||
Add support of Link Power Management (LPM): add new API GetBOSDescriptor(), that is used only if USBD_LPM_ENABLED switch is enabled in usbd_conf.h file
|
||||
usbd_core.c: Fix bug of unsupported premature Host Out stage during data In stage (ie. when endpoint 0 maximum data size is 8 and Host requests GetDeviceDescriptor for the first time)
|
||||
usbd_ctlreq.c: Fix bug of unsupported Endpoint Class requests (ie. Audio SetCurrent request for endpoint sampling rate setting)
|
||||
**HID Class**
|
||||
Updating Polling time API USBD_HID_GetPollingInterval() to query this period for HS and FS
|
||||
usbd_hid.c: Fix USBD_LL_CloseEP() function call in USBD_HID_DeInit() replacing endpoint size by endpoint address.
|
||||
**CDC Class**
|
||||
usbd_cdc.c: Add missing GetInterface request management in USBD_CDC_Setup() function
|
||||
usbd_cdc.c: Update USBD_CDC_Setup() function to allow correct user implementation of CDC_SET_CONTROL_LINE_STATE and similar no-data setup requests.
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section6" aria-hidden="true">
|
||||
<label for="collapse-section6" aria-hidden="true">V2.3.0 / 04-November-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Update all drivers to be C++ compliant
|
||||
**CDC Class**
|
||||
usbd_cdc.c: fix clear flag issue in USBD_CDC_TransmitPacket() function
|
||||
usbd_cdc_if_template.c: update TEMPLATE_Receive() function header comment
|
||||
Miscellaneous source code comments update
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section5" aria-hidden="true">
|
||||
<label for="collapse-section5" aria-hidden="true">V2.2.0 / 13-June-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Source code comments review and update
|
||||
**HID class**
|
||||
Remove unused API USBD_HID_DeviceQualifierDescriptor()
|
||||
Add a new API in the HID class to query the poll time USBD_HID_GetPollingInterval()
|
||||
**CDC class**
|
||||
Bug fix: missing handling ZeroLength Setup request
|
||||
**All classes**
|
||||
Add alias for the class definition, it's defined as macro with capital letter
|
||||
ex. for the HID, the USBD_HID_CLASS macro is defined this way #define USBD_HID_CLASS &USBD_HID
|
||||
and the application code can use the previous definition: &USBD_HID ex. USBD_RegisterClass(&USBD_Device, &USBD_HID) or the new USBD_HID_CLASS ex. USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS)
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true">
|
||||
<label for="collapse-section4" aria-hidden="true">V2.1.0 / 22-April-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
usbd_conf_template.c: update file with the right content (it was using MSC memory management layer)
|
||||
usbd_conf_template.h: change include of stm32f4xx.h by stm32xxx.h and add comment to inform user to adapt it to the device used
|
||||
Several enhancements in CustomHID class
|
||||
Update the Custom HID class driver to simplify the link with user processes
|
||||
Optimize the Custom HID class driver and reduce footprint
|
||||
Add USBD_CUSTOM_HID_RegisterInterface() API to link user process to custom HID class
|
||||
Add Custom HID interface template file usbd_customhid_if_template.c/h
|
||||
Miscellaneous comments update
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section3" aria-hidden="true">
|
||||
<label for="collapse-section3" aria-hidden="true">V2.0.0 / 18-February-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Major update based on STM32Cube specification.
|
||||
|
||||
Headline
|
||||
---------
|
||||
Library Core, Classes architecture and APIs modified vs. V1.1.0, and thus the 2 versions are not compatible.
|
||||
|
||||
|
||||
**This version has to be used only with STM32Cube based development**
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true">
|
||||
<label for="collapse-section2" aria-hidden="true">V1.1.0 / 19-March-2012</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
Headline
|
||||
---------
|
||||
Official support of STM32F4xx devices
|
||||
All source files: license disclaimer text update and add link to the License file on ST Internet.
|
||||
Handle test mode in the set feature request
|
||||
Handle dynamically the USB SELF POWERED feature
|
||||
Handle correctly the USBD_CtlError process to take into account error during Control OUT stage
|
||||
Miscellaneous bug fix
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true">
|
||||
<label for="collapse-section1" aria-hidden="true">V1.0.0 / 22-July-2011</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
First official version for STM32F105/7xx and STM32F2xx devices
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
<footer class="sticky">
|
||||
::: {.columns}
|
||||
::: {.column width="95%"}
|
||||
:::
|
||||
::: {.column width="5%"}
|
||||
<abbr title="Based on template cx566953 version 2.1">Info</abbr>
|
||||
:::
|
||||
:::
|
||||
</footer>
|
||||
31
SECURITY.md
Normal file
31
SECURITY.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Report potential product security vulnerabilities
|
||||
|
||||
ST places a high priority on security, and our Product Security Incident
|
||||
Response Team (PSIRT) is committed to rapidly addressing potential security
|
||||
vulnerabilities affecting our products. PSIRT's long history and vast experience
|
||||
in security allows ST to perform clear analyses and provide appropriate guidance
|
||||
on mitigations and solutions when applicable.
|
||||
|
||||
If you wish to report potential security vulnerabilities regarding our products,
|
||||
**please do not report them through public GitHub issues.** Instead, we
|
||||
encourage you to report them to our ST PSIRT following the process described at:
|
||||
**https://www.st.com/content/st_com/en/security/report-vulnerabilities.html**
|
||||
|
||||
### IMPORTANT - READ CAREFULLY:
|
||||
|
||||
STMicroelectronics International N.V., on behalf of itself, its affiliates and
|
||||
subsidiaries, (collectively “ST”) takes all potential security vulnerability
|
||||
reports or other related communications (“Report(s)”) seriously. In order to
|
||||
review Your Report (the terms “You” and “Yours” include your employer, and all
|
||||
affiliates, subsidiaries and related persons or entities) and take actions as
|
||||
deemed appropriate, ST requires that we have the rights and Your permission to
|
||||
do so.
|
||||
|
||||
As such, by submitting Your Report to ST, You agree that You have the right to
|
||||
do so, and You grant to ST the rights to use the Report for purposes related to
|
||||
security vulnerability analysis, testing, correction, patching, reporting and
|
||||
any other related purpose or function.
|
||||
|
||||
By submitting Your Report, You agree that ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
Reference in New Issue
Block a user