RTEMS 6.1-rc6
Loading...
Searching...
No Matches
stm32h7xx_ll_iwdg.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_LL_IWDG_H
21#define STM32H7xx_LL_IWDG_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx.h"
29
34#if defined(IWDG1) || defined(IWDG2)
35
41/* Private types -------------------------------------------------------------*/
42/* Private variables ---------------------------------------------------------*/
43
44/* Private constants ---------------------------------------------------------*/
49#define LL_IWDG_KEY_RELOAD 0x0000AAAAU
50#define LL_IWDG_KEY_ENABLE 0x0000CCCCU
51#define LL_IWDG_KEY_WR_ACCESS_ENABLE 0x00005555U
52#define LL_IWDG_KEY_WR_ACCESS_DISABLE 0x00000000U
57/* Private macros ------------------------------------------------------------*/
58
59/* Exported types ------------------------------------------------------------*/
60/* Exported constants --------------------------------------------------------*/
71#define LL_IWDG_SR_PVU IWDG_SR_PVU
72#define LL_IWDG_SR_RVU IWDG_SR_RVU
73#define LL_IWDG_SR_WVU IWDG_SR_WVU
82#define LL_IWDG_PRESCALER_4 0x00000000U
83#define LL_IWDG_PRESCALER_8 (IWDG_PR_PR_0)
84#define LL_IWDG_PRESCALER_16 (IWDG_PR_PR_1)
85#define LL_IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0)
86#define LL_IWDG_PRESCALER_64 (IWDG_PR_PR_2)
87#define LL_IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0)
88#define LL_IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1)
97/* Exported macro ------------------------------------------------------------*/
115#define LL_IWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
116
123#define LL_IWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
133/* Exported functions --------------------------------------------------------*/
150__STATIC_INLINE void LL_IWDG_Enable(IWDG_TypeDef *IWDGx)
151{
152 WRITE_REG(IWDGx->KR, LL_IWDG_KEY_ENABLE);
153}
154
161__STATIC_INLINE void LL_IWDG_ReloadCounter(IWDG_TypeDef *IWDGx)
162{
163 WRITE_REG(IWDGx->KR, LL_IWDG_KEY_RELOAD);
164}
165
172__STATIC_INLINE void LL_IWDG_EnableWriteAccess(IWDG_TypeDef *IWDGx)
173{
174 WRITE_REG(IWDGx->KR, LL_IWDG_KEY_WR_ACCESS_ENABLE);
175}
176
183__STATIC_INLINE void LL_IWDG_DisableWriteAccess(IWDG_TypeDef *IWDGx)
184{
185 WRITE_REG(IWDGx->KR, LL_IWDG_KEY_WR_ACCESS_DISABLE);
186}
187
202__STATIC_INLINE void LL_IWDG_SetPrescaler(IWDG_TypeDef *IWDGx, uint32_t Prescaler)
203{
204 WRITE_REG(IWDGx->PR, IWDG_PR_PR & Prescaler);
205}
206
220__STATIC_INLINE uint32_t LL_IWDG_GetPrescaler(IWDG_TypeDef *IWDGx)
221{
222 return (READ_REG(IWDGx->PR));
223}
224
232__STATIC_INLINE void LL_IWDG_SetReloadCounter(IWDG_TypeDef *IWDGx, uint32_t Counter)
233{
234 WRITE_REG(IWDGx->RLR, IWDG_RLR_RL & Counter);
235}
236
243__STATIC_INLINE uint32_t LL_IWDG_GetReloadCounter(IWDG_TypeDef *IWDGx)
244{
245 return (READ_REG(IWDGx->RLR));
246}
247
255__STATIC_INLINE void LL_IWDG_SetWindow(IWDG_TypeDef *IWDGx, uint32_t Window)
256{
257 WRITE_REG(IWDGx->WINR, IWDG_WINR_WIN & Window);
258}
259
266__STATIC_INLINE uint32_t LL_IWDG_GetWindow(IWDG_TypeDef *IWDGx)
267{
268 return (READ_REG(IWDGx->WINR));
269}
270
286__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_PVU(IWDG_TypeDef *IWDGx)
287{
288 return ((READ_BIT(IWDGx->SR, IWDG_SR_PVU) == (IWDG_SR_PVU)) ? 1UL : 0UL);
289}
290
297__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_RVU(IWDG_TypeDef *IWDGx)
298{
299 return ((READ_BIT(IWDGx->SR, IWDG_SR_RVU) == (IWDG_SR_RVU)) ? 1UL : 0UL);
300}
301
308__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_WVU(IWDG_TypeDef *IWDGx)
309{
310 return ((READ_BIT(IWDGx->SR, IWDG_SR_WVU) == (IWDG_SR_WVU)) ? 1UL : 0UL);
311}
312
321__STATIC_INLINE uint32_t LL_IWDG_IsReady(IWDG_TypeDef *IWDGx)
322{
323 return ((READ_BIT(IWDGx->SR, IWDG_SR_PVU | IWDG_SR_RVU | IWDG_SR_WVU) == 0U) ? 1UL : 0UL);
324}
325
338#endif /* IWDG1 || IWDG2 */
339
344#ifdef __cplusplus
345}
346#endif
347
348#endif /* STM32H7xx_LL_IWDG_H */
#define IWDG_SR_PVU
Definition: stm32h723xx.h:13250
#define IWDG_PR_PR
Definition: stm32h723xx.h:13237
#define IWDG_RLR_RL
Definition: stm32h723xx.h:13245
#define IWDG_WINR_WIN
Definition: stm32h723xx.h:13261
#define IWDG_SR_WVU
Definition: stm32h723xx.h:13256
#define IWDG_SR_RVU
Definition: stm32h723xx.h:13253
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
Independent WATCHDOG.
Definition: stm32h723xx.h:1152
__IO uint32_t PR
Definition: stm32h723xx.h:1154
__IO uint32_t KR
Definition: stm32h723xx.h:1153
__IO uint32_t WINR
Definition: stm32h723xx.h:1157
__IO uint32_t SR
Definition: stm32h723xx.h:1156
__IO uint32_t RLR
Definition: stm32h723xx.h:1155