drivers: serial: define default values for basic options
Defined default values for baudrate, parity, stop bits, and data bits. This removes complexity and obfuscation from the code. Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
This commit is contained in:
parent
64585b7444
commit
0df6736bb9
27 changed files with 161 additions and 101 deletions
|
|
@ -960,12 +960,9 @@ static struct uart_altera_device_data uart_altera_dev_data_##n = { \
|
|||
.uart_cfg = \
|
||||
{ \
|
||||
.baudrate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, \
|
||||
UART_CFG_PARITY_NONE), \
|
||||
.stop_bits = DT_INST_ENUM_IDX_OR(n, stop_bits, \
|
||||
UART_CFG_STOP_BITS_1), \
|
||||
.data_bits = DT_INST_ENUM_IDX_OR(n, data_bits, \
|
||||
UART_CFG_DATA_BITS_8), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
.flow_ctrl = DT_INST_PROP(n, hw_flow_control) ? \
|
||||
UART_CFG_FLOW_CTRL_RTS_CTS : \
|
||||
UART_CFG_FLOW_CTRL_NONE, \
|
||||
|
|
|
|||
|
|
@ -617,9 +617,9 @@ static DEVICE_API(uart, uart_cc13xx_cc26xx_driver_api) = {
|
|||
uart_cc13xx_cc26xx_data_##n = { \
|
||||
.uart_config = { \
|
||||
.baudrate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = UART_CFG_PARITY_NONE, \
|
||||
.stop_bits = UART_CFG_STOP_BITS_1, \
|
||||
.data_bits = UART_CFG_DATA_BITS_8, \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE, \
|
||||
}, \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
|
|
|
|||
|
|
@ -1055,11 +1055,9 @@ static DEVICE_API(uart, uart_esp32_api) = {
|
|||
\
|
||||
static struct uart_esp32_data uart_esp32_data_##idx = { \
|
||||
.uart_config = {.baudrate = DT_INST_PROP(idx, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(idx, parity, UART_CFG_PARITY_NONE), \
|
||||
.stop_bits = DT_INST_ENUM_IDX_OR(idx, stop_bits, \
|
||||
UART_CFG_STOP_BITS_1), \
|
||||
.data_bits = DT_INST_ENUM_IDX_OR(idx, data_bits, \
|
||||
UART_CFG_DATA_BITS_8), \
|
||||
.parity = DT_INST_ENUM_IDX(idx, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(idx, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(idx, data_bits), \
|
||||
.flow_ctrl = MAX(COND_CODE_1(DT_INST_PROP(idx, hw_rs485_hd_mode), \
|
||||
(UART_CFG_FLOW_CTRL_RS485), \
|
||||
(UART_CFG_FLOW_CTRL_NONE)), \
|
||||
|
|
|
|||
|
|
@ -519,9 +519,9 @@ static DEVICE_API(uart, ifx_cat1_uart_driver_api) = {
|
|||
\
|
||||
static struct ifx_cat1_uart_config ifx_cat1_uart##n##_cfg = { \
|
||||
.dt_cfg.baudrate = DT_INST_PROP(n, current_speed), \
|
||||
.dt_cfg.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.dt_cfg.stop_bits = DT_INST_ENUM_IDX_OR(n, stop_bits, UART_CFG_STOP_BITS_1), \
|
||||
.dt_cfg.data_bits = DT_INST_ENUM_IDX_OR(n, data_bits, UART_CFG_DATA_BITS_8), \
|
||||
.dt_cfg.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.dt_cfg.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.dt_cfg.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
.dt_cfg.flow_ctrl = DT_INST_PROP(n, hw_flow_control), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
.reg_addr = (CySCB_Type *)DT_INST_REG_ADDR(n), \
|
||||
|
|
|
|||
|
|
@ -994,12 +994,9 @@ static struct uart_intel_lw_device_data uart_intel_lw_dev_data_##n = { \
|
|||
.uart_cfg = \
|
||||
{ \
|
||||
.baudrate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, \
|
||||
UART_CFG_PARITY_NONE), \
|
||||
.stop_bits = DT_INST_ENUM_IDX_OR(n, stop_bits, \
|
||||
UART_CFG_STOP_BITS_1), \
|
||||
.data_bits = DT_INST_ENUM_IDX_OR(n, data_bits, \
|
||||
UART_CFG_DATA_BITS_8), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
.flow_ctrl = DT_INST_PROP(n, hw_flow_control) ? \
|
||||
UART_CFG_FLOW_CTRL_RTS_CTS : \
|
||||
UART_CFG_FLOW_CTRL_NONE, \
|
||||
|
|
|
|||
|
|
@ -438,10 +438,10 @@ static DEVICE_API(uart, uart_max32_driver_api) = {
|
|||
.perclk.bit = DT_INST_CLOCKS_CELL(_num, bit), \
|
||||
.perclk.clk_src = \
|
||||
DT_INST_PROP_OR(_num, clock_source, ADI_MAX32_PRPH_CLK_SRC_PCLK), \
|
||||
.uart_conf.baudrate = DT_INST_PROP_OR(_num, current_speed, 115200), \
|
||||
.uart_conf.parity = DT_INST_ENUM_IDX_OR(_num, parity, UART_CFG_PARITY_NONE), \
|
||||
.uart_conf.data_bits = DT_INST_ENUM_IDX_OR(_num, data_bits, UART_CFG_DATA_BITS_8), \
|
||||
.uart_conf.stop_bits = DT_INST_ENUM_IDX_OR(_num, stop_bits, UART_CFG_STOP_BITS_1), \
|
||||
.uart_conf.baudrate = DT_INST_PROP(_num, current_speed), \
|
||||
.uart_conf.parity = DT_INST_ENUM_IDX(_num, parity), \
|
||||
.uart_conf.data_bits = DT_INST_ENUM_IDX(_num, data_bits), \
|
||||
.uart_conf.stop_bits = DT_INST_ENUM_IDX(_num, stop_bits), \
|
||||
.uart_conf.flow_ctrl = \
|
||||
DT_INST_PROP_OR(_num, hw_flow_control, UART_CFG_FLOW_CTRL_NONE), \
|
||||
IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, \
|
||||
|
|
|
|||
|
|
@ -1188,7 +1188,7 @@ static const struct mcux_flexcomm_config mcux_flexcomm_##n##_config = { \
|
|||
.clock_subsys = \
|
||||
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
|
||||
.baud_rate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
UART_MCUX_FLEXCOMM_IRQ_CFG_FUNC_INIT(n) \
|
||||
UART_MCUX_FLEXCOMM_ASYNC_CFG(n) \
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ static const struct mcux_iuart_config mcux_iuart_##n##_config = { \
|
|||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
|
||||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
|
||||
.baud_rate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
IRQ_FUNC_INIT \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1368,7 +1368,7 @@ static const struct mcux_lpuart_config mcux_lpuart_##n##_config = { \
|
|||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \
|
||||
.baud_rate = DT_INST_PROP(n, current_speed), \
|
||||
.flow_ctrl = FLOW_CONTROL(n), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.rs485_de_active_low = DT_INST_PROP(n, nxp_rs485_de_active_low), \
|
||||
.loopback_en = DT_INST_PROP(n, nxp_loopback), \
|
||||
.single_wire = DT_INST_PROP(n, single_wire), \
|
||||
|
|
|
|||
|
|
@ -491,8 +491,7 @@ static DEVICE_API(uart, neorv32_uart_driver_api) = {
|
|||
static struct neorv32_uart_data neorv32_uart_##n##_data = { \
|
||||
.uart_cfg = { \
|
||||
.baudrate = DT_PROP(node_id, current_speed), \
|
||||
.parity = DT_ENUM_IDX_OR(node_id, parity, \
|
||||
UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_ENUM_IDX(node_id, parity), \
|
||||
.stop_bits = UART_CFG_STOP_BITS_1, \
|
||||
.data_bits = UART_CFG_DATA_BITS_8, \
|
||||
.flow_ctrl = DT_PROP(node_id, hw_flow_control) ? \
|
||||
|
|
|
|||
|
|
@ -278,12 +278,10 @@ static int uart_rz_scif_init(const struct device *dev)
|
|||
static struct uart_rz_scif_data uart_rz_scif_data_##n = { \
|
||||
.uart_config = \
|
||||
{ \
|
||||
.baudrate = DT_INST_PROP_OR(n, current_speed, 115200), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.stop_bits = \
|
||||
DT_INST_ENUM_IDX_OR(n, stop_bits, UART_CFG_STOP_BITS_1), \
|
||||
.data_bits = \
|
||||
DT_INST_ENUM_IDX_OR(n, data_bits, UART_CFG_DATA_BITS_8), \
|
||||
.baudrate = DT_INST_PROP(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
.flow_ctrl = DT_INST_PROP_OR(n, hw_flow_control, \
|
||||
UART_CFG_FLOW_CTRL_NONE), \
|
||||
}, \
|
||||
|
|
|
|||
|
|
@ -427,11 +427,9 @@ static void uart_rzt2m_isr(const struct device *dev)
|
|||
.uart_cfg = \
|
||||
{ \
|
||||
.baudrate = DT_INST_ENUM_IDX(n, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.stop_bits = \
|
||||
DT_INST_ENUM_IDX_OR(n, stop_bits, UART_CFG_STOP_BITS_1), \
|
||||
.data_bits = \
|
||||
DT_INST_ENUM_IDX_OR(n, data_bits, UART_CFG_DATA_BITS_8), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(n, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(n, data_bits), \
|
||||
}, \
|
||||
}; \
|
||||
UART_RZT2M_CONFIG_FUNC(n); \
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ static int usart_si32_init(const struct device *dev)
|
|||
static const struct usart_si32_config usart_si32_cfg_##index = { \
|
||||
.usart = (SI32_USART_A_Type *)DT_INST_REG_ADDR(index), \
|
||||
.hw_flow_control = DT_INST_PROP(index, hw_flow_control), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(index, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(index, parity), \
|
||||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(index)), \
|
||||
SI32_USART_IRQ_HANDLER_FUNC(index)}; \
|
||||
\
|
||||
|
|
|
|||
|
|
@ -2345,18 +2345,13 @@ static void uart_stm32_irq_config_func_##index(const struct device *dev) \
|
|||
*/
|
||||
#define STM32_UART_CHECK_DT_PARITY(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_INST_ENUM_IDX_OR(index, parity, STM32_UART_DEFAULT_PARITY) \
|
||||
== UART_CFG_PARITY_MARK || \
|
||||
DT_INST_ENUM_IDX_OR(index, parity, STM32_UART_DEFAULT_PARITY) \
|
||||
== UART_CFG_PARITY_SPACE), \
|
||||
!(DT_INST_ENUM_IDX(index, parity) == UART_CFG_PARITY_MARK || \
|
||||
DT_INST_ENUM_IDX(index, parity) == UART_CFG_PARITY_SPACE), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported parity configuration"); \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_INST_ENUM_IDX_OR(index, parity, STM32_UART_DEFAULT_PARITY) \
|
||||
!= UART_CFG_PARITY_NONE && \
|
||||
DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_9), \
|
||||
!(DT_INST_ENUM_IDX(index, parity) != UART_CFG_PARITY_NONE && \
|
||||
DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_9), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported parity + data bits combination");
|
||||
|
||||
|
|
@ -2367,32 +2362,18 @@ BUILD_ASSERT( \
|
|||
#ifdef LL_USART_DATAWIDTH_7B
|
||||
#define STM32_UART_CHECK_DT_DATA_BITS(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_5 || \
|
||||
(DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_6 && \
|
||||
DT_INST_ENUM_IDX_OR(index, parity, \
|
||||
STM32_UART_DEFAULT_PARITY) \
|
||||
== UART_CFG_PARITY_NONE)), \
|
||||
!(DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_5 || \
|
||||
(DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_6 && \
|
||||
DT_INST_ENUM_IDX(index, parity) == UART_CFG_PARITY_NONE)), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported data bits configuration");
|
||||
#else
|
||||
#define STM32_UART_CHECK_DT_DATA_BITS(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_5 || \
|
||||
DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_6 || \
|
||||
(DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS) \
|
||||
== UART_CFG_DATA_BITS_7 && \
|
||||
DT_INST_ENUM_IDX_OR(index, parity, \
|
||||
STM32_UART_DEFAULT_PARITY) \
|
||||
== UART_CFG_PARITY_NONE)), \
|
||||
!(DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_5 || \
|
||||
DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_6 || \
|
||||
(DT_INST_ENUM_IDX(index, data_bits) == UART_CFG_DATA_BITS_7 && \
|
||||
DT_INST_ENUM_IDX(index, parity) == UART_CFG_PARITY_NONE)), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported data bits configuration");
|
||||
#endif
|
||||
|
|
@ -2404,9 +2385,7 @@ BUILD_ASSERT( \
|
|||
#ifndef LL_USART_STOPBITS_0_5
|
||||
#define STM32_UART_CHECK_DT_STOP_BITS_0_5(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_INST_ENUM_IDX_OR(index, stop_bits, \
|
||||
STM32_UART_DEFAULT_STOP_BITS) \
|
||||
== UART_CFG_STOP_BITS_0_5), \
|
||||
DT_INST_ENUM_IDX(index, stop_bits) != UART_CFG_STOP_BITS_0_5, \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported stop bits configuration");
|
||||
/* LPUARTs don't support 0.5 stop bits configurations */
|
||||
|
|
@ -2414,9 +2393,7 @@ BUILD_ASSERT( \
|
|||
#define STM32_UART_CHECK_DT_STOP_BITS_0_5(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_HAS_COMPAT_STATUS_OKAY(st_stm32_lpuart) && \
|
||||
DT_INST_ENUM_IDX_OR(index, stop_bits, \
|
||||
STM32_UART_DEFAULT_STOP_BITS) \
|
||||
== UART_CFG_STOP_BITS_0_5), \
|
||||
DT_INST_ENUM_IDX(index, stop_bits) == UART_CFG_STOP_BITS_0_5), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported stop bits configuration");
|
||||
#endif
|
||||
|
|
@ -2428,9 +2405,7 @@ BUILD_ASSERT( \
|
|||
#ifndef LL_USART_STOPBITS_1_5
|
||||
#define STM32_UART_CHECK_DT_STOP_BITS_1_5(index) \
|
||||
BUILD_ASSERT( \
|
||||
DT_INST_ENUM_IDX_OR(index, stop_bits, \
|
||||
STM32_UART_DEFAULT_STOP_BITS) \
|
||||
!= UART_CFG_STOP_BITS_1_5, \
|
||||
DT_INST_ENUM_IDX(index, stop_bits) != UART_CFG_STOP_BITS_1_5, \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported stop bits configuration");
|
||||
/* LPUARTs don't support 1.5 stop bits configurations */
|
||||
|
|
@ -2438,9 +2413,7 @@ BUILD_ASSERT( \
|
|||
#define STM32_UART_CHECK_DT_STOP_BITS_1_5(index) \
|
||||
BUILD_ASSERT( \
|
||||
!(DT_HAS_COMPAT_STATUS_OKAY(st_stm32_lpuart) && \
|
||||
DT_INST_ENUM_IDX_OR(index, stop_bits, \
|
||||
STM32_UART_DEFAULT_STOP_BITS) \
|
||||
== UART_CFG_STOP_BITS_1_5), \
|
||||
DT_INST_ENUM_IDX(index, stop_bits) == UART_CFG_STOP_BITS_1_5), \
|
||||
"Node " DT_NODE_PATH(DT_DRV_INST(index)) \
|
||||
" has unsupported stop bits configuration");
|
||||
#endif
|
||||
|
|
@ -2454,14 +2427,10 @@ static const struct stm32_pclken pclken_##index[] = \
|
|||
STM32_DT_INST_CLOCKS(index);\
|
||||
\
|
||||
static struct uart_config uart_cfg_##index = { \
|
||||
.baudrate = DT_INST_PROP_OR(index, current_speed, \
|
||||
STM32_UART_DEFAULT_BAUDRATE), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(index, parity, \
|
||||
STM32_UART_DEFAULT_PARITY), \
|
||||
.stop_bits = DT_INST_ENUM_IDX_OR(index, stop_bits, \
|
||||
STM32_UART_DEFAULT_STOP_BITS), \
|
||||
.data_bits = DT_INST_ENUM_IDX_OR(index, data_bits, \
|
||||
STM32_UART_DEFAULT_DATA_BITS), \
|
||||
.baudrate = DT_INST_PROP(index, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX(index, parity), \
|
||||
.stop_bits = DT_INST_ENUM_IDX(index, stop_bits), \
|
||||
.data_bits = DT_INST_ENUM_IDX(index, data_bits), \
|
||||
.flow_ctrl = DT_INST_PROP(index, hw_flow_control) \
|
||||
? UART_CFG_FLOW_CTRL_RTS_CTS \
|
||||
: UART_CFG_FLOW_CTRL_NONE, \
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@
|
|||
|
||||
#include <stm32_ll_usart.h>
|
||||
|
||||
#define STM32_UART_DEFAULT_BAUDRATE 115200
|
||||
#define STM32_UART_DEFAULT_PARITY UART_CFG_PARITY_NONE
|
||||
#define STM32_UART_DEFAULT_STOP_BITS UART_CFG_STOP_BITS_1
|
||||
#define STM32_UART_DEFAULT_DATA_BITS UART_CFG_DATA_BITS_8
|
||||
|
||||
/* device config */
|
||||
struct uart_stm32_config {
|
||||
/* USART instance */
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ static DEVICE_API(uart, usart_wch_driver_api) = {
|
|||
static const struct usart_wch_config usart_wch_##idx##_config = { \
|
||||
.regs = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \
|
||||
.current_speed = DT_INST_PROP(idx, current_speed), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(idx, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(idx, parity), \
|
||||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \
|
||||
.clock_id = DT_INST_CLOCKS_CELL(idx, id), \
|
||||
.pin_cfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ static DEVICE_API(uart, usart_gd32_driver_api) = {
|
|||
.clkid = DT_INST_CLOCKS_CELL(n, id), \
|
||||
.reset = RESET_DT_SPEC_INST_GET(n), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \
|
||||
.parity = DT_INST_ENUM_IDX(n, parity), \
|
||||
GD32_USART_IRQ_HANDLER_FUNC_INIT(n) \
|
||||
}; \
|
||||
DEVICE_DT_INST_DEFINE(n, usart_gd32_init, \
|
||||
|
|
|
|||
|
|
@ -34,3 +34,18 @@ properties:
|
|||
- 5: "ADI_MAX32_PRPH_CLK_SRC_INRO" Internal Ring Oscillator
|
||||
The target device might not support all option please take a look on
|
||||
target device user guide
|
||||
|
||||
current-speed:
|
||||
description: |
|
||||
Initial baud rate setting for UART. Defaults to standard baudrate of 115200 if not specified.
|
||||
default: 115200
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
|
|
|||
|
|
@ -13,6 +13,16 @@ properties:
|
|||
required: true
|
||||
description: Default baudrate of the uart controller.
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
||||
fixed-baudrate:
|
||||
type: boolean
|
||||
description: |
|
||||
|
|
|
|||
|
|
@ -14,6 +14,16 @@ properties:
|
|||
pinctrl-names:
|
||||
required: true
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
||||
hw-rs485-hd-mode:
|
||||
type: boolean
|
||||
description: |
|
||||
|
|
|
|||
|
|
@ -39,3 +39,13 @@ properties:
|
|||
|
||||
pinctrl-names:
|
||||
required: true
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
|
|
|||
|
|
@ -17,3 +17,13 @@ properties:
|
|||
type: boolean
|
||||
description: |
|
||||
Baud rate cannot be changed by software (Divisor register is not writable)
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@ compatible: "renesas,rz-scif-uart"
|
|||
include: [uart-controller.yaml, pinctrl-device.yaml]
|
||||
|
||||
properties:
|
||||
current-speed:
|
||||
description: |
|
||||
Initial baud rate setting for UART. Defaults to standard baudrate of 115200 if not specified.
|
||||
default: 115200
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
||||
channel:
|
||||
type: int
|
||||
required: true
|
||||
|
|
|
|||
|
|
@ -22,5 +22,15 @@ properties:
|
|||
- 9600
|
||||
- 115200
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
||||
interrupts:
|
||||
required: true
|
||||
|
|
|
|||
|
|
@ -25,6 +25,21 @@ properties:
|
|||
interrupts:
|
||||
required: true
|
||||
|
||||
current-speed:
|
||||
description: |
|
||||
Initial baud rate setting for UART. Defaults to standard baudrate of 115200 if not specified.
|
||||
default: 115200
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
||||
single-wire:
|
||||
type: boolean
|
||||
description: |
|
||||
|
|
|
|||
|
|
@ -13,3 +13,16 @@ properties:
|
|||
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
current-speed:
|
||||
required: true
|
||||
|
||||
stop-bits:
|
||||
description: |
|
||||
Sets the number of stop bits. Defaults to standard of 1 if not specified.
|
||||
default: "1"
|
||||
|
||||
data-bits:
|
||||
description: |
|
||||
Sets the number of data bits. Defaults to standard of 8 if not specified.
|
||||
default: 8
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ properties:
|
|||
- "none"
|
||||
- "odd"
|
||||
- "even"
|
||||
default: "none"
|
||||
stop-bits:
|
||||
type: string
|
||||
description: |
|
||||
|
|
|
|||
Loading…
Reference in a new issue