Lines Matching +full:internal +full:- +full:osc +full:- +full:disable

1 /* stellarisUartDrv.c - Stellaris UART driver */
6 * Copyright (c) 2013-2015 Wind River Systems, Inc.
8 * SPDX-License-Identifier: Apache-2.0
15 * an 16550 in functionality, but is not register-compatible.
16 * It is also register-compatible with the UART found on TI CC2650 SoC,
19 * There is only support for poll-mode, so it can only be used with the printk
129 const struct uart_stellaris_config *config = dev->config; in baudrate_set()
132 /* upon reset, the system clock uses the internal OSC @ 12MHz */ in baudrate_set()
147 * those registers are 32-bit, but the reserved bits should be in baudrate_set()
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()
163 const struct uart_stellaris_config *config = dev->config; in enable()
165 config->uart->ctl |= UARTCTL_UARTEN; in enable()
169 * @brief Disable the UART
175 static inline void disable(const struct device *dev) in disable() function
177 const struct uart_stellaris_config *config = dev->config; in disable()
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()
191 * 8-bit frame
208 const struct uart_stellaris_config *config = dev->config; in line_control_defaults_set()
210 config->uart->lcrh = LINE_CONTROL_DEFAULTS; in line_control_defaults_set()
225 struct uart_stellaris_dev_data_t *data = dev->data; in uart_stellaris_init()
226 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_init()
227 disable(dev); in uart_stellaris_init()
228 baudrate_set(dev, data->baud_rate, in uart_stellaris_init()
229 config->sys_clk_freq); in uart_stellaris_init()
234 config->irq_config_func(dev); in uart_stellaris_init()
251 const struct uart_stellaris_config *config = dev->config; in poll_tx_ready()
253 return (config->uart->fr & UARTFR_TXFE); in poll_tx_ready()
262 * @return 0 if a character arrived, -1 if the input buffer if empty.
267 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_poll_in()
269 if (config->uart->fr & UARTFR_RXFE) { in uart_stellaris_poll_in()
270 return (-1); in uart_stellaris_poll_in()
274 *c = (unsigned char)config->uart->dr; in uart_stellaris_poll_in()
291 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_poll_out()
297 config->uart->dr = (uint32_t)c; in uart_stellaris_poll_out()
315 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_fifo_fill()
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()
338 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_fifo_read()
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()
361 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_tx_enable()
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()
379 disable(dev); 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()
390 disable(dev); 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()
401 * @brief Disable TX interrupt in IER
407 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_tx_disable()
409 config->uart->im &= ~UARTTIM_TXIM; in uart_stellaris_irq_tx_disable()
421 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_tx_ready()
423 return ((config->uart->mis & UARTMIS_TXMIS) == UARTMIS_TXMIS); in uart_stellaris_irq_tx_ready()
433 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_rx_enable()
435 config->uart->im |= UARTTIM_RXIM; in uart_stellaris_irq_rx_enable()
439 * @brief Disable RX interrupt in IER
445 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_rx_disable()
447 config->uart->im &= ~UARTTIM_RXIM; in uart_stellaris_irq_rx_disable()
459 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_rx_ready()
461 return ((config->uart->mis & UARTMIS_RXMIS) == UARTMIS_RXMIS); in uart_stellaris_irq_rx_ready()
471 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_err_enable()
473 config->uart->im |= (UARTTIM_RTIM | UARTTIM_FEIM | UARTTIM_PEIM | in uart_stellaris_irq_err_enable()
478 * @brief Disable error interrupts
484 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_err_disable()
486 config->uart->im &= ~(UARTTIM_RTIM | UARTTIM_FEIM | UARTTIM_PEIM | in uart_stellaris_irq_err_disable()
499 const struct uart_stellaris_config *config = dev->config; in uart_stellaris_irq_is_pending()
502 return ((config->uart->mis & (UARTMIS_RXMIS | UARTMIS_TXMIS)) ? 1 : 0); in uart_stellaris_irq_is_pending()
527 struct uart_stellaris_dev_data_t * const dev_data = dev->data; in uart_stellaris_irq_callback_set()
529 dev_data->cb = cb; in uart_stellaris_irq_callback_set()
530 dev_data->cb_data = cb_data; in uart_stellaris_irq_callback_set()
542 struct uart_stellaris_dev_data_t * const dev_data = dev->data; in uart_stellaris_isr()
544 if (dev_data->cb) { in uart_stellaris_isr()
545 dev_data->cb(dev, dev_data->cb_data); in uart_stellaris_isr()