1 /* 2 * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 * Copyright 2016-2020 NXP 4 * 5 * 6 * This is the header file for the Panic module. 7 * 8 * SPDX-License-Identifier: BSD-3-Clause 9 */ 10 11 #ifndef __PANIC_H__ 12 #define __PANIC_H__ 13 14 #ifndef SDK_COMPONENT_DEPENDENCY_FSL_COMMON 15 #define SDK_COMPONENT_DEPENDENCY_FSL_COMMON (1U) 16 #endif 17 #if (defined(SDK_COMPONENT_DEPENDENCY_FSL_COMMON) && (SDK_COMPONENT_DEPENDENCY_FSL_COMMON > 0U)) 18 #include "fsl_common.h" 19 #else 20 #endif 21 22 /*! 23 * @addtogroup Panic 24 * @{ 25 */ 26 27 /*! ********************************************************************************* 28 ************************************************************************************* 29 * Include 30 ************************************************************************************* 31 ********************************************************************************** */ 32 33 /*! ********************************************************************************* 34 ************************************************************************************* 35 * Public type definitions 36 ************************************************************************************* 37 ********************************************************************************** */ 38 39 /**@brief panic id. */ 40 typedef uint32_t panic_id_t; 41 42 /**@brief panic data structure. */ 43 typedef struct _panic_data 44 { 45 panic_id_t id; /* Panic ID */ 46 uint32_t location; /* location address where the Panic occurred */ 47 uint32_t extra1; /* extra1 */ 48 uint32_t extra2; /* extra2 */ 49 uint32_t linkRegister; /* Link register */ 50 uint32_t cpsr_contents; /* cpsr_contents*/ 51 uint8_t stack_dump[4]; /* initially just contain the contents of the LR */ 52 } panic_data_t; 53 54 /*! ********************************************************************************* 55 ************************************************************************************* 56 * Public macros 57 ************************************************************************************* 58 ********************************************************************************** */ 59 #ifndef PANIC_ENABLE_LOG 60 #define PANIC_ENABLE_LOG (0) 61 #endif 62 63 #define ID_PANIC(grp, value) ((panic_id_t)(((panic_id_t)(grp) << 16) + ((panic_id_t)(value)))) 64 65 /*! ********************************************************************************* 66 ************************************************************************************* 67 * Public prototypes 68 ************************************************************************************* 69 ********************************************************************************** */ 70 71 /*! 72 * @brief Panic function. 73 * 74 * 75 * @param id Panic ID 76 * @param location location address where the Panic occurred 77 * @param extra1 extra1 parameter to be stored in Panic structure. 78 * @param extra2 extra2 parameter to be stored in Panic structure 79 * @retval No return vaule. 80 */ 81 void panic(panic_id_t id, uint32_t location, uint32_t extra1, uint32_t extra2); 82 /*! @}*/ 83 #endif /* __PANIC_H__ */ 84