Software Drivers

xiicps.c File Reference

#include "xiicps.h"

Functions

int XIicPs_CfgInitialize (XIicPs *InstancePtr, XIicPs_Config *ConfigPtr, u32 EffectiveAddr)
int XIicPs_BusIsBusy (XIicPs *InstancePtr)
void XIicPs_Abort (XIicPs *InstancePtr)
void XIicPs_Reset (XIicPs *InstancePtr)
int TransmitFifoFill (XIicPs *InstancePtr)

Detailed Description

Contains implementation of required functions for the XIicPs driver. See xiicps.h for detailed description of the device and driver.

 MODIFICATION HISTORY:
 Ver   Who     Date     Changes
 ----- ------  -------- --------------------------------------------
 1.00a drg/jz  01/30/10 First release
 1.00a sdm     09/21/11 Updated the InstancePtr->Options in the
			 XIicPs_CfgInitialize by calling XIicPs_GetOptions.
 2.1   hk      04/25/14 Explicitly reset CR and clear FIFO in Abort function
                        and state the same in the comments. CR# 784254.
                        Fix for CR# 761060 - provision for repeated start.
 

Function Documentation

int TransmitFifoFill ( XIicPs InstancePtr  ) 

Put more data into the transmit FIFO, number of bytes is ether expected number of bytes for this transfer or available space in FIFO, which ever is less.

Parameters:
InstancePtr is a pointer to the XIicPs instance.
Returns:
Number of bytes left for this instance.
Note:
This is function is shared by master and slave.
void XIicPs_Abort ( XIicPs InstancePtr  ) 

Aborts a transfer in progress by resetting the FIFOs. The byte counts are cleared.

Parameters:
InstancePtr is a pointer to the XIicPs instance.
Returns:
None.
Note:
None.
int XIicPs_BusIsBusy ( XIicPs InstancePtr  ) 

Check whether the I2C bus is busy

Parameters:
InstancePtr is a pointer to the XIicPs instance.
Returns:
  • TRUE if the bus is busy.
  • FALSE if the bus is not busy.
Note:
None.
int XIicPs_CfgInitialize ( XIicPs InstancePtr,
XIicPs_Config ConfigPtr,
u32  EffectiveAddr 
)

Initializes a specific XIicPs instance such that the driver is ready to use.

The state of the device after initialization is:

  • Device is disabled
  • Slave mode
Parameters:
InstancePtr is a pointer to the XIicPs instance.
ConfigPtr is a reference to a structure containing information about a specific IIC device. This function initializes an InstancePtr object for a specific device specified by the contents of Config.
EffectiveAddr is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use ConfigPtr->BaseAddress for this parameter, passing the physical address instead.
Returns:
The return value is XST_SUCCESS if successful.
Note:
None.
void XIicPs_Reset ( XIicPs InstancePtr  ) 

Resets the IIC device. Reset must only be called after the driver has been initialized. The configuration of the device after reset is the same as its configuration after initialization. Any data transfer that is in progress is aborted.

The upper layer software is responsible for re-configuring (if necessary) and reenabling interrupts for the IIC device after the reset.

Parameters:
InstancePtr is a pointer to the XIicPs instance.
Returns:
None.
Note:
None.