MCUXpresso SDK API Reference Manual: UART SDMA Driver

| MCUXpresso SDK API Reference Manual Rev 2.11.1 NXP Semiconductors

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs
UART SDMA Driver
UART: Universal Asynchronous Receiver/Transmitter Driver

## Overview

## Data Structures
struct | uart_sdma_handle_t
| UART sDMA handle. More...

## Typedefs
typedef void(* | uart_sdma_transfer_callback_t )(UART_Type *base, uart_sdma_handle_t *handle, status_t status, void *userData)
| UART transfer callback function. More...

## Driver version
#define | FSL_UART_SDMA_DRIVER_VERSION (MAKE_VERSION(2, 3, 0))
| UART SDMA driver version. More...

## sDMA transactional
void | UART_TransferCreateHandleSDMA (UART_Type *base, uart_sdma_handle_t *handle, uart_sdma_transfer_callback_t callback, void *userData, sdma_handle_t *txSdmaHandle, sdma_handle_t *rxSdmaHandle, uint32_t eventSourceTx, uint32_t eventSourceRx)
| Initializes the UART handle which is used in transactional functions. More...
status_t | UART_SendSDMA (UART_Type *base, uart_sdma_handle_t *handle, uart_transfer_t *xfer)
| Sends data using sDMA. More...
status_t | UART_ReceiveSDMA (UART_Type *base, uart_sdma_handle_t *handle, uart_transfer_t *xfer)
| Receives data using sDMA. More...
void | UART_TransferAbortSendSDMA (UART_Type *base, uart_sdma_handle_t *handle)
| Aborts the sent data using sDMA. More...
void | UART_TransferAbortReceiveSDMA (UART_Type *base, uart_sdma_handle_t *handle)
| Aborts the receive data using sDMA. More...
void | UART_TransferSdmaHandleIRQ (UART_Type *base, void *uartSdmaHandle)
| UART IRQ handle function. More...

## Data Structure Documentation

struct _uart_sdma_handle

### Data Fields
uart_sdma_transfer_callback_t | callback
| Callback function. More...
void * | userData
| UART callback function parameter. More...
size_t | rxDataSizeAll
| Size of the data to receive. More...
size_t | txDataSizeAll
| Size of the data to send out. More...
sdma_handle_t * | txSdmaHandle
| The sDMA TX channel used. More...
sdma_handle_t * | rxSdmaHandle
| The sDMA RX channel used. More...
volatile uint8_t | txState
| TX transfer state. More...
volatile uint8_t | rxState
| RX transfer state.

#### Field Documentation

uart_sdma_transfer_callback_t uart_sdma_handle_t::callback

void* uart_sdma_handle_t::userData

size_t uart_sdma_handle_t::rxDataSizeAll

size_t uart_sdma_handle_t::txDataSizeAll

sdma_handle_t* uart_sdma_handle_t::txSdmaHandle

sdma_handle_t* uart_sdma_handle_t::rxSdmaHandle

volatile uint8_t uart_sdma_handle_t::txState

## Macro Definition Documentation

#define FSL_UART_SDMA_DRIVER_VERSION (MAKE_VERSION(2, 3, 0))

## Typedef Documentation

typedef void(* uart_sdma_transfer_callback_t)(UART_Type *base, uart_sdma_handle_t *handle, status_t status, void *userData)

## Function Documentation

void UART_TransferCreateHandleSDMA | ( | UART_Type * | base,
|  | uart_sdma_handle_t * | handle,
|  | uart_sdma_transfer_callback_t | callback,
|  | void * | userData,
|  | sdma_handle_t * | txSdmaHandle,
|  | sdma_handle_t * | rxSdmaHandle,
|  | uint32_t | eventSourceTx,
|  | uint32_t | eventSourceRx
| ) |  |

Parameters

  base | UART peripheral base address.
  handle | Pointer to the uart_sdma_handle_t structure.
  callback | UART callback, NULL means no callback.
  userData | User callback function data.
  rxSdmaHandle | User-requested DMA handle for RX DMA transfer.
  txSdmaHandle | User-requested DMA handle for TX DMA transfer.
  eventSourceTx | Eventsource for TX DMA transfer.
  eventSourceRx | Eventsource for RX DMA transfer.

status_t UART_SendSDMA | ( | UART_Type * | base,
|  | uart_sdma_handle_t * | handle,
|  | uart_transfer_t * | xfer
| ) |  |

This function sends data using sDMA. This is a non-blocking function, which returns right away. When all data is sent, the send callback function is called.

Parameters

  base | UART peripheral base address.
  handle | UART handle pointer.
  xfer | UART sDMA transfer structure. See uart_transfer_t.

Return values

  kStatus_Success | if succeeded; otherwise failed.
  kStatus_UART_TxBusy | Previous transfer ongoing.
  kStatus_InvalidArgument | Invalid argument.

status_t UART_ReceiveSDMA | ( | UART_Type * | base,
|  | uart_sdma_handle_t * | handle,
|  | uart_transfer_t * | xfer
| ) |  |

This function receives data using sDMA. This is a non-blocking function, which returns right away. When all data is received, the receive callback function is called.

Parameters

  base | UART peripheral base address.
  handle | Pointer to the uart_sdma_handle_t structure.
  xfer | UART sDMA transfer structure. See uart_transfer_t.

Return values

  kStatus_Success | if succeeded; otherwise failed.
  kStatus_UART_RxBusy | Previous transfer ongoing.
  kStatus_InvalidArgument | Invalid argument.

void UART_TransferAbortSendSDMA | ( | UART_Type * | base,
|  | uart_sdma_handle_t * | handle
| ) |  |

This function aborts sent data using sDMA.

Parameters

  base | UART peripheral base address.
  handle | Pointer to the uart_sdma_handle_t structure.

void UART_TransferAbortReceiveSDMA | ( | UART_Type * | base,
|  | uart_sdma_handle_t * | handle
| ) |  |

This function aborts receive data using sDMA.

Parameters

  base | UART peripheral base address.
  handle | Pointer to the uart_sdma_handle_t structure.

void UART_TransferSdmaHandleIRQ | ( | UART_Type * | base,
|  | void * | uartSdmaHandle
| ) |  |

This function handles the UART transmit complete IRQ request and invoke user callback.

Parameters

  base | UART peripheral base address.
  uartSdmaHandle | UART handle pointer.