Disable IRQs whilst transferring bytes on VCP (F4)
This commit is contained in:
parent
4e894cc90f
commit
473d78790e
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue