2010-09-22 15:10:42 +02:00
|
|
|
#include <irq.h>
|
2013-03-30 21:44:16 +01:00
|
|
|
#ifdef CC430
|
2013-06-21 03:52:57 +02:00
|
|
|
#include <cc430f6137.h>
|
2013-03-30 21:44:16 +01:00
|
|
|
#else
|
2013-06-21 03:52:57 +02:00
|
|
|
#include <msp430x16x.h>
|
2013-03-30 21:44:16 +01:00
|
|
|
#endif
|
2010-09-22 15:10:42 +02:00
|
|
|
#include <cpu.h>
|
|
|
|
|
2013-06-21 03:52:57 +02:00
|
|
|
unsigned int disableIRQ()
|
|
|
|
{
|
2010-09-22 15:10:42 +02:00
|
|
|
unsigned int state;
|
2013-06-21 03:52:57 +02:00
|
|
|
__asm__("mov.w r2,%0" : "=r"(state));
|
2010-09-22 15:10:42 +02:00
|
|
|
state &= GIE;
|
2013-06-21 03:52:57 +02:00
|
|
|
|
2013-06-24 22:37:35 +02:00
|
|
|
if (state) {
|
2013-06-21 03:52:57 +02:00
|
|
|
dINT();
|
|
|
|
}
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2013-06-21 03:52:57 +02:00
|
|
|
unsigned int enableIRQ()
|
|
|
|
{
|
2010-09-22 15:10:42 +02:00
|
|
|
unsigned int state;
|
2013-06-21 03:52:57 +02:00
|
|
|
__asm__("mov.w r2,%0" : "=r"(state));
|
2010-09-22 15:10:42 +02:00
|
|
|
state &= GIE;
|
2013-06-21 03:52:57 +02:00
|
|
|
|
2013-06-24 22:37:35 +02:00
|
|
|
if (!state) {
|
2013-06-21 03:52:57 +02:00
|
|
|
eINT();
|
|
|
|
}
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2013-06-21 03:52:57 +02:00
|
|
|
void restoreIRQ(unsigned int state)
|
|
|
|
{
|
2013-06-24 22:37:35 +02:00
|
|
|
if (state) {
|
2013-06-21 03:52:57 +02:00
|
|
|
eINT();
|
|
|
|
}
|
2010-09-22 15:10:42 +02:00
|
|
|
}
|
|
|
|
|