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

Read Guidance

The LPI2C_EDMA module provide a method for LPI2C transfer operation based on EDMA.

Data Structures

struct  lpi2c_master_edma_transfer_handle_t
 Driver handle for master DMA APIs. More...
 

Typedefs

typedef void(* lpi2c_master_edma_transfer_callback_t )(lpi2c_master_edma_transfer_handle_t *psHandle)
 Master DMA completion callback function pointer type. More...
 

Master DMA

void LPI2C_MasterCreateEDMAHandle (LPI2C_Type *base, lpi2c_master_edma_transfer_handle_t *psHandle, lpi2c_master_edma_transfer_callback_t pfcallback, void *pUserData, DMA_Type *edmaBase, edma_channel_t eEdmaTxChannel, edma_channel_t eEdmaRxChannel)
 Create a new handle for the LPI2C master DMA APIs. More...
 
status_t LPI2C_MasterTransferEDMA (lpi2c_master_edma_transfer_handle_t *psHandle, lpi2c_master_transfer_t *psTransfer)
 Performs a non-blocking DMA-based transaction on the I2C bus. More...
 
status_t LPI2C_MasterTransferGetCountEDMA (lpi2c_master_edma_transfer_handle_t *psHandle, uint16_t *pu16Count)
 Returns number of bytes transferred so far. More...
 
status_t LPI2C_MasterTransferAbortEDMA (lpi2c_master_edma_transfer_handle_t *psHandle)
 Terminates a non-blocking LPI2C master transmission early. More...
 

Data Structure Documentation

struct _lpi2c_master_edma_transfer_handle
Note
The contents of this structure are private and subject to change.

Data Fields

LPI2C_Type * base
 LPI2C base pointer. More...
 
bool bIsBusy
 Transfer state machine current state. More...
 
uint8_t u8Nbytes
 eDMA minor byte transfer count initially configured. More...
 
uint16_t u16CommandBuffer [7]
 LPI2C command sequence. More...
 
lpi2c_master_transfer_t sTransfer
 Copy of the current transfer info. More...
 
lpi2c_master_edma_transfer_callback_t pfCallback
 Callback function pointer. More...
 
status_t completionStatus
 Either #kStatus_Success or an error code describing how the transfer completed. More...
 
void * pUserData
 Application data passed to callback. More...
 
edma_handle_t sRxDmaHandle
 Handle for receive DMA channel. More...
 
edma_handle_t sTxDmaHandle
 Handle for transmit DMA channel. More...
 

Field Documentation

LPI2C_Type* lpi2c_master_edma_transfer_handle_t::base
bool lpi2c_master_edma_transfer_handle_t::bIsBusy
uint8_t lpi2c_master_edma_transfer_handle_t::u8Nbytes
uint16_t lpi2c_master_edma_transfer_handle_t::u16CommandBuffer[7]
lpi2c_master_transfer_t lpi2c_master_edma_transfer_handle_t::sTransfer
lpi2c_master_edma_transfer_callback_t lpi2c_master_edma_transfer_handle_t::pfCallback
status_t lpi2c_master_edma_transfer_handle_t::completionStatus
void* lpi2c_master_edma_transfer_handle_t::pUserData
edma_handle_t lpi2c_master_edma_transfer_handle_t::sRxDmaHandle
edma_handle_t lpi2c_master_edma_transfer_handle_t::sTxDmaHandle

Typedef Documentation

typedef void(* lpi2c_master_edma_transfer_callback_t)(lpi2c_master_edma_transfer_handle_t *psHandle)

This callback is used only for the non-blocking master transfer API. Specify the callback you wish to use in the call to LPI2C_MasterCreateEDMAHandle().

Parameters
psHandleHandle associated with the completed transfer.

Function Documentation

void LPI2C_MasterCreateEDMAHandle ( LPI2C_Type *  base,
lpi2c_master_edma_transfer_handle_t *  psHandle,
lpi2c_master_edma_transfer_callback_t  pfcallback,
void *  pUserData,
DMA_Type *  edmaBase,
edma_channel_t  eEdmaTxChannel,
edma_channel_t  eEdmaRxChannel 
)

The creation of a handle is for use with the DMA APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_MasterTransferAbortEDMA() API shall be called.

For devices where the LPI2C send and receive DMA requests are OR'd together, the txDmaHandle parameter is ignored and may be set to NULL.

Parameters
baseThe LPI2C peripheral base address.
psHandlePointer to the LPI2C master driver handle.
pfcallbackUser provided pointer to the asynchronous callback function.
pUserDataUser provided pointer to the application callback data.
edmaBaseEdma base address.
eEdmaTxChanneleDMA channel for master transfer Tx request.
eEdmaTxChanneleDMA channel for master transfer Rx request.
status_t LPI2C_MasterTransferEDMA ( lpi2c_master_edma_transfer_handle_t *  psHandle,
lpi2c_master_transfer_t *  psTransfer 
)

The callback specified when the handle was created is invoked when the transaction has completed.

Parameters
psHandlePointer to the LPI2C master driver handle.
psTransferThe pointer to the transfer descriptor.
Return values
#kStatus_SuccessThe transaction was started successfully.
kStatus_LPI2C_BusyEither another master is currently utilizing the bus, or another DMA transaction is already in progress.
status_t LPI2C_MasterTransferGetCountEDMA ( lpi2c_master_edma_transfer_handle_t *  psHandle,
uint16_t *  pu16Count 
)
Parameters
psHandlePointer to the LPI2C master driver handle.
pu16CountNumber of bytes transferred so far by the non-blocking transaction.
Return values
#kStatus_Success
#kStatus_NoTransferInProgressThere is not a DMA transaction currently in progress.
status_t LPI2C_MasterTransferAbortEDMA ( lpi2c_master_edma_transfer_handle_t *  psHandle)
Note
It is not safe to call this function from an IRQ handler that has a higher priority than the eDMA peripheral's IRQ priority.
Parameters
psHandlePointer to the LPI2C master driver handle.
Return values
#kStatus_SuccessA transaction was successfully aborted.
kStatus_LPI2C_IdleThere is not a DMA transaction currently in progress.