|
PebbleOS v4.44.0-105-g1dd754433
|
Restart or power off the system, with handlers to shut down in order. More...
Data Structures | |
| struct | pbl_sys_off_handler |
| Restart or power-off handler. More... | |
Macros | |
| #define | PBL_SYS_OFF_PRIO_LOW -128 |
| Priority of handlers that must run after the others of their mode. | |
| #define | PBL_SYS_OFF_PRIO_DEFAULT 0 |
| Default handler priority. | |
| #define | PBL_SYS_OFF_PRIO_HIGH 128 |
| Priority of handlers that must run before the others of their mode. | |
| #define | PBL_SYS_OFF_HANDLER_DEFINE(_name, _mode, _priority, _handler, _user_data) |
| Define a restart or power-off handler. | |
Enumerations | |
| enum | pbl_sys_off_mode { PBL_SYS_OFF_RESTART_PREPARE , PBL_SYS_OFF_POWER_OFF_PREPARE , PBL_SYS_OFF_RESTART , PBL_SYS_OFF_POWER_OFF } |
| Stage of a restart or power-off a handler runs in. More... | |
Functions | |
| void | pbl_reboot (void) |
| Restart the system in order. | |
| void | pbl_power_off (void) |
| Power off the system in order. | |
| void | pbl_reboot_emergency (void) |
| Reset the SoC at once, without running any handler. | |
| void | pbl_soc_reset (void) |
| Reset the SoC. | |
Restart or power off the system, with handlers to shut down in order.
pbl_reboot() and pbl_power_off() run the handlers of the matching prepare mode, then the handlers that restart or power off the system, highest priority first. Prepare handlers shut down what must not be cut off midway, e.g. a radio link or a flash erase. Restart and power-off handlers end the system; one that returns has declined or failed, and the next one runs. If none ends the system, the kernel resets the SoC with pbl_soc_reset() when the SoC selects CONFIG_SOC_HAS_RESET, else with the architecture's reset.
Prepare handlers only run on the first request made from a thread with interrupts and the scheduler unlocked; otherwise, or when a handler requests a reboot itself, they are skipped. Restart and power-off handlers run in the context of the request, so they must check it before doing anything that blocks.
| #define PBL_SYS_OFF_HANDLER_DEFINE | ( | _name, | |
| _mode, | |||
| _priority, | |||
| _handler, | |||
| _user_data | |||
| ) |
Define a restart or power-off handler.
| _name | Name of the handler, unique across the firmware. |
| _mode | Mode the handler runs in, an pbl_sys_off_mode. |
| _priority | Order among the handlers of _mode, highest first. |
| _handler | Function called in _mode. |
| _user_data | Data passed to _handler. |
| #define PBL_SYS_OFF_PRIO_DEFAULT 0 |
Default handler priority.
| #define PBL_SYS_OFF_PRIO_HIGH 128 |
Priority of handlers that must run before the others of their mode.
| #define PBL_SYS_OFF_PRIO_LOW -128 |
Priority of handlers that must run after the others of their mode.
| enum pbl_sys_off_mode |
| void pbl_power_off | ( | void | ) |
Power off the system in order.
Runs the PBL_SYS_OFF_POWER_OFF_PREPARE handlers, then the PBL_SYS_OFF_POWER_OFF ones. Resets the SoC if none of them powers off. Callable from any context.
| void pbl_reboot | ( | void | ) |
Restart the system in order.
Runs the PBL_SYS_OFF_RESTART_PREPARE handlers, then the PBL_SYS_OFF_RESTART ones. Callable from any context.
| void pbl_reboot_emergency | ( | void | ) |
Reset the SoC at once, without running any handler.
For contexts where nothing else can be trusted to work. Callable from any context.
| void pbl_soc_reset | ( | void | ) |
Reset the SoC.
Implemented by SoCs that select CONFIG_SOC_HAS_RESET, for those the architecture's reset doesn't suit. Called with interrupts locked.