Add a basic power management framework
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3936 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
c38362f357
commit
eac7114381
@ -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();
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user