/****************************************************************************** * * Copyright (C) 2007 - 2014 Xilinx, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * Use of the Software is limited solely to applications: * (a) running on a Xilinx device, or * (b) that interact with a Xilinx device through a bus or interconnect. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the Xilinx shall not be used * in advertising or otherwise to promote the sale, use or other dealings in * this Software without prior written authorization from Xilinx. * ******************************************************************************/ /*****************************************************************************/ /** * @file xhwicap_intr_example.c * * * This file contains a design example using the HwIcap driver (XHwIcap) and * the HwIcap device using the interrupt mode. * * @note None. * * * *****WARNING ************ * * This is not an example that can be used directly. This example gives the * sequence of steps that need to be done for programming the FPGA with a given * configuration(partial) file. This configuration file differs from each system * and each version of the FPGA device. * *
* * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ---- -------- --------------------------------------------------------- * 2.00a sv 09/29/07 First release * 4.00a hvm 12/1/09 Updated with HAL phase 1 changes * 5.00a hvm 2/25/10 Updated with S6 support * 10.0 bss 6/24/14 Removed support for families older than 7 series * *******************************************************************************/ /***************************** Include Files *********************************/ #include "xparameters.h" /* XPAR parameters */ #include "xhwicap.h" /* HwIcap device driver */ #include "xintc.h" /* Interrupt controller device driver */ #include "xil_exception.h" /* Exceptions */ /************************** Constant Definitions *****************************/ /* * The following constants map to the XPAR parameters created in the * xparameters.h file. They are defined here such that a user can easily * change all the needed parameters in one place. */ #define HWICAP_DEVICE_ID XPAR_HWICAP_0_DEVICE_ID #define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID #define HWICAP_IRPT_INTR XPAR_INTC_0_HWICAP_0_VEC_ID /* * This is the size of the buffer in words which is written in this example. */ #define TEST_WRITE_BUFFER_SIZE 4096 #error This is an example to show the usage of the device/driver in Interrupt \ mode. The user has to give a valid partial bitstream as in input to \ the example otherwise it may overwrite the existing configuration \ data in the device and result in unpredicatble behaviour /**************************** Type Definitions *******************************/ /***************** Macros (Inline Functions) Definitions *********************/ /************************** Function Prototypes ******************************/ int HwIcapIntrExample(XIntc *IntcInstancePtr, XHwIcap *HwIcapInstancePtr, u16 HwIcapDeviceId, u16 HwIcapIntrId); void HwIcapIntrHandler(void *CallBackRef, u32 StatusEvent, u32 WordCount); static int HwIcapSetupInterruptSystem(XIntc* IntcInstancePtr, XHwIcap *HwIcapPtr, u16 IntrId ); /************************** Variable Definitions *****************************/ /* * The instances to support the device drivers are global such that the * are initialized to zero each time the program runs. */ static XIntc IntcInstance; /* The instance of the Interrupt Controller */ static XHwIcap HwIcapInstance; /* The instance of the HwIcap device */ /* * The following variables are shared between non-interrupt processing and * interrupt processing such that they must be global. */ volatile int TransferInProgress; /* * The following variable tracks any errors that occur during interrupt * processing */ int Error; /* * The following variables are used to read and write to the HwIcap device, they * are global to avoid having large buffers on the stack. */ u32 WriteBuffer[TEST_WRITE_BUFFER_SIZE]; /*****************************************************************************/ /** * * Main function to call the HwIcap interrupt example. * * @param None * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None * ******************************************************************************/ int main(void) { int Status; /* * Run the HwIcap Interrupt example. */ Status = HwIcapIntrExample(&IntcInstance, &HwIcapInstance, HWICAP_DEVICE_ID, HWICAP_IRPT_INTR); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; } /*****************************************************************************/ /** * * This function does a minimal test on the HwIcap device and driver as a * design example. The purpose of this function is to illustrate how to use * the XHwIcap component using the interrupt mode. * * This function sends data and expects to receive the same data. * * * @param IntcInstancePtr is a pointer to the instance of the INTC component. * @param HwIcapInstancePtr is a pointer to the instance of HwIcap component. * @param HwIcapDeviceId is the Device ID of the HwIcap Device and is the * XPAR_