iicps
Vitis Drivers API Documentation
xiicps_intr_multi_master_example.c File Reference

Overview

Design example is to demonstrate multi-master support in interrupt mode.

In case of arbitration lost interrupt there will be retry in example. The XIicPs_MasterSend() API is used to transmit the data and the XIicPs_MasterRecv() API is used to receive the data. This example tested on ZCU102 board and slave address needs to be changed based on board design

This example can run on zynqmp / versal IIC device as master and Aardvark test hardware used as slave. It sends 18 buffers of data to slave and expects to receive the same data through the IIC.

 MODIFICATION HISTORY:
Ver   Who Date     Changes


1.00a sg 03/09/19 First release 3.18 gm 07/14/23 Added SDT support.

 

Functions

s32 IicPsMultiMasterIntrExample (u16 DeviceId)
 The purpose of this function is to illustrate multi-master arbitration lost support in XIicPs driver. More...
 
void Handler (void *CallBackRef, u32 Event)
 This function is the handler which performs processing to handle data events from the IIC. More...
 
s32 main (void)
 Main function to call the example. More...
 

Function Documentation

void Handler ( void *  CallBackRef,
u32  Event 
)

This function is the handler which performs processing to handle data events from the IIC.

It is called from an interrupt context such that the amount of processing performed should be minimized.

This handler provides an example of how to handle data for the IIC and is application specific.

Parameters
CallBackRefcontains a callback reference from the driver, in this case it is the instance pointer for the IIC driver.
Eventcontains the specific kind of event that has occurred.
Returns
None.
Note
None.
s32 IicPsMultiMasterIntrExample ( u16  DeviceId)

The purpose of this function is to illustrate multi-master arbitration lost support in XIicPs driver.

This function sends data and expects to receive the same data through the IIC using the Aardvark test hardware.

This function uses interrupt driver mode of the IIC.

This function uses interrupt transfer functions to send buffers with different length and receive the same from device. In case arbitration lost status will re-initiate the transfer BufferSizes array contains length information

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

This function contains an infinite loop such that if interrupts are not working it may never return.

References XIicPs_Config::BaseAddress, Handler(), TotalErrorCount, XIicPs_BusIsBusy(), XIicPs_CfgInitialize(), XIicPs_LookupConfig(), XIicPs_MasterInterruptHandler(), XIicPs_MasterRecv(), XIicPs_MasterSend(), XIicPs_SelfTest(), XIicPs_SetSClk(), and XIicPs_SetStatusHandler().

Referenced by main().

s32 main ( void  )

Main function to call the example.

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

References IicPsMultiMasterIntrExample().