123 uint32_t tmperr_Check[((uint16_t)
DIAG_ID_MAX + 31u) / 32u] = {0};
128 uint16_t checkfail = 0u;
131 if (checkfail > 0u) {
147 for (uint8_t i = 0; i < (uint8_t)(((uint16_t)
DIAG_ID_MAX + 31u) / 32u); i++) {
148 tmperr_Check[i] = 0u;
161 for (uint8_t c = 0; c < (uint8_t)(((uint16_t)
DIAG_ID_MAX + 31u) / 32u); c++) {
168 for (uint16_t entry = 0u; entry < (uint16_t)
DIAG_ID_MAX; entry++) {
183 if (fatalErrorDetected && discardDelay) {
194 const uint16_t errorThreshold =
200 if (thresholdCounter > errorThreshold) {
248 uint32_t *u32ptr_errCodemsk =
NULL_PTR;
249 uint32_t *u32ptr_warnCodemsk =
NULL_PTR;
250 uint16_t *u16ptr_threshcounter =
NULL_PTR;
251 uint16_t cfg_threshold = 0;
252 uint16_t err_enable_idx = 0;
253 uint32_t err_enable_bitmask = 0;
278 uint8_t stringID = 0u;
283 err_enable_idx = diagId / 32;
284 err_enable_bitmask = 1 << (diagId % 32);
296 if (((*u16ptr_threshcounter) == 0)) {
298 }
else if ((*u16ptr_threshcounter) > 1) {
299 (*u16ptr_threshcounter)--;
300 }
else if ((*u16ptr_threshcounter) == 1) {
303 *u32ptr_errCodemsk &= ~err_enable_bitmask;
304 *u32ptr_warnCodemsk &= ~err_enable_bitmask;
305 (*u16ptr_threshcounter) = 0;
321 if ((*u16ptr_threshcounter) < cfg_threshold) {
322 (*u16ptr_threshcounter)++;
324 }
else if ((*u16ptr_threshcounter) == cfg_threshold) {
326 (*u16ptr_threshcounter)++;
327 *u32ptr_errCodemsk |= err_enable_bitmask;
328 *u32ptr_warnCodemsk &= ~err_enable_bitmask;
342 }
else if (((*u16ptr_threshcounter) > cfg_threshold)) {
348 *u32ptr_errCodemsk &= ~err_enable_bitmask;
349 *u32ptr_warnCodemsk |= err_enable_bitmask;
355 *u32ptr_errCodemsk &= ~err_enable_bitmask;
356 *u32ptr_warnCodemsk &= ~err_enable_bitmask;
357 (*u16ptr_threshcounter) = 0;
392 bool fatalErrorActive =
false;
397 fatalErrorActive =
true;
400 return fatalErrorActive;
404 #ifdef UNITY_UNIT_TEST
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
STD_RETURN_TYPE_e DIAG_CheckEvent(STD_RETURN_TYPE_e cond, DIAG_ID_e diagId, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_CheckEvent provides a simple interface to check an event for STD_OK.
static DIAG_DEV_s * diag_devptr
static uint8_t DIAG_EntryWrite(uint8_t eventID, DIAG_EVENT_e event, uint32_t data)
DIAG_EntryWrite adds an error entry.
uint32_t DIAG_GetDelay(DIAG_ID_e diagnosisEntry)
Get configured delay of passed diagnosis entry.
void DIAG_PrintErrors(void)
Prints contents of the error buffer on user request.
STD_RETURN_TYPE_e DIAG_GetDiagnosisEntryState(DIAG_ID_e diagnosisEntry)
Checks if passed diagnosis entry has been triggered or not.
bool DIAG_IsAnyFatalErrorSet(void)
Check if any fatal error is set.
static DIAG_DIAGNOSIS_STATE_s diag
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
static uint8_t diag_locked
STD_RETURN_TYPE_e DIAG_Initialize(DIAG_DEV_s *diag_dev_pointer)
DIAG_Init initializes all needed structures/buffers.
static void DIAG_Reset(void)
DIAG_Reset resetsall needed structures.
@ DIAG_STATE_UNINITIALIZED
@ DIAG_HANDLER_RETURN_NOT_READY
@ DIAG_HANDLER_INVALID_DATA
@ DIAG_HANDLER_RETURN_WRONG_ID
@ DIAG_HANDLER_RETURN_WARNING_OCCURRED
@ DIAG_HANDLER_RETURN_ERR_OCCURRED
@ DIAG_HANDLER_INVALID_ERR_IMPACT
@ DIAG_HANDLER_RETURN_UNKNOWN
DIAG_ID_CFG_s diag_diagnosisIdConfiguration[]
const DIAG_DATABASE_SHIM_s diag_kDatabaseShim
@ DIAG_EVALUATION_ENABLED
@ DIAG_EVALUATION_DISABLED
#define DIAG_MAX_ENTRIES_OF_ERROR
#define DIAG_DELAY_DISCARDED
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Definition of foxBMS standard types.
#define NULL_PTR
Null pointer.
Declaration of the OS wrapper interface.
uint8_t nrOfConfiguredDiagnosisEntries
DIAG_ID_CFG_s * pConfigurationOfDiagnosisEntries
DIAG_ID_CFG_s * pFatalErrorLinkTable[DIAG_ID_MAX]
uint16_t numberOfFatalErrors
uint32_t entry_event[DIAG_ID_MAX]
uint32_t errflag[(DIAG_ID_MAX+31)/32]
uint8_t entry_cnt[DIAG_ID_MAX]
uint16_t occurrenceCounter[BS_NR_OF_STRINGS][DIAG_ID_MAX]
DIAG_MODULE_STATE_e state
uint32_t warnflag[(DIAG_ID_MAX+31)/32]
uint8_t id2ch[DIAG_ID_MAX]
uint32_t err_enableflag[(DIAG_ID_MAX+31)/32]
DIAG_RECORDING_e enable_recording
DIAG_CALLBACK_FUNCTION_f * fpCallback
DIAG_EVALUATE_e enable_evaluate