Lines Matching full:usart
11 * @brief USART driver for Atmel SAM MCU family.
26 Usart *regs;
50 Usart * const usart = config->regs; in usart_sam_poll_in() local
52 if (!(usart->US_CSR & US_CSR_RXRDY)) { in usart_sam_poll_in()
57 *c = (unsigned char)usart->US_RHR; in usart_sam_poll_in()
66 Usart * const usart = config->regs; in usart_sam_poll_out() local
69 while (!(usart->US_CSR & US_CSR_TXRDY)) { in usart_sam_poll_out()
73 usart->US_THR = (uint32_t)c; in usart_sam_poll_out()
80 volatile Usart * const usart = config->regs; in usart_sam_err_check() local
83 if (usart->US_CSR & US_CSR_OVRE) { in usart_sam_err_check()
87 if (usart->US_CSR & US_CSR_PARE) { in usart_sam_err_check()
91 if (usart->US_CSR & US_CSR_FRAME) { in usart_sam_err_check()
104 volatile Usart * const usart = config->regs; in usart_sam_baudrate_set() local
119 usart->US_BRGR = US_BRGR_CD(divisor); in usart_sam_baudrate_set()
146 volatile Usart * const usart = config->regs; in usart_sam_get_parity() local
148 switch (usart->US_MR & US_MR_PAR_Msk) { in usart_sam_get_parity()
180 volatile Usart * const usart = config->regs; in usart_sam_get_stop_bits() local
182 switch (usart->US_MR & US_MR_NBSTOP_Msk) { in usart_sam_get_stop_bits()
212 volatile Usart * const usart = config->regs; in usart_sam_get_data_bits() local
214 switch (usart->US_MR & US_MR_CHRL_Msk) { in usart_sam_get_data_bits()
242 volatile Usart * const usart = config->regs; in usart_sam_get_flow_ctrl() local
244 switch (usart->US_MR & US_MR_USART_MODE_Msk) { in usart_sam_get_flow_ctrl()
260 volatile Usart * const usart = config->regs; in usart_sam_configure() local
269 /* Reset and disable USART */ in usart_sam_configure()
270 usart->US_CR = US_CR_RSTRX | US_CR_RSTTX in usart_sam_configure()
277 usart->US_MR = US_MR_CHMODE_NORMAL in usart_sam_configure()
291 usart->US_CR = US_CR_RXEN | US_CR_TXEN; in usart_sam_configure()
318 volatile Usart * const usart = config->regs; in usart_sam_fifo_fill() local
321 while ((usart->US_CSR & US_CSR_TXRDY) == 0) { in usart_sam_fifo_fill()
324 usart->US_THR = *tx_data; in usart_sam_fifo_fill()
334 volatile Usart * const usart = config->regs; in usart_sam_fifo_read() local
340 if (usart->US_CSR & US_CSR_RXRDY) { in usart_sam_fifo_read()
341 rx_data[bytes_read] = usart->US_RHR; in usart_sam_fifo_read()
355 volatile Usart * const usart = config->regs; in usart_sam_irq_tx_enable() local
357 usart->US_IER = US_IER_TXRDY; in usart_sam_irq_tx_enable()
364 volatile Usart * const usart = config->regs; in usart_sam_irq_tx_disable() local
366 usart->US_IDR = US_IDR_TXRDY; in usart_sam_irq_tx_disable()
373 volatile Usart * const usart = config->regs; in usart_sam_irq_tx_ready() local
378 return (usart->US_CSR & US_CSR_TXRDY && in usart_sam_irq_tx_ready()
379 usart->US_IMR & US_IMR_TXRDY); in usart_sam_irq_tx_ready()
386 volatile Usart * const usart = config->regs; in usart_sam_irq_rx_enable() local
388 usart->US_IER = US_IER_RXRDY; in usart_sam_irq_rx_enable()
395 volatile Usart * const usart = config->regs; in usart_sam_irq_rx_disable() local
397 usart->US_IDR = US_IDR_RXRDY; in usart_sam_irq_rx_disable()
404 volatile Usart * const usart = config->regs; in usart_sam_irq_tx_complete() local
406 return (usart->US_CSR & US_CSR_TXRDY && in usart_sam_irq_tx_complete()
407 usart->US_CSR & US_CSR_TXEMPTY); in usart_sam_irq_tx_complete()
414 volatile Usart * const usart = config->regs; in usart_sam_irq_rx_ready() local
416 return (usart->US_CSR & US_CSR_RXRDY); in usart_sam_irq_rx_ready()
423 volatile Usart * const usart = config->regs; in usart_sam_irq_err_enable() local
425 usart->US_IER = US_IER_OVRE | US_IER_FRAME | US_IER_PARE; in usart_sam_irq_err_enable()
432 volatile Usart * const usart = config->regs; in usart_sam_irq_err_disable() local
434 usart->US_IDR = US_IDR_OVRE | US_IDR_FRAME | US_IDR_PARE; in usart_sam_irq_err_disable()
441 volatile Usart * const usart = config->regs; in usart_sam_irq_is_pending() local
443 return (usart->US_IMR & (US_IMR_TXRDY | US_IMR_RXRDY)) & in usart_sam_irq_is_pending()
444 (usart->US_CSR & (US_CSR_TXRDY | US_CSR_RXRDY)); in usart_sam_irq_is_pending()
483 Usart * const usart = cfg->regs; in usart_sam_init() local
485 /* Enable USART clock in PMC */ in usart_sam_init()
496 usart->US_IDR = 0xFFFFFFFF; in usart_sam_init()
542 static const struct usart_sam_dev_cfg usart##n##_sam_config = { \
543 .regs = (Usart *)DT_INST_REG_ADDR(n), \
554 static void usart##n##_sam_irq_config_func(const struct device *port) \
563 .irq_config_func = usart##n##_sam_irq_config_func
575 static struct usart_sam_dev_data usart##n##_sam_data = { \
579 static const struct usart_sam_dev_cfg usart##n##_sam_config; \
583 &usart##n##_sam_data, \
584 &usart##n##_sam_config, PRE_KERNEL_1, \