Skip to content

Commit abce8f6

Browse files
authored
Merge pull request #2028 from fpistm/stm32_mw_usb_device
chore(usb): update to stm32_mw_usb_device v2.11.1
2 parents 7efab52 + 5be7a2b commit abce8f6

File tree

92 files changed

+15865
-4219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+15865
-4219
lines changed

cores/arduino/stm32/usb/cdc/usbd_cdc.c

Lines changed: 212 additions & 88 deletions
Large diffs are not rendered by default.

cores/arduino/stm32/usb/cdc/usbd_cdc.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,19 @@ extern USBD_ClassTypeDef USBD_CDC;
144144
uint8_t USBD_CDC_RegisterInterface(USBD_HandleTypeDef *pdev,
145145
USBD_CDC_ItfTypeDef *fops);
146146

147+
#ifdef USE_USBD_COMPOSITE
148+
uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff,
149+
uint32_t length, uint8_t ClassId);
150+
uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev, uint8_t ClassId);
151+
uint8_t USBD_CDC_ClearBuffer(USBD_HandleTypeDef *pdev, uint8_t ClassId);
152+
#else
147153
uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff,
148154
uint32_t length);
149-
155+
uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev);
156+
uint8_t USBD_CDC_ClearBuffer(USBD_HandleTypeDef *pdev);
157+
#endif /* USE_USBD_COMPOSITE */
150158
uint8_t USBD_CDC_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff);
151159
uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev);
152-
uint8_t USBD_CDC_ClearBuffer(USBD_HandleTypeDef *pdev);
153-
uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev);
154160
/**
155161
* @}
156162
*/

cores/arduino/stm32/usb/cdc/usbd_cdc_if.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ USBD_HandleTypeDef hUSBD_Device_CDC;
4848

4949
static bool CDC_initialized = false;
5050
static bool CDC_DTR_enabled = true;
51+
#if defined(ICACHE) && defined (HAL_ICACHE_MODULE_ENABLED) && !defined(HAL_ICACHE_MODULE_DISABLED)
52+
static bool icache_enabled = false;
53+
#endif /* ICACHE && HAL_ICACHE_MODULE_ENABLED && !HAL_ICACHE_MODULE_DISABLED */
5154

5255
/* Received Data over USB are stored in this buffer */
5356
CDC_TransmitQueue_TypeDef TransmitQueue;
@@ -270,6 +273,15 @@ static int8_t USBD_CDC_TransmitCplt(uint8_t *Buf, uint32_t *Len, uint8_t epnum)
270273

271274
void CDC_init(void)
272275
{
276+
#if defined(ICACHE) && defined (HAL_ICACHE_MODULE_ENABLED) && !defined(HAL_ICACHE_MODULE_DISABLED)
277+
if (HAL_ICACHE_IsEnabled() == 1) {
278+
icache_enabled = true;
279+
/* Disable instruction cache prior to internal cacheable memory update */
280+
if (HAL_ICACHE_Disable() != HAL_OK) {
281+
Error_Handler();
282+
}
283+
}
284+
#endif /* ICACHE && HAL_ICACHE_MODULE_ENABLED && !HAL_ICACHE_MODULE_DISABLED */
273285
if (!CDC_initialized) {
274286
/* Init Device Library */
275287
if (USBD_Init(&hUSBD_Device_CDC, &USBD_Desc, 0) == USBD_OK) {
@@ -294,6 +306,14 @@ void CDC_deInit(void)
294306
USBD_DeInit(&hUSBD_Device_CDC);
295307
CDC_initialized = false;
296308
}
309+
#if defined(ICACHE) && defined (HAL_ICACHE_MODULE_ENABLED) && !defined(HAL_ICACHE_MODULE_DISABLED)
310+
if (icache_enabled) {
311+
/* Re-enable instruction cache */
312+
if (HAL_ICACHE_Enable() != HAL_OK) {
313+
Error_Handler();
314+
}
315+
}
316+
#endif /* ICACHE && HAL_ICACHE_MODULE_ENABLED && !HAL_ICACHE_MODULE_DISABLED */
297317
}
298318

299319
bool CDC_connected()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy