iic
Vitis Drivers API Documentation
xiic.h File Reference

Data Structures

struct  XIic_Config
 This typedef contains configuration information for the device. More...
 
struct  XIicStats
 XIic statistics. More...
 
struct  XIic
 The XIic driver instance data. More...
 

Macros

#define XII_ADDR_TO_SEND_TYPE   1
 Bus address of slave device. More...
 
#define XII_ADDR_TO_RESPOND_TYPE   2
 This device's bus address as slave. More...
 
Configuration options

The following options may be specified or retrieved for the device and enable/disable additional features of the IIC bus.

Each of the options are bit fields such that more than one may be specified.

#define XII_GENERAL_CALL_OPTION   0x00000001
 
#define XII_REPEATED_START_OPTION   0x00000002
 
#define XII_SEND_10_BIT_OPTION   0x00000004
 
Status events

The following status events occur during IIC bus processing and are passed to the status callback.

Each event is only valid during the appropriate processing of the IIC bus. Each of these events are bit fields such that more than one may be specified.

#define XII_BUS_NOT_BUSY_EVENT   0x00000001
 Bus transitioned to not busy. More...
 
#define XII_ARB_LOST_EVENT   0x00000002
 Arbitration was lost. More...
 
#define XII_SLAVE_NO_ACK_EVENT   0x00000004
 Slave did not ACK (had error) More...
 
#define XII_MASTER_READ_EVENT   0x00000008
 Master reading from slave. More...
 
#define XII_MASTER_WRITE_EVENT   0x00000010
 Master writing to slave. More...
 
#define XII_GENERAL_CALL_EVENT   0x00000020
 General call to all slaves. More...
 

Typedefs

typedef void(* XIic_Handler )(void *CallBackRef, int ByteCount)
 This callback function data type is defined to handle the asynchronous processing of sent and received data of the IIC driver. More...
 
typedef void(* XIic_StatusHandler )(void *CallBackRef, int StatusEvent)
 This callback function data type is defined to handle the asynchronous processing of status events of the IIC driver. More...
 

Functions

int XIic_Initialize (XIic *InstancePtr, u16 DeviceId)
 Initializes a specific XIic instance. More...
 
XIic_ConfigXIic_LookupConfig (u16 DeviceId)
 Looks up the device configuration based on the unique device ID. More...
 
int XIic_CfgInitialize (XIic *InstancePtr, XIic_Config *Config, UINTPTR EffectiveAddr)
 Initializes a specific XIic instance. More...
 
int XIic_Start (XIic *InstancePtr)
 This function starts the IIC device and driver by enabling the proper interrupts such that data may be sent and received on the IIC bus. More...
 
int XIic_Stop (XIic *InstancePtr)
 This function stops the IIC device and driver such that data is no longer sent or received on the IIC bus. More...
 
void XIic_Reset (XIic *InstancePtr)
 Resets the IIC device. More...
 
int XIic_SetAddress (XIic *InstancePtr, int AddressType, int Address)
 This function sets the bus addresses. More...
 
u16 XIic_GetAddress (XIic *InstancePtr, int AddressType)
 This function gets the addresses for the IIC device driver. More...
 
int XIic_SetGpOutput (XIic *InstancePtr, u8 OutputValue)
 This function sets the contents of the General Purpose Output register for the IIC device driver. More...
 
int XIic_GetGpOutput (XIic *InstancePtr, u8 *OutputValuePtr)
 This function gets the contents of the General Purpose Output register for the IIC device driver. More...
 
u32 XIic_IsSlave (XIic *InstancePtr)
 A function to determine if the device is currently addressed as a slave. More...
 
void XIic_SetRecvHandler (XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)
 Sets the receive callback function, the receive handler, which the driver calls when it finishes receiving data. More...
 
void XIic_SetSendHandler (XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)
 Sets the send callback function, the send handler, which the driver calls when it receives confirmation of sent data. More...
 
void XIic_SetStatusHandler (XIic *InstancePtr, void *CallBackRef, XIic_StatusHandler FuncPtr)
 Sets the status callback function, the status handler, which the driver calls when it encounters conditions which are not data related. More...
 
void XIic_InterruptHandler (void *InstancePtr)
 This function is the interrupt handler for the XIic driver. More...
 
int XIic_MasterRecv (XIic *InstancePtr, u8 *RxMsgPtr, int ByteCount)
 This function receives data as a master from a slave device on the IIC bus. More...
 
int XIic_MasterSend (XIic *InstancePtr, u8 *TxMsgPtr, int ByteCount)
 This function sends data as a master on the IIC bus. More...
 
int XIic_DynMasterRecv (XIic *InstancePtr, u8 *RxMsgPtr, u8 ByteCount)
 This function receives data as a master from a slave device on the IIC bus. More...
 
int XIic_DynMasterSend (XIic *InstancePtr, u8 *TxMsgPtr, u8 ByteCount)
 This function sends data as a Dynamic master on the IIC bus. More...
 
void XIic_SlaveInclude (void)
 This function includes slave code such that slave events will be processed. More...
 
int XIic_SlaveRecv (XIic *InstancePtr, u8 *RxMsgPtr, int ByteCount)
 This function sends data as a slave on the IIC bus and should not be called until an event has occurred that indicates the device has been selected by a master attempting read from the slave (XII_MASTER_READ_EVENT). More...
 
int XIic_SlaveSend (XIic *InstancePtr, u8 *TxMsgPtr, int ByteCount)
 This function sends data as a slave on the IIC bus and should not be called until an event has occurred that indicates the device has been selected by a master attempting read from the slave (XII_MASTER_READ_EVENT). More...
 
void XIic_GetStats (XIic *InstancePtr, XIicStats *StatsPtr)
 Gets a copy of the statistics for an IIC device. More...
 
void XIic_ClearStats (XIic *InstancePtr)
 Clears the statistics for the IIC device by zeroing all counts. More...
 
int XIic_SelfTest (XIic *InstancePtr)
 Runs a limited self-test on the driver/device. More...
 
void XIic_SetOptions (XIic *InstancePtr, u32 NewOptions)
 This function sets the options for the IIC device driver. More...
 
u32 XIic_GetOptions (XIic *InstancePtr)
 This function gets the current options for the IIC device. More...
 
void XIic_MultiMasterInclude (void)
 This function includes multi-master code such that multi-master events are handled properly. More...