AM261x MCU+ SDK: APIs for I2C LLD

| AM261x MCU+ SDK 26.00.00 |

Files | Data Structures | Functions | Typedefs
APIs for I2C LLD
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the I2C LLD module. The APIs can be used by other drivers to get access to I2C and also by application to initiate transaction operations.

The I2C LLD header file should be included in an application as follows:

#include <drivers/i2c/v1/lld/i2c_lld.h>

## Files
file | i2c_lld.h
| I2C LLD Driver API/interface file.

## Data Structures
struct | I2CLLD_Transaction
| I2C Transaction. More...
struct | I2CLLD_Message
| I2C Message. More...
struct | I2C_ExtendedParams
| Data structure used with I2C_lld_write(), I2C_lld_writeIntr(), I2C_lld_read(), I2C_lld_readIntr() More...
struct | I2C_Memory_ExtendedParams
| Data structure used with I2C_lld_mem_write(), I2C_lld_mem_writeIntr(), I2C_lld_mem_read(), I2C_lld_mem_readIntr() More...
struct | I2CLLD_targetTransaction
| I2C Target Transaction. More...
struct | I2CLLD_Object
| I2C Driver Object. More...

## Functions
int32_t | I2C_lld_init (I2CLLD_Handle handle)
| API to Initializes the I2C instance. More...
int32_t | I2C_lld_deInit (I2CLLD_Handle handle)
| API to De-Initializes the I2C instance. More...
int32_t | I2C_lld_Transaction_init (I2CLLD_Transaction *transaction)
| API to set default values of I2CLLD_Transaction in transaction. More...
int32_t | I2C_lld_Message_init (I2CLLD_Message *msg)
| API to set default values of I2CLLD_Message in msg. More...
int32_t | I2C_lld_write (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
| API to initiate an I2C write operation in polled mode as I2C Controller. More...
int32_t | I2C_lld_target_write (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
| API to initiate an I2C write operation in polled mode as I2C Target. More...
int32_t | I2C_lld_writeIntr (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
| API to initiate an I2C write operation in interrupt mode as I2C Controller. More...
int32_t | I2C_lld_target_writeIntr (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
| API to Initiate an I2C write operation in interrupt mode as I2C Target. More...
int32_t | I2C_lld_read (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
| API to initiate an I2C read operation in polled mode as I2C Controller. More...
int32_t | I2C_lld_target_read (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
| API to initiate an I2C read Operation in polled mode as I2C Target. More...
int32_t | I2C_lld_readIntr (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
| API to initiate an I2C read operation in interrupt mode as I2C Controller. More...
int32_t | I2C_lld_target_readIntr (I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
| API to initiate an I2C read operation in interrupt mode as I2C Target. More...
int32_t | I2C_lld_mem_write (I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams, uint32_t timeout)
| API to initiate a Memory write Operation in polling Mode. More...
int32_t | I2C_lld_mem_writeIntr (I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams)
| API to initiate a Memory write operation in interrupt Mode. More...
int32_t | I2C_lld_mem_read (I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams, uint32_t timeout)
| API to initiate a Memory read operation in Polled mode. More...
int32_t | I2C_lld_mem_readIntr (I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams)
| API to initiate a Memory read operation in interrupt mode. More...
int32_t | I2C_lld_transferPoll (I2CLLD_Handle handle, I2CLLD_Message *msg)
| API to initiate a transfer from I2C in polled mode. More...
int32_t | I2C_lld_transferIntr (I2CLLD_Handle handle, I2CLLD_Message *msg)
| API to initiate a transfer from I2C in interrupt mode. More...
int32_t | I2C_lld_targetTransferIntr (I2CLLD_Handle handle, I2CLLD_targetTransaction *txn)
| API to initiate a transfer from I2C in interrupt mode as target. More...
int32_t | I2C_lld_probe (I2CLLD_Handle handle, uint32_t targetAddr)
| API to probe I2C. More...
int32_t | I2C_lld_setBusFrequency (I2CLLD_Handle handle, uint32_t busFrequency)
| API to set the bus frequency. More...
void | I2C_lld_controllerIsr (void *args)
| I2C Controller ISR, can be used as IRQ handler in Controller mode. More...
void | I2C_lld_targetIsr (void *args)
| I2C Target ISR, can be used as IRQ handler in Target mode. More...
void | I2CControllerControl (uint32_t baseAddr, uint32_t ctrlMask, uint32_t ctrlCmds)
void | I2CSetDataCount (uint32_t baseAddr, uint32_t count)
void | I2CControllerStart (uint32_t baseAddr)
void | I2CControllerIntEnableEx (uint32_t baseAddr, uint32_t intFlag)
void | I2CControllerTargetAddrSet (uint32_t baseAddr, uint32_t targetAddr)
void | I2CControllerIntClearEx (uint32_t baseAddr, uint32_t intFlag)
void | I2CModeControl (uint32_t baseAddr, uint32_t ctrlMask, uint32_t ctrlCmds)
void | I2CTargetEnable (uint32_t baseAddr)

## Typedefs
typedef uint32_t(* | I2C_Clock_getTicks) (void)
| The definition of a get System Tick function used by the I2C driver to keep track of time. More...
typedef uint32_t(* | I2C_Clock_usecToTicks) (uint64_t usecs)
| The definition of a micro seconds to ticks function used by the I2C driver to get ticks from microseconds. More...
typedef void(* | I2C_Clock_uSleep) (uint32_t usec)
| The definition of a sleep function used by the I2C driver for delay. More...
typedef void(* | I2C_lld_transferCompleteCallback) (void *args, const I2CLLD_Message *msg, int32_t transferStatus)
| The definition of a transfer completion callback function used by the I2C driver when used in Controller Callback Mode. More...
typedef void(* | I2C_lld_targetTransferCompleteCallback) (void *args, const I2CLLD_targetTransaction *targetTxn, int32_t transferStatus)
| The definition of a transfer completion callback function used by the I2C driver when used in Target Mode. More...
typedef struct I2CLLD_Object * | I2CLLD_Handle

## Return status
#define | I2C_STS_SUCCESS ((int32_t) 0)
| Return status when the API execution was successful. More...
#define | I2C_STS_ERR ((int32_t)-1)
| Return status when the API execution was not successful due to a generic Error. More...
#define | I2C_STS_ERR_TIMEOUT ((int32_t)-2)
| Return status when the API execution was not successful due to a time out. More...
#define | I2C_STS_ERR_INVALID_PARAM ((int32_t)-3)
| Return status when the API execution failed due invalid parameters. More...
#define | I2C_STS_ERR_BUS_BUSY ((int32_t)-4)
| Return status when the API execution failed due to driver busy. More...
#define | I2C_STS_ERR_NO_ACK ((int32_t)-5)
| Return status when the API execution failed due to no Acknowledgement from target. More...
#define | I2C_STS_ERR_ARBITRATION_LOST ((int32_t)-6)
| Return status when the API execution failed due to loss in arbitration during transmission. More...

## Timeout values
#define | I2C_NO_WAIT ((uint32_t)0)
| Value to use when needing a timeout of zero or NO timeout, return immediately on resource not available. More...
#define | I2C_WAIT_FOREVER ((uint32_t)-1)
| Value to use when needing a timeout of infinity or wait forver until resource is available. More...

## I2C Driver states
#define | I2C_STATE_RESET ((uint8_t) 0U)
| I2C driver is in Reset State prior to driver init and post driver deinit. More...
#define | I2C_STATE_IDLE ((uint8_t) 1U)
| I2C driver accepts runtime APIs only Ready State, otherwise return error. More...
#define | I2C_STATE_BUSY ((uint8_t) 2U)
| I2C driver is busy performing operation with peripherals, return error when APIs are invoked. More...
#define | I2C_STATE_ERROR ((uint8_t) 3U)
| I2C driver ran into error, returns error for all APIs other than deinit in this state. More...

## MACROS used to select one of the standardized bus bit rates for
I2C communication. Deafults to I2C_400KHZ
#define | I2C_100KHZ ((uint8_t) 0U)
| I2C bus frequency : 100KHz. More...
#define | I2C_400KHZ ((uint8_t) 1U)
| I2C bus frequency : 400KHz. More...

## MACROS for the possible values of Memory Write/Read API parameter.
#define | I2C_MEM_ADDR_SIZE_8_BITS ((uint8_t) 1U)
| I2C Target Internal Memory address 8 bits. More...
#define | I2C_MEM_ADDR_SIZE_16_BITS ((uint8_t) 2U)
| I2C Target Internal Memory address 16 bits. More...

## MACROS used to define the state of the I2C Driver State Machine
#define | I2C_WRITE_STATE ((uint8_t) 10U)
| I2C is in Write state. More...
#define | I2C_READ_STATE ((uint8_t) 11U)
| I2C is in Write state. More...
#define | I2C_TARGET_XFER_STATE ((uint8_t) 12U)
| I2C is trasferring in target mode. More...
#define | I2C_TARGET_RESTART_STATE ((uint8_t) 13U)
| I2C is restarting trasfer in target mode. More...

## MACROS for I2CControllerControl mask and command values (ICMDR register)
#define | I2C_CFG_MASK_TX (CSL_I2C_ICMDR_TRX_MASK)
#define | I2C_CFG_MASK_RX (CSL_I2C_ICMDR_TRX_MASK)
#define | I2C_CFG_MASK_STOP (CSL_I2C_ICMDR_STP_MASK)
#define | I2C_CFG_MASK_START (CSL_I2C_ICMDR_STT_MASK)
#define | I2C_CFG_MASK_RUN_FREE (CSL_I2C_ICMDR_FREE_MASK)
#define | I2C_CFG_MASK_REPEAT_MODE (CSL_I2C_ICMDR_RM_MASK)
#define | I2C_CFG_MASK_LOOP_BACK (CSL_I2C_ICMDR_DLB_MASK)
#define | I2C_CFG_MASK_XA (CSL_I2C_ICMDR_XA_MASK)
#define | I2C_CFG_CMD_TX (CSL_I2C_ICMDR_TRX_MASK)
#define | I2C_CFG_CMD_RX (0U)
#define | I2C_CFG_CMD_STOP (CSL_I2C_ICMDR_STP_MASK)
#define | I2C_CFG_CMD_START (CSL_I2C_ICMDR_STT_MASK)
#define | I2C_CFG_CMD_RUN_FREE_ON (CSL_I2C_ICMDR_FREE_MASK)
#define | I2C_CFG_CMD_RUN_FREE_OFF (0U)
#define | I2C_CFG_CMD_REPEAT_MODE_ON (CSL_I2C_ICMDR_RM_MASK)
#define | I2C_CFG_CMD_REPEAT_MODE_OFF (0U)
#define | I2C_CFG_CMD_LOOP_BACK_ON (CSL_I2C_ICMDR_DLB_MASK)
#define | I2C_CFG_CMD_LOOP_BACK_OFF (0U)
#define | I2C_CFG_CMD_10BIT_ADDRESS (I2C_CFG_MASK_XA)
#define | I2C_CFG_CMD_7BIT_ADDRESS (0U)

## MACROS that can be passed to I2CControllerIntStatusEx and I2CControllerIntClearEx
APIs as int status flag to check and clear interrupt status
#define | I2C_INT_ARBITRATION_LOST (CSL_I2C_ICSTR_AL_MASK)
#define | I2C_INT_NO_ACK (CSL_I2C_ICSTR_NACK_MASK)
#define | I2C_INT_ADRR_READY_ACESS (CSL_I2C_ICSTR_ARDY_MASK)
#define | I2C_INT_RECV_READY (CSL_I2C_ICSTR_ICRRDY_MASK)
#define | I2C_INT_TRANSMIT_READY (CSL_I2C_ICSTR_ICXRDY_MASK)
#define | I2C_INT_STOP_CONDITION (CSL_I2C_ICSTR_SCD_MASK)
#define | I2C_INT_ADRR_ZERO (CSL_I2C_ICSTR_AD0_MASK)
#define | I2C_INT_ADRR_TARGET (CSL_I2C_ICSTR_AAS_MASK)
#define | I2C_INT_TRANSMIT_UNDER_FLOW (CSL_I2C_ICSTR_XSMT_MASK)
#define | I2C_INT_RECV_OVER_RUN (CSL_I2C_ICSTR_RSFULL_MASK)
#define | I2C_INT_BUS_BUSY (CSL_I2C_ICSTR_BB_MASK)
#define | I2C_INT_NO_ACK_SENT (CSL_I2C_ICSTR_NACKSNT_MASK)
#define | I2C_INT_TARGET_DIRECTION (CSL_I2C_ICSTR_SDIR_MASK)
#define | I2C_ALL_INTS
#define | I2C_INT_MASK_ARBITRATION_LOST (CSL_I2C_ICIMR_AL_MASK)
#define | I2C_INT_MASK_NO_ACK (CSL_I2C_ICIMR_NACK_MASK)
#define | I2C_INT_MASK_ADRR_READY_ACESS (CSL_I2C_ICIMR_ARDY_MASK)
#define | I2C_INT_MASK_RECV_READY (CSL_I2C_ICIMR_ICRRDY_MASK)
#define | I2C_INT_MASK_TRANSMIT_READY (CSL_I2C_ICIMR_ICXRDY_MASK)
#define | I2C_INT_MASK_STOP_CONDITION (CSL_I2C_ICIMR_SCD_MASK)
#define | I2C_INT_MASK_ADRR_TARGET (CSL_I2C_ICIMR_AAS_MASK)
#define | I2C_ALL_INTS_MASK

## Macro Definition Documentation

## ◆ I2C_STS_SUCCESS

#define I2C_STS_SUCCESS ((int32_t) 0)

Return status when the API execution was successful.

## ◆ I2C_STS_ERR

#define I2C_STS_ERR ((int32_t)-1)

Return status when the API execution was not successful due to a generic Error.

## ◆ I2C_STS_ERR_TIMEOUT

#define I2C_STS_ERR_TIMEOUT ((int32_t)-2)

Return status when the API execution was not successful due to a time out.

## ◆ I2C_STS_ERR_INVALID_PARAM

#define I2C_STS_ERR_INVALID_PARAM ((int32_t)-3)

Return status when the API execution failed due invalid parameters.

## ◆ I2C_STS_ERR_BUS_BUSY

#define I2C_STS_ERR_BUS_BUSY ((int32_t)-4)

Return status when the API execution failed due to driver busy.

## ◆ I2C_STS_ERR_NO_ACK

#define I2C_STS_ERR_NO_ACK ((int32_t)-5)

Return status when the API execution failed due to no Acknowledgement from target.

## ◆ I2C_STS_ERR_ARBITRATION_LOST

#define I2C_STS_ERR_ARBITRATION_LOST ((int32_t)-6)

Return status when the API execution failed due to loss in arbitration during transmission.

## ◆ I2C_NO_WAIT

#define I2C_NO_WAIT ((uint32_t)0)

Value to use when needing a timeout of zero or NO timeout, return immediately on resource not available.

## ◆ I2C_WAIT_FOREVER

#define I2C_WAIT_FOREVER ((uint32_t)-1)

Value to use when needing a timeout of infinity or wait forver until resource is available.

## ◆ I2C_STATE_RESET

#define I2C_STATE_RESET ((uint8_t) 0U)

I2C driver is in Reset State prior to driver init and post driver deinit.

## ◆ I2C_STATE_IDLE

#define I2C_STATE_IDLE ((uint8_t) 1U)

I2C driver accepts runtime APIs only Ready State, otherwise return error.

## ◆ I2C_STATE_BUSY

#define I2C_STATE_BUSY ((uint8_t) 2U)

I2C driver is busy performing operation with peripherals, return error when APIs are invoked.

## ◆ I2C_STATE_ERROR

#define I2C_STATE_ERROR ((uint8_t) 3U)

I2C driver ran into error, returns error for all APIs other than deinit in this state.

## ◆ I2C_100KHZ

#define I2C_100KHZ ((uint8_t) 0U)

I2C bus frequency : 100KHz.

## ◆ I2C_400KHZ

#define I2C_400KHZ ((uint8_t) 1U)

I2C bus frequency : 400KHz.

## ◆ I2C_MEM_ADDR_SIZE_8_BITS

#define I2C_MEM_ADDR_SIZE_8_BITS ((uint8_t) 1U)

I2C Target Internal Memory address 8 bits.

## ◆ I2C_MEM_ADDR_SIZE_16_BITS

#define I2C_MEM_ADDR_SIZE_16_BITS ((uint8_t) 2U)

I2C Target Internal Memory address 16 bits.

## ◆ I2C_WRITE_STATE

#define I2C_WRITE_STATE ((uint8_t) 10U)

I2C is in Write state.

## ◆ I2C_READ_STATE

#define I2C_READ_STATE ((uint8_t) 11U)

I2C is in Write state.

## ◆ I2C_TARGET_XFER_STATE

#define I2C_TARGET_XFER_STATE ((uint8_t) 12U)

I2C is trasferring in target mode.

## ◆ I2C_TARGET_RESTART_STATE

#define I2C_TARGET_RESTART_STATE ((uint8_t) 13U)

I2C is restarting trasfer in target mode.

## ◆ I2C_CFG_MASK_TX

#define I2C_CFG_MASK_TX (CSL_I2C_ICMDR_TRX_MASK)

## ◆ I2C_CFG_MASK_RX

#define I2C_CFG_MASK_RX (CSL_I2C_ICMDR_TRX_MASK)

## ◆ I2C_CFG_MASK_STOP

#define I2C_CFG_MASK_STOP (CSL_I2C_ICMDR_STP_MASK)

## ◆ I2C_CFG_MASK_START

#define I2C_CFG_MASK_START (CSL_I2C_ICMDR_STT_MASK)

## ◆ I2C_CFG_MASK_RUN_FREE

#define I2C_CFG_MASK_RUN_FREE (CSL_I2C_ICMDR_FREE_MASK)

## ◆ I2C_CFG_MASK_REPEAT_MODE

#define I2C_CFG_MASK_REPEAT_MODE (CSL_I2C_ICMDR_RM_MASK)

## ◆ I2C_CFG_MASK_LOOP_BACK

#define I2C_CFG_MASK_LOOP_BACK (CSL_I2C_ICMDR_DLB_MASK)

## ◆ I2C_CFG_MASK_XA

#define I2C_CFG_MASK_XA (CSL_I2C_ICMDR_XA_MASK)

## ◆ I2C_CFG_CMD_TX

#define I2C_CFG_CMD_TX (CSL_I2C_ICMDR_TRX_MASK)

## ◆ I2C_CFG_CMD_RX

#define I2C_CFG_CMD_RX (0U)

## ◆ I2C_CFG_CMD_STOP

#define I2C_CFG_CMD_STOP (CSL_I2C_ICMDR_STP_MASK)

## ◆ I2C_CFG_CMD_START

#define I2C_CFG_CMD_START (CSL_I2C_ICMDR_STT_MASK)

## ◆ I2C_CFG_CMD_RUN_FREE_ON

#define I2C_CFG_CMD_RUN_FREE_ON (CSL_I2C_ICMDR_FREE_MASK)

## ◆ I2C_CFG_CMD_RUN_FREE_OFF

#define I2C_CFG_CMD_RUN_FREE_OFF (0U)

## ◆ I2C_CFG_CMD_REPEAT_MODE_ON

#define I2C_CFG_CMD_REPEAT_MODE_ON (CSL_I2C_ICMDR_RM_MASK)

## ◆ I2C_CFG_CMD_REPEAT_MODE_OFF

#define I2C_CFG_CMD_REPEAT_MODE_OFF (0U)

## ◆ I2C_CFG_CMD_LOOP_BACK_ON

#define I2C_CFG_CMD_LOOP_BACK_ON (CSL_I2C_ICMDR_DLB_MASK)

## ◆ I2C_CFG_CMD_LOOP_BACK_OFF

#define I2C_CFG_CMD_LOOP_BACK_OFF (0U)

## ◆ I2C_CFG_CMD_10BIT_ADDRESS

#define I2C_CFG_CMD_10BIT_ADDRESS (I2C_CFG_MASK_XA)

## ◆ I2C_CFG_CMD_7BIT_ADDRESS

#define I2C_CFG_CMD_7BIT_ADDRESS (0U)

## ◆ I2C_INT_ARBITRATION_LOST

#define I2C_INT_ARBITRATION_LOST (CSL_I2C_ICSTR_AL_MASK)

## ◆ I2C_INT_NO_ACK

#define I2C_INT_NO_ACK (CSL_I2C_ICSTR_NACK_MASK)

## ◆ I2C_INT_ADRR_READY_ACESS

#define I2C_INT_ADRR_READY_ACESS (CSL_I2C_ICSTR_ARDY_MASK)

## ◆ I2C_INT_RECV_READY

#define I2C_INT_RECV_READY (CSL_I2C_ICSTR_ICRRDY_MASK)

## ◆ I2C_INT_TRANSMIT_READY

#define I2C_INT_TRANSMIT_READY (CSL_I2C_ICSTR_ICXRDY_MASK)

## ◆ I2C_INT_STOP_CONDITION

#define I2C_INT_STOP_CONDITION (CSL_I2C_ICSTR_SCD_MASK)

## ◆ I2C_INT_ADRR_ZERO

#define I2C_INT_ADRR_ZERO (CSL_I2C_ICSTR_AD0_MASK)

## ◆ I2C_INT_ADRR_TARGET

#define I2C_INT_ADRR_TARGET (CSL_I2C_ICSTR_AAS_MASK)

## ◆ I2C_INT_TRANSMIT_UNDER_FLOW

#define I2C_INT_TRANSMIT_UNDER_FLOW (CSL_I2C_ICSTR_XSMT_MASK)

## ◆ I2C_INT_RECV_OVER_RUN

#define I2C_INT_RECV_OVER_RUN (CSL_I2C_ICSTR_RSFULL_MASK)

## ◆ I2C_INT_BUS_BUSY

#define I2C_INT_BUS_BUSY (CSL_I2C_ICSTR_BB_MASK)

## ◆ I2C_INT_NO_ACK_SENT

#define I2C_INT_NO_ACK_SENT (CSL_I2C_ICSTR_NACKSNT_MASK)

## ◆ I2C_INT_TARGET_DIRECTION

#define I2C_INT_TARGET_DIRECTION (CSL_I2C_ICSTR_SDIR_MASK)

## ◆ I2C_ALL_INTS

#define I2C_ALL_INTS

Value:
( I2C_INT_ARBITRATION_LOST | \
I2C_INT_NO_ACK | \
I2C_INT_ADRR_READY_ACESS | \
I2C_INT_RECV_READY | \
I2C_INT_TRANSMIT_READY | \
I2C_INT_STOP_CONDITION | \
I2C_INT_ADRR_ZERO | \
I2C_INT_ADRR_TARGET | \
I2C_INT_TRANSMIT_UNDER_FLOW | \
I2C_INT_RECV_OVER_RUN | \
I2C_INT_BUS_BUSY | \
I2C_INT_NO_ACK_SENT | \
I2C_INT_TARGET_DIRECTION \
)

## ◆ I2C_INT_MASK_ARBITRATION_LOST

#define I2C_INT_MASK_ARBITRATION_LOST (CSL_I2C_ICIMR_AL_MASK)

## ◆ I2C_INT_MASK_NO_ACK

#define I2C_INT_MASK_NO_ACK (CSL_I2C_ICIMR_NACK_MASK)

## ◆ I2C_INT_MASK_ADRR_READY_ACESS

#define I2C_INT_MASK_ADRR_READY_ACESS (CSL_I2C_ICIMR_ARDY_MASK)

## ◆ I2C_INT_MASK_RECV_READY

#define I2C_INT_MASK_RECV_READY (CSL_I2C_ICIMR_ICRRDY_MASK)

## ◆ I2C_INT_MASK_TRANSMIT_READY

#define I2C_INT_MASK_TRANSMIT_READY (CSL_I2C_ICIMR_ICXRDY_MASK)

## ◆ I2C_INT_MASK_STOP_CONDITION

#define I2C_INT_MASK_STOP_CONDITION (CSL_I2C_ICIMR_SCD_MASK)

## ◆ I2C_INT_MASK_ADRR_TARGET

#define I2C_INT_MASK_ADRR_TARGET (CSL_I2C_ICIMR_AAS_MASK)

## ◆ I2C_ALL_INTS_MASK

#define I2C_ALL_INTS_MASK

Value:
( I2C_INT_MASK_ARBITRATION_LOST | \
I2C_INT_MASK_NO_ACK | \
I2C_INT_MASK_ADRR_READY_ACESS | \
I2C_INT_MASK_RECV_READY | \
I2C_INT_MASK_TRANSMIT_READY | \
I2C_INT_MASK_STOP_CONDITION | \
I2C_INT_MASK_ADRR_TARGET \
)

## Typedef Documentation

## ◆ I2C_Clock_getTicks

typedef uint32_t(* I2C_Clock_getTicks) (void)

The definition of a get System Tick function used by the I2C driver to keep track of time.

Returns
  Returns system ticks in 32-bit unsigned int format

## ◆ I2C_Clock_usecToTicks

typedef uint32_t(* I2C_Clock_usecToTicks) (uint64_t usecs)

The definition of a micro seconds to ticks function used by the I2C driver to get ticks from microseconds.

Parameters

  usecs | Micro Seconds

Returns
  Returns system ticks in 32-bit unsigned int format

## ◆ I2C_Clock_uSleep

typedef void(* I2C_Clock_uSleep) (uint32_t usec)

The definition of a sleep function used by the I2C driver for delay.

Parameters

  usec | Micro Seconds

## ◆ I2C_lld_transferCompleteCallback

typedef void(* I2C_lld_transferCompleteCallback) (void *args, const I2CLLD_Message *msg, int32_t transferStatus)

The definition of a transfer completion callback function used by the I2C driver when used in Controller Callback Mode.

Parameters

  args | Void Pointer
  msg | Pointer to I2CLLD_Message Object
  transferStatus | Transfer Status

## ◆ I2C_lld_targetTransferCompleteCallback

typedef void(* I2C_lld_targetTransferCompleteCallback) (void *args, const I2CLLD_targetTransaction *targetTxn, int32_t transferStatus)

The definition of a transfer completion callback function used by the I2C driver when used in Target Mode.

Parameters

  args | Void Pointer
  targetTxn | Pointer to I2CLLD_targetTransaction Object
  transferStatus | Transfer Status

## ◆ I2CLLD_Handle

typedef struct I2CLLD_Object * I2CLLD_Handle

## Function Documentation

## ◆ I2C_lld_init()

int32_t I2C_lld_init | ( | I2CLLD_Handle | handle | ) |

API to Initializes the I2C instance.

Parameters

  handle | [IN] Handle to the I2C instance used

Returns
  I2C_StatusCode

## ◆ I2C_lld_deInit()

int32_t I2C_lld_deInit | ( | I2CLLD_Handle | handle | ) |

API to De-Initializes the I2C instance.

Parameters

  handle | [IN] Handle to the I2C instance used

Returns
  I2C_StatusCode

## ◆ I2C_lld_Transaction_init()

int32_t I2C_lld_Transaction_init | ( | I2CLLD_Transaction * | transaction | ) |

API to set default values of I2CLLD_Transaction in transaction.

Parameters

  transaction | [IN] Pointer to the structure to be initialized

Returns
  I2C_StatusCode

## ◆ I2C_lld_Message_init()

int32_t I2C_lld_Message_init | ( | I2CLLD_Message * | msg | ) |

API to set default values of I2CLLD_Message in msg.

Parameters

  msg | [IN] Pointer to the structure to be initialized

Returns
  I2C_StatusCode

## ◆ I2C_lld_write()

int32_t I2C_lld_write | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate an I2C write operation in polled mode as I2C Controller.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_target_write()

int32_t I2C_lld_target_write | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate an I2C write operation in polled mode as I2C Target.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_writeIntr()

int32_t I2C_lld_writeIntr | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams
| ) |  |

API to initiate an I2C write operation in interrupt mode as I2C Controller.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_target_writeIntr()

int32_t I2C_lld_target_writeIntr | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams
| ) |  |

API to Initiate an I2C write operation in interrupt mode as I2C Target.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_read()

int32_t I2C_lld_read | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate an I2C read operation in polled mode as I2C Controller.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_target_read()

int32_t I2C_lld_target_read | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate an I2C read Operation in polled mode as I2C Target.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_readIntr()

int32_t I2C_lld_readIntr | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams
| ) |  |

API to initiate an I2C read operation in interrupt mode as I2C Controller.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_target_readIntr()

int32_t I2C_lld_target_readIntr | ( | I2CLLD_Handle | handle,
|  | I2C_ExtendedParams * | extendedParams
| ) |  |

API to initiate an I2C read operation in interrupt mode as I2C Target.

Parameters

  handle | [IN] Handle to the I2C instance used
  extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_mem_write()

int32_t I2C_lld_mem_write | ( | I2CLLD_Handle | handle,
|  | I2C_Memory_ExtendedParams * | mem_extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate a Memory write Operation in polling Mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  mem_extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_mem_writeIntr()

int32_t I2C_lld_mem_writeIntr | ( | I2CLLD_Handle | handle,
|  | I2C_Memory_ExtendedParams * | mem_extendedParams
| ) |  |

API to initiate a Memory write operation in interrupt Mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  mem_extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_mem_read()

int32_t I2C_lld_mem_read | ( | I2CLLD_Handle | handle,
|  | I2C_Memory_ExtendedParams * | mem_extendedParams,
|  | uint32_t | timeout
| ) |  |

API to initiate a Memory read operation in Polled mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  mem_extendedParams | [IN] Pointer to structure containing transfer parameters
  timeout | [IN] Timeout for read operation in Micro Seconds I2cTimeoutValues

Returns
  I2C_StatusCode

## ◆ I2C_lld_mem_readIntr()

int32_t I2C_lld_mem_readIntr | ( | I2CLLD_Handle | handle,
|  | I2C_Memory_ExtendedParams * | mem_extendedParams
| ) |  |

API to initiate a Memory read operation in interrupt mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  mem_extendedParams | [IN] Pointer to structure containing transfer parameters

Returns
  I2C_StatusCode

## ◆ I2C_lld_transferPoll()

int32_t I2C_lld_transferPoll | ( | I2CLLD_Handle | handle,
|  | I2CLLD_Message * | msg
| ) |  |

API to initiate a transfer from I2C in polled mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  msg | [IN] Pointer to the I2CLLD_Message structure that contains values for this specific transfer

Returns
  I2C_StatusCode

## ◆ I2C_lld_transferIntr()

int32_t I2C_lld_transferIntr | ( | I2CLLD_Handle | handle,
|  | I2CLLD_Message * | msg
| ) |  |

API to initiate a transfer from I2C in interrupt mode.

Parameters

  handle | [IN] Handle to the I2C instance used
  msg | [IN] Pointer to the I2CLLD_Message structure that contains values for this specific transfer

Returns
  I2C_StatusCode

## ◆ I2C_lld_targetTransferIntr()

int32_t I2C_lld_targetTransferIntr | ( | I2CLLD_Handle | handle,
|  | I2CLLD_targetTransaction * | txn
| ) |  |

API to initiate a transfer from I2C in interrupt mode as target.

Parameters

  handle | [IN] Handle to the I2C instance used
  txn | [IN] Pointer to the I2CLLD_targetTransaction structure that contains values for this specific transfer

Returns
  I2C_StatusCode

## ◆ I2C_lld_probe()

int32_t I2C_lld_probe | ( | I2CLLD_Handle | handle,
|  | uint32_t | targetAddr
| ) |  |

API to probe I2C.

Parameters

  handle | [IN] handle to the I2C instance used
  targetAddr | [IN] address of the target to probe

Returns
  I2C_StatusCode

## ◆ I2C_lld_setBusFrequency()

int32_t I2C_lld_setBusFrequency | ( | I2CLLD_Handle | handle,
|  | uint32_t | busFrequency
| ) |  |

API to set the bus frequency.

Parameters

  handle | [IN] handle to the I2C instance used
  busFrequency | [IN] frequency value to be set I2cBitRates

Returns
  I2C_StatusCode

## ◆ I2C_lld_controllerIsr()

void I2C_lld_controllerIsr | ( | void * | args | ) |

I2C Controller ISR, can be used as IRQ handler in Controller mode.

Parameters

  args | [IN] Argument to the ISR

## ◆ I2C_lld_targetIsr()

void I2C_lld_targetIsr | ( | void * | args | ) |

I2C Target ISR, can be used as IRQ handler in Target mode.

Parameters

  args | [IN] Argument to the ISR

## ◆ I2CControllerControl()

void I2CControllerControl | ( | uint32_t | baseAddr,
|  | uint32_t | ctrlMask,
|  | uint32_t | ctrlCmds
| ) |  |

## ◆ I2CSetDataCount()

void I2CSetDataCount | ( | uint32_t | baseAddr,
|  | uint32_t | count
| ) |  |

## ◆ I2CControllerStart()

void I2CControllerStart | ( | uint32_t | baseAddr | ) |

## ◆ I2CControllerIntEnableEx()

void I2CControllerIntEnableEx | ( | uint32_t | baseAddr,
|  | uint32_t | intFlag
| ) |  |

## ◆ I2CControllerTargetAddrSet()

void I2CControllerTargetAddrSet | ( | uint32_t | baseAddr,
|  | uint32_t | targetAddr
| ) |  |

## ◆ I2CControllerIntClearEx()

void I2CControllerIntClearEx | ( | uint32_t | baseAddr,
|  | uint32_t | intFlag
| ) |  |

## ◆ I2CModeControl()

void I2CModeControl | ( | uint32_t | baseAddr,
|  | uint32_t | ctrlMask,
|  | uint32_t | ctrlCmds
| ) |  |

## ◆ I2CTargetEnable()

void I2CTargetEnable | ( | uint32_t | baseAddr | ) |

I2C_INT_MASK_ARBITRATION_LOST
#define I2C_INT_MASK_ARBITRATION_LOST
Definition: i2c_lld.h:250
i2c_lld.h
I2C LLD Driver API/interface file.
I2C_INT_ARBITRATION_LOST
#define I2C_INT_ARBITRATION_LOST
Definition: i2c_lld.h:221