fix samd21 race condition with setup packet

reproduced with Adafruit_TinyUSB_ArduinoCore port commit 11d669b4d2a40eb2fc5e51b2a9707a6de9d42363 and SAMD BSP 1.6.1
This commit is contained in:
hathach
2020-07-23 01:39:15 +07:00
parent 7d2fc12445
commit 0407cfe16c
8 changed files with 76 additions and 40 deletions

View File

@@ -43,6 +43,8 @@ static inline void prepare_setup(void)
{
// Only make sure the EP0 OUT buffer is ready
sram_registers[0][0].ADDR.reg = (uint32_t) _setup_packet;
sram_registers[0][0].PCKSIZE.bit.MULTI_PACKET_SIZE = sizeof(_setup_packet);
sram_registers[0][0].PCKSIZE.bit.BYTE_COUNT = 0;
}
// Setup the control endpoint 0.