MCUXpresso SDK API Reference Manual: ECSPI 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
ECSPI SDMA Driver
ECSPI: Enhanced Configurable Serial Peripheral Interface Driver

## Overview

## Data Structures
struct | ecspi_sdma_handle_t
| ECSPI SDMA transfer handle, users should not touch the content of the handle. More...

## Typedefs
typedef void(* | ecspi_sdma_callback_t )(ECSPI_Type *base, ecspi_sdma_handle_t *handle, status_t status, void *userData)
| ECSPI SDMA callback called at the end of transfer. More...

## Driver version
#define | FSL_ECSPI_FREERTOS_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
| ECSPI FreeRTOS driver version. More...

## DMA Transactional
void | ECSPI_MasterTransferCreateHandleSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle, ecspi_sdma_callback_t callback, void *userData, sdma_handle_t *txHandle, sdma_handle_t *rxHandle, uint32_t eventSourceTx, uint32_t eventSourceRx, uint32_t TxChannel, uint32_t RxChannel)
| Initialize the ECSPI master SDMA handle. More...
void | ECSPI_SlaveTransferCreateHandleSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle, ecspi_sdma_callback_t callback, void *userData, sdma_handle_t *txHandle, sdma_handle_t *rxHandle, uint32_t eventSourceTx, uint32_t eventSourceRx, uint32_t TxChannel, uint32_t RxChannel)
| Initialize the ECSPI Slave SDMA handle. More...
status_t | ECSPI_MasterTransferSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle, ecspi_transfer_t *xfer)
| Perform a non-blocking ECSPI master transfer using SDMA. More...
status_t | ECSPI_SlaveTransferSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle, ecspi_transfer_t *xfer)
| Perform a non-blocking ECSPI slave transfer using SDMA. More...
void | ECSPI_MasterTransferAbortSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle)
| Abort a ECSPI master transfer using SDMA. More...
void | ECSPI_SlaveTransferAbortSDMA (ECSPI_Type *base, ecspi_sdma_handle_t *handle)
| Abort a ECSPI slave transfer using SDMA. More...

## Data Structure Documentation

struct _ecspi_sdma_handle

### Data Fields
bool | txInProgress
| Send transfer finished.
bool | rxInProgress
| Receive transfer finished.
sdma_handle_t * | txSdmaHandle
| DMA handler for ECSPI send.
sdma_handle_t * | rxSdmaHandle
| DMA handler for ECSPI receive.
ecspi_sdma_callback_t | callback
| Callback for ECSPI SDMA transfer.
void * | userData
| User Data for ECSPI SDMA callback.
uint32_t | state
| Internal state of ECSPI SDMA transfer.
uint32_t | ChannelTx
| Channel for send handle.
uint32_t | ChannelRx
| Channel for receive handler.

## Macro Definition Documentation

#define FSL_ECSPI_FREERTOS_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))

## Typedef Documentation

typedef void(* ecspi_sdma_callback_t)(ECSPI_Type *base, ecspi_sdma_handle_t *handle, status_t status, void *userData)

## Function Documentation

void ECSPI_MasterTransferCreateHandleSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle,
|  | ecspi_sdma_callback_t | callback,
|  | void * | userData,
|  | sdma_handle_t * | txHandle,
|  | sdma_handle_t * | rxHandle,
|  | uint32_t | eventSourceTx,
|  | uint32_t | eventSourceRx,
|  | uint32_t | TxChannel,
|  | uint32_t | RxChannel
| ) |  |

This function initializes the ECSPI master SDMA handle which can be used for other SPI master transactional APIs. Usually, for a specified ECSPI instance, user need only call this API once to get the initialized handle.

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI handle pointer.
  callback | User callback function called at the end of a transfer.
  userData | User data for callback.
  txHandle | SDMA handle pointer for ECSPI Tx, the handle shall be static allocated by users.
  rxHandle | SDMA handle pointer for ECSPI Rx, the handle shall be static allocated by users.
  eventSourceTx | event source for ECSPI send, which can be found in SDMA mapping.
  eventSourceRx | event source for ECSPI receive, which can be found in SDMA mapping.
  TxChannel | SDMA channel for ECSPI send.
  RxChannel | SDMA channel for ECSPI receive.

void ECSPI_SlaveTransferCreateHandleSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle,
|  | ecspi_sdma_callback_t | callback,
|  | void * | userData,
|  | sdma_handle_t * | txHandle,
|  | sdma_handle_t * | rxHandle,
|  | uint32_t | eventSourceTx,
|  | uint32_t | eventSourceRx,
|  | uint32_t | TxChannel,
|  | uint32_t | RxChannel
| ) |  |

This function initializes the ECSPI Slave SDMA handle which can be used for other SPI Slave transactional APIs. Usually, for a specified ECSPI instance, user need only call this API once to get the initialized handle.

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI handle pointer.
  callback | User callback function called at the end of a transfer.
  userData | User data for callback.
  txHandle | SDMA handle pointer for ECSPI Tx, the handle shall be static allocated by users.
  rxHandle | SDMA handle pointer for ECSPI Rx, the handle shall be static allocated by users.
  eventSourceTx | event source for ECSPI send, which can be found in SDMA mapping.
  eventSourceRx | event source for ECSPI receive, which can be found in SDMA mapping.
  TxChannel | SDMA channel for ECSPI send.
  RxChannel | SDMA channel for ECSPI receive.

status_t ECSPI_MasterTransferSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle,
|  | ecspi_transfer_t * | xfer
| ) |  |

Note
  This interface returned immediately after transfer initiates.

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI SDMA handle pointer.
  xfer | Pointer to sdma transfer structure.

Return values

  kStatus_Success | Successfully start a transfer.
  kStatus_InvalidArgument | Input argument is invalid.
  kStatus_ECSPI_Busy | EECSPI is not idle, is running another transfer.

status_t ECSPI_SlaveTransferSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle,
|  | ecspi_transfer_t * | xfer
| ) |  |

Note
  This interface returned immediately after transfer initiates.

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI SDMA handle pointer.
  xfer | Pointer to sdma transfer structure.

Return values

  kStatus_Success | Successfully start a transfer.
  kStatus_InvalidArgument | Input argument is invalid.
  kStatus_ECSPI_Busy | EECSPI is not idle, is running another transfer.

void ECSPI_MasterTransferAbortSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle
| ) |  |

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI SDMA handle pointer.

void ECSPI_SlaveTransferAbortSDMA | ( | ECSPI_Type * | base,
|  | ecspi_sdma_handle_t * | handle
| ) |  |

Parameters

  base | ECSPI peripheral base address.
  handle | ECSPI SDMA handle pointer.