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

Overview

Data Structures

struct  lpspi_master_edma_handle_t
 LPSPI master eDMA transfer handle structure used for transactional API. More...
 
struct  lpspi_slave_edma_handle_t
 LPSPI slave eDMA transfer handle structure used for transactional API. More...
 

Typedefs

typedef void(* lpspi_master_edma_transfer_callback_t )(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData)
 Completion callback function pointer type. More...
 
typedef void(* lpspi_slave_edma_transfer_callback_t )(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, status_t status, void *userData)
 Completion callback function pointer type. More...
 

Functions

void LPSPI_MasterTransferCreateHandleEDMA (LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
 Initializes the LPSPI master eDMA handle. More...
 
status_t LPSPI_MasterTransferEDMA (LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_transfer_t *transfer)
 LPSPI master transfer data using eDMA. More...
 
void LPSPI_MasterTransferAbortEDMA (LPSPI_Type *base, lpspi_master_edma_handle_t *handle)
 LPSPI master aborts a transfer which is using eDMA. More...
 
status_t LPSPI_MasterTransferGetCountEDMA (LPSPI_Type *base, lpspi_master_edma_handle_t *handle, size_t *count)
 Gets the master eDMA transfer remaining bytes. More...
 
void LPSPI_SlaveTransferCreateHandleEDMA (LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
 Initializes the LPSPI slave eDMA handle. More...
 
status_t LPSPI_SlaveTransferEDMA (LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_transfer_t *transfer)
 LPSPI slave transfers data using eDMA. More...
 
void LPSPI_SlaveTransferAbortEDMA (LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
 LPSPI slave aborts a transfer which is using eDMA. More...
 
status_t LPSPI_SlaveTransferGetCountEDMA (LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, size_t *count)
 Gets the slave eDMA transfer remaining bytes. More...
 

Driver version

#define FSL_LPSPI_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 5))
 LPSPI EDMA driver version 2.0.5. More...
 

Data Structure Documentation

struct _lpspi_master_edma_handle

Forward declaration of the _lpspi_master_edma_handle typedefs.

Data Fields

volatile bool isPcsContinuous
 Is PCS continuous in transfer. More...
 
volatile bool isByteSwap
 A flag that whether should byte swap. More...
 
volatile uint8_t fifoSize
 FIFO dataSize. More...
 
volatile uint8_t rxWatermark
 Rx watermark. More...
 
volatile uint8_t bytesEachWrite
 Bytes for each write TDR. More...
 
volatile uint8_t bytesEachRead
 Bytes for each read RDR. More...
 
volatile uint8_t bytesLastRead
 Bytes for last read RDR. More...
 
volatile bool isThereExtraRxBytes
 Is there extra RX byte. More...
 
uint8_t *volatile txData
 Send buffer. More...
 
uint8_t *volatile rxData
 Receive buffer. More...
 
volatile size_t txRemainingByteCount
 Number of bytes remaining to send. More...
 
volatile size_t rxRemainingByteCount
 Number of bytes remaining to receive. More...
 
volatile uint32_t writeRegRemainingTimes
 Write TDR register remaining times. More...
 
volatile uint32_t readRegRemainingTimes
 Read RDR register remaining times. More...
 
uint32_t totalByteCount
 Number of transfer bytes.
 
uint32_t txBuffIfNull
 Used if there is not txData for DMA purpose. More...
 
uint32_t rxBuffIfNull
 Used if there is not rxData for DMA purpose. More...
 
uint32_t transmitCommand
 Used to write TCR for DMA purpose. More...
 
volatile uint8_t state
 LPSPI transfer state , _lpspi_transfer_state. More...
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
lpspi_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_tedmaTxDataToTxRegHandle
 edma_handle_t handle point used for TxData to TxReg buff
 
edma_tcd_t lpspiSoftwareTCD [3]
 SoftwareTCD, internal used.
 

Field Documentation

volatile bool lpspi_master_edma_handle_t::isPcsContinuous
volatile bool lpspi_master_edma_handle_t::isByteSwap
volatile uint8_t lpspi_master_edma_handle_t::fifoSize
volatile uint8_t lpspi_master_edma_handle_t::rxWatermark
volatile uint8_t lpspi_master_edma_handle_t::bytesEachWrite
volatile uint8_t lpspi_master_edma_handle_t::bytesEachRead
volatile uint8_t lpspi_master_edma_handle_t::bytesLastRead
volatile bool lpspi_master_edma_handle_t::isThereExtraRxBytes
uint8_t* volatile lpspi_master_edma_handle_t::txData
uint8_t* volatile lpspi_master_edma_handle_t::rxData
volatile size_t lpspi_master_edma_handle_t::txRemainingByteCount
volatile size_t lpspi_master_edma_handle_t::rxRemainingByteCount
volatile uint32_t lpspi_master_edma_handle_t::writeRegRemainingTimes
volatile uint32_t lpspi_master_edma_handle_t::readRegRemainingTimes
uint32_t lpspi_master_edma_handle_t::txBuffIfNull
uint32_t lpspi_master_edma_handle_t::rxBuffIfNull
uint32_t lpspi_master_edma_handle_t::transmitCommand
volatile uint8_t lpspi_master_edma_handle_t::state
uint8_t lpspi_master_edma_handle_t::nbytes
lpspi_master_edma_transfer_callback_t lpspi_master_edma_handle_t::callback
void* lpspi_master_edma_handle_t::userData
struct _lpspi_slave_edma_handle

Forward declaration of the _lpspi_slave_edma_handle typedefs.

Data Fields

volatile bool isByteSwap
 A flag that whether should byte swap. More...
 
volatile uint8_t fifoSize
 FIFO dataSize. More...
 
volatile uint8_t rxWatermark
 Rx watermark. More...
 
volatile uint8_t bytesEachWrite
 Bytes for each write TDR. More...
 
volatile uint8_t bytesEachRead
 Bytes for each read RDR. More...
 
volatile uint8_t bytesLastRead
 Bytes for last read RDR. More...
 
volatile bool isThereExtraRxBytes
 Is there extra RX byte. More...
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
uint8_t *volatile txData
 Send buffer. More...
 
uint8_t *volatile rxData
 Receive buffer. More...
 
volatile size_t txRemainingByteCount
 Number of bytes remaining to send. More...
 
volatile size_t rxRemainingByteCount
 Number of bytes remaining to receive. More...
 
volatile uint32_t writeRegRemainingTimes
 Write TDR register remaining times. More...
 
volatile uint32_t readRegRemainingTimes
 Read RDR register remaining times. More...
 
uint32_t totalByteCount
 Number of transfer bytes.
 
uint32_t txBuffIfNull
 Used if there is not txData for DMA purpose. More...
 
uint32_t rxBuffIfNull
 Used if there is not rxData for DMA purpose. More...
 
volatile uint8_t state
 LPSPI transfer state. More...
 
uint32_t errorCount
 Error count for slave transfer. More...
 
lpspi_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
 
edma_tcd_t lpspiSoftwareTCD [2]
 SoftwareTCD, internal used.
 

Field Documentation

volatile bool lpspi_slave_edma_handle_t::isByteSwap
volatile uint8_t lpspi_slave_edma_handle_t::fifoSize
volatile uint8_t lpspi_slave_edma_handle_t::rxWatermark
volatile uint8_t lpspi_slave_edma_handle_t::bytesEachWrite
volatile uint8_t lpspi_slave_edma_handle_t::bytesEachRead
volatile uint8_t lpspi_slave_edma_handle_t::bytesLastRead
volatile bool lpspi_slave_edma_handle_t::isThereExtraRxBytes
uint8_t lpspi_slave_edma_handle_t::nbytes
uint8_t* volatile lpspi_slave_edma_handle_t::txData
uint8_t* volatile lpspi_slave_edma_handle_t::rxData
volatile size_t lpspi_slave_edma_handle_t::txRemainingByteCount
volatile size_t lpspi_slave_edma_handle_t::rxRemainingByteCount
volatile uint32_t lpspi_slave_edma_handle_t::writeRegRemainingTimes
volatile uint32_t lpspi_slave_edma_handle_t::readRegRemainingTimes
uint32_t lpspi_slave_edma_handle_t::txBuffIfNull
uint32_t lpspi_slave_edma_handle_t::rxBuffIfNull
volatile uint8_t lpspi_slave_edma_handle_t::state
uint32_t lpspi_slave_edma_handle_t::errorCount
lpspi_slave_edma_transfer_callback_t lpspi_slave_edma_handle_t::callback
void* lpspi_slave_edma_handle_t::userData

Macro Definition Documentation

#define FSL_LPSPI_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 5))

Typedef Documentation

typedef void(* lpspi_master_edma_transfer_callback_t)(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData)
Parameters
baseLPSPI peripheral base address.
handlePointer to the handle for the LPSPI master.
statusSuccess or error code describing whether the transfer completed.
userDataArbitrary pointer-dataSized value passed from the application.
typedef void(* lpspi_slave_edma_transfer_callback_t)(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, status_t status, void *userData)
Parameters
baseLPSPI peripheral base address.
handlePointer to the handle for the LPSPI slave.
statusSuccess or error code describing whether the transfer completed.
userDataArbitrary pointer-dataSized value passed from the application.

Function Documentation

void LPSPI_MasterTransferCreateHandleEDMA ( LPSPI_Type *  base,
lpspi_master_edma_handle_t *  handle,
lpspi_master_edma_transfer_callback_t  callback,
void *  userData,
edma_handle_t edmaRxRegToRxDataHandle,
edma_handle_t edmaTxDataToTxRegHandle 
)

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

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

Parameters
baseLPSPI peripheral base address.
handleLPSPI handle pointer to lpspi_master_edma_handle_t.
callbackLPSPI callback.
userDatacallback function parameter.
edmaRxRegToRxDataHandleedmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToTxRegHandleedmaTxDataToTxRegHandle pointer to edma_handle_t.
status_t LPSPI_MasterTransferEDMA ( LPSPI_Type *  base,
lpspi_master_edma_handle_t *  handle,
lpspi_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: The transfer data size should be an integer multiple of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_master_edma_handle_t structure which stores the transfer state.
transferpointer to lpspi_transfer_t structure.
Returns
status of status_t.
void LPSPI_MasterTransferAbortEDMA ( LPSPI_Type *  base,
lpspi_master_edma_handle_t *  handle 
)

This function aborts a transfer which is using eDMA.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_master_edma_handle_t structure which stores the transfer state.
status_t LPSPI_MasterTransferGetCountEDMA ( LPSPI_Type *  base,
lpspi_master_edma_handle_t *  handle,
size_t *  count 
)

This function gets the master eDMA transfer remaining bytes.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_master_edma_handle_t structure which stores the transfer state.
countNumber of bytes transferred so far by the EDMA transaction.
Returns
status of status_t.
void LPSPI_SlaveTransferCreateHandleEDMA ( LPSPI_Type *  base,
lpspi_slave_edma_handle_t *  handle,
lpspi_slave_edma_transfer_callback_t  callback,
void *  userData,
edma_handle_t edmaRxRegToRxDataHandle,
edma_handle_t edmaTxDataToTxRegHandle 
)

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

Note that LPSPI eDMA has a separated (Rx and Tx as two sources) or shared (Rx and Tx as the same source) DMA request source.

(1) For a separated DMA request source, enable and set the Rx DMAMUX source for edmaRxRegToRxDataHandle and Tx DMAMUX source for edmaTxDataToTxRegHandle. (2) For a shared DMA request source, enable and set the Rx/Rx DMAMUX source for edmaRxRegToRxDataHandle .

Parameters
baseLPSPI peripheral base address.
handleLPSPI handle pointer to lpspi_slave_edma_handle_t.
callbackLPSPI callback.
userDatacallback function parameter.
edmaRxRegToRxDataHandleedmaRxRegToRxDataHandle pointer to edma_handle_t.
edmaTxDataToTxRegHandleedmaTxDataToTxRegHandle pointer to edma_handle_t.
status_t LPSPI_SlaveTransferEDMA ( LPSPI_Type *  base,
lpspi_slave_edma_handle_t *  handle,
lpspi_transfer_t transfer 
)

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

Note: The transfer data size should be an integer multiple of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
transferpointer to lpspi_transfer_t structure.
Returns
status of status_t.
void LPSPI_SlaveTransferAbortEDMA ( LPSPI_Type *  base,
lpspi_slave_edma_handle_t *  handle 
)

This function aborts a transfer which is using eDMA.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
status_t LPSPI_SlaveTransferGetCountEDMA ( LPSPI_Type *  base,
lpspi_slave_edma_handle_t *  handle,
size_t *  count 
)

This function gets the slave eDMA transfer remaining bytes.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_slave_edma_handle_t structure which stores the transfer state.
countNumber of bytes transferred so far by the eDMA transaction.
Returns
status of status_t.