iicps
Vitis Drivers API Documentation
xiicps_smbus_polled_master_example.c File Reference

Overview

This example can run on zynqmp / versal platform evaluation board and IIC controller configured as master in polled mode and loopback setup used for slave.

It sends and receives the data using IIC master device for SMBus transfers.

 MODIFICATION HISTORY:
Ver   Who Date     Changes


1.00 gm 06/30/22 First release 3.18 gm 07/14/23 Added SDT support.

 

Functions

int IicPsMasterPolledExample (u16 DeviceId)
 This function does a minimal test on the Iic device and driver as a design example. More...
 
int XIicPsSmbusPolledMasterWriteBlockData (XIicPs *InstancePtr, u8 Command, u8 ByteCount, u8 *SendBufferPtr)
 This function writes a buffer of data to the smbus slave. More...
 
int XIicPsSmbusPolledMasterReadBlockData (XIicPs *InstancePtr, u8 Command, u8 ByteCount, u8 *RecvBufferPtr)
 This function sends a command and reads a buffer of data from the smbus slave. More...
 
int main (void)
 Main function to call the polled master example. More...
 

Variables

XIicPs Iic
 Instance of the IIC Device. More...
 
u8 SendBuffer [TEST_BUFFER_SIZE]
 Buffer for Transmitting Data. More...
 
u8 RecvBuffer [TEST_BUFFER_SIZE]
 Buffer for Receiving Data. More...
 

Function Documentation

int IicPsMasterPolledExample ( u16  DeviceId)

This function does a minimal test on the Iic device and driver as a design example.

The purpose of this function is to illustrate how to use the XIicPs driver.

This function sends and receives data as a smbus master in poll mode of the IIC.

Parameters
DeviceIdis the Device ID of the IicPs Device and is the XPAR_<IICPS_instance>_DEVICE_ID value from xparameters.h
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note
None.
int main ( void  )

Main function to call the polled master example.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful.
Note
None.

References IicPsMasterPolledExample().

int XIicPsSmbusPolledMasterReadBlockData ( XIicPs InstancePtr,
u8  Command,
u8  ByteCount,
u8 *  RecvBufferPtr 
)

This function sends a command and reads a buffer of data from the smbus slave.

Parameters
InstancePtrcontains the address of XIicPs instance.
Commandcontains send command.
ByteCountcontains the number of bytes to read.
RecvBufferPtrcontains the address of receive buffer.
Returns
XST_SUCCESS if successful else XST_FAILURE.
Note
None

References XIicPs_BusIsBusy(), XIicPs_ClearOptions(), XIicPs_MasterRecvPolled(), XIicPs_MasterSendPolled(), XIICPS_REP_START_OPTION, and XIicPs_SetOptions().

int XIicPsSmbusPolledMasterWriteBlockData ( XIicPs InstancePtr,
u8  Command,
u8  ByteCount,
u8 *  SendBufferPtr 
)

This function writes a buffer of data to the smbus slave.

Parameters
InstancePtrcontains the address of XIicPs instance.
Commandcontains send command.
ByteCountcontains the number of bytes to write.
SendBufferPtrcontains the address of send buffer.
Returns
XST_SUCCESS if successful else XST_FAILURE.
Note
None

References XIicPs_BusIsBusy(), and XIicPs_MasterSendPolled().

Variable Documentation

XIicPs Iic

Instance of the IIC Device.

u8 RecvBuffer[TEST_BUFFER_SIZE]

Buffer for Receiving Data.

u8 SendBuffer[TEST_BUFFER_SIZE]

Buffer for Transmitting Data.