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

Overview

The MCUXpresso SDK provides a peripheral driver for the Inter-Integrated Circuit (I2C) DMAC module of MCUXpresso SDK devices.

Data Structures

struct  i2c_master_dmac_handle_t
 I2C master DMAC transfer structure. More...
 

Macros

#define I2C_TX_LENGTH   8U
 Retry times for waiting flag. More...
 

Typedefs

typedef void(* i2c_master_dmac_transfer_callback_t )(I2C_Type *base, i2c_master_dmac_handle_t *handle, status_t status, void *userData)
 I2C master DMAC transfer callback typedef. More...
 
typedef void(* i2c_dmac_master_irq_handler_t )(I2C_Type *base, i2c_master_dmac_handle_t *handle)
 Typedef for master dmac handler. More...
 

Driver version

#define FSL_I2C_DMAC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 I2C DMAC driver version. More...
 

I2C Master DMAC Transfer Sub-group

void I2C_MasterTransferCreateHandleDMAC (I2C_Type *base, i2c_master_dmac_handle_t *handle, i2c_master_dmac_transfer_callback_t callback, void *userData, dmac_handle_t *dmacTxHandle, dmac_handle_t *dmacRxHandle)
 Initializes the I2C master transfer in DMAC way. More...
 
status_t I2C_MasterTransferDMAC (I2C_Type *base, i2c_master_dmac_handle_t *handle, i2c_master_transfer_t *xfer)
 Initiates a master transfer on the I2C bus in DMAC way. More...
 
void I2C_MasterTransferAbortDMAC (I2C_Type *base, i2c_master_dmac_handle_t *handle)
 Aborts an in-process transfer in DMAC way. More...
 

Data Structure Documentation

struct _i2c_master_dmac_handle

I2C master DMAC handle typedef.

Data Fields

I2C_Type * base
 I2C instance base pointer. More...
 
size_t transferSize
 Total bytes to be transferred. More...
 
volatile size_t dataSize
 Left bytes to be transferred. More...
 
uint8_t *volatile data
 Pointer to the user send/receive data buffer. More...
 
uint16_t txData [I2C_TX_LENGTH]
 The buffer of re-allocated 16-bit width data to be written to tx register. More...
 
dmac_channel_transfer_config_t dmacTxConfig
 The DMAC transfer configuration to transmit data. More...
 
uint8_t state
 I2C master transfer status. More...
 
dmac_handle_t * dmacTxHandle
 The DMAC handler used for tx. More...
 
dmac_handle_t * dmacRxHandle
 The DMAC handler used for rx. More...
 
i2c_master_dmac_transfer_callback_t completionCallback
 A callback function called after the DMAC transfer finished. More...
 
void * userData
 A callback parameter passed to the callback function. More...
 

Field Documentation

I2C_Type* i2c_master_dmac_handle_t::base
size_t i2c_master_dmac_handle_t::transferSize
volatile size_t i2c_master_dmac_handle_t::dataSize
uint8_t* volatile i2c_master_dmac_handle_t::data
uint16_t i2c_master_dmac_handle_t::txData[I2C_TX_LENGTH]
dmac_channel_transfer_config_t i2c_master_dmac_handle_t::dmacTxConfig
uint8_t i2c_master_dmac_handle_t::state
dmac_handle_t* i2c_master_dmac_handle_t::dmacTxHandle
dmac_handle_t* i2c_master_dmac_handle_t::dmacRxHandle
i2c_master_dmac_transfer_callback_t i2c_master_dmac_handle_t::completionCallback
void* i2c_master_dmac_handle_t::userData

Macro Definition Documentation

#define FSL_I2C_DMAC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
#define I2C_TX_LENGTH   8U

Buffer length of re-allocated 16-bit width data.

Typedef Documentation

typedef void(* i2c_master_dmac_transfer_callback_t)(I2C_Type *base, i2c_master_dmac_handle_t *handle, status_t status, void *userData)
typedef void(* i2c_dmac_master_irq_handler_t)(I2C_Type *base, i2c_master_dmac_handle_t *handle)

Function Documentation

void I2C_MasterTransferCreateHandleDMAC ( I2C_Type *  base,
i2c_master_dmac_handle_t *  handle,
i2c_master_dmac_transfer_callback_t  callback,
void *  userData,
dmac_handle_t *  dmacTxHandle,
dmac_handle_t *  dmacRxHandle 
)
Parameters
baseI2C peripheral base address
handlePointer to i2c_master_dmac_handle_t structure to store the transfer state.
callbackPointer to the user callback function
userDataUser configurable pointer to any data, function, structure etc that user wish to use in the callback
dmacTxHandleDMAC handle pointer for tx
dmacRxHandleDMAC handle pointer for rx
status_t I2C_MasterTransferDMAC ( I2C_Type *  base,
i2c_master_dmac_handle_t *  handle,
i2c_master_transfer_t xfer 
)
Note
Transfer in DMAC way is non-blocking which means this API returns immediately after transfer initiates. If user installs a user callback when calling I2C_MasterTransferCreateHandleDMAC before, the callback will be invoked when transfer finishes.
Parameters
baseI2C base pointer
handlepointer to i2c_master_transfer_handle_t structure which stores the transfer state.
xferPointer to the transfer configuration structure.
Return values
kStatus_SuccessSuccessfully start the data transmission.
kStatus_I2C_BusyPrevious transmission still not finished.
void I2C_MasterTransferAbortDMAC ( I2C_Type *  base,
i2c_master_dmac_handle_t *  handle 
)
Note
This API can be called at any time after a transfer of DMAC way initiates and before it finishes to abort the transfer early.
Parameters
baseI2C base pointer.
handlePointer to i2c_master_handle_t structure which stores the transfer state