cpu/msp430-common: removed e|dINT calls
This commit is contained in:
parent
c839e65479
commit
36a99a0c70
@ -14,10 +14,6 @@
|
||||
#include "sched.h"
|
||||
#include "thread.h"
|
||||
|
||||
volatile int __inISR = 0;
|
||||
|
||||
char __isr_stack[MSP430_ISR_STACK_SIZE];
|
||||
|
||||
/*
|
||||
* we must prevent the compiler to generate a prologue or an epilogue
|
||||
* for thread_yield_higher(), since we rely on the RETI instruction at the end
|
||||
@ -97,11 +93,6 @@ char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
|
||||
return (char *) stackptr;
|
||||
}
|
||||
|
||||
int inISR(void)
|
||||
{
|
||||
return __inISR;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* System reboot */
|
||||
|
||||
@ -50,6 +50,13 @@ extern volatile int __inISR;
|
||||
*/
|
||||
extern char __isr_stack[MSP430_ISR_STACK_SIZE];
|
||||
|
||||
/**
|
||||
* @brief definition of legacy interrupt control functions
|
||||
*/
|
||||
#define eINT enableIRQ
|
||||
#define dINT disableIRQ
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Save the current thread context from inside an ISR
|
||||
*/
|
||||
@ -150,40 +157,6 @@ inline void __restore_context(unsigned int irqen)
|
||||
__asm__("reti");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable interrupts
|
||||
*/
|
||||
inline void eINT(void)
|
||||
{
|
||||
/* puts("+"); */
|
||||
/* eint(); // problem with MSPGCC intrinsics? */
|
||||
__asm__ __volatile__("bis %0, r2" : : "i"(GIE));
|
||||
__asm__ __volatile__("nop");
|
||||
/* this NOP is needed to handle a "delay slot" that all MSP430 MCUs
|
||||
impose silently after messing with the GIE bit, DO NOT REMOVE IT! */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable interrupts
|
||||
*/
|
||||
inline void dINT(void)
|
||||
{
|
||||
/* puts("-"); */
|
||||
/* dint(); // problem with MSPGCC intrinsics? */
|
||||
__asm__ __volatile__("bic %0, r2" : : "i"(GIE));
|
||||
__asm__ __volatile__("nop");
|
||||
/* this NOP is needed to handle a "delay slot" that all MSP430 MCUs
|
||||
impose silently after messing with the GIE bit, DO NOT REMOVE IT! */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if currently inside an interrupt routine
|
||||
*
|
||||
* @return 0 if not in interrupt context
|
||||
* @return 1 if in interrupt context
|
||||
*/
|
||||
int inISR(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize the cpu
|
||||
*/
|
||||
|
||||
@ -22,6 +22,10 @@
|
||||
#include "irq.h"
|
||||
#include "cpu.h"
|
||||
|
||||
volatile int __inISR = 0;
|
||||
|
||||
char __isr_stack[MSP430_ISR_STACK_SIZE];
|
||||
|
||||
unsigned int disableIRQ(void)
|
||||
{
|
||||
unsigned int state;
|
||||
@ -29,7 +33,11 @@ unsigned int disableIRQ(void)
|
||||
state &= GIE;
|
||||
|
||||
if (state) {
|
||||
dINT();
|
||||
/* puts("-"); */
|
||||
__asm__ __volatile__("bic %0, r2" : : "i"(GIE));
|
||||
/* this NOP is needed to handle a "delay slot" that all MSP430 MCUs
|
||||
impose silently after messing with the GIE bit, DO NOT REMOVE IT! */
|
||||
__asm__ __volatile__("nop");
|
||||
}
|
||||
|
||||
return state;
|
||||
@ -42,7 +50,10 @@ unsigned int enableIRQ(void)
|
||||
state &= GIE;
|
||||
|
||||
if (!state) {
|
||||
eINT();
|
||||
__asm__ __volatile__("bis %0, r2" : : "i"(GIE));
|
||||
/* this NOP is needed to handle a "delay slot" that all MSP430 MCUs
|
||||
impose silently after messing with the GIE bit, DO NOT REMOVE IT! */
|
||||
__asm__ __volatile__("nop");
|
||||
}
|
||||
|
||||
return state;
|
||||
@ -51,6 +62,14 @@ unsigned int enableIRQ(void)
|
||||
void restoreIRQ(unsigned int state)
|
||||
{
|
||||
if (state) {
|
||||
eINT();
|
||||
__asm__ __volatile__("bis %0, r2" : : "i"(GIE));
|
||||
/* this NOP is needed to handle a "delay slot" that all MSP430 MCUs
|
||||
impose silently after messing with the GIE bit, DO NOT REMOVE IT! */
|
||||
__asm__ __volatile__("nop");
|
||||
}
|
||||
}
|
||||
|
||||
int inISR(void)
|
||||
{
|
||||
return __inISR;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user