]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/gpiops_v2_1/src/xgpiops_hw.h
6c9ef5e0eb4cb6888807f0227d733f32341be2e3
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / gpiops_v2_1 / src / xgpiops_hw.h
1 /******************************************************************************
2 *
3 * (c) Copyright 2010-14 Xilinx, Inc. All rights reserved.
4 *
5 * This file contains confidential and proprietary information of Xilinx, Inc.
6 * and is protected under U.S. and international copyright and other
7 * intellectual property laws.
8 *
9 * DISCLAIMER
10 * This disclaimer is not a license and does not grant any rights to the
11 * materials distributed herewith. Except as otherwise provided in a valid
12 * license issued to you by Xilinx, and to the maximum extent permitted by
13 * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
14 * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
15 * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
16 * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
17 * and (2) Xilinx shall not be liable (whether in contract or tort, including
18 * negligence, or under any other theory of liability) for any loss or damage
19 * of any kind or nature related to, arising under or in connection with these
20 * materials, including for any direct, or any indirect, special, incidental,
21 * or consequential loss or damage (including loss of data, profits, goodwill,
22 * or any type of loss or damage suffered as a result of any action brought by
23 * a third party) even if such damage or loss was reasonably foreseeable or
24 * Xilinx had been advised of the possibility of the same.
25 *
26 * CRITICAL APPLICATIONS
27 * Xilinx products are not designed or intended to be fail-safe, or for use in
28 * any application requiring fail-safe performance, such as life-support or
29 * safety devices or systems, Class III medical devices, nuclear facilities,
30 * applications related to the deployment of airbags, or any other applications
31 * that could lead to death, personal injury, or severe property or
32 * environmental damage (individually and collectively, "Critical
33 * Applications"). Customer assumes the sole risk and liability of any use of
34 * Xilinx products in Critical Applications, subject only to applicable laws
35 * and regulations governing limitations on product liability.
36 *
37 * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
38 * AT ALL TIMES.
39 *
40 ******************************************************************************/
41 /*****************************************************************************/
42 /**
43 *
44 * @file xgpiops_hw.h
45 *
46 * This header file contains the identifiers and basic driver functions (or
47 * macros) that can be used to access the device. Other driver functions
48 * are defined in xgpiops.h.
49 *
50 * <pre>
51 * MODIFICATION HISTORY:
52 *
53 * Ver   Who  Date     Changes
54 * ----- ---- -------- -------------------------------------------------
55 * 1.00a sv   01/15/10 First Release
56 * 1.02a hk   08/22/13 Added low level reset API function prototype and
57 *                     related constant definitions
58 * </pre>
59 *
60 ******************************************************************************/
61 #ifndef XGPIOPS_HW_H            /* prevent circular inclusions */
62 #define XGPIOPS_HW_H            /* by using protection macros */
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif /* __cplusplus */
67
68 /***************************** Include Files *********************************/
69
70 #include "xil_types.h"
71 #include "xil_assert.h"
72 #include "xil_io.h"
73
74 /************************** Constant Definitions *****************************/
75
76 /** @name Register offsets for the GPIO. Each register is 32 bits.
77  *  @{
78  */
79 #define XGPIOPS_DATA_LSW_OFFSET  0x000  /* Mask and Data Register LSW, WO */
80 #define XGPIOPS_DATA_MSW_OFFSET  0x004  /* Mask and Data Register MSW, WO */
81 #define XGPIOPS_DATA_OFFSET      0x040  /* Data Register, RW */
82 #define XGPIOPS_DATA_RO_OFFSET   0x060  /* Data Register - Input, RO */
83 #define XGPIOPS_DIRM_OFFSET      0x204  /* Direction Mode Register, RW */
84 #define XGPIOPS_OUTEN_OFFSET     0x208  /* Output Enable Register, RW */
85 #define XGPIOPS_INTMASK_OFFSET   0x20C  /* Interrupt Mask Register, RO */
86 #define XGPIOPS_INTEN_OFFSET     0x210  /* Interrupt Enable Register, WO */
87 #define XGPIOPS_INTDIS_OFFSET    0x214  /* Interrupt Disable Register, WO*/
88 #define XGPIOPS_INTSTS_OFFSET    0x218  /* Interrupt Status Register, RO */
89 #define XGPIOPS_INTTYPE_OFFSET   0x21C  /* Interrupt Type Register, RW */
90 #define XGPIOPS_INTPOL_OFFSET    0x220  /* Interrupt Polarity Register, RW */
91 #define XGPIOPS_INTANY_OFFSET    0x224  /* Interrupt On Any Register, RW */
92 /* @} */
93
94 /** @name Register offsets for each Bank.
95  *  @{
96  */
97 #define XGPIOPS_DATA_MASK_OFFSET 0x8  /* Data/Mask Registers offset */
98 #define XGPIOPS_DATA_BANK_OFFSET 0x4  /* Data Registers offset */
99 #define XGPIOPS_REG_MASK_OFFSET 0x40  /* Registers offset */
100 /* @} */
101
102 /* For backwards compatibility */
103 #define XGPIOPS_BYPM_MASK_OFFSET        XGPIOPS_REG_MASK_OFFSET
104
105 /** @name Interrupt type reset values for each bank
106  *  @{
107  */
108 #define XGPIOPS_INTTYPE_BANK0_RESET  0xFFFFFFFF
109 #define XGPIOPS_INTTYPE_BANK1_RESET  0x3FFFFFFF
110 #define XGPIOPS_INTTYPE_BANK2_RESET  0xFFFFFFFF
111 #define XGPIOPS_INTTYPE_BANK3_RESET  0xFFFFFFFF
112 /* @} */
113
114 /**************************** Type Definitions *******************************/
115
116 /***************** Macros (Inline Functions) Definitions *********************/
117
118 /****************************************************************************/
119 /**
120 *
121 * This macro reads the given register.
122 *
123 * @param        BaseAddr is the base address of the device.
124 * @param        RegOffset is the register offset to be read.
125 *
126 * @return       The 32-bit value of the register
127 *
128 * @note         None.
129 *
130 *****************************************************************************/
131 #define XGpioPs_ReadReg(BaseAddr, RegOffset)            \
132                 Xil_In32((BaseAddr) + (RegOffset))
133
134 /****************************************************************************/
135 /**
136 *
137 * This macro writes to the given register.
138 *
139 * @param        BaseAddr is the base address of the device.
140 * @param        RegOffset is the offset of the register to be written.
141 * @param        Data is the 32-bit value to write to the register.
142 *
143 * @return       None.
144 *
145 * @note         None.
146 *
147 *****************************************************************************/
148 #define XGpioPs_WriteReg(BaseAddr, RegOffset, Data)     \
149                 Xil_Out32((BaseAddr) + (RegOffset), (Data))
150
151 /************************** Function Prototypes ******************************/
152
153 void XGpioPs_ResetHw(u32 BaseAddress);
154
155 #ifdef __cplusplus
156 }
157 #endif /* __cplusplus */
158
159 #endif /* XGPIOPS_HW_H */