/** * @file hal_harderr.h * @author Xiao Lifan (xiaolf6@midea.com) * @brief * @version 0.1 * @date 2021-09-26 * * @copyright Copyright (c) 2021 * * @details The interface of system hard error detect and handling * */ #ifndef _HAL_HARDERR_H_ #define _HAL_HARDERR_H_ #include "hal_config.h" /**************************************************************** * * Standard Interface * * *************************************************************/ /********************/ /* Type definations */ /********************/ // typedef union // { // uint32_t all; // struct bit // { // uint32_t bit0:1; // uint32_t bit0:1; // }; // } Hal_Harderr_FlagType; /******************************/ /* Global Interface Variables */ /******************************/ /* !!!Important!!! */ /* Interface Variable Should Not Be Modified By Application */ /** * @brief The flag of triggered hardware error * */ extern uint32_t Hal_HardErr_Flags; /*************************/ /* Global Interface Hook */ /*************************/ /** * @brief Function called when hardware error are triggered * */ extern void (*Hal_HardErr_TriggerHook)(); /** * @brief Function called when hardware error are cleared * * @note The clear of the hardware err may lag * */ extern void (*Hal_HardErr_ClearHook)(); /*****************************************/ /* Application Layer Interface Functions */ /*****************************************/ /** * @brief Get specified bit of hardware error flags * * @param bit bit index * @return uint8_t error status 0 - no error, 1 - error occurs */ uint8_t Hal_HardErr_GetFlagStatus(uint8_t bit); /** * @brief Try clear hardware error * * @return uint8_t result of clear action 0 - success, 1 - falied */ uint8_t Hal_HardErr_TryClearHardErr(); /**************************************/ /* Platform Layer Interface Functions */ /**************************************/ /** * @brief Init hardware error detection * */ void Hal_HardErr_Init(); /** * @brief Set the specified bit of hardware error flag * * @param bit bit index * @param state flag state */ void Hal_HardErr_SetFlagStatus(uint8_t bit, uint8_t state); #endif