From 544c308c18d134ade0ce23f39b73dc3f46074825 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 23 Apr 2020 16:18:14 +1000 Subject: [PATCH] py/scheduler: Add option to wrap mp_sched_schedule in arbitrary attr. So ports can put it in a special memory section if needed. --- py/mpconfig.h | 4 ++++ py/scheduler.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/py/mpconfig.h b/py/mpconfig.h index 1327d8b027..f2b3af1f2a 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1449,6 +1449,10 @@ typedef double mp_float_t; #define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) f #endif +#ifndef MICROPY_WRAP_MP_SCHED_SCHEDULE +#define MICROPY_WRAP_MP_SCHED_SCHEDULE(f) f +#endif + /*****************************************************************************/ /* Miscellaneous settings */ diff --git a/py/scheduler.c b/py/scheduler.c index b559091b83..06d7b36c2c 100644 --- a/py/scheduler.c +++ b/py/scheduler.c @@ -120,7 +120,7 @@ void mp_sched_unlock(void) { MICROPY_END_ATOMIC_SECTION(atomic_state); } -bool mp_sched_schedule(mp_obj_t function, mp_obj_t arg) { +bool MICROPY_WRAP_MP_SCHED_SCHEDULE(mp_sched_schedule)(mp_obj_t function, mp_obj_t arg) { mp_uint_t atomic_state = MICROPY_BEGIN_ATOMIC_SECTION(); bool ret; if (!mp_sched_full()) {