MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
QSCI_EDMA: EDMA based QSCI Driver

Read Guidance

The QSCI_EDMA module provide a method for QSCI transfer operation based on EDMA.

Data Structures

struct  qsci_edma_transfer_handle_t
 QSCI edma transfer handle. More...
 

Typedefs

typedef void(* qsci_edma_transfer_callback_t )(qsci_edma_transfer_handle_t *psHandle)
 QSCI edma transfer callback function definition. More...
 

Driver version

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

eDMA transactional

void QSCI_TransferCreateHandleEDMA (QSCI_Type *base, qsci_edma_transfer_handle_t *psHandle, qsci_edma_transfer_callback_t pfCallback, void *pUserData, DMA_Type *edmaBase, edma_channel_t eEdmaTxChannel, edma_channel_t eEdmaRxChannel)
 Initializes the QSCI edma handle. More...
 
status_t QSCI_TransferSendEDMA (qsci_edma_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer)
 Initiate data transmit using EDMA. More...
 
status_t QSCI_TransferReceiveEDMA (qsci_edma_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer)
 Initiate data receive using EDMA. More...
 
void QSCI_TransferAbortSendEDMA (qsci_edma_transfer_handle_t *psHandle)
 Aborts the data transmit process using EDMA. More...
 
void QSCI_TransferAbortReceiveEDMA (qsci_edma_transfer_handle_t *psHandle)
 Aborts the data receive process using EDMA. More...
 
status_t QSCI_TransferGetReceiveCountEDMA (qsci_edma_transfer_handle_t *psHandle, uint32_t *pu32Count)
 Gets the number of received bytes. More...
 
status_t QSCI_TransferGetSendCountEDMA (qsci_edma_transfer_handle_t *psHandle, uint32_t *pu32Count)
 Gets the number of bytes written to the QSCI TX register. More...
 

Data Structure Documentation

struct _qsci_edma_transfer_handle
Note
If user wants to use the transactional API to transfer data in edma way, one QSCI instance should and can only be allocated one handle.
The handle is maintained by QSCI driver internally, which means the transfer state is retained and user shall not modify its state u8TxState or u8RxState in application level. If user only wish to use transactional APIs without understanding its machanism, it is not necessary to understand these members.

Data Fields

QSCI_Type * base
 Pointer to the QSCI base that belongs to this handle. More...
 
qsci_edma_transfer_callback_t pfCallback
 Callback function. More...
 
uint32_t u32RxDataSizeAll
 Size of the data to receive. More...
 
uint32_t u32TxDataSizeAll
 Size of the data to send out. More...
 
edma_handle_t sTxEdmaHandle
 The eDMA TX channel used. More...
 
edma_handle_t sRxEdmaHandle
 The eDMA RX channel used. More...
 
volatile uint8_t u8TxState
 TX transfer state. More...
 
volatile uint8_t u8RxState
 RX transfer state.
 
status_t busStatus
 QSCI bus status. More...
 
void * pUserData
 
User configurable pointer to any data, function, structure etc that user wish to use in the

callback

 

Field Documentation

QSCI_Type* qsci_edma_transfer_handle_t::base
qsci_edma_transfer_callback_t qsci_edma_transfer_handle_t::pfCallback
uint32_t qsci_edma_transfer_handle_t::u32RxDataSizeAll
uint32_t qsci_edma_transfer_handle_t::u32TxDataSizeAll
edma_handle_t qsci_edma_transfer_handle_t::sTxEdmaHandle
edma_handle_t qsci_edma_transfer_handle_t::sRxEdmaHandle
volatile uint8_t qsci_edma_transfer_handle_t::u8TxState
status_t qsci_edma_transfer_handle_t::busStatus

Typedef Documentation

typedef void(* qsci_edma_transfer_callback_t)(qsci_edma_transfer_handle_t *psHandle)

Defines the interface of user callback function used in QSCI edma transfer using transactional APIs. The callback function shall be defined and declared in application level by user. Before starting QSCI transmiting or receiving by calling QSCI_TransferSendEDMA or QSCI_TransferReceiveEDMA, call QSCI_TransferCreateHandleEDMA to install the user callback. When the transmiting or receiving ends, user callback will be invoked by driver.

Parameters
psHandleTransfer handle that contains bus status, user data.

Function Documentation

void QSCI_TransferCreateHandleEDMA ( QSCI_Type *  base,
qsci_edma_transfer_handle_t *  psHandle,
qsci_edma_transfer_callback_t  pfCallback,
void *  pUserData,
DMA_Type *  edmaBase,
edma_channel_t  eEdmaTxChannel,
edma_channel_t  eEdmaRxChannel 
)

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

Parameters
baseQSCI peripheral base address.
psHandlePointer to qsci_edma_transfer_handle_t structure.
pfCallbackCallback function.
pUserDataUser data.
edmaBaseEdma base address.
eEdmaTxChanneleDMA channel for TX transfer.
eEdmaRxChanneleDMA channel for RX transfer.
status_t QSCI_TransferSendEDMA ( qsci_edma_transfer_handle_t *  psHandle,
qsci_transfer_t psTransfer 
)

This function initiates a data transmit process using eDMA. This is a non-blocking function, which returns right away. When all the data is sent, the send callback function is called.

Parameters
psHandleQSCI handle pointer.
psTransferQSCI eDMA transfer structure. See qsci_transfer_t.
Return values
kStatus_Successif succeed, others failed.
kStatus_QSCI_TxBusyPrevious transfer on going.
kStatus_InvalidArgumentInvalid argument.
status_t QSCI_TransferReceiveEDMA ( qsci_edma_transfer_handle_t *  psHandle,
qsci_transfer_t psTransfer 
)

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

Parameters
handlePointer to qsci_edma_transfer_handle_t structure.
psTransferQSCI eDMA transfer structure, see qsci_transfer_t.
Return values
kStatus_Successif succeed, others fail.
kStatus_QSCI_RxBusyPrevious transfer ongoing.
kStatus_InvalidArgumentInvalid argument.
void QSCI_TransferAbortSendEDMA ( qsci_edma_transfer_handle_t *  psHandle)
Parameters
psHandlePointer to qsci_edma_transfer_handle_t structure.
void QSCI_TransferAbortReceiveEDMA ( qsci_edma_transfer_handle_t *  psHandle)
Parameters
psHandlePointer to qsci_edma_transfer_handle_t structure.
status_t QSCI_TransferGetReceiveCountEDMA ( qsci_edma_transfer_handle_t *  psHandle,
uint32_t *  pu32Count 
)

This function gets the number of received bytes.

Parameters
psHandleQSCI handle pointer.
pu32CountReceive bytes count.
Return values
kStatus_NoTransferInProgressNo receive in progress.
kStatus_SuccessGet successfully through the parameter count;
status_t QSCI_TransferGetSendCountEDMA ( qsci_edma_transfer_handle_t *  psHandle,
uint32_t *  pu32Count 
)

This function gets the number of bytes written to the QSCI TX register by DMA.

Parameters
psHandleQSCI handle pointer.
pu32CountSend bytes count.
Return values
kStatus_NoTransferInProgressNo send in progress.
kStatus_SuccessGet successfully through the parameter count;