MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the DSPI Peripheral driver. The DSPI driver configures DSPI module and provides the functional and transactional interfaces to build the DSPI application.

Data Structures

struct  dspi_master_edma_handle_t
 DSPI master eDMA transfer handle structure used for the transactional API. More...
 
struct  dspi_slave_edma_handle_t
 DSPI slave eDMA transfer handle structure used for the transactional API. More...
 

Typedefs

typedef void(* dspi_master_edma_transfer_callback_t )(SPI_Type *base, dspi_master_edma_handle_t *handle, status_t status, void *userData)
 Completion callback function pointer type. More...
 
typedef void(* dspi_slave_edma_transfer_callback_t )(SPI_Type *base, dspi_slave_edma_handle_t *handle, status_t status, void *userData)
 Completion callback function pointer type. More...
 

Functions

void DSPI_MasterTransferCreateHandleEDMA (SPI_Type *base, dspi_master_edma_handle_t *handle, dspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToIntermediaryHandle, edma_handle_t *edmaIntermediaryToTxRegHandle)
 Initializes the DSPI master eDMA handle. More...
 
status_t DSPI_MasterTransferEDMA (SPI_Type *base, dspi_master_edma_handle_t *handle, dspi_transfer_t *transfer)
 DSPI master transfer data using eDMA. More...
 
void DSPI_MasterTransferAbortEDMA (SPI_Type *base, dspi_master_edma_handle_t *handle)
 DSPI master aborts a transfer which is using eDMA. More...
 
status_t DSPI_MasterTransferGetCountEDMA (SPI_Type *base, dspi_master_edma_handle_t *handle, size_t *count)
 Gets the master eDMA transfer count. More...
 
void DSPI_SlaveTransferCreateHandleEDMA (SPI_Type *base, dspi_slave_edma_handle_t *handle, dspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
 Initializes the DSPI slave eDMA handle. More...
 
status_t DSPI_SlaveTransferEDMA (SPI_Type *base, dspi_slave_edma_handle_t *handle, dspi_transfer_t *transfer)
 DSPI slave transfer data using eDMA. More...
 
void DSPI_SlaveTransferAbortEDMA (SPI_Type *base, dspi_slave_edma_handle_t *handle)
 DSPI slave aborts a transfer which is using eDMA. More...
 
status_t DSPI_SlaveTransferGetCountEDMA (SPI_Type *base, dspi_slave_edma_handle_t *handle, size_t *count)
 Gets the slave eDMA transfer count. More...
 

Data Structure Documentation

struct _dspi_master_edma_handle

Forward declaration of the DSPI eDMA master handle typedefs.

Data Fields

uint32_t bitsPerFrame
 The desired number of bits per frame. More...
 
volatile uint32_t command
 The desired data command. More...
 
volatile uint32_t lastCommand
 The desired last data command. More...
 
uint8_t fifoSize
 FIFO dataSize. More...
 
volatile bool isPcsActiveAfterTransfer
 Indicates whether the PCS signal keeps active after the last frame transfer. More...
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
volatile uint8_t state
 DSPI transfer state , _dspi_transfer_state. More...
 
uint8_t *volatile txData
 Send buffer. More...
 
uint8_t *volatile rxData
 Receive buffer. More...
 
volatile size_t remainingSendByteCount
 A number of bytes remaining to send. More...
 
volatile size_t remainingReceiveByteCount
 A number of bytes remaining to receive. More...
 
size_t totalByteCount
 A number of transfer bytes.
 
uint32_t rxBuffIfNull
 Used if there is not rxData for DMA purpose. More...
 
uint32_t txBuffIfNull
 Used if there is not txData for DMA purpose. More...
 
dspi_master_edma_transfer_callback_t callback
 Completion callback. More...
 
void * userData
 Callback user data. More...
 
edma_handle_tedmaRxRegToRxDataHandle
 edma_handle_t handle point used for RxReg to RxData buff
 
edma_handle_tedmaTxDataToIntermediaryHandle
 edma_handle_t handle point used for TxData to Intermediary
 
edma_handle_tedmaIntermediaryToTxRegHandle
 edma_handle_t handle point used for Intermediary to TxReg
 
edma_tcd_t dspiSoftwareTCD [2]
 SoftwareTCD , internal used.
 

Field Documentation

uint32_t dspi_master_edma_handle_t::bitsPerFrame
volatile uint32_t dspi_master_edma_handle_t::command
volatile uint32_t dspi_master_edma_handle_t::lastCommand
uint8_t dspi_master_edma_handle_t::fifoSize
volatile bool dspi_master_edma_handle_t::isPcsActiveAfterTransfer
uint8_t dspi_master_edma_handle_t::nbytes
volatile uint8_t dspi_master_edma_handle_t::state
uint8_t* volatile dspi_master_edma_handle_t::txData
uint8_t* volatile dspi_master_edma_handle_t::rxData
volatile size_t dspi_master_edma_handle_t::remainingSendByteCount
volatile size_t dspi_master_edma_handle_t::remainingReceiveByteCount
uint32_t dspi_master_edma_handle_t::rxBuffIfNull
uint32_t dspi_master_edma_handle_t::txBuffIfNull
dspi_master_edma_transfer_callback_t dspi_master_edma_handle_t::callback
void* dspi_master_edma_handle_t::userData
struct _dspi_slave_edma_handle

Forward declaration of the DSPI eDMA slave handle typedefs.

Data Fields

uint32_t bitsPerFrame
 The desired number of bits per frame. More...
 
uint8_t *volatile txData
 Send buffer. More...
 
uint8_t *volatile rxData
 Receive buffer. More...
 
volatile size_t remainingSendByteCount
 A number of bytes remaining to send. More...
 
volatile size_t remainingReceiveByteCount
 A number of bytes remaining to receive. More...
 
size_t totalByteCount
 A number of transfer bytes.
 
uint32_t rxBuffIfNull
 Used if there is not rxData for DMA purpose. More...
 
uint32_t txBuffIfNull
 Used if there is not txData for DMA purpose. More...
 
uint32_t txLastData
 Used if there is an extra byte when 16bits per frame for DMA purpose. More...
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
volatile uint8_t state
 DSPI transfer state. More...
 
dspi_slave_edma_transfer_callback_t callback
 Completion callback. More...
 
void * userData
 Callback user data. More...
 
edma_handle_tedmaRxRegToRxDataHandle
 edma_handle_t handle point used for RxReg to RxData buff
 
edma_handle_tedmaTxDataToTxRegHandle
 edma_handle_t handle point used for TxData to TxReg
 

Field Documentation

uint32_t dspi_slave_edma_handle_t::bitsPerFrame
uint8_t* volatile dspi_slave_edma_handle_t::txData
uint8_t* volatile dspi_slave_edma_handle_t::rxData
volatile size_t dspi_slave_edma_handle_t::remainingSendByteCount
volatile size_t dspi_slave_edma_handle_t::remainingReceiveByteCount
uint32_t dspi_slave_edma_handle_t::rxBuffIfNull
uint32_t dspi_slave_edma_handle_t::txBuffIfNull
uint32_t dspi_slave_edma_handle_t::txLastData
uint8_t dspi_slave_edma_handle_t::nbytes
volatile uint8_t dspi_slave_edma_handle_t::state
dspi_slave_edma_transfer_callback_t dspi_slave_edma_handle_t::callback
void* dspi_slave_edma_handle_t::userData

Typedef Documentation

typedef void(* dspi_master_edma_transfer_callback_t)(SPI_Type *base, dspi_master_edma_handle_t *handle, status_t status, void *userData)
Parameters
baseDSPI peripheral base address.
handleA pointer to the handle for the DSPI master.
statusSuccess or error code describing whether the transfer completed.
userDataAn arbitrary pointer-dataSized value passed from the application.
typedef void(* dspi_slave_edma_transfer_callback_t)(SPI_Type *base, dspi_slave_edma_handle_t *handle, status_t status, void *userData)
Parameters
baseDSPI peripheral base address.
handleA pointer to the handle for the DSPI slave.
statusSuccess or error code describing whether the transfer completed.
userDataAn arbitrary pointer-dataSized value passed from the application.

Function Documentation

void DSPI_MasterTransferCreateHandleEDMA ( SPI_Type *  base,
dspi_master_edma_handle_t *  handle,
dspi_master_edma_transfer_callback_t  callback,
void *  userData,
edma_handle_t edmaRxRegToRxDataHandle,
edma_handle_t edmaTxDataToIntermediaryHandle,
edma_handle_t edmaIntermediaryToTxRegHandle 
)

This function initializes the DSPI eDMA handle which can be used for other DSPI transactional APIs. Usually, for a specified DSPI instance, call this API once to get the initialized handle.

Note that DSPI eDMA has separated (RX and TX as two sources) or shared (RX and TX are the same source) DMA request source. (1) For the separated DMA request source, enable and set the RX DMAMUX source for edmaRxRegToRxDataHandle and TX DMAMUX source for edmaIntermediaryToTxRegHandle. (2) For the shared DMA request source, enable and set the RX/RX DMAMUX source for the edmaRxRegToRxDataHandle.

Parameters
baseDSPI peripheral base address.
handleDSPI handle pointer to dspi_master_edma_handle_t.
callbackDSPI callback.
userDataA callback function parameter.
edmaRxRegToRxDataHandleedmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToIntermediaryHandleedmaTxDataToIntermediaryHandle pointer to edma_handle_t.
edmaIntermediaryToTxRegHandleedmaIntermediaryToTxRegHandle pointer to edma_handle_t.
status_t DSPI_MasterTransferEDMA ( SPI_Type *  base,
dspi_master_edma_handle_t *  handle,
dspi_transfer_t transfer 
)

This function transfers data using eDMA. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_master_edma_handle_t structure which stores the transfer state.
transferA pointer to the dspi_transfer_t structure.
Returns
status of status_t.
void DSPI_MasterTransferAbortEDMA ( SPI_Type *  base,
dspi_master_edma_handle_t *  handle 
)

This function aborts a transfer which is using eDMA.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_master_edma_handle_t structure which stores the transfer state.
status_t DSPI_MasterTransferGetCountEDMA ( SPI_Type *  base,
dspi_master_edma_handle_t *  handle,
size_t *  count 
)

This function gets the master eDMA transfer count.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_master_edma_handle_t structure which stores the transfer state.
countA number of bytes transferred by the non-blocking transaction.
Returns
status of status_t.
void DSPI_SlaveTransferCreateHandleEDMA ( SPI_Type *  base,
dspi_slave_edma_handle_t *  handle,
dspi_slave_edma_transfer_callback_t  callback,
void *  userData,
edma_handle_t edmaRxRegToRxDataHandle,
edma_handle_t edmaTxDataToTxRegHandle 
)

This function initializes the DSPI eDMA handle which can be used for other DSPI transactional APIs. Usually, for a specified DSPI instance, call this API once to get the initialized handle.

Note that DSPI eDMA has separated (RN and TX in 2 sources) or shared (RX and TX are the same source) DMA request source. (1)For the separated DMA request source, enable and set the RX DMAMUX source for edmaRxRegToRxDataHandle and TX DMAMUX source for edmaTxDataToTxRegHandle. (2)For the shared DMA request source, enable and set the RX/RX DMAMUX source for the edmaRxRegToRxDataHandle.

Parameters
baseDSPI peripheral base address.
handleDSPI handle pointer to dspi_slave_edma_handle_t.
callbackDSPI callback.
userDataA callback function parameter.
edmaRxRegToRxDataHandleedmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToTxRegHandleedmaTxDataToTxRegHandle pointer to edma_handle_t.
status_t DSPI_SlaveTransferEDMA ( SPI_Type *  base,
dspi_slave_edma_handle_t *  handle,
dspi_transfer_t transfer 
)

This function transfers data using eDMA. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called. Note that the slave eDMA transfer doesn't support transfer_size is 1 when the bitsPerFrame is greater than eight.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_slave_edma_handle_t structure which stores the transfer state.
transferA pointer to the dspi_transfer_t structure.
Returns
status of status_t.
void DSPI_SlaveTransferAbortEDMA ( SPI_Type *  base,
dspi_slave_edma_handle_t *  handle 
)

This function aborts a transfer which is using eDMA.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_slave_edma_handle_t structure which stores the transfer state.
status_t DSPI_SlaveTransferGetCountEDMA ( SPI_Type *  base,
dspi_slave_edma_handle_t *  handle,
size_t *  count 
)

This function gets the slave eDMA transfer count.

Parameters
baseDSPI peripheral base address.
handleA pointer to the dspi_slave_edma_handle_t structure which stores the transfer state.
countA number of bytes transferred so far by the non-blocking transaction.
Returns
status of status_t.