]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/include/xscuwdt_hw.h
3d55029f944442b2497a555c78c3e7566b55de98
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / include / xscuwdt_hw.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2010 - 2014 Xilinx, Inc.  All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
30 *
31 ******************************************************************************/
32 /****************************************************************************/
33 /**
34 *
35 * @file xscuwdt_hw.h
36 *
37 * This file contains the hardware interface to the Xilinx SCU private Watch Dog
38 * Timer (XSCUWDT).
39 *
40 * <pre>
41 * MODIFICATION HISTORY:
42 *
43 * Ver   Who Date     Changes
44 * ----- --- -------- ---------------------------------------------
45 * 1.00a sdm 01/15/10 First release
46 * 1.01a bss 02/27/12 Updated the register offsets to start at 0x0 instead
47 *                    of 0x20 as the base address obtained from the tools
48 *                    starts at 0x20.
49 * 1.02a  sg 07/17/12 Included xil_assert.h for CR 667947. This is an issue
50 *                    when the xstatus.h in the common driver overwrites
51 *                    the xstatus.h of the standalone BSP during the
52 *                    libgen.
53 * </pre>
54 *
55 ******************************************************************************/
56 #ifndef XSCUWDT_HW_H            /* prevent circular inclusions */
57 #define XSCUWDT_HW_H            /* by using protection macros */
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 /***************************** Include Files *********************************/
64
65 #include "xil_types.h"
66 #include "xil_io.h"
67 #include "xil_assert.h"
68 /************************** Constant Definitions *****************************/
69
70 /** @name Register Map
71  * Offsets of registers from the start of the device. The WDT registers start at
72  * an offset 0x20
73  * @{
74  */
75
76 #define XSCUWDT_LOAD_OFFSET     0x00 /**< Watchdog Load Register */
77 #define XSCUWDT_COUNTER_OFFSET  0x04 /**< Watchdog Counter Register */
78 #define XSCUWDT_CONTROL_OFFSET  0x08 /**< Watchdog Control Register */
79 #define XSCUWDT_ISR_OFFSET      0x0C /**< Watchdog Interrupt Status Register */
80 #define XSCUWDT_RST_STS_OFFSET  0x10 /**< Watchdog Reset Status Register */
81 #define XSCUWDT_DISABLE_OFFSET  0x14 /**< Watchdog Disable Register */
82 /* @} */
83
84 /** @name Watchdog Control register
85  * This register bits control the prescaler, WD/Timer mode, Intr enable,
86  * auto-reload, watchdog enable.
87  * @{
88  */
89
90 #define XSCUWDT_CONTROL_PRESCALER_MASK   0x0000FF00 /**< Prescaler */
91 #define XSCUWDT_CONTROL_PRESCALER_SHIFT  8
92 #define XSCUWDT_CONTROL_WD_MODE_MASK     0x00000008 /**< Watchdog/Timer mode */
93 #define XSCUWDT_CONTROL_IT_ENABLE_MASK   0x00000004 /**< Intr enable (in
94                                                          timer mode) */
95 #define XSCUWDT_CONTROL_AUTO_RELOAD_MASK 0x00000002 /**< Auto-reload (in
96                                                          timer mode) */
97 #define XSCUWDT_CONTROL_WD_ENABLE_MASK   0x00000001 /**< Watchdog enable */
98 /* @} */
99
100 /** @name Interrupt Status register
101  * This register indicates the Counter register has reached zero in Counter
102  * mode.
103  * @{
104  */
105
106 #define XSCUWDT_ISR_EVENT_FLAG_MASK     0x00000001 /**< Event flag */
107 /*@}*/
108
109 /** @name Reset Status register
110  * This register indicates the Counter register has reached zero in Watchdog
111  * mode and a reset request is sent.
112  * @{
113  */
114
115 #define XSCUWDT_RST_STS_RESET_FLAG_MASK 0x00000001 /**< Time out occured */
116 /*@}*/
117
118 /** @name Disable register
119  * This register is used to switch from watchdog mode to timer mode.
120  * The software must write 0x12345678 and 0x87654321 successively to the
121  * Watchdog Disable Register so that the watchdog mode bit in the Watchdog
122  * Control Register is set to zero.
123  * @{
124  */
125 #define XSCUWDT_DISABLE_VALUE1          0x12345678 /**< Watchdog mode disable
126                                                         value 1 */
127 #define XSCUWDT_DISABLE_VALUE2          0x87654321 /**< Watchdog mode disable
128                                                         value 2 */
129 /*@}*/
130
131 /**************************** Type Definitions *******************************/
132
133 /***************** Macros (Inline Functions) Definitions *********************/
134
135 /****************************************************************************/
136 /**
137 *
138 * Read the given register.
139 *
140 * @param        BaseAddr is the base address of the device
141 * @param        RegOffset is the register offset to be read
142 *
143 * @return       The 32-bit value of the register
144 *
145 * @note         C-style signature:
146 *               u32 XScuWdt_ReadReg(u32 BaseAddr, u32 RegOffset)
147 *
148 *****************************************************************************/
149 #define XScuWdt_ReadReg(BaseAddr, RegOffset)            \
150         Xil_In32((BaseAddr) + (RegOffset))
151
152 /****************************************************************************/
153 /**
154 *
155 * Write the given register.
156 *
157 * @param        BaseAddr is the base address of the device
158 * @param        RegOffset is the register offset to be written
159 * @param        Data is the 32-bit value to write to the register
160 *
161 * @return       None.
162 *
163 * @note         C-style signature:
164 *               void XScuWdt_WriteReg(u32 BaseAddr, u32 RegOffset, u32 Data)
165 *
166 *****************************************************************************/
167 #define XScuWdt_WriteReg(BaseAddr, RegOffset, Data)     \
168         Xil_Out32((BaseAddr) + (RegOffset), (Data))
169
170 /************************** Function Prototypes ******************************/
171
172 /************************** Variable Definitions *****************************/
173
174 #ifdef __cplusplus
175 }
176 #endif
177
178 #endif  /* end of protection macro */