Lines Matching +full:conf +full:- +full:tx

2  * Copyright (c) 2023-2024 Analog Devices, Inc.
4 * SPDX-License-Identifier: Apache-2.0
37 struct uart_config conf; /* baudrate, stopbits, ... */ member
46 const struct max32_uart_config *cfg = dev->config; in api_poll_out()
48 MXC_UART_WriteCharacter(cfg->regs, c); in api_poll_out()
54 const struct max32_uart_config *cfg = dev->config; in api_poll_in()
56 val = MXC_UART_ReadCharacterRaw(cfg->regs); in api_poll_in()
60 return -1; in api_poll_in()
70 const struct max32_uart_config *cfg = dev->config; in api_err_check()
72 flags = MXC_UART_GetFlags(cfg->regs); in api_err_check()
92 const struct max32_uart_config *const cfg = dev->config; in api_configure()
93 mxc_uart_regs_t *regs = cfg->regs; in api_configure()
94 struct max32_uart_data *data = dev->data; in api_configure()
99 if (data->conf.parity != uart_cfg->parity) { in api_configure()
102 switch (uart_cfg->parity) { in api_configure()
117 return -ENOTSUP; in api_configure()
124 return -ENOTSUP; in api_configure()
127 return -EINVAL; in api_configure()
132 return -ENOTSUP; in api_configure()
135 data->conf.parity = uart_cfg->parity; in api_configure()
141 if (data->conf.stop_bits != uart_cfg->stop_bits) { in api_configure()
142 if (uart_cfg->stop_bits == UART_CFG_STOP_BITS_1) { in api_configure()
144 } else if (uart_cfg->stop_bits == UART_CFG_STOP_BITS_2) { in api_configure()
147 return -ENOTSUP; in api_configure()
150 return -ENOTSUP; in api_configure()
153 data->conf.stop_bits = uart_cfg->stop_bits; in api_configure()
158 * Valid data for MAX32 is 5-6-7-8 in api_configure()
159 * Valid data for Zepyhr is 0-1-2-3 in api_configure()
162 if (data->conf.data_bits != uart_cfg->data_bits) { in api_configure()
163 err = MXC_UART_SetDataSize(regs, (5 + uart_cfg->data_bits)); in api_configure()
165 return -ENOTSUP; in api_configure()
168 data->conf.data_bits = uart_cfg->data_bits; in api_configure()
175 if (data->conf.flow_ctrl != uart_cfg->flow_ctrl) { in api_configure()
176 if (uart_cfg->flow_ctrl != UART_CFG_FLOW_CTRL_NONE) { in api_configure()
177 return -ENOTSUP; in api_configure()
179 data->conf.flow_ctrl = uart_cfg->flow_ctrl; in api_configure()
185 if (data->conf.baudrate != uart_cfg->baudrate) { in api_configure()
186 err = Wrap_MXC_UART_SetFrequency(regs, uart_cfg->baudrate, cfg->perclk.clk_src); in api_configure()
188 return -ENOTSUP; in api_configure()
191 data->conf.baudrate = uart_cfg->baudrate; in api_configure()
200 struct max32_uart_data *data = dev->data; in api_config_get()
203 *uart_cfg = data->conf; in api_config_get()
213 const struct max32_uart_config *const cfg = dev->config; in uart_max32_init()
214 mxc_uart_regs_t *regs = cfg->regs; in uart_max32_init()
216 if (!device_is_ready(cfg->clock)) { in uart_max32_init()
218 return -ENODEV; in uart_max32_init()
226 ret = clock_control_on(cfg->clock, (clock_control_subsys_t)&cfg->perclk); in uart_max32_init()
232 ret = pinctrl_apply_state(cfg->pctrl, PINCTRL_STATE_DEFAULT); in uart_max32_init()
237 ret = api_configure(dev, &cfg->uart_conf); in uart_max32_init()
248 /* Clear any pending UART RX/TX interrupts */ in uart_max32_init()
250 cfg->irq_config_func(dev); in uart_max32_init()
261 const struct max32_uart_config *cfg = dev->config; in api_fifo_fill()
263 num_tx = MXC_UART_WriteTXFIFO(cfg->regs, (unsigned char *)tx_data, size); in api_fifo_fill()
271 const struct max32_uart_config *cfg = dev->config; in api_fifo_read()
273 num_rx = MXC_UART_ReadRXFIFO(cfg->regs, (unsigned char *)rx_data, size); in api_fifo_read()
275 MXC_UART_ClearFlags(cfg->regs, ADI_MAX32_UART_INT_RX); in api_fifo_read()
283 const struct max32_uart_config *cfg = dev->config; in api_irq_tx_enable()
286 MXC_UART_EnableInt(cfg->regs, ADI_MAX32_UART_INT_TX | ADI_MAX32_UART_INT_TX_OEM); in api_irq_tx_enable()
295 const struct max32_uart_config *cfg = dev->config; in api_irq_tx_disable()
297 MXC_UART_DisableInt(cfg->regs, ADI_MAX32_UART_INT_TX | ADI_MAX32_UART_INT_TX_OEM); in api_irq_tx_disable()
302 struct max32_uart_data *const data = dev->data; in api_irq_tx_ready()
303 const struct max32_uart_config *cfg = dev->config; in api_irq_tx_ready()
304 uint32_t inten = Wrap_MXC_UART_GetRegINTEN(cfg->regs); in api_irq_tx_ready()
307 !(data->status & MXC_F_UART_STATUS_TX_FULL)); in api_irq_tx_ready()
312 const struct max32_uart_config *cfg = dev->config; in api_irq_rx_enable()
314 MXC_UART_EnableInt(cfg->regs, ADI_MAX32_UART_INT_RX); in api_irq_rx_enable()
319 const struct max32_uart_config *cfg = dev->config; in api_irq_rx_disable()
321 MXC_UART_DisableInt(cfg->regs, ADI_MAX32_UART_INT_RX); in api_irq_rx_disable()
326 const struct max32_uart_config *cfg = dev->config; in api_irq_tx_complete()
328 if (MXC_UART_GetActive(cfg->regs) == E_BUSY) { in api_irq_tx_complete()
337 struct max32_uart_data *const data = dev->data; in api_irq_rx_ready()
338 const struct max32_uart_config *cfg = dev->config; in api_irq_rx_ready()
339 uint32_t inten = Wrap_MXC_UART_GetRegINTEN(cfg->regs); in api_irq_rx_ready()
341 return ((inten & ADI_MAX32_UART_INT_RX) && !(data->status & ADI_MAX32_UART_RX_EMPTY)); in api_irq_rx_ready()
346 const struct max32_uart_config *cfg = dev->config; in api_irq_err_enable()
348 MXC_UART_EnableInt(cfg->regs, ADI_MAX32_UART_ERROR_INTERRUPTS); in api_irq_err_enable()
353 const struct max32_uart_config *cfg = dev->config; in api_irq_err_disable()
355 MXC_UART_DisableInt(cfg->regs, ADI_MAX32_UART_ERROR_INTERRUPTS); in api_irq_err_disable()
360 struct max32_uart_data *const data = dev->data; in api_irq_is_pending()
362 return (data->flags & (ADI_MAX32_UART_INT_RX | ADI_MAX32_UART_INT_TX)); in api_irq_is_pending()
367 struct max32_uart_data *const data = dev->data; in api_irq_update()
368 const struct max32_uart_config *const cfg = dev->config; in api_irq_update()
370 data->flags = MXC_UART_GetFlags(cfg->regs); in api_irq_update()
371 data->status = MXC_UART_GetStatus(cfg->regs); in api_irq_update()
373 MXC_UART_ClearFlags(cfg->regs, data->flags); in api_irq_update()
381 struct max32_uart_data *const data = dev->data; in api_irq_callback_set()
383 data->cb = cb; in api_irq_callback_set()
384 data->cb_data = cb_data; in api_irq_callback_set()
389 struct max32_uart_data *data = dev->data; in uart_max32_isr()
391 if (data->cb) { in uart_max32_isr()
392 data->cb(dev, data->cb_data); in uart_max32_isr()