Lines Matching +full:zephyr +full:- +full:base

2  * Copyright (c) 2016-2017, Texas Instruments Incorporated
4 * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/kernel.h>
10 #include <zephyr/arch/cpu.h>
11 #include <zephyr/drivers/uart.h>
12 #include <zephyr/drivers/pinctrl.h>
20 #include <zephyr/irq.h>
23 unsigned long base; member
49 * However, the Zephyr console driver, and the Zephyr uart sample test, assume
56 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_init()
57 const struct uart_cc32xx_dev_data_t *data = dev->data; in uart_cc32xx_init()
60 MAP_PRCMPeripheralClkEnable(data->prcm, in uart_cc32xx_init()
63 MAP_PRCMPeripheralReset(data->prcm); in uart_cc32xx_init()
65 ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); in uart_cc32xx_init()
71 MAP_UARTConfigSetExpClk(config->base, in uart_cc32xx_init()
72 MAP_PRCMPeripheralClockGet(data->prcm), in uart_cc32xx_init()
73 data->baud_rate, in uart_cc32xx_init()
76 MAP_UARTFlowControlSet(config->base, UART_FLOWCONTROL_NONE); in uart_cc32xx_init()
77 /* Re-disable the FIFOs: */ in uart_cc32xx_init()
78 MAP_UARTFIFODisable(config->base); in uart_cc32xx_init()
82 MAP_UARTIntClear(config->base, UART_INT_RX); in uart_cc32xx_init()
84 config->irq_config_func(dev); in uart_cc32xx_init()
86 /* Fill the tx fifo, so Zephyr console & shell subsystems get "primed" in uart_cc32xx_init()
90 MAP_UARTCharPutNonBlocking(config->base, PRIME_CHAR); in uart_cc32xx_init()
97 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_poll_in()
99 if (MAP_UARTCharsAvail(config->base)) { in uart_cc32xx_poll_in()
100 *c = MAP_UARTCharGetNonBlocking(config->base); in uart_cc32xx_poll_in()
102 return (-1); in uart_cc32xx_poll_in()
109 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_poll_out()
111 MAP_UARTCharPut(config->base, c); in uart_cc32xx_poll_out()
116 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_err_check()
120 cc32xx_errs = MAP_UARTRxErrorGet(config->base); in uart_cc32xx_err_check()
122 /* Map cc32xx SDK uart.h defines to zephyr uart.h defines */ in uart_cc32xx_err_check()
129 MAP_UARTRxErrorClear(config->base); in uart_cc32xx_err_check()
140 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_fifo_fill()
143 while ((size - num_tx) > 0) { in uart_cc32xx_fifo_fill()
145 if (MAP_UARTCharPutNonBlocking(config->base, tx_data[num_tx])) { in uart_cc32xx_fifo_fill()
158 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_fifo_read()
161 while (((size - num_rx) > 0) && in uart_cc32xx_fifo_read()
162 MAP_UARTCharsAvail(config->base)) { in uart_cc32xx_fifo_read()
166 MAP_UARTCharGetNonBlocking(config->base); in uart_cc32xx_fifo_read()
174 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_tx_enable()
176 MAP_UARTIntEnable(config->base, UART_INT_TX); in uart_cc32xx_irq_tx_enable()
181 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_tx_disable()
183 MAP_UARTIntDisable(config->base, UART_INT_TX); in uart_cc32xx_irq_tx_disable()
188 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_tx_ready()
191 int_status = MAP_UARTIntStatus(config->base, 1); in uart_cc32xx_irq_tx_ready()
198 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_rx_enable()
201 MAP_UARTIntEnable(config->base, UART_INT_RX); in uart_cc32xx_irq_rx_enable()
206 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_rx_disable()
208 MAP_UARTIntDisable(config->base, UART_INT_RX); in uart_cc32xx_irq_rx_disable()
213 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_tx_complete()
215 return (!MAP_UARTBusy(config->base)); in uart_cc32xx_irq_tx_complete()
220 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_rx_ready()
223 int_status = MAP_UARTIntStatus(config->base, 1); in uart_cc32xx_irq_rx_ready()
230 /* Not yet used in zephyr */ in uart_cc32xx_irq_err_enable()
235 /* Not yet used in zephyr */ in uart_cc32xx_irq_err_disable()
240 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_irq_is_pending()
243 int_status = MAP_UARTIntStatus(config->base, 1); in uart_cc32xx_irq_is_pending()
257 struct uart_cc32xx_dev_data_t * const dev_data = dev->data; in uart_cc32xx_irq_callback_set()
259 dev_data->cb = cb; in uart_cc32xx_irq_callback_set()
260 dev_data->cb_data = cb_data; in uart_cc32xx_irq_callback_set()
275 const struct uart_cc32xx_dev_config *config = dev->config; in uart_cc32xx_isr()
276 struct uart_cc32xx_dev_data_t * const dev_data = dev->data; in uart_cc32xx_isr()
278 unsigned long intStatus = MAP_UARTIntStatus(config->base, 1); in uart_cc32xx_isr()
280 if (dev_data->cb) { in uart_cc32xx_isr()
281 dev_data->cb(dev, dev_data->cb_data); in uart_cc32xx_isr()
284 * RX/TX interrupt should have been implicitly cleared by Zephyr UART in uart_cc32xx_isr()
288 MAP_UARTIntClear(config->base, in uart_cc32xx_isr()
329 .base = DT_INST_REG_ADDR(idx), \