AM261x MCU+ SDK: i2c_lld.h File Reference

| AM261x MCU+ SDK 26.00.00 |

Data Structures | Typedefs | Functions
i2c_lld.h File Reference
APIs for SOC Specific Device Drivers » APIs for I2C LLD

## Introduction

I2C LLD Driver API/interface file.

Go to the source code of this 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...

## Macros
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

## 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

## 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)