PAN1080 Peripheral API
pan_wwdt.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Panchip Technology Corp. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef __PAN_WWDT_H__
15#define __PAN_WWDT_H__
16
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
28
32typedef enum _WWDT_Prescale
33{
34 WWDT_PRESCALER_1 = (0UL << WWDT_CTL_PSCSEL_Pos),
35 WWDT_PRESCALER_2 = (1UL << WWDT_CTL_PSCSEL_Pos),
36 WWDT_PRESCALER_4 = (2UL << WWDT_CTL_PSCSEL_Pos),
37 WWDT_PRESCALER_8 = (3UL << WWDT_CTL_PSCSEL_Pos),
38 WWDT_PRESCALER_16 = (4UL << WWDT_CTL_PSCSEL_Pos),
39 WWDT_PRESCALER_32 = (5UL << WWDT_CTL_PSCSEL_Pos),
40 WWDT_PRESCALER_64 = (6UL << WWDT_CTL_PSCSEL_Pos),
41 WWDT_PRESCALER_128 = (7UL << WWDT_CTL_PSCSEL_Pos),
42 WWDT_PRESCALER_192 = (8UL << WWDT_CTL_PSCSEL_Pos),
43 WWDT_PRESCALER_256 = (9UL << WWDT_CTL_PSCSEL_Pos),
44 WWDT_PRESCALER_384 = (0xAUL << WWDT_CTL_PSCSEL_Pos),
45 WWDT_PRESCALER_512 = (0xBUL << WWDT_CTL_PSCSEL_Pos),
46 WWDT_PRESCALER_768 = (0xCUL << WWDT_CTL_PSCSEL_Pos),
47 WWDT_PRESCALER_1024 = (0xDUL << WWDT_CTL_PSCSEL_Pos),
48 WWDT_PRESCALER_1536 = (0xEUL << WWDT_CTL_PSCSEL_Pos),
49 WWDT_PRESCALER_2048 = (0xFUL << WWDT_CTL_PSCSEL_Pos)
53#define WWDT_RELOAD_WORD (0x00005AA5)
60__STATIC_INLINE void WWDT_ClearResetFlag(void)
61{
62 WWDT->STATUS = WWDT_STATUS_WWDTRF_Msk;
63}
64
69__STATIC_INLINE void WWDT_ClearIntFlag(void)
70{
71 WWDT->STATUS = WWDT_STATUS_WWDTIF_Msk;
72}
73
78__STATIC_INLINE void WWDT_ClearWWDTFFlag(void)
79{
80 WWDT->STATUS = WWDT_STATUS_WWDTF_Msk;
81}
82
89__STATIC_INLINE bool WWDT_GetResetFlag(void)
90{
91 return (WWDT->STATUS & WWDT_STATUS_WWDTRF_Msk) ? true : false;
92}
93
100__STATIC_INLINE bool WWDT_GetIntFlag(void)
101{
102 return (WWDT->STATUS & WWDT_STATUS_WWDTIF_Msk) ? true : false;
103}
104
111__STATIC_INLINE bool WWDT_GetWWDTFFlag(void)
112{
113 return (WWDT->STATUS & WWDT_STATUS_WWDTF_Msk) ? true : false;
114}
115
120__STATIC_INLINE uint32_t WWDT_GetCounter(void)
121{
122 return WWDT->CNT;
123}
124
129__STATIC_INLINE uint32_t WWDT_GetCompareValue(void)
130{
131 return (WWDT->CTL & WWDT_CTL_CMPDAT_Msk) >> WWDT_CTL_CMPDAT_Pos;
132}
133
141__STATIC_INLINE void WWDT_ReloadCounter(void)
142{
143 WWDT->RLDCNT = WWDT_RELOAD_WORD;
144}
145
170void WWDT_Open(WWDT_PrescaleDef preScale, uint32_t u32CmpValue, uint32_t u32EnableInt);
171
176void WWDT_Close(void);
177
180#ifdef __cplusplus
181}
182#endif
183
184#endif /* __PAN_WWDT_H__ */
185
_WWDT_Prescale
Definition: pan_wwdt.h:33
enum _WWDT_Prescale WWDT_PrescaleDef
@ WWDT_PRESCALER_64
Definition: pan_wwdt.h:40
@ WWDT_PRESCALER_16
Definition: pan_wwdt.h:38
@ WWDT_PRESCALER_32
Definition: pan_wwdt.h:39
@ WWDT_PRESCALER_8
Definition: pan_wwdt.h:37
@ WWDT_PRESCALER_192
Definition: pan_wwdt.h:42
@ WWDT_PRESCALER_512
Definition: pan_wwdt.h:45
@ WWDT_PRESCALER_768
Definition: pan_wwdt.h:46
@ WWDT_PRESCALER_1
Definition: pan_wwdt.h:34
@ WWDT_PRESCALER_384
Definition: pan_wwdt.h:44
@ WWDT_PRESCALER_2
Definition: pan_wwdt.h:35
@ WWDT_PRESCALER_4
Definition: pan_wwdt.h:36
@ WWDT_PRESCALER_256
Definition: pan_wwdt.h:43
@ WWDT_PRESCALER_2048
Definition: pan_wwdt.h:49
@ WWDT_PRESCALER_1024
Definition: pan_wwdt.h:47
@ WWDT_PRESCALER_128
Definition: pan_wwdt.h:41
@ WWDT_PRESCALER_1536
Definition: pan_wwdt.h:48
__STATIC_INLINE uint32_t WWDT_GetCounter(void)
This function to reflects current WWDT counter value.
Definition: pan_wwdt.h:120
void WWDT_Open(WWDT_PrescaleDef preScale, uint32_t u32CmpValue, uint32_t u32EnableInt)
This function make WWDT module start counting with different counter period and compared window value...
__STATIC_INLINE void WWDT_ClearIntFlag(void)
This function clear WWDT compare match interrupt flag.
Definition: pan_wwdt.h:69
#define WWDT_RELOAD_WORD
Definition: pan_wwdt.h:53
void WWDT_Close(void)
This function stops WWDT counting.
__STATIC_INLINE uint32_t WWDT_GetCompareValue(void)
This function reflects current WWDT compare value (CMPDAT)
Definition: pan_wwdt.h:129
__STATIC_INLINE bool WWDT_GetWWDTFFlag(void)
This function is used to indicate WWDT compare match event flag.
Definition: pan_wwdt.h:111
__STATIC_INLINE void WWDT_ClearWWDTFFlag(void)
This function clear WWDT compare match event flag.
Definition: pan_wwdt.h:78
__STATIC_INLINE void WWDT_ReloadCounter(void)
This function is used to reload the WWDT counter value to 0x3F.
Definition: pan_wwdt.h:141
__STATIC_INLINE bool WWDT_GetResetFlag(void)
This function is use to get WWDT time-out reset system flag.
Definition: pan_wwdt.h:89
__STATIC_INLINE void WWDT_ClearResetFlag(void)
This function clear WWDT time-out reset system flag.
Definition: pan_wwdt.h:60
__STATIC_INLINE bool WWDT_GetIntFlag(void)
This function is used to indicate WWDT compare match interrupt flag.
Definition: pan_wwdt.h:100