+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: emaclite_header.h,v 1.1.2.2 2010/09/16 12:57:34 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef EMACLITE_HEADER_H /* prevent circular inclusions */\r
-#define EMACLITE_HEADER_H /* by using protection macros */\r
-\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-int EmacLitePolledExample(u16 DeviceId);\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: emaclite_intr_header.h,v 1.1.2.2 2010/09/16 12:57:34 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef EMACLITE_INTR_HEADER_H /* prevent circular inclusions */\r
-#define EMACLITE_INTR_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-int EmacLiteIntrExample(XIntc* IntcInstancePtr,\r
- XEmacLite* EmacLiteInstPtr,\r
- u16 EmacLiteDeviceId,\r
- u16 EmacLiteIntrId);\r
-\r
-#endif\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: gpio_header.h,v 1.1.2.2 2010/09/16 13:03:37 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef GPIO_HEADER_H /* prevent circular inclusions */\r
-#define GPIO_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-int GpioOutputExample(u16 DeviceId, u32 GpioWidth);\r
-int GpioInputExample(u16 DeviceId, u32 *DataRead);\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: gpio_intr_header.h,v 1.1.2.2 2010/09/16 13:03:37 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef GPIO_INTR_HEADER_H /* prevent circular inclusions */\r
-#define GPIO_INTR_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-\r
-int GpioIntrExample(XIntc* IntcInstancePtr,\r
- XGpio* InstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u16 IntrMask,\r
- u32 *DataRead);\r
-\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: intc_header.h,v 1.1.4.1 2010/09/17 05:32:46 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2006-2009 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef INTC_HEADER_H /* prevent circular inclusions */\r
-#define INTC_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_assert.h"\r
-#include "xil_types.h"\r
-#include "xstatus.h"\r
-\r
-int IntcSelfTestExample(u16 DeviceId);\r
-int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId);\r
-\r
-#endif\r
-\r
+++ /dev/null
-/*
- *
- * Xilinx, Inc.
- * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
- * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
- * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
- * STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
- * IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
- * FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION
- * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
- * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
- * ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
- * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *
- *
- * This file is a generated sample test application.
- *
- * This application is intended to test and/or illustrate some
- * functionality of your system. The contents of this file may
- * vary depending on the IP in your system and may use existing
- * IP driver functions. These drivers will be generated in your
- * SDK application project when you run the "Generate Libraries" menu item.
- *
- */
-
-\r
-#include <stdio.h>
-#include "xparameters.h"
-#include "xenv_standalone.h"
-#include "xintc.h"
-#include "intc_header.h"
-#include "xbasic_types.h"
-#include "xgpio.h"
-#include "gpio_header.h"
-#include "xbasic_types.h"
-#include "xgpio.h"
-#include "gpio_header.h"
-#include "gpio_intr_header.h"
-#include "uartlite_header.h"
-#include "xtmrctr.h"
-#include "tmrctr_header.h"
-#include "tmrctr_intr_header.h"
-#include "xemaclite.h"
-#include "xemaclite_example.h"
-#include "emaclite_header.h"
-#include "emaclite_intr_header.h"
-\r
-
-#define GPIO_CHANNEL1 1
-\r
-int xmain()
-{
-\r
- static XIntc intc;
- static XGpio Push_Buttons_4Bits_Gpio;
- static XTmrCtr axi_timer_0_Timer;
- static XEmacLite Ethernet_Lite_EmacLite;
-\r
- XCACHE_ENABLE_ICACHE();
- XCACHE_ENABLE_DCACHE();
-\r
- print("---Entering main---\n\r");
-\r
-
-
- {
- int status;
-
- print("\r\n Running IntcSelfTestExample() for microblaze_0_intc...\r\n");
-
- status = IntcSelfTestExample(XPAR_MICROBLAZE_0_INTC_DEVICE_ID);
-
- if (status == 0) {
- print("IntcSelfTestExample PASSED\r\n");
- }
- else {
- print("IntcSelfTestExample FAILED\r\n");
- }
- }
-
- {
- int Status;
-
- Status = IntcInterruptSetup(&intc, XPAR_MICROBLAZE_0_INTC_DEVICE_ID);
- if (Status == 0) {
- print("Intc Interrupt Setup PASSED\r\n");
- }
- else {
- print("Intc Interrupt Setup FAILED\r\n");
- }
- }
-
-
- {
- u32 status;
-
- print("\r\nRunning GpioOutputExample() for LEDs_4Bits...\r\n");
-
- status = GpioOutputExample(XPAR_LEDS_4BITS_DEVICE_ID,4);
-
- if (status == 0) {
- print("GpioOutputExample PASSED.\r\n");
- }
- else {
- print("GpioOutputExample FAILED.\r\n");
- }
- }
-
-
- {
- u32 status;
-
- print("\r\nRunning GpioInputExample() for Push_Buttons_4Bits...\r\n");
-
- u32 DataRead;
-
- status = GpioInputExample(XPAR_PUSH_BUTTONS_4BITS_DEVICE_ID, &DataRead);
-
- if (status == 0) {
- xil_printf("GpioInputExample PASSED. Read data:0x%X\r\n", DataRead);
- }
- else {
- print("GpioInputExample FAILED.\r\n");
- }
- }
- {
-
- int Status;
-
- u32 DataRead;
-
- print(" Press button to Generate Interrupt\r\n");
-
- Status = GpioIntrExample(&intc, &Push_Buttons_4Bits_Gpio, \
- XPAR_PUSH_BUTTONS_4BITS_DEVICE_ID, \
- XPAR_MICROBLAZE_0_INTC_PUSH_BUTTONS_4BITS_IP2INTC_IRPT_INTR, \
- GPIO_CHANNEL1, &DataRead);
-
- if (Status == 0 ){
- if(DataRead == 0)
- print("No button pressed. \r\n");
- else
- print("Gpio Interrupt Test PASSED. \r\n");
- }
- else {
- print("Gpio Interrupt Test FAILED.\r\n");
- }
-
- }
-
- /*
- * Peripheral SelfTest will not be run for RS232_Uart_1
- * because it has been selected as the STDOUT device
- */
-
-
-
- {
- int status;
-
- print("\r\nRunning UartLiteSelfTestExample() for debug_module...\r\n");
- status = UartLiteSelfTestExample(XPAR_DEBUG_MODULE_DEVICE_ID);
- if (status == 0) {
- print("UartLiteSelfTestExample PASSED\r\n");
- }
- else {
- print("UartLiteSelfTestExample FAILED\r\n");
- }
- }
-
-
- {
- int status;
-
- print("\r\n Running TmrCtrSelfTestExample() for axi_timer_0...\r\n");
-
- status = TmrCtrSelfTestExample(XPAR_AXI_TIMER_0_DEVICE_ID, 0x0);
-
- if (status == 0) {
- print("TmrCtrSelfTestExample PASSED\r\n");
- }
- else {
- print("TmrCtrSelfTestExample FAILED\r\n");
- }
- }
- {
- int Status;
-
- print("\r\n Running Interrupt Test for axi_timer_0...\r\n");
-
- Status = TmrCtrIntrExample(&intc, &axi_timer_0_Timer, \
- XPAR_AXI_TIMER_0_DEVICE_ID, \
- XPAR_MICROBLAZE_0_INTC_AXI_TIMER_0_INTERRUPT_INTR, 0);
-
- if (Status == 0) {
- print("Timer Interrupt Test PASSED\r\n");
- }
- else {
- print("Timer Interrupt Test FAILED\r\n");
- }
-
- }
-
-
- {
- int status;
-
- print("\r\nRunning EmacLitePolledExample() for Ethernet_Lite...\r\n");
- status = EmacLitePolledExample(XPAR_ETHERNET_LITE_DEVICE_ID);
- if (status == 0) {
- print("EmacLite Polled Example PASSED\r\n");
- }
- else {
- print("EmacLite Polled Example FAILED\r\n");
- }
- }
- {
- int Status;
-
- print("\r\n Running Interrupt Test for Ethernet_Lite...\r\n");
-
- Status = EmacLiteIntrExample(&intc, &Ethernet_Lite_EmacLite, \
- XPAR_ETHERNET_LITE_DEVICE_ID, \
- XPAR_MICROBLAZE_0_INTC_ETHERNET_LITE_IP2INTC_IRPT_INTR);
-
- if (Status == 0) {
- print("EmacLite Interrupt Test PASSED\r\n");
- }
- else {
- print("EmacLite Interrupt Test FAILED\r\n");
- }
-
- }
-\r
- print("---Exiting main---\n\r");
-\r
- XCACHE_DISABLE_ICACHE();
- XCACHE_DISABLE_DCACHE();
-\r
- return 0;
-}
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: tmrctr_header.h,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef TMRCTR_HEADER_H /* prevent circular inclusions */\r
-#define TMRCTR_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber);\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: tmrctr_intr_header.h,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef TMRCTR_INTR_HEADER_H /* prevent circular inclusions */\r
-#define TMRCTR_INTR_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-\r
-int TmrCtrIntrExample(XIntc* IntcInstancePtr,\r
- XTmrCtr* InstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u8 TmrCtrNumber);\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: uartlite_header.h,v 1.1.2.2 2010/09/16 12:12:57 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2006-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-#ifndef UARTLITE_HEADER_H /* prevent circular inclusions */\r
-#define UARTLITE_HEADER_H /* by using protection macros */\r
-\r
-#include "xil_types.h"\r
-#include "xil_assert.h"\r
-#include "xstatus.h"\r
-\r
-int UartLiteSelfTestExample(u16 DeviceId);\r
-\r
-#endif\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xemaclite_example.h,v 1.1.2.1 2010/07/12 08:34:24 svemula Exp $\r
-*/\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* @file xemaclite_example.h\r
-*\r
-* Defines common data types, prototypes, and includes the proper headers\r
-* for use with the EmacLite example code residing in this directory.\r
-*\r
-* This file along with xemaclite_example_util.c are utilized with the specific\r
-* example code in the other source code files provided.\r
-*\r
-* These examples are designed to be compiled and utilized within the EDK\r
-* standalone BSP development environment. The readme file contains more\r
-* information on build requirements needed by these examples.\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -------------------------------------------------------\r
-* 2.00a ktn 04/13/09 First release\r
-* </pre>\r
-*\r
-******************************************************************************/\r
-#ifndef XEMACLITE_EXAMPLE_H\r
-#define XEMACLITE_EXAMPLE_H\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xemaclite.h"\r
-\r
-/************************** Constant Definitions ****************************/\r
-\r
-#define PHY_REG0_OFFSET 0 /* Register 0 of PHY device */\r
-#define PHY_REG1_OFFSET 1 /* Register 1 of PHY device */\r
-\r
-#define PHY_REG0_RESET_MASK 0x8000 /* Reset Phy device */\r
-#define PHY_REG0_LOOPBACK_MASK 0x4000 /* Loopback Enable in Phy */\r
-#define PHY_REG0_SPD_100_MASK 0x2000 /* Speed of 100Mbps for Phy */\r
-\r
-#define PHY_REG1_DETECT_MASK 0x1808 /* Mask to detect PHY device */\r
-\r
-#define EMACLITE_PHY_DELAY_SEC 4 /* Amount of time to delay waiting on\r
- * PHY to reset.\r
- */\r
-\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#define EMAC_DEVICE_ID XPAR_EMACLITE_0_DEVICE_ID\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-/**************************** Type Definitions ******************************/\r
-\r
-/************************** Function Prototypes *****************************/\r
-\r
-/*\r
- * Utility functions implemented in xemaclite_example_util.c\r
- */\r
-void EmacLitePhyDelay(unsigned int Seconds);\r
-u32 EmacLitePhyDetect(XEmacLite *InstancePtr);\r
-int EmacLiteEnablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress);\r
-int EmacLiteDisablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress);\r
-\r
-/************************** Variable Definitions ****************************/\r
-/*\r
- * Set up valid local MAC addresses. This loop back test uses the LocalAddress\r
- * both as a source and destination MAC address.\r
- */\r
-\r
-XEmacLite EmacLiteInstance; /* Instance of the EmacLite */\r
-\r
-/*\r
- * Buffers used for Transmission and Reception of Packets. These are declared\r
- * as global so that they are not a part of the stack.\r
- */\r
-u8 TxFrame[XEL_MAX_FRAME_SIZE];\r
-u8 RxFrame[XEL_MAX_FRAME_SIZE];\r
-\r
-volatile u32 RecvFrameLength; /* Indicates the length of the Received packet\r
- */\r
-volatile int TransmitComplete; /* Flag to indicate that the Transmission\r
- * is complete\r
- */\r
-#endif /* XTEMAC_EXAMPLE_H */\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xemaclite_example_util.c,v 1.1.2.1 2010/07/12 08:34:25 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* @file xemaclite_example_util.c\r
-*\r
-* This file implements the utility functions for the EmacLite example code.\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -------------------------------------------------------\r
-* 2.00a ktn 04/13/09 First release\r
-* 2.00a ktn 06/13/09 Changed the EmacLitePhyDetect function so that\r
-* the function is not in an infinite loop in case of a\r
-* faulty Phy device.\r
-* </pre>\r
-*\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xemaclite_example.h"\r
-#include "stdio.h"\r
-\r
-/************************** Variable Definitions ****************************/\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function detects the PHY address by looking for successful MII status\r
-* register contents (PHY register 1). It looks for a PHY that supports\r
-* auto-negotiation and 10Mbps full-duplex and half-duplex. So, this code\r
-* won't work for PHYs that don't support those features, but it's a bit more\r
-* general purpose than matching a specific PHY manufacturer ID.\r
-*\r
-* Note also that on some (older) Xilinx ML4xx boards, PHY address 0 does not\r
-* properly respond to this query. But, since the default is 0 and assuming\r
-* no other address responds, then it seems to work OK.\r
-*\r
-* @param InstancePtr is the pointer to the instance of EmacLite driver.\r
-*\r
-* @return The address of the PHY device detected (returns 0 if not\r
-* detected).\r
-*\r
-* @note\r
-* The bit mask (0x1808) of the MII status register\r
-* (PHY Register 1) used in this function are:\r
-* 0x1000: 10Mbps full duplex support.\r
-* 0x0800: 10Mbps half duplex support.\r
-* 0x0008: Auto-negotiation support.\r
-*\r
-******************************************************************************/\r
-u32 EmacLitePhyDetect(XEmacLite *InstancePtr)\r
-{\r
- u16 PhyData;\r
- int PhyAddr;\r
-\r
- /*\r
- * Verify all 32 MDIO ports.\r
- */\r
- for (PhyAddr = 31; PhyAddr >= 0; PhyAddr--) {\r
- XEmacLite_PhyRead(InstancePtr, PhyAddr, PHY_REG1_OFFSET,\r
- &PhyData);\r
-\r
- if (PhyData != 0xFFFF) {\r
- if ((PhyData & PHY_REG1_DETECT_MASK) ==\r
- PHY_REG1_DETECT_MASK) {\r
- return PhyAddr; /* Found a valid PHY device */\r
- }\r
- }\r
- }\r
- /*\r
- * Unable to detect PHY device returning the default address of 0.\r
- */\r
- return 0;\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function enables the MAC loopback on the PHY.\r
-*\r
-* @param InstancePtr is the pointer to the instance of EmacLite driver.\r
-* @param PhyAddress is the address of the Phy device.\r
-*\r
-* @return\r
-* - XST_SUCCESS if the loop back is enabled.\r
-* - XST_FAILURE if the loop back was not enabled.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int EmacLiteEnablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress)\r
-{\r
- int Status;\r
- u16 PhyData = 0;\r
-\r
- /*\r
- * Set the speed and put the PHY in reset.\r
- */\r
- PhyData |= PHY_REG0_SPD_100_MASK;\r
- Status = XEmacLite_PhyWrite(InstancePtr, PhyAddress, PHY_REG0_OFFSET,\r
- PhyData | PHY_REG0_RESET_MASK);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Give sufficient delay for Phy Reset.\r
- */\r
- EmacLitePhyDelay(EMACLITE_PHY_DELAY_SEC);\r
-\r
- /*\r
- * Set the PHY in loop back.\r
- */\r
- XEmacLite_PhyWrite(InstancePtr, PhyAddress, PHY_REG0_OFFSET,\r
- PhyData | PHY_REG0_LOOPBACK_MASK);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Give sufficient delay for Phy Loopback Enable.\r
- */\r
- EmacLitePhyDelay(1);\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function disables the MAC loopback on the PHY.\r
-*\r
-* @param InstancePtr is the pointer to the instance of EmacLite driver.\r
-* @param PhyAddress is the address of the Phy device.\r
-*\r
-* @return\r
-* - XST_SUCCESS if the loop back was disabled.\r
-* - XST_FAILURE if the loop back was not disabled.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int EmacLiteDisablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress)\r
-{\r
- int Status;\r
- u16 PhyData;\r
-\r
- /*\r
- * Disable loop back through PHY register using MDIO support.\r
- */\r
- Status = XEmacLite_PhyRead(InstancePtr, PhyAddress, PHY_REG0_OFFSET,\r
- &PhyData);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- Status = XEmacLite_PhyWrite(InstancePtr,PhyAddress, PHY_REG0_OFFSET,\r
- PhyData & ~(PHY_REG0_LOOPBACK_MASK));\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* For PPC we use a usleep call, for Microblaze we use an assembly loop that\r
-* is roughly the same regardless of optimization level, although caches and\r
-* memory access time can make the delay vary. Just keep in mind that after\r
-* resetting or updating the PHY modes, the PHY typically needs time to recover.\r
-*\r
-* @return None\r
-*\r
-* @note None\r
-*\r
-******************************************************************************/\r
-void EmacLitePhyDelay(unsigned int Seconds)\r
-{\r
-#ifdef __MICROBLAZE__\r
- static int WarningFlag = 0;\r
-\r
- /* If MB caches are disabled or do not exist, this delay loop could\r
- * take minutes instead of seconds (e.g., 30x longer). Print a warning\r
- * message for the user (once). If only MB had a built-in timer!\r
- */\r
- if (((mfmsr() & 0x20) == 0) && (!WarningFlag)) {\r
-#ifdef STDOUT_BASEADDRESS\r
- xil_printf("Warning: This example will take ");\r
- xil_printf("minutes to complete without I-cache enabled \r\n");\r
-#endif\r
- WarningFlag = 1;\r
- }\r
-\r
-#define ITERS_PER_SEC (XPAR_CPU_CORE_CLOCK_FREQ_HZ / 6)\r
- asm volatile ("\n"\r
- "1: \n\t"\r
- "addik r7, r0, %0 \n\t"\r
- "2: \n\t"\r
- "addik r7, r7, -1 \n\t"\r
- "bneid r7, 2b \n\t"\r
- "or r0, r0, r0 \n\t"\r
- "bneid %1, 1b \n\t"\r
- "addik %1, %1, -1 \n\t"\r
- :: "i"(ITERS_PER_SEC), "d" (Seconds));\r
-\r
-#else\r
-\r
- usleep(Seconds * 1000000);\r
-\r
-#endif\r
-}\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xemaclite_intr_example.c,v 1.1.2.2 2010/08/06 15:11:04 anirudh Exp $\r
-*/\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-2* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-* @file xemaclite_intr_example.c\r
-*\r
-* This file contains an example for using the EmacLite hardware and driver.\r
-* This file contains an interrupt example outlining the use of interrupts and\r
-* callbacks in the transmission/reception of an Ethernet frame of 1000 bytes of\r
-* payload.\r
-*\r
-* If the MDIO interface is NOT configured in the EmacLite core then this example\r
-* will transmit a frame.\r
-* If the MDIO interface is configured in the EmacLite core then this example\r
-* will enable the MAC loopback in the PHY device, then transmit the frame and\r
-* compare the received frame.\r
-*\r
-* @note\r
-*\r
-* None\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.01a ecm 05/21/04 First release\r
-* 1.01a sv 06/06/05 Minor changes to comply to Doxygen and coding guidelines\r
-* 1.01a sv 06/06/06 Minor changes for supporting Test App Interrupt examples\r
-* 2.00a ktn 02/25/09 Updated to use PHY loop back if MDIO is configured in\r
-* core\r
-* 3.00a ktn 10/22/09 Updated the example to use the HAL APIs/macros.\r
-* Updated example to use the macros that have been changed\r
-* in the driver to remove _m from the name of the macro.\r
-* 3.01a ktn 07/08/10 Updated example to support Little Endian MicroBlaze.\r
-*\r
-* </pre>\r
-*\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xemaclite_example.h"\r
-#include "xintc.h"\r
-#include "xil_exception.h"\r
-#include "xil_io.h"\r
-\r
-/************************** Constant Definitions *****************************/\r
-\r
-#ifndef TESTAPP_GEN\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID\r
-#define INTC_EMACLITE_ID XPAR_INTC_0_EMACLITE_0_VEC_ID\r
-#endif\r
-\r
-/*\r
- * The Size of the Test Frame.\r
- */\r
-#define EMACLITE_TEST_FRAME_SIZE 1000\r
-\r
-/**************************** Type Definitions *******************************/\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-/************************** Function Prototypes ******************************/\r
-\r
-int EmacLiteIntrExample(XIntc *IntcInstancePtr,\r
- XEmacLite *EmacLiteInstPtr,\r
- u16 EmacLiteDeviceId,\r
- u16 EmacLiteIntrId);\r
-\r
-static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr,\r
- u32 PayloadSize);\r
-static int EmacLiteRecvFrame(u32 PayloadSize);\r
-static void EmacLiteRecvHandler(void *CallBackRef);\r
-static void EmacLiteSendHandler(void *CallBackRef);\r
-static void EmacLiteDisableIntrSystem(XIntc *IntcInstancePtr,\r
- u16 EmacLiteIntrId);\r
-static int EmacLiteSetupIntrSystem(XIntc *IntcInstancePtr,\r
- XEmacLite *EmacLiteInstPtr, u16 EmacLiteIntrId);\r
-\r
-/************************** Variable Definitions *****************************/\r
-\r
-XIntc IntcInstance; /* Instance of the Interrupt Controller */\r
-\r
-/*\r
- * Set up valid local and remote MAC addresses. This loop back test uses the\r
- * LocalAddress both as a source and destination MAC address.\r
- */\r
-static u8 RemoteAddress[XEL_MAC_ADDR_SIZE] =\r
-{\r
- 0x00, 0x10, 0xa4, 0xb6, 0xfd, 0x09\r
-};\r
-static u8 LocalAddress[XEL_MAC_ADDR_SIZE] =\r
-{\r
- 0x00, 0x0A, 0x35, 0x01, 0x02, 0x03\r
-};\r
-\r
-/****************************************************************************/\r
-/**\r
-*\r
-* This function is the main function of the EmacLite interrupt example.\r
-*\r
-* @param None.\r
-*\r
-* @return XST_SUCCESS if successful, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-*****************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main()\r
-{\r
- int Status;\r
-\r
- /*\r
- * Run the EmacLite interrupt example , specify the parameters\r
- * generated in xparameters.h.\r
- */\r
- Status = EmacLiteIntrExample(&IntcInstance,\r
- &EmacLiteInstance,\r
- EMAC_DEVICE_ID,\r
- INTC_EMACLITE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-#endif\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* The main entry point for the EmacLite driver example in interrupt mode.\r
-\r
-* This function will transmit/receive the Ethernet frames and verify the\r
-* data in the received frame (if the MDIO interface is configured in the\r
-* EmacLite core).\r
-* This function simply transmits a frame if the MDIO interface is not\r
-* configured in the EmacLite core.\r
-*\r
-* @param IntcInstancePtr is a pointer to the instance of the Intc.\r
-* @param EmacLiteInstPtr is a pointer to the instance of the EmacLite.\r
-* @param EmacLiteDeviceId is device ID of the XEmacLite Device ,\r
-* typically XPAR_<EMACLITE_instance>_DEVICE_ID value from\r
-* xparameters.h.\r
-* @param EmacLiteIntrId is the interrupt ID and is typically\r
-* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID value from\r
-* xparameters.h.\r
-*\r
-* @return XST_SUCCESS if successful, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int EmacLiteIntrExample(XIntc *IntcInstancePtr,\r
- XEmacLite *EmacLiteInstPtr,\r
- u16 EmacLiteDeviceId,\r
- u16 EmacLiteIntrId)\r
-{\r
- int Status;\r
- u32 PhyAddress = 0;\r
- XEmacLite_Config *ConfigPtr;\r
-\r
- /*\r
- * Initialize the EmacLite device.\r
- */\r
- ConfigPtr = XEmacLite_LookupConfig(EmacLiteDeviceId);\r
- if (ConfigPtr == NULL) {\r
- return XST_FAILURE;\r
- }\r
- Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,\r
- ConfigPtr,\r
- ConfigPtr->BaseAddress);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Set the MAC address.\r
- */\r
- XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalAddress);\r
-\r
- /*\r
- * Empty any existing receive frames.\r
- */\r
- XEmacLite_FlushReceive(EmacLiteInstPtr);\r
-\r
-\r
- /*\r
- * Check if there is a Tx buffer available, if there isn't it is an\r
- * error.\r
- */\r
- if (XEmacLite_TxBufferAvailable(EmacLiteInstPtr) != TRUE) {\r
- return XST_FAILURE;\r
- }\r
-\r
-\r
- /*\r
- * Set up the interrupt infrastructure.\r
- */\r
- Status = EmacLiteSetupIntrSystem(IntcInstancePtr,\r
- EmacLiteInstPtr,\r
- EmacLiteIntrId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Setup the EmacLite handlers.\r
- */\r
- XEmacLite_SetRecvHandler((EmacLiteInstPtr), (void *)(EmacLiteInstPtr),\r
- (XEmacLite_Handler)EmacLiteRecvHandler);\r
- XEmacLite_SetSendHandler((EmacLiteInstPtr), (void *)(EmacLiteInstPtr),\r
- (XEmacLite_Handler)EmacLiteSendHandler);\r
-\r
-\r
- /*\r
- * Enable the interrupts in the EmacLite controller.\r
- */\r
- XEmacLite_EnableInterrupts(EmacLiteInstPtr);\r
- RecvFrameLength = 0;\r
-\r
- /*\r
- * If the MDIO is configured in the device.\r
- */\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- /*\r
- * Detect the PHY device and enable the MAC Loop back\r
- * in the PHY.\r
- */\r
- PhyAddress = EmacLitePhyDetect(EmacLiteInstPtr);\r
- Status = EmacLiteEnablePhyLoopBack(EmacLiteInstPtr,\r
- PhyAddress);\r
- if (Status != XST_SUCCESS) {\r
- XEmacLite_DisableInterrupts(EmacLiteInstPtr);\r
- EmacLiteDisableIntrSystem(IntcInstancePtr,\r
- EmacLiteIntrId);\r
- return XST_FAILURE;\r
- }\r
- }\r
-\r
- /*\r
- * Transmit an Ethernet frame.\r
- */\r
- Status = EmacLiteSendFrame(EmacLiteInstPtr,\r
- EMACLITE_TEST_FRAME_SIZE);\r
- if (Status != XST_SUCCESS) {\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- /*\r
- * Disable the MAC Loop back in the PHY and\r
- * disable/disconnect the EmacLite Interrupts.\r
- */\r
- EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,\r
- PhyAddress);\r
- XEmacLite_DisableInterrupts(EmacLiteInstPtr);\r
- EmacLiteDisableIntrSystem(IntcInstancePtr,\r
- EmacLiteIntrId);\r
- return XST_FAILURE;\r
- }\r
- }\r
-\r
- /*\r
- * Wait for the frame to be transmitted.\r
- */\r
- while (TransmitComplete == FALSE);\r
-\r
- /*\r
- * If the MDIO is not configured in the core then return XST_SUCCESS\r
- * as the frame has been transmitted.\r
- */\r
- if (!XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
-\r
- /*\r
- * Disable and disconnect the EmacLite Interrupts.\r
- */\r
- XEmacLite_DisableInterrupts(EmacLiteInstPtr);\r
- EmacLiteDisableIntrSystem(IntcInstancePtr, EmacLiteIntrId);\r
- return XST_SUCCESS;\r
- }\r
-\r
- /*\r
- * Wait for the frame to be received.\r
- */\r
- while (RecvFrameLength == 0);\r
-\r
- /*\r
- * Check the received frame.\r
- */\r
- Status = EmacLiteRecvFrame(EMACLITE_TEST_FRAME_SIZE);\r
-\r
- /*\r
- * Diasble the Loop Back.\r
- */\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- /*\r
- * Disable the MAC Loop back in the PHY.\r
- */\r
- Status |= EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,\r
- PhyAddress);\r
- }\r
-\r
- /*\r
- * Disable and disconnect the EmacLite Interrupts.\r
- */\r
- XEmacLite_DisableInterrupts(EmacLiteInstPtr);\r
- EmacLiteDisableIntrSystem(IntcInstancePtr, EmacLiteIntrId);\r
- if ((Status != XST_SUCCESS) && (Status != XST_NO_DATA)) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function sends a frame of given size. This function assumes interrupt\r
-* mode and sends the frame.\r
-*\r
-* @param EmacLiteInstPtr is a pointer to the EmacLite instance.\r
-* @param PayloadSize is the size of the frame to create. The size only\r
-* reflects the payload size, it does not include the Ethernet\r
-* header size (14 bytes) nor the Ethernet CRC size (4 bytes).\r
-*\r
-* @return XST_SUCCESS if successful, else XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr, u32 PayloadSize)\r
-{\r
- int Status;\r
- u8 *FramePtr;\r
- u32 Index;\r
-\r
- /*\r
- * Set the Complete flag to false.\r
- */\r
- TransmitComplete = FALSE;\r
-\r
- /*\r
- * Assemble the frame with a destination address and the source address.\r
- */\r
- FramePtr = (u8 *)TxFrame;\r
-\r
- /*\r
- * Set up the destination address as the local address for\r
- * Phy Loopback and Internal loopback.\r
- */\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr) ||\r
- XEmacLite_IsLoopbackConfigured(EmacLiteInstPtr)) {\r
-\r
- *FramePtr++ = LocalAddress[0];\r
- *FramePtr++ = LocalAddress[1];\r
- *FramePtr++ = LocalAddress[2];\r
- *FramePtr++ = LocalAddress[3];\r
- *FramePtr++ = LocalAddress[4];\r
- *FramePtr++ = LocalAddress[5];\r
- } else {\r
- /*\r
- * Fill in the valid Destination MAC address if\r
- * the Loopback is not enabled.\r
- */\r
- *FramePtr++ = RemoteAddress[0];\r
- *FramePtr++ = RemoteAddress[1];\r
- *FramePtr++ = RemoteAddress[2];\r
- *FramePtr++ = RemoteAddress[3];\r
- *FramePtr++ = RemoteAddress[4];\r
- *FramePtr++ = RemoteAddress[5];\r
- }\r
-\r
- /*\r
- * Fill in the source MAC address.\r
- */\r
- *FramePtr++ = LocalAddress[0];\r
- *FramePtr++ = LocalAddress[1];\r
- *FramePtr++ = LocalAddress[2];\r
- *FramePtr++ = LocalAddress[3];\r
- *FramePtr++ = LocalAddress[4];\r
- *FramePtr++ = LocalAddress[5];\r
-\r
- /*\r
- * Set up the type/length field - be sure its in network order.\r
- */\r
- *((u16 *)FramePtr) = Xil_Htons(PayloadSize);\r
- FramePtr++;\r
- FramePtr++;\r
-\r
- /*\r
- * Now fill in the data field with known values so we can verify them.\r
- */\r
- for (Index = 0; Index < PayloadSize; Index++) {\r
- *FramePtr++ = (u8)Index;\r
- }\r
-\r
- /*\r
- * Now send the frame.\r
- */\r
- Status = XEmacLite_Send(EmacLiteInstPtr, (u8 *)TxFrame,\r
- PayloadSize + XEL_HEADER_SIZE);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function receives a frame of given size. This function assumes interrupt\r
-* mode, receives the frame and verifies its contents.\r
-*\r
-* @param PayloadSize is the size of the frame to receive.\r
-* The size only reflects the payload size, it does not include the\r
-* Ethernet header size (14 bytes) nor the Ethernet CRC size (4\r
-* bytes).\r
-*\r
-* @return XST_SUCCESS if successful, a driver-specific return code if not.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static int EmacLiteRecvFrame(u32 PayloadSize)\r
-{\r
- u8 *FramePtr;\r
-\r
- /*\r
- * This assumes MAC does not strip padding or CRC.\r
- */\r
- if (RecvFrameLength != 0) {\r
- int Index;\r
-\r
- /*\r
- * Verify length, which should be the payload size.\r
- */\r
- if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=\r
- PayloadSize) {\r
- return XST_LOOPBACK_ERROR;\r
- }\r
-\r
- /*\r
- * Verify the contents of the Received Frame.\r
- */\r
- FramePtr = (u8 *)RxFrame;\r
- FramePtr += XEL_HEADER_SIZE; /* Get past the header */\r
-\r
- for (Index = 0; Index < PayloadSize; Index++) {\r
- if (*FramePtr++ != (u8)Index) {\r
- return XST_LOOPBACK_ERROR;\r
- }\r
- }\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function handles the receive callback from the EmacLite driver.\r
-*\r
-* @param CallBackRef is the call back reference provided to the Handler.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static void EmacLiteRecvHandler(void *CallBackRef)\r
-{\r
- XEmacLite *XEmacInstancePtr;\r
-\r
- /*\r
- * Convert the argument to something useful.\r
- */\r
- XEmacInstancePtr = (XEmacLite *)CallBackRef;\r
-\r
- /*\r
- * Handle the Receive callback.\r
- */\r
- RecvFrameLength = XEmacLite_Recv(XEmacInstancePtr, (u8 *)RxFrame);\r
-\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function handles the transmit callback from the EmacLite driver.\r
-*\r
-* @param CallBackRef is the call back reference provided to the Handler.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static void EmacLiteSendHandler(void *CallBackRef)\r
-{\r
- XEmacLite *XEmacInstancePtr;\r
-\r
- /*\r
- * Convert the argument to something useful.\r
- */\r
- XEmacInstancePtr = (XEmacLite *)CallBackRef;\r
-\r
- /*\r
- * Handle the Transmit callback.\r
- */\r
- TransmitComplete = TRUE;\r
-\r
-}\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function setups the interrupt system such that interrupts can occur\r
-* for the EmacLite device. This function is application specific since the\r
-* actual system may or may not have an interrupt controller. The EmacLite\r
-* could be directly connected to a processor without an interrupt controller.\r
-* The user should modify this function to fit the application.\r
-*\r
-* @param IntcInstancePtr is a pointer to the instance of the Intc.\r
-* @param EmacLiteInstPtr is a pointer to the instance of the EmacLite.\r
-* @param EmacLiteIntrId is the interrupt ID and is typically\r
-* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID\r
-* value from xparameters.h\r
-*\r
-* @return XST_SUCCESS if successful, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static int EmacLiteSetupIntrSystem(XIntc *IntcInstancePtr,\r
- XEmacLite *EmacLiteInstPtr, u16 EmacLiteIntrId)\r
-{\r
- int Status;\r
-\r
-#ifndef TESTAPP_GEN\r
- /*\r
- * Initialize the interrupt controller driver so that it is ready to\r
- * use.\r
- */\r
- Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-#endif\r
- /*\r
- * Connect a device driver handler that will be called when an interrupt\r
- * for the device occurs, the device driver handler performs the\r
- * specific interrupt processing for the device.\r
- */\r
- Status = XIntc_Connect(IntcInstancePtr,\r
- EmacLiteIntrId,\r
- XEmacLite_InterruptHandler,\r
- (void *)(EmacLiteInstPtr));\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
-#ifndef TESTAPP_GEN\r
- /*\r
- * Start the interrupt controller such that interrupts are enabled for\r
- * all devices that cause interrupts, specific real mode so that\r
- * the EmacLite can cause interrupts thru the interrupt controller.\r
- */\r
- Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-#endif\r
-\r
- /*\r
- * Enable the interrupt for the EmacLite in the Interrupt controller.\r
- */\r
- XIntc_Enable(IntcInstancePtr, EmacLiteIntrId);\r
-\r
-#ifndef TESTAPP_GEN\r
-\r
- /*\r
- * Initialize the exception table.\r
- */\r
- Xil_ExceptionInit();\r
-\r
- /*\r
- * Register the interrupt controller handler with the exception table.\r
- */\r
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,\r
- (Xil_ExceptionHandler) XIntc_InterruptHandler,\r
- IntcInstancePtr);\r
-\r
- /*\r
- * Enable non-critical exceptions.\r
- */\r
- Xil_ExceptionEnable();\r
-\r
-#endif /* TESTAPP_GEN */\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function disables the interrupts that occur for the EmacLite device.\r
-*\r
-* @param IntcInstancePtr is the pointer to the instance of the INTC\r
-* component.\r
-* @param EmacLiteIntrId is the interrupt ID and is typically\r
-* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID\r
-* value from xparameters.h.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static void EmacLiteDisableIntrSystem(XIntc *IntcInstancePtr,\r
- u16 EmacLiteIntrId)\r
-{\r
- /*\r
- * Disconnect and disable the interrupts for the EmacLite device.\r
- */\r
- XIntc_Disconnect(IntcInstancePtr, EmacLiteIntrId);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xemaclite_polled_example.c,v 1.1.2.2 2010/08/06 15:11:04 anirudh Exp $\r
-*/\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2004-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-* @file xemaclite_polled_example.c\r
-*\r
-* This file contains an example for using the EmacLite hardware and driver.\r
-* This file contains an polled mode example outlining the transmission/reception\r
-* of an Ethernet frame of 1000 bytes of payload.\r
-*\r
-* If the MDIO interface is NOT configured in the EmacLite core then this example\r
-* will only transmit a frame.\r
-* If the MDIO interface is configured in the EmacLite core then this example\r
-* will enable the MAC loopback in the PHY device, then transmit the frame and\r
-* compare the received frame.\r
-*\r
-* @note\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.01a ecm 21/05/04 First release\r
-* 1.01a sv 06/06/05 Minor changes to comply to Doxygen and coding guidelines\r
-* 2.00a ktn 02/25/09 Updated to use PHY loop back if MDIO is configured in\r
-* core and updated to be used in Test App\r
-* 3.00a ktn 10/22/09 Updated example to use the macros that have been changed\r
-* in the driver to remove _m from the name of the macro.\r
-* 3.01a ktn 07/08/10 Updated example to support Little Endian MicroBlaze.\r
-*\r
-* </pre>\r
-*\r
-*****************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xemaclite_example.h"\r
-\r
-/************************** Constant Definitions *****************************/\r
-\r
-/*\r
- * The Size of the Test Frame.\r
- */\r
-#define EMACLITE_TEST_FRAME_SIZE 1000\r
-\r
-/**************************** Type Definitions *******************************/\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-/************************** Function Prototypes ******************************/\r
-\r
-int EmacLitePolledExample(u16 DeviceId);\r
-\r
-static int EmacLiteSendFrame(XEmacLite *InstancePtr, u32 PayloadSize);\r
-\r
-static int EmacLiteRecvFrame(u32 PayloadSize);\r
-\r
-/************************** Variable Definitions *****************************/\r
-\r
-/*\r
- * Set up valid local and remote MAC addresses. This loop back test uses the\r
- * LocalAddress both as a source and destination MAC address.\r
- */\r
-static u8 LocalAddress[XEL_MAC_ADDR_SIZE] =\r
-{\r
- 0x00, 0x0A, 0x35, 0x01, 0x02, 0x03\r
-};\r
-static u8 RemoteAddress[XEL_MAC_ADDR_SIZE] =\r
-{\r
- 0x00, 0x10, 0xa4, 0xb6, 0xfd, 0x09\r
-};\r
-\r
-/****************************************************************************/\r
-/**\r
-*\r
-* This function is the main function of the EmacLite polled example.\r
-*\r
-* @param None.\r
-*\r
-* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE .\r
-*\r
-* @note None.\r
-*\r
-*****************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main()\r
-{\r
- int Status;\r
-\r
- /*\r
- * Run the EmacLite Polled example, specify the Device ID that is\r
- * generated in xparameters.h.\r
- */\r
- Status = EmacLitePolledExample(EMAC_DEVICE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-#endif\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* The main entry point for the EmacLite driver example in polled mode.\r
-*\r
-* This function will transmit/receive the Ethernet frames and verify the\r
-* data in the received frame (if the MDIO interface is configured in the\r
-* EmacLite core).\r
-* This function simply transmits a frame if the MDIO interface is not\r
-* configured in the EmacLite core.\r
-*\r
-* @param DeviceId is device ID of the XEmacLite Device , typically\r
-* XPAR_<EMAC_instance>_DEVICE_ID value from xparameters.h.\r
-*\r
-* @return XST_SUCCESS to indicate success, XST_FAILURE otherwise.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int EmacLitePolledExample(u16 DeviceId)\r
-{\r
- int Status;\r
- XEmacLite *EmacLiteInstPtr = &EmacLiteInstance;\r
- u32 PhyAddress = 0;\r
- RecvFrameLength = 0;\r
- XEmacLite_Config *ConfigPtr;\r
-\r
- /*\r
- * Initialize the EmacLite device.\r
- */\r
- ConfigPtr = XEmacLite_LookupConfig(DeviceId);\r
- if (ConfigPtr == NULL) {\r
- return XST_FAILURE;\r
- }\r
- Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,\r
- ConfigPtr,\r
- ConfigPtr->BaseAddress);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Set the MAC address.\r
- */\r
- XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalAddress);\r
-\r
- /*\r
- * Empty any existing receive frames.\r
- */\r
- XEmacLite_FlushReceive(EmacLiteInstPtr);\r
-\r
- /*\r
- * Check if there is a TX buffer available, if there isn't it is an\r
- * error.\r
- */\r
- if (XEmacLite_TxBufferAvailable(EmacLiteInstPtr) != TRUE) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * If the MDIO is configured in the device.\r
- */\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- /*\r
- * Detect the PHY device and enable the MAC Loop back\r
- * in the PHY.\r
- */\r
- PhyAddress = EmacLitePhyDetect(EmacLiteInstPtr);\r
- Status = EmacLiteEnablePhyLoopBack(EmacLiteInstPtr,\r
- PhyAddress);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
- }\r
-\r
-\r
- /*\r
- * Reset the receive frame length to zero.\r
- */\r
- RecvFrameLength = 0;\r
- Status = EmacLiteSendFrame(EmacLiteInstPtr, EMACLITE_TEST_FRAME_SIZE);\r
- if (Status != XST_SUCCESS) {\r
- if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- /*\r
- * Disable the MAC Loop back in the PHY.\r
- */\r
- EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,\r
- PhyAddress);\r
- return XST_FAILURE;\r
- }\r
- }\r
-\r
- /*\r
- * If the MDIO is not configured in the core then return XST_SUCCESS\r
- * as the frame has been transmitted.\r
- */\r
- if (!XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {\r
- return XST_SUCCESS;\r
- }\r
-\r
-\r
- /*\r
- * Poll for receive packet.\r
- */\r
- while ((volatile u32)RecvFrameLength == 0) {\r
- RecvFrameLength = XEmacLite_Recv(EmacLiteInstPtr,\r
- (u8 *)RxFrame);\r
- }\r
-\r
- /*\r
- * Check the received frame.\r
- */\r
- Status = EmacLiteRecvFrame(EMACLITE_TEST_FRAME_SIZE);\r
- if ((Status != XST_SUCCESS) && (Status != XST_NO_DATA)) {\r
- /*\r
- * Disable the MAC Loop back in the PHY.\r
- */\r
- EmacLiteDisablePhyLoopBack(EmacLiteInstPtr, PhyAddress);\r
- return XST_FAILURE;\r
- }\r
-\r
-\r
- /*\r
- * Disable the MAC Loop back in the PHY.\r
- */\r
- EmacLiteDisablePhyLoopBack(EmacLiteInstPtr, PhyAddress);\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function sends a frame of given size.\r
-*\r
-* @param XEmacInstancePtr is a pointer to the XEmacLite instance.\r
-* @param PayloadSize is the size of the frame to create. The size only\r
-* reflects the payload size, it does not include the Ethernet\r
-* header size (14 bytes) nor the Ethernet CRC size (4 bytes).\r
-*\r
-* @return XST_SUCCESS if successful, else a driver-specific return code.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static int EmacLiteSendFrame(XEmacLite *InstancePtr, u32 PayloadSize)\r
-{\r
- u8 *FramePtr;\r
- int Index;\r
- FramePtr = (u8 *)TxFrame;\r
-\r
- /*\r
- * Set up the destination address as the local address for\r
- * Phy Loopback.\r
- */\r
- if (XEmacLite_IsMdioConfigured(InstancePtr)) {\r
-\r
- *FramePtr++ = LocalAddress[0];\r
- *FramePtr++ = LocalAddress[1];\r
- *FramePtr++ = LocalAddress[2];\r
- *FramePtr++ = LocalAddress[3];\r
- *FramePtr++ = LocalAddress[4];\r
- *FramePtr++ = LocalAddress[5];\r
- } else {\r
- /*\r
- * Fill in the valid Destination MAC address if\r
- * the Loopback is not enabled.\r
- */\r
- *FramePtr++ = RemoteAddress[0];\r
- *FramePtr++ = RemoteAddress[1];\r
- *FramePtr++ = RemoteAddress[2];\r
- *FramePtr++ = RemoteAddress[3];\r
- *FramePtr++ = RemoteAddress[4];\r
- *FramePtr++ = RemoteAddress[5];\r
- }\r
-\r
- /*\r
- * Fill in the source MAC address.\r
- */\r
- *FramePtr++ = LocalAddress[0];\r
- *FramePtr++ = LocalAddress[1];\r
- *FramePtr++ = LocalAddress[2];\r
- *FramePtr++ = LocalAddress[3];\r
- *FramePtr++ = LocalAddress[4];\r
- *FramePtr++ = LocalAddress[5];\r
-\r
- /*\r
- * Set up the type/length field - be sure its in network order.\r
- */\r
- *((u16 *)FramePtr) = Xil_Htons(PayloadSize);\r
- FramePtr++;\r
- FramePtr++;\r
-\r
- /*\r
- * Now fill in the data field with known values so we can verify them\r
- * on receive.\r
- */\r
- for (Index = 0; Index < PayloadSize; Index++) {\r
- *FramePtr++ = (u8)Index;\r
- }\r
-\r
- /*\r
- * Now send the frame.\r
- */\r
- return XEmacLite_Send(InstancePtr, (u8 *)TxFrame,\r
- PayloadSize + XEL_HEADER_SIZE);\r
-\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function receives a frame of given size. This function assumes interrupt\r
-* mode, receives the frame and verifies its contents.\r
-*\r
-* @param PayloadSize is the size of the frame to receive.\r
-* The size only reflects the payload size, it does not include the\r
-* Ethernet header size (14 bytes) nor the Ethernet CRC size (4\r
-* bytes).\r
-*\r
-* @return XST_SUCCESS if successful, a driver-specific return code if not.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-static int EmacLiteRecvFrame(u32 PayloadSize)\r
-{\r
- u8 *FramePtr;\r
-\r
- /*\r
- * This assumes MAC does not strip padding or CRC.\r
- */\r
- if (RecvFrameLength != 0) {\r
- int Index;\r
-\r
- /*\r
- * Verify length, which should be the payload size.\r
- */\r
- if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=\r
- PayloadSize) {\r
- return XST_LOOPBACK_ERROR;\r
- }\r
-\r
- /*\r
- * Verify the contents of the Received Frame.\r
- */\r
- FramePtr = (u8 *)RxFrame;\r
- FramePtr += XEL_HEADER_SIZE; /* Get past the header */\r
-\r
- for (Index = 0; Index < PayloadSize; Index++) {\r
- if (*FramePtr++ != (u8)Index) {\r
- return XST_LOOPBACK_ERROR;\r
- }\r
- }\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xgpio_intr_tapp_example.c,v 1.1.2.1 2009/11/25 07:38:15 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2002-2009 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-* @file xgpio_intr_tapp_example.c\r
-*\r
-* This file contains a design example using the GPIO driver (XGpio) in an\r
-* interrupt driven mode of operation. This example does assume that there is\r
-* an interrupt controller in the hardware system and the GPIO device is\r
-* connected to the interrupt controller.\r
-*\r
-* This file is used by the TestAppGen utility to include a simplified test for\r
-* gpio interrupts.\r
-\r
-* The buttons and LEDs are on 2 seperate channels of the GPIO so that interrupts\r
-* are not caused when the LEDs are turned on and off.\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -------------------------------------------------------\r
-* 2.01a sn 05/09/06 Modified to be used by TestAppGen to include test for\r
-* interrupts.\r
-* 3.00a ktn 11/21/09 Updated to use HAL Processor APIs and minior changes\r
-* as per coding guidelines.\r
-*</pre>\r
-*\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xgpio.h"\r
-#include "xil_exception.h"\r
-#include "xintc.h"\r
-\r
-/************************** Constant Definitions *****************************/\r
-#ifndef TESTAPP_GEN\r
-/*\r
- * The following constants map to the names of the hardware instances that\r
- * were created in the EDK XPS system. They are only defined here such that\r
- * a user can easily change all the needed device IDs in one place.\r
- */\r
-#define GPIO_DEVICE_ID XPAR_PUSH_BUTTONS_5BIT_DEVICE_ID\r
-#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID\r
-#define INTC_GPIO_INTERRUPT_ID XPAR_INTC_0_GPIO_3_VEC_ID\r
-#define GPIO_CHANNEL1 1\r
-/*\r
- * The following constants define the positions of the buttons and LEDs each\r
- * channel of the GPIO\r
- */\r
-#define GPIO_ALL_LEDS 0xFFFF\r
-#define GPIO_ALL_BUTTONS 0xFFFF\r
-\r
-/*\r
- * The following constants define the GPIO channel that is used for the buttons\r
- * and the LEDs. They allow the channels to be reversed easily.\r
- */\r
-#define BUTTON_CHANNEL 1 /* Channel 1 of the GPIO Device */\r
-#define LED_CHANNEL 2 /* Channel 2 of the GPIO Device */\r
-#define BUTTON_INTERRUPT XGPIO_IR_CH1_MASK /* Channel 1 Interrupt Mask */\r
-\r
-/*\r
- * The following constant determines which buttons must be pressed at the same\r
- * time to cause interrupt processing to stop and start\r
- */\r
-#define INTERRUPT_CONTROL_VALUE 0x7\r
-\r
-/*\r
- * The following constant is used to wait after an LED is turned on to make\r
- * sure that it is visible to the human eye. This constant might need to be\r
- * tuned for faster or slower processor speeds.\r
- */\r
-#define LED_DELAY 1000000\r
-\r
-#endif\r
-\r
-#define INTR_DELAY 0x00FFFFFF\r
-\r
-\r
-/************************** Function Prototypes ******************************/\r
-void GpioDriverHandler(void *CallBackRef);\r
-\r
-int GpioIntrExample(XIntc* IntcInstancePtr, XGpio* InstancePtr,\r
- u16 DeviceId, u16 IntrId,\r
- u16 IntrMask, u32 *DataRead);\r
-\r
-int GpioSetupIntrSystem(XIntc* IntcInstancePtr, XGpio* InstancePtr,\r
- u16 DeviceId, u16 IntrId, u16 IntrMask);\r
-\r
-void GpioDisableIntr(XIntc* IntcInstancePtr, XGpio* InstancePtr,\r
- u16 IntrId, u16 IntrMask);\r
-\r
-/************************** Variable Definitions *****************************/\r
-\r
-/*\r
- * The following are declared globally so they are zeroed and so they are\r
- * easily accessible from a debugger\r
- */\r
-XGpio Gpio; /* The Instance of the GPIO Driver */\r
-\r
-XIntc Intc; /* The Instance of the Interrupt Controller Driver */\r
-\r
-\r
-static u16 GlobalIntrMask; /* GPIO channel mask that is needed by\r
- * the Interrupt Handler */\r
-\r
-static volatile u32 IntrFlag; /* Interrupt Handler Flag */\r
-\r
-/****************************************************************************/\r
-/**\r
-* This function is the main function of the GPIO example. It is responsible\r
-* for initializing the GPIO device, setting up interrupts and providing a\r
-* foreground loop such that interrupt can occur in the background.\r
-*\r
-* @param None.\r
-*\r
-* @return\r
-* - XST_SUCCESS to indicate success.\r
-* - XST_FAILURE to indicate failure.\r
-*\r
-* @note None.\r
-*\r
-*****************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
- int Status;\r
- u32 DataRead;\r
-\r
- print(" Press button to Generate Interrupt\r\n");\r
-\r
- Status = GpioIntrExample(&Intc, &Gpio,\r
- GPIO_DEVICE_ID,\r
- INTC_GPIO_INTERRUPT_ID,\r
- GPIO_CHANNEL1, &DataRead);\r
-\r
- if (Status == 0 ){\r
- if(DataRead == 0)\r
- print("No button pressed. \r\n");\r
- else\r
- print("Gpio Interrupt Test PASSED. \r\n");\r
- } else {\r
- print("Gpio Interrupt Test FAILED.\r\n");\r
- }\r
-}\r
-#endif\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This is the entry function from the TestAppGen tool generated application\r
-* which tests the interrupts when enabled in the GPIO\r
-*\r
-* @param IntcInstancePtr is a reference to the Interrupt Controller\r
-* driver Instance\r
-* @param InstancePtr is a reference to the GPIO driver Instance\r
-* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR\r
-* value from xparameters.h\r
-* @param IntrMask is the GPIO channel mask\r
-* @param DataRead is the pointer where the data read from GPIO Input is\r
-* returned\r
-*\r
-* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int GpioIntrExample(XIntc* IntcInstancePtr, XGpio* InstancePtr, u16 DeviceId,\r
- u16 IntrId, u16 IntrMask, u32 *DataRead)\r
-{\r
- int Status;\r
- u32 delay;\r
-\r
- /* Initialize the GPIO driver. If an error occurs then exit */\r
-\r
- Status = XGpio_Initialize(InstancePtr, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- Status = GpioSetupIntrSystem(IntcInstancePtr,\r
- InstancePtr,\r
- DeviceId,\r
- IntrId,\r
- IntrMask);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- IntrFlag = 0;\r
- delay = 0;\r
-\r
- while(!IntrFlag && (delay < INTR_DELAY)) {\r
- delay++;\r
- }\r
-\r
- GpioDisableIntr(IntcInstancePtr,\r
- InstancePtr,\r
- IntrId,\r
- IntrMask);\r
-\r
- *DataRead = IntrFlag;\r
-\r
- return Status;\r
-\r
-}\r
-\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function performs the GPIO set up for Interrupts\r
-*\r
-* @param IntcInstancePtr is a reference to the Interrupt Controller\r
-* driver Instance\r
-* @param InstancePtr is a reference to the GPIO driver Instance\r
-* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR\r
-* value from xparameters.h\r
-* @param IntrMask is the GPIO channel mask\r
-*\r
-* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int GpioSetupIntrSystem(XIntc* IntcInstancePtr, XGpio* InstancePtr,\r
- u16 DeviceId, u16 IntrId, u16 IntrMask)\r
-\r
-{\r
- int Result;\r
-\r
- GlobalIntrMask = IntrMask;\r
-\r
-#ifndef TESTAPP_GEN\r
- /*\r
- * Initialize the interrupt controller driver so that it's ready to use.\r
- * specify the device ID that was generated in xparameters.h\r
- */\r
- Result = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);\r
- if (Result != XST_SUCCESS) {\r
- return Result;\r
- }\r
-#endif\r
-\r
- /* Hook up simple interrupt service routine for TestApp */\r
-\r
- Result = XIntc_Connect(IntcInstancePtr, IntrId,\r
- (XInterruptHandler)GpioDriverHandler,\r
- InstancePtr);\r
-\r
- /*\r
- * Enable the GPIO channel interrupts so that push button can be detected\r
- * and enable interrupts for the GPIO device\r
- */\r
- XGpio_InterruptEnable(InstancePtr, IntrMask);\r
- XGpio_InterruptGlobalEnable(InstancePtr);\r
-\r
- /* Enable the interrupt vector at the interrupt controller */\r
- XIntc_Enable(IntcInstancePtr, IntrId);\r
-\r
-#ifndef TESTAPP_GEN\r
-\r
- /*\r
- * Initialize the exception table and register the interrupt\r
- * controller handler with the exception table\r
- */\r
- Xil_ExceptionInit();\r
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,\r
- (Xil_ExceptionHandler)XIntc_InterruptHandler,\r
- IntcInstancePtr);\r
-\r
- /* Enable non-critical exceptions */\r
- Xil_ExceptionEnable();\r
-\r
- /*\r
- * Start the interrupt controller such that interrupts are recognized\r
- * and handled by the processor\r
- */\r
- Result = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);\r
-#endif\r
-\r
- if (Result != XST_SUCCESS) {\r
- return Result;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This is the interrupt handler routine for the GPIO for this example.\r
-*\r
-* @param CallbackRef is the Callback reference for the handler.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-void GpioDriverHandler(void *CallbackRef)\r
-{\r
- XGpio *GpioPtr = (XGpio *)CallbackRef;\r
-\r
- IntrFlag = 1;\r
- /*\r
- * Clear the Interrupt\r
- */\r
- XGpio_InterruptClear(GpioPtr, GlobalIntrMask);\r
-\r
-}\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function disables the interrupts for the GPIO\r
-*\r
-* @param IntcInstancePtr is a pointer to the Interrupt Controller\r
-* driver Instance\r
-* @param InstancePtr is a pointer to the GPIO driver Instance\r
-* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR\r
-* value from xparameters.h\r
-* @param IntrMask is the GPIO channel mask\r
-*\r
-* @return None\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-void GpioDisableIntr(XIntc* IntcInstancePtr, XGpio* InstancePtr,\r
- u16 IntrId, u16 IntrMask)\r
-{\r
- XGpio_InterruptDisable(InstancePtr, IntrMask);\r
- XIntc_Disable(IntcInstancePtr, IntrId);\r
- return;\r
-}\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xgpio_tapp_example.c,v 1.1.2.1 2009/11/25 07:38:15 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2005-2009 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-\r
-/*****************************************************************************/\r
-/**\r
-* @file xgpio_tapp_example.c\r
-*\r
-* This file contains a example for using GPIO hardware and driver.\r
-* This example assumes that there is a UART Device or STDIO Device in the\r
-* hardware system.\r
-*\r
-* This example can be run on the Xilinx ML300 board using the Prototype Pins &\r
-* LEDs of the board connected to the GPIO and the Push Buttons connected.\r
-*\r
-* @note\r
-*\r
-* None\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.00a sv 04/15/05 Initial release for TestApp integration.\r
-* 3.00a sv 11/21/09 Updated to use HAL Processor APIs.\r
-* </pre>\r
-*\r
-*****************************************************************************/\r
-\r
-/***************************** Include Files ********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xgpio.h"\r
-#include "stdio.h"\r
-#include "xstatus.h"\r
-\r
-/************************** Constant Definitions ****************************/\r
-\r
-/*\r
- * The following constant is used to wait after an LED is turned on to make\r
- * sure that it is visible to the human eye. This constant might need to be\r
- * tuned for faster or slower processor speeds.\r
- */\r
-#define LED_DELAY 1000000\r
-\r
-/* following constant is used to determine which channel of the GPIO is\r
- * used if there are 2 channels supported in the GPIO.\r
- */\r
-#define LED_CHANNEL 1\r
-\r
-#define LED_MAX_BLINK 0x1 /* Number of times the LED Blinks */\r
-\r
-#define GPIO_BITWIDTH 16 /* This is the width of the GPIO */\r
-\r
-#define printf xil_printf /* A smaller footprint printf */\r
-\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#ifndef TESTAPP_GEN\r
-#define GPIO_OUTPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID\r
-#define GPIO_INPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID\r
-#endif /* TESTAPP_GEN */\r
-\r
-/**************************** Type Definitions ******************************/\r
-\r
-\r
-/***************** Macros (Inline Functions) Definitions *******************/\r
-\r
-\r
-/************************** Function Prototypes ****************************/\r
-\r
-int GpioOutputExample(u16 DeviceId, u32 GpioWidth);\r
-\r
-int GpioInputExample(u16 DeviceId, u32 *DataRead);\r
-\r
-void GpioDriverHandler(void *CallBackRef);\r
-\r
-\r
-/************************** Variable Definitions **************************/\r
-\r
-/*\r
- * The following are declared globally so they are zeroed and so they are\r
- * easily accessible from a debugger\r
- */\r
-XGpio GpioOutput; /* The driver instance for GPIO Device configured as O/P */\r
-XGpio GpioInput; /* The driver instance for GPIO Device configured as I/P */\r
-\r
-/*****************************************************************************/\r
-/**\r
-* Main function to call the example.This function is not included if the\r
-* example is generated from the TestAppGen test tool.\r
-*\r
-* @param None\r
-*\r
-* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful\r
-*\r
-* @note None\r
-*\r
-******************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
- int Status;\r
- u32 InputData;\r
-\r
- Status = GpioOutputExample(GPIO_OUTPUT_DEVICE_ID, GPIO_BITWIDTH);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- Status = GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- printf("Data read from GPIO Input is 0x%x \n", (int)InputData);\r
-\r
- return XST_SUCCESS;\r
-}\r
-#endif\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function does a minimal test on the GPIO device configured as OUTPUT\r
-* and driver as a example.\r
-*\r
-*\r
-* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param GpioWidth is the width of the GPIO\r
-*\r
-* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful\r
-*\r
-* @note None\r
-*\r
-****************************************************************************/\r
-int GpioOutputExample(u16 DeviceId, u32 GpioWidth)\r
-{\r
- u32 Data;\r
- volatile int Delay;\r
- u32 LedBit;\r
- u32 LedLoop;\r
- int Status;\r
-\r
- /*\r
- * Initialize the GPIO driver so that it's ready to use,\r
- * specify the device ID that is generated in xparameters.h\r
- */\r
- Status = XGpio_Initialize(&GpioOutput, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
-\r
- /*\r
- * Set the direction for all signals to be outputs\r
- */\r
- XGpio_SetDataDirection(&GpioOutput, LED_CHANNEL, 0x0);\r
-\r
- /*\r
- * Set the GPIO outputs to low\r
- */\r
- XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 0x0);\r
-\r
- for (LedBit = 0x0; LedBit < GpioWidth; LedBit++) {\r
-\r
- for (LedLoop = 0; LedLoop < LED_MAX_BLINK; LedLoop++) {\r
-\r
- /*\r
- * Set the GPIO Output to High\r
- */\r
- XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL,\r
- 1 << LedBit);\r
-\r
-#ifndef __SIM__\r
- /*\r
- * Wait a small amount of time so the LED is visible\r
- */\r
- for (Delay = 0; Delay < LED_DELAY; Delay++);\r
-\r
-#endif\r
- /*\r
- * Clear the GPIO Output\r
- */\r
- XGpio_DiscreteClear(&GpioOutput, LED_CHANNEL,\r
- 1 << LedBit);\r
-\r
-\r
-#ifndef __SIM__\r
- /*\r
- * Wait a small amount of time so the LED is visible\r
- */\r
- for (Delay = 0; Delay < LED_DELAY; Delay++);\r
-#endif\r
-\r
- }\r
-\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function performs a test on the GPIO driver/device with the GPIO\r
-* configured as INPUT\r
-*\r
-* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param DataRead is the pointer where the data read from GPIO Input is\r
-* returned\r
-*\r
-* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int GpioInputExample(u16 DeviceId, u32 *DataRead)\r
-{\r
- int Status;\r
-\r
- /*\r
- * Initialize the GPIO driver so that it's ready to use,\r
- * specify the device ID that is generated in xparameters.h\r
- */\r
- Status = XGpio_Initialize(&GpioInput, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Set the direction for all signals to be inputs\r
- */\r
- XGpio_SetDataDirection(&GpioInput, LED_CHANNEL, 0xFFFFFFFF);\r
-\r
- /*\r
- * Read the state of the data so that it can be verified\r
- */\r
- *DataRead = XGpio_DiscreteRead(&GpioInput, LED_CHANNEL);\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-\r
-/* $Id: xintc_tapp_example.c,v 1.1.4.1 2010/09/17 05:32:46 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2002-2009 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/******************************************************************************/\r
-/**\r
-*\r
-* @file xintc_tapp_example.c\r
-*\r
-* This file contains a self test example using the Interrupt Controller driver\r
-* (XIntc) and hardware device. Please reference other device driver examples to\r
-* see more examples of how the Intc and interrupts can be used by a software\r
-* application.\r
-*\r
-* This example shows the use of the Interrupt Controller both with a PowerPC405\r
-* and MicroBlaze processor.\r
-*\r
-* The TestApp Gen utility uses this file to perform the self test and setup\r
-* of Intc for interrupts.\r
-*\r
-* @note\r
-*\r
-* None\r
-*\r
-* <pre>\r
-*\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- --------------------------------------------------------\r
-* 1.00a sv 06/29/05 Created for Test App Integration\r
-* 1.00c sn 05/09/06 Added Interrupt Setup Function\r
-* 2.00a ktn 10/20/09 Updated to use HAL Processor APIs and minor changes as\r
-* per coding guidelines.\r
-* </pre>\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xstatus.h"\r
-#include "xintc.h"\r
-#include "xil_exception.h"\r
-\r
-\r
-/************************** Constant Definitions *****************************/\r
-\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place. This definition is not\r
- * included if the example is generated from the TestAppGen test tool.\r
- */\r
-#ifndef TESTAPP_GEN\r
-#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID\r
-#endif\r
-\r
-/**************************** Type Definitions *******************************/\r
-\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-\r
-/************************** Function Prototypes ******************************/\r
-\r
-int IntcSelfTestExample(u16 DeviceId);\r
-int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId);\r
-\r
-/************************** Variable Definitions *****************************/\r
-\r
-static XIntc InterruptController; /* Instance of the Interrupt Controller */\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This is the main function for the Interrupt Controller example. This\r
-* function is not included if the example is generated from the TestAppGen test\r
-* tool.\r
-*\r
-* @param None.\r
-*\r
-* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
- int Status;\r
-\r
- /*\r
- * Run the Intc example , specify the Device ID generated in\r
- * xparameters.h.\r
- */\r
- Status = IntcSelfTestExample(INTC_DEVICE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-#endif\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function runs a self-test on the driver/device. This is a destructive\r
-* test. This function is an example of how to use the interrupt controller\r
-* driver component (XIntc) and the hardware device. This function is designed\r
-* to work without any hardware devices to cause interrupts. It may not return\r
-* if the interrupt controller is not properly connected to the processor in\r
-* either software or hardware.\r
-*\r
-* This function relies on the fact that the interrupt controller hardware\r
-* has come out of the reset state such that it will allow interrupts to be\r
-* simulated by the software.\r
-*\r
-* @param DeviceId is device ID of the Interrupt Controller Device,\r
-* typically XPAR_<INTC_instance>_DEVICE_ID value from\r
-* xparameters.h.\r
-*\r
-* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int IntcSelfTestExample(u16 DeviceId)\r
-{\r
- int Status;\r
-\r
- /*\r
- * Initialize the interrupt controller driver so that it is ready to use.\r
- */\r
- Status = XIntc_Initialize(&InterruptController, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
-\r
- /*\r
- * Perform a self-test to ensure that the hardware was built correctly.\r
- */\r
- Status = XIntc_SelfTest(&InterruptController);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function is used by the TestAppGen generated application to setup\r
-* the interrupt controller.\r
-*\r
-* @param IntcInstancePtr is the reference to the Interrupt Controller\r
-* instance.\r
-* @param DeviceId is device ID of the Interrupt Controller Device,\r
-* typically XPAR_<INTC_instance>_DEVICE_ID value from\r
-* xparameters.h.\r
-*\r
-* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId)\r
-{\r
-\r
- int Status;\r
-\r
- /*\r
- * Initialize the interrupt controller driver so that it is\r
- * ready to use.\r
- */\r
- Status = XIntc_Initialize(IntcInstancePtr, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Perform a self-test to ensure that the hardware was built correctly.\r
- */\r
- Status = XIntc_SelfTest(IntcInstancePtr);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Initialize the exception table.\r
- */\r
- Xil_ExceptionInit();\r
-\r
- /*\r
- * Register the interrupt controller handler with the exception table.\r
- */\r
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,\r
- (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler,\r
- (void*) 0);\r
-\r
- /*\r
- * Enable exceptions.\r
- */\r
- Xil_ExceptionEnable();\r
-\r
- /*\r
- * Start the interrupt controller such that interrupts are enabled for\r
- * all devices that cause interrupts.\r
- */\r
- Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xtmrctr_intr_example.c,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2002-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-* @file xtmrctr_intr_example.c\r
-*\r
-* This file contains a design example using the timer counter driver\r
-* (XTmCtr) and hardware device using interrupt mode.This example assumes\r
-* that the interrupt controller is also present as a part of the system\r
-*\r
-* This file can be used as a standalone example or by the TestAppGen utility\r
-* to include a test for Timer interrupts.\r
-*\r
-*\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.00b jhl 02/13/02 First release\r
-* 1.00b sv 04/26/05 Minor changes to comply to Doxygen and coding guidelines\r
-* 1.00b sn 05/09/06 Modified to be used by TestAppGen to include test for\r
-* interrupts.\r
-* 2.00a ktn 10/30/09 Updated to use HAL API's and minor changes as per coding\r
-* guidelines.\r
-*</pre>\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xtmrctr.h"\r
-#include "xintc.h"\r
-#include "xil_exception.h"\r
-\r
-/************************** Constant Definitions *****************************/\r
-#ifndef TESTAPP_GEN\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are only defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#define TMRCTR_DEVICE_ID XPAR_TMRCTR_0_DEVICE_ID\r
-#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID\r
-#define TMRCTR_INTERRUPT_ID XPAR_INTC_0_TMRCTR_0_VEC_ID\r
-\r
-/*\r
- * The following constant determines which timer counter of the device that is\r
- * used for this example, there are currently 2 timer counters in a device\r
- * and this example uses the first one, 0, the timer numbers are 0 based\r
- */\r
-#define TIMER_CNTR_0 0\r
-\r
-#endif\r
-/*\r
- * The following constant is used to set the reset value of the timer counter,\r
- * making this number larger reduces the amount of time this example consumes\r
- * because it is the value the timer counter is loaded with when it is started\r
- */\r
-#define RESET_VALUE 0xF0000000\r
-\r
-\r
-\r
-/**************************** Type Definitions *******************************/\r
-\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-\r
-/************************** Function Prototypes ******************************/\r
-\r
-int TmrCtrIntrExample(XIntc* IntcInstancePtr,\r
- XTmrCtr* InstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u8 TmrCtrNumber);\r
-\r
-static int TmrCtrSetupIntrSystem(XIntc* IntcInstancePtr,\r
- XTmrCtr* InstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u8 TmrCtrNumber);\r
-\r
-void TimerCounterHandler(void *CallBackRef, u8 TmrCtrNumber);\r
-\r
-void TmrCtrDisableIntr(XIntc* IntcInstancePtr, u16 IntrId);\r
-\r
-/************************** Variable Definitions *****************************/\r
-#ifndef TESTAPP_GEN\r
-XIntc InterruptController; /* The instance of the Interrupt Controller */\r
-\r
-XTmrCtr TimerCounterInst; /* The instance of the Timer Counter */\r
-#endif\r
-/*\r
- * The following variables are shared between non-interrupt processing and\r
- * interrupt processing such that they must be global.\r
- */\r
-volatile int TimerExpired;\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-* This function is the main function of the Tmrctr example using Interrupts.\r
-*\r
-* @param None.\r
-*\r
-* @return XST_SUCCESS to indicate success, else XST_FAILURE to indicate a\r
-* Failure.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
-\r
- int Status;\r
-\r
- /*\r
- * Run the Timer Counter - Interrupt example.\r
- */\r
- Status = TmrCtrIntrExample(&InterruptController,\r
- &TimerCounterInst,\r
- TMRCTR_DEVICE_ID,\r
- TMRCTR_INTERRUPT_ID,\r
- TIMER_CNTR_0);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-#endif\r
-\r
-/*****************************************************************************/\r
-/**\r
-* This function does a minimal test on the timer counter device and driver as a\r
-* design example. The purpose of this function is to illustrate how to use the\r
-* XTmrCtr component. It initializes a timer counter and then sets it up in\r
-* compare mode with auto reload such that a periodic interrupt is generated.\r
-*\r
-* This function uses interrupt driven mode of the timer counter.\r
-*\r
-* @param IntcInstancePtr is a pointer to the Interrupt Controller\r
-* driver Instance\r
-* @param TmrCtrInstancePtr is a pointer to the XTmrCtr driver Instance\r
-* @param DeviceId is the XPAR_<TmrCtr_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param IntrId is XPAR_<INTC_instance>_<TmrCtr_instance>_INTERRUPT_INTR\r
-* value from xparameters.h\r
-* @param TmrCtrNumber is the number of the timer to which this\r
-* handler is associated with.\r
-*\r
-* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE\r
-*\r
-* @note This function contains an infinite loop such that if interrupts\r
-* are not working it may never return.\r
-*\r
-*****************************************************************************/\r
-int TmrCtrIntrExample(XIntc* IntcInstancePtr,\r
- XTmrCtr* TmrCtrInstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u8 TmrCtrNumber)\r
-{\r
- int Status;\r
- int LastTimerExpired = 0;\r
-\r
- /*\r
- * Initialize the timer counter so that it's ready to use,\r
- * specify the device ID that is generated in xparameters.h\r
- */\r
- Status = XTmrCtr_Initialize(TmrCtrInstancePtr, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Perform a self-test to ensure that the hardware was built\r
- * correctly, use the 1st timer in the device (0)\r
- */\r
- Status = XTmrCtr_SelfTest(TmrCtrInstancePtr, TmrCtrNumber);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Connect the timer counter to the interrupt subsystem such that\r
- * interrupts can occur. This function is application specific.\r
- */\r
- Status = TmrCtrSetupIntrSystem(IntcInstancePtr,\r
- TmrCtrInstancePtr,\r
- DeviceId,\r
- IntrId,\r
- TmrCtrNumber);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Setup the handler for the timer counter that will be called from the\r
- * interrupt context when the timer expires, specify a pointer to the\r
- * timer counter driver instance as the callback reference so the handler\r
- * is able to access the instance data\r
- */\r
- XTmrCtr_SetHandler(TmrCtrInstancePtr, TimerCounterHandler,\r
- TmrCtrInstancePtr);\r
-\r
- /*\r
- * Enable the interrupt of the timer counter so interrupts will occur\r
- * and use auto reload mode such that the timer counter will reload\r
- * itself automatically and continue repeatedly, without this option\r
- * it would expire once only\r
- */\r
- XTmrCtr_SetOptions(TmrCtrInstancePtr, TmrCtrNumber,\r
- XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION);\r
-\r
- /*\r
- * Set a reset value for the timer counter such that it will expire\r
- * eariler than letting it roll over from 0, the reset value is loaded\r
- * into the timer counter when it is started\r
- */\r
- XTmrCtr_SetResetValue(TmrCtrInstancePtr, TmrCtrNumber, RESET_VALUE);\r
-\r
- /*\r
- * Start the timer counter such that it's incrementing by default,\r
- * then wait for it to timeout a number of times\r
- */\r
- XTmrCtr_Start(TmrCtrInstancePtr, TmrCtrNumber);\r
-\r
- while (1) {\r
- /*\r
- * Wait for the first timer counter to expire as indicated by the\r
- * shared variable which the handler will increment\r
- */\r
- while (TimerExpired == LastTimerExpired) {\r
- }\r
- LastTimerExpired = TimerExpired;\r
-\r
- /*\r
- * If it has expired a number of times, then stop the timer counter\r
- * and stop this example\r
- */\r
- if (TimerExpired == 3) {\r
-\r
- XTmrCtr_Stop(TmrCtrInstancePtr, TmrCtrNumber);\r
- break;\r
- }\r
- }\r
-\r
- TmrCtrDisableIntr(IntcInstancePtr, DeviceId);\r
- return XST_SUCCESS;\r
-}\r
-\r
-/*****************************************************************************/\r
-/**\r
-* This function is the handler which performs processing for the timer counter.\r
-* It is called from an interrupt context such that the amount of processing\r
-* performed should be minimized. It is called when the timer counter expires\r
-* if interrupts are enabled.\r
-*\r
-* This handler provides an example of how to handle timer counter interrupts\r
-* but is application specific.\r
-*\r
-* @param CallBackRef is a pointer to the callback function\r
-* @param TmrCtrNumber is the number of the timer to which this\r
-* handler is associated with.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-void TimerCounterHandler(void *CallBackRef, u8 TmrCtrNumber)\r
-{\r
- XTmrCtr *InstancePtr = (XTmrCtr *)CallBackRef;\r
-\r
- /*\r
- * Check if the timer counter has expired, checking is not necessary\r
- * since that's the reason this function is executed, this just shows\r
- * how the callback reference can be used as a pointer to the instance\r
- * of the timer counter that expired, increment a shared variable so\r
- * the main thread of execution can see the timer expired\r
- */\r
- if (XTmrCtr_IsExpired(InstancePtr, TmrCtrNumber)) {\r
- TimerExpired++;\r
- if(TimerExpired == 3) {\r
- XTmrCtr_SetOptions(InstancePtr, TmrCtrNumber, 0);\r
- }\r
- }\r
-}\r
-\r
-/*****************************************************************************/\r
-/**\r
-* This function setups the interrupt system such that interrupts can occur\r
-* for the timer counter. This function is application specific since the actual\r
-* system may or may not have an interrupt controller. The timer counter could\r
-* be directly connected to a processor without an interrupt controller. The\r
-* user should modify this function to fit the application.\r
-*\r
-* @param IntcInstancePtr is a pointer to the Interrupt Controller\r
-* driver Instance.\r
-* @param TmrCtrInstancePtr is a pointer to the XTmrCtr driver Instance.\r
-* @param DeviceId is the XPAR_<TmrCtr_instance>_DEVICE_ID value from\r
-* xparameters.h.\r
-* @param IntrId is XPAR_<INTC_instance>_<TmrCtr_instance>_VEC_ID\r
-* value from xparameters.h.\r
-* @param TmrCtrNumber is the number of the timer to which this\r
-* handler is associated with.\r
-*\r
-* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE.\r
-*\r
-* @note This function contains an infinite loop such that if interrupts\r
-* are not working it may never return.\r
-*\r
-******************************************************************************/\r
-static int TmrCtrSetupIntrSystem(XIntc* IntcInstancePtr,\r
- XTmrCtr* TmrCtrInstancePtr,\r
- u16 DeviceId,\r
- u16 IntrId,\r
- u8 TmrCtrNumber)\r
-{\r
- int Status;\r
-\r
- #ifndef TESTAPP_GEN\r
- /*\r
- * Initialize the interrupt controller driver so that\r
- * it's ready to use, specify the device ID that is generated in\r
- * xparameters.h\r
- */\r
- Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-#endif\r
- /*\r
- * Connect a device driver handler that will be called when an interrupt\r
- * for the device occurs, the device driver handler performs the specific\r
- * interrupt processing for the device\r
- */\r
- Status = XIntc_Connect(IntcInstancePtr, IntrId,\r
- (XInterruptHandler)XTmrCtr_InterruptHandler,\r
- (void *)TmrCtrInstancePtr);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
-#ifndef TESTAPP_GEN\r
- /*\r
- * Start the interrupt controller such that interrupts are enabled for\r
- * all devices that cause interrupts, specific real mode so that\r
- * the timer counter can cause interrupts thru the interrupt controller.\r
- */\r
- Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-#endif\r
-\r
- /*\r
- * Enable the interrupt for the timer counter\r
- */\r
- XIntc_Enable(IntcInstancePtr, IntrId);\r
-\r
-#ifndef TESTAPP_GEN\r
- /*\r
- * Initialize the exception table.\r
- */\r
- Xil_ExceptionInit();\r
-\r
- /*\r
- * Register the interrupt controller handler with the exception table.\r
- */\r
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,\r
- (Xil_ExceptionHandler)\r
- XIntc_InterruptHandler,\r
- IntcInstancePtr);\r
-\r
- /*\r
- * Enable non-critical exceptions.\r
- */\r
- Xil_ExceptionEnable();\r
-\r
-#endif\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r
-/******************************************************************************/\r
-/**\r
-*\r
-* This function disables the interrupts for the Timer.\r
-*\r
-* @param IntcInstancePtr is a reference to the Interrupt Controller\r
-* driver Instance.\r
-* @param IntrId is XPAR_<INTC_instance>_<Timer_instance>_VEC_ID\r
-* value from xparameters.h.\r
-*\r
-* @return None.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-void TmrCtrDisableIntr(XIntc* IntcInstancePtr, u16 IntrId)\r
-{\r
- /*\r
- * Disable the interrupt for the timer counter\r
- */\r
- XIntc_Disable(IntcInstancePtr, IntrId);\r
-\r
- return;\r
-}\r
-\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xtmrctr_selftest_example.c,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2002-2010 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/*****************************************************************************/\r
-/**\r
-* @file xtmrctr_selftest_example.c\r
-*\r
-* This file contains a example for using the Timer Counter hardware and\r
-* driver\r
-*\r
-* @note\r
-*\r
-* None\r
-*\r
-* <pre>\r
-* MODIFICATION HISTORY:\r
-*\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.00a sv 04/25/05 Initial release for TestApp integration.\r
-* 2.00a ktn 11/26/09 Minor changes as per coding guidelines.\r
-* </pre>\r
-*\r
-*****************************************************************************/\r
-\r
-/***************************** Include Files ********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xtmrctr.h"\r
-\r
-\r
-/************************** Constant Definitions ****************************/\r
-\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#define TMRCTR_DEVICE_ID XPAR_TMRCTR_0_DEVICE_ID\r
-\r
-/*\r
- * This example only uses the 1st of the 2 timer counters contained in a\r
- * single timer counter hardware device\r
- */\r
-#define TIMER_COUNTER_0 0\r
-\r
-/**************************** Type Definitions ******************************/\r
-\r
-\r
-/***************** Macros (Inline Functions) Definitions *******************/\r
-\r
-\r
-/************************** Function Prototypes ****************************/\r
-\r
-int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber);\r
-\r
-/************************** Variable Definitions **************************/\r
-\r
-XTmrCtr TimerCounter; /* The instance of the timer counter */\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-* Main function to call the example. This function is not included if the\r
-* example is generated from the TestAppGen test tool.\r
-*\r
-* @param None\r
-*\r
-* @return XST_SUCCESS to indicate success, else XST_FAILURE to indicate\r
-* a Failure.\r
-*\r
-* @note None\r
-*\r
-******************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
- int Status;\r
-\r
- Status = TmrCtrSelfTestExample(TMRCTR_DEVICE_ID, TIMER_COUNTER_0);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-#endif\r
-\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function does a minimal test on the TmrCtr device and driver as a\r
-* design example. The purpose of this function is to illustrate\r
-* how to use the XTmrCtr component.\r
-*\r
-*\r
-* @param DeviceId is the XPAR_<TMRCTR_instance>_DEVICE_ID value from\r
-* xparameters.h\r
-* @param TmrCtrNumber is the timer counter of the device to operate on.\r
-* Each device may contain multiple timer counters.\r
-* The timer number is a zero based number with a range of\r
-* 0 - (XTC_DEVICE_TIMER_COUNT - 1).\r
-*\r
-* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful\r
-*\r
-* @note None\r
-*\r
-****************************************************************************/\r
-int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber)\r
-{\r
- int Status;\r
- XTmrCtr *TmrCtrInstancePtr = &TimerCounter;\r
-\r
- /*\r
- * Initialize the TmrCtr driver so that it iss ready to use\r
- */\r
- Status = XTmrCtr_Initialize(TmrCtrInstancePtr, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Perform a self-test to ensure that the hardware was built\r
- * correctly, use the 1st timer in the device (0)\r
- */\r
- Status = XTmrCtr_SelfTest(TmrCtrInstancePtr, TmrCtrNumber);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
+++ /dev/null
-#define TESTAPP_GEN
-\r
-/* $Id: xuartlite_selftest_example.c,v 1.1.2.1 2009/11/24 05:14:25 svemula Exp $ */\r
-/******************************************************************************\r
-*\r
-* (c) Copyright 2005-2009 Xilinx, Inc. All rights reserved.\r
-*\r
-* This file contains confidential and proprietary information of Xilinx, Inc.\r
-* and is protected under U.S. and international copyright and other\r
-* intellectual property laws.\r
-*\r
-* DISCLAIMER\r
-* This disclaimer is not a license and does not grant any rights to the\r
-* materials distributed herewith. Except as otherwise provided in a valid\r
-* license issued to you by Xilinx, and to the maximum extent permitted by\r
-* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL\r
-* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,\r
-* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF\r
-* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;\r
-* and (2) Xilinx shall not be liable (whether in contract or tort, including\r
-* negligence, or under any other theory of liability) for any loss or damage\r
-* of any kind or nature related to, arising under or in connection with these\r
-* materials, including for any direct, or any indirect, special, incidental,\r
-* or consequential loss or damage (including loss of data, profits, goodwill,\r
-* or any type of loss or damage suffered as a result of any action brought by\r
-* a third party) even if such damage or loss was reasonably foreseeable or\r
-* Xilinx had been advised of the possibility of the same.\r
-*\r
-* CRITICAL APPLICATIONS\r
-* Xilinx products are not designed or intended to be fail-safe, or for use in\r
-* any application requiring fail-safe performance, such as life-support or\r
-* safety devices or systems, Class III medical devices, nuclear facilities,\r
-* applications related to the deployment of airbags, or any other applications\r
-* that could lead to death, personal injury, or severe property or\r
-* environmental damage (individually and collectively, "Critical\r
-* Applications"). Customer assumes the sole risk and liability of any use of\r
-* Xilinx products in Critical Applications, subject only to applicable laws\r
-* and regulations governing limitations on product liability.\r
-*\r
-* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE\r
-* AT ALL TIMES.\r
-*\r
-******************************************************************************/\r
-/****************************************************************************/\r
-/**\r
-*\r
-* @file xuartlite_selftest_example.c\r
-*\r
-* This file contains a design example using the UartLite driver (XUartLite) and\r
-* hardware device.\r
-*\r
-* @note\r
-*\r
-* None\r
-*\r
-* MODIFICATION HISTORY:\r
-* <pre>\r
-* Ver Who Date Changes\r
-* ----- ---- -------- -----------------------------------------------\r
-* 1.00a ecm 01/25/04 First Release.\r
-* 1.00a sv 06/13/05 Minor changes to comply to Doxygen and Coding guidelines\r
-* 2.00a ktn 10/20/09 Minor changes as per coding guidelines.\r
-* </pre>\r
-******************************************************************************/\r
-\r
-/***************************** Include Files *********************************/\r
-\r
-#include "xparameters.h"\r
-#include "xuartlite.h"\r
-\r
-/************************** Constant Definitions *****************************/\r
-\r
-/*\r
- * The following constants map to the XPAR parameters created in the\r
- * xparameters.h file. They are defined here such that a user can easily\r
- * change all the needed parameters in one place.\r
- */\r
-#define UARTLITE_DEVICE_ID XPAR_UARTLITE_0_DEVICE_ID\r
-\r
-\r
-/**************************** Type Definitions *******************************/\r
-\r
-\r
-/***************** Macros (Inline Functions) Definitions *********************/\r
-\r
-\r
-/************************** Function Prototypes ******************************/\r
-\r
-int UartLiteSelfTestExample(u16 DeviceId);\r
-\r
-/************************** Variable Definitions *****************************/\r
-\r
-XUartLite UartLite; /* Instance of the UartLite device */\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* Main function to call the example. This function is not included if the\r
-* example is generated from the TestAppGen test tool.\r
-*\r
-* @param None.\r
-*\r
-* @return XST_SUCCESS if successful, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-******************************************************************************/\r
-#ifndef TESTAPP_GEN\r
-int main(void)\r
-{\r
- int Status;\r
-\r
- /*\r
- * Run the UartLite self test example, specify the Device ID that is\r
- * generated in xparameters.h\r
- */\r
- Status = UartLiteSelfTestExample(UARTLITE_DEVICE_ID);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-\r
-}\r
-#endif\r
-\r
-/*****************************************************************************/\r
-/**\r
-*\r
-* This function does a minimal test on the UartLite device and driver as a\r
-* design example. The purpose of this function is to illustrate\r
-* how to use the XUartLite component.\r
-*\r
-*\r
-* @param DeviceId is the XPAR_<uartlite_instance>_DEVICE_ID value from\r
-* xparameters.h.\r
-*\r
-* @return XST_SUCCESS if successful, otherwise XST_FAILURE.\r
-*\r
-* @note None.\r
-*\r
-****************************************************************************/\r
-int UartLiteSelfTestExample(u16 DeviceId)\r
-{\r
- int Status;\r
-\r
- /*\r
- * Initialize the UartLite driver so that it is ready to use.\r
- */\r
- Status = XUartLite_Initialize(&UartLite, DeviceId);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- /*\r
- * Perform a self-test to ensure that the hardware was built correctly.\r
- */\r
- Status = XUartLite_SelfTest(&UartLite);\r
- if (Status != XST_SUCCESS) {\r
- return XST_FAILURE;\r
- }\r
-\r
- return XST_SUCCESS;\r
-}\r
-\r
-\r