#include "xhwicap_i.h"
#include "xhwicap_l.h"
#include <xstatus.h>
#include "xparameters.h"
Classes | |
struct | XHwIcap_Config |
struct | XHwIcap |
Defines | |
#define | XHWICAP_H_ |
#define | XHwIcap_FifoWrite(InstancePtr, Data) |
#define | XHwIcap_FifoRead(InstancePtr) (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_RF_OFFSET)) |
#define | XHwIcap_SetSizeReg(InstancePtr, Data) |
#define | XHwIcap_GetControlReg(InstancePtr) (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_CR_OFFSET)) |
#define | XHwIcap_StartConfig(InstancePtr) |
#define | XHwIcap_StartReadBack(InstancePtr) |
#define | XHwIcap_GetStatusReg(InstancePtr) (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_SR_OFFSET)) |
#define | XHwIcap_IsTransferDone(InstancePtr) ((InstancePtr->IsTransferInProgress) ? FALSE : TRUE) |
#define | XHwIcap_IsDeviceBusy(InstancePtr) |
#define | XHwIcap_IntrGlobalEnable(InstancePtr) |
#define | XHwIcap_IntrGlobalDisable(InstancePtr) |
#define | XHwIcap_IntrGetStatus(InstancePtr) |
#define | XHwIcap_IntrDisable(InstancePtr, IntrMask) |
#define | XHwIcap_IntrEnable(InstancePtr, IntrMask) |
#define | XHwIcap_IntrGetEnabled(InstancePtr) |
#define | XHwIcap_IntrClear(InstancePtr, IntrMask) |
#define | XHwIcap_GetWrFifoVacancy(InstancePtr) XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, XHI_WFV_OFFSET) |
#define | XHwIcap_GetRdFifoOccupancy(InstancePtr) XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, XHI_RFO_OFFSET) |
Typedefs | |
typedef void(* | XHwIcap_StatusHandler )(void *CallBackRef, u32 StatusEvent, u32 WordCount) |
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) |
XHwIcap_Config * | XHwIcap_LookupConfig (u16 DeviceId) |
int | XHwIcap_CommandDesync (XHwIcap *InstancePtr) |
int | XHwIcap_CommandCapture (XHwIcap *InstancePtr) |
u32 | XHwIcap_GetConfigReg (XHwIcap *InstancePtr, u32 ConfigReg, u32 *RegData) |
int | XHwIcap_SelfTest (XHwIcap *InstancePtr) |
void | XHwIcap_IntrHandler (void *InstancePtr) |
void | XHwIcap_SetInterruptHandler (XHwIcap *InstancePtr, void *CallBackRef, XHwIcap_StatusHandler FuncPtr) |
int | XHwIcap_DeviceReadFrame (XHwIcap *InstancePtr, long Top, long Block, long HClkRow, long MajorFrame, long MinorFrame, u32 *FrameBuffer) |
int | XHwIcap_DeviceWriteFrame (XHwIcap *InstancePtr, long Top, long Block, long HClkRow, long MajorFrame, long MinorFrame, u32 *FrameData) |
int | XHwIcap_SetClbBits (XHwIcap *InstancePtr, long Row, long Col, const u8 Resource[][2], const u8 Value[], long NumBits) |
int | XHwIcap_GetClbBits (XHwIcap *InstancePtr, long Row, long Col, const u8 Resource[][2], u8 Value[], long NumBits) |
#define XHwIcap_FifoRead | ( | InstancePtr | ) | (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_RF_OFFSET)) |
Read data from the Read FIFO.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_FifoWrite | ( | InstancePtr, | |||
Data | ) |
(XHwIcap_WriteReg(((InstancePtr)->HwIcapConfig.BaseAddress), \ XHI_WF_OFFSET, (Data)))
Write data to the Write FIFO.
InstancePtr | is a pointer to the XHwIcap instance. | |
Data | is the 32-bit value to be written to the FIFO. |
#define XHwIcap_GetControlReg | ( | InstancePtr | ) | (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_CR_OFFSET)) |
Get the contents of the Control register.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_GetRdFifoOccupancy | ( | InstancePtr | ) | XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, XHI_RFO_OFFSET) |
This macro returns the occupancy of the Read FIFO.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHwIcap_GetStatusReg | ( | InstancePtr | ) | (XHwIcap_ReadReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_SR_OFFSET)) |
Get the contents of the status register.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_GetWrFifoVacancy | ( | InstancePtr | ) | XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, XHI_WFV_OFFSET) |
This macro returns the vacancy of the Write FIFO. This indicates the number of words that can be written to the Write FIFO before it becomes full.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHWICAP_H_ |
#define XHwIcap_IntrClear | ( | InstancePtr, | |||
IntrMask | ) |
XHwIcap_WriteReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPISR_OFFSET, \ XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPISR_OFFSET) | ((IntrMask) & XHI_IPIXR_ALL_MASK))
This macro clears the specified interrupts in the Interrupt Status Register (IPISR).
InstancePtr | is a pointer to the HwIcap instance. | |
IntrMask | contains the interrupts to be cleared. |
#define XHwIcap_IntrDisable | ( | InstancePtr, | |||
IntrMask | ) |
XHwIcap_WriteReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPIER_OFFSET, \ XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPIER_OFFSET) & (~ (IntrMask & XHI_IPIXR_ALL_MASK)));\ (InstancePtr)->IsPolled = TRUE;
This macro disables the specified interrupts in the Interrupt Enable Register. It is non-destructive in that the register is read and only the interrupts specified is changed.
InstancePtr | is a pointer to the HwIcap instance. | |
IntrMask | is the bit-mask of the interrupts to be disabled. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XHI_IPIXR_*_MASK bits defined in xhwicap_l.h. |
#define XHwIcap_IntrEnable | ( | InstancePtr, | |||
IntrMask | ) |
XHwIcap_WriteReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPIER_OFFSET, \ (XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPIER_OFFSET) | ((IntrMask) & XHI_IPIXR_ALL_MASK))); \ (InstancePtr)->IsPolled = FALSE;
This macro enables the specified interrupts in the Interrupt Enable Register. It is non-destructive in that the register is read and only the interrupts specified is changed.
InstancePtr | is a pointer to the HwIcap instance. | |
IntrMask | is the bit-mask of the interrupts to be enabled. Bit positions of 1 will be enabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XHI_IPIXR_*_MASK bits defined in xhwicap_l.h. |
#define XHwIcap_IntrGetEnabled | ( | InstancePtr | ) |
XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPIER_OFFSET)
This macro returns the interrupt status read from Interrupt Enable Register(IIER). Use the XHI_IPIXR_* constants defined in xhwicap_l.h to interpret the returned value.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHwIcap_IntrGetStatus | ( | InstancePtr | ) |
XHwIcap_ReadReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_IPISR_OFFSET)
This macro returns the interrupt status read from Interrupt Status Register(IPISR). Use the XHI_IPIXR_* constants defined in xhwicap_l.h to interpret the returned value.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHwIcap_IntrGlobalDisable | ( | InstancePtr | ) |
XHwIcap_WriteReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_GIER_OFFSET, 0x0)
This macro disables the global interrupt in the Global Interrupt Enable Register (GIER) so that the interrupt output from the HwIcap device is disabled.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHwIcap_IntrGlobalEnable | ( | InstancePtr | ) |
XHwIcap_WriteReg((InstancePtr)->HwIcapConfig.BaseAddress, \ XHI_GIER_OFFSET, XHI_GIER_GIE_MASK)
This macro enables the global interrupt in the Global Interrupt Enable Register (GIER) so that the interrupt output from the HwIcap device is enabled. Interrupts enabled using XHwIcap_IntrEnable() will not occur until the global interrupt enable bit is set by using this macro.
InstancePtr | is a pointer to the HwIcap instance. |
#define XHwIcap_IsDeviceBusy | ( | InstancePtr | ) |
((XHwIcap_GetStatusReg(InstancePtr) & XHI_SR_DONE_MASK) ? \ FALSE : TRUE)
This macro checks if the last Read/Write to the ICAP device in the FPGA is completed.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_IsTransferDone | ( | InstancePtr | ) | ((InstancePtr->IsTransferInProgress) ? FALSE : TRUE) |
This macro checks if the last Read/Write of the data to the Read/Write FIFO of the HwIcap device is completed.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_SetSizeReg | ( | InstancePtr, | |||
Data | ) |
(XHwIcap_WriteReg(((InstancePtr)->HwIcapConfig.BaseAddress), \ XHI_SZ_OFFSET, (Data)))
Set the number of words to be read from the Icap in the Size register.
The Size Register holds the number of 32 bit words to transfer from the the Icap to the Read FIFO of the HwIcap device.
InstancePtr | is a pointer to the XHwIcap instance. | |
Data | is the size in words. |
#define XHwIcap_StartConfig | ( | InstancePtr | ) |
(XHwIcap_WriteReg(((InstancePtr)->HwIcapConfig.BaseAddress), XHI_CR_OFFSET, \ (XHwIcap_GetControlReg(InstancePtr) & \ (~ XHI_CR_READ_MASK)) | XHI_CR_WRITE_MASK))
Set the Control Register to initiate a configuration (write) to the device.
InstancePtr | is a pointer to the XHwIcap instance. |
#define XHwIcap_StartReadBack | ( | InstancePtr | ) |
(XHwIcap_WriteReg(((InstancePtr)->HwIcapConfig.BaseAddress) , XHI_CR_OFFSET, \ (XHwIcap_GetControlReg(InstancePtr) & \ (~ XHI_CR_WRITE_MASK)) | XHI_CR_READ_MASK))
Set the Control Register to initiate a ReadBack from the device.
InstancePtr | is a pointer to the XHwIcap instance. |
typedef void(* XHwIcap_StatusHandler)(void *CallBackRef, u32 StatusEvent, u32 WordCount) |
The handler data type allows the user to define a callback function to handle the asynchronous processing of the HwIcap driver. The application using this driver is expected to define a handler of this type to support interrupt driven mode. The handler executes in an interrupt context such that minimal processing should be performed.
CallBackRef | is a callback reference passed in by the application layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. Its type is unimportant to the driver component, so it is a void pointer. | |
StatusEvent | indicates one or more status events that occurred. See the XHwIcap_SetInterruptHandler for details on the status events that can be passed in the callback. | |
WordCount | indicates how many words of data were successfully transferred. This may be less than the number of words requested if there was an error. |
void XHwIcap_Abort | ( | XHwIcap * | InstancePtr | ) |
This function initiates the Abort Sequence by setting the Abort bit in the control register.
InstancePtr | is a pointer to the XHwIcap instance. |
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.
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. |
Set IcapWidth
Set IsLiteMode
int XHwIcap_CommandCapture | ( | XHwIcap * | InstancePtr | ) |
Sends a CAPTURE command to the ICAP port. This command captures all of the flip flop states so they will be available during readback. One can use this command instead of enabling the CAPTURE block in the design.
InstancePtr | is a pointer to the XHwIcap instance. |
int XHwIcap_CommandDesync | ( | XHwIcap * | InstancePtr | ) |
Sends a DESYNC command to the ICAP port.
InstancePtr | - a pointer to the XHwIcap instance to be worked on |
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.
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. |
int XHwIcap_DeviceReadFrame | ( | XHwIcap * | InstancePtr, | |
long | Top, | |||
long | Block, | |||
long | HClkRow, | |||
long | MajorFrame, | |||
long | MinorFrame, | |||
u32 * | FrameBuffer | |||
) |
Reads one frame from the device and puts it in memory specified by the user.
InstancePtr | - a pointer to the XHwIcap instance to be worked on. | |
Top | - top (0) or bottom (1) half of device | |
Block | - Block Address (XHI_FAR_CLB_BLOCK, XHI_FAR_BRAM_BLOCK, XHI_FAR_BRAM_INT_BLOCK) | |
HClkRow | - selects the HClk Row | |
MajorFrame | - selects the column | |
MinorFrame | - selects frame inside column | |
FrameBuffer | is a pointer to the memory where the frame read from the device is stored |
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.
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. |
Icap Width of 32 does not use Fifo but declared to overcome compilation error. Size of 4 is used to overcome compiler warnings
int XHwIcap_DeviceWriteFrame | ( | XHwIcap * | InstancePtr, | |
long | Top, | |||
long | Block, | |||
long | HClkRow, | |||
long | MajorFrame, | |||
long | MinorFrame, | |||
u32 * | FrameData | |||
) |
Writes one frame from the specified buffer and puts it in the device (ICAP).
InstancePtr | is a pointer to the XHwIcap instance. | |
Top | - top (0) or bottom (1) half of device | |
Block | - Block Address (XHI_FAR_CLB_BLOCK, XHI_FAR_BRAM_BLOCK, XHI_FAR_BRAM_INT_BLOCK) | |
HClkRow | - selects the HClk Row | |
MajorFrame | - selects the column | |
MinorFrame | - selects frame inside column | |
FrameData | is a pointer to the frame that is to be written to the device. |
void XHwIcap_FlushFifo | ( | XHwIcap * | InstancePtr | ) |
This function flushes the FIFOs in the device.
InstancePtr | is a pointer to the XHwIcap instance. |
int XHwIcap_GetClbBits | ( | XHwIcap * | InstancePtr, | |
long | Row, | |||
long | Col, | |||
const u8 | Resource[][2], | |||
u8 | Value[], | |||
long | NumBits | |||
) |
Gets bits contained in a Center tile specified by the CLB row and col coordinates. The coordinate system lables the upper left CLB as (1,1).
InstancePtr | is a pointer to the XHwIcap instance. | |
Row | is the CLB row. (1,1) is the upper left CLB. | |
Col | is the CLB col. (1,1) is the upper left CLB. | |
Resource | is the Target bits (first dimension length will be the number of bits to set and must match the numBits parameter) (second dimension contains two value -- one for minor row and one for col information from within the Center tile targetted by the above row and col coords). | |
Value | is the values to set each of the targets bits to. The size of this array must be euqal to NumBits. | |
NumBits | is the number of Bits to change in this method. |
u32 XHwIcap_GetConfigReg | ( | XHwIcap * | InstancePtr, | |
u32 | ConfigReg, | |||
u32 * | RegData | |||
) |
This function returns the value of the specified configuration register.
InstancePtr | is a pointer to the XHwIcap instance. | |
ConfigReg | is a constant which represents the configuration register value to be returned. Constants specified in xhwicap_i.h. Examples: XHI_IDCODE, XHI_FLR. | |
RegData | is the value of the specified configuration register. |
void XHwIcap_IntrHandler | ( | void * | InstancePtr | ) |
The interrupt handler for HwIcap interrupts. This function must be connected by the user to an interrupt source.
InstancePtr | is a pointer to the XHwIcap instance. |
XHwIcap_Config* XHwIcap_LookupConfig | ( | u16 | DeviceId | ) |
Looks up the device configuration based on the unique device ID. A table contains the configuration info for each device in the system.
DeviceId | contains the ID of the device for which the device configuration pointer is to be returned. |
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.
InstancePtr | is a pointer to the XHwIcap instance. |
int XHwIcap_SelfTest | ( | XHwIcap * | InstancePtr | ) |
Run a self-test on the driver/device. The test
InstancePtr | is a pointer to the XHwIcap instance. |
int XHwIcap_SetClbBits | ( | XHwIcap * | InstancePtr, | |
long | Row, | |||
long | Col, | |||
const u8 | Resource[][2], | |||
const u8 | Value[], | |||
long | NumBits | |||
) |
Sets bits contained in a Center tile specified by the CLB row and col coordinates. The coordinate system lables the upper left CLB as (1,1).
InstancePtr | is a pointer to XHwIcap instance to be worked on | |
Row | is the CLB row. (1,1) is the upper left CLB. | |
Col | is the CLB col. (1,1) is the upper left CLB. | |
Resource | is the Target bits (first dimension length will be the number of bits to set and must match the numBits parameter) (second dimension contains two value -- one for minor row and one for col information from within the Center tile targetted by the above row and col coords). | |
Value | is the values to set each of the targets bits to. The size of this array must be euqal to NumBits. | |
NumBits | is the number of Bits to change in this method. |
void XHwIcap_SetInterruptHandler | ( | XHwIcap * | InstancePtr, | |
void * | CallBackRef, | |||
XHwIcap_StatusHandler | FuncPtr | |||
) |
Sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to the higher layer software. The handler executes in an interrupt context, so it must minimize the amount of processing performed such as transferring data to a thread context. One of the following status events is passed to the status handler.
InstancePtr | is a pointer to the XHwIcap instance. | |
CallBackRef | is the upper layer callback reference passed back when the callback function is invoked. | |
FuncPtr | is the pointer to the callback function. |
The handler is called within interrupt context, so it should do its work quickly and queue potentially time-consuming work to a task-level thread.
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.