1 /***************************************************************************//**
\r
3 * @brief Reset Management Unit (RMU) peripheral API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
33 #ifndef __SILICON_LABS_EM_RMU_H__
\r
34 #define __SILICON_LABS_EM_RMU_H__
\r
36 #include "em_device.h"
\r
37 #if defined(RMU_COUNT) && (RMU_COUNT > 0)
\r
38 #include "em_assert.h"
\r
40 #include <stdbool.h>
\r
46 /***************************************************************************//**
\r
47 * @addtogroup EM_Library
\r
49 ******************************************************************************/
\r
51 /***************************************************************************//**
\r
54 ******************************************************************************/
\r
56 /*******************************************************************************
\r
57 ******************************** ENUMS ************************************
\r
58 ******************************************************************************/
\r
60 /** RMU reset modes */
\r
63 #if defined(_RMU_CTRL_PINRMODE_MASK)
\r
64 rmuResetModeDisabled = _RMU_CTRL_PINRMODE_DISABLED,
\r
65 rmuResetModeLimited = _RMU_CTRL_PINRMODE_LIMITED,
\r
66 rmuResetModeExtended = _RMU_CTRL_PINRMODE_EXTENDED,
\r
67 rmuResetModeFull = _RMU_CTRL_PINRMODE_FULL,
\r
69 rmuResetModeClear = 0,
\r
70 rmuResetModeSet = 1,
\r
72 } RMU_ResetMode_TypeDef;
\r
74 /** RMU controlled peripheral reset control and reset source control */
\r
77 #if defined(RMU_CTRL_BURSTEN)
\r
78 rmuResetBU = _RMU_CTRL_BURSTEN_MASK, /**< Reset control over Backup Power domain select */
\r
80 #if defined(RMU_CTRL_LOCKUPRDIS)
\r
81 rmuResetLockUp = _RMU_CTRL_LOCKUPRDIS_MASK, /**< Cortex lockup reset select */
\r
82 #elif defined(_RMU_CTRL_LOCKUPRMODE_MASK)
\r
83 rmuResetLockUp = _RMU_CTRL_LOCKUPRMODE_MASK, /**< Cortex lockup reset select */
\r
85 #if defined(_RMU_CTRL_WDOGRMODE_MASK)
\r
86 rmuResetWdog = _RMU_CTRL_WDOGRMODE_MASK, /**< WDOG reset select */
\r
88 #if defined(_RMU_CTRL_LOCKUPRMODE_MASK)
\r
89 rmuResetCoreLockup = _RMU_CTRL_LOCKUPRMODE_MASK, /**< Cortex lockup reset select */
\r
91 #if defined(_RMU_CTRL_SYSRMODE_MASK)
\r
92 rmuResetSys = _RMU_CTRL_SYSRMODE_MASK, /**< SYSRESET select */
\r
94 #if defined(_RMU_CTRL_PINRMODE_MASK)
\r
95 rmuResetPin = _RMU_CTRL_PINRMODE_MASK, /**< Pin reset select */
\r
97 } RMU_Reset_TypeDef;
\r
99 /*******************************************************************************
\r
100 ***************************** PROTOTYPES **********************************
\r
101 ******************************************************************************/
\r
103 /** RMU_LockupResetDisable kept for backwards compatibility */
\r
104 #define RMU_LockupResetDisable(A) RMU_ResetControl(rmuResetLockUp, A)
\r
106 void RMU_ResetControl(RMU_Reset_TypeDef reset, RMU_ResetMode_TypeDef mode);
\r
107 void RMU_ResetCauseClear(void);
\r
108 uint32_t RMU_ResetCauseGet(void);
\r
110 #if defined(_RMU_CTRL_RESETSTATE_MASK)
\r
111 /***************************************************************************//**
\r
113 * Set user reset state. This state is reset only by a Power-on-reset and a
\r
116 * @param[in] userState User state to set
\r
117 ******************************************************************************/
\r
118 __STATIC_INLINE void RMU_UserResetStateSet(uint32_t userState)
\r
120 EFM_ASSERT(!(userState
\r
121 & ~(_RMU_CTRL_RESETSTATE_MASK >> _RMU_CTRL_RESETSTATE_SHIFT)));
\r
122 RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_RESETSTATE_MASK)
\r
123 | (userState << _RMU_CTRL_RESETSTATE_SHIFT);
\r
126 /***************************************************************************//**
\r
128 * Get user reset state. This state is reset only by a Power-on-reset and a
\r
132 * Reset surviving user state
\r
133 ******************************************************************************/
\r
134 __STATIC_INLINE uint32_t RMU_UserResetStateGet(void)
\r
136 uint32_t userState = (RMU->CTRL & _RMU_CTRL_RESETSTATE_MASK)
\r
137 >> _RMU_CTRL_RESETSTATE_SHIFT;
\r
142 /** @} (end addtogroup RMU) */
\r
143 /** @} (end addtogroup EM_Library) */
\r
149 #endif /* defined(RMU_COUNT) && (RMU_COUNT > 0) */
\r
150 #endif /* __SILICON_LABS_EM_RMU_H__ */
\r