Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
wdt_sfrs.h
Go to the documentation of this file.
1 
12 #ifndef __WDT_SFRS_H__
13 #define __WDT_SFRS_H__
14 
18 typedef struct {
19  union {
20  struct {
21  uint8_t WDTEN:1;
22  uint8_t RESETEN:1;
23  uint8_t RSTFLAG:1;
24  uint8_t WDTPRES:2;
25  uint8_t Reserved:3;
26  };
27  uint8_t BYTE;
28  } WDTCTRL;
29  uint8_t Reserved[3];
30  uint32_t WDTCLR;
31 } WDT_SFRS_t;
32 
36 #define WDT_SFRS ((__IO WDT_SFRS_t *) (0x50020018))
37 
38 #define WDT_PRES_2PWR13 0
39 #define WDT_PRES_2PWR19 1
40 #define WDT_PRES_2PWR22 2
41 #define WDT_PRES_2PWR32 3
42 
46 static __INLINE void f_WDT_Enable(void)
47 {
48  WDT_SFRS->WDTCTRL.WDTEN = 1;
49 }
50 
54 static __INLINE void f_WDT_Disable(void)
55 {
56  WDT_SFRS->WDTCTRL.WDTEN = 0;
57 }
58 
62 static __INLINE void f_WDT_ResetEnable(void)
63 {
64  WDT_SFRS->WDTCTRL.RESETEN = 1;
65 }
66 
70 static __INLINE void f_WDT_ResetDisable(void)
71 {
72  WDT_SFRS->WDTCTRL.RESETEN = 0;
73 }
74 
80 static __INLINE void f_WDT_SetPrescaler(uint8_t val)
81 {
82  WDT_SFRS->WDTCTRL.WDTPRES = val;
83 }
84 
88 static __INLINE void f_WDT_Clear(void)
89 {
90  WDT_SFRS->WDTCLR = 0x3C570001;
91  WDT_SFRS->WDTCLR = 0x007F4AD6;
92 }
93 
99 static __INLINE uint8_t f_WDT_IsReset(void)
100 {
101  return WDT_SFRS->WDTCTRL.RSTFLAG;
102 }
103 
104 #endif /* __WDT_SFRS_H__ */
static __INLINE void f_WDT_Disable(void)
Disable watchdog timer.
Definition: wdt_sfrs.h:54
uint8_t BYTE
Definition: wdt_sfrs.h:27
static __INLINE void f_WDT_ResetEnable(void)
Enable watchdog timer reset.
Definition: wdt_sfrs.h:62
static __INLINE void f_WDT_ResetDisable(void)
Disable watchdog timer reset.
Definition: wdt_sfrs.h:70
static __INLINE uint8_t f_WDT_IsReset(void)
Check if watchdog timer reset occurred.
Definition: wdt_sfrs.h:99
uint32_t WDTCLR
Definition: wdt_sfrs.h:30
static __INLINE void f_WDT_Clear(void)
Clear watchdog timer.
Definition: wdt_sfrs.h:88
static __INLINE void f_WDT_Enable(void)
Enable watchdog timer.
Definition: wdt_sfrs.h:46
static __INLINE void f_WDT_SetPrescaler(uint8_t val)
Select watchdog timer clock pre-scaler.
Definition: wdt_sfrs.h:80
#define WDT_SFRS
The starting address of WDT SFRS.
Definition: wdt_sfrs.h:36
A structure to represent Special Function Registers for WDT.
Definition: wdt_sfrs.h:18