summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-22 12:27:05 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-22 12:27:05 +0000
commitef42377a6d8967bcdc3e82e93bc92e33c0a213c2 (patch)
treec4f2d9a461e38cab54ad5261525edb603da18e15
parentc678a1785d5a64f577093589194c1630de3b5f4d (diff)
PM update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5045 7fd9a85b-ad96-42d3-883c-3090e2eb8679
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_idle.c57
1 files changed, 39 insertions, 18 deletions
diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c
index 5b9f3c9fae..910d0a9d6c 100644
--- a/nuttx/configs/stm3210e-eval/src/up_idle.c
+++ b/nuttx/configs/stm3210e-eval/src/up_idle.c
@@ -252,15 +252,47 @@ static void up_idlepm(void)
enum pm_state_e newstate;
int ret;
- /* Decide, which power saving level can be obtained */
+ /* The following is logic that is done after the wake-up from PM_STANDBY
+ * state. It decides whether to go back to the PM_NORMAL or to the deeper
+ * power-saving mode PM_SLEEP: If the alarm expired with no "normal"
+ * wake-up event, then PM_SLEEP is entered.
+ *
+ * Logically, this code belongs at the end of the PM_STANDBY case below,
+ * does not work in the position for some unkown reason.
+ */
+
+ if (oldstate == PM_STANDBY)
+ {
+ /* Were we awakened by the alarm? */
+
+#ifdef CONFIG_RTC_ALARM
+ if (g_alarmwakeup)
+ {
+ /* Yes.. Go to SLEEP mode */
+
+ newstate = PM_SLEEP;
+ }
+ else
+#endif
+ {
+ /* Resume normal operation */
+
+ newstate = PM_NORMAL:
+ }
+ }
+ else
+#endif
+ {
+ /* Let the PM system decide, which power saving level can be obtained */
- newstate = pm_checkstate();
+ newstate = pm_checkstate();
+ }
/* Check for state changes */
if (newstate != oldstate)
{
- lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
+ llvdbg("newstate= %d oldstate=%d\n", newstate, oldstate);
sched_lock();
@@ -338,22 +370,11 @@ static void up_idlepm(void)
{
lldbg("Warning: Cancel alarm failed\n");
}
-
- /* Were we awakened by the alarm? */
-
- if (g_alarmwakeup)
- {
- /* Yes.. Go to SLEEP mode */
-
- pm_changestate(PM_SLEEP);
- }
- else
#endif
- {
- /* Resume normal operation */
-
- pm_changestate(PM_NORMAL);
- }
+ /* Note: See the additional PM_STANDBY related logic at the
+ * beginning of this function. That logic is executed after
+ * this point.
+ */
}
break;