summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-03-17 10:40:45 +0700
committerhathach <[email protected]>2020-03-17 10:40:45 +0700
commita39d170672cca9b0c05065971ea3070def4f4244 (patch)
tree4adb277f9eaab64f87dd4f4277d8745772b85021
parentf8d6bbe43b788031f4fbd2986e9f6cd8911ba19d (diff)
follow up to pr #301
rename OPT_MCU_NUC505_USB_DMA to simply USE_DMA
-rw-r--r--README.md2
-rw-r--r--src/portable/nuvoton/nuc505/dcd_nuc505.c20
2 files changed, 12 insertions, 10 deletions
diff --git a/README.md b/README.md
index 211dcc50a..19106db3e 100644
--- a/README.md
+++ b/README.md
@@ -32,13 +32,13 @@ The stack supports the following MCUs:
- **MicroChip:** SAMD21, SAMD51 (device only)
- **Nordic:** nRF52840, nRF52833
+- **Nuvoton:** NUC120, NUC121/NUC125, NUC126, NUC505
- **NXP:**
- LPC Series: 11Uxx, 13xx, 175x_6x, 177x_8x, 18xx, 40xx, 43xx, 51Uxx, 54xxx, 55xx
- iMX RT Series: RT1011, RT1015, RT1021, RT1052, RT1062, RT1064
- **Sony:** CXD56
- **ST:** STM32 series: L0, F0, F1, F2, F3, F4, F7, H7 (device only)
- **[ValentyUSB](https://github.com/im-tomu/valentyusb)** eptri
-- **Nuvoton:** NUC120, NUC121/NUC125, NUC126, NUC505
[Here is the list of supported Boards](docs/boards.md) that can be used with provided examples.
diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c
index e05e73eff..ff2e5264d 100644
--- a/src/portable/nuvoton/nuc505/dcd_nuc505.c
+++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c
@@ -33,12 +33,6 @@
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)
@@ -46,6 +40,14 @@
#include "device/dcd.h"
#include "NUC505Series.h"
+/*
+ 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.
+ Disable for now, we could implement a walk-around if non-DMA slow the MCU down
+ too much.
+*/
+#define USE_DMA 0
+
/* rather important info unfortunately not provided by device include files */
#define USBD_BUF_SIZE 2048 /* how much USB buffer space there is */
#define USBD_MAX_DMA_LEN 0x1000 /* max bytes that can be DMAed at one time */
@@ -217,7 +219,7 @@ static void bus_reset(void)
current_dma_xfer = NULL;
}
-#ifdef OPT_MCU_NUC505_USB_DMA
+#if USE_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)
{
@@ -473,7 +475,7 @@ void USBD_IRQHandler(void)
if (bus_state & USBD_BUSINTSTS_DMADONEIF_Msk)
{
-#ifdef OPT_MCU_NUC505_USB_DMA
+#if USE_DMA
if (current_dma_xfer)
{
current_dma_xfer->dma_requested = false;
@@ -607,7 +609,7 @@ void USBD_IRQHandler(void)
if (out_ep)
{
-#ifdef OPT_MCU_NUC505_USB_DMA
+#if USE_DMA
xfer->dma_requested = true;
service_dma();
#else