summaryrefslogtreecommitdiff
path: root/src/arch/msp430fr5969lp/arch.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-15 12:26:23 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-15 12:26:23 +0200
commit60d9448acc7331a599cbdb4b1007ec45419f57fb (patch)
treeb3f23811f9deed5cb57a50f0de0fdb6e0fa283c8 /src/arch/msp430fr5969lp/arch.cc
parent17831e691af5152e9e1bdd8588e150810c1836a6 (diff)
MSP430: Avoid possible race conditions when going to sleep
Diffstat (limited to 'src/arch/msp430fr5969lp/arch.cc')
-rw-r--r--src/arch/msp430fr5969lp/arch.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc
index 7de978c..b475c5f 100644
--- a/src/arch/msp430fr5969lp/arch.cc
+++ b/src/arch/msp430fr5969lp/arch.cc
@@ -109,9 +109,8 @@ void Arch::delay_ms(unsigned char const ms)
void Arch::idle_loop(void)
{
while (1) {
- __eint();
asm volatile("nop");
- __bis_SR_register(LPM2_bits);
+ __bis_SR_register(GIE | LPM2_bits);
asm volatile("nop");
__dint();
#if defined(WITH_LOOP)
@@ -128,13 +127,12 @@ void Arch::idle_loop(void)
void Arch::idle(void)
{
- __eint();
asm volatile("nop");
- __bis_SR_register(LPM2_bits);
+ __bis_SR_register(GIE | LPM2_bits);
asm volatile("nop");
__dint();
#ifdef WITH_WAKEUP
- wakeup();
+ wakeup();
#endif
}
@@ -144,7 +142,7 @@ Arch arch;
#include "driver/uptime.h"
-__attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle_timer0_overflow()
+__attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle_timer1_overflow()
{
if (TA1IV == 0x0e) {
#ifdef WITH_LOOP