Skip to content
Permalink
Browse files

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>
  • Loading branch information...
andrewboie committed Aug 6, 2019
1 parent 882503f commit 00bf76eaa7b228598a0e45a5874b2047c9784b7d
Showing with 15 additions and 0 deletions.
  1. +10 −0 include/fatal.h
  2. +5 −0 kernel/fatal.c
@@ -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
*
@@ -95,6 +95,11 @@ void z_fatal_print(const char *fmt, ...)
}
#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)
{
struct k_thread *thread = k_current_get();

0 comments on commit 00bf76e

Please sign in to comment.
You can’t perform that action at this time.