mirror of
https://github.com/STMicroelectronics/stm32-mw-usb-device.git
synced 2026-02-09 04:25:36 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a58ee226 |
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -103,42 +103,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_AUDIO_Private_FunctionPrototypes
|
/** @defgroup USBD_AUDIO_Private_FunctionPrototypes
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
static uint8_t USBD_AUDIO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
||||||
|
static uint8_t USBD_AUDIO_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
||||||
static uint8_t USBD_AUDIO_Init (USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t cfgidx);
|
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_DeInit (USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t cfgidx);
|
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_Setup(USBD_HandleTypeDef *pdev,
|
static uint8_t USBD_AUDIO_Setup(USBD_HandleTypeDef *pdev,
|
||||||
USBD_SetupReqTypedef *req);
|
USBD_SetupReqTypedef *req);
|
||||||
|
|
||||||
static uint8_t *USBD_AUDIO_GetCfgDesc(uint16_t *length);
|
static uint8_t *USBD_AUDIO_GetCfgDesc(uint16_t *length);
|
||||||
|
|
||||||
static uint8_t *USBD_AUDIO_GetDeviceQualifierDesc(uint16_t *length);
|
static uint8_t *USBD_AUDIO_GetDeviceQualifierDesc(uint16_t *length);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
static uint8_t USBD_AUDIO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
static uint8_t USBD_AUDIO_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_EP0_RxReady(USBD_HandleTypeDef *pdev);
|
static uint8_t USBD_AUDIO_EP0_RxReady(USBD_HandleTypeDef *pdev);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_EP0_TxReady(USBD_HandleTypeDef *pdev);
|
static uint8_t USBD_AUDIO_EP0_TxReady(USBD_HandleTypeDef *pdev);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_SOF(USBD_HandleTypeDef *pdev);
|
static uint8_t USBD_AUDIO_SOF(USBD_HandleTypeDef *pdev);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
static void AUDIO_REQ_GetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
|
static void AUDIO_REQ_GetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
|
||||||
|
|
||||||
static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
|
static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -381,6 +365,7 @@ static uint8_t USBD_AUDIO_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
|||||||
USBD_LL_PrepareReceive(pdev, AUDIO_OUT_EP, haudio->buffer,
|
USBD_LL_PrepareReceive(pdev, AUDIO_OUT_EP, haudio->buffer,
|
||||||
AUDIO_OUT_PACKET);
|
AUDIO_OUT_PACKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +379,6 @@ static uint8_t USBD_AUDIO_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
|||||||
static uint8_t USBD_AUDIO_DeInit(USBD_HandleTypeDef *pdev,
|
static uint8_t USBD_AUDIO_DeInit(USBD_HandleTypeDef *pdev,
|
||||||
uint8_t cfgidx)
|
uint8_t cfgidx)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Open EP OUT */
|
/* Open EP OUT */
|
||||||
USBD_LL_CloseEP(pdev, AUDIO_OUT_EP);
|
USBD_LL_CloseEP(pdev, AUDIO_OUT_EP);
|
||||||
pdev->ep_out[AUDIO_OUT_EP & 0xFU].is_used = 0U;
|
pdev->ep_out[AUDIO_OUT_EP & 0xFU].is_used = 0U;
|
||||||
@@ -532,6 +516,7 @@ static uint8_t USBD_AUDIO_Setup (USBD_HandleTypeDef *pdev,
|
|||||||
static uint8_t *USBD_AUDIO_GetCfgDesc(uint16_t *length)
|
static uint8_t *USBD_AUDIO_GetCfgDesc(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_AUDIO_CfgDesc);
|
*length = sizeof(USBD_AUDIO_CfgDesc);
|
||||||
|
|
||||||
return USBD_AUDIO_CfgDesc;
|
return USBD_AUDIO_CfgDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,10 +527,8 @@ static uint8_t *USBD_AUDIO_GetCfgDesc (uint16_t *length)
|
|||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
static uint8_t USBD_AUDIO_DataIn (USBD_HandleTypeDef *pdev,
|
static uint8_t USBD_AUDIO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
uint8_t epnum)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Only OUT data are processed */
|
/* Only OUT data are processed */
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
@@ -562,7 +545,8 @@ static uint8_t USBD_AUDIO_EP0_RxReady (USBD_HandleTypeDef *pdev)
|
|||||||
haudio = (USBD_AUDIO_HandleTypeDef *) pdev->pClassData;
|
haudio = (USBD_AUDIO_HandleTypeDef *) pdev->pClassData;
|
||||||
|
|
||||||
if (haudio->control.cmd == AUDIO_REQ_SET_CUR)
|
if (haudio->control.cmd == AUDIO_REQ_SET_CUR)
|
||||||
{/* In this driver, to simplify code, only SET_CUR request is managed */
|
{
|
||||||
|
/* In this driver, to simplify code, only SET_CUR request is managed */
|
||||||
|
|
||||||
if (haudio->control.unit == AUDIO_OUT_STREAMING_CTRL)
|
if (haudio->control.unit == AUDIO_OUT_STREAMING_CTRL)
|
||||||
{
|
{
|
||||||
@@ -668,7 +652,6 @@ void USBD_AUDIO_Sync (USBD_HandleTypeDef *pdev, AUDIO_OffsetTypeDef offset)
|
|||||||
*/
|
*/
|
||||||
static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
{
|
{
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -680,7 +663,6 @@ static uint8_t USBD_AUDIO_IsoINIncomplete (USBD_HandleTypeDef *pdev, uint8_t ep
|
|||||||
*/
|
*/
|
||||||
static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
{
|
{
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -690,8 +672,7 @@ static uint8_t USBD_AUDIO_IsoOutIncomplete (USBD_HandleTypeDef *pdev, uint8_t e
|
|||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
static uint8_t USBD_AUDIO_DataOut (USBD_HandleTypeDef *pdev,
|
static uint8_t USBD_AUDIO_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
uint8_t epnum)
|
|
||||||
{
|
{
|
||||||
USBD_AUDIO_HandleTypeDef *haudio;
|
USBD_AUDIO_HandleTypeDef *haudio;
|
||||||
haudio = (USBD_AUDIO_HandleTypeDef *) pdev->pClassData;
|
haudio = (USBD_AUDIO_HandleTypeDef *) pdev->pClassData;
|
||||||
@@ -765,9 +746,7 @@ static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
|
|||||||
if (req->wLength)
|
if (req->wLength)
|
||||||
{
|
{
|
||||||
/* Prepare the reception of the buffer over EP0 */
|
/* Prepare the reception of the buffer over EP0 */
|
||||||
USBD_CtlPrepareRx (pdev,
|
USBD_CtlPrepareRx(pdev, haudio->control.data, req->wLength);
|
||||||
haudio->control.data,
|
|
||||||
req->wLength);
|
|
||||||
|
|
||||||
haudio->control.cmd = AUDIO_REQ_SET_CUR; /* Set the request value */
|
haudio->control.cmd = AUDIO_REQ_SET_CUR; /* Set the request value */
|
||||||
haudio->control.len = (uint8_t)req->wLength; /* Set the request data length */
|
haudio->control.len = (uint8_t)req->wLength; /* Set the request data length */
|
||||||
@@ -785,6 +764,7 @@ static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
|
|||||||
static uint8_t *USBD_AUDIO_GetDeviceQualifierDesc(uint16_t *length)
|
static uint8_t *USBD_AUDIO_GetDeviceQualifierDesc(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_AUDIO_DeviceQualifierDesc);
|
*length = sizeof(USBD_AUDIO_DeviceQualifierDesc);
|
||||||
|
|
||||||
return USBD_AUDIO_DeviceQualifierDesc;
|
return USBD_AUDIO_DeviceQualifierDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,6 +780,7 @@ uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef *pdev,
|
|||||||
{
|
{
|
||||||
pdev->pUserData = fops;
|
pdev->pUserData = fops;
|
||||||
}
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -125,7 +125,6 @@ static int8_t TEMPLATE_DeInit(uint32_t options)
|
|||||||
*/
|
*/
|
||||||
static int8_t TEMPLATE_AudioCmd(uint8_t *pbuf, uint32_t size, uint8_t cmd)
|
static int8_t TEMPLATE_AudioCmd(uint8_t *pbuf, uint32_t size, uint8_t cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +135,6 @@ static int8_t TEMPLATE_AudioCmd (uint8_t* pbuf, uint32_t size, uint8_t cmd)
|
|||||||
*/
|
*/
|
||||||
static int8_t TEMPLATE_VolumeCtl(uint8_t vol)
|
static int8_t TEMPLATE_VolumeCtl(uint8_t vol)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +145,6 @@ static int8_t TEMPLATE_VolumeCtl (uint8_t vol)
|
|||||||
*/
|
*/
|
||||||
static int8_t TEMPLATE_MuteCtl(uint8_t cmd)
|
static int8_t TEMPLATE_MuteCtl(uint8_t cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +155,6 @@ static int8_t TEMPLATE_MuteCtl (uint8_t cmd)
|
|||||||
*/
|
*/
|
||||||
static int8_t TEMPLATE_PeriodicTC(uint8_t cmd)
|
static int8_t TEMPLATE_PeriodicTC(uint8_t cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +165,6 @@ static int8_t TEMPLATE_PeriodicTC (uint8_t cmd)
|
|||||||
*/
|
*/
|
||||||
static int8_t TEMPLATE_GetState(void)
|
static int8_t TEMPLATE_GetState(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -144,9 +144,9 @@ typedef void (*pFunction)(void);
|
|||||||
USBD_IDX_INTERFACE_STR + (n) + 1U /* iInterface: Index of string descriptor */ \
|
USBD_IDX_INTERFACE_STR + (n) + 1U /* iInterface: Index of string descriptor */ \
|
||||||
|
|
||||||
#define TRANSFER_SIZE_BYTES(size) ((uint8_t)(size)), /* XFERSIZEB0 */\
|
#define TRANSFER_SIZE_BYTES(size) ((uint8_t)(size)), /* XFERSIZEB0 */\
|
||||||
((uint8_t)(size >> 8)) /* XFERSIZEB1 */
|
((uint8_t)((size) >> 8)) /* XFERSIZEB1 */
|
||||||
|
|
||||||
#define IS_PROTECTED_AREA(add) (uint8_t)(((add >= 0x08000000) && (add < (APP_DEFAULT_ADD)))? 1:0)
|
#define IS_PROTECTED_AREA(add) (uint8_t)((((add) >= 0x08000000) && ((add) < (APP_DEFAULT_ADD)))? 1:0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -127,7 +127,7 @@ static uint8_t USBD_DFU_IsoINIncomplete (USBD_HandleTypeDef *pdev, uint8_t epnu
|
|||||||
|
|
||||||
static uint8_t USBD_DFU_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
static uint8_t USBD_DFU_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
#if (USBD_SUPPORT_USER_STRING == 1U)
|
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||||
static uint8_t *USBD_DFU_GetUsrStringDesc(USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length);
|
static uint8_t *USBD_DFU_GetUsrStringDesc(USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ USBD_ClassTypeDef USBD_DFU =
|
|||||||
USBD_DFU_GetCfgDesc,
|
USBD_DFU_GetCfgDesc,
|
||||||
USBD_DFU_GetCfgDesc,
|
USBD_DFU_GetCfgDesc,
|
||||||
USBD_DFU_GetDeviceQualifierDesc,
|
USBD_DFU_GetDeviceQualifierDesc,
|
||||||
#if (USBD_SUPPORT_USER_STRING == 1U)
|
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||||
USBD_DFU_GetUsrStringDesc
|
USBD_DFU_GetUsrStringDesc
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -681,7 +681,7 @@ static uint8_t *USBD_DFU_GetDeviceQualifierDesc (uint16_t *length)
|
|||||||
* @param length : pointer data length
|
* @param length : pointer data length
|
||||||
* @retval pointer to the descriptor table or NULL if the descriptor is not supported.
|
* @retval pointer to the descriptor table or NULL if the descriptor is not supported.
|
||||||
*/
|
*/
|
||||||
#if (USBD_SUPPORT_USER_STRING == 1U)
|
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||||
static uint8_t *USBD_DFU_GetUsrStringDesc(USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length)
|
static uint8_t *USBD_DFU_GetUsrStringDesc(USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length)
|
||||||
{
|
{
|
||||||
static uint8_t USBD_StrDesc[255];
|
static uint8_t USBD_StrDesc[255];
|
||||||
@@ -1013,7 +1013,8 @@ static void DFU_ClearStatus(USBD_HandleTypeDef *pdev)
|
|||||||
hdfu->dev_status[5] = 0U;/*iString*/
|
hdfu->dev_status[5] = 0U;/*iString*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /*State Error*/
|
{
|
||||||
|
/*State Error*/
|
||||||
hdfu->dev_state = DFU_STATE_ERROR;
|
hdfu->dev_state = DFU_STATE_ERROR;
|
||||||
hdfu->dev_status[0] = DFU_ERROR_UNKNOWN;/*bStatus*/
|
hdfu->dev_status[0] = DFU_ERROR_UNKNOWN;/*bStatus*/
|
||||||
hdfu->dev_status[1] = 0U;
|
hdfu->dev_status[1] = 0U;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -126,10 +126,13 @@ extern uint8_t ReadFormatCapacity_Data [];
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _SENSE_ITEM {
|
typedef struct _SENSE_ITEM
|
||||||
|
{
|
||||||
char Skey;
|
char Skey;
|
||||||
union {
|
union
|
||||||
struct _ASCs {
|
{
|
||||||
|
struct _ASCs
|
||||||
|
{
|
||||||
char ASC;
|
char ASC;
|
||||||
char ASCQ;
|
char ASCQ;
|
||||||
} b;
|
} b;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -80,31 +80,17 @@
|
|||||||
/** @defgroup MSC_CORE_Private_FunctionPrototypes
|
/** @defgroup MSC_CORE_Private_FunctionPrototypes
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
uint8_t USBD_MSC_Init (USBD_HandleTypeDef *pdev,
|
uint8_t USBD_MSC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
||||||
uint8_t cfgidx);
|
uint8_t USBD_MSC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
||||||
|
uint8_t USBD_MSC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
|
||||||
uint8_t USBD_MSC_DeInit (USBD_HandleTypeDef *pdev,
|
uint8_t USBD_MSC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
uint8_t cfgidx);
|
uint8_t USBD_MSC_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum);
|
||||||
|
|
||||||
uint8_t USBD_MSC_Setup (USBD_HandleTypeDef *pdev,
|
|
||||||
USBD_SetupReqTypedef *req);
|
|
||||||
|
|
||||||
uint8_t USBD_MSC_DataIn (USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t epnum);
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t USBD_MSC_DataOut (USBD_HandleTypeDef *pdev,
|
|
||||||
uint8_t epnum);
|
|
||||||
|
|
||||||
uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length);
|
uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length);
|
||||||
|
|
||||||
uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length);
|
uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length);
|
||||||
|
|
||||||
uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length);
|
uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length);
|
||||||
|
|
||||||
uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length);
|
uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -179,9 +165,8 @@ __ALIGN_BEGIN uint8_t USBD_MSC_CfgHSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
|||||||
|
|
||||||
/* USB Mass storage device Configuration Descriptor */
|
/* USB Mass storage device Configuration Descriptor */
|
||||||
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
|
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
|
||||||
uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
__ALIGN_BEGIN uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
||||||
{
|
{
|
||||||
|
|
||||||
0x09, /* bLength: Configuation Descriptor size */
|
0x09, /* bLength: Configuation Descriptor size */
|
||||||
USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */
|
USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */
|
||||||
USB_MSC_CONFIG_DESC_SIZ,
|
USB_MSC_CONFIG_DESC_SIZ,
|
||||||
@@ -223,7 +208,6 @@ uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
|||||||
|
|
||||||
__ALIGN_BEGIN uint8_t USBD_MSC_OtherSpeedCfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
__ALIGN_BEGIN uint8_t USBD_MSC_OtherSpeedCfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
|
||||||
{
|
{
|
||||||
|
|
||||||
0x09, /* bLength: Configuation Descriptor size */
|
0x09, /* bLength: Configuation Descriptor size */
|
||||||
USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,
|
USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,
|
||||||
USB_MSC_CONFIG_DESC_SIZ,
|
USB_MSC_CONFIG_DESC_SIZ,
|
||||||
@@ -355,6 +339,7 @@ uint8_t USBD_MSC_DeInit (USBD_HandleTypeDef *pdev,
|
|||||||
USBD_free(pdev->pClassData);
|
USBD_free(pdev->pClassData);
|
||||||
pdev->pClassData = NULL;
|
pdev->pClassData = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -372,7 +357,6 @@ uint8_t USBD_MSC_Setup (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
|||||||
|
|
||||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Class request */
|
/* Class request */
|
||||||
case USB_REQ_TYPE_CLASS:
|
case USB_REQ_TYPE_CLASS:
|
||||||
switch (req->bRequest)
|
switch (req->bRequest)
|
||||||
@@ -519,10 +503,10 @@ uint8_t USBD_MSC_Setup (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
|||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
uint8_t USBD_MSC_DataIn (USBD_HandleTypeDef *pdev,
|
uint8_t USBD_MSC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
uint8_t epnum)
|
|
||||||
{
|
{
|
||||||
MSC_BOT_DataIn(pdev, epnum);
|
MSC_BOT_DataIn(pdev, epnum);
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,10 +517,10 @@ uint8_t USBD_MSC_DataIn (USBD_HandleTypeDef *pdev,
|
|||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
uint8_t USBD_MSC_DataOut (USBD_HandleTypeDef *pdev,
|
uint8_t USBD_MSC_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
||||||
uint8_t epnum)
|
|
||||||
{
|
{
|
||||||
MSC_BOT_DataOut(pdev, epnum);
|
MSC_BOT_DataOut(pdev, epnum);
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,6 +533,7 @@ uint8_t USBD_MSC_DataOut (USBD_HandleTypeDef *pdev,
|
|||||||
uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length)
|
uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_MSC_CfgHSDesc);
|
*length = sizeof(USBD_MSC_CfgHSDesc);
|
||||||
|
|
||||||
return USBD_MSC_CfgHSDesc;
|
return USBD_MSC_CfgHSDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,6 +546,7 @@ uint8_t *USBD_MSC_GetHSCfgDesc (uint16_t *length)
|
|||||||
uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length)
|
uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_MSC_CfgFSDesc);
|
*length = sizeof(USBD_MSC_CfgFSDesc);
|
||||||
|
|
||||||
return USBD_MSC_CfgFSDesc;
|
return USBD_MSC_CfgFSDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,6 +559,7 @@ uint8_t *USBD_MSC_GetFSCfgDesc (uint16_t *length)
|
|||||||
uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length)
|
uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_MSC_OtherSpeedCfgDesc);
|
*length = sizeof(USBD_MSC_OtherSpeedCfgDesc);
|
||||||
|
|
||||||
return USBD_MSC_OtherSpeedCfgDesc;
|
return USBD_MSC_OtherSpeedCfgDesc;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -584,6 +571,7 @@ uint8_t *USBD_MSC_GetOtherSpeedCfgDesc (uint16_t *length)
|
|||||||
uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length)
|
uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length)
|
||||||
{
|
{
|
||||||
*length = sizeof(USBD_MSC_DeviceQualifierDesc);
|
*length = sizeof(USBD_MSC_DeviceQualifierDesc);
|
||||||
|
|
||||||
return USBD_MSC_DeviceQualifierDesc;
|
return USBD_MSC_DeviceQualifierDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,6 +587,7 @@ uint8_t USBD_MSC_RegisterStorage (USBD_HandleTypeDef *pdev,
|
|||||||
{
|
{
|
||||||
pdev->pUserData = fops;
|
pdev->pUserData = fops;
|
||||||
}
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +77,6 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
static void MSC_BOT_CBW_Decode(USBD_HandleTypeDef *pdev);
|
static void MSC_BOT_CBW_Decode(USBD_HandleTypeDef *pdev);
|
||||||
|
|
||||||
static void MSC_BOT_SendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
static void MSC_BOT_SendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
||||||
uint16_t len);
|
uint16_t len);
|
||||||
|
|
||||||
@@ -164,9 +163,7 @@ void MSC_BOT_DataIn (USBD_HandleTypeDef *pdev,
|
|||||||
switch (hmsc->bot_state)
|
switch (hmsc->bot_state)
|
||||||
{
|
{
|
||||||
case USBD_BOT_DATA_IN:
|
case USBD_BOT_DATA_IN:
|
||||||
if(SCSI_ProcessCmd(pdev,
|
if (SCSI_ProcessCmd(pdev, hmsc->cbw.bLUN, &hmsc->cbw.CB[0]) < 0)
|
||||||
hmsc->cbw.bLUN,
|
|
||||||
&hmsc->cbw.CB[0]) < 0)
|
|
||||||
{
|
{
|
||||||
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_FAILED);
|
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_FAILED);
|
||||||
}
|
}
|
||||||
@@ -175,7 +172,6 @@ void MSC_BOT_DataIn (USBD_HandleTypeDef *pdev,
|
|||||||
case USBD_BOT_SEND_DATA:
|
case USBD_BOT_SEND_DATA:
|
||||||
case USBD_BOT_LAST_DATA_IN:
|
case USBD_BOT_LAST_DATA_IN:
|
||||||
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_PASSED);
|
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_PASSED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -202,13 +198,10 @@ void MSC_BOT_DataOut (USBD_HandleTypeDef *pdev,
|
|||||||
|
|
||||||
case USBD_BOT_DATA_OUT:
|
case USBD_BOT_DATA_OUT:
|
||||||
|
|
||||||
if(SCSI_ProcessCmd(pdev,
|
if (SCSI_ProcessCmd(pdev, hmsc->cbw.bLUN, &hmsc->cbw.CB[0]) < 0)
|
||||||
hmsc->cbw.bLUN,
|
|
||||||
&hmsc->cbw.CB[0]) < 0)
|
|
||||||
{
|
{
|
||||||
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_FAILED);
|
MSC_BOT_SendCSW(pdev, USBD_CSW_CMD_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -67,7 +67,8 @@
|
|||||||
|
|
||||||
|
|
||||||
/* USB Mass storage Page 0 Inquiry Data */
|
/* USB Mass storage Page 0 Inquiry Data */
|
||||||
const uint8_t MSC_Page00_Inquiry_Data[] = {
|
const uint8_t MSC_Page00_Inquiry_Data[] =
|
||||||
|
{
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
@@ -77,7 +78,8 @@ const uint8_t MSC_Page00_Inquiry_Data[] = {
|
|||||||
0x83
|
0x83
|
||||||
};
|
};
|
||||||
/* USB Mass storage sense 6 Data */
|
/* USB Mass storage sense 6 Data */
|
||||||
const uint8_t MSC_Mode_Sense6_data[] = {
|
const uint8_t MSC_Mode_Sense6_data[] =
|
||||||
|
{
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
0x00,
|
0x00,
|
||||||
@@ -88,7 +90,8 @@ const uint8_t MSC_Mode_Sense6_data[] = {
|
|||||||
0x00
|
0x00
|
||||||
};
|
};
|
||||||
/* USB Mass storage sense 10 Data */
|
/* USB Mass storage sense 10 Data */
|
||||||
const uint8_t MSC_Mode_Sense10_data[] = {
|
const uint8_t MSC_Mode_Sense10_data[] =
|
||||||
|
{
|
||||||
0x00,
|
0x00,
|
||||||
0x06,
|
0x06,
|
||||||
0x00,
|
0x00,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -167,6 +167,7 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *cmd)
|
|||||||
SCSI_SenseCode(pdev, lun, ILLEGAL_REQUEST, INVALID_CDB);
|
SCSI_SenseCode(pdev, lun, ILLEGAL_REQUEST, INVALID_CDB);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +388,8 @@ static int8_t SCSI_RequestSense (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
|
|||||||
hmsc->bot_data[0] = 0x70U;
|
hmsc->bot_data[0] = 0x70U;
|
||||||
hmsc->bot_data[7] = REQUEST_SENSE_DATA_LEN - 6U;
|
hmsc->bot_data[7] = REQUEST_SENSE_DATA_LEN - 6U;
|
||||||
|
|
||||||
if((hmsc->scsi_sense_head != hmsc->scsi_sense_tail)) {
|
if ((hmsc->scsi_sense_head != hmsc->scsi_sense_tail))
|
||||||
|
{
|
||||||
|
|
||||||
hmsc->bot_data[2] = hmsc->scsi_sense[hmsc->scsi_sense_head].Skey;
|
hmsc->bot_data[2] = hmsc->scsi_sense[hmsc->scsi_sense_head].Skey;
|
||||||
hmsc->bot_data[12] = hmsc->scsi_sense[hmsc->scsi_sense_head].w.b.ASCQ;
|
hmsc->bot_data[12] = hmsc->scsi_sense[hmsc->scsi_sense_head].w.b.ASCQ;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -35,34 +35,30 @@
|
|||||||
/* Extern function prototypes ------------------------------------------------*/
|
/* Extern function prototypes ------------------------------------------------*/
|
||||||
/* Private functions ---------------------------------------------------------*/
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
#define STORAGE_LUN_NBR 1
|
#define STORAGE_LUN_NBR 1U
|
||||||
#define STORAGE_BLK_NBR 0x10000
|
#define STORAGE_BLK_NBR 0x10000U
|
||||||
#define STORAGE_BLK_SIZ 0x200
|
#define STORAGE_BLK_SIZ 0x200U
|
||||||
|
|
||||||
int8_t STORAGE_Init(uint8_t lun);
|
int8_t STORAGE_Init(uint8_t lun);
|
||||||
|
|
||||||
int8_t STORAGE_GetCapacity (uint8_t lun,
|
int8_t STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num,
|
||||||
uint32_t *block_num,
|
|
||||||
uint16_t *block_size);
|
uint16_t *block_size);
|
||||||
|
|
||||||
int8_t STORAGE_IsReady(uint8_t lun);
|
int8_t STORAGE_IsReady(uint8_t lun);
|
||||||
|
|
||||||
int8_t STORAGE_IsWriteProtected(uint8_t lun);
|
int8_t STORAGE_IsWriteProtected(uint8_t lun);
|
||||||
|
|
||||||
int8_t STORAGE_Read (uint8_t lun,
|
int8_t STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr,
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr,
|
|
||||||
uint16_t blk_len);
|
uint16_t blk_len);
|
||||||
|
|
||||||
int8_t STORAGE_Write (uint8_t lun,
|
int8_t STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr,
|
||||||
uint8_t *buf,
|
|
||||||
uint32_t blk_addr,
|
|
||||||
uint16_t blk_len);
|
uint16_t blk_len);
|
||||||
|
|
||||||
int8_t STORAGE_GetMaxLun(void);
|
int8_t STORAGE_GetMaxLun(void);
|
||||||
|
|
||||||
/* USB Mass storage Standard Inquiry Data */
|
/* USB Mass storage Standard Inquiry Data */
|
||||||
int8_t STORAGE_Inquirydata[] = {//36
|
int8_t STORAGE_Inquirydata[] = /* 36 */
|
||||||
|
{
|
||||||
|
|
||||||
/* LUN 0 */
|
/* LUN 0 */
|
||||||
0x00,
|
0x00,
|
||||||
@@ -148,10 +144,8 @@ int8_t STORAGE_IsWriteProtected (uint8_t lun)
|
|||||||
* Output : None.
|
* Output : None.
|
||||||
* Return : None.
|
* Return : None.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
int8_t STORAGE_Read (uint8_t lun,
|
int8_t STORAGE_Read(uint8_t lun, uint8_t *buf,
|
||||||
uint8_t *buf,
|
uint32_t blk_addr, uint16_t blk_len)
|
||||||
uint32_t blk_addr,
|
|
||||||
uint16_t blk_len)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -162,10 +156,8 @@ int8_t STORAGE_Read (uint8_t lun,
|
|||||||
* Output : None.
|
* Output : None.
|
||||||
* Return : None.
|
* Return : None.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
int8_t STORAGE_Write (uint8_t lun,
|
int8_t STORAGE_Write(uint8_t lun, uint8_t *buf,
|
||||||
uint8_t *buf,
|
uint32_t blk_addr, uint16_t blk_len)
|
||||||
uint32_t blk_addr,
|
|
||||||
uint16_t blk_len)
|
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
#define USBD_MAX_NUM_INTERFACES 1U
|
#define USBD_MAX_NUM_INTERFACES 1U
|
||||||
#define USBD_MAX_NUM_CONFIGURATION 1U
|
#define USBD_MAX_NUM_CONFIGURATION 1U
|
||||||
#define USBD_MAX_STR_DESC_SIZ 0x100U
|
#define USBD_MAX_STR_DESC_SIZ 0x100U
|
||||||
#define USBD_SUPPORT_USER_STRING 0U
|
#define USBD_SUPPORT_USER_STRING_DESC 0U
|
||||||
#define USBD_SELF_POWERED 1U
|
#define USBD_SELF_POWERED 1U
|
||||||
#define USBD_DEBUG_LEVEL 2U
|
#define USBD_DEBUG_LEVEL 2U
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -61,9 +61,9 @@
|
|||||||
#define USBD_SELF_POWERED 1U
|
#define USBD_SELF_POWERED 1U
|
||||||
#endif /*USBD_SELF_POWERED */
|
#endif /*USBD_SELF_POWERED */
|
||||||
|
|
||||||
#ifndef USBD_SUPPORT_USER_STRING
|
#ifndef USBD_SUPPORT_USER_STRING_DESC
|
||||||
#define USBD_SUPPORT_USER_STRING 0U
|
#define USBD_SUPPORT_USER_STRING_DESC 0U
|
||||||
#endif /* USBD_SUPPORT_USER_STRING */
|
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||||
|
|
||||||
#define USB_LEN_DEV_QUALIFIER_DESC 0x0AU
|
#define USB_LEN_DEV_QUALIFIER_DESC 0x0AU
|
||||||
#define USB_LEN_DEV_DESC 0x12U
|
#define USB_LEN_DEV_DESC 0x12U
|
||||||
@@ -158,7 +158,6 @@
|
|||||||
|
|
||||||
typedef struct usb_setup_req
|
typedef struct usb_setup_req
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t bmRequest;
|
uint8_t bmRequest;
|
||||||
uint8_t bRequest;
|
uint8_t bRequest;
|
||||||
uint16_t wValue;
|
uint16_t wValue;
|
||||||
@@ -187,7 +186,7 @@ typedef struct _Device_cb
|
|||||||
uint8_t *(*GetFSConfigDescriptor)(uint16_t *length);
|
uint8_t *(*GetFSConfigDescriptor)(uint16_t *length);
|
||||||
uint8_t *(*GetOtherSpeedConfigDescriptor)(uint16_t *length);
|
uint8_t *(*GetOtherSpeedConfigDescriptor)(uint16_t *length);
|
||||||
uint8_t *(*GetDeviceQualifierDescriptor)(uint16_t *length);
|
uint8_t *(*GetDeviceQualifierDescriptor)(uint16_t *length);
|
||||||
#if (USBD_SUPPORT_USER_STRING == 1U)
|
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||||
uint8_t *(*GetUsrStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length);
|
uint8_t *(*GetUsrStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -202,7 +201,8 @@ typedef enum
|
|||||||
} USBD_SpeedTypeDef;
|
} USBD_SpeedTypeDef;
|
||||||
|
|
||||||
/* Following USB Device status */
|
/* Following USB Device status */
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
USBD_OK = 0U,
|
USBD_OK = 0U,
|
||||||
USBD_BUSY,
|
USBD_BUSY,
|
||||||
USBD_FAIL,
|
USBD_FAIL,
|
||||||
@@ -241,8 +241,8 @@ typedef struct _USBD_HandleTypeDef
|
|||||||
uint32_t dev_default_config;
|
uint32_t dev_default_config;
|
||||||
uint32_t dev_config_status;
|
uint32_t dev_config_status;
|
||||||
USBD_SpeedTypeDef dev_speed;
|
USBD_SpeedTypeDef dev_speed;
|
||||||
USBD_EndpointTypeDef ep_in[15];
|
USBD_EndpointTypeDef ep_in[16];
|
||||||
USBD_EndpointTypeDef ep_out[15];
|
USBD_EndpointTypeDef ep_out[16];
|
||||||
uint32_t ep0_state;
|
uint32_t ep0_state;
|
||||||
uint32_t ep0_data_len;
|
uint32_t ep0_data_len;
|
||||||
uint8_t dev_state;
|
uint8_t dev_state;
|
||||||
@@ -272,8 +272,8 @@ typedef struct _USBD_HandleTypeDef
|
|||||||
#define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
|
#define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
|
||||||
(((uint16_t)(*(((uint8_t *)(addr)) + 1U))) << 8U))
|
(((uint16_t)(*(((uint8_t *)(addr)) + 1U))) << 8U))
|
||||||
|
|
||||||
#define LOBYTE(x) ((uint8_t)(x & 0x00FFU))
|
#define LOBYTE(x) ((uint8_t)((x) & 0x00FFU))
|
||||||
#define HIBYTE(x) ((uint8_t)((x & 0xFF00U) >> 8U))
|
#define HIBYTE(x) ((uint8_t)(((x) & 0xFF00U) >> 8U))
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
@@ -291,18 +291,24 @@ typedef struct _USBD_HandleTypeDef
|
|||||||
/* In HS mode and when the DMA is used, all variables and data structures dealing
|
/* In HS mode and when the DMA is used, all variables and data structures dealing
|
||||||
with the DMA during the transaction process should be 4-bytes aligned */
|
with the DMA during the transaction process should be 4-bytes aligned */
|
||||||
|
|
||||||
#if defined (__GNUC__) /* GNU Compiler */
|
#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
|
||||||
#define __ALIGN_END __attribute__ ((aligned (4)))
|
#ifndef __ALIGN_END
|
||||||
|
#define __ALIGN_END __attribute__ ((aligned (4U)))
|
||||||
|
#endif /* __ALIGN_END */
|
||||||
|
#ifndef __ALIGN_BEGIN
|
||||||
#define __ALIGN_BEGIN
|
#define __ALIGN_BEGIN
|
||||||
|
#endif /* __ALIGN_BEGIN */
|
||||||
#else
|
#else
|
||||||
|
#ifndef __ALIGN_END
|
||||||
#define __ALIGN_END
|
#define __ALIGN_END
|
||||||
|
#endif /* __ALIGN_END */
|
||||||
|
#ifndef __ALIGN_BEGIN
|
||||||
#if defined (__CC_ARM) /* ARM Compiler */
|
#if defined (__CC_ARM) /* ARM Compiler */
|
||||||
#define __ALIGN_BEGIN __align(4)
|
#define __ALIGN_BEGIN __align(4U)
|
||||||
#elif defined (__ICCARM__) /* IAR Compiler */
|
#elif defined (__ICCARM__) /* IAR Compiler */
|
||||||
#define __ALIGN_BEGIN
|
#define __ALIGN_BEGIN
|
||||||
#elif defined (__TASKING__) /* TASKING Compiler */
|
|
||||||
#define __ALIGN_BEGIN __align(4)
|
|
||||||
#endif /* __CC_ARM */
|
#endif /* __CC_ARM */
|
||||||
|
#endif /* __ALIGN_BEGIN */
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* @file usbd_conf_template.c
|
* @file usbd_conf_template.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief USB Device configuration and interface file
|
* @brief USB Device configuration and interface file
|
||||||
* This template should be copied to the user folder, renamed and customized
|
* This template should be copied to the user folder,
|
||||||
* following user needs.
|
* renamed and customized following user needs.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -75,10 +75,8 @@ USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
|
|||||||
* @param ep_mps: Endpoint Max Packet Size
|
* @param ep_mps: Endpoint Max Packet Size
|
||||||
* @retval USBD Status
|
* @retval USBD Status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev,
|
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr,
|
||||||
uint8_t ep_addr,
|
uint8_t ep_type, uint16_t ep_mps)
|
||||||
uint8_t ep_type,
|
|
||||||
uint16_t ep_mps)
|
|
||||||
{
|
{
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
@@ -122,7 +120,8 @@ USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|||||||
* @param ep_addr: Endpoint Number
|
* @param ep_addr: Endpoint Number
|
||||||
* @retval USBD Status
|
* @retval USBD Status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev,
|
||||||
|
uint8_t ep_addr)
|
||||||
{
|
{
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
@@ -144,7 +143,8 @@ uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|||||||
* @param ep_addr: Endpoint Number
|
* @param ep_addr: Endpoint Number
|
||||||
* @retval USBD Status
|
* @retval USBD Status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr)
|
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev,
|
||||||
|
uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
@@ -157,10 +157,8 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
|
|||||||
* @param size: Data size
|
* @param size: Data size
|
||||||
* @retval USBD Status
|
* @retval USBD Status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
|
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr,
|
||||||
uint8_t ep_addr,
|
uint8_t *pbuf, uint16_t size)
|
||||||
uint8_t *pbuf,
|
|
||||||
uint16_t size)
|
|
||||||
{
|
{
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
@@ -174,8 +172,7 @@ USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev,
|
|||||||
* @retval USBD Status
|
* @retval USBD Status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
|
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
|
||||||
uint8_t ep_addr,
|
uint8_t ep_addr, uint8_t *pbuf,
|
||||||
uint8_t *pbuf,
|
|
||||||
uint16_t size)
|
uint16_t size)
|
||||||
{
|
{
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
@@ -189,7 +186,7 @@ USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
|
|||||||
*/
|
*/
|
||||||
uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
/** @defgroup USBD_CORE_Private_TypesDefinitions
|
/** @defgroup USBD_CORE_Private_TypesDefinitions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -50,13 +51,12 @@
|
|||||||
/** @defgroup USBD_CORE_Private_Macros
|
/** @defgroup USBD_CORE_Private_Macros
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CORE_Private_FunctionPrototypes
|
/** @defgroup USBD_CORE_Private_FunctionPrototypes
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** @defgroup USBD_CORE_Private_Functions
|
/** @defgroup USBD_CORE_Private_Functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
@@ -85,7 +86,8 @@
|
|||||||
* @param id: Low level core index
|
* @param id: Low level core index
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id)
|
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,
|
||||||
|
USBD_DescriptorsTypeDef *pdesc, uint8_t id)
|
||||||
{
|
{
|
||||||
/* Check whether the USB Host handle is valid */
|
/* Check whether the USB Host handle is valid */
|
||||||
if (pdev == NULL)
|
if (pdev == NULL)
|
||||||
@@ -150,7 +152,7 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
|
|||||||
USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass)
|
USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass)
|
||||||
{
|
{
|
||||||
USBD_StatusTypeDef status = USBD_OK;
|
USBD_StatusTypeDef status = USBD_OK;
|
||||||
if(pclass != 0)
|
if (pclass != NULL)
|
||||||
{
|
{
|
||||||
/* link the class to the USB Device handle */
|
/* link the class to the USB Device handle */
|
||||||
pdev->pClass = pclass;
|
pdev->pClass = pclass;
|
||||||
@@ -175,7 +177,6 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeD
|
|||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev)
|
USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Start the low level driver */
|
/* Start the low level driver */
|
||||||
USBD_LL_Start(pdev);
|
USBD_LL_Start(pdev);
|
||||||
|
|
||||||
@@ -248,6 +249,7 @@ USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx
|
|||||||
{
|
{
|
||||||
/* Clear configuration and De-initialize the Class process*/
|
/* Clear configuration and De-initialize the Class process*/
|
||||||
pdev->pClass->DeInit(pdev, cfgidx);
|
pdev->pClass->DeInit(pdev, cfgidx);
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,8 +312,7 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
|
|||||||
{
|
{
|
||||||
pep->rem_length -= pep->maxpacket;
|
pep->rem_length -= pep->maxpacket;
|
||||||
|
|
||||||
USBD_CtlContinueRx (pdev,
|
USBD_CtlContinueRx(pdev, pdata,
|
||||||
pdata,
|
|
||||||
(uint16_t)MIN(pep->rem_length, pep->maxpacket));
|
(uint16_t)MIN(pep->rem_length, pep->maxpacket));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -357,8 +358,8 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
|
|||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum,
|
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
|
||||||
uint8_t *pdata)
|
uint8_t epnum, uint8_t *pdata)
|
||||||
{
|
{
|
||||||
USBD_EndpointTypeDef *pep;
|
USBD_EndpointTypeDef *pep;
|
||||||
|
|
||||||
@@ -378,7 +379,8 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum,
|
|||||||
USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U);
|
USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* last packet is MPS multiple, so send ZLP packet */
|
{
|
||||||
|
/* last packet is MPS multiple, so send ZLP packet */
|
||||||
if ((pep->total_length % pep->maxpacket == 0U) &&
|
if ((pep->total_length % pep->maxpacket == 0U) &&
|
||||||
(pep->total_length >= pep->maxpacket) &&
|
(pep->total_length >= pep->maxpacket) &&
|
||||||
(pep->total_length < pdev->ep0_data_len))
|
(pep->total_length < pdev->ep0_data_len))
|
||||||
@@ -450,6 +452,7 @@ USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
|
|||||||
pdev->ep_in[0x80U & 0xFU].is_used = 1U;
|
pdev->ep_in[0x80U & 0xFU].is_used = 1U;
|
||||||
|
|
||||||
pdev->ep_in[0].maxpacket = USB_MAX_EP0_SIZE;
|
pdev->ep_in[0].maxpacket = USB_MAX_EP0_SIZE;
|
||||||
|
|
||||||
/* Upon Reset call user call back */
|
/* Upon Reset call user call back */
|
||||||
pdev->dev_state = USBD_STATE_DEFAULT;
|
pdev->dev_state = USBD_STATE_DEFAULT;
|
||||||
pdev->ep0_state = USBD_EP0_IDLE;
|
pdev->ep0_state = USBD_EP0_IDLE;
|
||||||
@@ -470,9 +473,11 @@ USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
|
|||||||
* @param pdev: device instance
|
* @param pdev: device instance
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed)
|
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev,
|
||||||
|
USBD_SpeedTypeDef speed)
|
||||||
{
|
{
|
||||||
pdev->dev_speed = speed;
|
pdev->dev_speed = speed;
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,6 +492,7 @@ USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
|
|||||||
{
|
{
|
||||||
pdev->dev_old_state = pdev->dev_state;
|
pdev->dev_old_state = pdev->dev_state;
|
||||||
pdev->dev_state = USBD_STATE_SUSPENDED;
|
pdev->dev_state = USBD_STATE_SUSPENDED;
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,8 +504,12 @@ USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
|
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
|
||||||
|
{
|
||||||
|
if (pdev->dev_state == USBD_STATE_SUSPENDED)
|
||||||
{
|
{
|
||||||
pdev->dev_state = pdev->dev_old_state;
|
pdev->dev_state = pdev->dev_old_state;
|
||||||
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,6 +529,7 @@ USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
|
|||||||
pdev->pClass->SOF(pdev);
|
pdev->pClass->SOF(pdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +539,8 @@ USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
|
|||||||
* @param pdev: device instance
|
* @param pdev: device instance
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev,
|
||||||
|
uint8_t epnum)
|
||||||
{
|
{
|
||||||
/* Prevent unused arguments compilation warning */
|
/* Prevent unused arguments compilation warning */
|
||||||
UNUSED(pdev);
|
UNUSED(pdev);
|
||||||
@@ -543,7 +555,8 @@ USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t ep
|
|||||||
* @param pdev: device instance
|
* @param pdev: device instance
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
|
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev,
|
||||||
|
uint8_t epnum)
|
||||||
{
|
{
|
||||||
/* Prevent unused arguments compilation warning */
|
/* Prevent unused arguments compilation warning */
|
||||||
UNUSED(pdev);
|
UNUSED(pdev);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
/** @defgroup USBD_REQ_Private_TypesDefinitions
|
/** @defgroup USBD_REQ_Private_TypesDefinitions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
/** @defgroup USBD_REQ_Private_Macros
|
/** @defgroup USBD_REQ_Private_Macros
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +62,7 @@
|
|||||||
/** @defgroup USBD_REQ_Private_Variables
|
/** @defgroup USBD_REQ_Private_Variables
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -108,7 +111,8 @@ static uint8_t USBD_GetLen(uint8_t *buf);
|
|||||||
* @param req: usb request
|
* @param req: usb request
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
|
USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev,
|
||||||
|
USBD_SetupReqTypedef *req)
|
||||||
{
|
{
|
||||||
USBD_StatusTypeDef ret = USBD_OK;
|
USBD_StatusTypeDef ret = USBD_OK;
|
||||||
|
|
||||||
@@ -120,11 +124,9 @@ USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_REQ_TYPE_STANDARD:
|
case USB_REQ_TYPE_STANDARD:
|
||||||
|
|
||||||
switch (req->bRequest)
|
switch (req->bRequest)
|
||||||
{
|
{
|
||||||
case USB_REQ_GET_DESCRIPTOR:
|
case USB_REQ_GET_DESCRIPTOR:
|
||||||
|
|
||||||
USBD_GetDescriptor(pdev, req);
|
USBD_GetDescriptor(pdev, req);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -144,7 +146,6 @@ USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
|
|||||||
USBD_GetStatus(pdev, req);
|
USBD_GetStatus(pdev, req);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case USB_REQ_SET_FEATURE:
|
case USB_REQ_SET_FEATURE:
|
||||||
USBD_SetFeature(pdev, req);
|
USBD_SetFeature(pdev, req);
|
||||||
break;
|
break;
|
||||||
@@ -174,7 +175,8 @@ USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
|
|||||||
* @param req: usb request
|
* @param req: usb request
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
|
USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev,
|
||||||
|
USBD_SetupReqTypedef *req)
|
||||||
{
|
{
|
||||||
USBD_StatusTypeDef ret = USBD_OK;
|
USBD_StatusTypeDef ret = USBD_OK;
|
||||||
|
|
||||||
@@ -225,17 +227,16 @@ USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
|
|||||||
* @param req: usb request
|
* @param req: usb request
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
|
USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev,
|
||||||
|
USBD_SetupReqTypedef *req)
|
||||||
{
|
{
|
||||||
|
USBD_EndpointTypeDef *pep;
|
||||||
uint8_t ep_addr;
|
uint8_t ep_addr;
|
||||||
USBD_StatusTypeDef ret = USBD_OK;
|
USBD_StatusTypeDef ret = USBD_OK;
|
||||||
USBD_EndpointTypeDef *pep;
|
|
||||||
ep_addr = LOBYTE(req->wIndex);
|
ep_addr = LOBYTE(req->wIndex);
|
||||||
|
|
||||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||||
{
|
{
|
||||||
|
|
||||||
case USB_REQ_TYPE_CLASS:
|
case USB_REQ_TYPE_CLASS:
|
||||||
case USB_REQ_TYPE_VENDOR:
|
case USB_REQ_TYPE_VENDOR:
|
||||||
pdev->pClass->Setup(pdev, req);
|
pdev->pClass->Setup(pdev, req);
|
||||||
@@ -252,9 +253,7 @@ USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTyped
|
|||||||
|
|
||||||
switch (req->bRequest)
|
switch (req->bRequest)
|
||||||
{
|
{
|
||||||
|
|
||||||
case USB_REQ_SET_FEATURE:
|
case USB_REQ_SET_FEATURE:
|
||||||
|
|
||||||
switch (pdev->dev_state)
|
switch (pdev->dev_state)
|
||||||
{
|
{
|
||||||
case USBD_STATE_ADDRESSED:
|
case USBD_STATE_ADDRESSED:
|
||||||
@@ -272,7 +271,8 @@ USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTyped
|
|||||||
case USBD_STATE_CONFIGURED:
|
case USBD_STATE_CONFIGURED:
|
||||||
if (req->wValue == USB_FEATURE_EP_HALT)
|
if (req->wValue == USB_FEATURE_EP_HALT)
|
||||||
{
|
{
|
||||||
if ((ep_addr != 0x00U) && (ep_addr != 0x80U) && (req->wLength == 0x00U))
|
if ((ep_addr != 0x00U) &&
|
||||||
|
(ep_addr != 0x80U) && (req->wLength == 0x00U))
|
||||||
{
|
{
|
||||||
USBD_LL_StallEP(pdev, ep_addr);
|
USBD_LL_StallEP(pdev, ep_addr);
|
||||||
}
|
}
|
||||||
@@ -393,6 +393,8 @@ USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTyped
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USBD_GetDescriptor
|
* @brief USBD_GetDescriptor
|
||||||
* Handle Get Descriptor requests
|
* Handle Get Descriptor requests
|
||||||
@@ -403,15 +405,23 @@ USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTyped
|
|||||||
static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev,
|
static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev,
|
||||||
USBD_SetupReqTypedef *req)
|
USBD_SetupReqTypedef *req)
|
||||||
{
|
{
|
||||||
uint16_t len;
|
uint16_t len = 0U;
|
||||||
uint8_t *pbuf;
|
uint8_t *pbuf = NULL;
|
||||||
|
uint8_t err = 0U;
|
||||||
|
|
||||||
switch (req->wValue >> 8)
|
switch (req->wValue >> 8)
|
||||||
{
|
{
|
||||||
#if (USBD_LPM_ENABLED == 1U)
|
#if (USBD_LPM_ENABLED == 1U)
|
||||||
case USB_DESC_TYPE_BOS:
|
case USB_DESC_TYPE_BOS:
|
||||||
|
if (pdev->pDesc->GetBOSDescriptor != NULL)
|
||||||
|
{
|
||||||
pbuf = pdev->pDesc->GetBOSDescriptor(pdev->dev_speed, &len);
|
pbuf = pdev->pDesc->GetBOSDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case USB_DESC_TYPE_DEVICE:
|
case USB_DESC_TYPE_DEVICE:
|
||||||
@@ -421,12 +431,12 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
|
|||||||
case USB_DESC_TYPE_CONFIGURATION:
|
case USB_DESC_TYPE_CONFIGURATION:
|
||||||
if (pdev->dev_speed == USBD_SPEED_HIGH)
|
if (pdev->dev_speed == USBD_SPEED_HIGH)
|
||||||
{
|
{
|
||||||
pbuf = (uint8_t *)pdev->pClass->GetHSConfigDescriptor(&len);
|
pbuf = pdev->pClass->GetHSConfigDescriptor(&len);
|
||||||
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
|
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pbuf = (uint8_t *)pdev->pClass->GetFSConfigDescriptor(&len);
|
pbuf = pdev->pClass->GetFSConfigDescriptor(&len);
|
||||||
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
|
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -435,81 +445,143 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
|
|||||||
switch ((uint8_t)(req->wValue))
|
switch ((uint8_t)(req->wValue))
|
||||||
{
|
{
|
||||||
case USBD_IDX_LANGID_STR:
|
case USBD_IDX_LANGID_STR:
|
||||||
pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len);
|
if (pdev->pDesc->GetLangIDStrDescriptor != NULL)
|
||||||
break;
|
|
||||||
|
|
||||||
case USBD_IDX_MFC_STR:
|
|
||||||
pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev->dev_speed, &len);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USBD_IDX_PRODUCT_STR:
|
|
||||||
pbuf = pdev->pDesc->GetProductStrDescriptor(pdev->dev_speed, &len);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USBD_IDX_SERIAL_STR:
|
|
||||||
pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev->dev_speed, &len);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USBD_IDX_CONFIG_STR:
|
|
||||||
pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev->dev_speed, &len);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USBD_IDX_INTERFACE_STR:
|
|
||||||
pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev->dev_speed, &len);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
#if (USBD_SUPPORT_USER_STRING == 1U)
|
|
||||||
pbuf = pdev->pClass->GetUsrStrDescriptor(pdev, (req->wValue) , &len);
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
USBD_CtlError(pdev , req);
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case USB_DESC_TYPE_DEVICE_QUALIFIER:
|
|
||||||
|
|
||||||
if(pdev->dev_speed == USBD_SPEED_HIGH)
|
|
||||||
{
|
{
|
||||||
pbuf = (uint8_t *)pdev->pClass->GetDeviceQualifierDescriptor(&len);
|
pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
USBD_CtlError(pdev, req);
|
USBD_CtlError(pdev, req);
|
||||||
return;
|
err++;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBD_IDX_MFC_STR:
|
||||||
|
if (pdev->pDesc->GetManufacturerStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBD_IDX_PRODUCT_STR:
|
||||||
|
if (pdev->pDesc->GetProductStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pDesc->GetProductStrDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBD_IDX_SERIAL_STR:
|
||||||
|
if (pdev->pDesc->GetSerialStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBD_IDX_CONFIG_STR:
|
||||||
|
if (pdev->pDesc->GetConfigurationStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBD_IDX_INTERFACE_STR:
|
||||||
|
if (pdev->pDesc->GetInterfaceStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev->dev_speed, &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||||
|
if (pdev->pClass->GetUsrStrDescriptor != NULL)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pClass->GetUsrStrDescriptor(pdev, (req->wValue), &len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USB_DESC_TYPE_DEVICE_QUALIFIER:
|
||||||
|
if (pdev->dev_speed == USBD_SPEED_HIGH)
|
||||||
|
{
|
||||||
|
pbuf = pdev->pClass->GetDeviceQualifierDescriptor(&len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBD_CtlError(pdev, req);
|
||||||
|
err++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION:
|
case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION:
|
||||||
if (pdev->dev_speed == USBD_SPEED_HIGH)
|
if (pdev->dev_speed == USBD_SPEED_HIGH)
|
||||||
{
|
{
|
||||||
pbuf = (uint8_t *)pdev->pClass->GetOtherSpeedConfigDescriptor(&len);
|
pbuf = pdev->pClass->GetOtherSpeedConfigDescriptor(&len);
|
||||||
pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
|
pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
USBD_CtlError(pdev, req);
|
USBD_CtlError(pdev, req);
|
||||||
return;
|
err++;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
USBD_CtlError(pdev, req);
|
USBD_CtlError(pdev, req);
|
||||||
return;
|
err++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err != 0U)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((len != 0U) && (req->wLength != 0U))
|
if ((len != 0U) && (req->wLength != 0U))
|
||||||
{
|
{
|
||||||
|
|
||||||
len = MIN(len, req->wLength);
|
len = MIN(len, req->wLength);
|
||||||
|
(void)USBD_CtlSendData(pdev, pbuf, len);
|
||||||
USBD_CtlSendData (pdev, pbuf, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->wLength == 0U)
|
if (req->wLength == 0U)
|
||||||
{
|
{
|
||||||
USBD_CtlSendStatus(pdev);
|
(void)USBD_CtlSendStatus(pdev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,13 +787,11 @@ static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
|||||||
static void USBD_SetFeature(USBD_HandleTypeDef *pdev,
|
static void USBD_SetFeature(USBD_HandleTypeDef *pdev,
|
||||||
USBD_SetupReqTypedef *req)
|
USBD_SetupReqTypedef *req)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
|
if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
|
||||||
{
|
{
|
||||||
pdev->dev_remote_wakeup = 1U;
|
pdev->dev_remote_wakeup = 1U;
|
||||||
USBD_CtlSendStatus(pdev);
|
USBD_CtlSendStatus(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -764,10 +834,10 @@ static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
|
|||||||
void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
|
void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
|
||||||
{
|
{
|
||||||
req->bmRequest = *(uint8_t *)(pdata);
|
req->bmRequest = *(uint8_t *)(pdata);
|
||||||
req->bRequest = *(uint8_t *) (pdata + 1);
|
req->bRequest = *(uint8_t *)(pdata + 1U);
|
||||||
req->wValue = SWAPBYTE (pdata + 2);
|
req->wValue = SWAPBYTE(pdata + 2U);
|
||||||
req->wIndex = SWAPBYTE (pdata + 4);
|
req->wIndex = SWAPBYTE(pdata + 4U);
|
||||||
req->wLength = SWAPBYTE (pdata + 6);
|
req->wLength = SWAPBYTE(pdata + 6U);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* @file usbd_desc_template.c
|
* @file usbd_desc_template.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file provides the USBD descriptors and string formatting method.
|
* @brief This file provides the USBD descriptors and string formatting method.
|
||||||
* This template should be copied to the user folder, renamed and customized
|
* This template should be copied to the user folder,
|
||||||
* following user needs.
|
* renamed and customized following user needs.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -46,12 +46,13 @@ uint8_t *USBD_Class_ProductStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *len
|
|||||||
uint8_t *USBD_Class_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
uint8_t *USBD_Class_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||||
uint8_t *USBD_Class_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
uint8_t *USBD_Class_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||||
uint8_t *USBD_Class_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
uint8_t *USBD_Class_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||||
#ifdef USB_SUPPORT_USER_STRING_DESC
|
#ifdef USBD_SUPPORT_USER_STRING_DESC
|
||||||
uint8_t *USBD_Class_USRStringDesc(USBD_SpeedTypeDef speed, uint8_t idx, uint16_t *length);
|
uint8_t *USBD_Class_USRStringDesc(USBD_SpeedTypeDef speed, uint8_t idx, uint16_t *length);
|
||||||
#endif /* USB_SUPPORT_USER_STRING_DESC */
|
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
USBD_DescriptorsTypeDef Class_Desc = {
|
USBD_DescriptorsTypeDef Class_Desc =
|
||||||
|
{
|
||||||
USBD_Class_DeviceDescriptor,
|
USBD_Class_DeviceDescriptor,
|
||||||
USBD_Class_LangIDStrDescriptor,
|
USBD_Class_LangIDStrDescriptor,
|
||||||
USBD_Class_ManufacturerStrDescriptor,
|
USBD_Class_ManufacturerStrDescriptor,
|
||||||
@@ -65,7 +66,8 @@ USBD_DescriptorsTypeDef Class_Desc = {
|
|||||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||||
#pragma data_alignment=4
|
#pragma data_alignment=4
|
||||||
#endif
|
#endif
|
||||||
__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END = {
|
__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
||||||
|
{
|
||||||
0x12, /* bLength */
|
0x12, /* bLength */
|
||||||
USB_DESC_TYPE_DEVICE, /* bDescriptorType */
|
USB_DESC_TYPE_DEVICE, /* bDescriptorType */
|
||||||
0x00, /* bcdUSB */
|
0x00, /* bcdUSB */
|
||||||
@@ -90,7 +92,8 @@ __ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END = {
|
|||||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||||
#pragma data_alignment=4
|
#pragma data_alignment=4
|
||||||
#endif
|
#endif
|
||||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END = {
|
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
||||||
|
{
|
||||||
USB_LEN_LANGID_STR_DESC,
|
USB_LEN_LANGID_STR_DESC,
|
||||||
USB_DESC_TYPE_STRING,
|
USB_DESC_TYPE_STRING,
|
||||||
LOBYTE(USBD_LANGID_STRING),
|
LOBYTE(USBD_LANGID_STRING),
|
||||||
@@ -236,10 +239,10 @@ static void Get_SerialNum(void)
|
|||||||
|
|
||||||
deviceserial0 += deviceserial2;
|
deviceserial0 += deviceserial2;
|
||||||
|
|
||||||
if (deviceserial0 != 0)
|
if (deviceserial0 != 0U)
|
||||||
{
|
{
|
||||||
IntToUnicode (deviceserial0, &USBD_StringSerial[2] ,8);
|
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8U);
|
||||||
IntToUnicode (deviceserial1, &USBD_StringSerial[18] ,4);
|
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,22 +255,22 @@ static void Get_SerialNum(void)
|
|||||||
*/
|
*/
|
||||||
static void IntToUnicode(uint32_t value, uint8_t *pbuf, uint8_t len)
|
static void IntToUnicode(uint32_t value, uint8_t *pbuf, uint8_t len)
|
||||||
{
|
{
|
||||||
uint8_t idx = 0;
|
uint8_t idx = 0U;
|
||||||
|
|
||||||
for( idx = 0 ; idx < len ; idx ++)
|
for (idx = 0U ; idx < len ; idx ++)
|
||||||
{
|
{
|
||||||
if( ((value >> 28)) < 0xA )
|
if (((value >> 28)) < 0xAU)
|
||||||
{
|
{
|
||||||
pbuf[ 2* idx] = (value >> 28) + '0';
|
pbuf[ 2U * idx] = (value >> 28) + '0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pbuf[2* idx] = (value >> 28) + 'A' - 10;
|
pbuf[2U * idx] = (value >> 28) + 'A' - 10U;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = value << 4;
|
value = value << 4;
|
||||||
|
|
||||||
pbuf[ 2* idx + 1] = 0;
|
pbuf[2U * idx + 1] = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* This software component is licensed by ST under Ultimate Liberty license
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* http://www.st.com/SLA0044
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
* @param len: length of data to be sent
|
* @param len: length of data to be sent
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev,
|
||||||
uint16_t len)
|
uint8_t *pbuf, uint16_t len)
|
||||||
{
|
{
|
||||||
/* Set EP0 State */
|
/* Set EP0 State */
|
||||||
pdev->ep0_state = USBD_EP0_DATA_IN;
|
pdev->ep0_state = USBD_EP0_DATA_IN;
|
||||||
@@ -123,8 +123,8 @@ USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
|
|||||||
* @param len: length of data to be received
|
* @param len: length of data to be received
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev,
|
||||||
uint16_t len)
|
uint8_t *pbuf, uint16_t len)
|
||||||
{
|
{
|
||||||
/* Set EP0 State */
|
/* Set EP0 State */
|
||||||
pdev->ep0_state = USBD_EP0_DATA_OUT;
|
pdev->ep0_state = USBD_EP0_DATA_OUT;
|
||||||
@@ -145,8 +145,8 @@ USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
|||||||
* @param len: length of data to be received
|
* @param len: length of data to be received
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev, uint8_t *pbuf,
|
USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev,
|
||||||
uint16_t len)
|
uint8_t *pbuf, uint16_t len)
|
||||||
{
|
{
|
||||||
USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
|
USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ USB Device | HAL |
|
|||||||
---------- | ---------- |
|
---------- | ---------- |
|
||||||
Tag v2.5.1 | Tag v1.10.2 ([stm32l0xx_hal_driver](https://github.com/STMicroelectronics/stm32l0xx_hal_driver))
|
Tag v2.5.1 | Tag v1.10.2 ([stm32l0xx_hal_driver](https://github.com/STMicroelectronics/stm32l0xx_hal_driver))
|
||||||
Tag v2.5.2 | Tag v1.4.0 ([stm32l1xx_hal_driver](https://github.com/STMicroelectronics/stm32l1xx_hal_driver))
|
Tag v2.5.2 | Tag v1.4.0 ([stm32l1xx_hal_driver](https://github.com/STMicroelectronics/stm32l1xx_hal_driver))
|
||||||
|
Tag v2.5.3 | Tag v1.7.3 ([stm32f0xx_hal_driver](https://github.com/STMicroelectronics/stm32f0xx_hal_driver))<br>Tag v1.1.4 ([stm32f1xx_hal_driver](https://github.com/STMicroelectronics/stm32f1xx_hal_driver))<br>Tag v1.2.4 ([stm32f2xx_hal_driver](https://github.com/STMicroelectronics/stm32f2xx_hal_driver))<br>Tag v1.5.3 ([stm32f3xx_hal_driver](https://github.com/STMicroelectronics/stm32f3xx_hal_driver))
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -923,7 +923,30 @@ ul
|
|||||||
<tbody><tr style="">
|
<tbody><tr style="">
|
||||||
<td style="padding: 0in;" valign="top">
|
<td style="padding: 0in;" valign="top">
|
||||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.5.2 / 27-Mars-2019</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.5.3 / 30-April-2019</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||||
|
Changes</span></u></b><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul style="margin-top: 0cm;" type="square"><li>Fix misra-c 2012 high severity violations</li><li>Core driver:</li><ul><li>protect shared macros __ALIGN_BEGIN, __ALIGN_END with C directive #ifndef</li><li>update Core driver and DFU Class driver to use USBD_SUPPORT_USER_STRING_DESC insead of USBD_SUPPORT_USER_STRING</li><li> prevent accessing to NULL pointer if the get descriptor functions are not defined</li><li>Update on USBD_LL_Resume(), restore the device state only if the current state is USBD_STATE_SUSPENDED </li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.5.2 / 27-Mars-2019</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||||
Changes</span></u></b><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></p>
|
Changes</span></u></b><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></p>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user