Document API IEC60730 Library
|
Go to the documentation of this file.
18 #ifndef SL_IEC60730_WATCHDOG_H
19 #define SL_IEC60730_WATCHDOG_H
131 #define SL_IEC60730_WDOGINST_NUMB 1
134 #if ((SL_IEC60730_WDOG0_ENABLE == 1) && (SL_IEC60730_WDOG1_ENABLE == 1))
135 #define SL_IEC60730_WDOGINST_NUMB 2
136 #elif ((SL_IEC60730_WDOG0_ENABLE == 0) && (SL_IEC60730_WDOG1_ENABLE == 0))
137 #warning No watchdogs have been selected for testing!
138 #define SL_IEC60730_WDOGINST_NUMB 0
140 #define SL_IEC60730_WDOGINST_NUMB 1
145 #ifndef SL_IEC60730_WDOG_WAIT_TIMEOUT
146 #define SL_IEC60730_WDOG_WAIT_TIMEOUT (uint32_t) 0x0000FFFFUL
150 #define SL_IEC60730_WDOG_INST(n) WDOG##n
154 #define SL_IEC60730_RST RMU
157 #define SL_IEC60730_RSTCAUSE_POR RMU_RSTCAUSE_PORST
160 #define SL_IEC60730_RSTCAUSE_EM4 RMU_RSTCAUSE_EM4RST
163 #define SL_IEC60730_RSTCAUSE_WDOG0 RMU_RSTCAUSE_WDOGRST
166 #define SL_IEC60730_RSTCAUSE_WDOG1 RMU_RSTCAUSE_WDOGRST
169 #define SL_IEC60730_RSTCAUSES_CLEAR()
172 #define SL_IEC60730_RSTCAUSE (SL_IEC60730_RST->RSTCAUSE)
175 #ifndef SL_IEC60730_WDOG_INST
176 #if (_SILICON_LABS_32B_SERIES == 2)
177 #if ((defined SL_IEC60730_NON_SECURE_ENABLE) && (!defined(SL_TRUSTZONE_SECURE)))
178 #define SL_IEC60730_WDOG_INST(n) WDOG##n##_NS
180 #define SL_IEC60730_WDOG_INST(n) WDOG##n
182 #else // Series 1 devices
183 #define SL_IEC60730_WDOG_INST(n) WDOG##n
184 #endif //(_SILICON_LABS_32B_SERIES == 2)
187 #if (_SILICON_LABS_32B_SERIES < 2)
188 #ifndef SL_IEC60730_RST
189 #define SL_IEC60730_RST RMU
192 #define SL_IEC60730_RSTCAUSE_POR RMU_RSTCAUSE_PORST
193 #define SL_IEC60730_RSTCAUSE_EM4 RMU_RSTCAUSE_EM4RST
194 #define SL_IEC60730_RSTCAUSE_WDOG0 RMU_RSTCAUSE_WDOGRST
195 #define SL_IEC60730_RSTCAUSE_WDOG1 RMU_RSTCAUSE_WDOGRST
197 #ifndef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
198 #define SL_IEC60730_RSTCAUSES_CLEAR() \
200 SL_IEC60730_RST->CMD |= RMU_CMD_RCCLR; \
203 #define SL_IEC60730_RSTCAUSES_CLEAR() unit_test_iec60730_watchdog_mock_rstcause_clear()
204 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
205 #else // Series 2 devices
206 #ifndef SL_IEC60730_RST
207 #if ((defined SL_IEC60730_NON_SECURE_ENABLE) && (!defined(SL_TRUSTZONE_SECURE)))
208 #define SL_IEC60730_RST EMU_NS
210 #define SL_IEC60730_RST EMU
214 #define SL_IEC60730_RSTCAUSE_POR EMU_RSTCAUSE_POR
215 #define SL_IEC60730_RSTCAUSE_EM4 EMU_RSTCAUSE_EM4
216 #define SL_IEC60730_RSTCAUSE_WDOG0 EMU_RSTCAUSE_WDOG0
217 #define SL_IEC60730_RSTCAUSE_WDOG1 EMU_RSTCAUSE_WDOG1
219 #ifndef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
220 #ifdef WDOG_HAS_SET_CLEAR
221 #define SL_IEC60730_RSTCAUSES_CLEAR() \
223 SL_IEC60730_RST->CMD_SET = EMU_CMD_RSTCAUSECLR; \
226 #define SL_IEC60730_RSTCAUSES_CLEAR() \
228 SL_IEC60730_RST->CMD |= EMU_CMD_RSTCAUSECLR; \
230 #endif // WDOG_HAS_SET_CLEAR
232 #define SL_IEC60730_RSTCAUSES_CLEAR() unit_test_iec60730_watchdog_mock_rstcause_clear()
233 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
234 #endif // (_SILICON_LABS_32B_SERIES < 2)
237 #ifndef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
238 #define SL_IEC60730_RSTCAUSE (SL_IEC60730_RST->RSTCAUSE)
240 #define SL_IEC60730_RSTCAUSE unit_test_iec60730_watchdog_mock_rstcause()
241 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
243 #ifndef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
244 #define SL_IEC60730_RST_POR (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_POR)
245 #define SL_IEC60730_RST_EM4 (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_EM4)
247 #define SL_IEC60730_RST_POR unit_test_iec60730_watchdog_mock_rst_por()
248 #define SL_IEC60730_RST_EM4 unit_test_iec60730_watchdog_mock_rst_em4()
249 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
253 #define SL_IEC60730_RST_WDOG0 (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_WDOG0)
254 #define SL_IEC60730_RST_WDOG1 (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_WDOG1)
257 #ifndef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
258 #if (SL_IEC60730_WDOG0_ENABLE == 1)
259 #define SL_IEC60730_RST_WDOG0 (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_WDOG0)
261 #define SL_IEC60730_RST_WDOG0 0
262 #endif // (SL_IEC60730_WDOG0_ENABLE == 1)
263 #if (SL_IEC60730_WDOG1_ENABLE == 1)
264 #define SL_IEC60730_RST_WDOG1 (SL_IEC60730_RSTCAUSE & SL_IEC60730_RSTCAUSE_WDOG1)
266 #define SL_IEC60730_RST_WDOG1 0
267 #endif // (SL_IEC60730_WDOG1_ENABLE == 1)
269 #if (SL_IEC60730_WDOG0_ENABLE == 1)
270 #define SL_IEC60730_RST_WDOG0 unit_test_iec60730_watchdog_mock_rst_wdog0()
272 #define SL_IEC60730_RST_WDOG0 0
273 #endif // (SL_IEC60730_WDOG0_ENABLE == 1)
274 #if (SL_IEC60730_WDOG1_ENABLE == 1)
275 #define SL_IEC60730_RST_WDOG1 unit_test_iec60730_watchdog_mock_rst_wdog1()
277 #define SL_IEC60730_RST_WDOG1 0
278 #endif // (SL_IEC60730_WDOG1_ENABLE == 1)
279 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
282 #define SL_IEC60730_RST_WDOGS (SL_IEC60730_RST_WDOG0 || SL_IEC60730_RST_WDOG1)
284 #ifndef SL_IEC60730_BURAM
285 #if (_SILICON_LABS_32B_SERIES == 2)
286 #if ((defined SL_IEC60730_NON_SECURE_ENABLE) && (!defined(SL_TRUSTZONE_SECURE)))
287 #define SL_IEC60730_BURAM BURAM_NS
289 #define SL_IEC60730_BURAM BURAM
291 #endif // (_SILICON_LABS_32B_SERIES == 2)
295 #ifndef SL_IEC60730_BURAM_IDX
296 #define SL_IEC60730_BURAM_IDX 0UL
308 #ifdef UNIT_TEST_IEC60730_WATCHDOG_ENABLE
315 void sl_iec60730_watchdog_count_reset(
void);
323 void sl_iec60730_watchdog_count_set(uint8_t count);
325 #endif // UNIT_TEST_IEC60730_WATCHDOG_ENABLE
@ SL_IEC60730_WATCHDOG_INVALID
Watchdog POST test not done.
Definition: sl_iec60730_watchdog.h:125
sl_iec60730_test_watchdog_t
State of watchdog testing.
Definition: sl_iec60730_watchdog.h:124
Watchdog component configuration structure.
Definition: sl_iec60730_watchdog.h:118
WDOG_TypeDef *const SL_WDOG
Pointer to Watchdog instance.
Definition: sl_iec60730_watchdog.h:119
@ SL_IEC60730_WATCHDOG_TESTING
Watchdog POST testing in progress.
Definition: sl_iec60730_watchdog.h:126
sl_iec60730_test_result_t sl_iec60730_watchdog_post(void)
uint32_t rst
Watchdog reset cause value.
Definition: sl_iec60730_watchdog.h:120
sl_iec60730_test_result_t
The result of a test.
Definition: sl_iec60730.h:72
@ SL_IEC60730_WATCHDOG_VALID
Watchdog POST test complete, watchdog valid.
Definition: sl_iec60730_watchdog.h:127
volatile sl_iec60730_test_watchdog_t iec60730_watchdog_state