37static const uint32_t splimMask = 1UL << ERRCTRL_ESF_5_bp;
38static const uint32_t cfd0Mask = 1UL << ERRCTRL_ESF_9_bp;
39static const uint32_t cfd1Mask = 1UL << ERRCTRL_ESF_10_bp;
40static const uint32_t cfm0Mask = 1UL << ERRCTRL_ESF_11_bp;
41static const uint32_t cfm1Mask = 1UL << ERRCTRL_ESF_12_bp;
42static const uint32_t eepromMask = 1UL << ERRCTRL_ESF_14_bp;
43static const uint32_t evsys0Mask = 1UL << ERRCTRL_ESF_15_bp;
44static const uint32_t evsys1Mask = 1UL << ERRCTRL_ESF_16_bp;
47static bool VerifyDiagnosticResult(uint32_t channelMask);
49static bool InjectSplimError(
void);
50static uint8_t DisableSplimChannel(
void);
51static void RestoreSplimChannelConfig(uint8_t splimChBackup);
53static bool InjectCfd0Error(
void);
54static uint8_t DisableCfd0Channel(
void);
55static void RestoreCfd0ChannelConfig(uint8_t cfd0ChBackup);
57static bool InjectCfd1Error(
void);
58static uint8_t DisableCfd1Channel(
void);
59static void RestoreCfd1ChannelConfig(uint8_t cfd1ChBackup);
61static bool InjectCfm0Error(
void);
62static uint8_t DisableCfm0Channel(
void);
63static void RestoreCfm0ChannelConfig(uint8_t cfm0ChBackup);
65static bool InjectCfm1Error(
void);
66static uint8_t DisableCfm1Channel(
void);
67static void RestoreCfm1ChannelConfig(uint8_t cfm1ChBackup);
69static bool InjectEepromError(
void);
70static uint8_t DisableEepromChannel(
void);
71static void RestoreEepromChannelConfig(uint8_t eepromChBackup);
73static bool InjectEvsys0Error(
void);
74static uint8_t DisableEvsys0Channel(
void);
75static void RestoreEvsys0ChannelConfig(uint8_t evsys0ChBackup);
77static bool InjectEvsys1Error(
void);
78static uint8_t DisableEvsys1Channel(
void);
79static void RestoreEvsys1ChannelConfig(uint8_t evsys1ChBackup);
93 const bool isChannelSet = InjectSplimError();
119 const bool isChannelSet = InjectCfd0Error();
145 const bool isChannelSet = InjectCfd1Error();
171 const bool isChannelSet = InjectCfm0Error();
197 const bool isChannelSet = InjectCfm1Error();
223 const bool isChannelSet = InjectEepromError();
249 const bool isChannelSet = InjectEvsys0Error();
275 const bool isChannelSet = InjectEvsys1Error();
290static bool VerifyDiagnosticResult(uint32_t channelMask)
294 const bool isChannelSet = ((chStatus & channelMask) == channelMask);
301static bool InjectSplimError(
void)
304 const uint8_t splimChBackup = DisableSplimChannel();
309 const bool isChannelSet = VerifyDiagnosticResult(splimMask);
311 RestoreSplimChannelConfig(splimChBackup);
317static uint8_t DisableSplimChannel(
void)
319 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
320 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
321 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
322 const uint8_t disableChConfig = (floatConfig | severityConfig);
330 return splimChBackup;
333static void RestoreSplimChannelConfig(uint8_t splimChBackup)
335 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
342static bool InjectCfd0Error(
void)
345 const uint8_t cfd0ChBackup = DisableCfd0Channel();
350 const bool isChannelSet = VerifyDiagnosticResult(cfd0Mask);
352 RestoreCfd0ChannelConfig(cfd0ChBackup);
358static uint8_t DisableCfd0Channel(
void)
360 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
361 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
362 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
363 const uint8_t disableChConfig = (floatConfig | severityConfig);
374static void RestoreCfd0ChannelConfig(uint8_t cfd0ChBackup)
376 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
383static bool InjectCfd1Error(
void)
386 const uint8_t cfd1ChBackup = DisableCfd1Channel();
391 const bool isChannelSet = VerifyDiagnosticResult(cfd1Mask);
393 RestoreCfd1ChannelConfig(cfd1ChBackup);
399static uint8_t DisableCfd1Channel(
void)
401 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
402 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
403 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
404 const uint8_t disableChConfig = (floatConfig | severityConfig);
415static void RestoreCfd1ChannelConfig(uint8_t cfd1ChBackup)
417 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
424static bool InjectCfm0Error(
void)
427 const uint8_t cfm0ChBackup = DisableCfm0Channel();
432 const bool isChannelSet = VerifyDiagnosticResult(cfm0Mask);
434 RestoreCfm0ChannelConfig(cfm0ChBackup);
440static uint8_t DisableCfm0Channel(
void)
442 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
443 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
444 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
445 const uint8_t disableChConfig = (floatConfig | severityConfig);
456static void RestoreCfm0ChannelConfig(uint8_t cfm0ChBackup)
458 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
465static bool InjectCfm1Error(
void)
468 const uint8_t cfm1ChBackup = DisableCfm1Channel();
473 const bool isChannelSet = VerifyDiagnosticResult(cfm1Mask);
475 RestoreCfm1ChannelConfig(cfm1ChBackup);
481static uint8_t DisableCfm1Channel(
void)
483 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
484 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
485 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
486 const uint8_t disableChConfig = (floatConfig | severityConfig);
497static void RestoreCfm1ChannelConfig(uint8_t cfm1ChBackup)
499 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
506static bool InjectEepromError(
void)
509 const uint8_t eepromChBackup = DisableEepromChannel();
514 const bool isChannelSet = VerifyDiagnosticResult(eepromMask);
516 RestoreEepromChannelConfig(eepromChBackup);
522static uint8_t DisableEepromChannel(
void)
524 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
525 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
526 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
527 const uint8_t disableChConfig = (floatConfig | severityConfig);
535 return eepromChBackup;
538static void RestoreEepromChannelConfig(uint8_t eepromChBackup)
540 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
547static bool InjectEvsys0Error(
void)
550 const uint8_t evsys0ChBackup = DisableEvsys0Channel();
555 const bool isChannelSet = VerifyDiagnosticResult(evsys0Mask);
557 RestoreEvsys0ChannelConfig(evsys0ChBackup);
563static uint8_t DisableEvsys0Channel(
void)
565 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
566 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
567 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
568 const uint8_t disableChConfig = (floatConfig | severityConfig);
576 return evsys0ChBackup;
579static void RestoreEvsys0ChannelConfig(uint8_t evsys0ChBackup)
581 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
588static bool InjectEvsys1Error(
void)
591 const uint8_t evsys1ChBackup = DisableEvsys1Channel();
596 const bool isChannelSet = VerifyDiagnosticResult(evsys1Mask);
598 RestoreEvsys1ChannelConfig(evsys1ChBackup);
604static uint8_t DisableEvsys1Channel(
void)
606 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
607 const uint8_t floatConfig = 0U << ERRCTRL_FLOAT_bp;
608 const uint8_t severityConfig = (uint8_t)ERRCTRL_ERRLVL_NOTIFICATION_gc;
609 const uint8_t disableChConfig = (floatConfig | severityConfig);
617 return evsys1ChBackup;
620static void RestoreEvsys1ChannelConfig(uint8_t evsys1ChBackup)
622 const uint8_t stateMask = (uint8_t)ERRCTRL_STATE_gm;
errFlag_t
Defines the error flag used by Middleware services to indicate error detection.
uint8_t ERRCTRL_ReadConfigEvsys0(void)
Reads the ESCEVSYS0 register value.
uint8_t ERRCTRL_ReadConfigCfd1(void)
Reads the ESCCFD1 register value.
void ERRCTRL_WriteConfigSplim(uint8_t value)
Overwrites the ESCSPLIM register value.
void ERRCTRL_WriteConfigEeprom(uint8_t value)
Overwrites the ESCEEPROM register value.
void ERRCTRL_WriteConfigCfd0(uint8_t value)
Overwrites the ESCCFD0 register value.
void ERRCTRL_WriteConfigEvsys1(uint8_t value)
Overwrites the ESCEVSYS1 register value.
void ERRCTRL_WriteConfigCfd1(uint8_t value)
Overwrites the ESCCFD1 register value.
uint32_t ERRCTRL_ReadChannelStatus(void)
Reads the ESF register value.
uint8_t ERRCTRL_ReadConfigCfd0(void)
Reads the ESCCFD0 register value.
void ERRCTRL_WriteConfigCfm1(uint8_t value)
Overwrites the ESCCFM1 register value.
uint8_t ERRCTRL_ReadConfigSplim(void)
Reads the ESCSPLIM register value.
void ERRCTRL_WriteChannelTest(uint32_t value)
Overwrites the ESFTEST register value.
uint8_t ERRCTRL_ReadConfigEvsys1(void)
Reads the ESCEVSYS1 register value.
void ERRCTRL_WriteConfigEvsys0(uint8_t value)
Overwrites the ESCEVSYS0 register value.
uint8_t ERRCTRL_ReadConfigCfm0(void)
Reads the ESCCFM0 register value.
uint8_t ERRCTRL_ReadConfigCfm1(void)
Reads the ESCCFM1 register value.
uint8_t ERRCTRL_ReadConfigEeprom(void)
Reads the ESCEEPROM register value.
void ERRCTRL_WriteConfigCfm0(uint8_t value)
Overwrites the ESCCFM0 register value.
void ERRCTRL_WriteChannelStatus(uint32_t value)
Overwrites the ESF register value.
void ERRCTRL_ModifyControlA(uint8_t groupMask, uint8_t groupConfig)
Modifies specific bit field(s) in the CTRLA register.
errFlag_t MW_DiagErrorChannelCfd1(void)
Performs error injection diagnostic to detect faults in the CFD1 error channel.
errFlag_t MW_DiagErrorChannelEvsys0(void)
Performs error injection diagnostic to detect faults in the EVSYS0 error channel.
errFlag_t MW_DiagErrorChannelSplim(void)
Performs error injection diagnostic to detect faults in the SPLIM error channel.
errFlag_t MW_DiagErrorChannelCfm1(void)
Performs error injection diagnostic to detect faults in the CFM1 error channel.
errFlag_t MW_DiagErrorChannelCfm0(void)
Performs error injection diagnostic to detect faults in the CFM0 error channel.
errFlag_t MW_DiagErrorChannelEeprom(void)
Performs error injection diagnostic to detect faults in the EEPROM error channel.
errFlag_t MW_DiagErrorChannelCfd0(void)
Performs error injection diagnostic to detect faults in the CFD0 error channel.
errFlag_t MW_DiagErrorChannelEvsys1(void)
Performs error injection diagnostic to detect faults in the EVSYS1 error channel.
void AtomicSectionStart(void)
Backup and disable global interrupts.
void AtomicSectionEnd(void)
Restore global interrupts if previously enabled.
bool IsErrChConfigurable(uint32_t channelMask)
Check Error Controller state and error channels indicated by the channel mask input.
Contains API prototypes and defines for the Error Manager Diagnostics.