Inter-Integrated Circuit Peripherals
UG0331 User Guide Revision 15.0 546
4. Generate the component by clicking Generate Component or by selecting SmartDesign >
Generate Component. For more information on generation of the component, refer to the Libero
SoC User Guide. The firmware driver folder and SoftConsole workspace are included into the
project. Click Configure firmware, as shown in the following figure to find the I
2
C driver information.
Figure 235 • I
2
C Driver User's Guide
5. Click Generate Bitstream under Program Design to complete *.fdb file generation.
6. Double-click Export Firmware under Handoff Design for Firmware Development in the Libero
SoC design flow window to generate the SoftConsole Firmware Project. The SoftConsole folder
contains the mss_i2c firmware driver. The firmware driver, mss_i2c (mss_i2c.c and mss_i2c.h)
which provides a set of functions for controlling the MSS I2Cs can also be downloaded from the
Microsemi firmware catalog. The following figure lists the main APIs for I
2
C. For more information on
the APIs, refer to the SmartFusion2_MSS_I2C_Driver_UG, as shown in the preceding figure.
Table 519 • MSS I
2
C APIs
Category API Description and Usage
Initialization and
configuration function
MSS_I2C_init() Initializes and configures the I
2
C with MSS I2C's
configuration as parameters
I
2
C master operation
functions
MSS_I2C_write() Initiates an I
2
C master write transaction
MSS_I2C_read() Initiates an I
2
C master read transaction
MSS_I2C_write_read() Initiates an I
2
C write-read transaction
MSS_I2C_wait_complete() Waits for the current I
2
C transaction to complete
MSS_I2C_get_status() Gets the current state of an MSS I2C instance
I
2
C slave operation
functions
MSS_I2C_set_slave_tx_buffer() Specifies the memory buffer holding the data that
will be sent to the I
2
C master
MSS_I2C_set_slave_rx_buffer() Specifies the memory buffer that will be used by
the MSS I2C slave instance to receive data
MSS_I2C_set_slave_mem_offset_length() Specifies the number of bytes expected as part of
the write phase of a write-read transaction
MSS_I2C_register_write_handler() Registers the function that is called to process
the data written to MSS I2C instance when it is
the slave in an I
2
C write transaction
MSS_I2C_enable_slave() Enables the MSS I2C slave
MSS_I2C_disable_slave() Disables the MSS I2C slave