From bfd033e8d48306e431481ba6d43fa36f2125f785 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 18 Jun 2012 14:45:34 +0000 Subject: STM32 power management update git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4848 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/stm32/stm32_idle.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'nuttx/arch/arm/src/stm32/stm32_idle.c') diff --git a/nuttx/arch/arm/src/stm32/stm32_idle.c b/nuttx/arch/arm/src/stm32/stm32_idle.c index b5fd9fcb3..791a79429 100644 --- a/nuttx/arch/arm/src/stm32/stm32_idle.c +++ b/nuttx/arch/arm/src/stm32/stm32_idle.c @@ -45,6 +45,7 @@ #include +#include "stm32_pm.h" #include "up_internal.h" /**************************************************************************** @@ -98,7 +99,8 @@ static void up_idlepm(void) flags = irqsave(); /* Perform board-specific, state-dependent logic here */ - /* <-- ADD CODE HERE --> */ + + llvdbg("newstate= %d oldstate=%d\n", newstate, oldstate); /* Then force the global state change */ @@ -115,6 +117,29 @@ static void up_idlepm(void) oldstate = newstate; } + + /* MCU-specific power management logic */ + + switch (newstate) + { + case PM_NORMAL: + break; + + case PM_IDLE: + break; + + case PM_STANDBY: + stm32_pmstop(true); + break; + + case PM_SLEEP: + (void)stm32_pmstandby(); + break; + + default: + break; + } + irqrestore(flags); } } -- cgit v1.2.3