From 8514a91ea98dd5015aba083af2d3f16a54b93e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Tue, 3 Dec 2013 18:44:01 +0100 Subject: [PATCH] cc2538: lpm: Fix energest context when aborting lpm_enter() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In one of the abort cases in lpm_enter(), the energest context has previously been set to LPM, so the abort code needs to set it back to CPU. Signed-off-by: Benoît Thébaudeau --- cpu/cc2538/lpm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpu/cc2538/lpm.c b/cpu/cc2538/lpm.c index bbc035219..74d00df91 100644 --- a/cpu/cc2538/lpm.c +++ b/cpu/cc2538/lpm.c @@ -301,6 +301,11 @@ lpm_enter() select_32_mhz_xosc(); REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0; + + /* Remember IRQ energest for next pass */ + ENERGEST_IRQ_SAVE(irq_energest); + ENERGEST_ON(ENERGEST_TYPE_CPU); + ENERGEST_OFF(ENERGEST_TYPE_LPM); } else { /* All clear. Assert WFI and drop to PM1/2. This is now un-interruptible */ assert_wfi();