AM263Px MCU+ SDK  10.01.00

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

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_Transaction *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_ObjectI2CLLD_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...