MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
QSCI_DMA: DMA based QSCI Driver

Overview

The QSCI_DMA module provide a method for QSCI transfer operation based on DMA.

Data Structures

struct  qsci_dma_transfer_handle_t
 QSCI dma transfer handle. More...
 

Typedefs

typedef void(* qsci_dma_transfer_callback_t )(qsci_dma_transfer_handle_t *psHandle)
 QSCI dma transfer callback function definition. More...
 

Driver version

#define FSL_QSCI_DMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
 QSCI DMA driver version. More...
 

DMA transactional

void QSCI_TransferCreateHandleDMA (QSCI_Type *base, qsci_dma_transfer_handle_t *psHandle, qsci_dma_transfer_callback_t pfCallback, void *pUserData, DMA_Type *dmaBase, dma_channel_t dmaTxChannel, dma_channel_t dmaRxChannel)
 Initializes the QSCI dma handle. More...
 
status_t QSCI_TransferSendDMA (qsci_dma_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer)
 Initiate data transmit using DMA. More...
 
status_t QSCI_TransferReceiveDMA (qsci_dma_transfer_handle_t *psHandle, qsci_transfer_t *psTransfer)
 Initiate data receive using DMA. More...
 
void QSCI_TransferAbortSendDMA (qsci_dma_transfer_handle_t *psHandle)
 Aborts the data transmit process using DMA. More...
 
void QSCI_TransferAbortReceiveDMA (qsci_dma_transfer_handle_t *psHandle)
 Aborts the data receive process using DMA. More...
 
status_t QSCI_TransferGetReceivedCountDMA (qsci_dma_transfer_handle_t *psHandle, uint32_t *pu32Count)
 Gets the number of received bytes. More...
 
status_t QSCI_TransferGetSendCountDMA (qsci_dma_transfer_handle_t *psHandle, uint32_t *pu32Count)
 Gets the number of bytes written to the QSCI TX register. More...
 

Data Structure Documentation

struct _qsci_dma_transfer_handle

Forward declaration of the qsci dma handle typedef.

This struct address should be sizeof(dma_channel_tcd_t) aligned.

Note
If user wants to use the transactional API to transfer data in dma 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_dma_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...
 
dma_handle_t sTxDmaHandle
 The DMA TX channel used. More...
 
dma_handle_t sRxDmaHandle
 The DMA 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_dma_transfer_handle_t::base
qsci_dma_transfer_callback_t qsci_dma_transfer_handle_t::pfCallback
uint32_t qsci_dma_transfer_handle_t::u32RxDataSizeAll
uint32_t qsci_dma_transfer_handle_t::u32TxDataSizeAll
dma_handle_t qsci_dma_transfer_handle_t::sTxDmaHandle
dma_handle_t qsci_dma_transfer_handle_t::sRxDmaHandle
volatile uint8_t qsci_dma_transfer_handle_t::u8TxState
status_t qsci_dma_transfer_handle_t::busStatus

Macro Definition Documentation

#define FSL_QSCI_DMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))

Typedef Documentation

typedef void(* qsci_dma_transfer_callback_t)(qsci_dma_transfer_handle_t *psHandle)

Defines the interface of user callback function used in QSCI dma 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_TransferSendDMA or QSCI_TransferReceiveDMA, call QSCI_TransferCreateHandleDMA 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_TransferCreateHandleDMA ( QSCI_Type *  base,
qsci_dma_transfer_handle_t *  psHandle,
qsci_dma_transfer_callback_t  pfCallback,
void *  pUserData,
DMA_Type *  dmaBase,
dma_channel_t  dmaTxChannel,
dma_channel_t  dmaRxChannel 
)

This function initializes the QSCI dma 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_dma_transfer_handle_t structure.
pfCallbackCallback function.
pUserDataUser data.
dmaBaseDMA base address.
dmaTxChannelDMA channel for TX transfer.
dmaRxChannelDMA channel for RX transfer.
status_t QSCI_TransferSendDMA ( qsci_dma_transfer_handle_t *  psHandle,
qsci_transfer_t psTransfer 
)

This function initiates a data transmit process using DMA. 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 DMA 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_TransferReceiveDMA ( qsci_dma_transfer_handle_t *  psHandle,
qsci_transfer_t psTransfer 
)

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

Parameters
psHandlePointer to qsci_dma_transfer_handle_t structure.
psTransferQSCI DMA transfer structure, see qsci_transfer_t.
Return values
kStatus_Successif succeed, others fail.
kStatus_QSCI_RxBusyPrevious transfer ongoing.
kStatus_InvalidArgumentInvalid argument.
void QSCI_TransferAbortSendDMA ( qsci_dma_transfer_handle_t *  psHandle)
Parameters
psHandlePointer to qsci_dma_transfer_handle_t structure.
void QSCI_TransferAbortReceiveDMA ( qsci_dma_transfer_handle_t *  psHandle)
Parameters
psHandlePointer to qsci_dma_transfer_handle_t structure.
status_t QSCI_TransferGetReceivedCountDMA ( qsci_dma_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_TransferGetSendCountDMA ( qsci_dma_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;