Skip to content

Commit

Permalink
sn32: usb: do NOT clear interrupt status until handled
Browse files Browse the repository at this point in the history
Leftover Sonix reference code cleanup. Sometimes when there is traffic
on more than 1 ep's packets would be dropped before they could be handled.
Clearing the status flags after handling them takes care of it.
  • Loading branch information
dexter93 committed Jul 20, 2023
1 parent e9a4a51 commit 5ded9de
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,8 @@ static void sn32_usb_write_fifo(usbep_t ep, const uint8_t *buf, size_t sz, bool
static void usb_lld_serve_interrupt(USBDriver *usbp) {
uint32_t iwIntFlag;

/* Get Interrupt Status and clear immediately. */
/* Get Interrupt Status */
iwIntFlag = SN32_USB->INSTS;
/* Keep only PRESETUP & ERR_SETUP flags. */
SN32_USB->INSTSC = ~(mskEP0_PRESETUP | mskERR_SETUP);

if (iwIntFlag == 0) {
//@20160902 add for EMC protection
Expand Down

0 comments on commit 5ded9de

Please sign in to comment.