mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 01:40:14 +01:00
rp2: Refactor to not use pico-sdk alarm pool functions for sleeping.
The best_effort_wfe_or_timeout() and sleep_us() pico-sdk functions use the pico-sdk alarm pool internally, and that has a bug. Some usages inside pico-sdk (notably multicore_lockout_start_blocking()) will still end up calling best_effort_wfe_or_timeout(), although usually with "end_of_time" as the timeout value so it should avoid any alarm pool race conditions. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
committed by
Damien George
parent
74fb42aa82
commit
83e82c5ad3
@@ -62,23 +62,22 @@
|
||||
if ((TIMEOUT_MS) < 0) { \
|
||||
__wfe(); \
|
||||
} else { \
|
||||
best_effort_wfe_or_timeout(make_timeout_time_ms(TIMEOUT_MS)); \
|
||||
mp_wfe_or_timeout(TIMEOUT_MS); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
extern int mp_interrupt_char;
|
||||
extern ringbuf_t stdin_ringbuf;
|
||||
|
||||
// Port-specific function to create a wakeup interrupt after timeout_ms and enter WFE
|
||||
void mp_wfe_or_timeout(uint32_t timeout_ms);
|
||||
|
||||
uint32_t mp_thread_begin_atomic_section(void);
|
||||
void mp_thread_end_atomic_section(uint32_t);
|
||||
|
||||
void mp_hal_set_interrupt_char(int c);
|
||||
void mp_hal_time_ns_set_from_rtc(void);
|
||||
|
||||
static inline void mp_hal_delay_us(mp_uint_t us) {
|
||||
sleep_us(us);
|
||||
}
|
||||
|
||||
static inline void mp_hal_delay_us_fast(mp_uint_t us) {
|
||||
busy_wait_us(us);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user