|
AM62Ax MCU+ SDK
10.01.00
|
|
Go to the documentation of this file.
69 #include <drivers/i2c/v0/cslr_i2c.h>
70 #include <drivers/hw_include/soc_config.h>
71 #if defined (DRV_VERSION_I2C_V0)
72 #include <drivers/i2c/v0/soc/i2c_soc.h>
79 #define I2C_MAX_NUM_OWN_TARGET_ADDR (4U)
88 #define I2C_STS_SUCCESS ((int32_t) 0)
91 #define I2C_STS_ERR ((int32_t)-1)
94 #define I2C_STS_ERR_TIMEOUT ((int32_t)-2)
96 #define I2C_STS_ERR_INVALID_PARAM ((int32_t)-3)
98 #define I2C_STS_ERR_BUS_BUSY ((int32_t)-4)
101 #define I2C_STS_ERR_NO_ACK ((int32_t)-5)
104 #define I2C_STS_ERR_ARBITRATION_LOST ((int32_t)-6)
106 #define I2C_STS_ERR_ACCESS_ERROR ((int32_t)-7)
108 #define I2C_STS_RESTART ((int32_t)-8)
120 #define I2C_NO_WAIT ((uint32_t)0)
123 #define I2C_WAIT_FOREVER ((uint32_t)-1)
133 #define I2C_STATE_RESET ((uint8_t) 0U)
136 #define I2C_STATE_IDLE ((uint8_t) 1U)
139 #define I2C_STATE_BUSY ((uint8_t) 2U)
142 #define I2C_STATE_ERROR ((uint8_t) 3U)
154 #define I2C_100KHZ ((uint8_t) 0U)
156 #define I2C_400KHZ ((uint8_t) 1U)
158 #define I2C_1P0MHZ ((uint8_t) 2U)
160 #define I2C_3P4MHZ ((uint8_t) 3U)
171 #define I2C_MEM_ADDR_SIZE_8_BITS ((uint8_t) 1U)
173 #define I2C_MEM_ADDR_SIZE_16_BITS ((uint8_t) 2U)
184 #define I2C_WRITE_STATE ((uint8_t) 10U)
186 #define I2C_READ_STATE ((uint8_t) 11U)
188 #define I2C_TARGET_XFER_STATE ((uint8_t) 12U)
190 #define I2C_TARGET_RESTART_STATE ((uint8_t) 13U)
364 int32_t transferStatus);
376 int32_t transferStatus);
uint64_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 microsec...
Definition: i2c_lld.h:343
I2C_Clock_getTicks Clock_getTicks
Definition: i2c_lld.h:402
#define I2C_MAX_NUM_OWN_TARGET_ADDR
Definition: i2c_lld.h:79
uint32_t startTicks
Definition: i2c_lld.h:438
I2CLLD_Transaction * txn
Definition: i2c_lld.h:233
uint32_t readCount
Definition: i2c_lld.h:217
int32_t I2C_lld_Transaction_init(I2CLLD_Transaction *transaction)
API to set default values of I2CLLD_Transaction in transaction.
I2CLLD_targetTransaction * currentTargetTransaction
Definition: i2c_lld.h:428
uint32_t writeCountIdx
Definition: i2c_lld.h:432
uint8_t * writeBuf
Definition: i2c_lld.h:306
uint8_t * writeBufIdx
Definition: i2c_lld.h:430
uint32_t writeCount
Definition: i2c_lld.h:308
int32_t I2C_lld_Message_init(I2CLLD_Message *msg)
API to set default values of I2CLLD_Message in msg.
uint32_t readCount
Definition: i2c_lld.h:312
uint32_t targetAddress
Definition: i2c_lld.h:240
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 ...
Definition: i2c_lld.h:374
int32_t I2C_lld_write(I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
API to initiate the write transaction in polled mode.
void(* I2C_Clock_uSleep)(uint64_t usec)
The definition of a sleep function used by the I2C driver for delay.
Definition: i2c_lld.h:352
uint32_t funcClk
Definition: i2c_lld.h:398
I2C Message.
Definition: i2c_lld.h:230
I2C_Clock_uSleep Clock_uSleep
Definition: i2c_lld.h:406
uint32_t memAddr
Definition: i2c_lld.h:279
void * arg
Definition: i2c_lld.h:242
uint8_t * readBuf
Definition: i2c_lld.h:310
int32_t I2C_lld_read(I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams, uint32_t timeout)
API to initiate the read transaction in polled mode.
uint8_t * writeBuf
Definition: i2c_lld.h:211
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 Control...
Definition: i2c_lld.h:362
uint8_t * readBuf
Definition: i2c_lld.h:215
uint32_t timeout
Definition: i2c_lld.h:244
I2CLLD_Transaction i2ctxn
Definition: i2c_lld.h:444
bool expandSA
Definition: i2c_lld.h:249
int32_t I2C_lld_readIntr(I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
API to initiate the read transaction in Interrupt mode.
int32_t I2C_lld_recoverBus(I2CLLD_Handle handle, uint32_t i2cDelay)
Function to recover the bus in case of lockup.
bool expandSA
Definition: i2c_lld.h:265
I2CLLD_Message * currentMsg
Definition: i2c_lld.h:426
I2C Transaction.
Definition: i2c_lld.h:208
uint8_t * buffer
Definition: i2c_lld.h:261
int32_t I2C_lld_mem_read(I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams, uint32_t timeout)
Function to initiate a transfer from I2C in interrupt mode.
int32_t I2C_lld_mem_write(I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams, uint32_t timeout)
Function to initiate a transfer from I2C in interrupt mode.
uint32_t timeout
Definition: i2c_lld.h:314
uint8_t * dataArray
Definition: i2c_lld.h:446
uint32_t intrNum
Definition: i2c_lld.h:394
uint32_t baseAddr
Definition: i2c_lld.h:392
int32_t I2C_lld_transferIntr(I2CLLD_Handle handle, I2CLLD_Message *msg)
Function to initiate a transfer from I2C in interrupt mode.
bool expandSA
Definition: i2c_lld.h:317
void I2C_lld_targetIsr(void *args)
This is the I2C Target ISR and can be used as IRQ handler in Target mode.
uint32_t txnCount
Definition: i2c_lld.h:235
int32_t I2C_lld_transferPoll(I2CLLD_Handle handle, I2CLLD_Message *msg)
Function to initiate a transfer from I2C in polled mode.
uint32_t readCountIdx
Definition: i2c_lld.h:436
int32_t I2C_lld_init(I2CLLD_Handle handle)
This API Initializes the I2C instance.
I2C_lld_transferCompleteCallback transferCompleteCallback
Definition: i2c_lld.h:408
I2C_ExtendedParams extendedParams
Definition: i2c_lld.h:277
uint32_t writeCount
Definition: i2c_lld.h:213
uint32_t(* I2C_Clock_getTicks)(void)
The definition of a get System Tick function used by the I2C driver to keep track of time.
Definition: i2c_lld.h:332
bool memTxnActive
Definition: i2c_lld.h:453
uint8_t memAddrSize
Definition: i2c_lld.h:450
bool controllerMode
Definition: i2c_lld.h:246
Data structure used with I2C_lld_mem_write(), I2C_lld_mem_writeIntr(), I2C_lld_mem_read(),...
Definition: i2c_lld.h:275
uint32_t deviceAddress
Definition: i2c_lld.h:259
int32_t I2C_lld_writeIntr(I2CLLD_Handle handle, I2C_ExtendedParams *extendedParams)
API to initiate the write transaction in Interrupt mode.
uint32_t intStatusErr
Definition: i2c_lld.h:419
Data structure used with I2C_lld_write(), I2C_lld_writeIntr(), I2C_lld_read(), I2C_lld_readIntr()
Definition: i2c_lld.h:257
int32_t I2C_lld_mem_readIntr(I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams)
Function to initiate a transfer from I2C in interrupt mode.
uint8_t * readBufIdx
Definition: i2c_lld.h:434
uint8_t bitRate
Definition: i2c_lld.h:396
int32_t I2C_lld_probe(I2CLLD_Handle handle, uint32_t targetAddr)
Function to probe I2C.
int32_t I2C_lld_setBusFrequency(I2CLLD_Handle handle, uint32_t busFrequency)
Function to set the bus frequency.
int32_t I2C_lld_mem_writeIntr(I2CLLD_Handle handle, I2C_Memory_ExtendedParams *mem_extendedParams)
Function to initiate a transfer from I2C in interrupt mode.
void I2C_lld_controllerIsr(void *args)
This is the I2C Controller ISR and can be used as IRQ handler in Controller mode.
I2C_lld_targetTransferCompleteCallback targetTransferCompleteCallback
Definition: i2c_lld.h:410
int32_t I2C_lld_deInit(I2CLLD_Handle handle)
This API De-Initializes the I2C instance.
uint8_t state
Definition: i2c_lld.h:417
uint32_t size
Definition: i2c_lld.h:263
I2CLLD_targetTransaction i2cTargetTransaction
Definition: i2c_lld.h:455
I2C Driver Object.
Definition: i2c_lld.h:385
I2C_Clock_usecToTicks Clock_usecToTicks
Definition: i2c_lld.h:404
I2CLLD_Message i2cMsg
Definition: i2c_lld.h:442
I2C Target Transaction.
Definition: i2c_lld.h:303
void * args
Definition: i2c_lld.h:457
struct I2CLLD_Object * I2CLLD_Handle
int32_t I2C_lld_targetTransferIntr(I2CLLD_Handle handle, I2CLLD_targetTransaction *txn)
Function to initiate a transfer from I2C in target mode.
uint8_t memAddrSize
Definition: i2c_lld.h:281
uint32_t currentTxnCount
Definition: i2c_lld.h:440