PDK API Guide for J721E
wd_timer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
53 #ifndef WD_TIMER_H_
54 #define WD_TIMER_H_
55 
56 /* ========================================================================== */
57 /* Include Files */
58 /* ========================================================================== */
59 #include <ti/csl/hw_types.h>
60 #include <ti/csl/cslr_wd_timer.h>
61 #include <stdint.h>
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /* ========================================================================== */
68 /* Macros & Typedefs */
69 /* ========================================================================== */
74 /* \brief Divide functional clock by 1 */
75 #define WD_TIMER_PRESCALER_CLK_DIV_1 (uint32_t) (0x00000000U)
76 
77 /* \brief Divide functional clock by 2 */
78 #define WD_TIMER_PRESCALER_CLK_DIV_2 (uint32_t) (0x00000004U)
79 
80 /* \brief Divide functional clock by 4 */
81 #define WD_TIMER_PRESCALER_CLK_DIV_4 (uint32_t) (0x00000008U)
82 
83 /* \brief Divide functional clock by 8 */
84 #define WD_TIMER_PRESCALER_CLK_DIV_8 (uint32_t) (0x0000000CU)
85 
86 /* \brief Divide functional clock by 16 */
87 #define WD_TIMER_PRESCALER_CLK_DIV_16 (uint32_t) (0x00000010U)
88 
89 /* \brief Divide functional clock by 32 */
90 #define WD_TIMER_PRESCALER_CLK_DIV_32 (uint32_t) (0x00000014U)
91 
92 /* \brief Divide functional clock by 64 */
93 #define WD_TIMER_PRESCALER_CLK_DIV_64 (uint32_t) (0x00000018U)
94 
95 /* \brief Divide functional clock by 128 */
96 #define WD_TIMER_PRESCALER_CLK_DIV_128 (uint32_t) (0x0000001CU)
97 /* @} */
98 
104 /* \brief Watchdog delay interrupt */
105 #define WD_TIMER_INT_DELAY (WD_TIMER_WIRQSTATRAW_EVENT_DLY_MASK)
106 
107 /* \brief Watchdog overflow interrupt */
108 #define WD_TIMER_INT_OVERFLOW (WD_TIMER_WIRQSTATRAW_EVENT_OVF_MASK)
109 
110 /* \brief Watchdog all interrupts */
111 #define WD_TIMER_INT_ALL (WD_TIMER_INT_DELAY | \
112  WD_TIMER_INT_OVERFLOW)
113 /* @} */
114 
119 /* \brief Enable delay interrupt */
120 #define WD_TIMER_INT_ENABLE_DELAY (WD_TIMER_WIRQENSET_ENABLE_DLY_MASK)
121 
122 /* \brief Enable overflow interrupt */
123 #define WD_TIMER_INT_ENABLE_OVRFLW (WD_TIMER_WIRQENSET_ENABLE_OVF_MASK)
124 
125 /* \brief Enable all interrupts */
126 #define WD_TIMER_INT_ENABLE_ALL (WD_TIMER_INT_ENABLE_DELAY | \
127  WD_TIMER_INT_ENABLE_OVRFLW)
128 /* @} */
129 
134 /* \brief Disable delay interrupt */
135 #define WD_TIMER_INT_DISABLE_DELAY (WD_TIMER_WIRQENCLR_ENABLE_DLY_MASK)
136 
137 /* \brief Disable overflow interrupt */
138 #define WD_TIMER_INT_DISABLE_OVRFLW (WD_TIMER_WIRQENCLR_ENABLE_OVF_MASK)
139 
140 /* \brief Disable all interrupts */
141 #define WD_TIMER_INT_DISABLE_ALL (WD_TIMER_INT_DISABLE_DELAY | \
142  WD_TIMER_INT_DISABLE_OVRFLW)
143 /* @} */
144 
149 /* \brief Write pending for register WD_TIMER_WCLR */
150 #define WD_TIMER_WRITE_PENDING_WCLR \
151  ((uint32_t) WD_TIMER_WWPS_W_PEND_WCLR_MASK)
152 
153 /* \brief Write pending for register WD_TIMER_WCRR */
154 #define WD_TIMER_WRITE_PENDING_WCRR \
155  ((uint32_t) WD_TIMER_WWPS_W_PEND_WCRR_MASK)
156 
157 /* \brief Write pending for register WD_TIMER_WLDR */
158 #define WD_TIMER_WRITE_PENDING_WLDR \
159  ((uint32_t) WD_TIMER_WWPS_W_PEND_WLDR_MASK)
160 
161 /* \brief Write pending for register WD_TIMER_WTGR */
162 #define WD_TIMER_WRITE_PENDING_WTGR \
163  ((uint32_t) WD_TIMER_WWPS_W_PEND_WTGR_MASK)
164 
165 /* \brief Write pending for register WD_TIMER_WSPR */
166 #define WD_TIMER_WRITE_PENDING_WSPR \
167  ((uint32_t) WD_TIMER_WWPS_W_PEND_WSPR_MASK)
168 
169 /* \brief Write pending for register WD_TIMER_WDLY */
170 #define WD_TIMER_WRITE_PENDING_WDLY \
171  ((uint32_t) WD_TIMER_WWPS_W_PEND_WDLY_MASK)
172 /* @} */
173 
174 /* ========================================================================== */
175 /* Global Variables */
176 /* ========================================================================== */
177 /* None */
178 
179 /* ========================================================================== */
180 /* Function Declarations */
181 /* ========================================================================== */
190 void WDTIMEREnable(uint32_t baseAddr);
191 
200 void WDTIMERDisable(uint32_t baseAddr);
201 
210 uint32_t WDTIMERRevisionIDGet(uint32_t baseAddr);
211 
220 void WDTIMERReset(uint32_t baseAddr);
221 
241 void WDTIMERPreScalerClkEnable(uint32_t baseAddr, uint32_t ptv);
242 
251 void WDTIMERPreScalerClkDisable(uint32_t baseAddr);
252 
262 void WDTIMERCounterSet(uint32_t baseAddr, uint32_t countVal);
263 
273 uint32_t WDTIMERCounterGet(uint32_t baseAddr);
274 
286 void WDTIMERReloadSet(uint32_t baseAddr, uint32_t reloadVal);
287 
296 uint32_t WDTIMERReloadGet(uint32_t baseAddr);
297 
313 void WDTIMERTriggerSet(uint32_t baseAddr, uint32_t trigVal);
314 
324 void WDTIMERDelaySet(uint32_t baseAddr, uint32_t delayVal);
325 
335 uint32_t WDTIMERDelayGet(uint32_t baseAddr);
336 
350 void WDTIMERIntRawStatusSet(uint32_t baseAddr, uint32_t intFlags);
351 
360 uint32_t WDTIMERIntRawStatusGet(uint32_t baseAddr);
361 
370 uint32_t WDTIMERIntStatusGet(uint32_t baseAddr);
371 
385 void WDTIMERIntStatusClear(uint32_t baseAddr, uint32_t intFlags);
386 
400 void WDTIMERIntEnable(uint32_t baseAddr, uint32_t intFlags);
401 
411 uint32_t WDTIMERIntEnableStatusGet(uint32_t baseAddr);
412 
426 void WDTIMERIntDisable(uint32_t baseAddr, uint32_t intFlags);
427 
445 uint32_t WDTIMERWritePostedStatusGet(uint32_t baseAddr, uint32_t flags);
446 
447 #ifdef __cplusplus
448 }
449 #endif
450 
451 #endif
452 
453 /********************************* End of file ******************************/
void WDTIMERIntStatusClear(uint32_t baseAddr, uint32_t intFlags)
Clear IRQ status.
void WDTIMERDelaySet(uint32_t baseAddr, uint32_t delayVal)
Load the delay register of Watchdog timer with the delay value.
void WDTIMERPreScalerClkDisable(uint32_t baseAddr)
This API will disable the pre-scaler clock.
void WDTIMERIntDisable(uint32_t baseAddr, uint32_t intFlags)
Disable Watchdog timer interrupts.
uint32_t flags
Definition: csl_udmap_tr.h:213
void WDTIMERCounterSet(uint32_t baseAddr, uint32_t countVal)
Set/Write the Counter register with the counter value.
uint32_t WDTIMERIntEnableStatusGet(uint32_t baseAddr)
Used to check whether interrupts of Watchdog timer are enabled or disabled.
uint32_t WDTIMERCounterGet(uint32_t baseAddr)
Get/Read the counter value from the counter register.
void WDTIMERIntRawStatusSet(uint32_t baseAddr, uint32_t intFlags)
Set IRQ status by software.
void WDTIMERPreScalerClkEnable(uint32_t baseAddr, uint32_t ptv)
This API will configure and enable the pre-scaler clock.
void WDTIMERReloadSet(uint32_t baseAddr, uint32_t reloadVal)
Set the reload count value in the Watchdog timer load register.
uint32_t WDTIMERReloadGet(uint32_t baseAddr)
Get the reload count value from the Watchdog timer load register.
uint32_t WDTIMERWritePostedStatusGet(uint32_t baseAddr, uint32_t flags)
Read the status of WD_TIMER_WWPS register.
void WDTIMEREnable(uint32_t baseAddr)
Starts/Enables the watchdog timer.
void WDTIMERTriggerSet(uint32_t baseAddr, uint32_t trigVal)
Set/enable the trigger write access.
uint32_t WDTIMERIntRawStatusGet(uint32_t baseAddr)
Return the Raw IRQ status.
void WDTIMERIntEnable(uint32_t baseAddr, uint32_t intFlags)
Enable Watchdog timer interrupts.
uint32_t WDTIMERRevisionIDGet(uint32_t baseAddr)
Return the revision id of the SOC used.
uint32_t WDTIMERDelayGet(uint32_t baseAddr)
Return the delay register value of Watchdog timer.
void WDTIMERDisable(uint32_t baseAddr)
Stops/Disables the watchdog timer.
void WDTIMERReset(uint32_t baseAddr)
Reset the watchdog timer module.
uint32_t WDTIMERIntStatusGet(uint32_t baseAddr)
Read the status of WD_TIMER_WIRQSTAT register.