]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/scuwdt_v2_1/src/xscuwdt_hw.h
Completely re-generate the Zynq 7000 demo using the 2016.1 SDK tools.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / scuwdt_v2_1 / src / xscuwdt_hw.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2010 - 2015 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 * @addtogroup scuwdt_v2_1
37 * @{
38 *
39 * This file contains the hardware interface to the Xilinx SCU private Watch Dog
40 * Timer (XSCUWDT).
41 *
42 * <pre>
43 * MODIFICATION HISTORY:
44 *
45 * Ver   Who Date     Changes
46 * ----- --- -------- ---------------------------------------------
47 * 1.00a sdm 01/15/10 First release
48 * 1.01a bss 02/27/12 Updated the register offsets to start at 0x0 instead
49 *                    of 0x20 as the base address obtained from the tools
50 *                    starts at 0x20.
51 * 1.02a  sg 07/17/12 Included xil_assert.h for CR 667947. This is an issue
52 *                    when the xstatus.h in the common driver overwrites
53 *                    the xstatus.h of the standalone BSP during the
54 *                    libgen.
55 * 2.1   sk  02/26/15 Modified the code for MISRA-C:2012 compliance.
56 * </pre>
57 *
58 ******************************************************************************/
59 #ifndef XSCUWDT_HW_H            /* prevent circular inclusions */
60 #define XSCUWDT_HW_H            /* by using protection macros */
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 /***************************** Include Files *********************************/
67
68 #include "xil_types.h"
69 #include "xil_io.h"
70 #include "xil_assert.h"
71 /************************** Constant Definitions *****************************/
72
73 /** @name Register Map
74  * Offsets of registers from the start of the device. The WDT registers start at
75  * an offset 0x20
76  * @{
77  */
78
79 #define XSCUWDT_LOAD_OFFSET     0x00U /**< Watchdog Load Register */
80 #define XSCUWDT_COUNTER_OFFSET  0x04U /**< Watchdog Counter Register */
81 #define XSCUWDT_CONTROL_OFFSET  0x08U /**< Watchdog Control Register */
82 #define XSCUWDT_ISR_OFFSET      0x0CU /**< Watchdog Interrupt Status Register */
83 #define XSCUWDT_RST_STS_OFFSET  0x10U /**< Watchdog Reset Status Register */
84 #define XSCUWDT_DISABLE_OFFSET  0x14U /**< Watchdog Disable Register */
85 /* @} */
86
87 /** @name Watchdog Control register
88  * This register bits control the prescaler, WD/Timer mode, Intr enable,
89  * auto-reload, watchdog enable.
90  * @{
91  */
92
93 #define XSCUWDT_CONTROL_PRESCALER_MASK   0x0000FF00U /**< Prescaler */
94 #define XSCUWDT_CONTROL_PRESCALER_SHIFT  8U
95 #define XSCUWDT_CONTROL_WD_MODE_MASK     0x00000008U /**< Watchdog/Timer mode */
96 #define XSCUWDT_CONTROL_IT_ENABLE_MASK   0x00000004U /**< Intr enable (in
97                                                          timer mode) */
98 #define XSCUWDT_CONTROL_AUTO_RELOAD_MASK 0x00000002U /**< Auto-reload (in
99                                                          timer mode) */
100 #define XSCUWDT_CONTROL_WD_ENABLE_MASK   0x00000001U /**< Watchdog enable */
101 /* @} */
102
103 /** @name Interrupt Status register
104  * This register indicates the Counter register has reached zero in Counter
105  * mode.
106  * @{
107  */
108
109 #define XSCUWDT_ISR_EVENT_FLAG_MASK     0x00000001U /**< Event flag */
110 /*@}*/
111
112 /** @name Reset Status register
113  * This register indicates the Counter register has reached zero in Watchdog
114  * mode and a reset request is sent.
115  * @{
116  */
117
118 #define XSCUWDT_RST_STS_RESET_FLAG_MASK 0x00000001U /**< Time out occured */
119 /*@}*/
120
121 /** @name Disable register
122  * This register is used to switch from watchdog mode to timer mode.
123  * The software must write 0x12345678 and 0x87654321 successively to the
124  * Watchdog Disable Register so that the watchdog mode bit in the Watchdog
125  * Control Register is set to zero.
126  * @{
127  */
128 #define XSCUWDT_DISABLE_VALUE1          0x12345678U /**< Watchdog mode disable
129                                                         value 1 */
130 #define XSCUWDT_DISABLE_VALUE2          0x87654321U /**< Watchdog mode disable
131                                                         value 2 */
132 /*@}*/
133
134 /**************************** Type Definitions *******************************/
135
136 /***************** Macros (Inline Functions) Definitions *********************/
137
138 /****************************************************************************/
139 /**
140 *
141 * Read the given register.
142 *
143 * @param        BaseAddr is the base address of the device
144 * @param        RegOffset is the register offset to be read
145 *
146 * @return       The 32-bit value of the register
147 *
148 * @note         C-style signature:
149 *               u32 XScuWdt_ReadReg(u32 BaseAddr, u32 RegOffset)
150 *
151 *****************************************************************************/
152 #define XScuWdt_ReadReg(BaseAddr, RegOffset)            \
153         Xil_In32((BaseAddr) + ((u32)RegOffset))
154
155 /****************************************************************************/
156 /**
157 *
158 * Write the given register.
159 *
160 * @param        BaseAddr is the base address of the device
161 * @param        RegOffset is the register offset to be written
162 * @param        Data is the 32-bit value to write to the register
163 *
164 * @return       None.
165 *
166 * @note         C-style signature:
167 *               void XScuWdt_WriteReg(u32 BaseAddr, u32 RegOffset, u32 Data)
168 *
169 *****************************************************************************/
170 #define XScuWdt_WriteReg(BaseAddr, RegOffset, Data)     \
171         Xil_Out32((BaseAddr) + ((u32)RegOffset), ((u32)Data))
172
173 /************************** Function Prototypes ******************************/
174
175 /************************** Variable Definitions *****************************/
176
177 #ifdef __cplusplus
178 }
179 #endif
180
181 #endif  /* end of protection macro */
182 /** @} */