iic
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
xiic.h File Reference
#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xiic_l.h"

Data Structures

struct  XIic_Config
 Holds configuration information for the device. More...
 
struct  XIicStats
 Holds XIic statistics. More...
 
struct  XIic
 Holds 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
 General call option. More...
 
#define XII_REPEATED_START_OPTION   0x00000002
 Repeated start option. More...
 
#define XII_SEND_10_BIT_OPTION   0x00000004
 Send 10 bit option. More...
 
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)
 Defines the send and receive callback type for the IIC driver. More...
 
typedef void(* XIic_StatusHandler )(void *CallBackRef, int StatusEvent)
 Defines the status callback type for the IIC driver. More...
 

Functions

int XIic_Initialize (XIic *InstancePtr, UINTPTR BaseAddress)
 Initializes a specific XIic instance. More...
 
XIic_Config * XIic_LookupConfig (UINTPTR BaseAddress)
 Looks up the device configuration by unique device ID or base address. More...
 
int XIic_CfgInitialize (XIic *InstancePtr, XIic_Config *Config, UINTPTR EffectiveAddr)
 Initializes a specific XIic instance. More...
 
int XIic_Start (XIic *InstancePtr)
 Starts the IIC device and driver by enabling the proper interrupts. More...
 
int XIic_Stop (XIic *InstancePtr)
 Stops the IIC device and driver. More...
 
void XIic_Reset (XIic *InstancePtr)
 Resets the IIC device. More...
 
int XIic_SetAddress (XIic *InstancePtr, int AddressType, int Address)
 Sets the bus addresses. More...
 
u16 XIic_GetAddress (XIic *InstancePtr, int AddressType)
 Gets the addresses for the IIC device driver. More...
 
int XIic_SetGpOutput (XIic *InstancePtr, u8 OutputValue)
 Sets the contents of the IIC General Purpose Output register. More...
 
int XIic_GetGpOutput (XIic *InstancePtr, u8 *OutputValuePtr)
 Gets the contents of the IIC General Purpose Output register. More...
 
u32 XIic_IsSlave (XIic *InstancePtr)
 Determines if the device is currently addressed as a slave. More...
 
void XIic_SetRecvHandler (XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)
 Sets the receive handler that the driver calls after receiving data. More...
 
void XIic_SetSendHandler (XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)
 Sets the send handler called on confirmation of sent data. More...
 
void XIic_SetStatusHandler (XIic *InstancePtr, void *CallBackRef, XIic_StatusHandler FuncPtr)
 Sets the status handler for events that are not data related. More...
 
void XIic_InterruptHandler (void *InstancePtr)
 Handles interrupts for the XIic driver. More...
 
int XIic_MasterRecv (XIic *InstancePtr, u8 *RxMsgPtr, int ByteCount)
 Receives data as a master from a slave device on the IIC bus. More...
 
int XIic_MasterSend (XIic *InstancePtr, u8 *TxMsgPtr, int ByteCount)
 Sends data as a master on the IIC bus. More...
 
int XIic_DynMasterRecv (XIic *InstancePtr, u8 *RxMsgPtr, u8 ByteCount)
 Receives data as a master from a slave device on the IIC bus. More...
 
int XIic_DynMasterSend (XIic *InstancePtr, u8 *TxMsgPtr, u8 ByteCount)
 Sends data as a Dynamic master on the IIC bus. More...
 
int XIic_DynamicInitialize (XIic *InstancePtr)
 Initializes the IIC core for dynamic functionality. More...
 
void XIic_SlaveInclude (void)
 Includes slave code so slave events are processed. More...
 
int XIic_SlaveRecv (XIic *InstancePtr, u8 *RxMsgPtr, int ByteCount)
 Receives data as a slave on the IIC bus. More...
 
int XIic_SlaveSend (XIic *InstancePtr, u8 *TxMsgPtr, int ByteCount)
 Sends data as a slave on the IIC bus. 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 Options)
 Sets the options for the IIC device driver. More...
 
u32 XIic_GetOptions (XIic *InstancePtr)
 Gets the current options for the IIC device. More...
 
u32 XIic_SetClk (XIic *InstancePtr, u32 FsclHz)
 Sets the serial clock rate for the IIC device. More...
 
void XIic_MultiMasterInclude (void)
 Includes multi-master code so multi-master events are handled. More...