Software Drivers

xhwicap.c File Reference

#include <xil_types.h>
#include <xil_assert.h>
#include "xhwicap.h"
#include "xparameters.h"

Functions

int XHwIcap_CfgInitialize (XHwIcap *InstancePtr, XHwIcap_Config *ConfigPtr, u32 EffectiveAddr)
int XHwIcap_DeviceWrite (XHwIcap *InstancePtr, u32 *FrameBuffer, u32 NumWords)
int XHwIcap_DeviceRead (XHwIcap *InstancePtr, u32 *FrameBuffer, u32 NumWords)
void XHwIcap_Reset (XHwIcap *InstancePtr)
void XHwIcap_FlushFifo (XHwIcap *InstancePtr)
void XHwIcap_Abort (XHwIcap *InstancePtr)

Detailed Description

This file contains the functions of the XHwIcap driver. See xhwicap.h for a detailed description of the driver.

Note:

Virtex4, Virtex5, Virtex6, Spartan6, 7 series and Zynq devices are supported.

In a Zynq device the ICAP needs to be selected using the XDcfg_SelectIcapInterface API of the DevCfg driver (clear the PCAP_PR bit of Control register in the Device Config Interface) before it can be accessed using the HwIcap.

 MODIFICATION HISTORY:
 Ver   Who  Date      Changes
 ----- ---- -------- -------------------------------------------------------
 2.00a sv   09/11/07  Initial version.
 2.01a ecm  04/08/08  Updated data structures to include the V5FXT parts.
 3.00a sv   11/28/08  Added the API for initiating Abort while reading/writing
		       from the ICAP.
 4.00a hvm  12/1/09   Added support for V6 and updated with HAL phase 1
		       modifications
 5.00a hvm  04/02/10  Added support for S6 device.
 5.01a hvm  07/06/10  In XHwIcap_DeviceRead function, a read bit mask
		       verification is added after all the data bytes are read
		       from READ FIFO.The Verification of the read bit mask
		       at the begining of reading of bytes is removed.
 5.03a hvm  15/4/11   Updated with V6 CXT device definitions.
 6.00a hvm  08/01/11  Added support for K7 devices.
 7.00a bss  03/14/12  Added support for 8/16/32 ICAP Data Widths - CR 620085
		       Added support for Lite Mode(no Write FIFO) - CR 601748
		       Added Virtex 7, Artix 7 and Zynq Idcodes in Device look
		        up table - CR 647140, CR 643295
 8.01a bss  04/18/13  Updated to fix compiler warnings. CR#704814
 9.0   bss  02/20/14  Updated to support Kintex8, kintexu and virtex72000T
	 		family devices.
 10.0  bss  6/24/14  Removed support for families older than 7 series
		      Removed IDCODE lookup logic in XHwIcap_CfgInitialize.
 10.0  bss  7/10/14  Fix compilation failure for designs other than 32 bit
		      data width of HWICAP.
 

Function Documentation

void XHwIcap_Abort ( XHwIcap InstancePtr  ) 

This function initiates the Abort Sequence by setting the Abort bit in the control register.

Parameters:
InstancePtr is a pointer to the XHwIcap instance.
Returns:
None.
Note:
None.
int XHwIcap_CfgInitialize ( XHwIcap InstancePtr,
XHwIcap_Config ConfigPtr,
u32  EffectiveAddr 
)

This function initializes a specific XHwIcap instance. The IDCODE is read from the FPGA and based on the IDCODE the information about the resources in the FPGA is filled in the instance structure.

The HwIcap device will be in put in a reset state before exiting this function.

Parameters:
InstancePtr is a pointer to the XHwIcap instance.
ConfigPtr points to the XHwIcap device configuration structure.
EffectiveAddr is the device base address in the virtual memory address space. If the address translation is not used then the physical address is passed. Unexpected errors may occur if the address mapping is changed after this function is invoked.
Returns:
XST_SUCCESS else XST_FAILURE
Note:
None.

Set IcapWidth

Set IsLiteMode

int XHwIcap_DeviceRead ( XHwIcap InstancePtr,
u32 *  FrameBuffer,
u32  NumWords 
)

This function reads the specified number of words from the ICAP device in the polled mode. Interrupt mode is not supported in reading data from the ICAP device.

Parameters:
InstancePtr is a pointer to the XHwIcap instance.
FrameBuffer is a pointer to the memory where the frame read from the ICAP device is stored.
NumWords is the number of words (16 bit for S6 and 32 bit for all other devices) to write to the ICAP device.
Returns:
  • XST_SUCCESS if the specified number of words have been read from the ICAP device
  • XST_FAILURE if the device is busy with the last Read/Write or if the requested number of words have not been read from the ICAP device, or there is a timeout.
Note:
This is a blocking function.
int XHwIcap_DeviceWrite ( XHwIcap InstancePtr,
u32 *  FrameBuffer,
u32  NumWords 
)

This function writes the given user data to the Write FIFO in both the polled mode and the interrupt mode and starts the transfer of the data to the ICAP device.

In the polled mode, this function will write the specified number of words into the FIFO before returning.

In the interrupt mode, this function will write the words upto the size of the Write FIFO and starts the transfer, then subsequent transfer of the data is performed by the interrupt service routine until the entire buffer has been transferred. The status callback function is called when the entire buffer has been sent. In order to use interrupts, it is necessary for the user to connect the driver interrupt handler, XHwIcap_IntrHandler(), to the interrupt system of the application and enable the interrupts associated with the Write FIFO. The user has to enable the interrupts each time this function is called using the XHwIcap_IntrEnable macro.

Parameters:
InstancePtr is a pointer to the XHwIcap instance.
FrameBuffer is a pointer to the data to be written to the ICAP device.
NumWords is the number of words (16 bit for S6 and 32 bit for all other devices)to write to the ICAP device.
Returns:
XST_SUCCESS or XST_FAILURE
Note:
This function is a blocking for the polled mode of operation and is non-blocking for the interrupt mode of operation. Use the function XHwIcap_DeviceWriteFrame for writing a frame of data to the ICAP device.

Icap Width of 32 does not use Fifo but declared to overcome compilation error. Size of 4 is used to overcome compiler warnings

void XHwIcap_FlushFifo ( XHwIcap InstancePtr  ) 

This function flushes the FIFOs in the device.

Parameters:
InstancePtr is a pointer to the XHwIcap instance.
Returns:
None.
Note:
None.
void XHwIcap_Reset ( XHwIcap InstancePtr  ) 

This function forces the software reset of the complete HWICAP device. All the registers will return to the default value and the FIFO is also flushed as a part of this software reset.

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