kernel: add z_fatal_halt() to interface

Intended to be called from application-level implementations
of k_sys_fatal_error_handler().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-08-06 12:10:49 -07:00 committed by Andrew Boie
commit 00bf76eaa7
2 changed files with 15 additions and 0 deletions

View file

@ -31,6 +31,16 @@ enum k_fatal_error_reason {
*/ */
}; };
/**
* @brief Halt the system on a fatal error
*
* Invokes architecture-specific code to power off or halt the system in
* a low power state. Lacking that, lock interupts and sit in an idle loop.
*
* @param reason Fatal exception reason code
*/
FUNC_NORETURN void k_fatal_halt(unsigned int reason);
/** /**
* @brief Fatal error policy handler * @brief Fatal error policy handler
* *

View file

@ -95,6 +95,11 @@ void z_fatal_print(const char *fmt, ...)
} }
#endif /* CONFIG_LOG || CONFIG_PRINTK */ #endif /* CONFIG_LOG || CONFIG_PRINTK */
FUNC_NORETURN void k_fatal_halt(unsigned int reason)
{
z_arch_system_halt(reason);
}
void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf) void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{ {
struct k_thread *thread = k_current_get(); struct k_thread *thread = k_current_get();