Intel® Quark™ Microcontroller Software Interface  1.4.0
Intel® Quark™ Microcontroller BSP
qm_i2c_transfer_t Struct Reference

I2C transfer type. More...

#include <qm_i2c.h>

Data Fields

uint8_t * tx
 Write data. More...
 
uint32_t tx_len
 Write data length. More...
 
uint8_t * rx
 Read data. More...
 
uint32_t rx_len
 Read buffer length. More...
 
bool stop
 Master: Generate STOP. More...
 
void(* callback )(void *data, int rc, qm_i2c_status_t status, uint32_t len)
 Transfer callback. More...
 
void * callback_data
 User callback data. More...
 

Detailed Description

I2C transfer type.

Master mode:

  • If tx len is 0: perform receive-only transaction.
  • If rx len is 0: perform transmit-only transaction.
  • Both tx and rx len not 0: perform a transmit-then-receive combined transaction.

Definition at line 130 of file qm_i2c.h.

Field Documentation

void(* qm_i2c_transfer_t::callback)(void *data, int rc, qm_i2c_status_t status, uint32_t len)

Transfer callback.

Called after all data is transmitted/received or if the driver detects an error during the I2C transfer.

In slave mode, qm_i2c_slave_irq_transfer_update shall be called from this callback to update transfer buffers when receiving a QM_I2C_RX_FULL or QM_I2C_TX_EMPTY status. If the update function is not called with these statuses, the driver will drop every new data received or send dummy data (0x00) for each byte until next bus start.

Parameters
[in]dataUser defined data.
[in]rc0 on success. Negative errno for possible error codes.
[in]statusI2C status.
[in]lenLength of the transfer if successful, 0 otherwise.

Definition at line 161 of file qm_i2c.h.

void* qm_i2c_transfer_t::callback_data

User callback data.

Definition at line 163 of file qm_i2c.h.

uint8_t* qm_i2c_transfer_t::rx

Read data.

Definition at line 133 of file qm_i2c.h.

Referenced by qm_i2c_master_dma_transfer().

uint32_t qm_i2c_transfer_t::rx_len

Read buffer length.

Definition at line 134 of file qm_i2c.h.

Referenced by qm_i2c_master_dma_transfer(), and qm_i2c_master_irq_transfer().

bool qm_i2c_transfer_t::stop

Master: Generate STOP.

Slave: stop at the end of transaction.

Definition at line 140 of file qm_i2c.h.

Referenced by qm_i2c_master_dma_transfer().

uint8_t* qm_i2c_transfer_t::tx

Write data.

Definition at line 131 of file qm_i2c.h.

Referenced by qm_i2c_master_dma_transfer().

uint32_t qm_i2c_transfer_t::tx_len

Write data length.

Definition at line 132 of file qm_i2c.h.

Referenced by qm_i2c_master_dma_transfer().