8000 renesas-ra/usb: Use interrupt rather than polling for usb task. · micropython/micropython@39c32aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 39c32aa

Browse files
committed
renesas-ra/usb: Use interrupt rather than polling for usb task.
Signed-off-by: Andrew Leech <andrew@alelec.net>
1 parent e1fe62f commit 39c32aa

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

ports/renesas-ra/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)"
157157
LDFLAGS += -L"$(shell dirname $(LIBSTDCPP_FILE_NAME))"
158158
endif
159159

160+
# Hook tinyusb USB interrupt if used to service usb task.
161+
LDFLAGS += --wrap=dcd_event_handler
162+
160163
# Options for mpy-cross
161164
MPY_CROSS_FLAGS += -march=armv7m
162165

ports/renesas-ra/mpconfigport.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,25 +250,10 @@ typedef unsigned int mp_uint_t; // must be pointer size
250250

251251
typedef long mp_off_t;
252252

253-
#if MICROPY_HW_ENABLE_USBDEV
254-
#define MICROPY_HW_USBDEV_TASK_HOOK extern void mp_usbd_task(void); mp_usbd_task();
255-
#define MICROPY_VM_HOOK_COUNT (10)
256-
#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
257-
#define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \
258-
vm_hook_divisor = MICROPY_VM_HOOK_COUNT; \
259-
MICROPY_HW_USBDEV_TASK_HOOK \
260-
}
261-
#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
262-
#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
263-
#else
264-
#define MICROPY_HW_USBDEV_TASK_HOOK
265-
#endif
266-
267253
#if MICROPY_PY_THREAD
268254
#define MICROPY_EVENT_POLL_HOOK \
269255
do { \
270256
extern void mp_handle_pending(bool); \
271-
MICROPY_HW_USBDEV_TASK_HOOK \
272257
mp_handle_pending(true); \
273258
if (pyb_thread_enabled) { \
274259
MP_THREAD_GIL_EXIT(); \
@@ -284,7 +269,6 @@ typedef long mp_off_t;
284269
#define MICROPY_EVENT_POLL_HOOK \
285270
do { \
286271
extern void mp_handle_pending(bool); \
287-
MICROPY_HW_USBDEV_TASK_HOOK \
288272
mp_handle_pending(true); \
289273
__WFI(); \
290274
} while (0);

0 commit comments

Comments
 (0)
0