cae93d3070cd7d9bb4742caf7f2320172cec3776
1 /**
2 * \file GPIO_board.h
3 *
4 * \brief GPIO board header file.
5 *
6 */
8 /*
9 * Copyright (C) 2014 - 2018 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the
21 * distribution.
22 *
23 * Neither the name of Texas Instruments Incorporated nor the names of
24 * its contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 */
42 #ifndef _GPIO_BOARD_H
43 #define _GPIO_BOARD_H
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 /* Example/Board Header files */
51 #include <ti/board/board.h>
53 #if defined (SOC_AM572x) || defined (SOC_AM574x)
54 #include <ti/csl/soc/am572x/src/cslr_soc_mpu_baseaddress.h>
55 #endif
57 #if defined (SOC_AM571x)
58 #include <ti/csl/soc/am571x/src/cslr_soc_mpu_baseaddress.h>
59 #endif
61 #if defined (SOC_AM65XX)
62 #include <ti/csl/src/ip/intr_router/V0/csl_intr_router.h>
63 #include <ti/csl/src/ip/fss/V0/cslr_fss.h>
64 #include <ti/csl/src/ip/rat/V0/csl_rat.h>
65 #include <ti/csl/soc/am65xx/src/cslr_soc_baseaddress.h>
66 #include <ti/csl/soc/am65xx/src/cslr_mcu_ctrl_mmr.h>
67 #include <ti/csl/soc/am65xx/src/cslr_mcu_pll_mmr.h>
68 #include <ti/csl/soc/am65xx/src/cslr_wkup_ctrl_mmr.h>
69 #endif
71 #if defined (SOC_J721E)
72 #include <ti/csl/src/ip/intr_router/V0/csl_intr_router.h>
73 #include <ti/csl/src/ip/fss/V0/cslr_fss.h>
74 #include <ti/csl/src/ip/rat/V0/csl_rat.h>
75 #include <ti/csl/soc/j721e/src/cslr_soc_baseaddress.h>
76 #include <ti/csl/soc/j721e/src/cslr_mcu_ctrl_mmr.h>
77 #include <ti/csl/soc/j721e/src/cslr_mcu_pll_mmr.h>
78 #include <ti/csl/soc/j721e/src/cslr_wkup_ctrl_mmr.h>
79 #endif
81 /**********************************************************************
82 ************************** Macros ************************************
83 **********************************************************************/
84 #if defined (idkAM572x) || defined (idkAM574x)
85 #define GPIO_INTR_LED_BASE_ADDR_1P2 (CSL_MPU_GPIO4_REGS)
86 #define GPIO_LED_PIN_NUM_1P2 (0x04U)
87 #define GPIO_INTR_LED_BASE_ADDR_1P3 (CSL_MPU_GPIO7_REGS)
88 #define GPIO_LED_PIN_NUM_1P3 (0x17U)
89 #endif
91 #if defined (idkAM571x)
92 #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO2_REGS)
93 #define GPIO_LED_PIN_NUM (0x15U)
94 #endif
96 #if defined (evmAM572x)
97 #if defined (__TI_ARM_V7M4__)
98 #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO1_REGS)
99 #define GPIO_LED_PIN_NUM (0x10U)
100 #else
101 #define GPIO_INTR_LED_BASE_ADDR (CSL_MPU_GPIO7_REGS)
102 #define GPIO_LED_PIN_NUM (0x08U)
103 #endif
104 #endif
106 #if defined (evmAM572x) || defined (idkAM571x) || \
107 defined (skAM437x) || defined (evmAM437x) || \
108 defined (icev2AM335x) || defined (skAM335x) || defined (bbbAM335x)
109 #define GPIO_BASE_ADDR GPIO_INTR_LED_BASE_ADDR
110 #define GPIO_LED_PIN GPIO_LED_PIN_NUM
111 #endif
113 #if defined (evmK2H) || defined (evmK2K)
114 #define K2H_EVM_USER0_LED_RED (12U) /* GPIO pin 12 */
115 #define K2H_EVM_USER0_LED_GREEN (13U) /* GPIO pin 13 */
116 #define K2H_EVM_USER1_LED_BLUE (14U) /* GPIO pin 14 */
117 #define K2H_EVM_USER2_LED_BLUE (15U) /* GPIO pin 15 */
119 #define GPIO_LED0_PIN_NUM K2H_EVM_USER0_LED_GREEN
120 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
121 #define GPIO_LED1_PIN_NUM K2H_EVM_USER2_LED_BLUE
122 #define GPIO_LED1_PORT_NUM (0U) /* GPIO port 0 */
123 #endif
125 #if defined (evmK2E)
126 #define K2E_EVM_USER0_LED_RED (12U) /* GPIO pin 12 */
127 #define K2E_EVM_USER0_LED_GREEN (13U) /* GPIO pin 13 */
128 #define K2E_EVM_USER1_LED_BLUE (14U) /* GPIO pin 14 */
129 #define K2E_EVM_USER2_LED_BLUE (15U) /* GPIO pin 15 */
131 #define GPIO_LED0_PIN_NUM K2E_EVM_USER0_LED_GREEN
132 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
133 #define GPIO_LED1_PIN_NUM K2E_EVM_USER1_LED_BLUE
134 #define GPIO_LED1_PORT_NUM (0U) /* GPIO port 0 */
135 #endif
137 #if defined (evmK2L)
138 /* No gpio pin directly connect to LED on K2L EVM */
139 #define GPIO_LED0_PIN_NUM (8U)
140 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
141 #define GPIO_LED1_PIN_NUM (9U)
142 #define GPIO_LED1_PORT_NUM (0U) /* GPIO port 0 */
143 #endif
145 #if defined (evmK2G)
146 #define GPIO_LED0_PIN_NUM (108U) /* by default PADCONFIG139 set to GPIO0_108 */
147 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
148 #define GPIO_LED1_PIN_NUM (11U) /* by default PADCONFIG186 set to GPIO1_11 */
149 #define GPIO_LED1_PORT_NUM (1U) /* GPIO port 1 */
151 #ifdef _TMS320C6X
152 #define GPIO_MUX_SEL (16U) /* Event slect number for DSP GPIOMUX int */
153 #else
154 #define GPIO_MUX_SEL (0U) /* Event slect number for ARM GPIOMUX int */
155 #endif
156 #endif
158 #if defined (iceK2G)
159 #define GPIO_LED0_PIN_NUM (11U) /* by default PADCONFIG139 set to GPIO0_108 */
160 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
161 #define GPIO_LED1_PIN_NUM (12U) /* by default PADCONFIG186 set to GPIO1_11 */
162 #define GPIO_LED1_PORT_NUM (1U) /* GPIO port 1 */
164 #ifdef _TMS320C6X
165 #define GPIO_MUX_SEL (16U) /* Event slect number for DSP GPIOMUX int */
166 #else
167 #define GPIO_MUX_SEL (0U) /* Event slect number for ARM GPIOMUX int */
168 #endif
169 #endif
171 #if defined (evmC6678)
172 /* No gpio pin directly connect to LED on C6678 EVM */
173 #define GPIO_LED0_PIN_NUM (8U)
174 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
175 #define GPIO_LED1_PIN_NUM (9U)
176 #define GPIO_LED1_PORT_NUM (0U) /* GPIO port 0 */
177 #endif
179 #if defined (evmC6657)
180 /* No gpio pin directly connect to LED on C6678 EVM */
181 #define GPIO_LED0_PIN_NUM (8U)
182 #define GPIO_LED0_PORT_NUM (0U) /* GPIO port 0 */
183 #define GPIO_LED1_PIN_NUM (9U)
184 #define GPIO_LED1_PORT_NUM (0U) /* GPIO port 0 */
185 #endif
187 #if defined (am65xx_evm) || defined (am65xx_idk) || defined (j721e_sim)
188 #if defined(AM65XX_BETA_BOARD)
189 #define GPIO_LED0_PIN_NUM BOARD_WKUP_GPIO_LD18_GREEN_PIN_NUM
190 #define GPIO_LED0_PORT_NUM BOARD_WKUP_GPIO_LD18_GREEN_PORT_NUM
191 #define GPIO_LED1_PIN_NUM BOARD_WKUP_GPIO_LD18_RED_PIN_NUM
192 #define GPIO_LED1_PORT_NUM BOARD_WKUP_GPIO_LD18_RED_PORT_NUM
193 #else
194 #define GPIO_LED0_PIN_NUM BOARD_WKUP_GPIO_LD16_PIN_NUM
195 #define GPIO_LED0_PORT_NUM BOARD_WKUP_GPIO_LD16_PORT_NUM
196 #define GPIO_LED1_PIN_NUM BOARD_WKUP_GPIO_LD17_PIN_NUM
197 #define GPIO_LED1_PORT_NUM BOARD_WKUP_GPIO_LD17_PORT_NUM
198 #endif
199 #endif
201 #if defined (j721e_evm)
202 /* J7ES: use WAKEUP GPIO0_6 --> TP45 for testing */
203 #define GPIO_LED0_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
204 #define GPIO_LED0_PORT_NUM 0 /* use WAKEUP GPIO0 */
205 #define GPIO_LED1_PIN_NUM BOARD_USER_LED1 /* Pin 6 */
206 #define GPIO_LED1_PORT_NUM 0 /* use WAKEUP GPIO0 */
207 #endif
209 /* ON Board LED pins which are connected to GPIO pins. */
210 typedef enum GPIO_LED {
211 USER_LED0 = 0,
212 USER_LED1
213 }GPIO_LED;
216 #define GPIO_PIN_VAL_LOW (0U)
217 #define GPIO_PIN_VAL_HIGH (1U)
220 #ifdef __cplusplus
221 }
222 #endif
224 #endif /* _GPIO_LOG_H */