ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
ADI_I2C_TRANSACTION Struct Reference

#include <adi_i2c.h>

Data Fields

uint8_t * pPrologue
 
uint16_t nPrologueSize
 
uint8_t * pData
 
uint16_t nDataSize
 
bool bReadNotWrite
 
bool bRepeatStart
 

Detailed Description

I2C Device Command/Data Transaction Structure. This is the called-provided data structure used by the blocking adi_i2c_ReadWrite() and non-blocking adi_i2c_SubmitBuffer() calls to describe the caller's transaction parameters, consisting of prologue data and size (the addressing phase), transmit/receive data pointer and size (the data phase), and various transaction control parameters.

Each transaction may optionally be prefaced with a prologue block, which may describe a read/write memory/register address, a slave-specific command, or some other slave-specific protocol that may precede the actual read/write data. Set the prologue size to zero if no prologue is desired.

Each call to adi_i2c_ReadWrite or adi_i2c_SubmitBuffer() must populate the following fields of the ADI_I2C_TRANSACTION block:

pPrologue
Byte pointer to an application-supplied prologue byte array. If the value is zero, prologue data is ignored.
nPrologueSize
The number of prologue bytes to be transmitted ahead of the data phase. If the value is zero, prologue data is ignored.
pData
Byte pointer to the application-supplied data byte array. This buffer is either the source or destination address of the data being transmitted or received, respectively.
nDataSize
The number of data bytes to be transmitted or received during the data phase. If the value is zero, the data phase is ignored.
bReadNotWrite
Direction control for data phase. If "true", data phase is a read (from the slave), if "false", data phase is a write (to the slave). Pertains only to the data phase. Any prologue data (addressing/command phase) is always transmitted (written to the slave) prior to the data phase.
bRepeatStart
Controls suppression of a Stop Condition between the addressing phase and the data phase of an I2C transaction. After the prologue (if present), a unidirectional data stream (I2C is a half-duplex protocol) is either transmitted or received (depending on the transfer direction). Frequently, a Repeat-Start Condition (in reality, just the absence of a Stop Condition following the prologue/addressing phase) is required between the addressing phase (prologue) and the data phase of a transaction to meet slave device protocol requirements. The Repeat-Start requirement can be driven by the slave device communications protocol, or simply to just prevent any other I2C master from rearbitrating the bus between the prologue (addressing) and data phases of a so-called "COMBINED FORMAT" (write-followed-by-read). When bRepeatStart is set "true", the usual Stop Condition between the addressing phase and the data phase is suppressed and the I2C bus controller issues a second Start Condition (Repeat-Start) for the data phase. Without Repeat-Start (bRepeatStart "false"), the addressing phase ends with a normal Stop Condition ahead of the data phase. Repeat-Start conditions are used when "turning the bus around" as in writing a read address (for example), immediately followed by a data stream from that read address... without releasing bus arbitration.
 

Definition at line 169 of file adi_i2c.h.

Field Documentation

◆ pPrologue

uint8_t* pPrologue

Prologue pointer.

Definition at line 170 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall().

◆ nPrologueSize

uint16_t nPrologueSize

Prologue byte count.

Definition at line 171 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall().

◆ pData

uint8_t* pData

Data pointer.

Definition at line 172 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall(), adi_i2c_ReadWrite(), and adi_i2c_SubmitBuffer().

◆ nDataSize

uint16_t nDataSize

Data byte count.

Definition at line 173 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall(), adi_i2c_ReadWrite(), and adi_i2c_SubmitBuffer().

◆ bReadNotWrite

bool bReadNotWrite

Read/write flag.

Definition at line 174 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall(), and adi_i2c_ReadWrite().

◆ bRepeatStart

bool bRepeatStart

Repeat start flag.

Definition at line 175 of file adi_i2c.h.

Referenced by adi_i2c_IssueGeneralCall().