From 7a6489aaa51f0981b7920445667bda49f18dde36 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Dec 2023 13:59:12 +1100 Subject: [PATCH] cc3200: Eliminate dependency on stm32's irq.h. Signed-off-by: Damien George --- ports/cc3200/hal/cc3200_asm.h | 12 ++++++++++-- ports/cc3200/hal/cc3200_hal.c | 1 - ports/cc3200/mpthreadport.c | 1 - ports/cc3200/telnet/telnet.c | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ports/cc3200/hal/cc3200_asm.h b/ports/cc3200/hal/cc3200_asm.h index 742c9a6f7f..2a9fc506ce 100644 --- a/ports/cc3200/hal/cc3200_asm.h +++ b/ports/cc3200/hal/cc3200_asm.h @@ -32,8 +32,11 @@ // // Note on IRQ state: you should not need to know the specific // value of the state variable, but rather just pass the return -// value from disable_irq back to enable_irq. If you really need -// to know the machine-specific values, see irq.h. +// value from disable_irq back to enable_irq. + +// these states correspond to values from query_irq, enable_irq and disable_irq +#define IRQ_STATE_DISABLED (0x00000001) +#define IRQ_STATE_ENABLED (0x00000000) #ifndef __disable_irq #define __disable_irq() __asm__ volatile ("cpsid i"); @@ -79,6 +82,11 @@ static inline void __set_BASEPRI(uint32_t value) { __asm volatile ("msr basepri, %0" : : "r" (value) : "memory"); } +__attribute__(( always_inline )) +static inline uint32_t query_irq(void) { + return __get_PRIMASK(); +} + __attribute__(( always_inline )) static inline void enable_irq(mp_uint_t state) { __set_PRIMASK(state); diff --git a/ports/cc3200/hal/cc3200_hal.c b/ports/cc3200/hal/cc3200_hal.c index b75a40151f..56dd2b2b82 100644 --- a/ports/cc3200/hal/cc3200_hal.c +++ b/ports/cc3200/hal/cc3200_hal.c @@ -49,7 +49,6 @@ #include "telnet.h" #include "pybuart.h" #include "utils.h" -#include "irq.h" #ifdef USE_FREERTOS #include "FreeRTOS.h" diff --git a/ports/cc3200/mpthreadport.c b/ports/cc3200/mpthreadport.c index 5b4771f395..c3f5f38d06 100644 --- a/ports/cc3200/mpthreadport.c +++ b/ports/cc3200/mpthreadport.c @@ -32,7 +32,6 @@ #include "py/mphal.h" #include "mptask.h" #include "task.h" -#include "irq.h" #if MICROPY_PY_THREAD diff --git a/ports/cc3200/telnet/telnet.c b/ports/cc3200/telnet/telnet.c index 86843c78f6..595be06f2f 100644 --- a/ports/cc3200/telnet/telnet.c +++ b/ports/cc3200/telnet/telnet.c @@ -37,7 +37,6 @@ #include "debug.h" #include "serverstask.h" #include "genhdr/mpversion.h" -#include "irq.h" /****************************************************************************** DEFINE PRIVATE CONSTANTS