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 #include <esp_attr.h>
11 
12 #if CONFIG_ESP_CONSOLE_UART_CUSTOM
13 static uart_dev_t *alt_console_uart_dev = (CONFIG_ESP_CONSOLE_UART_NUM == 0) ?
14                                           &UART0 :
15                                           &UART1;
16 
esp_rom_uart_putc(char c)17 void IRAM_ATTR esp_rom_uart_putc(char c)
18 {
19     while (uart_ll_get_txfifo_len(alt_console_uart_dev) == 0);
20     uart_ll_write_txfifo(alt_console_uart_dev, (const uint8_t *) &c, 1);
21 }
22 #endif
23 
24