MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexIO eDMA MCU Interface LCD Driver

SDK provide eDMA transactional APIs to transfer data using eDMA, the eDMA method is similar with interrupt transactional method. More...

Overview

Note
eDMA transactional functions use multiple beats method for better performance, in contrast, the blocking functions and interupt functions use single beat method. The function FLEXIO_MCULCD_ReadData, FLEXIO_MCULCD_WriteData, FLEXIO_MCULCD_GetStatusFlags, and FLEXIO_MCULCD_ClearStatusFlags are only used for single beat case, so don't use these functions to work together with eDMA functions.

FlexIO eDMA MCU Interface LCD Driver

FLEXIO LCD send/receive using a DMA method

flexio_MCULCD_edma_handle_t handle;
volatile bool completeFlag = false;
edma_handle_t rxEdmaHandle;
edma_handle_t txEdmaHandle;
void flexioLcdCallback(FLEXIO_MCULCD_Type *base, flexio_MCULCD_edma_handle_t *handle, status_t status, void *userData)
{
{
completeFlag = true;
}
}
void main(void)
{
// Create the edma Handle.
EDMA_CreateHandle(&rxEdmaHandle, DMA0, channel);
EDMA_CreateHandle(&txEdmaHandle, DMA0, channel);
// Configure the DMAMUX.
// ...
// rxEdmaHandle should use the last FlexIO RX shifters as DMA requst source.
// txEdmaHandle should use the first FlexIO TX shifters as DMA requst source.
// Init the FlexIO LCD driver.
// Create the transactional handle.
FLEXIO_MCULCD_TransferCreateHandleEDMA(&flexioLcdDev, &handle, flexioLcdCallback, NULL, &txEdmaHandle, &rxEdmaHandle);
xfer.command = command2;
xfer.dataAddrOrSameValue = (uint32_t)dataToSend;
xfer.dataCount = sizeof(dataToSend);
completeFlag = false;
FLEXIO_MCULCD_TransferEDMA(&flexioLcdDev, &handle, &xfer);
while (!completeFlag)
{
}
xfer.command = command2;
xfer.dataAddrOrSameValue = value;
xfer.dataCount = 1000;
completeFlag = false;
FLEXIO_MCULCD_TransferEDMA(&flexioLcdDev, &handle, &xfer);
while (!completeFlag)
{
}
xfer.command = command3;
xfer.dataAddrOrSameValue = (uint32_t)dataToReceive;
xfer.dataCount = sizeof(dataToReceive);
completeFlag = false;
FLEXIO_MCULCD_TransferEDMA(&flexioLcdDev, &handle, &xfer);
while (!completeFlag)
{
}
}

Data Structures

struct  flexio_mculcd_edma_handle_t
 FlexIO MCULCD eDMA transfer handle, users should not touch the content of the handle. More...
 

Macros

#define FSL_FLEXIO_MCULCD_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 4))
 FlexIO MCULCD EDMA driver version. More...
 

Typedefs

typedef void(* flexio_mculcd_edma_transfer_callback_t )(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, status_t status, void *userData)
 FlexIO MCULCD master callback for transfer complete. More...
 

eDMA Transactional

status_t FLEXIO_MCULCD_TransferCreateHandleEDMA (FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, flexio_mculcd_edma_transfer_callback_t callback, void *userData, edma_handle_t *txDmaHandle, edma_handle_t *rxDmaHandle)
 Initializes the FLEXO MCULCD master eDMA handle. More...
 
status_t FLEXIO_MCULCD_TransferEDMA (FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, flexio_mculcd_transfer_t *xfer)
 Performs a non-blocking FlexIO MCULCD transfer using eDMA. More...
 
void FLEXIO_MCULCD_TransferAbortEDMA (FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle)
 Aborts a FlexIO MCULCD transfer using eDMA. More...
 
status_t FLEXIO_MCULCD_TransferGetCountEDMA (FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, size_t *count)
 Gets the remaining bytes for FlexIO MCULCD eDMA transfer. More...
 

Data Structure Documentation

struct _flexio_mculcd_edma_handle

typedef for flexio_mculcd_edma_handle_t in advance.

Data Fields

FLEXIO_MCULCD_Typebase
 Pointer to the FLEXIO_MCULCD_Type. More...
 
uint8_t txShifterNum
 Number of shifters used for TX. More...
 
uint8_t rxShifterNum
 Number of shifters used for RX. More...
 
uint32_t minorLoopBytes
 eDMA transfer minor loop bytes. More...
 
edma_modulo_t txEdmaModulo
 Modulo value for the FlexIO shifter buffer access. More...
 
edma_modulo_t rxEdmaModulo
 Modulo value for the FlexIO shifter buffer access. More...
 
uint32_t dataAddrOrSameValue
 When sending the same value for many times, this is the value to send. More...
 
size_t dataCount
 Total count to be transferred. More...
 
volatile size_t remainingCount
 Remaining count still not transfered. More...
 
volatile uint32_t state
 FlexIO MCULCD driver internal state. More...
 
edma_handle_ttxDmaHandle
 DMA handle for MCULCD TX.
 
edma_handle_trxDmaHandle
 DMA handle for MCULCD RX.
 
flexio_mculcd_edma_transfer_callback_t completionCallback
 Callback for MCULCD DMA transfer.
 
void * userData
 User Data for MCULCD DMA callback.
 

Field Documentation

FLEXIO_MCULCD_Type* flexio_mculcd_edma_handle_t::base
uint8_t flexio_mculcd_edma_handle_t::txShifterNum
uint8_t flexio_mculcd_edma_handle_t::rxShifterNum
uint32_t flexio_mculcd_edma_handle_t::minorLoopBytes
edma_modulo_t flexio_mculcd_edma_handle_t::txEdmaModulo
edma_modulo_t flexio_mculcd_edma_handle_t::rxEdmaModulo
uint32_t flexio_mculcd_edma_handle_t::dataAddrOrSameValue

When writing or reading array, this is the address of the data array.

size_t flexio_mculcd_edma_handle_t::dataCount
volatile size_t flexio_mculcd_edma_handle_t::remainingCount
volatile uint32_t flexio_mculcd_edma_handle_t::state

Macro Definition Documentation

#define FSL_FLEXIO_MCULCD_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 0, 4))

Typedef Documentation

typedef void(* flexio_mculcd_edma_transfer_callback_t)(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, status_t status, void *userData)

When transfer finished, the callback function is called and returns the status as kStatus_FLEXIO_MCULCD_Idle.

Function Documentation

status_t FLEXIO_MCULCD_TransferCreateHandleEDMA ( FLEXIO_MCULCD_Type base,
flexio_mculcd_edma_handle_t *  handle,
flexio_mculcd_edma_transfer_callback_t  callback,
void *  userData,
edma_handle_t txDmaHandle,
edma_handle_t rxDmaHandle 
)

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

Parameters
basePointer to FLEXIO_MCULCD_Type structure.
handlePointer to flexio_mculcd_edma_handle_t structure to store the transfer state.
callbackMCULCD transfer complete callback, NULL means no callback.
userDatacallback function parameter.
txDmaHandleUser requested eDMA handle for FlexIO MCULCD eDMA TX, the DMA request source of this handle should be the first of TX shifters.
rxDmaHandleUser requested eDMA handle for FlexIO MCULCD eDMA RX, the DMA request source of this handle should be the last of RX shifters.
Return values
kStatus_SuccessSuccessfully create the handle.
status_t FLEXIO_MCULCD_TransferEDMA ( FLEXIO_MCULCD_Type base,
flexio_mculcd_edma_handle_t *  handle,
flexio_mculcd_transfer_t xfer 
)

This function returns immediately after transfer initiates. To check whether the transfer is completed, user could:

  1. Use the transfer completed callback;
  2. Polling function FLEXIO_MCULCD_GetTransferCountEDMA
Parameters
basepointer to FLEXIO_MCULCD_Type structure.
handlepointer to flexio_mculcd_edma_handle_t structure to store the transfer state.
xferPointer to FlexIO MCULCD transfer structure.
Return values
kStatus_SuccessSuccessfully start a transfer.
kStatus_InvalidArgumentInput argument is invalid.
kStatus_FLEXIO_MCULCD_BusyFlexIO MCULCD is not idle, it is running another transfer.
void FLEXIO_MCULCD_TransferAbortEDMA ( FLEXIO_MCULCD_Type base,
flexio_mculcd_edma_handle_t *  handle 
)
Parameters
basepointer to FLEXIO_MCULCD_Type structure.
handleFlexIO MCULCD eDMA handle pointer.
status_t FLEXIO_MCULCD_TransferGetCountEDMA ( FLEXIO_MCULCD_Type base,
flexio_mculcd_edma_handle_t *  handle,
size_t *  count 
)
Parameters
basepointer to FLEXIO_MCULCD_Type structure.
handleFlexIO MCULCD eDMA handle pointer.
countNumber of count transferred so far by the eDMA transaction.
Return values
kStatus_SuccessGet the transferred count Successfully.
kStatus_NoTransferInProgressNo transfer in process.