1 // Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "soc/uart_periph.h"
16 
17 /*
18  Bunch of constants for every UART peripheral: GPIO signals, irqs, hw addr of registers etc
19 */
20 const uart_signal_conn_t uart_periph_signal[SOC_UART_NUM] = {
21     {
22         .pins = {
23             [SOC_UART_TX_PIN_IDX] = {
24                 .default_gpio = U0TXD_GPIO_NUM,
25                 .iomux_func = U0TXD_MUX_FUNC,
26                 .input = 0,
27                 .signal = U0TXD_OUT_IDX,
28             },
29 
30             [SOC_UART_RX_PIN_IDX] = {
31                 .default_gpio = U0RXD_GPIO_NUM,
32                 .iomux_func = U0RXD_MUX_FUNC,
33                 .input = 1,
34                 .signal = U0RXD_IN_IDX,
35             },
36 
37             [SOC_UART_RTS_PIN_IDX] = {
38                 .default_gpio = U0RTS_GPIO_NUM,
39                 .iomux_func = U0RTS_MUX_FUNC,
40                 .input = 0,
41                 .signal = U0RTS_OUT_IDX,
42             },
43 
44             [SOC_UART_CTS_PIN_IDX] = {
45                 .default_gpio = U0CTS_GPIO_NUM,
46                 .iomux_func = U0CTS_MUX_FUNC,
47                 .input = 1,
48                 .signal = U0CTS_IN_IDX,
49             }
50         },
51         .irq = ETS_UART0_INTR_SOURCE,
52         .module = PERIPH_UART0_MODULE,
53     },
54 
55     {
56         .pins = {
57             [SOC_UART_TX_PIN_IDX] = {
58                 .default_gpio = U1TXD_GPIO_NUM,
59                 .iomux_func = U1TXD_MUX_FUNC,
60                 .input = 0,
61                 .signal = U1TXD_OUT_IDX,
62             },
63 
64             [SOC_UART_RX_PIN_IDX] = {
65                 .default_gpio = U1RXD_GPIO_NUM,
66                 .iomux_func = U1RXD_MUX_FUNC,
67                 .input = 1,
68                 .signal = U1RXD_IN_IDX,
69             },
70 
71             [SOC_UART_RTS_PIN_IDX] = {
72                 .default_gpio = U1RTS_GPIO_NUM,
73                 .iomux_func = U1RTS_MUX_FUNC,
74                 .input = 0,
75                 .signal = U1RTS_OUT_IDX,
76             },
77 
78             [SOC_UART_CTS_PIN_IDX] = {
79                 .default_gpio = U1CTS_GPIO_NUM,
80                 .iomux_func = U1CTS_MUX_FUNC,
81                 .input = 1,
82                 .signal = U1CTS_IN_IDX,
83             },
84         },
85         .irq = ETS_UART1_INTR_SOURCE,
86         .module = PERIPH_UART1_MODULE,
87     },
88 
89     {
90         .pins = {
91             [SOC_UART_TX_PIN_IDX] = {
92                 .default_gpio = U2TXD_GPIO_NUM,
93                 .iomux_func = U2TXD_MUX_FUNC,
94                 .input = 0,
95                 .signal = U2TXD_OUT_IDX,
96             },
97 
98             [SOC_UART_RX_PIN_IDX] = {
99                 .default_gpio = U2RXD_GPIO_NUM,
100                 .iomux_func = U2RXD_MUX_FUNC,
101                 .input = 1,
102                 .signal = U2RXD_IN_IDX,
103             },
104 
105             [SOC_UART_RTS_PIN_IDX] = {
106                 .default_gpio = U2RTS_GPIO_NUM,
107                 .iomux_func = U2RTS_MUX_FUNC,
108                 .input = 0,
109                 .signal = U2RTS_OUT_IDX,
110             },
111 
112             [SOC_UART_CTS_PIN_IDX] = {
113                 .default_gpio = U2CTS_GPIO_NUM,
114                 .iomux_func = U2CTS_MUX_FUNC,
115                 .input = 1,
116                 .signal = U2CTS_IN_IDX,
117             }
118         },
119         .irq = ETS_UART2_INTR_SOURCE,
120         .module = PERIPH_UART2_MODULE,
121     }
122 };
123