summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2024-07-26 10:03:32 +1000
committerDamien George <damien@micropython.org>2024-09-26 17:45:16 +1000
commita2475ee9de1f16def61f4c3f3fdd0751f07c654e (patch)
treef16c57b985150e219aa79d92eb5117b3ad4a0f2d
parent6381ad5d0c4c594dbb8feea3bebf6222fd78f3a1 (diff)
renesas-ra/usb: Use interrupt rather than polling for USB task.
Most ports using TinyUSB now schedule the USB tasks from the USB interrupt. This commit updates the renesas-ra port to use this new pattern. Signed-off-by: Andrew Leech <andrew@alelec.net>
-rw-r--r--ports/renesas-ra/Makefile3
-rw-r--r--ports/renesas-ra/mpconfigport.h16
2 files changed, 3 insertions, 16 deletions
diff --git a/ports/renesas-ra/Makefile b/ports/renesas-ra/Makefile
index 3a9abf724..dd70f56d7 100644
--- a/ports/renesas-ra/Makefile
+++ b/ports/renesas-ra/Makefile
@@ -157,6 +157,9 @@ LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)"
LDFLAGS += -L"$(shell dirname $(LIBSTDCPP_FILE_NAME))"
endif
+# Hook tinyusb USB interrupt if used to service usb task.
+LDFLAGS += --wrap=dcd_event_handler
+
# Options for mpy-cross
MPY_CROSS_FLAGS += -march=armv7m
diff --git a/ports/renesas-ra/mpconfigport.h b/ports/renesas-ra/mpconfigport.h
index a23a2c106..307dac24c 100644
--- a/ports/renesas-ra/mpconfigport.h
+++ b/ports/renesas-ra/mpconfigport.h
@@ -250,25 +250,10 @@ typedef unsigned int mp_uint_t; // must be pointer size
typedef long mp_off_t;
-#if MICROPY_HW_ENABLE_USBDEV
-#define MICROPY_HW_USBDEV_TASK_HOOK extern void mp_usbd_task(void); mp_usbd_task();
-#define MICROPY_VM_HOOK_COUNT (10)
-#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
-#define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \
- vm_hook_divisor = MICROPY_VM_HOOK_COUNT; \
- MICROPY_HW_USBDEV_TASK_HOOK \
-}
-#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
-#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
-#else
-#define MICROPY_HW_USBDEV_TASK_HOOK
-#endif
-
#if MICROPY_PY_THREAD
#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void mp_handle_pending(bool); \
- MICROPY_HW_USBDEV_TASK_HOOK \
mp_handle_pending(true); \
if (pyb_thread_enabled) { \
MP_THREAD_GIL_EXIT(); \
@@ -284,7 +269,6 @@ typedef long mp_off_t;
#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void mp_handle_pending(bool); \
- MICROPY_HW_USBDEV_TASK_HOOK \
mp_handle_pending(true); \
__WFI(); \
} while (0);