Skip to content

Commit 2d329c4

Browse files
committed
extmod/moduselect: Use configurable EVENT_POLL_HOOK instead of WFI.
To make moduselect be usable by any port.
1 parent ebc8d73 commit 2d329c4

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

cc3200/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ typedef long mp_off_t;
194194

195195
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
196196
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
197+
#define MICROPY_EVENT_POLL_HOOK __WFI();
197198

198199
// assembly functions to handle critical sections, interrupt
199200
// disabling/enabling and sleep mode enter/exit

extmod/moduselect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
172172
mp_map_deinit(&poll_map);
173173
return mp_obj_new_tuple(3, list_array);
174174
}
175-
__WFI();
175+
MICROPY_EVENT_POLL_HOOK
176176
}
177177
}
178178
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_select_select_obj, 3, 4, select_select);
@@ -264,7 +264,7 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) {
264264
}
265265
return ret_list;
266266
}
267-
__WFI();
267+
MICROPY_EVENT_POLL_HOOK
268268
}
269269
}
270270
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_poll_obj, 1, 3, poll_poll);

stmhal/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static inline mp_uint_t disable_irq(void) {
262262

263263
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
264264
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
265+
#define MICROPY_EVENT_POLL_HOOK __WFI();
265266

266267
// There is no classical C heap in bare-metal ports, only Python
267268
// garbage-collected heap. For completeness, emulate C heap via

0 commit comments

Comments
 (0)