Public functions of the fault handler library layer. More...
Functions | |
volatile uint16_t | drv_FaultHandler_CheckObject (volatile struct FAULT_OBJECT_s *fltObject) |
Check current fault status of a user-defined fault object. More... | |
volatile uint16_t | drv_TrapHandler_SoftTrapsInitialize (bool accumulator_a_overflow_trap_enable, bool accumulator_b_overflow_trap_enable, bool accumulator_catastrophic_overflow_trap_enable) |
Configures the software-configurable traps. More... | |
void | DefaultTrapHandler (enum TRAP_ID_e trap_id) |
Centralized trap handler routine. More... | |
Public functions of the fault handler library layer.
This is the detailed description of public functions of the fault handler library.
void DefaultTrapHandler | ( | enum TRAP_ID_e | trap_id | ) |
Centralized trap handler routine.
This routine is used as centralized trap handler for all traps. Each trap is identified and logged by a unique trap ID and the status bits of traps and interrupt vectors are captured
Users may modify the basic framework provided here to suit to the needs of their application.
Definition at line 116 of file drv_trap_handler.c.
uint16_t drv_FaultHandler_CheckObject | ( | volatile struct FAULT_OBJECT_s * | fltObject | ) |
Check current fault status of a user-defined fault object.
fltObject | Pointer to a Fault Monitoring Object of type struct FAULT_OBJECT_s |
This routine compares the most recent value of a global variable or SFR (SOURCE) against user-defined thresholds. If the value violates/exceeds one or more of the user defined conditions, a fault counter is incremented.
When this fault counter exceeds the user-defined maximum, a fault condition is tripped and the fault_status flag bit is set.
When a fault condition has been tripped and the fault status is set (=true), the fault check monitors for the source value triggering a recovery event. The recovery process works like the fault trip event by comparing the most recent source value against the user-defined RECOVERY_LEVEL. Once the value has been RSTCNT_MAX times below the RECOVERY_LEVEL threshold, the fault will automatically be cleared.
a) Comparison Types
The fault handler offers the following different comparison methods:
b) Value Filtering
A bit-mask filter can be used to monitor individual register bits or filter on specific bits within a 16-bit wide value. The bit-mask is always applied the source value. If no bit-mask is required, set bitmask = 0xFFFF;
c) Comparison of two dynamic values
When dynamic values of two variables need to be compared, the fault object offers a second pointer to a so-called reference object "ref_obj". When this pointer is != NULL, the absolute value of the difference between SOURCE and REFERNCE is compared against the user-defined TRIP and RECOVERY thresholds. When no second value is used, set ref_obj = NULL (NULL-pointer). This will force the fault check to ignore this value.
d) User defined responses
Function pointers "trip_response" and "reset_response" can be used to assign user-defined functions which should be called when a fault condition has been tripped or reset. I no user-defined function should be called, these pointers can be set = NULL (NULL-pointer)
Definition at line 168 of file drv_fault_handler.c.
uint16_t drv_TrapHandler_SoftTrapsInitialize | ( | bool | accumulator_a_overflow_trap_enable, |
bool | accumulator_b_overflow_trap_enable, | ||
bool | accumulator_catastrophic_overflow_trap_enable | ||
) |
Configures the software-configurable traps.
accumulator_a_overflow_trap_enable | Flag of type Boolean enabling/disabling accumulator A trap at 1.31 overflow |
accumulator_b_overflow_trap_enable | Flag of type Boolean enabling/disabling accumulator B trap at 1.31 overflow |
accumulator_catastrophic_overflow_trap_enable | Flag of type Boolean enabling/disabling catastrophic accumulator trap at 9.31 overflow |
This routine sets the DSP-specific traps for overflow-events of accumulator A and B.
Definition at line 90 of file drv_trap_handler.c.