summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-03-11 08:06:17 +0700
committerGitHub <[email protected]>2023-03-11 08:06:17 +0700
commitb5b2fad5fba530f925a35d3b50fb5797fd515682 (patch)
tree376a98788545e8b7459c2134c98fe9ad5f8b75d2
parent990fb6ae5c4d9d4b77c5a9ecb3a2abe899dd2712 (diff)
parentf0ddf8d10f7d58592d2ebb60025b227c8047114d (diff)
Merge pull request #1946 from kasjer/kasjer/nrf5x-fix-iso-memory-corruption
dcd_nrf5x: ISO OUT handling
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index afc14b010..4aeb85fc0 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -187,11 +187,16 @@ static void xact_out_dma(uint8_t epnum)
}
else
{
- // Trigger DMA move data from Endpoint -> SRAM
- NRF_USBD->ISOOUT.PTR = (uint32_t) xfer->buffer;
- NRF_USBD->ISOOUT.MAXCNT = xact_len;
+ if (xfer->started)
+ {
+ // Trigger DMA move data from Endpoint -> SRAM
+ NRF_USBD->ISOOUT.PTR = (uint32_t) xfer->buffer;
+ NRF_USBD->ISOOUT.MAXCNT = xact_len;
- start_dma(&NRF_USBD->TASKS_STARTISOOUT);
+ start_dma(&NRF_USBD->TASKS_STARTISOOUT);
+ } else {
+ atomic_flag_clear(&_dcd.dma_running);
+ }
}
}
else