[processor-sdk/pdk.git] / packages / ti / board / diag / boot_switch / build / am64x_evm / boot_switch_config.c
1 /******************************************************************************\r
2 * Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com\r
3 *\r
4 * Redistribution and use in source and binary forms, with or without\r
5 * modification, are permitted provided that the following conditions\r
6 * are met:\r
7 *\r
8 * Redistributions of source code must retain the above copyright\r
9 * notice, this list of conditions and the following disclaimer.\r
10 *\r
11 * Redistributions in binary form must reproduce the above copyright\r
12 * notice, this list of conditions and the following disclaimer in the\r
13 * documentation and/or other materials provided with the\r
14 * distribution.\r
15 *\r
16 * Neither the name of Texas Instruments Incorporated nor the names of\r
17 * its contributors may be used to endorse or promote products derived\r
18 * from this software without specific prior written permission.\r
19 *\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31 *\r
32 *****************************************************************************/\r
33 \r
34 /**\r
35 * \file boot_switch_config.c\r
36 *\r
37 * \brief Boot switch gpio configuration file.\r
38 *\r
39 */\r
40 #include <stdio.h>\r
41 #include <ti/drv/gpio/GPIO.h>\r
42 #include <ti/csl/soc.h>\r
43 #include <ti/drv/gpio/soc/GPIO_soc.h>\r
44 \r
45 /*\r
46 Port and pin number mask for GPIO.\r
47 Bits 7-0: Pin number and Bits 15-8: Port number */\r
48 \r
49 #define BOARD_BOOT_SW2_GPIO_PIN1 (0x000FU) /* GPIO0_15 */\r
50 #define BOARD_BOOT_SW2_GPIO_PIN2 (0x0010U) /* GPIO0_16 */\r
51 #define BOARD_BOOT_SW2_GPIO_PIN3 (0x0011U) /* GPIO0_17 */\r
52 #define BOARD_BOOT_SW2_GPIO_PIN4 (0x0012U) /* GPIO0_18 */\r
53 #define BOARD_BOOT_SW2_GPIO_PIN5 (0x0013U) /* GPIO0_19 */\r
54 #define BOARD_BOOT_SW2_GPIO_PIN6 (0x0014U) /* GPIO0_20 */\r
55 #define BOARD_BOOT_SW2_GPIO_PIN7 (0x0015U) /* GPIO0_21 */\r
56 #define BOARD_BOOT_SW2_GPIO_PIN8 (0x0016U) /* GPIO0_22 */\r
57 \r
58 #define BOARD_BOOT_SW3_GPIO_PIN1 (0x0017U) /* GPIO0_23 */\r
59 #define BOARD_BOOT_SW3_GPIO_PIN2 (0x0018U) /* GPIO0_24 */\r
60 #define BOARD_BOOT_SW3_GPIO_PIN3 (0x0019U) /* GPIO0_25 */\r
61 #define BOARD_BOOT_SW3_GPIO_PIN4 (0x001AU) /* GPIO0_26 */\r
62 #define BOARD_BOOT_SW3_GPIO_PIN5 (0x001BU) /* GPIO0_27 */\r
63 #define BOARD_BOOT_SW3_GPIO_PIN6 (0x001CU) /* GPIO0_28 */\r
64 #define BOARD_BOOT_SW3_GPIO_PIN7 (0x001DU) /* GPIO0_29 */\r
65 #define BOARD_BOOT_SW3_GPIO_PIN8 (0x001EU) /* GPIO0_30 */\r
66 \r
67 #define PIN1 (BOARD_BOOT_SW2_GPIO_PIN1)\r
68 #define PIN2 (BOARD_BOOT_SW2_GPIO_PIN2)\r
69 #define PIN3 (BOARD_BOOT_SW2_GPIO_PIN3)\r
70 #define PIN4 (BOARD_BOOT_SW2_GPIO_PIN4)\r
71 #define PIN5 (BOARD_BOOT_SW2_GPIO_PIN5)\r
72 #define PIN6 (BOARD_BOOT_SW2_GPIO_PIN6)\r
73 #define PIN7 (BOARD_BOOT_SW2_GPIO_PIN7)\r
74 #define PIN8 (BOARD_BOOT_SW2_GPIO_PIN8)\r
75 \r
76 #define PIN9 (BOARD_BOOT_SW3_GPIO_PIN1)\r
77 #define PIN10 (BOARD_BOOT_SW3_GPIO_PIN2)\r
78 #define PIN11 (BOARD_BOOT_SW3_GPIO_PIN3)\r
79 #define PIN12 (BOARD_BOOT_SW3_GPIO_PIN4)\r
80 #define PIN13 (BOARD_BOOT_SW3_GPIO_PIN5)\r
81 #define PIN14 (BOARD_BOOT_SW3_GPIO_PIN6)\r
82 #define PIN15 (BOARD_BOOT_SW3_GPIO_PIN7)\r
83 #define PIN16 (BOARD_BOOT_SW3_GPIO_PIN8)\r
84 \r
85 /* GPIO Driver board specific pin configuration structure */\r
86 GPIO_PinConfig gpioPinConfigs[] = {\r
87 PIN1 | GPIO_CFG_INPUT,\r
88 PIN2 | GPIO_CFG_INPUT,\r
89 PIN3 | GPIO_CFG_INPUT,\r
90 PIN4 | GPIO_CFG_INPUT,\r
91 PIN5 | GPIO_CFG_INPUT,\r
92 PIN6 | GPIO_CFG_INPUT,\r
93 PIN7 | GPIO_CFG_INPUT,\r
94 PIN8 | GPIO_CFG_INPUT,\r
95 PIN9 | GPIO_CFG_INPUT,\r
96 PIN10 | GPIO_CFG_INPUT,\r
97 PIN11 | GPIO_CFG_INPUT,\r
98 PIN12 | GPIO_CFG_INPUT,\r
99 PIN13 | GPIO_CFG_INPUT,\r
100 PIN14 | GPIO_CFG_INPUT,\r
101 PIN15 | GPIO_CFG_INPUT,\r
102 PIN16 | GPIO_CFG_INPUT,\r
103 };\r
104 \r
105 /* GPIO Driver call back functions */\r
106 GPIO_CallbackFxn gpioCallbackFunctions[] = {\r
107 NULL,\r
108 NULL,\r
109 NULL,\r
110 NULL,\r
111 NULL,\r
112 NULL,\r
113 NULL,\r
114 NULL,\r
115 NULL,\r
116 NULL,\r
117 NULL,\r
118 NULL,\r
119 NULL,\r
120 NULL,\r
121 NULL,\r
122 NULL,\r
123 };\r
124 \r
125 /* GPIO Driver configuration structure */\r
126 GPIO_v0_Config GPIO_v0_config = {\r
127 gpioPinConfigs,\r
128 gpioCallbackFunctions,\r
129 sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),\r
130 sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),\r
131 0,\r
132 };\r