diff --git a/Class/AUDIO/Src/usbd_audio.c b/Class/AUDIO/Src/usbd_audio.c index 7ea0a34..a0a0941 100644 --- a/Class/AUDIO/Src/usbd_audio.c +++ b/Class/AUDIO/Src/usbd_audio.c @@ -368,7 +368,7 @@ static uint8_t USBD_AUDIO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC); + AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) @@ -418,7 +418,7 @@ static uint8_t USBD_AUDIO_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC); + AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Open EP OUT */ @@ -761,7 +761,7 @@ static uint8_t USBD_AUDIO_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC); + AUDIOOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ haudio = (USBD_AUDIO_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; @@ -783,7 +783,7 @@ static uint8_t USBD_AUDIO_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) /* Increment the Buffer pointer or roll it back when all buffers are full */ haudio->wr_ptr += PacketSize; - if (haudio->wr_ptr == AUDIO_TOTAL_BUF_SIZE) + if (haudio->wr_ptr >= AUDIO_TOTAL_BUF_SIZE) { /* All buffers are full: roll back */ haudio->wr_ptr = 0U; diff --git a/Class/CCID/Inc/usbd_ccid.h b/Class/CCID/Inc/usbd_ccid.h index 9a0f6c2..d3b96a5 100644 --- a/Class/CCID/Inc/usbd_ccid.h +++ b/Class/CCID/Inc/usbd_ccid.h @@ -263,7 +263,7 @@ typedef struct } USBD_CCID_ParamTypeDef; /* - * CCID Class specification revsion 1.1 + * CCID Class specification revision 1.1 * Smart Card Device Class Descriptor Table */ diff --git a/Class/CCID/Inc/usbd_ccid_cmd.h b/Class/CCID/Inc/usbd_ccid_cmd.h index c9bc3b9..91e2720 100644 --- a/Class/CCID/Inc/usbd_ccid_cmd.h +++ b/Class/CCID/Inc/usbd_ccid_cmd.h @@ -55,7 +55,7 @@ extern "C" { an unimplemented slot, then the Slot Error register shall be set to 5 (index of bSlot field) */ /* - * CCID Class specification revsion 1.1 + * CCID Class specification revision 1.1 */ /* Following Parameters used in PC_to_RDR_XfrBlock */ diff --git a/Class/CCID/Src/usbd_ccid.c b/Class/CCID/Src/usbd_ccid.c index 9b91dbd..4c77b13 100644 --- a/Class/CCID/Src/usbd_ccid.c +++ b/Class/CCID/Src/usbd_ccid.c @@ -289,9 +289,9 @@ static uint8_t USBD_CCID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Init the CCID parameters into a state where it can receive a new command message */ @@ -337,9 +337,9 @@ static uint8_t USBD_CCID_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -474,8 +474,8 @@ static uint8_t USBD_CCID_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CCIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (epnum == (CCIDInEpAdd & 0x7FU)) @@ -530,7 +530,7 @@ static uint8_t USBD_CCID_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + CCIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hccid == NULL) @@ -816,7 +816,7 @@ uint8_t USBD_CCID_IntMessage(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CCIDCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Check if there is change in Smartcard Slot status */ diff --git a/Class/CDC/Inc/usbd_cdc.h b/Class/CDC/Inc/usbd_cdc.h index 242352c..aeac6bf 100644 --- a/Class/CDC/Inc/usbd_cdc.h +++ b/Class/CDC/Inc/usbd_cdc.h @@ -154,12 +154,17 @@ extern USBD_ClassTypeDef USBD_CDC; uint8_t USBD_CDC_RegisterInterface(USBD_HandleTypeDef *pdev, USBD_CDC_ItfTypeDef *fops); +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, + uint32_t length, uint8_t ClassId); +uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId); +#else uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length); - +uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev); +#endif /* USE_USBD_COMPOSITE */ uint8_t USBD_CDC_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff); uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev); -uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev); /** * @} */ diff --git a/Class/CDC/Src/usbd_cdc.c b/Class/CDC/Src/usbd_cdc.c index e25cdfa..4b60a2c 100644 --- a/Class/CDC/Src/usbd_cdc.c +++ b/Class/CDC/Src/usbd_cdc.c @@ -305,9 +305,9 @@ static uint8_t USBD_CDC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - CDCCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CDCCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) @@ -393,9 +393,9 @@ static uint8_t USBD_CDC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this CDC class instance */ - CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - CDCCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + CDCCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -746,17 +746,26 @@ uint8_t USBD_CDC_RegisterInterface(USBD_HandleTypeDef *pdev, return (uint8_t)USBD_OK; } + /** * @brief USBD_CDC_SetTxBuffer * @param pdev: device instance * @param pbuff: Tx Buffer - * @param length: Tx Buffer length + * @param length: length of data to be sent + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, + uint8_t *pbuff, uint32_t length, uint8_t ClassId) +{ + USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length) { USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ if (hcdc == NULL) { @@ -789,22 +798,32 @@ uint8_t USBD_CDC_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff) return (uint8_t)USBD_OK; } + /** * @brief USBD_CDC_TransmitPacket * Transmit packet on IN endpoint * @param pdev: device instance + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId) +{ + USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev) { USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ + USBD_StatusTypeDef ret = USBD_BUSY; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); -#endif /* USE_USBD_COMPOSITE */ - if (pdev->pClassDataCmsit[pdev->classId] == NULL) + CDCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, ClassId); +#endif /* USE_USBD_COMPOSITE */ + + if (hcdc == NULL) { return (uint8_t)USBD_FAIL; } @@ -838,7 +857,7 @@ uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + CDCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) diff --git a/Class/CDC_ECM/Inc/usbd_cdc_ecm.h b/Class/CDC_ECM/Inc/usbd_cdc_ecm.h index d519667..a69c4fd 100644 --- a/Class/CDC_ECM/Inc/usbd_cdc_ecm.h +++ b/Class/CDC_ECM/Inc/usbd_cdc_ecm.h @@ -243,15 +243,19 @@ extern USBD_ClassTypeDef USBD_CDC_ECM; uint8_t USBD_CDC_ECM_RegisterInterface(USBD_HandleTypeDef *pdev, USBD_CDC_ECM_ItfTypeDef *fops); -uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, - uint32_t length); - uint8_t USBD_CDC_ECM_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff); uint8_t USBD_CDC_ECM_ReceivePacket(USBD_HandleTypeDef *pdev); +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_ECM_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId); +uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, + uint32_t length, uint8_t ClassId); +#else uint8_t USBD_CDC_ECM_TransmitPacket(USBD_HandleTypeDef *pdev); - +uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, + uint32_t length); +#endif /* USE_USBD_COMPOSITE */ uint8_t USBD_CDC_ECM_SendNotification(USBD_HandleTypeDef *pdev, USBD_CDC_NotifCodeTypeDef Notif, uint16_t bVal, uint8_t *pData); diff --git a/Class/CDC_ECM/Src/usbd_cdc_ecm.c b/Class/CDC_ECM/Src/usbd_cdc_ecm.c index 4eaa662..7f658e6 100644 --- a/Class/CDC_ECM/Src/usbd_cdc_ecm.c +++ b/Class/CDC_ECM/Src/usbd_cdc_ecm.c @@ -295,9 +295,9 @@ static uint8_t USBD_CDC_ECM_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ hcdc = (USBD_CDC_ECM_HandleTypeDef *)USBD_malloc(sizeof(USBD_CDC_ECM_HandleTypeDef)); @@ -390,9 +390,9 @@ static uint8_t USBD_CDC_ECM_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -537,7 +537,7 @@ static uint8_t USBD_CDC_ECM_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -597,7 +597,7 @@ static uint8_t USBD_CDC_ECM_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -823,11 +823,18 @@ static uint8_t *USBD_CDC_ECM_USRStringDescriptor(USBD_HandleTypeDef *pdev, uint8 * @param pdev: device instance * @param pbuff: Tx Buffer * @param length: Tx Buffer length + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length, uint8_t ClassId) +{ + USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length) { USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif if (hcdc == NULL) { @@ -861,23 +868,32 @@ uint8_t USBD_CDC_ECM_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff) return (uint8_t)USBD_OK; } + /** * @brief USBD_CDC_ECM_TransmitPacket * Transmit packet on IN endpoint * @param pdev: device instance + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_ECM_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId) +{ + USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_ECM_TransmitPacket(USBD_HandleTypeDef *pdev) { USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ + USBD_StatusTypeDef ret = USBD_BUSY; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + ECMInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, ClassId); #endif /* USE_USBD_COMPOSITE */ - if (pdev->pClassDataCmsit[pdev->classId] == NULL) + if (hcdc == NULL) { return (uint8_t)USBD_FAIL; } @@ -912,7 +928,7 @@ uint8_t USBD_CDC_ECM_ReceivePacket(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + ECMOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -951,7 +967,7 @@ uint8_t USBD_CDC_ECM_SendNotification(USBD_HandleTypeDef *pdev, #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + ECMCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Initialize the request fields */ diff --git a/Class/CDC_ECM/Src/usbd_cdc_ecm_if_template.c b/Class/CDC_ECM/Src/usbd_cdc_ecm_if_template.c index e89a892..32006ec 100644 --- a/Class/CDC_ECM/Src/usbd_cdc_ecm_if_template.c +++ b/Class/CDC_ECM/Src/usbd_cdc_ecm_if_template.c @@ -85,7 +85,11 @@ static int8_t CDC_ECM_Itf_Init(void) } /* Set Application Buffers */ +#ifdef USE_USBD_COMPOSITE + (void)USBD_CDC_ECM_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U, 0U); +#else (void)USBD_CDC_ECM_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U); +#endif (void)USBD_CDC_ECM_SetRxBuffer(&USBD_Device, UserRxBuffer); return (0); diff --git a/Class/CDC_RNDIS/Inc/usbd_cdc_rndis.h b/Class/CDC_RNDIS/Inc/usbd_cdc_rndis.h index 1f5aba5..50d18c4 100644 --- a/Class/CDC_RNDIS/Inc/usbd_cdc_rndis.h +++ b/Class/CDC_RNDIS/Inc/usbd_cdc_rndis.h @@ -493,14 +493,18 @@ extern USBD_ClassTypeDef USBD_CDC_RNDIS; */ uint8_t USBD_CDC_RNDIS_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff); uint8_t USBD_CDC_RNDIS_ReceivePacket(USBD_HandleTypeDef *pdev); -uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev); uint8_t USBD_CDC_RNDIS_RegisterInterface(USBD_HandleTypeDef *pdev, USBD_CDC_RNDIS_ItfTypeDef *fops); - +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId); +uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, + uint8_t *pbuff, uint32_t length, uint8_t ClassId); +#else +uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev); uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length); - +#endif /* USE_USBD_COMPOSITE */ uint8_t USBD_CDC_RNDIS_SendNotification(USBD_HandleTypeDef *pdev, USBD_CDC_NotifCodeTypeDef Notif, uint16_t bVal, uint8_t *pData); diff --git a/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c b/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c index e48ae4a..b9b0b4b 100644 --- a/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c +++ b/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c @@ -357,9 +357,9 @@ static uint8_t USBD_CDC_RNDIS_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hcdc == NULL) @@ -454,9 +454,9 @@ static uint8_t USBD_CDC_RNDIS_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -637,7 +637,7 @@ static uint8_t USBD_CDC_RNDIS_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -699,7 +699,7 @@ static uint8_t USBD_CDC_RNDIS_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) uint32_t CurrPcktLen; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -936,16 +936,25 @@ static uint8_t *USBD_CDC_RNDIS_USRStringDescriptor(USBD_HandleTypeDef *pdev, uin } #endif /* USBD_SUPPORT_USER_STRING_DESC */ + /** * @brief USBD_CDC_RNDIS_SetTxBuffer * @param pdev: device instance * @param pbuff: Tx Buffer * @param length: Tx Buffer length + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length, uint8_t ClassId) +{ + USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length) { + USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ if (hcdc == NULL) { @@ -984,25 +993,32 @@ uint8_t USBD_CDC_RNDIS_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff) * @brief USBD_CDC_RNDIS_TransmitPacket * Transmit packet on IN endpoint * @param pdev: device instance + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId) +{ + USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev) { - USBD_CDC_RNDIS_HandleTypeDef *hcdc; + USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ + USBD_CDC_RNDIS_PacketMsgTypeDef *PacketMsg; USBD_StatusTypeDef ret = USBD_BUSY; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + RNDISInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, ClassId); #endif /* USE_USBD_COMPOSITE */ - if (pdev->pClassDataCmsit[pdev->classId] == NULL) + if (hcdc == NULL) { return (uint8_t)USBD_FAIL; } - hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; PacketMsg = (USBD_CDC_RNDIS_PacketMsgTypeDef *)(void *)hcdc->TxBuffer; if (hcdc->TxState == 0U) @@ -1048,7 +1064,7 @@ uint8_t USBD_CDC_RNDIS_ReceivePacket(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + RNDISOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->pClassDataCmsit[pdev->classId] == NULL) @@ -1094,7 +1110,7 @@ uint8_t USBD_CDC_RNDIS_SendNotification(USBD_HandleTypeDef *pdev, #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + RNDISCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Initialize the request fields */ diff --git a/Class/CDC_RNDIS/Src/usbd_cdc_rndis_if_template.c b/Class/CDC_RNDIS/Src/usbd_cdc_rndis_if_template.c index 9be1fe8..81aeee1 100644 --- a/Class/CDC_RNDIS/Src/usbd_cdc_rndis_if_template.c +++ b/Class/CDC_RNDIS/Src/usbd_cdc_rndis_if_template.c @@ -95,7 +95,11 @@ static int8_t CDC_RNDIS_Itf_Init(void) } /* Set Application Buffers */ +#ifdef USE_USBD_COMPOSITE + (void)USBD_CDC_RNDIS_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U, 0U); +#else (void)USBD_CDC_RNDIS_SetTxBuffer(&USBD_Device, UserTxBuffer, 0U); +#endif /* USE_USBD_COMPOSITE */ (void)USBD_CDC_RNDIS_SetRxBuffer(&USBD_Device, UserRxBuffer); return (0); diff --git a/Class/CompositeBuilder/Inc/usbd_composite_builder.h b/Class/CompositeBuilder/Inc/usbd_composite_builder.h index 6d61755..3a8aac3 100644 --- a/Class/CompositeBuilder/Inc/usbd_composite_builder.h +++ b/Class/CompositeBuilder/Inc/usbd_composite_builder.h @@ -172,10 +172,10 @@ typedef struct #if (USBD_CMPSIT_ACTIVATE_CDC == 1) || (USBD_CMPSIT_ACTIVATE_RNDIS == 1) || (USBD_CMPSIT_ACTIVATE_CDC_ECM == 1) typedef struct { -/* - * CDC Class specification revision 1.2 - * Table 15: Class-Specific Descriptor Header Format - */ + /* + * CDC Class specification revision 1.2 + * Table 15: Class-Specific Descriptor Header Format + */ /* Header Functional Descriptor */ uint8_t bLength; uint8_t bDescriptorType; @@ -204,10 +204,10 @@ typedef struct typedef struct { -/* - * CDC Class specification revision 1.2 - * Table 16: Union Interface Functional Descriptor - */ + /* + * CDC Class specification revision 1.2 + * Table 16: Union Interface Functional Descriptor + */ /* Union Functional Descriptor */ uint8_t bLength; uint8_t bDescriptorType; @@ -249,7 +249,7 @@ uint8_t USBD_CMPST_ClearConfDesc(USBD_HandleTypeDef *pdev); pEpDesc->bDescriptorType = USB_DESC_TYPE_ENDPOINT; \ pEpDesc->bEndpointAddress = (epadd); \ pEpDesc->bmAttributes = (eptype); \ - pEpDesc->wMaxPacketSize = (epsize); \ + pEpDesc->wMaxPacketSize = (uint16_t)(epsize); \ if(speed == (uint8_t)USBD_SPEED_HIGH) \ { \ pEpDesc->bInterval = HSinterval; \ diff --git a/Class/CompositeBuilder/Src/usbd_composite_builder.c b/Class/CompositeBuilder/Src/usbd_composite_builder.c index 76ce567..c567cb4 100644 --- a/Class/CompositeBuilder/Src/usbd_composite_builder.c +++ b/Class/CompositeBuilder/Src/usbd_composite_builder.c @@ -844,7 +844,7 @@ static void USBD_CMPSIT_HIDMouseDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_HID == 1 */ @@ -881,7 +881,7 @@ static void USBD_CMPSIT_MSCDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_MSC == 1 */ @@ -979,7 +979,7 @@ static void USBD_CMPSIT_CDCDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_CDC == 1 */ @@ -1018,7 +1018,7 @@ static void USBD_CMPSIT_DFUDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); UNUSED(idx); } @@ -1113,7 +1113,7 @@ static void USBD_CMPSIT_CDC_ECMDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, _ /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_CDC_ECM */ @@ -1249,7 +1249,7 @@ static void USBD_CMPSIT_AUDIODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I pSpEpDesc->bDescriptorType = USB_DESC_TYPE_ENDPOINT; pSpEpDesc->bEndpointAddress = pdev->tclasslist[pdev->classId].Eps[0].add; pSpEpDesc->bmAttributes = USBD_EP_TYPE_ISOC; - pSpEpDesc->wMaxPacketSize = USBD_AUDIO_GetEpPcktSze(pdev, 0U, 0U); + pSpEpDesc->wMaxPacketSize = (uint16_t)USBD_AUDIO_GetEpPcktSze(pdev, 0U, 0U); pSpEpDesc->bInterval = 0x01U; pSpEpDesc->bRefresh = 0x00U; pSpEpDesc->bSynchAddress = 0x00U; @@ -1267,7 +1267,7 @@ static void USBD_CMPSIT_AUDIODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_AUDIO */ @@ -1363,7 +1363,7 @@ static void USBD_CMPSIT_RNDISDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_RNDIS == 1 */ @@ -1407,7 +1407,7 @@ static void USBD_CMPSIT_CUSTOMHIDDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_CUSTOMHID == 1U */ @@ -1609,7 +1609,7 @@ static void USBD_CMPSIT_VIDEODesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __I /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 2U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_VIDEO == 1 */ @@ -1645,7 +1645,7 @@ static void USBD_CMPSIT_PRNTDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_PRINTER == 1 */ @@ -1715,7 +1715,7 @@ static void USBD_CMPSIT_CCIDDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_CCID == 1 */ @@ -1757,7 +1757,7 @@ static void USBD_CMPSIT_MTPDesc(USBD_HandleTypeDef *pdev, uint32_t pConf, __IO /* Update Config Descriptor and IAD descriptor */ ((USBD_ConfigDescTypeDef *)pConf)->bNumInterfaces += 1U; - ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = *Sze; + ((USBD_ConfigDescTypeDef *)pConf)->wTotalLength = (uint16_t)(*Sze); } #endif /* USBD_CMPSIT_ACTIVATE_MTP == 1 */ diff --git a/Class/CustomHID/Inc/usbd_customhid.h b/Class/CustomHID/Inc/usbd_customhid.h index d5e599e..2f4c634 100644 --- a/Class/CustomHID/Inc/usbd_customhid.h +++ b/Class/CustomHID/Inc/usbd_customhid.h @@ -106,7 +106,12 @@ typedef struct _USBD_CUSTOM_HID_Itf int8_t (* Init)(void); int8_t (* DeInit)(void); int8_t (* OutEvent)(uint8_t event_idx, uint8_t state); - +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED + int8_t (* CtrlReqComplete)(uint8_t request, uint16_t wLength); +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED + uint8_t *(* GetReport)(uint16_t *ReportLength); +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ } USBD_CUSTOM_HID_ItfTypeDef; typedef struct @@ -162,9 +167,13 @@ extern USBD_ClassTypeDef USBD_CUSTOM_HID; /** @defgroup USB_CORE_Exported_Functions * @{ */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev, + uint8_t *report, uint16_t len, uint8_t ClassId); +#else uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len); - +#endif /* USE_USBD_COMPOSITE */ uint8_t USBD_CUSTOM_HID_ReceivePacket(USBD_HandleTypeDef *pdev); uint8_t USBD_CUSTOM_HID_RegisterInterface(USBD_HandleTypeDef *pdev, diff --git a/Class/CustomHID/Src/usbd_customhid.c b/Class/CustomHID/Src/usbd_customhid.c index b6cdc37..378a1fc 100644 --- a/Class/CustomHID/Src/usbd_customhid.c +++ b/Class/CustomHID/Src/usbd_customhid.c @@ -136,8 +136,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_ { 0x09, /* bLength: Configuration Descriptor size */ USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */ - USB_CUSTOM_HID_CONFIG_DESC_SIZ, /* wTotalLength: Bytes returned */ - 0x00, + LOBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ), /* wTotalLength: Bytes returned */ + HIBYTE(USB_CUSTOM_HID_CONFIG_DESC_SIZ), 0x01, /* bNumInterfaces: 1 interface */ 0x01, /* bConfigurationValue: Configuration value */ 0x00, /* iConfiguration: Index of string descriptor @@ -170,8 +170,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_ 0x01, /* bNumDescriptors: Number of CUSTOM_HID class descriptors to follow */ 0x22, /* bDescriptorType */ - USBD_CUSTOM_HID_REPORT_DESC_SIZE, /* wItemLength: Total length of Report descriptor */ - 0x00, + LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE), /* wItemLength: Total length of Report descriptor */ + HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE), /******************** Descriptor of Custom HID endpoints ********************/ /* 27 */ 0x07, /* bLength: Endpoint Descriptor size */ @@ -179,8 +179,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_ CUSTOM_HID_EPIN_ADDR, /* bEndpointAddress: Endpoint Address (IN) */ 0x03, /* bmAttributes: Interrupt endpoint */ - CUSTOM_HID_EPIN_SIZE, /* wMaxPacketSize: 2 Bytes max */ - 0x00, + LOBYTE(CUSTOM_HID_EPIN_SIZE), /* wMaxPacketSize: 2 Bytes max */ + HIBYTE(CUSTOM_HID_EPIN_SIZE), CUSTOM_HID_FS_BINTERVAL, /* bInterval: Polling Interval */ /* 34 */ @@ -188,8 +188,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_ USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: */ CUSTOM_HID_EPOUT_ADDR, /* bEndpointAddress: Endpoint Address (OUT) */ 0x03, /* bmAttributes: Interrupt endpoint */ - CUSTOM_HID_EPOUT_SIZE, /* wMaxPacketSize: 2 Bytes max */ - 0x00, + LOBYTE(CUSTOM_HID_EPOUT_SIZE), /* wMaxPacketSize: 2 Bytes max */ + HIBYTE(CUSTOM_HID_EPOUT_SIZE), CUSTOM_HID_FS_BINTERVAL, /* bInterval: Polling Interval */ /* 41 */ }; @@ -207,8 +207,8 @@ __ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_Desc[USB_CUSTOM_HID_DESC_SIZ] __ALI 0x01, /* bNumDescriptors: Number of CUSTOM_HID class descriptors to follow */ 0x22, /* bDescriptorType */ - USBD_CUSTOM_HID_REPORT_DESC_SIZE, /* wItemLength: Total length of Report descriptor */ - 0x00, + LOBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE), /* wItemLength: Total length of Report descriptor */ + HIBYTE(USBD_CUSTOM_HID_REPORT_DESC_SIZE), }; #ifndef USE_USBD_COMPOSITE @@ -263,8 +263,8 @@ static uint8_t USBD_CUSTOM_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); - CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR); + CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); + CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) @@ -294,9 +294,11 @@ static uint8_t USBD_CUSTOM_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->Init(); +#ifndef USBD_CUSTOMHID_OUT_PREPARE_RECEIVE_DISABLED /* Prepare Out endpoint to receive 1st packet */ (void)USBD_LL_PrepareReceive(pdev, CUSTOMHIDOutEpAdd, hhid->Report_buf, USBD_CUSTOMHID_OUTREPORT_BUF_SIZE); +#endif /* USBD_CUSTOMHID_OUT_PREPARE_RECEIVE_DISABLED */ return (uint8_t)USBD_OK; } @@ -314,8 +316,8 @@ static uint8_t USBD_CUSTOM_HID_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); - CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR); + CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); + CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close CUSTOM_HID EP IN */ @@ -352,6 +354,9 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev, { USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; uint16_t len = 0U; +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED + uint16_t ReportLength = 0U; +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ uint8_t *pbuf = NULL; uint16_t status_info = 0U; USBD_StatusTypeDef ret = USBD_OK; @@ -383,10 +388,58 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev, break; case CUSTOM_HID_REQ_SET_REPORT: +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED + if (((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete != NULL) + { + /* Let the application decide when to enable EP0 to receive the next report */ + ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete(req->bRequest, + req->wLength); + } +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ +#ifndef USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED hhid->IsReportAvailable = 1U; (void)USBD_CtlPrepareRx(pdev, hhid->Report_buf, MIN(req->wLength, USBD_CUSTOMHID_OUTREPORT_BUF_SIZE)); +#endif /* USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED */ break; +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED + case CUSTOM_HID_REQ_GET_REPORT: + if (((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->GetReport != NULL) + { + ReportLength = req->wLength; + + /* Get report data buffer */ + pbuf = ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->GetReport(&ReportLength); + } + + if ((pbuf != NULL) && (ReportLength != 0U)) + { + len = MIN(ReportLength, req->wLength); + + /* Send the report data over EP0 */ + (void)USBD_CtlSendData(pdev, pbuf, len); + } + else + { +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED + if (((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete != NULL) + { + /* Let the application decide what to do, keep EP0 data phase in NAK state and + use USBD_CtlSendData() when data become available or stall the EP0 data phase */ + ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->CtrlReqComplete(req->bRequest, req->wLength); + } + else + { + /* Stall EP0 if no data available */ + USBD_CtlError(pdev, req); + } +#else + /* Stall EP0 if no data available */ + USBD_CtlError(pdev, req); +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ + } + break; +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ default: USBD_CtlError(pdev, req); @@ -475,25 +528,31 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev, * Send CUSTOM_HID Report * @param pdev: device instance * @param buff: pointer to report + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev, + uint8_t *report, uint16_t len, uint8_t ClassId) +{ + USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_CUSTOM_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len) { - USBD_CUSTOM_HID_HandleTypeDef *hhid; + USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ - if (pdev->pClassDataCmsit[pdev->classId] == NULL) + if (hhid == NULL) { return (uint8_t)USBD_FAIL; } #ifdef USE_USBD_COMPOSITE /* Get Endpoint IN address allocated for this class instance */ - CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + CUSTOMHIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, ClassId); #endif /* USE_USBD_COMPOSITE */ - hhid = (USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; - if (pdev->dev_state == USBD_STATE_CONFIGURED) { if (hhid->state == CUSTOM_HID_IDLE) @@ -657,7 +716,7 @@ uint8_t USBD_CUSTOM_HID_ReceivePacket(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get OUT Endpoint address allocated for this class instance */ - CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR); + CUSTOMHIDOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ hhid = (USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; diff --git a/Class/CustomHID/Src/usbd_customhid_if_template.c b/Class/CustomHID/Src/usbd_customhid_if_template.c index 1f4d15b..85881bd 100644 --- a/Class/CustomHID/Src/usbd_customhid_if_template.c +++ b/Class/CustomHID/Src/usbd_customhid_if_template.c @@ -33,6 +33,14 @@ EndBSPDependencies */ static int8_t TEMPLATE_CUSTOM_HID_Init(void); static int8_t TEMPLATE_CUSTOM_HID_DeInit(void); static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t event_idx, uint8_t state); + +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED +static int8_t TEMPLATE_CUSTOM_HID_CtrlReqComplete(uint8_t request, uint16_t wLength); +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ + +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED +static uint8_t *TEMPLATE_CUSTOM_HID_GetReport(uint16_t *ReportLength); +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ /* Private variables ---------------------------------------------------------*/ extern USBD_HandleTypeDef USBD_Device; @@ -44,6 +52,12 @@ USBD_CUSTOM_HID_ItfTypeDef USBD_CustomHID_template_fops = TEMPLATE_CUSTOM_HID_Init, TEMPLATE_CUSTOM_HID_DeInit, TEMPLATE_CUSTOM_HID_OutEvent, +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED + TEMPLATE_CUSTOM_HID_CtrlReqComplete, +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED + TEMPLATE_CUSTOM_HID_GetReport, +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ }; /* Private functions ---------------------------------------------------------*/ @@ -95,3 +109,50 @@ static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t event_idx, uint8_t state) return (0); } +#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED +/** + * @brief TEMPLATE_CUSTOM_HID_CtrlReqComplete + * Manage the CUSTOM HID control request complete + * @param request: control request + * @param wLength: request wLength + * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL + */ +static int8_t TEMPLATE_CUSTOM_HID_CtrlReqComplete(uint8_t request, uint16_t wLength) +{ + UNUSED(wLength); + + switch (request) + { + case CUSTOM_HID_REQ_SET_REPORT: + + break; + + case CUSTOM_HID_REQ_GET_REPORT: + + break; + + default: + break; + } + + return (0); +} +#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ + + +#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED +/** + * @brief TEMPLATE_CUSTOM_HID_GetReport + * Manage the CUSTOM HID control Get Report request + * @param event_idx: event index + * @param state: event state + * @retval return pointer to HID report + */ +static uint8_t *TEMPLATE_CUSTOM_HID_GetReport(uint16_t *ReportLength) +{ + UNUSED(ReportLength); + uint8_t *pbuff; + + return (pbuff); +} +#endif /* USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ diff --git a/Class/HID/Inc/usbd_hid.h b/Class/HID/Inc/usbd_hid.h index ed0c9bb..8b22a8d 100644 --- a/Class/HID/Inc/usbd_hid.h +++ b/Class/HID/Inc/usbd_hid.h @@ -60,14 +60,14 @@ extern "C" { #define HID_FS_BINTERVAL 0x0AU #endif /* HID_FS_BINTERVAL */ -#define HID_REQ_SET_PROTOCOL 0x0BU -#define HID_REQ_GET_PROTOCOL 0x03U +#define USBD_HID_REQ_SET_PROTOCOL 0x0BU +#define USBD_HID_REQ_GET_PROTOCOL 0x03U -#define HID_REQ_SET_IDLE 0x0AU -#define HID_REQ_GET_IDLE 0x02U +#define USBD_HID_REQ_SET_IDLE 0x0AU +#define USBD_HID_REQ_GET_IDLE 0x02U -#define HID_REQ_SET_REPORT 0x09U -#define HID_REQ_GET_REPORT 0x01U +#define USBD_HID_REQ_SET_REPORT 0x09U +#define USBD_HID_REQ_GET_REPORT 0x01U /** * @} */ @@ -78,9 +78,9 @@ extern "C" { */ typedef enum { - HID_IDLE = 0, - HID_BUSY, -} HID_StateTypeDef; + USBD_HID_IDLE = 0, + USBD_HID_BUSY, +} USBD_HID_StateTypeDef; typedef struct @@ -88,7 +88,7 @@ typedef struct uint32_t Protocol; uint32_t IdleState; uint32_t AltSetting; - HID_StateTypeDef state; + USBD_HID_StateTypeDef state; } USBD_HID_HandleTypeDef; /* @@ -134,7 +134,11 @@ extern USBD_ClassTypeDef USBD_HID; /** @defgroup USB_CORE_Exported_Functions * @{ */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len, uint8_t ClassId); +#else uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len); +#endif /* USE_USBD_COMPOSITE */ uint32_t USBD_HID_GetPollingInterval(USBD_HandleTypeDef *pdev); /** diff --git a/Class/HID/Src/usbd_hid.c b/Class/HID/Src/usbd_hid.c index 075a660..fdf7578 100644 --- a/Class/HID/Src/usbd_hid.c +++ b/Class/HID/Src/usbd_hid.c @@ -295,7 +295,7 @@ static uint8_t USBD_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) @@ -311,7 +311,7 @@ static uint8_t USBD_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) (void)USBD_LL_OpenEP(pdev, HIDInEpAdd, USBD_EP_TYPE_INTR, HID_EPIN_SIZE); pdev->ep_in[HIDInEpAdd & 0xFU].is_used = 1U; - hhid->state = HID_IDLE; + hhid->state = USBD_HID_IDLE; return (uint8_t)USBD_OK; } @@ -329,7 +329,7 @@ static uint8_t USBD_HID_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close HID EPs */ @@ -372,19 +372,19 @@ static uint8_t USBD_HID_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re case USB_REQ_TYPE_CLASS : switch (req->bRequest) { - case HID_REQ_SET_PROTOCOL: + case USBD_HID_REQ_SET_PROTOCOL: hhid->Protocol = (uint8_t)(req->wValue); break; - case HID_REQ_GET_PROTOCOL: + case USBD_HID_REQ_GET_PROTOCOL: (void)USBD_CtlSendData(pdev, (uint8_t *)&hhid->Protocol, 1U); break; - case HID_REQ_SET_IDLE: + case USBD_HID_REQ_SET_IDLE: hhid->IdleState = (uint8_t)(req->wValue >> 8); break; - case HID_REQ_GET_IDLE: + case USBD_HID_REQ_GET_IDLE: (void)USBD_CtlSendData(pdev, (uint8_t *)&hhid->IdleState, 1U); break; @@ -472,16 +472,24 @@ static uint8_t USBD_HID_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re return (uint8_t)ret; } + /** * @brief USBD_HID_SendReport * Send HID Report * @param pdev: device instance * @param buff: pointer to report + * @param ClassId: The Class ID * @retval status */ +#ifdef USE_USBD_COMPOSITE +uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len, uint8_t ClassId) +{ + USBD_HID_HandleTypeDef *hhid = (USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[ClassId]; +#else uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len) { USBD_HID_HandleTypeDef *hhid = (USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; +#endif /* USE_USBD_COMPOSITE */ if (hhid == NULL) { @@ -490,14 +498,14 @@ uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + HIDInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, ClassId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_state == USBD_STATE_CONFIGURED) { - if (hhid->state == HID_IDLE) + if (hhid->state == USBD_HID_IDLE) { - hhid->state = HID_BUSY; + hhid->state = USBD_HID_BUSY; (void)USBD_LL_Transmit(pdev, HIDInEpAdd, report, len); } } @@ -607,7 +615,7 @@ static uint8_t USBD_HID_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) UNUSED(epnum); /* Ensure that the FIFO is empty before a new transfer, this condition could be caused by a new transfer before the end of the previous transfer */ - ((USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId])->state = HID_IDLE; + ((USBD_HID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId])->state = USBD_HID_IDLE; return (uint8_t)USBD_OK; } diff --git a/Class/MSC/Inc/usbd_msc_scsi.h b/Class/MSC/Inc/usbd_msc_scsi.h index 0d0bbc5..477affb 100644 --- a/Class/MSC/Inc/usbd_msc_scsi.h +++ b/Class/MSC/Inc/usbd_msc_scsi.h @@ -82,7 +82,7 @@ extern "C" { #define UNIT_ATTENTION 6U #define DATA_PROTECT 7U #define BLANK_CHECK 8U -#define VENDOR_SPECIFIC 9U +#define MSC_VENDOR_SPECIFIC 9U #define COPY_ABORTED 10U #define ABORTED_COMMAND 11U #define VOLUME_OVERFLOW 13U diff --git a/Class/MSC/Src/usbd_msc.c b/Class/MSC/Src/usbd_msc.c index ad5daeb..7f2152f 100644 --- a/Class/MSC/Src/usbd_msc.c +++ b/Class/MSC/Src/usbd_msc.c @@ -229,8 +229,8 @@ uint8_t USBD_MSC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) @@ -273,8 +273,8 @@ uint8_t USBD_MSC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close MSC EPs */ @@ -313,8 +313,8 @@ uint8_t USBD_MSC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) diff --git a/Class/MSC/Src/usbd_msc_bot.c b/Class/MSC/Src/usbd_msc_bot.c index 0816de9..c51b013 100644 --- a/Class/MSC/Src/usbd_msc_bot.c +++ b/Class/MSC/Src/usbd_msc_bot.c @@ -101,8 +101,8 @@ void MSC_BOT_Init(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -139,8 +139,8 @@ void MSC_BOT_Reset(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -259,8 +259,8 @@ static void MSC_BOT_CBW_Decode(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -335,8 +335,8 @@ static void MSC_BOT_SendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint32_t #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -366,8 +366,8 @@ void MSC_BOT_SendCSW(USBD_HandleTypeDef *pdev, uint8_t CSW_Status) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -400,8 +400,8 @@ static void MSC_BOT_Abort(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) @@ -439,8 +439,8 @@ void MSC_BOT_CplClrFeature(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) diff --git a/Class/MSC/Src/usbd_msc_scsi.c b/Class/MSC/Src/usbd_msc_scsi.c index af7a0d5..609521a 100644 --- a/Class/MSC/Src/usbd_msc_scsi.c +++ b/Class/MSC/Src/usbd_msc_scsi.c @@ -832,7 +832,7 @@ static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc->bot_state == USBD_BOT_IDLE) /* Idle */ @@ -921,7 +921,7 @@ static int8_t SCSI_Write12(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param } #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmsc->bot_state == USBD_BOT_IDLE) /* Idle */ @@ -1075,7 +1075,7 @@ static int8_t SCSI_ProcessRead(USBD_HandleTypeDef *pdev, uint8_t lun) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ len = MIN(len, MSC_MEDIA_PACKET); @@ -1124,7 +1124,7 @@ static int8_t SCSI_ProcessWrite(USBD_HandleTypeDef *pdev, uint8_t lun) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ len = MIN(len, MSC_MEDIA_PACKET); diff --git a/Class/MTP/Src/usbd_mtp.c b/Class/MTP/Src/usbd_mtp.c index 03762ce..b0950e8 100644 --- a/Class/MTP/Src/usbd_mtp.c +++ b/Class/MTP/Src/usbd_mtp.c @@ -242,9 +242,9 @@ static uint8_t USBD_MTP_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - MTPCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MTPCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ @@ -292,9 +292,9 @@ static uint8_t USBD_MTP_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this MTP class instance */ - MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); - MTPCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR); + MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MTPCmdEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_INTR, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -338,7 +338,7 @@ static uint8_t USBD_MTP_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this MTP class instance */ - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hmtp == NULL) @@ -460,8 +460,8 @@ static uint8_t USBD_MTP_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this MTP class instance */ - MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (epnum == (MTPInEpAdd & 0x7FU)) @@ -516,7 +516,7 @@ static uint8_t USBD_MTP_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this MTP class instance */ - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ (void)USBD_MTP_STORAGE_ReceiveOpt(pdev); diff --git a/Class/MTP/Src/usbd_mtp_storage.c b/Class/MTP/Src/usbd_mtp_storage.c index afe234b..e09cd39 100644 --- a/Class/MTP/Src/usbd_mtp_storage.c +++ b/Class/MTP/Src/usbd_mtp_storage.c @@ -50,7 +50,7 @@ uint8_t USBD_MTP_STORAGE_Init(USBD_HandleTypeDef *pdev) USBD_MTP_HandleTypeDef *hmtp = (USBD_MTP_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Initialize the HW layyer of the file system */ @@ -205,7 +205,7 @@ uint8_t USBD_MTP_STORAGE_ReceiveOpt(USBD_HandleTypeDef *pdev) uint32_t *pMsgBuffer; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + MTPOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ MTP_DataLength.rx_length = USBD_GetRxCount(pdev, MTPOutEpAdd); @@ -463,7 +463,7 @@ static uint8_t USBD_MTP_STORAGE_SendData(USBD_HandleTypeDef *pdev, uint8_t *buf uint32_t length = MIN(hmtp->GenericContainer.length, len); #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); + MTPInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ (void)USBD_LL_Transmit(pdev, MTPInEpAdd, buf, length); diff --git a/Class/Printer/Src/usbd_printer.c b/Class/Printer/Src/usbd_printer.c index 9c37f23..7c1a4ba 100644 --- a/Class/Printer/Src/usbd_printer.c +++ b/Class/Printer/Src/usbd_printer.c @@ -249,8 +249,8 @@ static uint8_t USBD_PRNT_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Setup the max packet size according to selected speed */ @@ -305,8 +305,8 @@ static uint8_t USBD_PRNT_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -622,8 +622,8 @@ uint8_t USBD_PRNT_ReceivePacket(USBD_HandleTypeDef *pdev) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK); - PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK); + PRNTInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); + PRNTOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ if (hPRNT == NULL) diff --git a/Class/VIDEO/Src/usbd_video.c b/Class/VIDEO/Src/usbd_video.c index e5a1b0d..5bb75fb 100644 --- a/Class/VIDEO/Src/usbd_video.c +++ b/Class/VIDEO/Src/usbd_video.c @@ -414,7 +414,7 @@ static uint8_t USBD_VIDEO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC); + VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Open EP IN */ @@ -466,7 +466,7 @@ static uint8_t USBD_VIDEO_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ - VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC); + VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId); #endif /* USE_USBD_COMPOSITE */ /* Close EP IN */ @@ -836,19 +836,18 @@ static void VIDEO_REQ_GetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef */ static void VIDEO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) { - USBD_VIDEO_HandleTypeDef *hVIDEO = (USBD_VIDEO_HandleTypeDef *)(pdev->pClassDataCmsit[pdev->classId]); /* Check that the request has control data */ if (req->wLength > 0U) { /* Prepare the reception of the buffer over EP0 */ - if (LOBYTE(req->wValue) == (uint8_t)VS_PROBE_CONTROL) + if (req->wValue == (uint16_t)VS_PROBE_CONTROL) { /* Probe Request */ (void) USBD_CtlPrepareRx(pdev, (uint8_t *)&video_Probe_Control, MIN(req->wLength, sizeof(USBD_VideoControlTypeDef))); } - else if (LOBYTE(req->wValue) == (uint8_t)VS_COMMIT_CONTROL) + else if (req->wValue == (uint16_t)VS_COMMIT_CONTROL) { /* Commit Request */ (void) USBD_CtlPrepareRx(pdev, (uint8_t *)&video_Commit_Control, @@ -856,9 +855,7 @@ static void VIDEO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef } else { - /* Prepare the reception of the buffer over EP0 */ - (void) USBD_CtlPrepareRx(pdev, hVIDEO->control.data, - MIN(req->wLength, USB_MAX_EP0_SIZE)); + (void)USBD_LL_StallEP(pdev, 0x80U); } } } diff --git a/Core/Inc/usbd_conf_template.h b/Core/Inc/usbd_conf_template.h index fe5d6be..b288b66 100644 --- a/Core/Inc/usbd_conf_template.h +++ b/Core/Inc/usbd_conf_template.h @@ -76,6 +76,11 @@ extern "C" { #define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 0x02U #define USBD_CUSTOM_HID_REPORT_DESC_SIZE 163U +/* #define USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */ +/* #define USBD_CUSTOMHID_OUT_PREPARE_RECEIVE_DISABLED */ +/* #define USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED */ +/* #define USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */ + /* VIDEO Class Config */ #define UVC_1_1 /* #define UVC_1_0 */ diff --git a/Core/Inc/usbd_core.h b/Core/Inc/usbd_core.h index 7b7dff5..d601672 100644 --- a/Core/Inc/usbd_core.h +++ b/Core/Inc/usbd_core.h @@ -92,7 +92,7 @@ USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_C USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr); USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev); -uint8_t USBD_CoreGetEPAdd(USBD_HandleTypeDef *pdev, uint8_t ep_dir, uint8_t ep_type); +uint8_t USBD_CoreGetEPAdd(USBD_HandleTypeDef *pdev, uint8_t ep_dir, uint8_t ep_type, uint8_t ClassId); #endif /* USE_USBD_COMPOSITE */ uint8_t USBD_CoreFindIF(USBD_HandleTypeDef *pdev, uint8_t index); diff --git a/Core/Src/usbd_core.c b/Core/Src/usbd_core.c index 544c2a9..bdac79c 100644 --- a/Core/Src/usbd_core.c +++ b/Core/Src/usbd_core.c @@ -1123,20 +1123,21 @@ uint8_t USBD_CoreFindEP(USBD_HandleTypeDef *pdev, uint8_t index) * @param pdev: device instance * @param ep_dir: USBD_EP_IN or USBD_EP_OUT * @param ep_type: USBD_EP_TYPE_CTRL, USBD_EP_TYPE_ISOC, USBD_EP_TYPE_BULK or USBD_EP_TYPE_INTR + * @param ClassId: The Class ID * @retval Address of the selected endpoint or 0xFFU if no endpoint found. */ -uint8_t USBD_CoreGetEPAdd(USBD_HandleTypeDef *pdev, uint8_t ep_dir, uint8_t ep_type) +uint8_t USBD_CoreGetEPAdd(USBD_HandleTypeDef *pdev, uint8_t ep_dir, uint8_t ep_type, uint8_t ClassId) { uint8_t idx; /* Find the EP address in the selected class table */ - for (idx = 0; idx < pdev->tclasslist[pdev->classId].NumEps; idx++) + for (idx = 0; idx < pdev->tclasslist[ClassId].NumEps; idx++) { - if (((pdev->tclasslist[pdev->classId].Eps[idx].add & USBD_EP_IN) == ep_dir) && \ - (pdev->tclasslist[pdev->classId].Eps[idx].type == ep_type) && \ - (pdev->tclasslist[pdev->classId].Eps[idx].is_used != 0U)) + if (((pdev->tclasslist[ClassId].Eps[idx].add & USBD_EP_IN) == ep_dir) && \ + (pdev->tclasslist[ClassId].Eps[idx].type == ep_type) && \ + (pdev->tclasslist[ClassId].Eps[idx].is_used != 0U)) { - return (pdev->tclasslist[pdev->classId].Eps[idx].add); + return (pdev->tclasslist[ClassId].Eps[idx].add); } } diff --git a/Core/Src/usbd_ctlreq.c b/Core/Src/usbd_ctlreq.c index c733647..899bc70 100644 --- a/Core/Src/usbd_ctlreq.c +++ b/Core/Src/usbd_ctlreq.c @@ -895,7 +895,7 @@ static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) } else if (req->wValue == USB_FEATURE_TEST_MODE) { - pdev->dev_test_mode = req->wIndex >> 8; + pdev->dev_test_mode = (uint8_t)(req->wIndex >> 8); (void)USBD_CtlSendStatus(pdev); } else diff --git a/README.md b/README.md index ba20ce7..c25a919 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,31 @@ # Middleware USB Device MCU Component +![latest tag](https://img.shields.io/github/v/tag/STMicroelectronics/stm32_mw_usb_device.svg?color=brightgreen) + ## Overview -**STM32Cube** is an STMicroelectronics original initiative to ease the developers life by reducing efforts, time and cost. +**STM32Cube** is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost. -**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform, delivered for each STM32 series. +**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series. * The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product. - * The STM32 HAL-LL drivers : an abstraction drivers layer, the API ensuring maximized portability across the STM32 portfolio. - * The BSP Drivers of each evaluation or demonstration board provided by this STM32 series. - * A consistent set of middlewares components such as RTOS, USB, FatFS, Graphics, STM32_TouchSensing_Library... - * A full set of software projects (basic examples, applications or demonstrations) for each board provided by this STM32 series. + * The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio. + * The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series. + * A consistent set of middleware libraries such as RTOS, USB, FatFS, graphics, touch sensing library... + * A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series. Two models of publication are proposed for the STM32Cube embedded software: - * The monolithic **MCU Package** : all STM32Cube software modules of one STM32 series are present (Drivers, Middlewares, Projects, Utilities) in the repo (usual name **STM32Cubexx**, xx corresponding to the STM32 series). - * The **MCU component** : progressively from November 2019, each STM32Cube software module being part of the STM32Cube MCU Package, will be delivered as an individual repo, allowing the user to select and get only the required software functions. + * The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series). + * The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions. ## Description This **stm32_mw_usb_device** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **USB Device MCU Middleware** part. -## License - -Copyright (c) 2015 STMicroelectronics. - -This software component is licensed by ST under Ultimate Liberty license SLA0044, the "License". You may not use this file except in compliance with this license. You may obtain a copy of the license [here](https://www.st.com/SLA0044). +It represents ST offer to ensure the support of USB Devices on STM32 MCUs. +It includes two main modules: + * **Core** module for the USB device standard peripheral control APIs. It includes the files ensuring USB 2.0 standard code implementation for an USB device. +These files’ APIs will be called within every USB device application regardless of the desired functionality. + * **Class** module for the commonly supported classes APIs. it includes the files including different USB device classes. All STM32 USB classes are implemented according to the USB 2.0 and every class’s specifications. These files’ APIs will be called within USB device applications according to the desired functionality. ## Release note @@ -31,6 +33,4 @@ Details about the content of this release are available in the release note [her ## Troubleshooting -If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/stm32_mw_usb_device/issues/new/choose). - -For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/). +Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide. \ No newline at end of file diff --git a/Release_Notes.html b/Release_Notes.html index 1b9535d..22547fc 100644 --- a/Release_Notes.html +++ b/Release_Notes.html @@ -1,1429 +1,973 @@ - - - - - - - - Release Notes for STM32 USB Device Library - - - - - - - - -
-

 

-
- - - - - - -
- - - - - - - - - -
-

Back to Release - page

-
-

Release - Notes for STM32 USB Device Library

-

Copyright - 2015 STMicroelectronics

-

-
-

 

- - - - - - - - - -
-

Update - History

-

V2.10.0 - / 03-Sept-2021

-

Main - Changes

-
    -
  • Integration of  new USB device Class driver:
  • -
      -
    • Adding support of Composite devices with an auto - generation of composite device configuration - descriptors
    • -
    -
  • USB All Classes:
  • -
      -
    • Fix Code Spelling and improve Code Style
    • -
    • Update device class drivers to support Composite - devices
    • -
    • Improve declaration of USB configuration - descriptor table which is allocated if the - composite builder is not selected
    • -
    -
-

V2.9.0 - / 06-July-2021

-

Main - Changes

-
    -
  • Integration of  new USB device Class driver:
  • -
      -
    • USB CCID Class driver based on Universal - Serial Bus Device Class Definition for Integrated - Circuit(s) Cards Interface Devices Revision 1.1
    • -
    • USB MTP Class driver based on Universal Serial - Bus Device Class Media Transfer Protocol Revision - 1.1
    • -
    -
  • USB All Classes:
  • -
      -
    • Fix Code Spelling and improve Code Style
    • -
    • Update the way to declare licenses
    • -
    -
  • USB CDC/RNDIS/ECM Classes:
  • -
      -
    • Fix compilation warning with C++ due to missing - casting during class handler allocation
    • -
    -
-

V2.8.0 - / 10-Mars-2021

-

Main - Changes

-
    -
  • Integration of  new USB device Class driver:
  • -
      -
    • USB Printer Class driver based on Universal - Serial Bus Device Class Definition for Printing - Devices Version 1.1
    • -
    -
  • USB All Classes:
  • -
      -
    • Fix USB buffer overflow vulnerability for CDC, - CDC-ECM, CDC-RNDIS, DFU, AUDIO, CustomHID, and - Video Classes
    • -
    • fix compilation warning with C++ due to missing - casting during class handler allocation
    • -
    • Enhance comments of USB configuration - descriptors fields
    • -
    -
  • USB Video Class:
  • -
      -
    • fix missing closing bracket for extern "C" in - usbd_video.h
    • -
    • fix USBCV test with Uncompressed video format - support
    • -
    -
-

V2.7.1 - / 18-August-2020

- -

Main - Changes

-
    -
  • USB All Class:
  • -
      -
    • Add NULL pointer access check to Class handler
      -
    • -
    -
-

V2.7.0 - / 12-August-2020

-

Main - Changes

-
    -
  • Integration of  new USB device Class driver:
  • -
      -
    • USB video Class driver based on USB-IF video - class definition version 1.1
    • -
    -
-
    -
  • USB Core:
  • -
      -
    • Enhance NULL pointer check in Core APIs
    • -
    • Allow supporting both USER and USER Class string - desc
    • -
    • Add support of USB controller which handles - packet-size splitting by hardware
    • -
    • Avoid compilation warning due macro redefinition
    • -
    • change added to USBD_HandleTypeDef structure: - dev_state, old_dev_state and ep0_state declaration - become volatile to disable compiler optimization
    • -
    • Word spelling correction and file indentation - improved
    • -
    • usbd_conf.h/c Template file updated to suggest - using by default a static memory allocation for - Class handler
    • -
    -
-
    -
  • USB All Classes
  • -
      -
    • Word spelling correction and file indentation - improved
    • -
    • Allow updating device config descriptor Max - power from user code usbd_conf.h using - USBD_MAX_POWER define
    • -
    • Fix device config descriptor bmAttributes value - which depends on user code define - USBD_SELF_POWERED
    • -
    -
-
    -
  • USB CDC Class:
  • -
      -
    • Class specific request, add protection to limit - the maximum data length to be sent by the CDC - device
    • -
    -
-
    -
  • USB CustomHID Class:
  • -
      -
    • Allow changing CustomHID data EP size from user - code
    • -
    -
-
-

V2.6.1 - / 05-June-2020

-

Main - Changes

-
    -
  • USB Core:
  • -
      -
    • minor rework on USBD_Init() USBD_DeInit()
    • -
    • Fix warning issue with Keil due to missing - return value of setup API
      -
    • -
    -
  • USB CDC Class:
  • -
      -
    • Fix file indentation
    • -
    • Avoid accessing to NULL pointer in case - TransmitCplt() user fops is not defined to allow - application compatibility with device library - version below v2.6.0
      -
    • -
    -
-
-
    -
  • Fix minor misra-c 2012 violations
  • -
-

V2.6.0 - / 27-December-2019

-

Main - Changes

-
    -
  • Integration of three new USB device Class drivers:
  • -
      -
    • USB CDC ECM Class driver
    • -
    • USB CDC RNDIS Microsoft Class driver
    • -
    • USB Billboard Class driver
    • -
    -
  • Fix mandatory misra-c 2012 violations
  • -
  • update user core and class template files
  • -
  • USB Core:
  • -
      -
    • Fix unexpected EP0 stall during enumeration - phase 
    • -
    • Improve APIs error management and prevent - accessing NULL pointers
    • -
    -
  • USB MSC Class:
  • -
      -
    • Fix USBCV specific class tests
    • -
    • Fix multiple error with SCSI commands handling
    • -
    • Protect medium access when host ask for medium - ejection
    • -
    -
  • USB CDC Class:
  • -
      -
    • Add new function to inform user that current IN - transfer is completed
    • -
    • update transmit and receive APIs to transfer up - to 64KB
    • -
    -
-
    -
  • USB AUDIO Class:
  • -
      -
    • Fix audio sync start buffer size
    • -
    • update user callback periodicTC args by adding - pointer to user buffer and size
    • -
    -
  • USB CustomHID Class:
  • -
      -
    • Rework the OUT transfer complete and prevent - automatically re-enabling the OUT EP 
    • -
    • Add new user API to restart the OUT transfer: - USBD_CUSTOM_HID_ReceivePacket()
    • -
    -
-

V2.5.3 - / 30-April-2019

-

Main - Changes

-
    -
  • Fix misra-c 2012 high severity violations
  • -
  • Core driver:
  • -
      -
    • protect shared macros __ALIGN_BEGIN, __ALIGN_END - with C directive #ifndef
    • -
    • update Core driver and DFU Class driver to - use USBD_SUPPORT_USER_STRING_DESC instead of -  USBD_SUPPORT_USER_STRING
    • -
    •  prevent accessing to NULL pointer if the - get descriptor functions are not defined
    • -
    • Update on USBD_LL_Resume(),  restore the - device state only if the current state is - USBD_STATE_SUSPENDED
    • -
    -
-

V2.5.2 - / 27-Mars-2019

-

Main - Changes

-
    -
  • DFU - Class:
  • -
      -
    • fix - compilation warning due to unreachable instruction - code introduced with CMSIS V5.4.0 - NVIC_SystemReset() prototype change
    • -
    -
-

V2.5.1 - / 03-August-2018
-

-

Main - Changes

-
    -
  • Update - license section by adding path to get copy of ST - Ultimate Liberty license
  • -
  • Core: - Fix unexpected stall during status OUT phase
  • -
  • DFU - Class:
  • -
      -
    • rework - hdfu struct to prevent unaligned - addresses
    • -
    -
  • MSC Class:
  • -
      -
    • fix lba address overflow during large file - transfers > 4Go
    • -
    -
  • Template Class:
  • -
      -
    • add missing Switch case Break on - USBD_Template_Setup API
    • -
    -
-

V2.5.0 - / 15-December-2017
-

-

Main - Changes

-
    -
  • Update - license section
  • -
  • Update some - functions to be MISRAC - 2004 - compliant
  • -
  • Add - HS and OtherSpeed configuration descriptor for HID - and CustomHID classes
  • -
  • Correct - error handling in all class setup function
  • -
  • Add - usbd_desc_template.c/ usbd_desc_template.h - templates files
  • -
  • Add - support of class and vendor request
    -
  • -
  • CDC - Class: fix - zero-length packet issue in bulk IN transfer
  • -
  • Fix - compilation warning with unused arguments for some - functions
  • -
  • Improve - USB Core enumeration state machine
    -
  • -
-

V2.4.2 - / 11-December-2015
-

-

Main - Changes

-
    -
  • CDC - Class
  • -
      -
    • usbd_cdc.c: - change #include - "USBD_CDC.h" by #include - "usbd_cdc.h"
    • -
    -
-
-

V2.4.1 - / 19-June-2015
-

-

Main - Changes

-
    -
  • CDC - Class
  • -
      -
    • usbd_cdc.c: - comments update
    • -
    -
  • MSC - Class
  • -
      -
    • usbd_msc_bot.h: - update to be - C++ compliant
    • -
    -
  • AUDIO - Class
  • -
      -
    • usbd_audio.c: - fix issue when Host sends GetInterface command - it gets a wrong value
    • -
    -
      -
    • usbd_audio.c: - remove useless management of DMA half transfer
      -
    • -
    -
-

V2.4.0 - / 28-February-2015
-

-

Main - Changes

-
    -
  • Core - Driver
  • -
      -
    • Add - support of Link - Power Management (LPM): add - new API GetBOSDescriptor(), - that is used only if USBD_LPM_ENABLED - switch is enabled in usbd_conf.h file
    • -
    • usbd_core.c: -Fix - bug of unsupported premature Host Out stage - during data In stage (ie. when endpoint 0 - maximum data size is 8 and Host requests - GetDeviceDescriptor for the first time)
    • -
    • usbd_ctlreq.c: - Fix bug of unsupported Endpoint Class requests - (ie. Audio SetCurrent request for endpoint - sampling rate setting)
    • -
    -
  • HID - Class
  • -
      -
    • Updating - Polling time API USBD_HID_GetPollingInterval() - to query this period for HS and FS
    • -
    • usbd_hid.c: - Fix USBD_LL_CloseEP() function call in - USBD_HID_DeInit() replacing endpoint size by - endpoint address.
    • -
    -
  • CDC - Class
  • -
      -
    • usbd_cdc.c: 
    • -
        -
      • Add - missing GetInterface request management in - USBD_CDC_Setup() function
      • -
      -
        -
      • Update -USBD_CDC_Setup() - function to allow correct user implementation - of CDC_SET_CONTROL_LINE_STATE and similar - no-data setup requests.
        -
      • -
      -
    -
-

V2.3.0 - / 04-November-2014
-

-

Main - Changes

-
    -
  • Update - all drivers to be C++ compliant
    -
  • -
  • CDC - Class
  • -
      -
    • usbd_cdc.c: - fix clear flag issue in USBD_CDC_TransmitPacket() - function
    • -
    -
      -
    • usbd_cdc_if_template.c: - update - TEMPLATE_Receive() - function header comment
      -
    • -
    -
  • Miscellaneous - source code comments update
  • -
-

V2.2.0 - / 13-June-2014

-

Main - Changes

-
    -
  • Source - code comments review and update
  • -
  • HID - class
  • -
      -
    • Remove - unused API USBD_HID_DeviceQualifierDescriptor()
    • -
    • Add - a new API in the HID class to query the poll - time USBD_HID_GetPollingInterval()
      -
    • -
    -
  • CDC - class
  • -
      -
    • Bug - fix: missing handling ZeroLength Setup request
    • -
    -
  • All - classes
    -
  • -
      -
    • Add - alias for the class definition, it's defined as - macro with capital letter
    • -
    -
-
ex. - for the HID, the USBD_HID_CLASS - macro is defined this way #define - USBD_HID_CLASS  &USBD_HID
-   and - the application code can use the previous - definition: &USBD_HID - ex. USBD_RegisterClass(&USBD_Device, - &USBD_HID) or the new USBD_HID_CLASS - ex. USBD_RegisterClass(&USBD_Device, - USBD_HID_CLASS)
-

V2.1.0 - / 22-April-2014

-

Main - Changes

-
    -
  • usbd_conf_template.c: - update file with the right content (it was using - MSC memory management layer)
    -
  • -
  • usbd_conf_template.h: - change include of stm32f4xx.h - by stm32xxx.h - and add comment to inform user to adapt it to the - device used
  • -
  • Several - enhancements in CustomHID class
  • -
      -
    • Update - the Custom HID class driver to simplify the link - with user processes
    • -
    • Optimize - the Custom HID class driver and reduce footprint
    • -
    • Add - USBD_CUSTOM_HID_RegisterInterface() - API to link user process to custom HID - class
    • -
    • Add - Custom HID interface template file usbd_customhid_if_template.c/h
    • -
    -
  • Miscellaneous - comments update
    -
  • -
-

V2.0.0 - / 18-February-2014

-

Main - Changes

-
    -
  • Major - update based on STM32Cube specification: Library - Core, Classes architecture and APIs modified vs. - V1.1.0, and thus the 2 versions are not - compatible.
    -
  • -
  • This - version has to be used only with STM32Cube - based development
  • -
-

V1.1.0 - / 19-March-2012

-

Main - Changes

-
    -
  • Official - support of STM32F4xx - devices
  • -
  • All - source files: license disclaimer text update and - add link to the License file on ST Internet.
    -
  • -
  • Handle - test mode in the set feature request
  • -
  • Handle - dynamically the USB SELF POWERED feature
  • -
  • Handle - correctly the USBD_CtlError process to take into - account error during Control OUT stage
  • -
  • Miscellaneous - bug fix
  • -
-

V1.0.0 - / 22-July-2011

-

Main - Changes

-
    -
  • First - official version for STM32F105/7xx - and STM32F2xx - devices
  • -
-
- -

License

-

This software component is licensed by ST under - Ultimate Liberty license SLA0044, the "License"; - You may not use this component except in compliance - with the License. You may obtain a copy of the License - at:

-

http://www.st.com/SLA0044

-

- -
-
-

For - complete documentation on STM32 Microcontrollers visit www.st.com/STM32

-

-
-

-
-
-

 

-
- - + + + + + + + Release Notes for STM32GK Firmware Package + + + + + + +
+
+
+

Release Notes +for STM32Cube USB Device Library

+

Copyright © 2015 STMicroelectronics
+

+ +
+

Purpose

+

The USB device library comes on top of the STM32Cube™ USB device HAL +driver and offers all the APIs required to develop an USB device +application.

+

The main USB device library features are:

+ +

Here is the list of references to user documents:

+ +
+
+

Update History

+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
USB VIDEO Class:
Correction of the support of +VS_PROBE_CONTROL & VS_COMMIT_CONTROL requets
USB AUDIO Class:
Correction of the check on +AUDIO_TOTAL_BUF_SIZE to avoid vulnerabilities
USB HID Class:
Modification of some constants names to +avoid duplication versus USB host library
USB CustomHID Class:
Add support of Get Report control +request
Allow disabling EP OUT prepare receive +using a dedicated macros that can be defined in usbd_conf.h application +file
Add support of Report Descriptor with +length greater than 255 bytes
USB CCID Class:
Fix minor Code Spelling warning
USB All Classes:
Update all classes to support composite +multi-instance using the class id parameter
Fix code spelling and improve code +style
fix misraC 2012 rule 10.3
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Integration of new USB device +Class driver:
Adding support of Composite devices with +an auto generation of composite device configuration descriptors
USB All Classes:
Fix Code Spelling and improve Code +Style
Update device class drivers to support +Composite devices
Improve declaration of USB configuration +descriptor table which is allocated if the composite builder is not +selected
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Integration of new USB device +Class driver:
USB CCID Class driver based on Universal +Serial Bus Device Class Definition for Integrated Circuit(s) Cards +Interface Devices Revision 1.1
USB MTP Class driver based on Universal +Serial Bus Device Class Media Transfer Protocol Revision 1.1
USB All Classes:
Fix Code Spelling and improve Code +Style
Update the way to declare licenses
USB CDC/RNDIS/ECM +Classes:
Fix compilation warning with C++ due to +missing casting during class handler allocation
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Integration of new USB device +Class driver:
USB Printer Class driver based on +Universal Serial Bus Device Class Definition for Printing Devices +Version 1.1
USB All Classes:
Fix USB buffer overflow vulnerability for +CDC, CDC-ECM, CDC-RNDIS, DFU, AUDIO, CustomHID, and Video Classes
Fix compilation warning with C++ due to +missing casting during class handler allocation
Enhance comments of USB configuration +descriptors fields
USB Video Class:
Fix missing closing bracket for extern “C” +in usbd_video.h
Fix USBCV test with Uncompressed video +format support
+
+
+ + +

Main Changes

+ + + + + + + + + + + +
Headline
USB All Class: Add NULL pointer access +check to Class handler
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Integration of new USB device +Class driver:
USB video Class driver based on USB-IF +video class definition version 1.1
USB Core:
Enhance NULL pointer check in Core +APIs
Allow supporting both USER and USER Class +string desc
Add support of USB controller which +handles packet-size splitting by hardware
Avoid compilation warning due macro +redefinition
change added to USBD_HandleTypeDef +structure: dev_state, old_dev_state and ep0_state declaration become +volatile to disable compiler optimization
Word spelling correction and file +indentation improved
usbd_conf.h/c Template file updated to +suggest using by default a static memory allocation for Class +handler
USB All Classes:
Word spelling correction and file +indentation improved
Allow updating device config descriptor +Max power from user code usbd_conf.h using USBD_MAX_POWER define
Fix device config descriptor bmAttributes +value which depends on user code define USBD_SELF_POWERED
USB CDC Class:
Class specific request, add protection to +limit the maximum data length to be sent by the CDC device
USB CustomHID Class:
Allow changing CustomHID data EP size from +user code
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Fix minor misra-c 2012 violations
USB Core:
minor rework on USBD_Init() +USBD_DeInit()
Fix warning issue with Keil due to missing +return value of setup API
USB CDC Class:
Fix file indentation
Avoid accessing to NULL pointer in case +TransmitCplt() user fops is not defined to allow application +compatibility with device library version below v2.6.0
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Integration of three new USB device Class +drivers:CDC ECM , CDC RNDIS Microsoft, USB Billboard
Fix mandatory misra-c 2012 violations
update user core and class template +files
USB Core:
Fix unexpected EP0 stall during +enumeration phase
Improve APIs error management and prevent +accessing NULL pointers
USB MSC Class:
Fix USBCV specific class tests
Fix multiple error with SCSI commands +handling
Protect medium access when host ask for +medium ejection
USB CDC Class:
Add new function to inform user that +current IN transfer is completed
update transmit and receive APIs to +transfer up to 64KB
USB AUDIO Class:
Fix audio sync start buffer size
update user callback periodicTC args by +adding pointer to user buffer and size
USB CustomHID Class:
Rework the OUT transfer complete and +prevent automatically re-enabling the OUT EP
Add new user API to restart the OUT +transfer: USBD_CUSTOM_HID_ReceivePacket()
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Fix misra-c 2012 high severity +violations
Core driver:
protect shared macros __ALIGN_BEGIN, +__ALIGN_END with C directive #ifndef
update Core driver and DFU Class driver to +use USBD_SUPPORT_USER_STRING_DESC instead of +USBD_SUPPORT_USER_STRING
prevent accessing to NULL pointer if the +get descriptor functions are not defined
Update on USBD_LL_Resume(), restore the +device state only if the current state is USBD_STATE_SUSPENDED
+
+
+ + +

Main Changes

+ + + + + + + + + + + +
Headline
DFU Class: fix compilation warning due to +unreachable instruction code introduced with CMSIS V5.4.0 +NVIC_SystemReset() prototype change
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + +
Headline
Update license section by adding path to +get copy of ST Ultimate Liberty license
Core: Fix unexpected stall during status +OUT phase
DFU Class: rework hdfu struct to prevent +unaligned addresses
MSC Class: fix lba address overflow during +large file transfers greater than 4Go
Template Class: add missing Switch case +Break on USBD_Template_Setup API
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Update license section
Update some functions to be MISRAC 2004 +compliant
Add HS and OtherSpeed configuration +descriptor for HID and CustomHID classes
Correct error handling in all class setup +function
Add usbd_desc_template.c/ +usbd_desc_template.h templates files
Add support of class and vendor +request
CDC Class: fix zero-length packet issue in +bulk IN transfer
Fix compilation warning with unused +arguments for some functions
Improve USB Core enumeration state +machine
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + +
Headline
CDC Class
usbd_cdc.c: change #include “USBD_CDC.h” +by #include “usbd_cdc.h”
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
CDC Class
usbd_cdc.c: comments update
MSC Class
usbd_msc_bot.h: update to be C++ +compliant
AUDIO Class
usbd_audio.c: fix issue when Host sends +GetInterface command it gets a wrong value
usbd_audio.c: remove useless management of +DMA half transfer
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Core Driver
Add support of Link Power Management +(LPM): add new API GetBOSDescriptor(), that is used only if +USBD_LPM_ENABLED switch is enabled in usbd_conf.h file
usbd_core.c: Fix bug of unsupported +premature Host Out stage during data In stage (ie. when endpoint 0 +maximum data size is 8 and Host requests GetDeviceDescriptor for the +first time)
usbd_ctlreq.c: Fix bug of unsupported +Endpoint Class requests (ie. Audio SetCurrent request for endpoint +sampling rate setting)
HID Class
Updating Polling time API +USBD_HID_GetPollingInterval() to query this period for HS and FS
usbd_hid.c: Fix USBD_LL_CloseEP() function +call in USBD_HID_DeInit() replacing endpoint size by endpoint +address.
CDC Class
usbd_cdc.c: Add missing GetInterface +request management in USBD_CDC_Setup() function
usbd_cdc.c: Update USBD_CDC_Setup() +function to allow correct user implementation of +CDC_SET_CONTROL_LINE_STATE and similar no-data setup requests.
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + +
Headline
Update all drivers to be C++ +compliant
CDC Class
usbd_cdc.c: fix clear flag issue in +USBD_CDC_TransmitPacket() function
usbd_cdc_if_template.c: update +TEMPLATE_Receive() function header comment
Miscellaneous source code comments +update
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Source code comments review and +update
HID class
Remove unused API +USBD_HID_DeviceQualifierDescriptor()
Add a new API in the HID class to query +the poll time USBD_HID_GetPollingInterval()
CDC class
Bug fix: missing handling ZeroLength Setup +request
All classes
Add alias for the class definition, it’s +defined as macro with capital letter
ex. for the HID, the USBD_HID_CLASS macro +is defined this way #define USBD_HID_CLASS &USBD_HID
and the application code can use the +previous definition: &USBD_HID ex. +USBD_RegisterClass(&USBD_Device, &USBD_HID) or the new +USBD_HID_CLASS ex. USBD_RegisterClass(&USBD_Device, +USBD_HID_CLASS)
+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
usbd_conf_template.c: update file with the +right content (it was using MSC memory management layer)
usbd_conf_template.h: change include of +stm32f4xx.h by stm32xxx.h and add comment to inform user to adapt it to +the device used
Several enhancements in CustomHID +class
Update the Custom HID class driver to +simplify the link with user processes
Optimize the Custom HID class driver and +reduce footprint
Add USBD_CUSTOM_HID_RegisterInterface() +API to link user process to custom HID class
Add Custom HID interface template file +usbd_customhid_if_template.c/h
Miscellaneous comments update
+
+
+ + +

Main Changes

+

Major update based on STM32Cube specification.

+ + + + + + + + + + + +
Headline
Library Core, Classes architecture and +APIs modified vs. V1.1.0, and thus the 2 versions are not +compatible.
+

This version has to be used only with STM32Cube based +development

+
+
+ + +

Main Changes

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Headline
Official support of STM32F4xx devices
All source files: license disclaimer text +update and add link to the License file on ST Internet.
Handle test mode in the set feature +request
Handle dynamically the USB SELF POWERED +feature
Handle correctly the USBD_CtlError process +to take into account error during Control OUT stage
Miscellaneous bug fix
+
+
+ + +

Main Changes

+

First official version for STM32F105/7xx and STM32F2xx devices

+
+
+
+ + + diff --git a/Release_Notes.md b/Release_Notes.md new file mode 100644 index 0000000..5c1e033 --- /dev/null +++ b/Release_Notes.md @@ -0,0 +1,496 @@ +--- +pagetitle: Release Notes for STM32GK Firmware Package +lang: en +header-includes: +--- + +::: {.row} +::: {.col-sm-12 .col-lg-4} + +
+# Release Notes for STM32Cube USB Device Library +Copyright © 2015 STMicroelectronics\ + +[![ST logo](_htmresc/st_logo_2020.png)](https://www.st.com){.logo} +
+ +# Purpose + +The USB device library comes on top of the STM32Cube™ USB device HAL driver and +offers all the APIs required to develop an USB device application. + +The main USB device library features are: + + - Support of multi packet transfer features allowing sending big amount of data without + splitting it into max packet size transfers. + - Support of most common USB Class drivers (HID, MSC, DFU, CDC-ACM, CDC-ECM, RNDIS, MTP, AUDIO1.0, Printer, Video, Composite) + - Configuration files to interface with Cube HAL and change the library configuration without changing + the library code (Read Only). + - 32-bits aligned data structures to handle DMA based transfer in High speed modes. + +Here is the list of references to user documents: + +- [UM1734](https://www.st.com/resource/en/user_manual/DM00108129.pdf) : STM32Cube USB device library User Manual +- [Wiki Page](https://wiki.st.com/stm32mcu/wiki/USB_overview) : STM32Cube USB Wiki Page + +::: + +::: {.col-sm-12 .col-lg-8} +# Update History +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **USB VIDEO Class:** + Correction of the support of VS_PROBE_CONTROL & VS_COMMIT_CONTROL requets + **USB AUDIO Class:** + Correction of the check on AUDIO_TOTAL_BUF_SIZE to avoid vulnerabilities + **USB HID Class:** + Modification of some constants names to avoid duplication versus USB host library + **USB CustomHID Class:** + Add support of Get Report control request + Allow disabling EP OUT prepare receive using a dedicated macros that can be defined in usbd_conf.h application file + Add support of Report Descriptor with length greater than 255 bytes + **USB CCID Class:** + Fix minor Code Spelling warning + **USB All Classes:** + Update all classes to support composite multi-instance using the class id parameter + Fix code spelling and improve code style + fix misraC 2012 rule 10.3 + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **Integration of new USB device Class driver:** + Adding support of Composite devices with an auto generation of composite device configuration descriptors + **USB All Classes:** + Fix Code Spelling and improve Code Style + Update device class drivers to support Composite devices + Improve declaration of USB configuration descriptor table which is allocated if the composite builder is not selected + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **Integration of new USB device Class driver:** + USB CCID Class driver based on Universal Serial Bus Device Class Definition for Integrated Circuit(s) Cards Interface Devices Revision 1.1 + USB MTP Class driver based on Universal Serial Bus Device Class Media Transfer Protocol Revision 1.1 + **USB All Classes:** + Fix Code Spelling and improve Code Style + Update the way to declare licenses + **USB CDC/RNDIS/ECM Classes:** + Fix compilation warning with C++ due to missing casting during class handler allocation + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **Integration of new USB device Class driver:** + USB Printer Class driver based on Universal Serial Bus Device Class Definition for Printing Devices Version 1.1 + **USB All Classes:** + Fix USB buffer overflow vulnerability for CDC, CDC-ECM, CDC-RNDIS, DFU, AUDIO, CustomHID, and Video Classes + Fix compilation warning with C++ due to missing casting during class handler allocation + Enhance comments of USB configuration descriptors fields + **USB Video Class:** + Fix missing closing bracket for extern "C" in usbd_video.h + Fix USBCV test with Uncompressed video format support + + +
+::: + + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + USB All Class: Add NULL pointer access check to Class handler + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **Integration of new USB device Class driver:** + USB video Class driver based on USB-IF video class definition version 1.1 + **USB Core:** + Enhance NULL pointer check in Core APIs + Allow supporting both USER and USER Class string desc + Add support of USB controller which handles packet-size splitting by hardware + Avoid compilation warning due macro redefinition + change added to USBD_HandleTypeDef structure: dev_state, old_dev_state and ep0_state declaration become volatile to disable compiler optimization + Word spelling correction and file indentation improved + usbd_conf.h/c Template file updated to suggest using by default a static memory allocation for Class handler + **USB All Classes:** + Word spelling correction and file indentation improved + Allow updating device config descriptor Max power from user code usbd_conf.h using USBD_MAX_POWER define + Fix device config descriptor bmAttributes value which depends on user code define USBD_SELF_POWERED + **USB CDC Class:** + Class specific request, add protection to limit the maximum data length to be sent by the CDC device + **USB CustomHID Class:** + Allow changing CustomHID data EP size from user code + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Fix minor misra-c 2012 violations + **USB Core:** + minor rework on USBD_Init() USBD_DeInit() + Fix warning issue with Keil due to missing return value of setup API + **USB CDC Class:** + Fix file indentation + Avoid accessing to NULL pointer in case TransmitCplt() user fops is not defined to allow application compatibility with device library version below v2.6.0 + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Integration of three new USB device Class drivers:CDC ECM , CDC RNDIS Microsoft, USB Billboard + Fix mandatory misra-c 2012 violations + update user core and class template files + **USB Core:** + Fix unexpected EP0 stall during enumeration phase + Improve APIs error management and prevent accessing NULL pointers + **USB MSC Class:** + Fix USBCV specific class tests + Fix multiple error with SCSI commands handling + Protect medium access when host ask for medium ejection + **USB CDC Class:** + Add new function to inform user that current IN transfer is completed + update transmit and receive APIs to transfer up to 64KB + **USB AUDIO Class:** + Fix audio sync start buffer size + update user callback periodicTC args by adding pointer to user buffer and size + **USB CustomHID Class:** + Rework the OUT transfer complete and prevent automatically re-enabling the OUT EP + Add new user API to restart the OUT transfer: USBD_CUSTOM_HID_ReceivePacket() + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Fix misra-c 2012 high severity violations + **Core driver:** + protect shared macros __ALIGN_BEGIN, __ALIGN_END with C directive #ifndef + update Core driver and DFU Class driver to use USBD_SUPPORT_USER_STRING_DESC instead of USBD_SUPPORT_USER_STRING + prevent accessing to NULL pointer if the get descriptor functions are not defined + Update on USBD_LL_Resume(), restore the device state only if the current state is USBD_STATE_SUSPENDED + + +
+::: + + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + DFU Class: fix compilation warning due to unreachable instruction code introduced with CMSIS V5.4.0 NVIC_SystemReset() prototype change + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Update license section by adding path to get copy of ST Ultimate Liberty license + Core: Fix unexpected stall during status OUT phase + DFU Class: rework hdfu struct to prevent unaligned addresses + MSC Class: fix lba address overflow during large file transfers greater than 4Go + Template Class: add missing Switch case Break on USBD_Template_Setup API + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Update license section + Update some functions to be MISRAC 2004 compliant + Add HS and OtherSpeed configuration descriptor for HID and CustomHID classes + Correct error handling in all class setup function + Add usbd_desc_template.c/ usbd_desc_template.h templates files + Add support of class and vendor request + CDC Class: fix zero-length packet issue in bulk IN transfer + Fix compilation warning with unused arguments for some functions + Improve USB Core enumeration state machine + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **CDC Class** + usbd_cdc.c: change #include "USBD_CDC.h" by #include "usbd_cdc.h" + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **CDC Class** + usbd_cdc.c: comments update + **MSC Class** + usbd_msc_bot.h: update to be C++ compliant + **AUDIO Class** + usbd_audio.c: fix issue when Host sends GetInterface command it gets a wrong value + usbd_audio.c: remove useless management of DMA half transfer + + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + **Core Driver** + Add support of Link Power Management (LPM): add new API GetBOSDescriptor(), that is used only if USBD_LPM_ENABLED switch is enabled in usbd_conf.h file + usbd_core.c: Fix bug of unsupported premature Host Out stage during data In stage (ie. when endpoint 0 maximum data size is 8 and Host requests GetDeviceDescriptor for the first time) + usbd_ctlreq.c: Fix bug of unsupported Endpoint Class requests (ie. Audio SetCurrent request for endpoint sampling rate setting) + **HID Class** + Updating Polling time API USBD_HID_GetPollingInterval() to query this period for HS and FS + usbd_hid.c: Fix USBD_LL_CloseEP() function call in USBD_HID_DeInit() replacing endpoint size by endpoint address. + **CDC Class** + usbd_cdc.c: Add missing GetInterface request management in USBD_CDC_Setup() function + usbd_cdc.c: Update USBD_CDC_Setup() function to allow correct user implementation of CDC_SET_CONTROL_LINE_STATE and similar no-data setup requests. + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Update all drivers to be C++ compliant + **CDC Class** + usbd_cdc.c: fix clear flag issue in USBD_CDC_TransmitPacket() function + usbd_cdc_if_template.c: update TEMPLATE_Receive() function header comment + Miscellaneous source code comments update + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Source code comments review and update + **HID class** + Remove unused API USBD_HID_DeviceQualifierDescriptor() + Add a new API in the HID class to query the poll time USBD_HID_GetPollingInterval() + **CDC class** + Bug fix: missing handling ZeroLength Setup request + **All classes** + Add alias for the class definition, it's defined as macro with capital letter + ex. for the HID, the USBD_HID_CLASS macro is defined this way #define USBD_HID_CLASS &USBD_HID + and the application code can use the previous definition: &USBD_HID ex. USBD_RegisterClass(&USBD_Device, &USBD_HID) or the new USBD_HID_CLASS ex. USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS) + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + usbd_conf_template.c: update file with the right content (it was using MSC memory management layer) + usbd_conf_template.h: change include of stm32f4xx.h by stm32xxx.h and add comment to inform user to adapt it to the device used + Several enhancements in CustomHID class + Update the Custom HID class driver to simplify the link with user processes + Optimize the Custom HID class driver and reduce footprint + Add USBD_CUSTOM_HID_RegisterInterface() API to link user process to custom HID class + Add Custom HID interface template file usbd_customhid_if_template.c/h + Miscellaneous comments update + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + +Major update based on STM32Cube specification. + + Headline + --------- + Library Core, Classes architecture and APIs modified vs. V1.1.0, and thus the 2 versions are not compatible. + + +**This version has to be used only with STM32Cube based development** + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + + Headline + --------- + Official support of STM32F4xx devices + All source files: license disclaimer text update and add link to the License file on ST Internet. + Handle test mode in the set feature request + Handle dynamically the USB SELF POWERED feature + Handle correctly the USBD_CtlError process to take into account error during Control OUT stage + Miscellaneous bug fix + +
+::: + +::: {.collapse} + + +
+ +## Main Changes + +First official version for STM32F105/7xx and STM32F2xx devices + +
+::: + +::: +::: + + diff --git a/_htmresc/favicon.png b/_htmresc/favicon.png new file mode 100644 index 0000000..06713ee Binary files /dev/null and b/_htmresc/favicon.png differ diff --git a/_htmresc/mini-st.css b/_htmresc/mini-st.css new file mode 100644 index 0000000..986f4d4 --- /dev/null +++ b/_htmresc/mini-st.css @@ -0,0 +1,1711 @@ +@charset "UTF-8"; +/* + Flavor name: Custom (mini-custom) + Generated online - https://minicss.org/flavors + mini.css version: v3.0.1 +*/ +/* + Browsers resets and base typography. +*/ +/* Core module CSS variable definitions */ +:root { + --fore-color: #03234b; + --secondary-fore-color: #03234b; + --back-color: #ffffff; + --secondary-back-color: #ffffff; + --blockquote-color: #e6007e; + --pre-color: #e6007e; + --border-color: #3cb4e6; + --secondary-border-color: #3cb4e6; + --heading-ratio: 1.2; + --universal-margin: 0.5rem; + --universal-padding: 0.25rem; + --universal-border-radius: 0.075rem; + --background-margin: 1.5%; + --a-link-color: #3cb4e6; + --a-visited-color: #8c0078; } + +html { + font-size: 13.5px; } + +a, b, del, em, i, ins, q, span, strong, u { + font-size: 1em; } + +html, * { + font-family: -apple-system, BlinkMacSystemFont, Helvetica, arial, sans-serif; + line-height: 1.25; + -webkit-text-size-adjust: 100%; } + +* { + font-size: 1rem; } + +body { + margin: 0; + color: var(--fore-color); + @background: var(--back-color); + background: var(--back-color) linear-gradient(#ffd200, #ffd200) repeat-y left top; + background-size: var(--background-margin); + } + +details { + display: block; } + +summary { + display: list-item; } + +abbr[title] { + border-bottom: none; + text-decoration: underline dotted; } + +input { + overflow: visible; } + +img { + max-width: 100%; + height: auto; } + +h1, h2, h3, h4, h5, h6 { + line-height: 1.25; + margin: calc(1.5 * var(--universal-margin)) var(--universal-margin); + font-weight: 400; } + h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { + color: var(--secondary-fore-color); + display: block; + margin-top: -0.25rem; } + +h1 { + font-size: calc(1rem * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio)); } + +h2 { + font-size: calc(1rem * var(--heading-ratio) * var(--heading-ratio) ); + border-style: none none solid none ; + border-width: thin; + border-color: var(--border-color); } +h3 { + font-size: calc(1rem * var(--heading-ratio) ); } + +h4 { + font-size: calc(1rem * var(--heading-ratio)); } + +h5 { + font-size: 1rem; } + +h6 { + font-size: calc(1rem / var(--heading-ratio)); } + +p { + margin: var(--universal-margin); } + +ol, ul { + margin: var(--universal-margin); + padding-left: calc(3 * var(--universal-margin)); } + +b, strong { + font-weight: 700; } + +hr { + box-sizing: content-box; + border: 0; + line-height: 1.25em; + margin: var(--universal-margin); + height: 0.0714285714rem; + background: linear-gradient(to right, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent); } + +blockquote { + display: block; + position: relative; + font-style: italic; + color: var(--secondary-fore-color); + margin: var(--universal-margin); + padding: calc(3 * var(--universal-padding)); + border: 0.0714285714rem solid var(--secondary-border-color); + border-left: 0.3rem solid var(--blockquote-color); + border-radius: 0 var(--universal-border-radius) var(--universal-border-radius) 0; } + blockquote:before { + position: absolute; + top: calc(0rem - var(--universal-padding)); + left: 0; + font-family: sans-serif; + font-size: 2rem; + font-weight: 800; + content: "\201c"; + color: var(--blockquote-color); } + blockquote[cite]:after { + font-style: normal; + font-size: 0.75em; + font-weight: 700; + content: "\a— " attr(cite); + white-space: pre; } + +code, kbd, pre, samp { + font-family: Menlo, Consolas, monospace; + font-size: 0.85em; } + +code { + background: var(--secondary-back-color); + border-radius: var(--universal-border-radius); + padding: calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2); } + +kbd { + background: var(--fore-color); + color: var(--back-color); + border-radius: var(--universal-border-radius); + padding: calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2); } + +pre { + overflow: auto; + background: var(--secondary-back-color); + padding: calc(1.5 * var(--universal-padding)); + margin: var(--universal-margin); + border: 0.0714285714rem solid var(--secondary-border-color); + border-left: 0.2857142857rem solid var(--pre-color); + border-radius: 0 var(--universal-border-radius) var(--universal-border-radius) 0; } + +sup, sub, code, kbd { + line-height: 0; + position: relative; + vertical-align: baseline; } + +small, sup, sub, figcaption { + font-size: 0.75em; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +figure { + margin: var(--universal-margin); } + +figcaption { + color: var(--secondary-fore-color); } + +a { + text-decoration: none; } + a:link { + color: var(--a-link-color); } + a:visited { + color: var(--a-visited-color); } + a:hover, a:focus { + text-decoration: underline; } + +/* + Definitions for the grid system, cards and containers. +*/ +.container { + margin: 0 auto; + padding: 0 calc(1.5 * var(--universal-padding)); } + +.row { + box-sizing: border-box; + display: flex; + flex: 0 1 auto; + flex-flow: row wrap; + margin: 0 0 0 var(--background-margin); } + +.col-sm, +[class^='col-sm-'], +[class^='col-sm-offset-'], +.row[class*='cols-sm-'] > * { + box-sizing: border-box; + flex: 0 0 auto; + padding: 0 calc(var(--universal-padding) / 2); } + +.col-sm, +.row.cols-sm > * { + max-width: 100%; + flex-grow: 1; + flex-basis: 0; } + +.col-sm-1, +.row.cols-sm-1 > * { + max-width: 8.3333333333%; + flex-basis: 8.3333333333%; } + +.col-sm-offset-0 { + margin-left: 0; } + +.col-sm-2, +.row.cols-sm-2 > * { + max-width: 16.6666666667%; + flex-basis: 16.6666666667%; } + +.col-sm-offset-1 { + margin-left: 8.3333333333%; } + +.col-sm-3, +.row.cols-sm-3 > * { + max-width: 25%; + flex-basis: 25%; } + +.col-sm-offset-2 { + margin-left: 16.6666666667%; } + +.col-sm-4, +.row.cols-sm-4 > * { + max-width: 33.3333333333%; + flex-basis: 33.3333333333%; } + +.col-sm-offset-3 { + margin-left: 25%; } + +.col-sm-5, +.row.cols-sm-5 > * { + max-width: 41.6666666667%; + flex-basis: 41.6666666667%; } + +.col-sm-offset-4 { + margin-left: 33.3333333333%; } + +.col-sm-6, +.row.cols-sm-6 > * { + max-width: 50%; + flex-basis: 50%; } + +.col-sm-offset-5 { + margin-left: 41.6666666667%; } + +.col-sm-7, +.row.cols-sm-7 > * { + max-width: 58.3333333333%; + flex-basis: 58.3333333333%; } + +.col-sm-offset-6 { + margin-left: 50%; } + +.col-sm-8, +.row.cols-sm-8 > * { + max-width: 66.6666666667%; + flex-basis: 66.6666666667%; } + +.col-sm-offset-7 { + margin-left: 58.3333333333%; } + +.col-sm-9, +.row.cols-sm-9 > * { + max-width: 75%; + flex-basis: 75%; } + +.col-sm-offset-8 { + margin-left: 66.6666666667%; } + +.col-sm-10, +.row.cols-sm-10 > * { + max-width: 83.3333333333%; + flex-basis: 83.3333333333%; } + +.col-sm-offset-9 { + margin-left: 75%; } + +.col-sm-11, +.row.cols-sm-11 > * { + max-width: 91.6666666667%; + flex-basis: 91.6666666667%; } + +.col-sm-offset-10 { + margin-left: 83.3333333333%; } + +.col-sm-12, +.row.cols-sm-12 > * { + max-width: 100%; + flex-basis: 100%; } + +.col-sm-offset-11 { + margin-left: 91.6666666667%; } + +.col-sm-normal { + order: initial; } + +.col-sm-first { + order: -999; } + +.col-sm-last { + order: 999; } + +@media screen and (min-width: 500px) { + .col-md, + [class^='col-md-'], + [class^='col-md-offset-'], + .row[class*='cols-md-'] > * { + box-sizing: border-box; + flex: 0 0 auto; + padding: 0 calc(var(--universal-padding) / 2); } + + .col-md, + .row.cols-md > * { + max-width: 100%; + flex-grow: 1; + flex-basis: 0; } + + .col-md-1, + .row.cols-md-1 > * { + max-width: 8.3333333333%; + flex-basis: 8.3333333333%; } + + .col-md-offset-0 { + margin-left: 0; } + + .col-md-2, + .row.cols-md-2 > * { + max-width: 16.6666666667%; + flex-basis: 16.6666666667%; } + + .col-md-offset-1 { + margin-left: 8.3333333333%; } + + .col-md-3, + .row.cols-md-3 > * { + max-width: 25%; + flex-basis: 25%; } + + .col-md-offset-2 { + margin-left: 16.6666666667%; } + + .col-md-4, + .row.cols-md-4 > * { + max-width: 33.3333333333%; + flex-basis: 33.3333333333%; } + + .col-md-offset-3 { + margin-left: 25%; } + + .col-md-5, + .row.cols-md-5 > * { + max-width: 41.6666666667%; + flex-basis: 41.6666666667%; } + + .col-md-offset-4 { + margin-left: 33.3333333333%; } + + .col-md-6, + .row.cols-md-6 > * { + max-width: 50%; + flex-basis: 50%; } + + .col-md-offset-5 { + margin-left: 41.6666666667%; } + + .col-md-7, + .row.cols-md-7 > * { + max-width: 58.3333333333%; + flex-basis: 58.3333333333%; } + + .col-md-offset-6 { + margin-left: 50%; } + + .col-md-8, + .row.cols-md-8 > * { + max-width: 66.6666666667%; + flex-basis: 66.6666666667%; } + + .col-md-offset-7 { + margin-left: 58.3333333333%; } + + .col-md-9, + .row.cols-md-9 > * { + max-width: 75%; + flex-basis: 75%; } + + .col-md-offset-8 { + margin-left: 66.6666666667%; } + + .col-md-10, + .row.cols-md-10 > * { + max-width: 83.3333333333%; + flex-basis: 83.3333333333%; } + + .col-md-offset-9 { + margin-left: 75%; } + + .col-md-11, + .row.cols-md-11 > * { + max-width: 91.6666666667%; + flex-basis: 91.6666666667%; } + + .col-md-offset-10 { + margin-left: 83.3333333333%; } + + .col-md-12, + .row.cols-md-12 > * { + max-width: 100%; + flex-basis: 100%; } + + .col-md-offset-11 { + margin-left: 91.6666666667%; } + + .col-md-normal { + order: initial; } + + .col-md-first { + order: -999; } + + .col-md-last { + order: 999; } } +@media screen and (min-width: 1280px) { + .col-lg, + [class^='col-lg-'], + [class^='col-lg-offset-'], + .row[class*='cols-lg-'] > * { + box-sizing: border-box; + flex: 0 0 auto; + padding: 0 calc(var(--universal-padding) / 2); } + + .col-lg, + .row.cols-lg > * { + max-width: 100%; + flex-grow: 1; + flex-basis: 0; } + + .col-lg-1, + .row.cols-lg-1 > * { + max-width: 8.3333333333%; + flex-basis: 8.3333333333%; } + + .col-lg-offset-0 { + margin-left: 0; } + + .col-lg-2, + .row.cols-lg-2 > * { + max-width: 16.6666666667%; + flex-basis: 16.6666666667%; } + + .col-lg-offset-1 { + margin-left: 8.3333333333%; } + + .col-lg-3, + .row.cols-lg-3 > * { + max-width: 25%; + flex-basis: 25%; } + + .col-lg-offset-2 { + margin-left: 16.6666666667%; } + + .col-lg-4, + .row.cols-lg-4 > * { + max-width: 33.3333333333%; + flex-basis: 33.3333333333%; } + + .col-lg-offset-3 { + margin-left: 25%; } + + .col-lg-5, + .row.cols-lg-5 > * { + max-width: 41.6666666667%; + flex-basis: 41.6666666667%; } + + .col-lg-offset-4 { + margin-left: 33.3333333333%; } + + .col-lg-6, + .row.cols-lg-6 > * { + max-width: 50%; + flex-basis: 50%; } + + .col-lg-offset-5 { + margin-left: 41.6666666667%; } + + .col-lg-7, + .row.cols-lg-7 > * { + max-width: 58.3333333333%; + flex-basis: 58.3333333333%; } + + .col-lg-offset-6 { + margin-left: 50%; } + + .col-lg-8, + .row.cols-lg-8 > * { + max-width: 66.6666666667%; + flex-basis: 66.6666666667%; } + + .col-lg-offset-7 { + margin-left: 58.3333333333%; } + + .col-lg-9, + .row.cols-lg-9 > * { + max-width: 75%; + flex-basis: 75%; } + + .col-lg-offset-8 { + margin-left: 66.6666666667%; } + + .col-lg-10, + .row.cols-lg-10 > * { + max-width: 83.3333333333%; + flex-basis: 83.3333333333%; } + + .col-lg-offset-9 { + margin-left: 75%; } + + .col-lg-11, + .row.cols-lg-11 > * { + max-width: 91.6666666667%; + flex-basis: 91.6666666667%; } + + .col-lg-offset-10 { + margin-left: 83.3333333333%; } + + .col-lg-12, + .row.cols-lg-12 > * { + max-width: 100%; + flex-basis: 100%; } + + .col-lg-offset-11 { + margin-left: 91.6666666667%; } + + .col-lg-normal { + order: initial; } + + .col-lg-first { + order: -999; } + + .col-lg-last { + order: 999; } } +/* Card component CSS variable definitions */ +:root { + --card-back-color: #3cb4e6; + --card-fore-color: #03234b; + --card-border-color: #03234b; } + +.card { + display: flex; + flex-direction: column; + justify-content: space-between; + align-self: center; + position: relative; + width: 100%; + background: var(--card-back-color); + color: var(--card-fore-color); + border: 0.0714285714rem solid var(--card-border-color); + border-radius: var(--universal-border-radius); + margin: var(--universal-margin); + overflow: hidden; } + @media screen and (min-width: 320px) { + .card { + max-width: 320px; } } + .card > .sectione { + background: var(--card-back-color); + color: var(--card-fore-color); + box-sizing: border-box; + margin: 0; + border: 0; + border-radius: 0; + border-bottom: 0.0714285714rem solid var(--card-border-color); + padding: var(--universal-padding); + width: 100%; } + .card > .sectione.media { + height: 200px; + padding: 0; + -o-object-fit: cover; + object-fit: cover; } + .card > .sectione:last-child { + border-bottom: 0; } + +/* + Custom elements for card elements. +*/ +@media screen and (min-width: 240px) { + .card.small { + max-width: 240px; } } +@media screen and (min-width: 480px) { + .card.large { + max-width: 480px; } } +.card.fluid { + max-width: 100%; + width: auto; } + +.card.warning { + --card-back-color: #e5b8b7; + --card-fore-color: #3b234b; + --card-border-color: #8c0078; } + +.card.error { + --card-back-color: #464650; + --card-fore-color: #ffffff; + --card-border-color: #8c0078; } + +.card > .sectione.dark { + --card-back-color: #3b234b; + --card-fore-color: #ffffff; } + +.card > .sectione.double-padded { + padding: calc(1.5 * var(--universal-padding)); } + +/* + Definitions for forms and input elements. +*/ +/* Input_control module CSS variable definitions */ +:root { + --form-back-color: #ffe97f; + --form-fore-color: #03234b; + --form-border-color: #3cb4e6; + --input-back-color: #ffffff; + --input-fore-color: #03234b; + --input-border-color: #3cb4e6; + --input-focus-color: #0288d1; + --input-invalid-color: #d32f2f; + --button-back-color: #e2e2e2; + --button-hover-back-color: #dcdcdc; + --button-fore-color: #212121; + --button-border-color: transparent; + --button-hover-border-color: transparent; + --button-group-border-color: rgba(124, 124, 124, 0.54); } + +form { + background: var(--form-back-color); + color: var(--form-fore-color); + border: 0.0714285714rem solid var(--form-border-color); + border-radius: var(--universal-border-radius); + margin: var(--universal-margin); + padding: calc(2 * var(--universal-padding)) var(--universal-padding); } + +fieldset { + border: 0.0714285714rem solid var(--form-border-color); + border-radius: var(--universal-border-radius); + margin: calc(var(--universal-margin) / 4); + padding: var(--universal-padding); } + +legend { + box-sizing: border-box; + display: table; + max-width: 100%; + white-space: normal; + font-weight: 500; + padding: calc(var(--universal-padding) / 2); } + +label { + padding: calc(var(--universal-padding) / 2) var(--universal-padding); } + +.input-group { + display: inline-block; } + .input-group.fluid { + display: flex; + align-items: center; + justify-content: center; } + .input-group.fluid > input { + max-width: 100%; + flex-grow: 1; + flex-basis: 0px; } + @media screen and (max-width: 499px) { + .input-group.fluid { + align-items: stretch; + flex-direction: column; } } + .input-group.vertical { + display: flex; + align-items: stretch; + flex-direction: column; } + .input-group.vertical > input { + max-width: 100%; + flex-grow: 1; + flex-basis: 0px; } + +[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { + height: auto; } + +[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; } + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +input:not([type]), [type="text"], [type="email"], [type="number"], [type="search"], +[type="password"], [type="url"], [type="tel"], [type="checkbox"], [type="radio"], textarea, select { + box-sizing: border-box; + background: var(--input-back-color); + color: var(--input-fore-color); + border: 0.0714285714rem solid var(--input-border-color); + border-radius: var(--universal-border-radius); + margin: calc(var(--universal-margin) / 2); + padding: var(--universal-padding) calc(1.5 * var(--universal-padding)); } + +input:not([type="button"]):not([type="submit"]):not([type="reset"]):hover, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus, textarea:hover, textarea:focus, select:hover, select:focus { + border-color: var(--input-focus-color); + box-shadow: none; } +input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid { + border-color: var(--input-invalid-color); + box-shadow: none; } +input:not([type="button"]):not([type="submit"]):not([type="reset"])[readonly], textarea[readonly], select[readonly] { + background: var(--secondary-back-color); } + +select { + max-width: 100%; } + +option { + overflow: hidden; + text-overflow: ellipsis; } + +[type="checkbox"], [type="radio"] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + position: relative; + height: calc(1rem + var(--universal-padding) / 2); + width: calc(1rem + var(--universal-padding) / 2); + vertical-align: text-bottom; + padding: 0; + flex-basis: calc(1rem + var(--universal-padding) / 2) !important; + flex-grow: 0 !important; } + [type="checkbox"]:checked:before, [type="radio"]:checked:before { + position: absolute; } + +[type="checkbox"]:checked:before { + content: '\2713'; + font-family: sans-serif; + font-size: calc(1rem + var(--universal-padding) / 2); + top: calc(0rem - var(--universal-padding)); + left: calc(var(--universal-padding) / 4); } + +[type="radio"] { + border-radius: 100%; } + [type="radio"]:checked:before { + border-radius: 100%; + content: ''; + top: calc(0.0714285714rem + var(--universal-padding) / 2); + left: calc(0.0714285714rem + var(--universal-padding) / 2); + background: var(--input-fore-color); + width: 0.5rem; + height: 0.5rem; } + +:placeholder-shown { + color: var(--input-fore-color); } + +::-ms-placeholder { + color: var(--input-fore-color); + opacity: 0.54; } + +button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; } + +button, html [type="button"], [type="reset"], [type="submit"] { + -webkit-appearance: button; } + +button { + overflow: visible; + text-transform: none; } + +button, [type="button"], [type="submit"], [type="reset"], +a.button, label.button, .button, +a[role="button"], label[role="button"], [role="button"] { + display: inline-block; + background: var(--button-back-color); + color: var(--button-fore-color); + border: 0.0714285714rem solid var(--button-border-color); + border-radius: var(--universal-border-radius); + padding: var(--universal-padding) calc(1.5 * var(--universal-padding)); + margin: var(--universal-margin); + text-decoration: none; + cursor: pointer; + transition: background 0.3s; } + button:hover, button:focus, [type="button"]:hover, [type="button"]:focus, [type="submit"]:hover, [type="submit"]:focus, [type="reset"]:hover, [type="reset"]:focus, + a.button:hover, + a.button:focus, label.button:hover, label.button:focus, .button:hover, .button:focus, + a[role="button"]:hover, + a[role="button"]:focus, label[role="button"]:hover, label[role="button"]:focus, [role="button"]:hover, [role="button"]:focus { + background: var(--button-hover-back-color); + border-color: var(--button-hover-border-color); } + +input:disabled, input[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled], button:disabled, button[disabled], .button:disabled, .button[disabled], [role="button"]:disabled, [role="button"][disabled] { + cursor: not-allowed; + opacity: 0.75; } + +.button-group { + display: flex; + border: 0.0714285714rem solid var(--button-group-border-color); + border-radius: var(--universal-border-radius); + margin: var(--universal-margin); } + .button-group > button, .button-group [type="button"], .button-group > [type="submit"], .button-group > [type="reset"], .button-group > .button, .button-group > [role="button"] { + margin: 0; + max-width: 100%; + flex: 1 1 auto; + text-align: center; + border: 0; + border-radius: 0; + box-shadow: none; } + .button-group > :not(:first-child) { + border-left: 0.0714285714rem solid var(--button-group-border-color); } + @media screen and (max-width: 499px) { + .button-group { + flex-direction: column; } + .button-group > :not(:first-child) { + border: 0; + border-top: 0.0714285714rem solid var(--button-group-border-color); } } + +/* + Custom elements for forms and input elements. +*/ +button.primary, [type="button"].primary, [type="submit"].primary, [type="reset"].primary, .button.primary, [role="button"].primary { + --button-back-color: #1976d2; + --button-fore-color: #f8f8f8; } + button.primary:hover, button.primary:focus, [type="button"].primary:hover, [type="button"].primary:focus, [type="submit"].primary:hover, [type="submit"].primary:focus, [type="reset"].primary:hover, [type="reset"].primary:focus, .button.primary:hover, .button.primary:focus, [role="button"].primary:hover, [role="button"].primary:focus { + --button-hover-back-color: #1565c0; } + +button.secondary, [type="button"].secondary, [type="submit"].secondary, [type="reset"].secondary, .button.secondary, [role="button"].secondary { + --button-back-color: #d32f2f; + --button-fore-color: #f8f8f8; } + button.secondary:hover, button.secondary:focus, [type="button"].secondary:hover, [type="button"].secondary:focus, [type="submit"].secondary:hover, [type="submit"].secondary:focus, [type="reset"].secondary:hover, [type="reset"].secondary:focus, .button.secondary:hover, .button.secondary:focus, [role="button"].secondary:hover, [role="button"].secondary:focus { + --button-hover-back-color: #c62828; } + +button.tertiary, [type="button"].tertiary, [type="submit"].tertiary, [type="reset"].tertiary, .button.tertiary, [role="button"].tertiary { + --button-back-color: #308732; + --button-fore-color: #f8f8f8; } + button.tertiary:hover, button.tertiary:focus, [type="button"].tertiary:hover, [type="button"].tertiary:focus, [type="submit"].tertiary:hover, [type="submit"].tertiary:focus, [type="reset"].tertiary:hover, [type="reset"].tertiary:focus, .button.tertiary:hover, .button.tertiary:focus, [role="button"].tertiary:hover, [role="button"].tertiary:focus { + --button-hover-back-color: #277529; } + +button.inverse, [type="button"].inverse, [type="submit"].inverse, [type="reset"].inverse, .button.inverse, [role="button"].inverse { + --button-back-color: #212121; + --button-fore-color: #f8f8f8; } + button.inverse:hover, button.inverse:focus, [type="button"].inverse:hover, [type="button"].inverse:focus, [type="submit"].inverse:hover, [type="submit"].inverse:focus, [type="reset"].inverse:hover, [type="reset"].inverse:focus, .button.inverse:hover, .button.inverse:focus, [role="button"].inverse:hover, [role="button"].inverse:focus { + --button-hover-back-color: #111; } + +button.small, [type="button"].small, [type="submit"].small, [type="reset"].small, .button.small, [role="button"].small { + padding: calc(0.5 * var(--universal-padding)) calc(0.75 * var(--universal-padding)); + margin: var(--universal-margin); } + +button.large, [type="button"].large, [type="submit"].large, [type="reset"].large, .button.large, [role="button"].large { + padding: calc(1.5 * var(--universal-padding)) calc(2 * var(--universal-padding)); + margin: var(--universal-margin); } + +/* + Definitions for navigation elements. +*/ +/* Navigation module CSS variable definitions */ +:root { + --header-back-color: #03234b; + --header-hover-back-color: #ffd200; + --header-fore-color: #ffffff; + --header-border-color: #3cb4e6; + --nav-back-color: #ffffff; + --nav-hover-back-color: #ffe97f; + --nav-fore-color: #e6007e; + --nav-border-color: #3cb4e6; + --nav-link-color: #3cb4e6; + --footer-fore-color: #ffffff; + --footer-back-color: #03234b; + --footer-border-color: #3cb4e6; + --footer-link-color: #3cb4e6; + --drawer-back-color: #ffffff; + --drawer-hover-back-color: #ffe97f; + --drawer-border-color: #3cb4e6; + --drawer-close-color: #e6007e; } + +header { + height: 2.75rem; + background: var(--header-back-color); + color: var(--header-fore-color); + border-bottom: 0.0714285714rem solid var(--header-border-color); + padding: calc(var(--universal-padding) / 4) 0; + white-space: nowrap; + overflow-x: auto; + overflow-y: hidden; } + header.row { + box-sizing: content-box; } + header .logo { + color: var(--header-fore-color); + font-size: 1.75rem; + padding: var(--universal-padding) calc(2 * var(--universal-padding)); + text-decoration: none; } + header button, header [type="button"], header .button, header [role="button"] { + box-sizing: border-box; + position: relative; + top: calc(0rem - var(--universal-padding) / 4); + height: calc(3.1875rem + var(--universal-padding) / 2); + background: var(--header-back-color); + line-height: calc(3.1875rem - var(--universal-padding) * 1.5); + text-align: center; + color: var(--header-fore-color); + border: 0; + border-radius: 0; + margin: 0; + text-transform: uppercase; } + header button:hover, header button:focus, header [type="button"]:hover, header [type="button"]:focus, header .button:hover, header .button:focus, header [role="button"]:hover, header [role="button"]:focus { + background: var(--header-hover-back-color); } + +nav { + background: var(--nav-back-color); + color: var(--nav-fore-color); + border: 0.0714285714rem solid var(--nav-border-color); + border-radius: var(--universal-border-radius); + margin: var(--universal-margin); } + nav * { + padding: var(--universal-padding) calc(1.5 * var(--universal-padding)); } + nav a, nav a:visited { + display: block; + color: var(--nav-link-color); + border-radius: var(--universal-border-radius); + transition: background 0.3s; } + nav a:hover, nav a:focus, nav a:visited:hover, nav a:visited:focus { + text-decoration: none; + background: var(--nav-hover-back-color); } + nav .sublink-1 { + position: relative; + margin-left: calc(2 * var(--universal-padding)); } + nav .sublink-1:before { + position: absolute; + left: calc(var(--universal-padding) - 1 * var(--universal-padding)); + top: -0.0714285714rem; + content: ''; + height: 100%; + border: 0.0714285714rem solid var(--nav-border-color); + border-left: 0; } + nav .sublink-2 { + position: relative; + margin-left: calc(4 * var(--universal-padding)); } + nav .sublink-2:before { + position: absolute; + left: calc(var(--universal-padding) - 3 * var(--universal-padding)); + top: -0.0714285714rem; + content: ''; + height: 100%; + border: 0.0714285714rem solid var(--nav-border-color); + border-left: 0; } + +footer { + background: var(--footer-back-color); + color: var(--footer-fore-color); + border-top: 0.0714285714rem solid var(--footer-border-color); + padding: calc(2 * var(--universal-padding)) var(--universal-padding); + font-size: 0.875rem; } + footer a, footer a:visited { + color: var(--footer-link-color); } + +header.sticky { + position: -webkit-sticky; + position: sticky; + z-index: 1101; + top: 0; } + +footer.sticky { + position: -webkit-sticky; + position: sticky; + z-index: 1101; + bottom: 0; } + +.drawer-toggle:before { + display: inline-block; + position: relative; + vertical-align: bottom; + content: '\00a0\2261\00a0'; + font-family: sans-serif; + font-size: 1.5em; } +@media screen and (min-width: 500px) { + .drawer-toggle:not(.persistent) { + display: none; } } + +[type="checkbox"].drawer { + height: 1px; + width: 1px; + margin: -1px; + overflow: hidden; + position: absolute; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); } + [type="checkbox"].drawer + * { + display: block; + box-sizing: border-box; + position: fixed; + top: 0; + width: 320px; + height: 100vh; + overflow-y: auto; + background: var(--drawer-back-color); + border: 0.0714285714rem solid var(--drawer-border-color); + border-radius: 0; + margin: 0; + z-index: 1110; + right: -320px; + transition: right 0.3s; } + [type="checkbox"].drawer + * .drawer-close { + position: absolute; + top: var(--universal-margin); + right: var(--universal-margin); + z-index: 1111; + width: 2rem; + height: 2rem; + border-radius: var(--universal-border-radius); + padding: var(--universal-padding); + margin: 0; + cursor: pointer; + transition: background 0.3s; } + [type="checkbox"].drawer + * .drawer-close:before { + display: block; + content: '\00D7'; + color: var(--drawer-close-color); + position: relative; + font-family: sans-serif; + font-size: 2rem; + line-height: 1; + text-align: center; } + [type="checkbox"].drawer + * .drawer-close:hover, [type="checkbox"].drawer + * .drawer-close:focus { + background: var(--drawer-hover-back-color); } + @media screen and (max-width: 320px) { + [type="checkbox"].drawer + * { + width: 100%; } } + [type="checkbox"].drawer:checked + * { + right: 0; } + @media screen and (min-width: 500px) { + [type="checkbox"].drawer:not(.persistent) + * { + position: static; + height: 100%; + z-index: 1100; } + [type="checkbox"].drawer:not(.persistent) + * .drawer-close { + display: none; } } + +/* + Definitions for the responsive table component. +*/ +/* Table module CSS variable definitions. */ +:root { + --table-border-color: #03234b; + --table-border-separator-color: #03234b; + --table-head-back-color: #03234b; + --table-head-fore-color: #ffffff; + --table-body-back-color: #ffffff; + --table-body-fore-color: #03234b; + --table-body-alt-back-color: #f4f4f4; } + +table { + border-collapse: separate; + border-spacing: 0; + margin: 0; + display: flex; + flex: 0 1 auto; + flex-flow: row wrap; + padding: var(--universal-padding); + padding-top: 0; } + table caption { + font-size: 1rem; + margin: calc(2 * var(--universal-margin)) 0; + max-width: 100%; + flex: 0 0 100%; } + table thead, table tbody { + display: flex; + flex-flow: row wrap; + border: 0.0714285714rem solid var(--table-border-color); } + table thead { + z-index: 999; + border-radius: var(--universal-border-radius) var(--universal-border-radius) 0 0; + border-bottom: 0.0714285714rem solid var(--table-border-separator-color); } + table tbody { + border-top: 0; + margin-top: calc(0 - var(--universal-margin)); + border-radius: 0 0 var(--universal-border-radius) var(--universal-border-radius); } + table tr { + display: flex; + padding: 0; } + table th, table td { + padding: calc(0.5 * var(--universal-padding)); + font-size: 0.9rem; } + table th { + text-align: left; + background: var(--table-head-back-color); + color: var(--table-head-fore-color); } + table td { + background: var(--table-body-back-color); + color: var(--table-body-fore-color); + border-top: 0.0714285714rem solid var(--table-border-color); } + +table:not(.horizontal) { + overflow: auto; + max-height: 100%; } + table:not(.horizontal) thead, table:not(.horizontal) tbody { + max-width: 100%; + flex: 0 0 100%; } + table:not(.horizontal) tr { + flex-flow: row wrap; + flex: 0 0 100%; } + table:not(.horizontal) th, table:not(.horizontal) td { + flex: 1 0 0%; + overflow: hidden; + text-overflow: ellipsis; } + table:not(.horizontal) thead { + position: sticky; + top: 0; } + table:not(.horizontal) tbody tr:first-child td { + border-top: 0; } + +table.horizontal { + border: 0; } + table.horizontal thead, table.horizontal tbody { + border: 0; + flex: .2 0 0; + flex-flow: row nowrap; } + table.horizontal tbody { + overflow: auto; + justify-content: space-between; + flex: .8 0 0; + margin-left: 0; + padding-bottom: calc(var(--universal-padding) / 4); } + table.horizontal tr { + flex-direction: column; + flex: 1 0 auto; } + table.horizontal th, table.horizontal td { + width: auto; + border: 0; + border-bottom: 0.0714285714rem solid var(--table-border-color); } + table.horizontal th:not(:first-child), table.horizontal td:not(:first-child) { + border-top: 0; } + table.horizontal th { + text-align: right; + border-left: 0.0714285714rem solid var(--table-border-color); + border-right: 0.0714285714rem solid var(--table-border-separator-color); } + table.horizontal thead tr:first-child { + padding-left: 0; } + table.horizontal th:first-child, table.horizontal td:first-child { + border-top: 0.0714285714rem solid var(--table-border-color); } + table.horizontal tbody tr:last-child td { + border-right: 0.0714285714rem solid var(--table-border-color); } + table.horizontal tbody tr:last-child td:first-child { + border-top-right-radius: 0.25rem; } + table.horizontal tbody tr:last-child td:last-child { + border-bottom-right-radius: 0.25rem; } + table.horizontal thead tr:first-child th:first-child { + border-top-left-radius: 0.25rem; } + table.horizontal thead tr:first-child th:last-child { + border-bottom-left-radius: 0.25rem; } + +@media screen and (max-width: 499px) { + table, table.horizontal { + border-collapse: collapse; + border: 0; + width: 100%; + display: table; } + table thead, table th, table.horizontal thead, table.horizontal th { + border: 0; + height: 1px; + width: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); } + table tbody, table.horizontal tbody { + border: 0; + display: table-row-group; } + table tr, table.horizontal tr { + display: block; + border: 0.0714285714rem solid var(--table-border-color); + border-radius: var(--universal-border-radius); + background: #ffffff; + padding: var(--universal-padding); + margin: var(--universal-margin); + margin-bottom: calc(1 * var(--universal-margin)); } + table th, table td, table.horizontal th, table.horizontal td { + width: auto; } + table td, table.horizontal td { + display: block; + border: 0; + text-align: right; } + table td:before, table.horizontal td:before { + content: attr(data-label); + float: left; + font-weight: 600; } + table th:first-child, table td:first-child, table.horizontal th:first-child, table.horizontal td:first-child { + border-top: 0; } + table tbody tr:last-child td, table.horizontal tbody tr:last-child td { + border-right: 0; } } +table tr:nth-of-type(2n) > td { + background: var(--table-body-alt-back-color); } + +@media screen and (max-width: 500px) { + table tr:nth-of-type(2n) { + background: var(--table-body-alt-back-color); } } +:root { + --table-body-hover-back-color: #90caf9; } + +table.hoverable tr:hover, table.hoverable tr:hover > td, table.hoverable tr:focus, table.hoverable tr:focus > td { + background: var(--table-body-hover-back-color); } + +@media screen and (max-width: 500px) { + table.hoverable tr:hover, table.hoverable tr:hover > td, table.hoverable tr:focus, table.hoverable tr:focus > td { + background: var(--table-body-hover-back-color); } } +/* + Definitions for contextual background elements, toasts and tooltips. +*/ +/* Contextual module CSS variable definitions */ +:root { + --mark-back-color: #3cb4e6; + --mark-fore-color: #ffffff; } + +mark { + background: var(--mark-back-color); + color: var(--mark-fore-color); + font-size: 0.95em; + line-height: 1em; + border-radius: var(--universal-border-radius); + padding: calc(var(--universal-padding) / 4) var(--universal-padding); } + mark.inline-block { + display: inline-block; + font-size: 1em; + line-height: 1.4; + padding: calc(var(--universal-padding) / 2) var(--universal-padding); } + +:root { + --toast-back-color: #424242; + --toast-fore-color: #fafafa; } + +.toast { + position: fixed; + bottom: calc(var(--universal-margin) * 3); + left: 50%; + transform: translate(-50%, -50%); + z-index: 1111; + color: var(--toast-fore-color); + background: var(--toast-back-color); + border-radius: calc(var(--universal-border-radius) * 16); + padding: var(--universal-padding) calc(var(--universal-padding) * 3); } + +:root { + --tooltip-back-color: #212121; + --tooltip-fore-color: #fafafa; } + +.tooltip { + position: relative; + display: inline-block; } + .tooltip:before, .tooltip:after { + position: absolute; + opacity: 0; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); + transition: all 0.3s; + z-index: 1010; + left: 50%; } + .tooltip:not(.bottom):before, .tooltip:not(.bottom):after { + bottom: 75%; } + .tooltip.bottom:before, .tooltip.bottom:after { + top: 75%; } + .tooltip:hover:before, .tooltip:hover:after, .tooltip:focus:before, .tooltip:focus:after { + opacity: 1; + clip: auto; + -webkit-clip-path: inset(0%); + clip-path: inset(0%); } + .tooltip:before { + content: ''; + background: transparent; + border: var(--universal-margin) solid transparent; + left: calc(50% - var(--universal-margin)); } + .tooltip:not(.bottom):before { + border-top-color: #212121; } + .tooltip.bottom:before { + border-bottom-color: #212121; } + .tooltip:after { + content: attr(aria-label); + color: var(--tooltip-fore-color); + background: var(--tooltip-back-color); + border-radius: var(--universal-border-radius); + padding: var(--universal-padding); + white-space: nowrap; + transform: translateX(-50%); } + .tooltip:not(.bottom):after { + margin-bottom: calc(2 * var(--universal-margin)); } + .tooltip.bottom:after { + margin-top: calc(2 * var(--universal-margin)); } + +:root { + --modal-overlay-color: rgba(0, 0, 0, 0.45); + --modal-close-color: #e6007e; + --modal-close-hover-color: #ffe97f; } + +[type="checkbox"].modal { + height: 1px; + width: 1px; + margin: -1px; + overflow: hidden; + position: absolute; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); } + [type="checkbox"].modal + div { + position: fixed; + top: 0; + left: 0; + display: none; + width: 100vw; + height: 100vh; + background: var(--modal-overlay-color); } + [type="checkbox"].modal + div .card { + margin: 0 auto; + max-height: 50vh; + overflow: auto; } + [type="checkbox"].modal + div .card .modal-close { + position: absolute; + top: 0; + right: 0; + width: 1.75rem; + height: 1.75rem; + border-radius: var(--universal-border-radius); + padding: var(--universal-padding); + margin: 0; + cursor: pointer; + transition: background 0.3s; } + [type="checkbox"].modal + div .card .modal-close:before { + display: block; + content: '\00D7'; + color: var(--modal-close-color); + position: relative; + font-family: sans-serif; + font-size: 1.75rem; + line-height: 1; + text-align: center; } + [type="checkbox"].modal + div .card .modal-close:hover, [type="checkbox"].modal + div .card .modal-close:focus { + background: var(--modal-close-hover-color); } + [type="checkbox"].modal:checked + div { + display: flex; + flex: 0 1 auto; + z-index: 1200; } + [type="checkbox"].modal:checked + div .card .modal-close { + z-index: 1211; } + +:root { + --collapse-label-back-color: #03234b; + --collapse-label-fore-color: #ffffff; + --collapse-label-hover-back-color: #3cb4e6; + --collapse-selected-label-back-color: #3cb4e6; + --collapse-border-color: var(--collapse-label-back-color); + --collapse-selected-border-color: #ceecf8; + --collapse-content-back-color: #ffffff; + --collapse-selected-label-border-color: #3cb4e6; } + +.collapse { + width: calc(100% - 2 * var(--universal-margin)); + opacity: 1; + display: flex; + flex-direction: column; + margin: var(--universal-margin); + border-radius: var(--universal-border-radius); } + .collapse > [type="radio"], .collapse > [type="checkbox"] { + height: 1px; + width: 1px; + margin: -1px; + overflow: hidden; + position: absolute; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); } + .collapse > label { + flex-grow: 1; + display: inline-block; + height: 1.25rem; + cursor: pointer; + transition: background 0.2s; + color: var(--collapse-label-fore-color); + background: var(--collapse-label-back-color); + border: 0.0714285714rem solid var(--collapse-selected-border-color); + padding: calc(1.25 * var(--universal-padding)); } + .collapse > label:hover, .collapse > label:focus { + background: var(--collapse-label-hover-back-color); } + .collapse > label + div { + flex-basis: auto; + height: 1px; + width: 1px; + margin: -1px; + overflow: hidden; + position: absolute; + clip: rect(0 0 0 0); + -webkit-clip-path: inset(100%); + clip-path: inset(100%); + transition: max-height 0.3s; + max-height: 1px; } + .collapse > :checked + label { + background: var(--collapse-selected-label-back-color); + border-color: var(--collapse-selected-label-border-color); } + .collapse > :checked + label + div { + box-sizing: border-box; + position: relative; + width: 100%; + height: auto; + overflow: auto; + margin: 0; + background: var(--collapse-content-back-color); + border: 0.0714285714rem solid var(--collapse-selected-border-color); + border-top: 0; + padding: var(--universal-padding); + clip: auto; + -webkit-clip-path: inset(0%); + clip-path: inset(0%); + max-height: 100%; } + .collapse > label:not(:first-of-type) { + border-top: 0; } + .collapse > label:first-of-type { + border-radius: var(--universal-border-radius) var(--universal-border-radius) 0 0; } + .collapse > label:last-of-type:not(:first-of-type) { + border-radius: 0 0 var(--universal-border-radius) var(--universal-border-radius); } + .collapse > label:last-of-type:first-of-type { + border-radius: var(--universal-border-radius); } + .collapse > :checked:last-of-type:not(:first-of-type) + label { + border-radius: 0; } + .collapse > :checked:last-of-type + label + div { + border-radius: 0 0 var(--universal-border-radius) var(--universal-border-radius); } + +/* + Custom elements for contextual background elements, toasts and tooltips. +*/ +mark.tertiary { + --mark-back-color: #3cb4e6; } + +mark.tag { + padding: calc(var(--universal-padding)/2) var(--universal-padding); + border-radius: 1em; } + +/* + Definitions for progress elements and spinners. +*/ +/* Progress module CSS variable definitions */ +:root { + --progress-back-color: #3cb4e6; + --progress-fore-color: #555; } + +progress { + display: block; + vertical-align: baseline; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + height: 0.75rem; + width: calc(100% - 2 * var(--universal-margin)); + margin: var(--universal-margin); + border: 0; + border-radius: calc(2 * var(--universal-border-radius)); + background: var(--progress-back-color); + color: var(--progress-fore-color); } + progress::-webkit-progress-value { + background: var(--progress-fore-color); + border-top-left-radius: calc(2 * var(--universal-border-radius)); + border-bottom-left-radius: calc(2 * var(--universal-border-radius)); } + progress::-webkit-progress-bar { + background: var(--progress-back-color); } + progress::-moz-progress-bar { + background: var(--progress-fore-color); + border-top-left-radius: calc(2 * var(--universal-border-radius)); + border-bottom-left-radius: calc(2 * var(--universal-border-radius)); } + progress[value="1000"]::-webkit-progress-value { + border-radius: calc(2 * var(--universal-border-radius)); } + progress[value="1000"]::-moz-progress-bar { + border-radius: calc(2 * var(--universal-border-radius)); } + progress.inline { + display: inline-block; + vertical-align: middle; + width: 60%; } + +:root { + --spinner-back-color: #ddd; + --spinner-fore-color: #555; } + +@keyframes spinner-donut-anim { + 0% { + transform: rotate(0deg); } + 100% { + transform: rotate(360deg); } } +.spinner { + display: inline-block; + margin: var(--universal-margin); + border: 0.25rem solid var(--spinner-back-color); + border-left: 0.25rem solid var(--spinner-fore-color); + border-radius: 50%; + width: 1.25rem; + height: 1.25rem; + animation: spinner-donut-anim 1.2s linear infinite; } + +/* + Custom elements for progress bars and spinners. +*/ +progress.primary { + --progress-fore-color: #1976d2; } + +progress.secondary { + --progress-fore-color: #d32f2f; } + +progress.tertiary { + --progress-fore-color: #308732; } + +.spinner.primary { + --spinner-fore-color: #1976d2; } + +.spinner.secondary { + --spinner-fore-color: #d32f2f; } + +.spinner.tertiary { + --spinner-fore-color: #308732; } + +/* + Definitions for icons - powered by Feather (https://feathericons.com/). +*/ +span[class^='icon-'] { + display: inline-block; + height: 1em; + width: 1em; + vertical-align: -0.125em; + background-size: contain; + margin: 0 calc(var(--universal-margin) / 4); } + span[class^='icon-'].secondary { + -webkit-filter: invert(25%); + filter: invert(25%); } + span[class^='icon-'].inverse { + -webkit-filter: invert(100%); + filter: invert(100%); } + +span.icon-alert { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12' y2='16'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-bookmark { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E"); } +span.icon-calendar { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-credit { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='4' width='22' height='16' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='1' y1='10' x2='23' y2='10'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-edit { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.66V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.34'%3E%3C/path%3E%3Cpolygon points='18 2 22 6 12 16 8 16 8 12 18 2'%3E%3C/polygon%3E%3C/svg%3E"); } +span.icon-link { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'%3E%3C/path%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cline x1='10' y1='14' x2='21' y2='3'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-help { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='17' x2='12' y2='17'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-home { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'%3E%3C/path%3E%3Cpolyline points='9 22 9 12 15 12 15 22'%3E%3C/polyline%3E%3C/svg%3E"); } +span.icon-info { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-lock { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E"); } +span.icon-mail { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'%3E%3C/path%3E%3Cpolyline points='22,6 12,13 2,6'%3E%3C/polyline%3E%3C/svg%3E"); } +span.icon-location { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3'%3E%3C/circle%3E%3C/svg%3E"); } +span.icon-phone { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'%3E%3C/path%3E%3C/svg%3E"); } +span.icon-rss { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11a9 9 0 0 1 9 9'%3E%3C/path%3E%3Cpath d='M4 4a16 16 0 0 1 16 16'%3E%3C/path%3E%3Ccircle cx='5' cy='19' r='1'%3E%3C/circle%3E%3C/svg%3E"); } +span.icon-search { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-settings { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z'%3E%3C/path%3E%3C/svg%3E"); } +span.icon-share { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='3'%3E%3C/circle%3E%3Ccircle cx='18' cy='19' r='3'%3E%3C/circle%3E%3Cline x1='8.59' y1='13.51' x2='15.42' y2='17.49'%3E%3C/line%3E%3Cline x1='15.41' y1='6.51' x2='8.59' y2='10.49'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-cart { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'%3E%3C/circle%3E%3Ccircle cx='20' cy='21' r='1'%3E%3C/circle%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3E%3C/path%3E%3C/svg%3E"); } +span.icon-upload { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'%3E%3C/path%3E%3Cpolyline points='17 8 12 3 7 8'%3E%3C/polyline%3E%3Cline x1='12' y1='3' x2='12' y2='15'%3E%3C/line%3E%3C/svg%3E"); } +span.icon-user { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303234b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3E%3C/path%3E%3Ccircle cx='12' cy='7' r='4'%3E%3C/circle%3E%3C/svg%3E"); } + +/* + Definitions for STMicroelectronics icons (https://brandportal.st.com/document/26). +*/ +span.icon-st-update { + background-image: url("Update.svg"); } +span.icon-st-add { + background-image: url("Add button.svg"); } + +/* + Definitions for utilities and helper classes. +*/ +/* Utility module CSS variable definitions */ +:root { + --generic-border-color: rgba(0, 0, 0, 0.3); + --generic-box-shadow: 0 0.2857142857rem 0.2857142857rem 0 rgba(0, 0, 0, 0.125), 0 0.1428571429rem 0.1428571429rem -0.1428571429rem rgba(0, 0, 0, 0.125); } + +.hidden { + display: none !important; } + +.visually-hidden { + position: absolute !important; + width: 1px !important; + height: 1px !important; + margin: -1px !important; + border: 0 !important; + padding: 0 !important; + clip: rect(0 0 0 0) !important; + -webkit-clip-path: inset(100%) !important; + clip-path: inset(100%) !important; + overflow: hidden !important; } + +.bordered { + border: 0.0714285714rem solid var(--generic-border-color) !important; } + +.rounded { + border-radius: var(--universal-border-radius) !important; } + +.circular { + border-radius: 50% !important; } + +.shadowed { + box-shadow: var(--generic-box-shadow) !important; } + +.responsive-margin { + margin: calc(var(--universal-margin) / 4) !important; } + @media screen and (min-width: 500px) { + .responsive-margin { + margin: calc(var(--universal-margin) / 2) !important; } } + @media screen and (min-width: 1280px) { + .responsive-margin { + margin: var(--universal-margin) !important; } } + +.responsive-padding { + padding: calc(var(--universal-padding) / 4) !important; } + @media screen and (min-width: 500px) { + .responsive-padding { + padding: calc(var(--universal-padding) / 2) !important; } } + @media screen and (min-width: 1280px) { + .responsive-padding { + padding: var(--universal-padding) !important; } } + +@media screen and (max-width: 499px) { + .hidden-sm { + display: none !important; } } +@media screen and (min-width: 500px) and (max-width: 1279px) { + .hidden-md { + display: none !important; } } +@media screen and (min-width: 1280px) { + .hidden-lg { + display: none !important; } } +@media screen and (max-width: 499px) { + .visually-hidden-sm { + position: absolute !important; + width: 1px !important; + height: 1px !important; + margin: -1px !important; + border: 0 !important; + padding: 0 !important; + clip: rect(0 0 0 0) !important; + -webkit-clip-path: inset(100%) !important; + clip-path: inset(100%) !important; + overflow: hidden !important; } } +@media screen and (min-width: 500px) and (max-width: 1279px) { + .visually-hidden-md { + position: absolute !important; + width: 1px !important; + height: 1px !important; + margin: -1px !important; + border: 0 !important; + padding: 0 !important; + clip: rect(0 0 0 0) !important; + -webkit-clip-path: inset(100%) !important; + clip-path: inset(100%) !important; + overflow: hidden !important; } } +@media screen and (min-width: 1280px) { + .visually-hidden-lg { + position: absolute !important; + width: 1px !important; + height: 1px !important; + margin: -1px !important; + border: 0 !important; + padding: 0 !important; + clip: rect(0 0 0 0) !important; + -webkit-clip-path: inset(100%) !important; + clip-path: inset(100%) !important; + overflow: hidden !important; } } + +/*# sourceMappingURL=mini-custom.css.map */ + +img[alt="ST logo"] { display: block; margin: auto; width: 75%; max-width: 250px; min-width: 71px; } +img[alt="Cube logo"] { float: right; width: 30%; max-width: 10rem; min-width: 8rem; padding-right: 1rem;} + +.figure { + display: block; + margin-left: auto; + margin-right: auto; + text-align: center; +} \ No newline at end of file diff --git a/_htmresc/st_logo_2020.png b/_htmresc/st_logo_2020.png new file mode 100644 index 0000000..d6cebb5 Binary files /dev/null and b/_htmresc/st_logo_2020.png differ