1 // Copyright 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