diff options
Diffstat (limited to 'nuttx/arch')
-rw-r--r-- | nuttx/arch/sim/src/up_head.c | 11 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_idle.c | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/nuttx/arch/sim/src/up_head.c b/nuttx/arch/sim/src/up_head.c index e1d8c943b..431d417de 100644 --- a/nuttx/arch/sim/src/up_head.c +++ b/nuttx/arch/sim/src/up_head.c @@ -47,6 +47,7 @@ #include <nuttx/init.h> #include <nuttx/arch.h> +#include <nuttx/pm.h> /**************************************************************************** * Private Data @@ -60,6 +61,16 @@ static jmp_buf sim_abort; int main(int argc, char **argv, char **envp) { + /* Power management should be initialized early in the (simulated) boot + * sequence. + */ + +#ifdef CONFIG_PM + pm_initialize(); +#endif + + /* Then start NuttX */ + if (setjmp(sim_abort) == 0) { os_start(); 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. */ |