RTEMS  5.0.0
Functions

Functions

ALT_STATUS_CODE alt_i2c_master_general_call (ALT_I2C_DEV_t *i2c_dev, const void *data, const size_t size, const bool issue_restart, const bool issue_stop)
 
ALT_STATUS_CODE alt_i2c_general_call_ack_disable (ALT_I2C_DEV_t *i2c_dev)
 
ALT_STATUS_CODE alt_i2c_general_call_ack_enable (ALT_I2C_DEV_t *i2c_dev)
 
ALT_STATUS_CODE alt_i2c_general_call_ack_is_enabled (ALT_I2C_DEV_t *i2c_dev)
 

Detailed Description

The functions in this group support General Call addresses.

The general call address is for addressing every device connected to the I2C bus at the same time. However, if a device does not need any of the data supplied within the general call structure, it can ignore this address by not issuing an acknowledgment. If a device does require data from a general call address, it acknowledges this address and behaves as a slave-receiver. The master does not actually know how many devices acknowledged if one or more devices respond. The second and following bytes are acknowledged by every slave-receiver capable of handling this data. A slave who cannot process one of these bytes must ignore it by not-acknowledging. If one or more slaves acknowledge, the not-acknowledge will not be seen by the master.

The functions in this group do not provide any general call functional command interpretation or implementation (e.g. software reset).

Function Documentation

◆ alt_i2c_general_call_ack_disable()

ALT_STATUS_CODE alt_i2c_general_call_ack_disable ( ALT_I2C_DEV_t i2c_dev)

Disables the I2C controller from responding to a General Call address. The controller will respond with a NACK and no General Call status conditions or interrupts are generated.

Parameters
i2c_devA pointer to the I2C controller device block instance.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code

◆ alt_i2c_general_call_ack_enable()

ALT_STATUS_CODE alt_i2c_general_call_ack_enable ( ALT_I2C_DEV_t i2c_dev)

Enables the I2C controller to respond with an ACK when it receives a General Call address.

Parameters
i2c_devA pointer to the I2C controller device block instance.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code

◆ alt_i2c_general_call_ack_is_enabled()

ALT_STATUS_CODE alt_i2c_general_call_ack_is_enabled ( ALT_I2C_DEV_t i2c_dev)

Returns ALT_E_TRUE if the I2C controller is enabled to respond to General Call addresses.

Parameters
i2c_devA pointer to the I2C controller device block instance.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code

◆ alt_i2c_master_general_call()

ALT_STATUS_CODE alt_i2c_master_general_call ( ALT_I2C_DEV_t i2c_dev,
const void *  data,
const size_t  size,
const bool  issue_restart,
const bool  issue_stop 
)

This function acts in the role of a master-transmitter by issuing a general call command to all devices connected to the I2C bus.

The issue_restart and issue_stop parameters apply to the final write transaction in the num_data_entries byte transmission sequence.

The I2C controller must be in master mode before calling this function.

The target slave address will be modified by this function. Call alt_i2c_master_target_set() to reset the slave target address for subsequent IO.

Parameters
i2c_devA pointer to the I2C controller device block instance.
dataAn array of data byte(s) to transmit.
num_data_entriesThe number of entries (bytes) in data to place in the TX FIFO.
issue_restartThis parameter controls whether a RESTART is issued before the byte is sent or received. If:
  • true - if restart_enabled in ALT_I2C_MASTER_CONFIG_t is true, a RESTART is issued before the data is sent/received (according to the value of CMD), regardless of whether or not the transfer direction is changing from the previous command; if restart_enabled is false, a STOP followed by a START is issued instead.
  • false - If restart_enabled in ALT_I2C_MASTER_CONFIG_t is true, a RESTART is issued only if the transfer direction is changing from the previous command; if restart_enabled is false, a STOP followed by a START is issued instead.
issue_stopThis parameter controls whether a STOP is issued after the byte is sent or received. If:
  • true - STOP is issued after this byte, regardless of whether or not the Tx FIFO is empty. If the Tx FIFO is not empty, the master immediately tries to start a new transfer by issuing a START and arbitrating for the bus.
  • false - STOP is not issued after this byte, regardless of whether or not the Tx FIFO is empty. If the Tx FIFO is not empty, the master continues the current transfer by sending/receiving data bytes according to the value of the CMD bit. If the Tx FIFO is empty, the master holds the SCL line low and stalls the bus until a new command is available in the Tx FIFO.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code