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

Overview

Data Structures

struct  _lpspi_master_edma_handle
 LPSPI master eDMA transfer handle structure used for transactional API. More...
 
struct  _lpspi_slave_edma_handle
 LPSPI slave eDMA transfer handle structure used for transactional API. More...
 

Typedefs

typedef struct
_lpspi_master_edma_handle 
lpspi_master_edma_handle_t
 Forward declaration of the _lpspi_master_edma_handle typedefs.
 
typedef struct
_lpspi_slave_edma_handle 
lpspi_slave_edma_handle_t
 Forward declaration of the _lpspi_slave_edma_handle 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...
 
status_t LPSPI_MasterTransferPrepareEDMALite (LPSPI_Type *base, lpspi_master_edma_handle_t *handle, uint32_t configFlags)
 LPSPI master config transfer parameter while using eDMA. More...
 
status_t LPSPI_MasterTransferEDMALite (LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_transfer_t *transfer)
 LPSPI master transfer data using eDMA without configs. 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, 4, 2))
 LPSPI EDMA driver version. More...
 

Data Structure Documentation

struct _lpspi_master_edma_handle

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::isPcsContinuous
volatile bool _lpspi_master_edma_handle::isByteSwap
volatile uint8_t _lpspi_master_edma_handle::fifoSize
volatile uint8_t _lpspi_master_edma_handle::rxWatermark
volatile uint8_t _lpspi_master_edma_handle::bytesEachWrite
volatile uint8_t _lpspi_master_edma_handle::bytesEachRead
volatile uint8_t _lpspi_master_edma_handle::bytesLastRead
volatile bool _lpspi_master_edma_handle::isThereExtraRxBytes
uint8_t* volatile _lpspi_master_edma_handle::txData
uint8_t* volatile _lpspi_master_edma_handle::rxData
volatile size_t _lpspi_master_edma_handle::txRemainingByteCount
volatile size_t _lpspi_master_edma_handle::rxRemainingByteCount
volatile uint32_t _lpspi_master_edma_handle::writeRegRemainingTimes
volatile uint32_t _lpspi_master_edma_handle::readRegRemainingTimes
uint32_t _lpspi_master_edma_handle::txBuffIfNull
uint32_t _lpspi_master_edma_handle::rxBuffIfNull
uint32_t _lpspi_master_edma_handle::transmitCommand
volatile uint8_t _lpspi_master_edma_handle::state
uint8_t _lpspi_master_edma_handle::nbytes
lpspi_master_edma_transfer_callback_t _lpspi_master_edma_handle::callback
void* _lpspi_master_edma_handle::userData
struct _lpspi_slave_edma_handle

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::isByteSwap
volatile uint8_t _lpspi_slave_edma_handle::fifoSize
volatile uint8_t _lpspi_slave_edma_handle::rxWatermark
volatile uint8_t _lpspi_slave_edma_handle::bytesEachWrite
volatile uint8_t _lpspi_slave_edma_handle::bytesEachRead
volatile uint8_t _lpspi_slave_edma_handle::bytesLastRead
volatile bool _lpspi_slave_edma_handle::isThereExtraRxBytes
uint8_t _lpspi_slave_edma_handle::nbytes
uint8_t* volatile _lpspi_slave_edma_handle::txData
uint8_t* volatile _lpspi_slave_edma_handle::rxData
volatile size_t _lpspi_slave_edma_handle::txRemainingByteCount
volatile size_t _lpspi_slave_edma_handle::rxRemainingByteCount
volatile uint32_t _lpspi_slave_edma_handle::writeRegRemainingTimes
volatile uint32_t _lpspi_slave_edma_handle::readRegRemainingTimes
uint32_t _lpspi_slave_edma_handle::txBuffIfNull
uint32_t _lpspi_slave_edma_handle::rxBuffIfNull
volatile uint8_t _lpspi_slave_edma_handle::state
uint32_t _lpspi_slave_edma_handle::errorCount
lpspi_slave_edma_transfer_callback_t _lpspi_slave_edma_handle::callback
void* _lpspi_slave_edma_handle::userData

Macro Definition Documentation

#define FSL_LPSPI_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 4, 2))

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 Tx 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 edmaTxDataToTxRegHandle. (2) For a shared DMA request source, enable and set the Rx/Tx 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.
status_t LPSPI_MasterTransferPrepareEDMALite ( LPSPI_Type *  base,
lpspi_master_edma_handle_t handle,
uint32_t  configFlags 
)

This function is preparing to transfer data using eDMA, work with LPSPI_MasterTransferEDMALite.

Parameters
baseLPSPI peripheral base address.
handlepointer to lpspi_master_edma_handle_t structure which stores the transfer state.
configFlagstransfer configuration flags. _lpspi_transfer_config_flag_for_master.
Returns
Indicates whether LPSPI master transfer was successful or not.
Return values
kStatus_SuccessExecution successfully.
kStatus_LPSPI_BusyThe LPSPI device is busy.
status_t LPSPI_MasterTransferEDMALite ( 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: This API is only for transfer through DMA without configuration. Before calling this API, you must call LPSPI_MasterTransferPrepareEDMALite to configure it once. 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, config field is not uesed.
Returns
Indicates whether LPSPI master transfer was successful or not.
Return values
kStatus_SuccessExecution successfully.
kStatus_LPSPI_BusyThe LPSPI device is busy.
kStatus_InvalidArgumentThe transfer structure is invalid.
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.