]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53_bsp/psu_cortexa53_0/include/xttcps_hw.h
Completely re-generate the Zynq 7000 demo using the 2016.1 SDK tools.
[freertos] / FreeRTOS / Demo / CORTEX_A53_64-bit_UltraScale_MPSoC / RTOSDemo_A53_bsp / psu_cortexa53_0 / include / xttcps_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 xttcps_hw.h
36 *
37 * This file defines the hardware interface to one of the three timer counters
38 * in the Ps block.
39 *
40 *
41 * <pre>
42 * MODIFICATION HISTORY:
43 *
44 * Ver   Who    Date     Changes
45 * ----- ------ -------- -------------------------------------------------
46 * 1.00a drg/jz 01/21/10 First release
47 * 3.00  kvn    02/13/15 Modified code for MISRA-C:2012 compliance.
48 *
49 * </pre>
50 *
51 ******************************************************************************/
52
53 #ifndef XTTCPS_HW_H             /* prevent circular inclusions */
54 #define XTTCPS_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  *
70  * Register offsets from the base address of the device.
71  *
72  * @{
73  */
74 #define XTTCPS_CLK_CNTRL_OFFSET         0x00000000U  /**< Clock Control Register */
75 #define XTTCPS_CNT_CNTRL_OFFSET         0x0000000CU  /**< Counter Control Register*/
76 #define XTTCPS_COUNT_VALUE_OFFSET       0x00000018U  /**< Current Counter Value */
77 #define XTTCPS_INTERVAL_VAL_OFFSET      0x00000024U  /**< Interval Count Value */
78 #define XTTCPS_MATCH_0_OFFSET           0x00000030U  /**< Match 1 value */
79 #define XTTCPS_MATCH_1_OFFSET           0x0000003CU  /**< Match 2 value */
80 #define XTTCPS_MATCH_2_OFFSET           0x00000048U  /**< Match 3 value */
81 #define XTTCPS_ISR_OFFSET                       0x00000054U  /**< Interrupt Status Register */
82 #define XTTCPS_IER_OFFSET                       0x00000060U  /**< Interrupt Enable Register */
83 /* @} */
84
85 /** @name Clock Control Register
86  * Clock Control Register definitions
87  * @{
88  */
89 #define XTTCPS_CLK_CNTRL_PS_EN_MASK             0x00000001U  /**< Prescale enable */
90 #define XTTCPS_CLK_CNTRL_PS_VAL_MASK    0x0000001EU  /**< Prescale value */
91 #define XTTCPS_CLK_CNTRL_PS_VAL_SHIFT                    1U  /**< Prescale shift */
92 #define XTTCPS_CLK_CNTRL_PS_DISABLE                             16U  /**< Prescale disable */
93 #define XTTCPS_CLK_CNTRL_SRC_MASK               0x00000020U  /**< Clock source */
94 #define XTTCPS_CLK_CNTRL_EXT_EDGE_MASK  0x00000040U  /**< External Clock edge */
95 /* @} */
96
97 /** @name Counter Control Register
98  * Counter Control Register definitions
99  * @{
100  */
101 #define XTTCPS_CNT_CNTRL_DIS_MASK               0x00000001U /**< Disable the counter */
102 #define XTTCPS_CNT_CNTRL_INT_MASK               0x00000002U /**< Interval mode */
103 #define XTTCPS_CNT_CNTRL_DECR_MASK              0x00000004U /**< Decrement mode */
104 #define XTTCPS_CNT_CNTRL_MATCH_MASK             0x00000008U /**< Match mode */
105 #define XTTCPS_CNT_CNTRL_RST_MASK               0x00000010U /**< Reset counter */
106 #define XTTCPS_CNT_CNTRL_EN_WAVE_MASK   0x00000020U /**< Enable waveform */
107 #define XTTCPS_CNT_CNTRL_POL_WAVE_MASK  0x00000040U /**< Waveform polarity */
108 #define XTTCPS_CNT_CNTRL_RESET_VALUE    0x00000021U /**< Reset value */
109 /* @} */
110
111 /** @name Current Counter Value Register
112  * Current Counter Value Register definitions
113  * @{
114  */
115 #define XTTCPS_COUNT_VALUE_MASK         0x0000FFFFU /**< 16-bit counter value */
116 /* @} */
117
118 /** @name Interval Value Register
119  * Interval Value Register is the maximum value the counter will count up or
120  * down to.
121  * @{
122  */
123 #define XTTCPS_INTERVAL_VAL_MASK        0x0000FFFFU /**< 16-bit Interval value*/
124 /* @} */
125
126 /** @name Match Registers
127  * Definitions for Match registers, each timer counter has three match
128  * registers.
129  * @{
130  */
131 #define XTTCPS_MATCH_MASK               0x0000FFFFU /**< 16-bit Match value */
132 #define XTTCPS_NUM_MATCH_REG                     3U /**< Num of Match reg */
133 /* @} */
134
135 /** @name Interrupt Registers
136  * Following register bit mask is for all interrupt registers.
137  *
138  * @{
139  */
140 #define XTTCPS_IXR_INTERVAL_MASK        0x00000001U  /**< Interval Interrupt */
141 #define XTTCPS_IXR_MATCH_0_MASK         0x00000002U  /**< Match 1 Interrupt */
142 #define XTTCPS_IXR_MATCH_1_MASK         0x00000004U  /**< Match 2 Interrupt */
143 #define XTTCPS_IXR_MATCH_2_MASK         0x00000008U  /**< Match 3 Interrupt */
144 #define XTTCPS_IXR_CNT_OVR_MASK         0x00000010U  /**< Counter Overflow */
145 #define XTTCPS_IXR_ALL_MASK                     0x0000001FU  /**< All valid Interrupts */
146 /* @} */
147
148
149 /***************** Macros (Inline Functions) Definitions *********************/
150
151 /****************************************************************************/
152 /**
153 *
154 * Read the given Timer Counter register.
155 *
156 * @param        BaseAddress is the base address of the timer counter device.
157 * @param        RegOffset is the register offset to be read
158 *
159 * @return       The 32-bit value of the register
160 *
161 * @note         C-style signature:
162 *               u32 XTtcPs_ReadReg(u32 BaseAddress, u32 RegOffset)
163 *
164 *****************************************************************************/
165 #define XTtcPs_ReadReg(BaseAddress, RegOffset) \
166     (Xil_In32((BaseAddress) + (u32)(RegOffset)))
167
168 /****************************************************************************/
169 /**
170 *
171 * Write the given Timer Counter register.
172 *
173 * @param        BaseAddress is the base address of the timer counter device.
174 * @param        RegOffset is the register offset to be written
175 * @param        Data is the 32-bit value to write to the register
176 *
177 * @return       None.
178 *
179 * @note         C-style signature:
180 *               void XTtcPs_WriteReg(XTtcPs BaseAddress, u32 RegOffset,
181 *               u32 Data)
182 *
183 *****************************************************************************/
184 #define XTtcPs_WriteReg(BaseAddress, RegOffset, Data) \
185     (Xil_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data)))
186
187 /****************************************************************************/
188 /**
189 *
190 * Calculate a match register offset using the Match Register index.
191 *
192 * @param        MatchIndex is the 0-2 value of the match register
193 *
194 * @return       MATCH_N_OFFSET.
195 *
196 * @note         C-style signature:
197 *               u32 XTtcPs_Match_N_Offset(u8 MatchIndex)
198 *
199 *****************************************************************************/
200 #define XTtcPs_Match_N_Offset(MatchIndex) \
201                 ((u32)XTTCPS_MATCH_0_OFFSET + ((u32)(12U) * (u32)(MatchIndex)))
202
203 /************************** Function Prototypes ******************************/
204
205 /************************** Variable Definitions *****************************/
206 #ifdef __cplusplus
207 }
208 #endif
209 #endif /* end of protection macro */