diff options
| author | hathach <[email protected]> | 2020-03-17 10:24:37 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-03-17 10:24:37 +0700 |
| commit | f8d6bbe43b788031f4fbd2986e9f6cd8911ba19d (patch) | |
| tree | 135e39b5f315c49728350050b56dcaa3456d8704 /src/portable | |
| parent | 45e32a787bab61c61ad4a32f6c59d74f9d8aa4cd (diff) | |
| parent | e47f9921570c75afd3288407601897c5b283f043 (diff) | |
Merge branch 'master' into develop
Diffstat (limited to 'src/portable')
| -rw-r--r-- | src/portable/nuvoton/nuc505/dcd_nuc505.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c index 2b6a66bc2..e05e73eff 100644 --- a/src/portable/nuvoton/nuc505/dcd_nuc505.c +++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c @@ -33,6 +33,12 @@ nomenclature of EPA through EPL. */ +/* + Note on OPT_MCU_NUC505_USB_DMA: the author suggests against using this option. + The DMA functionality of the USBD peripheral does not appear to succeed with + transfer lengths that are longer (> 64 bytes) and are not a multiple of 4. +*/ + #include "tusb_option.h" #if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505) @@ -211,6 +217,7 @@ static void bus_reset(void) current_dma_xfer = NULL; } +#ifdef OPT_MCU_NUC505_USB_DMA /* this must only be called by the ISR; it does its best to share the single DMA engine across all user EPs (IN and OUT) */ static void service_dma(void) { @@ -243,6 +250,7 @@ static void service_dma(void) return; } } +#endif /* centralized location for USBD interrupt enable bit masks */ static const uint32_t enabled_irqs = USBD_GINTEN_USBIEN_Msk | \ @@ -366,7 +374,7 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to for (int count = 0; count < total_bytes; count++) *buffer++ = USBD->CEPDAT_BYTE; - usb_control_send_zlp(); + dcd_event_xfer_complete(0, ep_addr, total_bytes, XFER_RESULT_SUCCESS, true); } } else @@ -465,6 +473,7 @@ void USBD_IRQHandler(void) if (bus_state & USBD_BUSINTSTS_DMADONEIF_Msk) { +#ifdef OPT_MCU_NUC505_USB_DMA if (current_dma_xfer) { current_dma_xfer->dma_requested = false; @@ -480,6 +489,7 @@ void USBD_IRQHandler(void) current_dma_xfer = NULL; service_dma(); } +#endif } if (bus_state & USBD_BUSINTSTS_VBUSDETIF_Msk) @@ -597,7 +607,7 @@ void USBD_IRQHandler(void) if (out_ep) { -#if 1 +#ifdef OPT_MCU_NUC505_USB_DMA xfer->dma_requested = true; service_dma(); #else |
