Skip to content

Commit 1cf893a

Browse files
committed
ports/renesas: Replace MICROPY_EVENT_POLL_HOOK with mp_event_wait.
Signed-off-by: Andrew Leech <[email protected]>
1 parent eec5eb4 commit 1cf893a

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

ports/renesas-ra/machine_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uint
501501
if (!uart_tx_busy(self)) {
502502
return 0;
503503
}
504-
MICROPY_EVENT_POLL_HOOK
504+
mp_event_wait_indefinite();
505505
} while (mp_hal_ticks_ms() < timeout);
506506
*errcode = MP_ETIMEDOUT;
507507
ret = MP_STREAM_ERROR;

ports/renesas-ra/mpconfigport.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -265,30 +265,17 @@ typedef long mp_off_t;
265265
#endif
266266

267267
#if MICROPY_PY_THREAD
268-
#define MICROPY_EVENT_POLL_HOOK \
268+
#define MICROPY_INTERNAL_EVENT_HOOK \
269269
do { \
270-
extern void mp_handle_pending(bool); \
271-
MICROPY_HW_USBDEV_TASK_HOOK \
272-
mp_handle_pending(true); \
273270
if (pyb_thread_enabled) { \
274271
MP_THREAD_GIL_EXIT(); \
275272
pyb_thread_yield(); \
276273
MP_THREAD_GIL_ENTER(); \
277-
} else { \
278-
__WFI(); \
279274
} \
280275
} while (0);
281276

282277
#define MICROPY_THREAD_YIELD() pyb_thread_yield()
283278
#else
284-
#define MICROPY_EVENT_POLL_HOOK \
285-
do { \
286-
extern void mp_handle_pending(bool); \
287-
MICROPY_HW_USBDEV_TASK_HOOK \
288-
mp_handle_pending(true); \
289-
__WFI(); \
290-
} while (0);
291-
292279
#define MICROPY_THREAD_YIELD()
293280
#endif
294281

ports/renesas-ra/mphalport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ int mp_hal_stdin_rx_chr(void) {
104104
return dupterm_c;
105105
}
106106
#endif
107-
MICROPY_EVENT_POLL_HOOK
107+
mp_event_wait_indefinite();
108108
}
109109
}
110110

ports/renesas-ra/systick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void mp_hal_delay_ms(mp_uint_t Delay) {
106106
// This macro will execute the necessary idle behaviour. It may
107107
// raise an exception, switch threads or enter sleep mode (waiting for
108108
// (at least) the SysTick interrupt).
109-
MICROPY_EVENT_POLL_HOOK
109+
mp_event_wait_indefinite();
110110
} while (uwTick - start < Delay);
111111
} else {
112112
// IRQs disabled, so need to use a busy loop for the delay.

ports/renesas-ra/uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ bool uart_rx_wait(machine_uart_obj_t *self, uint32_t timeout) {
477477
if (HAL_GetTick() - start >= timeout) {
478478
return false; // timeout
479479
}
480-
MICROPY_EVENT_POLL_HOOK
480+
mp_event_wait_indefinite();
481481
}
482482
}
483483

@@ -498,7 +498,7 @@ bool uart_tx_wait(machine_uart_obj_t *self, uint32_t timeout) {
498498
if (HAL_GetTick() - start >= timeout) {
499499
return false; // timeout
500500
}
501-
MICROPY_EVENT_POLL_HOOK
501+
mp_event_wait_indefinite();
502502
}
503503
}
504504

0 commit comments

Comments
 (0)