1 /*
2  * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <esp_rom_uart.h>
8 #include <hal/uart_ll.h>
9 #include <soc/uart_periph.h>
10 
11 #if CONFIG_ESP_CONSOLE_UART_CUSTOM
12 static uart_dev_t *alt_console_uart_dev = (CONFIG_ESP_CONSOLE_UART_NUM == 0) ?
13                                           &UART0 :
14                                           (CONFIG_ESP_CONSOLE_UART_NUM == 1) ?
15                                           &UART1 :
16                                           &UART2;
17 
esp_rom_uart_putc(char c)18 void IRAM_ATTR esp_rom_uart_putc(char c)
19 {
20     while (uart_ll_get_txfifo_len(alt_console_uart_dev) == 0);
21     uart_ll_write_txfifo(alt_console_uart_dev, (const uint8_t *) &c, 1);
22 }
23 #endif
24 
25