Use custom assembly code instead of MSP GCC primitives for dINT()/eINT()

and all other functions that enable or disable interrupts
This commit is contained in:
Kévin Roussel 2014-06-18 15:13:05 +02:00
parent 8f65d26769
commit 91fd567c8f
2 changed files with 16 additions and 6 deletions

View File

@ -40,8 +40,8 @@ extern "C" {
extern volatile int __inISR;
extern char __isr_stack[MSP430_ISR_STACK_SIZE];
//#define eINT() eint()
//#define dINT() dint()
/*#define eINT() eint() */
/*#define dINT() dint() */
inline void __save_context_isr(void)
{
@ -125,14 +125,22 @@ inline void __restore_context(unsigned int irqen)
inline void eINT(void)
{
// puts("+");
eint();
/* 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! */
}
inline void dINT(void)
{
// puts("-");
dint();
/* 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! */
}
int inISR(void);

View File

@ -160,6 +160,7 @@ splhigh_(void)
int sr;
asmv("mov r2, %0" : "=r"(sr));
asmv("bic %0, r2" : : "i"(GIE));
asmv("nop");
return sr & GIE; /* Ignore other sr bits. */
}
/*---------------------------------------------------------------------------*/
@ -171,6 +172,7 @@ splx_(int sr)
{
/* If GIE was set, restore it. */
asmv("bis %0, r2" : : "r"(sr));
asmv("nop");
}
/*---------------------------------------------------------------------------*/