44 #include <hal/nrf_uarte.h> 45 #include <lib/assert.h> 152 typedef void (*uart_disable_t)(
const struct uart_t *Uart);
153 typedef void (*uart_start_basic_tx_t)(
const struct uart_t *Uart, uint8_t *DataSrc, uint16_t DataSize,
uart_tx_callback_t Callback,
void *CallbackData);
154 typedef void (*uart_start_ping_pong_tx_t)(
const struct uart_t *Uart, uint8_t *PrimDataSrc, uint16_t PrimDataSize, uint8_t *AltDataSrc, uint16_t AltDataSize,
uart_tx_callback_t Callback,
void *CallbackData);
155 typedef void (*uart_refresh_ping_pong_tx_t)(
const struct uart_t *Uart, uint8_t *DataSrc, uint16_t DataSize,
bool Stop);
156 typedef void (*uart_start_basic_rx_t)(
const struct uart_t *Uart, uint8_t *DataDest, uint16_t DataSize,
uart_rx_callback_t Callback,
void *CallbackData);
157 typedef void (*uart_start_ping_pong_rx_t)(
const struct uart_t *Uart, uint8_t *PrimDataDest, uint16_t PrimDataSize, uint8_t *AltDataDest, uint16_t AltDataSize,
uart_rx_callback_t Callback,
void *CallbackData);
158 typedef void (*uart_refresh_ping_pong_rx_t)(
const struct uart_t *Uart, uint8_t *DataDest, uint16_t DataSize,
bool Stop);
159 typedef void (*uart_reset_fifo_t)(
const struct uart_t* Uart,
bool Tx,
bool Rx);
160 typedef void (*uart_cancel_rx_t)(
const struct uart_t *Uart);
161 typedef bool (*uart_is_busy_rx_t)(
const struct uart_t *Uart);
162 typedef void (*uart_cancel_tx_t)(
const struct uart_t *Uart);
163 typedef bool (*uart_is_busy_tx_t)(
const struct uart_t *Uart);
164 typedef void (*uart_set_baudrate_t)(
const struct uart_t *Uart);
167 typedef void (*uart_set_rts)(
const struct uart_t *Uart,
bool Active);
168 typedef void (*uart_interrupt_handler_t)(
const struct uart_t *Uart);
227 uint32_t FlowControl : 2;
228 uint32_t RtsInverse : 1;
230 uint32_t StopBits : 1;
231 uint32_t WordLength : 4;
237 #define UART_VCALL(Uart, Fn) (Uart)->Func->Fn 293 uint8_t *DataSrc, uint16_t DataSize,
315 uint8_t *PrimDataSrc, uint16_t PrimDataSize,
316 uint8_t *AltDataSrc, uint16_t AltDataSize,
320 AltDataSrc, AltDataSize,
321 Callback, CallbackData);
336 uint8_t *DataSrc, uint16_t DataSize,
370 uint8_t *DataDest, uint16_t DataSize,
392 uint8_t *PrimDataDest, uint16_t PrimDataSize,
393 uint8_t *AltDataDest, uint16_t AltDataSize,
397 AltDataDest, AltDataSize,
398 Callback, CallbackData);
414 uint8_t *DataDest, uint16_t DataSize,
struct uart_state_t * State
Address to struct with RAM variables used by the uart driver.
No Rx timeout: check buffer and return immedialely.
default word length (8 bit)
Parity bit is on. Calculate odd parity.
struct data_buffer_t TxBuffer[2]
Transmit buffer for asynchronous transfers.
void * TxCallbackData
Data for the TX completion callback.
static void UartStartPingPongTx(const struct uart_t *Uart, uint8_t *PrimDataSrc, uint16_t PrimDataSize, uint8_t *AltDataSrc, uint16_t AltDataSize, uart_tx_callback_t Callback, void *CallbackData)
Name: UartStartPingPongTx Transmit data using DMA transfer in PingPong mode. Will alternate between p...
void(* uart_rx_callback_t)(const struct uart_t *Uart, void *CallbackData, enum uart_rx_status_t RxStatus)
static void UartDisable(const struct uart_t *Uart)
Name: UartDisable Disables UART.
static void UartSendBreak(const struct uart_t *Uart, uart_break_callback_t Callback, void *CallbackData)
Sends break (sets TX to logic 0 for a time of 1 byte transmission)
static void UartStartBasicRx(const struct uart_t *Uart, uint8_t *DataDest, uint16_t DataSize, uart_rx_callback_t Callback, void *CallbackData)
Name: UartStartBasicRx Receive data using DMA transfer in basic mode. Using primary DMA descriptor on...
Header file for the EVE power management framework.
static void UartStartBasicTx(const struct uart_t *Uart, uint8_t *DataSrc, uint16_t DataSize, uart_tx_callback_t Callback, void *CallbackData)
Name: UartStartBasicTx Transmit data using DMA transfer in basic mode. Using primary DMA descriptor o...
const struct uart_api_t * Func
Virtual function table.
Receiving completed successfully.
Parity error while receiving.
uint8_t RxBufIndex
Index of the active RX buffer.
uint8_t TxBufIndex
Index of the active TX buffer.
static void UartSetRts(const struct uart_t *Uart, bool Active)
Manually drives RTS pin. HW flow control must be off to use this function.
Frame error (no stop bit) while receiving.
uart_tx_callback_t TxCallback
TX completion callback.
Parity bit is on. Calculate even parity.
Buffer overrun while receiving.
void(* uart_init_t)(const struct uart_t *Uart)
static uint32_t UartDmaBytesReceived(const struct uart_t *Uart)
Name: UartDmaBytesReceived Will return number of received bytes for current DMA transfer.
static void UartInit(const struct uart_t *Uart)
Name: UartInit Initializes Uart.
static void UartCancelRx(const struct uart_t *Uart)
Name: UartCancelRx Shuts down DMA, flushes FIFO and disables RX interrupts for the UART...
Header file for the EVE clock management framework.
uint32_t RxStartTimeoutUs
Default value for the max time the driver waits for the first symbol in a message.
void(* uart_tx_callback_t)(const struct uart_t *Uart, void *CallbackData)
const struct uart_t * Uart
Backpointer to the static configuration.
void * BreakCallbackData
Data for the Break send completion callback.
static const struct data_buffer_t * UartGetRxBuffer(const struct uart_t *Uart)
Name: UartGetRxBuffer Returns the current RX buffer.
static void UartSetBaudrate(const struct uart_t *Uart, uint32_t Baudrate)
Name: UartSetBaudrate Sets new baudrate to the UART Note that in many situation Rx timeout settings m...
No Rx timeout: wait forever.
uint8_t TxStop
Amount of TX buffers in the pipeline.
Header file for the EVE microsecond-scale work scheduling.
void * RxCallbackData
Data for the RX completion callback.
uart_rx_callback_t RxCallback
RX completion callback.
static void UartCancelTx(const struct uart_t *Uart)
Name: UartCancelTx Shuts down DMA, flushes FIFO and disables TX interrupts for the UART...
uart_break_callback_t BreakCallback
Send Break completion callback.
uint32_t RxStartTimeoutUs
Current value for the max time the driver waits for the first symbol in a message.
uint32_t Baudrate
Current baudrate in bit/s.
Timeout while receiving (long delay after the last char received, typically 4 chars pause) ...
struct data_buffer_t RxBuffer[2]
Receive buffer for asynchronous transfers.
static void UartRefreshPingPongTx(const struct uart_t *Uart, uint8_t *DataSrc, uint16_t DataSize, bool Stop)
Name: UartRefreshPingPongTx Refresh transmit of data using DMA transfer in PingPong mode...
uint32_t RxStopTimeoutUs
Default value for the max time the driver waits for the next symbol in a message. ...
static void UartRefreshPingPongRx(const struct uart_t *Uart, uint8_t *DataDest, uint16_t DataSize, bool Stop)
Name: UartRefreshPingPongRx Refresh of receive data using DMA transfer in PingPong mode...
static struct data_buffer_t * UartGetTxBuffer(const struct uart_t *Uart)
Name: UartGetTxBuffer Returns the current TX buffer.
uint8_t RxCancelled
RX is cancelled.
uint8_t RxStop
Amount of RX buffers in the pipeline.
static void UartSetRxTimeouts(const struct uart_t *Uart, uint32_t RxStartTimeoutUs, uint32_t RxStopTimeoutUs)
Name: UartSetRxTimeouts Sets timeout values for the UART Calling code can use value UART_RX_TIMEOUT_D...
Rx was aborted by UartCancelRx()
static void UartStartPingPongRx(const struct uart_t *Uart, uint8_t *PrimDataDest, uint16_t PrimDataSize, uint8_t *AltDataDest, uint16_t AltDataSize, uart_rx_callback_t Callback, void *CallbackData)
Name: UartStartPingPongRx Receive data using DMA transfer in PingPong mode. Will alternate between pr...
static bool UartIsBusyTx(const struct uart_t *Uart)
Name: UartIsBusyTx Returns busy status of the UART TX path.
static void UartResetFifo(const struct uart_t *Uart, bool Tx, bool Rx)
Name: UartResetFifo Resets FIFO buffer for Tx or Rx or both. NB: Resetting Rx FIFO stops receiving...
Parity bit is on and always 1.
static bool UartIsBusyRx(const struct uart_t *Uart)
Name: UartIsBusyRx Returns busy status of the UART RX path.
uint32_t RxStopTimeoutUs
Current value for the max time the driver waits for the next symbol in a message. ...
void(* uart_break_callback_t)(const struct uart_t *Uart, void *CallbackData)
struct uwork_t SendBreakWork
timeout counter for Send Break
Parity bit is on and always 0.
const void * Impl
Device specific configuration data.