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>
This commit is contained in:
parent
6381ad5d0c
commit
a2475ee9de
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user