mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp_rom: extract common uart apis into esp_rom_uart.h
This commit is contained in:
@@ -19,11 +19,7 @@
|
||||
#include <sys/termios.h>
|
||||
#include <sys/errno.h>
|
||||
#include "unity.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/uart.h"
|
||||
#endif
|
||||
#include "esp_rom_uart.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
@@ -35,11 +31,11 @@
|
||||
|
||||
static void fwrite_str_loopback(const char* str, size_t size)
|
||||
{
|
||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
UART0.conf0.loopback = 1;
|
||||
fwrite(str, 1, size, stdout);
|
||||
fflush(stdout);
|
||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS);
|
||||
UART0.conf0.loopback = 0;
|
||||
}
|
||||
@@ -52,7 +48,7 @@ static void flush_stdin_stdout(void)
|
||||
;
|
||||
}
|
||||
fflush(stdout);
|
||||
uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
|
||||
}
|
||||
|
||||
TEST_CASE("can read from stdin", "[vfs]")
|
||||
|
@@ -26,11 +26,7 @@
|
||||
#include "driver/uart.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "driver/uart_select.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/uart.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/uart.h"
|
||||
#endif
|
||||
#include "esp_rom_uart.h"
|
||||
|
||||
// TODO: make the number of UARTs chip dependent
|
||||
#define UART_NUM SOC_UART_NUM
|
||||
@@ -352,7 +348,7 @@ static int uart_fsync(int fd)
|
||||
{
|
||||
assert(fd >= 0 && fd < 3);
|
||||
_lock_acquire_recursive(&s_ctx[fd]->write_lock);
|
||||
uart_tx_wait_idle((uint8_t) fd);
|
||||
esp_rom_uart_tx_wait_idle((uint8_t) fd);
|
||||
_lock_release_recursive(&s_ctx[fd]->write_lock);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user