Lines Matching full:uart

1 /* stellarisUartDrv.c - Stellaris UART driver */
12 * @brief Driver for Stellaris UART
14 * Driver for Stellaris UART found namely on TI LM3S6965 board. It is similar to
16 * It is also register-compatible with the UART found on TI CC2650 SoC,
28 #include <zephyr/drivers/uart.h>
34 /* Stellaris UART module */
72 volatile struct _uart *uart; member
120 * This routine set the given baud rate for the UART.
122 * @param dev UART device struct
150 config->uart->ibrd = (uint16_t)(brdi & 0xffff); /* 16 bits */ in baudrate_set()
151 config->uart->fbrd = (uint8_t)(brdf & 0x3f); /* 6 bits */ in baudrate_set()
155 * @brief Enable the UART
157 * This routine enables the given UART.
159 * @param dev UART device struct
165 config->uart->ctl |= UARTCTL_UARTEN; in enable()
169 * @brief Disable the UART
171 * This routine disables the given UART.
173 * @param dev UART device struct
179 config->uart->ctl &= ~UARTCTL_UARTEN; in disable()
182 while (config->uart->fr & UARTFR_BUSY) { in disable()
186 config->uart->lcrh &= ~UARTLCRH_FEN; in disable()
200 * @brief Set the default UART line controls
202 * This routine sets the given UART's line controls to their default settings.
204 * @param dev UART device struct
210 config->uart->lcrh = LINE_CONTROL_DEFAULTS; in line_control_defaults_set()
214 * @brief Initialize UART channel
217 * It is assumed that this function is called only once per UART.
219 * @param dev UART device struct
241 * @brief Get the UART transmit ready status
243 * This routine returns the given UART's transmit ready status.
245 * @param dev UART device struct
253 return (config->uart->fr & UARTFR_TXFE); in poll_tx_ready()
259 * @param dev UART device struct
269 if (config->uart->fr & UARTFR_RXFE) { in uart_stellaris_poll_in()
274 *c = (unsigned char)config->uart->dr; in uart_stellaris_poll_in()
285 * @param dev UART device struct
297 config->uart->dr = (uint32_t)c; in uart_stellaris_poll_out()
305 * @param dev UART device struct
318 while ((len - num_tx > 0) && ((config->uart->fr & UARTFR_TXFF) == 0U)) { in uart_stellaris_fifo_fill()
319 config->uart->dr = (uint32_t)tx_data[num_tx++]; in uart_stellaris_fifo_fill()
328 * @param dev UART device struct
341 while ((size - num_rx > 0) && ((config->uart->fr & UARTFR_RXFE) == 0U)) { in uart_stellaris_fifo_read()
342 rx_data[num_rx++] = (uint8_t)config->uart->dr; in uart_stellaris_fifo_read()
351 * @param dev UART device struct
374 saved_ctl = config->uart->ctl; in uart_stellaris_irq_tx_enable()
375 saved_ibrd = config->uart->ibrd; in uart_stellaris_irq_tx_enable()
376 saved_fbrd = config->uart->fbrd; in uart_stellaris_irq_tx_enable()
380 config->uart->fbrd = 0U; in uart_stellaris_irq_tx_enable()
381 config->uart->ibrd = 1U; in uart_stellaris_irq_tx_enable()
382 config->uart->lcrh = 0U; in uart_stellaris_irq_tx_enable()
383 config->uart->ctl = (UARTCTL_UARTEN | UARTCTL_TXEN | UARTCTL_LBE); in uart_stellaris_irq_tx_enable()
384 config->uart->dr = 0U; in uart_stellaris_irq_tx_enable()
386 while (config->uart->fr & UARTFR_BUSY) { in uart_stellaris_irq_tx_enable()
391 config->uart->ibrd = saved_ibrd; in uart_stellaris_irq_tx_enable()
392 config->uart->fbrd = saved_fbrd; in uart_stellaris_irq_tx_enable()
394 config->uart->ctl = saved_ctl; in uart_stellaris_irq_tx_enable()
397 config->uart->im |= UARTTIM_TXIM; in uart_stellaris_irq_tx_enable()
403 * @param dev UART device struct
409 config->uart->im &= ~UARTTIM_TXIM; in uart_stellaris_irq_tx_disable()
415 * @param dev UART device struct
423 return ((config->uart->mis & UARTMIS_TXMIS) == UARTMIS_TXMIS); in uart_stellaris_irq_tx_ready()
429 * @param dev UART device struct
435 config->uart->im |= UARTTIM_RXIM; in uart_stellaris_irq_rx_enable()
441 * @param dev UART device struct
447 config->uart->im &= ~UARTTIM_RXIM; in uart_stellaris_irq_rx_disable()
453 * @param dev UART device struct
461 return ((config->uart->mis & UARTMIS_RXMIS) == UARTMIS_RXMIS); in uart_stellaris_irq_rx_ready()
467 * @param dev UART device struct
473 config->uart->im |= (UARTTIM_RTIM | UARTTIM_FEIM | UARTTIM_PEIM | in uart_stellaris_irq_err_enable()
480 * @param dev UART device struct
486 config->uart->im &= ~(UARTTIM_RTIM | UARTTIM_FEIM | UARTTIM_PEIM | in uart_stellaris_irq_err_disable()
493 * @param dev UART device struct
502 return ((config->uart->mis & (UARTMIS_RXMIS | UARTMIS_TXMIS)) ? 1 : 0); in uart_stellaris_irq_is_pending()
508 * @param dev UART device struct
520 * @param dev UART device struct
583 .uart = (volatile struct _uart *)DT_INST_REG_ADDR(0),
622 .uart = (volatile struct _uart *)DT_INST_REG_ADDR(1),
661 .uart = (volatile struct _uart *)DT_INST_REG_ADDR(2),