diff --git a/ports/cc3200/hal/cc3200_asm.h b/ports/cc3200/hal/cc3200_asm.h index 742c9a6f7..2a9fc506c 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 b75a40151..56dd2b2b8 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 5b4771f39..c3f5f38d0 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 86843c78f..595be06f2 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