diff --git a/samples/power/power_hooks/Makefile b/samples/power/power_hooks/Makefile new file mode 100644 index 00000000000..0d56ce66d64 --- /dev/null +++ b/samples/power/power_hooks/Makefile @@ -0,0 +1,6 @@ +MDEF_FILE = prj.mdef +KERNEL_TYPE = micro +BOARD ?= qemu_x86 +CONF_FILE = prj.conf + +include ${ZEPHYR_BASE}/Makefile.inc diff --git a/samples/power/power_hooks/README.txt b/samples/power/power_hooks/README.txt new file mode 100644 index 00000000000..856fa9b523c --- /dev/null +++ b/samples/power/power_hooks/README.txt @@ -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 diff --git a/samples/power/power_hooks/prj.conf b/samples/power/power_hooks/prj.conf new file mode 100644 index 00000000000..f7c36e8bdad --- /dev/null +++ b/samples/power/power_hooks/prj.conf @@ -0,0 +1,4 @@ +CONFIG_STDOUT_CONSOLE=y +CONFIG_ADVANCED_POWER_MANAGEMENT=y +CONFIG_ADVANCED_IDLE=y +CONFIG_TICKLESS_IDLE=y diff --git a/samples/power/power_hooks/prj.mdef b/samples/power/power_hooks/prj.mdef new file mode 100644 index 00000000000..3d21f08ce67 --- /dev/null +++ b/samples/power/power_hooks/prj.mdef @@ -0,0 +1,5 @@ +% Application : PM template + +% TASK NAME PRIO ENTRY STACK GROUPS +% ================================== + TASK TASKA 7 main 2048 [EXE] diff --git a/samples/power/power_hooks/src/Makefile b/samples/power/power_hooks/src/Makefile new file mode 100644 index 00000000000..00066e15678 --- /dev/null +++ b/samples/power/power_hooks/src/Makefile @@ -0,0 +1 @@ +obj-y = main.o diff --git a/samples/power/power_hooks/src/main.c b/samples/power/power_hooks/src/main.c new file mode 100644 index 00000000000..b4f6e6c3a01 --- /dev/null +++ b/samples/power/power_hooks/src/main.c @@ -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 +#include + +#if defined(CONFIG_STDOUT_CONSOLE) +#include +#define PRINT printf +#else +#include +#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) +{ +} diff --git a/samples/power/power_hooks/testcase.ini b/samples/power/power_hooks/testcase.ini new file mode 100644 index 00000000000..749c8b4c860 --- /dev/null +++ b/samples/power/power_hooks/testcase.ini @@ -0,0 +1,4 @@ +[test] +build_only = true +tags = apps +arch_whitelist = x86