serial: introduce CONFIG_UART_USE_RUNTIME_CONFIGURE
This kconfig option enables runtime configuration of UART controllers. This allows application to call uart_configure() to configure the UART controllers and calling uart_config_get() to retrieve configuration. If this is disabled, UART controllers rely on UART driver's initialization function to properly configure the controller. The main use of this option is mainly code size reduction. Fixes #16231 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
e1d16b9ed4
commit
4e1692f85a
15 changed files with 77 additions and 1 deletions
|
@ -161,6 +161,7 @@ static int uart_esp32_err_check(const struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
|
||||
static int uart_esp32_config_get(const struct device *dev,
|
||||
struct uart_config *cfg)
|
||||
{
|
||||
|
@ -186,6 +187,7 @@ static int uart_esp32_config_get(const struct device *dev,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */
|
||||
|
||||
static int uart_esp32_set_baudrate(const struct device *dev, int baudrate)
|
||||
{
|
||||
|
@ -441,8 +443,10 @@ static const DRAM_ATTR struct uart_driver_api uart_esp32_api = {
|
|||
.poll_in = uart_esp32_poll_in,
|
||||
.poll_out = uart_esp32_poll_out,
|
||||
.err_check = uart_esp32_err_check,
|
||||
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
|
||||
.configure = uart_esp32_configure,
|
||||
.config_get = uart_esp32_config_get,
|
||||
#endif
|
||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||
.fifo_fill = uart_esp32_fifo_fill,
|
||||
.fifo_read = uart_esp32_fifo_read,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue