2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2023-03-14 05:47:23 +08:00
|
|
|
zephyr_syscall_header(
|
|
|
|
${ZEPHYR_BASE}/include/zephyr/sys/mutex.h
|
|
|
|
)
|
|
|
|
|
2019-01-19 19:57:38 +08:00
|
|
|
zephyr_sources(
|
2021-03-03 12:14:24 +08:00
|
|
|
cbprintf_packaged.c
|
2020-01-03 03:57:43 +08:00
|
|
|
printk.c
|
2019-07-24 16:04:55 +08:00
|
|
|
sem.c
|
2019-01-19 19:57:38 +08:00
|
|
|
thread_entry.c
|
|
|
|
)
|
|
|
|
|
2023-09-25 20:30:16 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_FDTABLE fdtable.c)
|
2022-09-27 00:53:00 +08:00
|
|
|
|
2020-11-08 20:24:22 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c)
|
|
|
|
zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c)
|
|
|
|
|
2021-10-20 12:49:15 +08:00
|
|
|
if(NOT CONFIG_PICOLIBC)
|
|
|
|
zephyr_sources(cbprintf.c)
|
|
|
|
endif()
|
|
|
|
|
2022-03-25 16:40:29 +08:00
|
|
|
if (CONFIG_ASSERT OR CONFIG_ASSERT_VERBOSE)
|
|
|
|
zephyr_sources(assert.c)
|
|
|
|
endif()
|
|
|
|
|
2020-11-25 06:47:47 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_USERSPACE mutex.c user_work.c)
|
2020-07-29 04:14:23 +08:00
|
|
|
|
2021-01-14 14:59:52 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_MPSC_PBUF mpsc_pbuf.c)
|
|
|
|
|
2022-05-17 21:49:59 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_SPSC_PBUF spsc_pbuf.c)
|
|
|
|
|
2020-07-29 04:14:23 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_SCHED_DEADLINE p4wq.c)
|
|
|
|
|
2021-04-27 17:56:39 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_REBOOT reboot.c)
|
|
|
|
|
lib: os: add support for system power off
Add a new API to perform an immediate system power off:
`sys_poweroff()`.
Until now, this functionality has been implemented via the system power
management module, but in a clunky fashion. The way system PM works is
by defining some idle states in devicetree, that, given some properties
(e.g. minimal residency, exit latency, etc.) are automatically selected
when system goes to idle based on the expected next wake-up. However,
system off is a power state that one typically wants to control manually
from the application because it implies state loss, and in most cases,
configuring some sort of wake-up source. So in general, it is not
desired to let the system enter this state automatically. This led to
the following stuff in-tree:
from `boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts`:
```c
/*
* Deep power-down mode is supported in this SoC through
* 'PM_STATE_SOFT_OFF' state. There is no entry for this in device tree,
* user can call pm_state_force to enter this state.
*/
```
That is, state not being defined in devicetree so that PM subsystem
doesn't pick it automatically, but still implemented in in the PM hooks:
from `soc/arm/nxp_imx/rt5xx/power.c`, `pm_state_set()`:
```c
case PM_STATE_SOFT_OFF:
set_deepsleep_pin_config();
POWER_EnterDeepPowerDown(EXCLUDE_FROM_DEEP_POWERDOWN);
break;
```
And to actually make use of this state, users had to do this kind of
abominations:
```c
pm_state_force(0u, &(struct pm_state_info){ PM_STATE_SOFT_OFF, 0, 0 });
/* Now we need to go sleep. This will let the idle thread runs and
* the pm subsystem will use the forced state. To confirm that the
* forced state is used, lets set the same timeout used previously.
*/
k_sleep(K_SECONDS(SLEEP_S));
printk("ERROR: System off failed\n");
while (true) {
/* spin to avoid fall-off behavior */
}
```
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 17:46:41 +08:00
|
|
|
zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)
|
|
|
|
|
2020-07-29 04:14:23 +08:00
|
|
|
zephyr_library_include_directories(
|
|
|
|
${ZEPHYR_BASE}/kernel/include
|
|
|
|
${ZEPHYR_BASE}/arch/${ARCH}/include
|
|
|
|
)
|