Disable IRQs whilst transferring bytes on VCP (F4)

This commit is contained in:
blckmn 2016-07-12 21:19:53 +10:00
parent 4e894cc90f
commit 473d78790e
1 changed files with 3 additions and 0 deletions

View File

@ -223,6 +223,8 @@ static uint32_t rxPackets = 0;
static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len) static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len)
{ {
__disable_irq();
rxPackets++; rxPackets++;
for (uint32_t i = 0; i < Len; i++) { for (uint32_t i = 0; i < Len; i++) {
@ -232,6 +234,7 @@ static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len)
rxTotalBytes++; rxTotalBytes++;
} }
__enable_irq();
if(receiveLength > (USB_RX_BUFSIZE-1)) if(receiveLength > (USB_RX_BUFSIZE-1))
return USBD_FAIL; return USBD_FAIL;