PAN1080 Peripheral API
pan_wdt.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_WDT_H__
15#define __PAN_WDT_H__
16
22#ifdef __cplusplus
23extern "C"
24{
25#endif
26
30typedef enum _WDT_Timeout
31{
32 WDT_TIMEOUT_2POW4 = (0UL << WDT_CTL_TOUTSEL_Pos),
33 WDT_TIMEOUT_2POW6 = (1UL << WDT_CTL_TOUTSEL_Pos),
34 WDT_TIMEOUT_2POW8 = (2UL << WDT_CTL_TOUTSEL_Pos),
35 WDT_TIMEOUT_2POW10 = (3UL << WDT_CTL_TOUTSEL_Pos),
36 WDT_TIMEOUT_2POW12 = (4UL << WDT_CTL_TOUTSEL_Pos),
37 WDT_TIMEOUT_2POW14 = (5UL << WDT_CTL_TOUTSEL_Pos),
38 WDT_TIMEOUT_2POW16 = (6UL << WDT_CTL_TOUTSEL_Pos),
39 WDT_TIMEOUT_2POW18 = (7UL << WDT_CTL_TOUTSEL_Pos)
46typedef enum _WDT_ResetDelay
47{
48 WDT_RESET_DELAY_2CLK = (3UL << WDT_ALTCTL_RSTDSEL_Pos),
49 WDT_RESET_DELAY_17CLK = (2UL << WDT_ALTCTL_RSTDSEL_Pos),
50 WDT_RESET_DELAY_129CLK = (1UL << WDT_ALTCTL_RSTDSEL_Pos),
51 WDT_RESET_DELAY_1025CLK = (0UL << WDT_ALTCTL_RSTDSEL_Pos)
60__STATIC_INLINE void WDT_ClearResetFlag(void)
61{
62 WDT->CTL |= WDT_CTL_RSTF_Msk;
63}
64
69__STATIC_INLINE void WDT_ClearTimeoutFlag(void)
70{
71 WDT->CTL |= WDT_CTL_TOF_Msk;
72}
73
78__STATIC_INLINE void WDT_ClearTimeoutIntFlag(void)
79{
80 WDT->CTL |= WDT_CTL_IF_Msk;
81}
82
87__STATIC_INLINE void WDT_ClearTimeoutWakeupFlag(void)
88{
89 WDT->CTL |= WDT_CTL_WKF_Msk;
90}
91
98__STATIC_INLINE bool WDT_GetResetFlag(void)
99{
100 return (WDT->CTL & WDT_CTL_RSTF_Msk) ? true : false;
101}
102
109__STATIC_INLINE bool WDT_GetTimeoutFlag(void)
110{
111 return (WDT->CTL & WDT_CTL_TOF_Msk) ? true : false;
112}
113
120__STATIC_INLINE bool WDT_GetTimeoutIntFlag(void)
121{
122 return (WDT->CTL & WDT_CTL_IF_Msk) ? true : false;
123}
124
131__STATIC_INLINE bool WDT_GetTimeoutWakeupFlag(void)
132{
133 return (WDT->CTL & WDT_CTL_WKF_Msk) ? true : false;
134}
135
142__STATIC_INLINE void WDT_ResetCounter(void)
143{
144 WDT->CTL |= WDT_CTL_RSTCNT_Msk;
145}
146
174void WDT_Open(WDT_TimeoutDef u32TimeoutInterval,
175 WDT_ResetDelayDef u32ResetDelay,
176 uint32_t u32EnableReset,
177 uint32_t u32EnableWakeup);
178
183void WDT_Close(void);
184
189void WDT_EnableInt(void);
190
195void WDT_DisableInt(void);
196
197
200#ifdef __cplusplus
201}
202#endif
203
204#endif /* __PAN_WDT_H__ */
_WDT_ResetDelay
Definition: pan_wdt.h:47
enum _WDT_ResetDelay WDT_ResetDelayDef
@ WDT_RESET_DELAY_17CLK
Definition: pan_wdt.h:49
@ WDT_RESET_DELAY_2CLK
Definition: pan_wdt.h:48
@ WDT_RESET_DELAY_1025CLK
Definition: pan_wdt.h:51
@ WDT_RESET_DELAY_129CLK
Definition: pan_wdt.h:50
enum _WDT_Timeout WDT_TimeoutDef
_WDT_Timeout
Definition: pan_wdt.h:31
@ WDT_TIMEOUT_2POW6
Definition: pan_wdt.h:33
@ WDT_TIMEOUT_2POW10
Definition: pan_wdt.h:35
@ WDT_TIMEOUT_2POW16
Definition: pan_wdt.h:38
@ WDT_TIMEOUT_2POW4
Definition: pan_wdt.h:32
@ WDT_TIMEOUT_2POW18
Definition: pan_wdt.h:39
@ WDT_TIMEOUT_2POW12
Definition: pan_wdt.h:36
@ WDT_TIMEOUT_2POW14
Definition: pan_wdt.h:37
@ WDT_TIMEOUT_2POW8
Definition: pan_wdt.h:34
__STATIC_INLINE void WDT_ClearTimeoutWakeupFlag(void)
This function clear WDT time-out wake-up system flag.
Definition: pan_wdt.h:87
__STATIC_INLINE void WDT_ClearTimeoutIntFlag(void)
This function clear WDT time-out interrupt flag.
Definition: pan_wdt.h:78
__STATIC_INLINE bool WDT_GetTimeoutWakeupFlag(void)
This function indicate WDT time-out waked system up or not.
Definition: pan_wdt.h:131
__STATIC_INLINE void WDT_ClearTimeoutFlag(void)
This function clear WDT time-out flag.
Definition: pan_wdt.h:69
void WDT_Close(void)
This function stops WDT counting and disable WDT module.
void WDT_DisableInt(void)
This function disables the WDT time-out interrupt.
__STATIC_INLINE void WDT_ClearResetFlag(void)
This function clear WDT time-out reset system flag.
Definition: pan_wdt.h:60
__STATIC_INLINE bool WDT_GetTimeoutIntFlag(void)
This function indicate WDT time-out interrupt occurred or not.
Definition: pan_wdt.h:120
void WDT_Open(WDT_TimeoutDef u32TimeoutInterval, WDT_ResetDelayDef u32ResetDelay, uint32_t u32EnableReset, uint32_t u32EnableWakeup)
This function make WDT module start counting with different time-out interval.
__STATIC_INLINE bool WDT_GetTimeoutFlag(void)
This function indicate WDT time-out evnet occurred or not.
Definition: pan_wdt.h:109
void WDT_EnableInt(void)
This function enables the WDT time-out interrupt.
__STATIC_INLINE bool WDT_GetResetFlag(void)
This function indicate WDT time-out to reset system or not.
Definition: pan_wdt.h:98
__STATIC_INLINE void WDT_ResetCounter(void)
This function is used to reset 18-bit WDT counter.
Definition: pan_wdt.h:142