Lines Matching full:uart

11  * @brief UART driver for Atmel SAM MCU family.
19 #include <zephyr/drivers/uart.h>
26 Uart *regs;
49 Uart * const uart = cfg->regs; in uart_sam_poll_in() local
51 if (!(uart->UART_SR & UART_SR_RXRDY)) { in uart_sam_poll_in()
56 *c = (unsigned char)uart->UART_RHR; in uart_sam_poll_in()
65 Uart * const uart = cfg->regs; in uart_sam_poll_out() local
68 while (!(uart->UART_SR & UART_SR_TXRDY)) { in uart_sam_poll_out()
72 uart->UART_THR = (uint32_t)c; in uart_sam_poll_out()
79 volatile Uart * const uart = cfg->regs; in uart_sam_err_check() local
82 if (uart->UART_SR & UART_SR_OVRE) { in uart_sam_err_check()
86 if (uart->UART_SR & UART_SR_PARE) { in uart_sam_err_check()
90 if (uart->UART_SR & UART_SR_FRAME) { in uart_sam_err_check()
94 uart->UART_CR = UART_CR_RSTSTA; in uart_sam_err_check()
105 volatile Uart * const uart = cfg->regs; in uart_sam_baudrate_set() local
120 uart->UART_BRGR = UART_BRGR_CD(divisor); in uart_sam_baudrate_set()
147 volatile Uart * const uart = cfg->regs; in uart_sam_get_parity() local
149 switch (uart->UART_MR & UART_MR_PAR_Msk) { in uart_sam_get_parity()
171 volatile Uart * const uart = config->regs; in uart_sam_configure() local
180 /* Reset and disable UART */ in uart_sam_configure()
181 uart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX in uart_sam_configure()
185 /* baud rate driven by the peripheral clock, UART does not filter in uart_sam_configure()
188 uart->UART_MR = UART_MR_CHMODE_NORMAL in uart_sam_configure()
198 uart->UART_CR = UART_CR_RXEN | UART_CR_TXEN; in uart_sam_configure()
226 volatile Uart * const uart = cfg->regs; in uart_sam_fifo_fill() local
229 while ((uart->UART_SR & UART_SR_TXRDY) == 0) { in uart_sam_fifo_fill()
232 uart->UART_THR = *tx_data; in uart_sam_fifo_fill()
242 volatile Uart * const uart = cfg->regs; in uart_sam_fifo_read() local
248 if (uart->UART_SR & UART_SR_RXRDY) { in uart_sam_fifo_read()
249 rx_data[bytes_read] = uart->UART_RHR; in uart_sam_fifo_read()
263 volatile Uart * const uart = cfg->regs; in uart_sam_irq_tx_enable() local
265 uart->UART_IER = UART_IER_TXRDY; in uart_sam_irq_tx_enable()
272 volatile Uart * const uart = cfg->regs; in uart_sam_irq_tx_disable() local
274 uart->UART_IDR = UART_IDR_TXRDY; in uart_sam_irq_tx_disable()
281 volatile Uart * const uart = cfg->regs; in uart_sam_irq_tx_ready() local
286 return (uart->UART_SR & UART_SR_TXRDY && in uart_sam_irq_tx_ready()
287 uart->UART_IMR & UART_IMR_TXRDY); in uart_sam_irq_tx_ready()
294 volatile Uart * const uart = cfg->regs; in uart_sam_irq_rx_enable() local
296 uart->UART_IER = UART_IER_RXRDY; in uart_sam_irq_rx_enable()
303 volatile Uart * const uart = cfg->regs; in uart_sam_irq_rx_disable() local
305 uart->UART_IDR = UART_IDR_RXRDY; in uart_sam_irq_rx_disable()
312 volatile Uart * const uart = cfg->regs; in uart_sam_irq_tx_complete() local
314 return (uart->UART_SR & UART_SR_TXRDY && in uart_sam_irq_tx_complete()
315 uart->UART_IMR & UART_IMR_TXEMPTY); in uart_sam_irq_tx_complete()
322 volatile Uart * const uart = cfg->regs; in uart_sam_irq_rx_ready() local
324 return (uart->UART_SR & UART_SR_RXRDY); in uart_sam_irq_rx_ready()
331 volatile Uart * const uart = cfg->regs; in uart_sam_irq_err_enable() local
333 uart->UART_IER = UART_IER_OVRE | UART_IER_FRAME | UART_IER_PARE; in uart_sam_irq_err_enable()
340 volatile Uart * const uart = cfg->regs; in uart_sam_irq_err_disable() local
342 uart->UART_IDR = UART_IDR_OVRE | UART_IDR_FRAME | UART_IDR_PARE; in uart_sam_irq_err_disable()
349 volatile Uart * const uart = cfg->regs; in uart_sam_irq_is_pending() local
351 return (uart->UART_IMR & (UART_IMR_TXRDY | UART_IMR_RXRDY)) & in uart_sam_irq_is_pending()
352 (uart->UART_SR & (UART_SR_TXRDY | UART_SR_RXRDY)); in uart_sam_irq_is_pending()
391 Uart * const uart = cfg->regs; in uart_sam_init() local
393 /* Enable UART clock in PMC */ in uart_sam_init()
404 uart->UART_IDR = 0xFFFFFFFF; in uart_sam_init()
447 static const struct uart_sam_dev_cfg uart##n##_sam_config = { \
448 .regs = (Uart *)DT_INST_REG_ADDR(n), \
458 static void uart##n##_sam_irq_config_func(const struct device *port) \
467 .irq_config_func = uart##n##_sam_irq_config_func
479 static struct uart_sam_dev_data uart##n##_sam_data = { \
483 static const struct uart_sam_dev_cfg uart##n##_sam_config; \
486 NULL, &uart##n##_sam_data, \
487 &uart##n##_sam_config, PRE_KERNEL_1, \