esp_rom: extract common uart apis into esp_rom_uart.h

This commit is contained in:
morris
2020-07-13 21:33:23 +08:00
parent e04eacbe3f
commit 345606e7f3
44 changed files with 274 additions and 150 deletions

View File

@@ -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;
}