Lines Matching +full:uart +full:- +full:dev
2 * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/drivers/uart.h>
16 UART_T *uart; member
27 static int uart_numicro_poll_in(const struct device *dev, unsigned char *c) in uart_numicro_poll_in() argument
29 const struct uart_numicro_config *config = dev->config; in uart_numicro_poll_in()
31 if ((config->uart->FIFOSTS & UART_FIFOSTS_RXEMPTY_Msk) != 0) { in uart_numicro_poll_in()
32 return -1; in uart_numicro_poll_in()
35 *c = (uint8_t)config->uart->DAT; in uart_numicro_poll_in()
40 static void uart_numicro_poll_out(const struct device *dev, unsigned char c) in uart_numicro_poll_out() argument
42 const struct uart_numicro_config *config = dev->config; in uart_numicro_poll_out()
44 UART_Write(config->uart, &c, 1); in uart_numicro_poll_out()
47 static int uart_numicro_err_check(const struct device *dev) in uart_numicro_err_check() argument
62 return -ENOTSUP; in uart_numicro_convert_stopbit()
78 return -ENOTSUP; in uart_numicro_convert_datalen()
100 static int uart_numicro_configure(const struct device *dev, in uart_numicro_configure() argument
103 const struct uart_numicro_config *config = dev->config; in uart_numicro_configure()
104 struct uart_numicro_data *ddata = dev->data; in uart_numicro_configure()
108 databits = uart_numicro_convert_datalen(cfg->data_bits); in uart_numicro_configure()
113 stopbits = uart_numicro_convert_stopbit(cfg->stop_bits); in uart_numicro_configure()
118 if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_NONE) { in uart_numicro_configure()
119 UART_DisableFlowCtrl(config->uart); in uart_numicro_configure()
120 } else if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) { in uart_numicro_configure()
121 UART_EnableFlowCtrl(config->uart); in uart_numicro_configure()
123 return -ENOTSUP; in uart_numicro_configure()
126 parity = uart_numicro_convert_parity(cfg->parity); in uart_numicro_configure()
128 UART_SetLineConfig(config->uart, cfg->baudrate, databits, parity, in uart_numicro_configure()
131 memcpy(&ddata->ucfg, cfg, sizeof(*cfg)); in uart_numicro_configure()
136 static int uart_numicro_config_get(const struct device *dev, in uart_numicro_config_get() argument
139 struct uart_numicro_data *ddata = dev->data; in uart_numicro_config_get()
141 memcpy(cfg, &ddata->ucfg, sizeof(*cfg)); in uart_numicro_config_get()
147 static int uart_numicro_init(const struct device *dev) in uart_numicro_init() argument
149 const struct uart_numicro_config *config = dev->config; in uart_numicro_init()
150 struct uart_numicro_data *ddata = dev->data; in uart_numicro_init()
153 SYS_ResetModule(config->id_rst); in uart_numicro_init()
157 /* Enable UART module clock */ in uart_numicro_init()
158 CLK_EnableModuleClock(config->id_clk); in uart_numicro_init()
161 CLK_SetModuleClock(config->id_clk, CLK_CLKSEL1_UART0SEL_PLL, in uart_numicro_init()
166 err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); in uart_numicro_init()
171 UART_Open(config->uart, ddata->ucfg.baudrate); in uart_numicro_init()
176 static DEVICE_API(uart, uart_numicro_driver_api) = {
190 .uart = (UART_T *)DT_INST_REG_ADDR(index), \
191 .id_rst = UART##index##_RST, \
192 .id_clk = UART##index##_MODULE, \