ports: Move definitions of ATOMIC_SECTION macros to mphalport.h.

Also move MICROPY_PY_PENDSV_ENTER/REENTER/EXIT to mphalport.h, for ports
where these are not already there.

This helps separate the hardware implementation of these macros from the
MicroPython configuration (eg for renesas-ra and stm32, the IRQ static
inline helper functions can now be moved to irq.h).

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-12-01 13:29:42 +11:00
parent bfdf500ea5
commit ad806df857
27 changed files with 124 additions and 120 deletions

View File

@@ -30,6 +30,10 @@
#include "hal/utils.h"
#include "hal/systick.h"
// assembly functions to handle critical sections, interrupt
// disabling/enabling and sleep mode enter/exit
#include "cc3200_asm.h"
/******************************************************************************
DEFINE CONSTANTS
******************************************************************************/
@@ -55,6 +59,9 @@
" isb \n"); \
}
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
******************************************************************************/

View File

@@ -25,7 +25,7 @@
* THE SOFTWARE.
*/
#include "py/mpconfig.h"
#include "py/mphal.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/mperrno.h"

View File

@@ -161,14 +161,8 @@ typedef int32_t mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
typedef long mp_off_t;
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
#define MICROPY_EVENT_POLL_HOOK __WFI();
// assembly functions to handle critical sections, interrupt
// disabling/enabling and sleep mode enter/exit
#include "cc3200_asm.h"
// We need to provide a declaration/definition of alloca()
#include <alloca.h>