summaryrefslogtreecommitdiff
path: root/nuttx/arch/sim/src/up_idle.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-04 19:24:27 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-04 19:24:27 +0000
commit7e1e02b8a0fc6f448892b82203a4a77606eb83c9 (patch)
tree3e508a03b68f2a4f31a8d2d3f0c4499a6ba40f12 /nuttx/arch/sim/src/up_idle.c
parent6729d8d258aa6a8734779d5143aafaf56fe073b4 (diff)
downloadpx4-nuttx-7e1e02b8a0fc6f448892b82203a4a77606eb83c9.tar.gz
px4-nuttx-7e1e02b8a0fc6f448892b82203a4a77606eb83c9.tar.bz2
px4-nuttx-7e1e02b8a0fc6f448892b82203a4a77606eb83c9.zip
Add a basic power management framework
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3936 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/sim/src/up_idle.c')
-rw-r--r--nuttx/arch/sim/src/up_idle.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/nuttx/arch/sim/src/up_idle.c b/nuttx/arch/sim/src/up_idle.c
index 32efaa11b..f1d9974d2 100644
--- a/nuttx/arch/sim/src/up_idle.c
+++ b/nuttx/arch/sim/src/up_idle.c
@@ -40,7 +40,10 @@
#include <nuttx/config.h>
#include <time.h>
+
#include <nuttx/arch.h>
+#include <nuttx/pm.h>
+
#include "up_internal.h"
/****************************************************************************
@@ -103,6 +106,24 @@ void up_idle(void)
uipdriver_loop();
#endif
+ /* Fake some power management stuff for testing purposes */
+
+#ifdef CONFIG_PM
+ {
+ static enum pm_state_e state = PM_NORMAL;
+ enum pm_state_e newstate;
+
+ newstate = pm_checkstate();
+ if (newstate != state)
+ {
+ if (pm_changestate(newstate) == OK)
+ {
+ state = newstate;
+ }
+ }
+ }
+#endif
+
/* Wait a bit so that the sched_process_timer() is called close to the
* correct rate.
*/