adv_power:Power management hooks template app
A template app that defines the power management hooks and enables the power management related CONFIG flags. This app will enable build testing of power management code inside the CONFIG flags. Change-Id: If26904f69333ff05a0711596218b51b828669de1 Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
This commit is contained in:
parent
3888735e0d
commit
d230fc3653
7 changed files with 104 additions and 0 deletions
6
samples/power/power_hooks/Makefile
Normal file
6
samples/power/power_hooks/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
MDEF_FILE = prj.mdef
|
||||
KERNEL_TYPE = micro
|
||||
BOARD ?= qemu_x86
|
||||
CONF_FILE = prj.conf
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
18
samples/power/power_hooks/README.txt
Normal file
18
samples/power/power_hooks/README.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Title: Power management hooks template
|
||||
|
||||
Description:
|
||||
|
||||
A template app that defines the power management hooks and
|
||||
enables the power management related CONFIG flags. This
|
||||
app will enable build testing of power management code inside
|
||||
the CONFIG flags.
|
||||
|
||||
This project is intended only for build testing. For running
|
||||
real PM tests use other applications that are full implementations
|
||||
specific to SOCs
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Building Project:
|
||||
|
||||
make pristine && make
|
4
samples/power/power_hooks/prj.conf
Normal file
4
samples/power/power_hooks/prj.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_ADVANCED_POWER_MANAGEMENT=y
|
||||
CONFIG_ADVANCED_IDLE=y
|
||||
CONFIG_TICKLESS_IDLE=y
|
5
samples/power/power_hooks/prj.mdef
Normal file
5
samples/power/power_hooks/prj.mdef
Normal file
|
@ -0,0 +1,5 @@
|
|||
% Application : PM template
|
||||
|
||||
% TASK NAME PRIO ENTRY STACK GROUPS
|
||||
% ==================================
|
||||
TASK TASKA 7 main 2048 [EXE]
|
1
samples/power/power_hooks/src/Makefile
Normal file
1
samples/power/power_hooks/src/Makefile
Normal file
|
@ -0,0 +1 @@
|
|||
obj-y = main.o
|
66
samples/power/power_hooks/src/main.c
Normal file
66
samples/power/power_hooks/src/main.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <advidle.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
PRINT("Power management template!\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter suspend or low power idle state
|
||||
*
|
||||
* This routine checks if the upcoming kernel idle interval is sufficient to
|
||||
* justify entering soc suspend mode or turn off peripherals. If it is, then
|
||||
* the routine performs the operations necessary to conserve power; if not,
|
||||
* then the routine returns immediately without suspending.
|
||||
*
|
||||
* param: upcoming kernel idle time ticks
|
||||
*
|
||||
* return: non-zero value if handled; zero to let kernel do the idling
|
||||
*/
|
||||
|
||||
int _sys_soc_suspend(int32_t ticks)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit suspend or low power idle state
|
||||
*
|
||||
* This routine is called after a suspend state is exited. This would
|
||||
* resume execution at the point system suspended if the soc was suspended.
|
||||
* If soc was not suspended, then this function will return and kernel will
|
||||
* continue its cold boot process.
|
||||
*
|
||||
* If any states were altered at an earlier call to suspend, then they
|
||||
* should be restored in this function.
|
||||
*
|
||||
* Will not return to caller if soc was suspended
|
||||
*/
|
||||
void _sys_soc_resume(void)
|
||||
{
|
||||
}
|
4
samples/power/power_hooks/testcase.ini
Normal file
4
samples/power/power_hooks/testcase.ini
Normal file
|
@ -0,0 +1,4 @@
|
|||
[test]
|
||||
build_only = true
|
||||
tags = apps
|
||||
arch_whitelist = x86
|
Loading…
Add table
Add a link
Reference in a new issue