FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
Reset Manager

Contains API prototypes and type definitions for the Reset Manager. More...

Files

file  midware_reset_manager.c
 Implements APIs for the Reset Manager.

Enumerations

enum  resetReason_t {
  RSTRSN_UNKNOWN = 0U , RSTRSN_POWER_ON , RSTRSN_BROWNOUT , RSTRSN_EXTERNAL ,
  RSTRSN_WDR_RESET , RSTRSN_SOFTWARE , RSTRSN_UPDI_RESET , RSTRSN_ERRCH_UNKNOWN ,
  RSTRSN_MCHK_UNKNOWN , RSTRSN_WDT_OUTSIDE , RSTRSN_WDT_TIMEOUT , RSTRSN_ERRCH_VREGFAIL ,
  RSTRSN_ERRCH_BUSERR , RSTRSN_ERRCH_RAM2 , RSTRSN_ERRCH_FLASH2 , RSTRSN_ERRCH_OPC ,
  RSTRSN_ERRCH_SPLIM , RSTRSN_ERRCH_RAM1 , RSTRSN_ERRCH_FLASH1 , RSTRSN_ERRCH_VREGWARN ,
  RSTRSN_ERRCH_CFD0 , RSTRSN_ERRCH_CFD1 , RSTRSN_ERRCH_CFM0 , RSTRSN_ERRCH_CFM1 ,
  RSTRSN_ERRCH_SWDT , RSTRSN_ERRCH_EEPROM , RSTRSN_ERRCH_EVSYS0 , RSTRSN_ERRCH_EVSYS1 ,
  RSTRSN_MCHK_OCD , RSTRSN_MCHK_DFT , RSTRSN_MCHK_EC , RSTRSN_MCHK_DCLS ,
  RSTRSN_MCHK_BOOT , RSTRSN_MCHK_WDT , RSTRSN_MCHK_CRC , RSTRSN_MCHK_VREG ,
  RSTRSN_MCHK_CFD , RSTRSN_MCHK_UPDI , RSTRSN_MAX
}
 Type defines for all possible reset sources. More...

Functions

void MW_ResetDevice (void)
 Issues a software reset request to reset the device.
resetReason_t MW_GetClearResetReason (void)
 Reads and clears the reset flag registers.

Detailed Description

Contains API prototypes and type definitions for the Reset Manager.

Version
1.0.0-alpha.1

The Reset Manager provides services to Tasks to ensure correct interaction with features of the RSTCTRL peripheral.

UML Class Diagrams

UML Activity Diagrams

Enumeration Type Documentation

◆ resetReason_t

Type defines for all possible reset sources.

Warning
It is assumed that the order of this enum is not modified, as MW_GetClearResetReason depends on this specific order with the relative offsets to efficiently determine the reset reason.
Enumerator
RSTRSN_UNKNOWN 

Unknown Reset reason

RSTRSN_POWER_ON 

Power-on Reset

RSTRSN_BROWNOUT 

Brown-out Reset

RSTRSN_EXTERNAL 

External Pin Reset

RSTRSN_WDR_RESET 

Unknown Watchdog Reset

RSTRSN_SOFTWARE 

Reset command issued by software

RSTRSN_UPDI_RESET 

UPDI or High Voltage Reset

RSTRSN_ERRCH_UNKNOWN 

Unknown Error Controller Channel Reset

RSTRSN_MCHK_UNKNOWN 

Unknown Machine Check Reset

RSTRSN_WDT_OUTSIDE 

Watchdog Reset command issued outside window

RSTRSN_WDT_TIMEOUT 

Watchdog Timer timeout Reset

RSTRSN_ERRCH_VREGFAIL 

VREGFAIL Error Channel Reset

RSTRSN_ERRCH_BUSERR 

BUSERR Error Channel Reset

RSTRSN_ERRCH_RAM2 

RAM2 Error Channel Reset

RSTRSN_ERRCH_FLASH2 

FLASH2 Error Channel Reset

RSTRSN_ERRCH_OPC 

OPC Error Channel Reset

RSTRSN_ERRCH_SPLIM 

SPLIM Error Channel Reset

RSTRSN_ERRCH_RAM1 

RAM1 Error Channel Reset

RSTRSN_ERRCH_FLASH1 

FLASH1 Error Channel Reset

RSTRSN_ERRCH_VREGWARN 

VREGWARN Error Channel Reset

RSTRSN_ERRCH_CFD0 

CFD0 Error Channel Reset

RSTRSN_ERRCH_CFD1 

CFD1 Error Channel Reset

RSTRSN_ERRCH_CFM0 

CFM0 Error Channel Reset

RSTRSN_ERRCH_CFM1 

CFM1 Error Channel Reset

RSTRSN_ERRCH_SWDT 

SWDT Error Channel Reset

RSTRSN_ERRCH_EEPROM 

EEPROM Error Channel Reset

RSTRSN_ERRCH_EVSYS0 

EVSYS0 Error Channel Reset

RSTRSN_ERRCH_EVSYS1 

EVSYS1 Error Channel Reset

RSTRSN_MCHK_OCD 

Illegal On-chip Debugging entry Reset

RSTRSN_MCHK_DFT 

Illegal Test entry Reset

RSTRSN_MCHK_EC 

Internal ERRCTRL error Reset

RSTRSN_MCHK_DCLS 

Dual-core lockstep error Reset

RSTRSN_MCHK_BOOT 

BOOTROM error Reset

RSTRSN_MCHK_WDT 

WDT Clock Failure Monitor Reset

RSTRSN_MCHK_CRC 

BOOTROM CRC error Reset

RSTRSN_MCHK_VREG 

VREG Monitor Reset

RSTRSN_MCHK_CFD 

Clock Failure Detection Reset

RSTRSN_MCHK_UPDI 

Illegal UPDI entry Reset

RSTRSN_MAX 

Reserved/invalid, indicates highest reset reason value

Definition at line 39 of file midware_reset_manager.h.

Function Documentation

◆ MW_GetClearResetReason()

resetReason_t MW_GetClearResetReason ( void )

Reads and clears the reset flag registers.

This function reads and clears reset flags to determine the last device reset reason. This is done by reporting the first found reset flag from MSb to LSb. If the flag indicates a Machine Check Reset, an Error Controller Reset or a Watchdog Timer Reset, the addition cause information of this type of reset is checked and reported.

Warning
If multiple resets have occurred without clearing the flags, the first identified reason is reported and all flags are cleared.
MISRA C:2012 Deviation
Advisory: misra-c2012- 10.5
Justification: This deviation concerns the determination of the device reset reason. The function uses an enum-to-integer conversion to map register bits to enum members of resetReason_t. This deviation enables reduction of execution time, flash usage, and complexity. The mapping is considered safe due to rigorous unit tests that ensure the correctness of the mapping between the register bits and the enum members. Additionally, the safety of this approach is maintained as long as the order of the enum members in resetReason_t is not changed, as documented in the warning above the enum declaration.
Returns
The determined reason for the last device reset.

Definition at line 47 of file midware_reset_manager.c.

◆ MW_ResetDevice()

void MW_ResetDevice ( void )

Issues a software reset request to reset the device.

Note
If this function returns, it means that the device reset failed. It is assumed that this is handled by the calling function.

Definition at line 42 of file midware_reset_manager.c.