From 39c32aaadeb1a1db932debb12a1bf9fe79bbff36 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Fri, 26 Jul 2024 10:03:32 +1000 Subject: [PATCH] renesas-ra/usb: Use interrupt rather than polling for usb task. Signed-off-by: Andrew Leech --- ports/renesas-ra/Makefile | 3 +++ ports/renesas-ra/mpconfigport.h | 16 ---------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/ports/renesas-ra/Makefile b/ports/renesas-ra/Makefile index 3a9abf7246516..dd70f56d7ca63 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 a23a2c1065fa2..307dac24ce583 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);