cpu/msp430_common: Prevent conflicting defines
irq_arch.h previously included cpu.h, which in term included the vendor header files. Those were needed to get the GIE define (general interrupt enable bit). However, the vendor files use fancy defines like `#define N (0x0004)` that easily conflict with application code. Due to the widespread use of the IRQ API, it is better to not include the vendor files in irq_arch.h. This commit adds a local define for the GIE bit and uses this instead of including cpu.h.
This commit is contained in:
parent
f7d9e2f1ab
commit
008e2d3b97
@ -24,7 +24,6 @@
|
|||||||
#define IRQ_ARCH_H
|
#define IRQ_ARCH_H
|
||||||
|
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "cpu.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -38,6 +37,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
extern volatile int __irq_is_in;
|
extern volatile int __irq_is_in;
|
||||||
|
#define _GENERAL_INTERRUPT_ENABLE (0x0008)
|
||||||
|
|
||||||
__attribute__((always_inline)) static inline unsigned int irq_disable(void)
|
__attribute__((always_inline)) static inline unsigned int irq_disable(void)
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ __attribute__((always_inline)) static inline unsigned int irq_disable(void)
|
|||||||
"nop" "\n\t"
|
"nop" "\n\t"
|
||||||
"and %[gie], %[state]" "\n\t"
|
"and %[gie], %[state]" "\n\t"
|
||||||
: [state] "=r"(state)
|
: [state] "=r"(state)
|
||||||
: [gie] "i"(GIE)
|
: [gie] "i"(_GENERAL_INTERRUPT_ENABLE)
|
||||||
: "memory"
|
: "memory"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ __attribute__((always_inline)) static inline unsigned int irq_enable(void)
|
|||||||
"nop" "\n\t"
|
"nop" "\n\t"
|
||||||
"and %[gie], %[state]" "\n\t"
|
"and %[gie], %[state]" "\n\t"
|
||||||
: [state] "=r"(state)
|
: [state] "=r"(state)
|
||||||
: [gie] "i"(GIE)
|
: [gie] "i"(_GENERAL_INTERRUPT_ENABLE)
|
||||||
: "memory"
|
: "memory"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user