G32R430 Device Driver Layer v1.0.4
G32R4xx Device Driver Layer API Reference
g32r4xx_ddl_wwdt.h
Go to the documentation of this file.
1
42
43/* Define to prevent recursive inclusion -------------------------------------*/
44#ifndef G32R4xx_DDL_WWDT_H
45#define G32R4xx_DDL_WWDT_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* Includes ------------------------------------------------------------------*/
52#include "g32r4xx.h"
53
57
58#if defined (WWDT)
59
63
64/* Private types -------------------------------------------------------------*/
65/* Private variables ---------------------------------------------------------*/
66/* Private constants ---------------------------------------------------------*/
67/* Private macros ------------------------------------------------------------*/
68/* Exported types ------------------------------------------------------------*/
69/* Exported constants --------------------------------------------------------*/
73
78#define DDL_WWDT_CFG_EWIEN WWDT_CFG_EWIEN
82
86#define DDL_WWDT_PRESCALER_1 0x00000000u
87#define DDL_WWDT_PRESCALER_2 WWDT_CFG_TBPSC_0
88#define DDL_WWDT_PRESCALER_4 WWDT_CFG_TBPSC_1
89#define DDL_WWDT_PRESCALER_8 (WWDT_CFG_TBPSC_0 | WWDT_CFG_TBPSC_1)
93
97
98/* Exported macro ------------------------------------------------------------*/
112#define DDL_WWDT_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
113
120#define DDL_WWDT_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
124
128
129/* Exported functions --------------------------------------------------------*/
133
146__STATIC_INLINE void DDL_WWDT_Enable(WWDT_TypeDef *WWDTx)
147{
148 SET_BIT(WWDTx->CTRL, WWDT_CTRL_WWDTEN);
149}
150
156__STATIC_INLINE uint32_t DDL_WWDT_IsEnabled(WWDT_TypeDef *WWDTx)
157{
158 return ((READ_BIT(WWDTx->CTRL, WWDT_CTRL_WWDTEN) == (WWDT_CTRL_WWDTEN)) ? 1UL : 0UL);
159}
160
171__STATIC_INLINE void DDL_WWDT_SetCounter(WWDT_TypeDef *WWDTx, uint32_t Counter)
172{
173 MODIFY_REG(WWDTx->CTRL, WWDT_CTRL_CNT, Counter);
174}
175
181__STATIC_INLINE uint32_t DDL_WWDT_GetCounter(WWDT_TypeDef *WWDTx)
182{
183 return (READ_BIT(WWDTx->CTRL, WWDT_CTRL_CNT));
184}
185
198__STATIC_INLINE void DDL_WWDT_SetPrescaler(WWDT_TypeDef *WWDTx, uint32_t Prescaler)
199{
200 MODIFY_REG(WWDTx->CFG, WWDT_CFG_TBPSC, Prescaler);
201}
202
212__STATIC_INLINE uint32_t DDL_WWDT_GetPrescaler(WWDT_TypeDef *WWDTx)
213{
214 return (READ_BIT(WWDTx->CFG, WWDT_CFG_TBPSC));
215}
216
232__STATIC_INLINE void DDL_WWDT_SetWindow(WWDT_TypeDef *WWDTx, uint32_t Window)
233{
234 MODIFY_REG(WWDTx->CFG, WWDT_CFG_WIN, Window);
235}
236
242__STATIC_INLINE uint32_t DDL_WWDT_GetWindow(WWDT_TypeDef *WWDTx)
243{
244 return (READ_BIT(WWDTx->CFG, WWDT_CFG_WIN));
245}
246
250
262__STATIC_INLINE uint32_t DDL_WWDT_IsActiveFlag_EWKUP(WWDT_TypeDef *WWDTx)
263{
264 return ((READ_BIT(WWDTx->STS, WWDT_STS_EWIFLG) == (WWDT_STS_EWIFLG)) ? 1UL : 0UL);
265}
266
272__STATIC_INLINE void DDL_WWDT_ClearFlag_EWKUP(WWDT_TypeDef *WWDTx)
273{
274 WRITE_REG(WWDTx->STS, ~WWDT_STS_EWIFLG);
275}
276
280
291__STATIC_INLINE void DDL_WWDT_EnableIT_EWKUP(WWDT_TypeDef *WWDTx)
292{
293 SET_BIT(WWDTx->CFG, WWDT_CFG_EWIEN);
294}
295
301__STATIC_INLINE uint32_t DDL_WWDT_IsEnabledIT_EWKUP(WWDT_TypeDef *WWDTx)
302{
303 return ((READ_BIT(WWDTx->CFG, WWDT_CFG_EWIEN) == (WWDT_CFG_EWIEN)) ? 1UL : 0UL);
304}
305
309
313
317
318#endif /* WWDT */
319
323
324#ifdef __cplusplus
325}
326#endif
327
328#endif /* G32R4xx_DDL_WWDT_H */
329
__STATIC_INLINE void DDL_WWDT_SetWindow(WWDT_TypeDef *WWDTx, uint32_t Window)
Set the Watchdog Window value to be compared to the downcounter (7-bits W[6:0]).
__STATIC_INLINE uint32_t DDL_WWDT_GetWindow(WWDT_TypeDef *WWDTx)
Return current Watchdog Window Value (7 bits value).
__STATIC_INLINE uint32_t DDL_WWDT_GetPrescaler(WWDT_TypeDef *WWDTx)
Return current Watchdog Prescaler Value.
__STATIC_INLINE void DDL_WWDT_Enable(WWDT_TypeDef *WWDTx)
Enable Window Watchdog. The watchdog is always disabled after a reset.
__STATIC_INLINE void DDL_WWDT_SetCounter(WWDT_TypeDef *WWDTx, uint32_t Counter)
Set the Watchdog counter value to provided value (7-bits T[6:0]).
__STATIC_INLINE void DDL_WWDT_SetPrescaler(WWDT_TypeDef *WWDTx, uint32_t Prescaler)
Set the time base of the prescaler (WDGTB).
__STATIC_INLINE uint32_t DDL_WWDT_GetCounter(WWDT_TypeDef *WWDTx)
Return current Watchdog Counter Value (7 bits counter value).
__STATIC_INLINE uint32_t DDL_WWDT_IsEnabled(WWDT_TypeDef *WWDTx)
Checks if Window Watchdog is enabled.
__STATIC_INLINE uint32_t DDL_WWDT_IsActiveFlag_EWKUP(WWDT_TypeDef *WWDTx)
Indicates if the WWDT Early Wakeup Interrupt Flag is set or not.
__STATIC_INLINE void DDL_WWDT_ClearFlag_EWKUP(WWDT_TypeDef *WWDTx)
Clear WWDT Early Wakeup Interrupt Flag (EWIF).
__STATIC_INLINE void DDL_WWDT_EnableIT_EWKUP(WWDT_TypeDef *WWDTx)
Enable the Early Wakeup Interrupt.
__STATIC_INLINE uint32_t DDL_WWDT_IsEnabledIT_EWKUP(WWDT_TypeDef *WWDTx)
Check if Early Wakeup Interrupt is enabled.