EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
em_rmu.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef EM_RMU_H
34 #define EM_RMU_H
35 
36 #include "em_device.h"
37 #if defined(RMU_COUNT) && (RMU_COUNT > 0)
38 #include "em_assert.h"
39 
40 #include <stdbool.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /***************************************************************************/
51 /***************************************************************************/
56 /*******************************************************************************
57  ******************************** ENUMS ************************************
58  ******************************************************************************/
59 
61 typedef enum
62 {
63 #if defined(_RMU_CTRL_PINRMODE_MASK)
64  rmuResetModeDisabled = _RMU_CTRL_PINRMODE_DISABLED,
65  rmuResetModeLimited = _RMU_CTRL_PINRMODE_LIMITED,
66  rmuResetModeExtended = _RMU_CTRL_PINRMODE_EXTENDED,
67  rmuResetModeFull = _RMU_CTRL_PINRMODE_FULL,
68 #else
69  rmuResetModeClear = 0,
70  rmuResetModeSet = 1,
71 #endif
73 
75 typedef enum
76 {
77 #if defined(RMU_CTRL_BURSTEN)
78  rmuResetBU = _RMU_CTRL_BURSTEN_MASK,
79 #endif
80 #if defined(RMU_CTRL_LOCKUPRDIS)
82 #elif defined(_RMU_CTRL_LOCKUPRMODE_MASK)
83  rmuResetLockUp = _RMU_CTRL_LOCKUPRMODE_MASK,
84 #endif
85 #if defined(_RMU_CTRL_WDOGRMODE_MASK)
86  rmuResetWdog = _RMU_CTRL_WDOGRMODE_MASK,
87 #endif
88 #if defined(_RMU_CTRL_LOCKUPRMODE_MASK)
89  rmuResetCoreLockup = _RMU_CTRL_LOCKUPRMODE_MASK,
90 #endif
91 #if defined(_RMU_CTRL_SYSRMODE_MASK)
92  rmuResetSys = _RMU_CTRL_SYSRMODE_MASK,
93 #endif
94 #if defined(_RMU_CTRL_PINRMODE_MASK)
95  rmuResetPin = _RMU_CTRL_PINRMODE_MASK,
96 #endif
98 
99 /*******************************************************************************
100  ***************************** PROTOTYPES **********************************
101  ******************************************************************************/
102 
104 #define RMU_LockupResetDisable(A) RMU_ResetControl(rmuResetLockUp, A)
105 
107 void RMU_ResetCauseClear(void);
108 uint32_t RMU_ResetCauseGet(void);
109 
110 #if defined(_RMU_CTRL_RESETSTATE_MASK)
111 /***************************************************************************/
118 __STATIC_INLINE void RMU_UserResetStateSet(uint32_t userState)
119 {
120  EFM_ASSERT(!(userState
121  & ~(_RMU_CTRL_RESETSTATE_MASK >> _RMU_CTRL_RESETSTATE_SHIFT)));
122  RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_RESETSTATE_MASK)
123  | (userState << _RMU_CTRL_RESETSTATE_SHIFT);
124 }
125 
126 /***************************************************************************/
134 __STATIC_INLINE uint32_t RMU_UserResetStateGet(void)
135 {
136  uint32_t userState = (RMU->CTRL & _RMU_CTRL_RESETSTATE_MASK)
137  >> _RMU_CTRL_RESETSTATE_SHIFT;
138  return userState;
139 }
140 #endif
141 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* defined(RMU_COUNT) && (RMU_COUNT > 0) */
150 #endif /* EM_RMU_H */
uint32_t RMU_ResetCauseGet(void)
Get the cause of the last reset.
Definition: em_rmu.c:291
RMU_Reset_TypeDef
Definition: em_rmu.h:75
Emlib peripheral API "assert" implementation.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define RMU
void RMU_ResetControl(RMU_Reset_TypeDef reset, RMU_ResetMode_TypeDef mode)
Disable/enable reset for various peripherals and signal sources.
Definition: em_rmu.c:222
RMU_ResetMode_TypeDef
Definition: em_rmu.h:61
#define _RMU_CTRL_LOCKUPRDIS_MASK
Definition: efm32g_rmu.h:58
void RMU_ResetCauseClear(void)
Clear the reset cause register.
Definition: em_rmu.c:249