]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/wdtps_v3_0/src/xwdtps_hw.h
Update some more standard demos for use on 64-bit architectures.
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / wdtps_v3_0 / src / xwdtps_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 xwdtps_hw.h
36 * @addtogroup wdtps_v3_0
37 * @{
38 *
39 * This file contains the hardware interface to the System Watch Dog Timer (WDT).
40 *
41 * <pre>
42 * MODIFICATION HISTORY:
43 *
44 * Ver   Who    Date     Changes
45 * ----- ------ -------- ---------------------------------------------
46 * 1.00a ecm/jz 01/15/10 First release
47 * 1.02a  sg    07/15/12 Removed defines related to  External Signal
48 *                       Length functionality for CR 658287
49 * 3.00  kvn    02/13/15 Modified code for MISRA-C:2012 compliance.
50 * </pre>
51 *
52 ******************************************************************************/
53 #ifndef XWDTPS_HW_H             /* prevent circular inclusions */
54 #define XWDTPS_HW_H             /* by using protection macros */
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /***************************** Include Files *********************************/
61
62 #include "xil_types.h"
63 #include "xil_assert.h"
64 #include "xil_io.h"
65
66 /************************** Constant Definitions *****************************/
67
68 /** @name Register Map
69  * Offsets of registers from the start of the device
70  * @{
71  */
72
73 #define XWDTPS_ZMR_OFFSET       0x00000000U /**< Zero Mode Register */
74 #define XWDTPS_CCR_OFFSET       0x00000004U /**< Counter Control Register */
75 #define XWDTPS_RESTART_OFFSET   0x00000008U /**< Restart Register */
76 #define XWDTPS_SR_OFFSET        0x0000000CU /**< Status Register */
77 /* @} */
78
79
80 /** @name Zero Mode Register
81  * This register controls how the time out is indicated and also contains
82  * the access code (0xABC) to allow writes to the register
83  * @{
84  */
85 #define XWDTPS_ZMR_WDEN_MASK    0x00000001U /**< enable the WDT */
86 #define XWDTPS_ZMR_RSTEN_MASK   0x00000002U /**< enable the reset output */
87 #define XWDTPS_ZMR_IRQEN_MASK   0x00000004U /**< enable the IRQ output */
88
89 #define XWDTPS_ZMR_RSTLN_MASK   0x00000070U /**< set length of reset pulse */
90 #define XWDTPS_ZMR_RSTLN_SHIFT  4U         /**< shift for reset pulse */
91
92 #define XWDTPS_ZMR_IRQLN_MASK   0x00000180U /**< set length of interrupt pulse */
93 #define XWDTPS_ZMR_IRQLN_SHIFT  7U         /**< shift for interrupt pulse */
94
95 #define XWDTPS_ZMR_ZKEY_MASK    0x00FFF000U /**< mask for writing access key */
96 #define XWDTPS_ZMR_ZKEY_VAL             0x00ABC000U /**< access key, 0xABC << 12 */
97
98 /* @} */
99
100 /** @name  Counter Control register
101  * This register controls how fast the timer runs and the reset value
102  * and also contains the access code (0x248) to allow writes to the
103  * register
104  * @{
105  */
106
107 #define XWDTPS_CCR_CLKSEL_MASK  0x00000003U /**< counter clock prescale */
108
109 #define XWDTPS_CCR_CRV_MASK     0x00003FFCU /**< counter reset value */
110 #define XWDTPS_CCR_CRV_SHIFT    2U         /**< shift for writing value */
111
112 #define XWDTPS_CCR_CKEY_MASK    0x03FFC000U /**< mask for writing access key */
113 #define XWDTPS_CCR_CKEY_VAL     0x00920000U /**< access key, 0x248 << 14 */
114
115 /* Bit patterns for Clock prescale divider values */
116
117 #define XWDTPS_CCR_PSCALE_0008  0x00000000U /**< divide clock by 8 */
118 #define XWDTPS_CCR_PSCALE_0064  0x00000001U /**< divide clock by 64 */
119 #define XWDTPS_CCR_PSCALE_0512  0x00000002U /**< divide clock by 512 */
120 #define XWDTPS_CCR_PSCALE_4096  0x00000003U /**< divide clock by 4096 */
121
122 /* @} */
123
124 /** @name  Restart register
125  * This register resets the timer preventing a timeout. Value is specific
126  * 0x1999
127  * @{
128  */
129
130 #define XWDTPS_RESTART_KEY_VAL  0x00001999U /**< valid key */
131
132 /*@}*/
133
134 /** @name Status register
135  * This register indicates timer reached zero count.
136  * @{
137  */
138 #define XWDTPS_SR_WDZ_MASK      0x00000001U /**< time out occurred */
139
140 /*@}*/
141
142 /**************************** Type Definitions *******************************/
143
144
145 /***************** Macros (Inline Functions) Definitions *********************/
146
147 /****************************************************************************/
148 /**
149 *
150 * Read the given register.
151 *
152 * @param        BaseAddress is the base address of the device
153 * @param        RegOffset is the register offset to be read
154 *
155 * @return       The 32-bit value of the register
156 *
157 * @note         C-style signature:
158 *               u32 XWdtPs_ReadReg(u32 BaseAddress, u32 RegOffset)
159 *
160 *****************************************************************************/
161 #define XWdtPs_ReadReg(BaseAddress, RegOffset) \
162         Xil_In32((BaseAddress) + (u32)(RegOffset))
163
164 /****************************************************************************/
165 /**
166 *
167 * Write the given register.
168 *
169 * @param        BaseAddress is the base address of the device
170 * @param        RegOffset is the register offset to be written
171 * @param        Data is the 32-bit value to write to the register
172 *
173 * @return       None.
174 *
175 * @note         C-style signature:
176 *               void XWdtPs_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
177 *
178 *****************************************************************************/
179 #define XWdtPs_WriteReg(BaseAddress, RegOffset, Data) \
180         Xil_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data))
181
182
183 /************************** Function Prototypes ******************************/
184
185
186 /************************** Variable Definitions *****************************/
187
188 #ifdef __cplusplus
189 }
190 #endif
191
192 #endif
193 /** @} */