refactor(uart_vfs): Move uart implementation of vfs to esp_driver_uart

Deprecated esp_vfs_dev_uart_xxx APIs
vfs_uart test case moved to esp_driver_uart test_apps
Astyle fixed for uart_vfs
This commit is contained in:
Song Ruo Jing
2023-11-24 14:56:08 +08:00
parent ef281dff5a
commit bc09031496
47 changed files with 803 additions and 514 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -13,12 +13,15 @@
extern "C" {
#endif
/**
* @brief add /dev/uart virtual filesystem driver
*
* This function is called from startup code to enable serial output
*/
void esp_vfs_dev_uart_register(void);
void esp_vfs_dev_uart_register(void) __attribute__((deprecated("Please use uart_vfs_dev_register() instead")));
void esp_vfs_dev_uart_use_nonblocking(int uart_num) __attribute__((deprecated("Please use uart_vfs_dev_use_nonblocking() instead")));
void esp_vfs_dev_uart_use_driver(int uart_num) __attribute__((deprecated("Please use uart_vfs_dev_use_driver() instead")));
int esp_vfs_dev_uart_port_set_rx_line_endings(int uart_num, esp_line_endings_t mode) __attribute__((deprecated("Please use uart_vfs_dev_port_set_rx_line_endings() instead")));
int esp_vfs_dev_uart_port_set_tx_line_endings(int uart_num, esp_line_endings_t mode) __attribute__((deprecated("Please use uart_vfs_dev_port_set_tx_line_endings() instead")));
/**
* @brief Set the line endings expected to be received on UART
@@ -34,7 +37,7 @@ void esp_vfs_dev_uart_register(void);
*
* @param mode line endings expected on UART
*/
void esp_vfs_dev_uart_set_rx_line_endings(esp_line_endings_t mode) __attribute__((deprecated("Please use esp_vfs_dev_uart_port_set_rx_line_endings")));
void esp_vfs_dev_uart_set_rx_line_endings(esp_line_endings_t mode) __attribute__((deprecated("Please use uart_vfs_dev_port_set_rx_line_endings() instead")));
/**
* @brief Set the line endings to sent to UART
@@ -50,61 +53,7 @@ void esp_vfs_dev_uart_set_rx_line_endings(esp_line_endings_t mode) __attribute__
*
* @param mode line endings to send to UART
*/
void esp_vfs_dev_uart_set_tx_line_endings(esp_line_endings_t mode) __attribute__((deprecated("Please use esp_vfs_dev_uart_port_set_tx_line_endings")));
/**
* @brief Set the line endings expected to be received on specified UART
*
* This specifies the conversion between line endings received on UART and
* newlines ('\n', LF) passed into stdin:
*
* - ESP_LINE_ENDINGS_CRLF: convert CRLF to LF
* - ESP_LINE_ENDINGS_CR: convert CR to LF
* - ESP_LINE_ENDINGS_LF: no modification
*
* @note this function is not thread safe w.r.t. reading from UART
*
* @param uart_num the UART number
* @param mode line endings to send to UART
* @return 0 if successed, or -1
* when an error (specified by errno) have occurred.
*/
int esp_vfs_dev_uart_port_set_rx_line_endings(int uart_num, esp_line_endings_t mode);
/**
* @brief Set the line endings to sent to specified UART
*
* This specifies the conversion between newlines ('\n', LF) on stdout and line
* endings sent over UART:
*
* - ESP_LINE_ENDINGS_CRLF: convert LF to CRLF
* - ESP_LINE_ENDINGS_CR: convert LF to CR
* - ESP_LINE_ENDINGS_LF: no modification
*
* @note this function is not thread safe w.r.t. writing to UART
*
* @param uart_num the UART number
* @param mode line endings to send to UART
* @return 0 if successed, or -1
* when an error (specified by errno) have occurred.
*/
int esp_vfs_dev_uart_port_set_tx_line_endings(int uart_num, esp_line_endings_t mode);
/**
* @brief set VFS to use simple functions for reading and writing UART
* Read is non-blocking, write is busy waiting until TX FIFO has enough space.
* These functions are used by default.
* @param uart_num UART peripheral number
*/
void esp_vfs_dev_uart_use_nonblocking(int uart_num);
/**
* @brief set VFS to use UART driver for reading and writing
* @note application must configure UART driver before calling these functions
* With these functions, read and write are blocking and interrupt-driven.
* @param uart_num UART peripheral number
*/
void esp_vfs_dev_uart_use_driver(int uart_num);
void esp_vfs_dev_uart_set_tx_line_endings(esp_line_endings_t mode) __attribute__((deprecated("Please use uart_vfs_dev_port_set_tx_line_endings() instead")));
/**
* @brief set VFS to use USB-SERIAL-JTAG driver for reading and writing