fatal: move enum definition to dedicated header

This allows enum values to be referenced in architecture `arch.h` files
without circular dependencies.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2023-01-06 18:34:10 +10:00 committed by Carles Cufí
parent d363781c94
commit 581e5375ff
2 changed files with 52 additions and 21 deletions

View File

@ -13,6 +13,7 @@
#include <zephyr/arch/cpu.h>
#include <zephyr/toolchain.h>
#include <zephyr/fatal_types.h>
#ifdef __cplusplus
extern "C" {
@ -24,27 +25,6 @@ extern "C" {
* @{
*/
enum k_fatal_error_reason {
/** Generic CPU exception, not covered by other codes */
K_ERR_CPU_EXCEPTION,
/** Unhandled hardware interrupt */
K_ERR_SPURIOUS_IRQ,
/** Faulting context overflowed its stack buffer */
K_ERR_STACK_CHK_FAIL,
/** Moderate severity software error */
K_ERR_KERNEL_OOPS,
/** High severity software error */
K_ERR_KERNEL_PANIC
/* TODO: add more codes for exception types that are common across
* architectures
*/
};
/**
* @brief Halt the system on a fatal error
*

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 CSIRO.
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
* @brief Fatal base type definitions
*/
#ifndef ZEPHYR_INCLUDE_FATAL_TYPES_H
#define ZEPHYR_INCLUDE_FATAL_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup fatal_types Fatal error base types
* @ingroup fatal_apis
* @{
*/
enum k_fatal_error_reason {
/** Generic CPU exception, not covered by other codes */
K_ERR_CPU_EXCEPTION,
/** Unhandled hardware interrupt */
K_ERR_SPURIOUS_IRQ,
/** Faulting context overflowed its stack buffer */
K_ERR_STACK_CHK_FAIL,
/** Moderate severity software error */
K_ERR_KERNEL_OOPS,
/** High severity software error */
K_ERR_KERNEL_PANIC,
/* TODO: add more codes for exception types that are common across
* architectures
*/
};
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_FATAL_TYPES_H */