From 1cf893a679ecb38d0b69befef2a6fd5e25db81dc Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Sun, 29 Sep 2024 21:23:29 +1000 Subject: [PATCH] ports/renesas: Replace MICROPY_EVENT_POLL_HOOK with mp_event_wait. Signed-off-by: Andrew Leech --- ports/renesas-ra/machine_uart.c | 2 +- ports/renesas-ra/mpconfigport.h | 15 +-------------- ports/renesas-ra/mphalport.c | 2 +- ports/renesas-ra/systick.c | 2 +- ports/renesas-ra/uart.c | 4 ++-- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/ports/renesas-ra/machine_uart.c b/ports/renesas-ra/machine_uart.c index b70978ad7a5fe..196e1ccd6dd3a 100644 --- a/ports/renesas-ra/machine_uart.c +++ b/ports/renesas-ra/machine_uart.c @@ -501,7 +501,7 @@ static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uint if (!uart_tx_busy(self)) { return 0; } - MICROPY_EVENT_POLL_HOOK + mp_event_wait_indefinite(); } while (mp_hal_ticks_ms() < timeout); *errcode = MP_ETIMEDOUT; ret = MP_STREAM_ERROR; diff --git a/ports/renesas-ra/mpconfigport.h b/ports/renesas-ra/mpconfigport.h index a23a2c1065fa2..1a1c1ff786f39 100644 --- a/ports/renesas-ra/mpconfigport.h +++ b/ports/renesas-ra/mpconfigport.h @@ -265,30 +265,17 @@ typedef long mp_off_t; #endif #if MICROPY_PY_THREAD -#define MICROPY_EVENT_POLL_HOOK \ +#define MICROPY_INTERNAL_EVENT_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(); \ pyb_thread_yield(); \ MP_THREAD_GIL_ENTER(); \ - } else { \ - __WFI(); \ } \ } while (0); #define MICROPY_THREAD_YIELD() pyb_thread_yield() #else -#define MICROPY_EVENT_POLL_HOOK \ - do { \ - extern void mp_handle_pending(bool); \ - MICROPY_HW_USBDEV_TASK_HOOK \ - mp_handle_pending(true); \ - __WFI(); \ - } while (0); - #define MICROPY_THREAD_YIELD() #endif diff --git a/ports/renesas-ra/mphalport.c b/ports/renesas-ra/mphalport.c index 1c62c23dd70be..7d3a3c0acfb76 100644 --- a/ports/renesas-ra/mphalport.c +++ b/ports/renesas-ra/mphalport.c @@ -104,7 +104,7 @@ int mp_hal_stdin_rx_chr(void) { return dupterm_c; } #endif - MICROPY_EVENT_POLL_HOOK + mp_event_wait_indefinite(); } } diff --git a/ports/renesas-ra/systick.c b/ports/renesas-ra/systick.c index 6fa02a2b6ec0a..8458bd8fe69e0 100644 --- a/ports/renesas-ra/systick.c +++ b/ports/renesas-ra/systick.c @@ -106,7 +106,7 @@ void mp_hal_delay_ms(mp_uint_t Delay) { // This macro will execute the necessary idle behaviour. It may // raise an exception, switch threads or enter sleep mode (waiting for // (at least) the SysTick interrupt). - MICROPY_EVENT_POLL_HOOK + mp_event_wait_indefinite(); } while (uwTick - start < Delay); } else { // IRQs disabled, so need to use a busy loop for the delay. diff --git a/ports/renesas-ra/uart.c b/ports/renesas-ra/uart.c index d17a1fc913fe0..f7418bf36da21 100644 --- a/ports/renesas-ra/uart.c +++ b/ports/renesas-ra/uart.c @@ -477,7 +477,7 @@ bool uart_rx_wait(machine_uart_obj_t *self, uint32_t timeout) { if (HAL_GetTick() - start >= timeout) { return false; // timeout } - MICROPY_EVENT_POLL_HOOK + mp_event_wait_indefinite(); } } @@ -498,7 +498,7 @@ bool uart_tx_wait(machine_uart_obj_t *self, uint32_t timeout) { if (HAL_GetTick() - start >= timeout) { return false; // timeout } - MICROPY_EVENT_POLL_HOOK + mp_event_wait_indefinite(); } }