mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Create project directory structure for the MicroBlaze demo project that uses the full Ethernet IP (rather than the Ethernet Lite IP).
This commit is contained in:
parent
74eedea5db
commit
e9e8365c8f
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>HardwareWithEthernet</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.xilinx.sdk.hw.HwProject</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
Binary file not shown.
9646
Demo/MicroBlaze_Spartan-6_Ethernet/HardwareWithEthernet/system.xml
Normal file
9646
Demo/MicroBlaze_Spartan-6_Ethernet/HardwareWithEthernet/system.xml
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,104 @@
|
|||
// BMM LOC annotation file.
|
||||
//
|
||||
// Release 13.2 - Data2MEM O.61xd, build 2.2 May 20, 2011
|
||||
// Copyright (c) 1995-2011 Xilinx, Inc. All rights reserved.
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Processor 'microblaze_0', ID 100, memory map.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ADDRESS_MAP microblaze_0 MICROBLAZE-LE 100
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Processor 'microblaze_0' address space 'lmb_bram_combined' 0x00000000:0x0000FFFF (64 KBytes).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ADDRESS_SPACE lmb_bram_combined RAMB16 [0x00000000:0x0000FFFF]
|
||||
BUS_BLOCK
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_0 [31:31] INPUT = lmb_bram_combined_0.mem PLACED = X2Y30;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_1 [30:30] INPUT = lmb_bram_combined_1.mem PLACED = X2Y28;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_2 [29:29] INPUT = lmb_bram_combined_2.mem PLACED = X3Y22;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_3 [28:28] INPUT = lmb_bram_combined_3.mem PLACED = X3Y20;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_4 [27:27] INPUT = lmb_bram_combined_4.mem PLACED = X3Y30;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_5 [26:26] INPUT = lmb_bram_combined_5.mem PLACED = X2Y26;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_6 [25:25] INPUT = lmb_bram_combined_6.mem PLACED = X2Y18;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_7 [24:24] INPUT = lmb_bram_combined_7.mem PLACED = X2Y20;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_8 [23:23] INPUT = lmb_bram_combined_8.mem PLACED = X3Y28;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_9 [22:22] INPUT = lmb_bram_combined_9.mem PLACED = X3Y26;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_10 [21:21] INPUT = lmb_bram_combined_10.mem PLACED = X3Y24;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_11 [20:20] INPUT = lmb_bram_combined_11.mem PLACED = X2Y10;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_12 [19:19] INPUT = lmb_bram_combined_12.mem PLACED = X2Y12;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_13 [18:18] INPUT = lmb_bram_combined_13.mem PLACED = X2Y24;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_14 [17:17] INPUT = lmb_bram_combined_14.mem PLACED = X2Y16;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_15 [16:16] INPUT = lmb_bram_combined_15.mem PLACED = X2Y14;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_16 [15:15] INPUT = lmb_bram_combined_16.mem PLACED = X1Y22;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_17 [14:14] INPUT = lmb_bram_combined_17.mem PLACED = X1Y24;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_18 [13:13] INPUT = lmb_bram_combined_18.mem PLACED = X1Y30;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_19 [12:12] INPUT = lmb_bram_combined_19.mem PLACED = X1Y28;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_20 [11:11] INPUT = lmb_bram_combined_20.mem PLACED = X0Y22;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_21 [10:10] INPUT = lmb_bram_combined_21.mem PLACED = X0Y20;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_22 [9:9] INPUT = lmb_bram_combined_22.mem PLACED = X0Y16;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_23 [8:8] INPUT = lmb_bram_combined_23.mem PLACED = X0Y28;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_24 [7:7] INPUT = lmb_bram_combined_24.mem PLACED = X1Y26;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_25 [6:6] INPUT = lmb_bram_combined_25.mem PLACED = X0Y26;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_26 [5:5] INPUT = lmb_bram_combined_26.mem PLACED = X0Y24;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_27 [4:4] INPUT = lmb_bram_combined_27.mem PLACED = X1Y20;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_28 [3:3] INPUT = lmb_bram_combined_28.mem PLACED = X1Y14;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_29 [2:2] INPUT = lmb_bram_combined_29.mem PLACED = X1Y18;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_30 [1:1] INPUT = lmb_bram_combined_30.mem PLACED = X1Y16;
|
||||
system_i/lmb_bram/lmb_bram/ramb16bwer_31 [0:0] INPUT = lmb_bram_combined_31.mem PLACED = X0Y18;
|
||||
END_BUS_BLOCK;
|
||||
END_ADDRESS_SPACE;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Processor 'microblaze_0' address space 'axi_bram_0_combined' 0x4A000000:0x4A00FFFF (64 KBytes).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ADDRESS_SPACE axi_bram_0_combined RAMB16 [0x4A000000:0x4A00FFFF]
|
||||
BUS_BLOCK
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_0 [31:31] INPUT = axi_bram_0_combined_0.mem PLACED = X2Y54;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_1 [30:30] INPUT = axi_bram_0_combined_1.mem PLACED = X2Y50;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_2 [29:29] INPUT = axi_bram_0_combined_2.mem PLACED = X3Y52;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_3 [28:28] INPUT = axi_bram_0_combined_3.mem PLACED = X2Y52;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_4 [27:27] INPUT = axi_bram_0_combined_4.mem PLACED = X3Y46;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_5 [26:26] INPUT = axi_bram_0_combined_5.mem PLACED = X2Y48;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_6 [25:25] INPUT = axi_bram_0_combined_6.mem PLACED = X3Y48;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_7 [24:24] INPUT = axi_bram_0_combined_7.mem PLACED = X3Y50;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_8 [23:23] INPUT = axi_bram_0_combined_8.mem PLACED = X3Y42;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_9 [22:22] INPUT = axi_bram_0_combined_9.mem PLACED = X3Y44;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_10 [21:21] INPUT = axi_bram_0_combined_10.mem PLACED = X2Y44;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_11 [20:20] INPUT = axi_bram_0_combined_11.mem PLACED = X2Y42;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_12 [19:19] INPUT = axi_bram_0_combined_12.mem PLACED = X3Y38;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_13 [18:18] INPUT = axi_bram_0_combined_13.mem PLACED = X3Y40;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_14 [17:17] INPUT = axi_bram_0_combined_14.mem PLACED = X3Y36;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_15 [16:16] INPUT = axi_bram_0_combined_15.mem PLACED = X3Y34;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_16 [15:15] INPUT = axi_bram_0_combined_16.mem PLACED = X2Y36;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_17 [14:14] INPUT = axi_bram_0_combined_17.mem PLACED = X1Y40;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_18 [13:13] INPUT = axi_bram_0_combined_18.mem PLACED = X2Y40;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_19 [12:12] INPUT = axi_bram_0_combined_19.mem PLACED = X2Y38;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_20 [11:11] INPUT = axi_bram_0_combined_20.mem PLACED = X1Y38;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_21 [10:10] INPUT = axi_bram_0_combined_21.mem PLACED = X0Y32;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_22 [9:9] INPUT = axi_bram_0_combined_22.mem PLACED = X0Y34;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_23 [8:8] INPUT = axi_bram_0_combined_23.mem PLACED = X1Y36;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_24 [7:7] INPUT = axi_bram_0_combined_24.mem PLACED = X0Y36;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_25 [6:6] INPUT = axi_bram_0_combined_25.mem PLACED = X1Y42;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_26 [5:5] INPUT = axi_bram_0_combined_26.mem PLACED = X0Y38;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_27 [4:4] INPUT = axi_bram_0_combined_27.mem PLACED = X0Y40;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_28 [3:3] INPUT = axi_bram_0_combined_28.mem PLACED = X0Y46;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_29 [2:2] INPUT = axi_bram_0_combined_29.mem PLACED = X1Y46;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_30 [1:1] INPUT = axi_bram_0_combined_30.mem PLACED = X1Y44;
|
||||
system_i/axi_bram_0/axi_bram_0/ramb16bwer_31 [0:0] INPUT = axi_bram_0_combined_31.mem PLACED = X0Y44;
|
||||
END_BUS_BLOCK;
|
||||
END_ADDRESS_SPACE;
|
||||
|
||||
END_ADDRESS_MAP;
|
||||
|
14
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/.cproject
Normal file
14
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/.cproject
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="org.eclipse.cdt.core.default.config.1982408324">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.1982408324" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
|
||||
<externalSettings/>
|
||||
<extensions/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
</cproject>
|
77
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/.project
Normal file
77
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/.project
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>RTOSDemoBSP</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>HardwareWithEthernet</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.make.core.makeBuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.core.errorOutputParser</key>
|
||||
<value>org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.MakeErrorParser;</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.build.arguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.build.command</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.build.target.auto</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.build.target.clean</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.build.target.inc</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.environment</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.xilinx.sdk.sw.SwProjectNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.make.core.makeNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,3 @@
|
|||
THIRPARTY=false
|
||||
PROCESSOR=microblaze_0
|
||||
MSS_FILE=system.mss
|
21
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/Makefile
Normal file
21
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Makefile generated by Xilinx SDK.
|
||||
|
||||
-include libgen.options
|
||||
|
||||
LIBRARIES = ${PROCESSOR}/lib/libxil.a
|
||||
MSS = system.mss
|
||||
|
||||
all: libs
|
||||
@echo 'Finished building libraries'
|
||||
|
||||
libs: $(LIBRARIES)
|
||||
|
||||
$(LIBRARIES): $(MSS)
|
||||
libgen -hw ${HWSPEC}\
|
||||
${REPOSITORIES}\
|
||||
-pe ${PROCESSOR} \
|
||||
-log libgen.log \
|
||||
$(MSS)
|
||||
|
||||
clean:
|
||||
rm -rf ${PROCESSOR}
|
20
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/libgen.log
Normal file
20
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/libgen.log
Normal file
|
@ -0,0 +1,20 @@
|
|||
Release 13.1 - libgen Xilinx EDK 13.1 Build EDK_O.40d
|
||||
(nt)
|
||||
Copyright (c) 1995-2011 Xilinx, Inc. All rights reserved.
|
||||
|
||||
Command Line: libgen -hw ../HardwareWithEthernet/system.xml -pe microblaze_0
|
||||
-log libgen.log system.mss
|
||||
|
||||
|
||||
Staging source files.
|
||||
Running DRCs.
|
||||
Running generate.
|
||||
Running post_generate.
|
||||
Running include - 'make -s include "COMPILER=mb-gcc" "ARCHIVER=mb-ar"
|
||||
"COMPILER_FLAGS=-mlittle-endian -mno-xl-soft-mul -mxl-barrel-shift
|
||||
-mxl-pattern-compare -mcpu=v8.20.a -O2 -c" "EXTRA_COMPILER_FLAGS=-g"'.
|
||||
|
||||
Running libs - 'make -s libs "COMPILER=mb-gcc" "ARCHIVER=mb-ar"
|
||||
"COMPILER_FLAGS=-mlittle-endian -mno-xl-soft-mul -mxl-barrel-shift
|
||||
-mxl-pattern-compare -mcpu=v8.20.a -O2 -c" "EXTRA_COMPILER_FLAGS=-g"'.
|
||||
Running execs_generate.
|
|
@ -0,0 +1,3 @@
|
|||
PROCESSOR=microblaze_0
|
||||
REPOSITORIES=
|
||||
HWSPEC=../HardwareWithEthernet/system.xml
|
123
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/system.mss
Normal file
123
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoBSP/system.mss
Normal file
|
@ -0,0 +1,123 @@
|
|||
|
||||
PARAMETER VERSION = 2.2.0
|
||||
|
||||
|
||||
BEGIN OS
|
||||
PARAMETER OS_NAME = standalone
|
||||
PARAMETER OS_VER = 3.01.a
|
||||
PARAMETER PROC_INSTANCE = microblaze_0
|
||||
PARAMETER STDIN = Debug_Module
|
||||
PARAMETER STDOUT = Debug_Module
|
||||
END
|
||||
|
||||
|
||||
BEGIN PROCESSOR
|
||||
PARAMETER DRIVER_NAME = cpu
|
||||
PARAMETER DRIVER_VER = 1.13.a
|
||||
PARAMETER HW_INSTANCE = microblaze_0
|
||||
END
|
||||
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = axidma
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = AXI_DMA_Ethernet
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = s6_ddrx
|
||||
PARAMETER DRIVER_VER = 1.00.a
|
||||
PARAMETER HW_INSTANCE = DDR3_SDRAM
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = gpio
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = DIP_Switches_4Bit
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = uartlite
|
||||
PARAMETER DRIVER_VER = 2.00.a
|
||||
PARAMETER HW_INSTANCE = Debug_Module
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = tmrctr
|
||||
PARAMETER DRIVER_VER = 2.03.a
|
||||
PARAMETER HW_INSTANCE = Dual_Timer_Counter
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = emc
|
||||
PARAMETER DRIVER_VER = 3.01.a
|
||||
PARAMETER HW_INSTANCE = FLASH
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = iic
|
||||
PARAMETER DRIVER_VER = 2.02.a
|
||||
PARAMETER HW_INSTANCE = IIC_EEPROM
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = bram
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = Internal_BRAM
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = intc
|
||||
PARAMETER DRIVER_VER = 2.02.a
|
||||
PARAMETER HW_INSTANCE = Interrupt_Cntlr
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = gpio
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = LEDs_4Bit
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = bram
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = LocalMemory_Cntlr_D
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = bram
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = LocalMemory_Cntlr_I
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = gpio
|
||||
PARAMETER DRIVER_VER = 3.00.a
|
||||
PARAMETER HW_INSTANCE = Push_Buttons_4Bit
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = uartns550
|
||||
PARAMETER DRIVER_VER = 2.00.a
|
||||
PARAMETER HW_INSTANCE = RS232_Uart_1
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = spi
|
||||
PARAMETER DRIVER_VER = 3.01.a
|
||||
PARAMETER HW_INSTANCE = SPI_FLASH
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = axiethernet
|
||||
PARAMETER DRIVER_VER = 1.01.a
|
||||
PARAMETER HW_INSTANCE = Soft_Ethernet_MAC
|
||||
END
|
||||
|
||||
BEGIN DRIVER
|
||||
PARAMETER DRIVER_NAME = sysace
|
||||
PARAMETER DRIVER_VER = 2.00.a
|
||||
PARAMETER HW_INSTANCE = SysACE_CompactFlash
|
||||
END
|
||||
|
||||
|
1985
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/.cproject
Normal file
1985
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/.cproject
Normal file
File diff suppressed because it is too large
Load diff
82
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/.project
Normal file
82
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/.project
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>RTOSDemoSource</name>
|
||||
<comment>RTOSDemoBSP - microblaze_0</comment>
|
||||
<projects>
|
||||
<project>RTOSDemoBSP</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/RTOSDemoSource/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,12 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
O_SRCS += \
|
||||
../Debug/FreeRTOS_Source/portable/GCC/MicroBlaze/port.o \
|
||||
../Debug/FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
O_SRCS += \
|
||||
../Debug/FreeRTOS_Source/portable/MemMang/heap_2.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
O_SRCS += \
|
||||
../Debug/FreeRTOS_Source/list.o \
|
||||
../Debug/FreeRTOS_Source/queue.o \
|
||||
../Debug/FreeRTOS_Source/tasks.o \
|
||||
../Debug/FreeRTOS_Source/timers.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
O_SRCS += \
|
||||
../Debug/src/testperiph.o \
|
||||
../Debug/src/xemaclite_example_util.o \
|
||||
../Debug/src/xemaclite_intr_example.o \
|
||||
../Debug/src/xemaclite_polled_example.o \
|
||||
../Debug/src/xgpio_intr_tapp_example.o \
|
||||
../Debug/src/xgpio_tapp_example.o \
|
||||
../Debug/src/xintc_tapp_example.o \
|
||||
../Debug/src/xtmrctr_intr_example.o \
|
||||
../Debug/src/xtmrctr_selftest_example.o \
|
||||
../Debug/src/xuartlite_selftest_example.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
O_SRCS += \
|
||||
../Debug/ParTest.o \
|
||||
../Debug/main-blinky.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
-include ../makefile.init
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
# All of the sources participating in the build are defined here
|
||||
-include sources.mk
|
||||
-include subdir.mk
|
||||
-include src/subdir.mk
|
||||
-include Debug/src/subdir.mk
|
||||
-include Debug/subdir.mk
|
||||
-include Debug/FreeRTOS_Source/subdir.mk
|
||||
-include Debug/FreeRTOS_Source/portable/MemMang/subdir.mk
|
||||
-include Debug/FreeRTOS_Source/portable/GCC/MicroBlaze/subdir.mk
|
||||
-include objects.mk
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(strip $(C_DEPS)),)
|
||||
-include $(C_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(S_UPPER_DEPS)),)
|
||||
-include $(S_UPPER_DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
-include ../makefile.defs
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
ELFSIZE += \
|
||||
RTOSDemoSource.elf.size \
|
||||
|
||||
ELFCHECK += \
|
||||
RTOSDemoSource.elf.elfcheck \
|
||||
|
||||
|
||||
# All Target
|
||||
all: RTOSDemoSource.elf secondary-outputs
|
||||
|
||||
# Tool invocations
|
||||
RTOSDemoSource.elf: $(OBJS) ../src/lscript.ld $(USER_OBJS)
|
||||
@echo Building target: $@
|
||||
@echo Invoking: MicroBlaze gcc linker
|
||||
mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../RTOSDemoBSP/microblaze_0/lib -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -o"RTOSDemoSource.elf" $(OBJS) $(USER_OBJS) $(LIBS)
|
||||
@echo Finished building target: $@
|
||||
@echo ' '
|
||||
|
||||
RTOSDemoSource.elf.size: RTOSDemoSource.elf
|
||||
@echo Invoking: MicroBlaze Print Size
|
||||
mb-size RTOSDemoSource.elf |tee "RTOSDemoSource.elf.size"
|
||||
@echo Finished building: $@
|
||||
@echo ' '
|
||||
|
||||
RTOSDemoSource.elf.elfcheck: RTOSDemoSource.elf
|
||||
@echo Invoking: Xilinx ELF Check
|
||||
elfcheck RTOSDemoSource.elf -hw ../../HardwareWithEthernetLite/system.xml -pe microblaze_0 |tee "RTOSDemoSource.elf.elfcheck"
|
||||
@echo Finished building: $@
|
||||
@echo ' '
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES)$(ELFSIZE)$(ELFCHECK)$(S_UPPER_DEPS) RTOSDemoSource.elf
|
||||
-@echo ' '
|
||||
|
||||
secondary-outputs: $(ELFSIZE) $(ELFCHECK)
|
||||
|
||||
.PHONY: all clean dependents
|
||||
.SECONDARY:
|
||||
|
||||
-include ../makefile.targets
|
|
@ -0,0 +1,8 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
USER_OBJS :=
|
||||
|
||||
LIBS :=
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
O_SRCS :=
|
||||
C_SRCS :=
|
||||
LD_SRCS :=
|
||||
S_UPPER_SRCS :=
|
||||
S_SRCS :=
|
||||
OBJ_SRCS :=
|
||||
OBJS :=
|
||||
C_DEPS :=
|
||||
EXECUTABLES :=
|
||||
ELFSIZE :=
|
||||
ELFCHECK :=
|
||||
S_UPPER_DEPS :=
|
||||
|
||||
# Every subdirectory with source files must be described here
|
||||
SUBDIRS := \
|
||||
src \
|
||||
. \
|
||||
Debug/src \
|
||||
Debug \
|
||||
Debug/FreeRTOS_Source \
|
||||
Debug/FreeRTOS_Source/portable/MemMang \
|
||||
Debug/FreeRTOS_Source/portable/GCC/MicroBlaze \
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../src/xemaclite_example_util.c
|
||||
|
||||
LD_SRCS += \
|
||||
../src/lscript.ld
|
||||
|
||||
OBJS += \
|
||||
./src/xemaclite_example_util.o
|
||||
|
||||
C_DEPS += \
|
||||
./src/xemaclite_example_util.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
src/%.o: ../src/%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource\lwIP\lwIP_Apps\apps\httpserver_raw" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource\lwIP\lwIP_Apps" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../main-blinky.c
|
||||
|
||||
OBJS += \
|
||||
./main-blinky.o
|
||||
|
||||
C_DEPS += \
|
||||
./main-blinky.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
%.o: ../%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource\lwIP\lwIP_Apps\apps\httpserver_raw" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_Ethernet\RTOSDemoSource\lwIP\lwIP_Apps" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
REM This file should be executed from the command line prior to the first
|
||||
REM build. It will be necessary to refresh the Eclipse project once the
|
||||
REM .bat file has been executed (normally just press F5 to refresh).
|
||||
|
||||
REM Copies all the required files from their location within the standard
|
||||
REM FreeRTOS directory structure to under the Eclipse project directory.
|
||||
REM This permits the Eclipse project to be used in 'managed' mode and without
|
||||
REM having to setup any linked resources.
|
||||
|
||||
REM Have the files already been copied?
|
||||
IF EXIST FreeRTOS_Source Goto END
|
||||
|
||||
REM Create the required directory structure.
|
||||
MD FreeRTOS_Source
|
||||
MD FreeRTOS_Source\include
|
||||
MD FreeRTOS_Source\portable\GCC
|
||||
MD FreeRTOS_Source\portable\GCC\MicroBlazeV8
|
||||
MD FreeRTOS_Source\portable\MemMang
|
||||
MD Demo_Source
|
||||
MD Demo_Source\include
|
||||
MD lwIP\api
|
||||
MD lwIP\core
|
||||
MD lwIP\core\ipv4
|
||||
MD lwIP\include
|
||||
MD lwIP\include\ipv4
|
||||
MD lwIP\include\ipv4\lwip
|
||||
MD lwIP\include\lwip
|
||||
MD lwIP\include\netif
|
||||
MD lwIP\netif
|
||||
MD lwIP\netif\include
|
||||
MD lwIP\netif\include\arch
|
||||
|
||||
REM Copy the core kernel files.
|
||||
copy ..\..\..\..\Source\tasks.c FreeRTOS_Source
|
||||
copy ..\..\..\..\Source\queue.c FreeRTOS_Source
|
||||
copy ..\..\..\..\Source\list.c FreeRTOS_Source
|
||||
copy ..\..\..\..\Source\timers.c FreeRTOS_Source
|
||||
|
||||
REM Copy the common header files
|
||||
copy ..\..\..\..\Source\include\*.* FreeRTOS_Source\include
|
||||
|
||||
REM Copy the portable layer files
|
||||
copy ..\..\..\..\Source\portable\GCC\MicroBlazeV8\*.* FreeRTOS_Source\portable\GCC\MicroBlazeV8
|
||||
|
||||
REM Copy the basic memory allocation files
|
||||
copy ..\..\..\..\Source\portable\MemMang\heap_2.c FreeRTOS_Source\portable\MemMang
|
||||
|
||||
REM Copy the files that define the common demo tasks.
|
||||
copy ..\..\..\Common\minimal\dynamic.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\BlockQ.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\death.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\blocktim.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\semtest.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\PollQ.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\GenQTest.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\QPeek.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\recmutex.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\sp_flop.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\flash.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\comtest_strings.c Demo_Source
|
||||
copy ..\..\..\Common\minimal\TimerDemo.c Demo_Source
|
||||
|
||||
REM Copy the common demo file headers.
|
||||
copy ..\..\..\Common\include\dynamic.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\partest.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\BlockQ.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\death.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\blocktim.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\semtest.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\PollQ.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\GenQTest.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\QPeek.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\recmutex.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\flop.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\flash.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\comtest_strings.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\serial.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\comtest.h Demo_Source\include
|
||||
copy ..\..\..\Common\include\TimerDemo.h Demo_Source\include
|
||||
|
||||
REM Copy the required lwIP files
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\api\*.c lwIP\api
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\core\*.c lwIP\core
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\core\ipv4\*.c lwIP\core\ipv4
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\include\ipv4\lwip\*.h lwIP\include\ipv4\lwip
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\include\lwip\*.h lwIP\include\lwip
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\include\netif\*.h lwIP\include\netif
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\src\netif\etharp.c lwIP\netif
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\ports\MicroBlaze-Ethernet-Lite lwip\netif
|
||||
copy ..\..\..\Common\ethernet\lwip-1.4.0\ports\MicroBlaze-Ethernet-Lite\include\arch lwip\netif\include\arch
|
||||
|
||||
: END
|
|
@ -0,0 +1,28 @@
|
|||
FreeRTOS_Source/list.d FreeRTOS_Source/list.o: ../FreeRTOS_Source/list.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
|
@ -0,0 +1,72 @@
|
|||
FreeRTOS_Source/portable/GCC/MicroBlaze/port.d \
|
||||
FreeRTOS_Source/portable/GCC/MicroBlaze/port.o: \
|
||||
../FreeRTOS_Source/portable/GCC/MicroBlaze/port.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_i.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_i.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
|
@ -0,0 +1,35 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
|
||||
|
||||
S_SRCS += \
|
||||
../FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.s
|
||||
|
||||
OBJS += \
|
||||
./FreeRTOS_Source/portable/GCC/MicroBlaze/port.o \
|
||||
./FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.o
|
||||
|
||||
C_DEPS += \
|
||||
./FreeRTOS_Source/portable/GCC/MicroBlaze/port.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
FreeRTOS_Source/portable/GCC/MicroBlaze/%.o: ../FreeRTOS_Source/portable/GCC/MicroBlaze/%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\Demo_Source\Common_Demo_Files\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\portable\GCC\MicroBlaze" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
FreeRTOS_Source/portable/GCC/MicroBlaze/%.o: ../FreeRTOS_Source/portable/GCC/MicroBlaze/%.s
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc assembler
|
||||
mb-as -mlittle-endian -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
FreeRTOS_Source/portable/MemMang/heap_2.d \
|
||||
FreeRTOS_Source/portable/MemMang/heap_2.o: \
|
||||
../FreeRTOS_Source/portable/MemMang/heap_2.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
|
@ -0,0 +1,24 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../FreeRTOS_Source/portable/MemMang/heap_2.c
|
||||
|
||||
OBJS += \
|
||||
./FreeRTOS_Source/portable/MemMang/heap_2.o
|
||||
|
||||
C_DEPS += \
|
||||
./FreeRTOS_Source/portable/MemMang/heap_2.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
FreeRTOS_Source/portable/MemMang/%.o: ../FreeRTOS_Source/portable/MemMang/%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\Demo_Source\Common_Demo_Files\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\portable\GCC\MicroBlaze" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
FreeRTOS_Source/queue.d FreeRTOS_Source/queue.o: \
|
||||
../FreeRTOS_Source/queue.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/croutine.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/croutine.h:
|
|
@ -0,0 +1,33 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../FreeRTOS_Source/list.c \
|
||||
../FreeRTOS_Source/queue.c \
|
||||
../FreeRTOS_Source/tasks.c \
|
||||
../FreeRTOS_Source/timers.c
|
||||
|
||||
OBJS += \
|
||||
./FreeRTOS_Source/list.o \
|
||||
./FreeRTOS_Source/queue.o \
|
||||
./FreeRTOS_Source/tasks.o \
|
||||
./FreeRTOS_Source/timers.o
|
||||
|
||||
C_DEPS += \
|
||||
./FreeRTOS_Source/list.d \
|
||||
./FreeRTOS_Source/queue.d \
|
||||
./FreeRTOS_Source/tasks.d \
|
||||
./FreeRTOS_Source/timers.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
FreeRTOS_Source/%.o: ../FreeRTOS_Source/%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\Demo_Source\Common_Demo_Files\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\portable\GCC\MicroBlaze" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
FreeRTOS_Source/tasks.d FreeRTOS_Source/tasks.o: \
|
||||
../FreeRTOS_Source/tasks.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/StackMacros.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/StackMacros.h:
|
|
@ -0,0 +1,38 @@
|
|||
FreeRTOS_Source/timers.d FreeRTOS_Source/timers.o: \
|
||||
../FreeRTOS_Source/timers.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/queue.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/queue.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h:
|
|
@ -0,0 +1,49 @@
|
|||
ParTest.d ParTest.o: ../ParTest.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/Demo_Source/Common_Demo_Files/include/partest.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/Demo_Source/Common_Demo_Files/include/partest.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
Binary file not shown.
|
@ -0,0 +1,9 @@
|
|||
elfcheck
|
||||
Xilinx EDK 13.1 Build EDK_O.40d
|
||||
Copyright (c) 1995-2010 Xilinx, Inc. All rights reserved.
|
||||
|
||||
Command Line: elfcheck -hw ../../HardwareWithEthernetLite/system.xml -pe
|
||||
microblaze_0 RTOSDemoSource.elf
|
||||
|
||||
ELF file : RTOSDemoSource.elf
|
||||
elfcheck passed.
|
|
@ -0,0 +1,2 @@
|
|||
text data bss dec hex filename
|
||||
65386 600 16198 82184 14108 RTOSDemoSource.elf
|
|
@ -0,0 +1,79 @@
|
|||
main-blinky.d main-blinky.o: ../main-blinky.c \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/queue.h \
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/microblaze_exceptions_g.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/FreeRTOS.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/projdefs.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/portable.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/mpu_wrappers.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/task.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/list.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/queue.h:
|
||||
|
||||
C:/E/Dev/FreeRTOS/WorkingCopy/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/include/timers.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/microblaze_exceptions_g.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h:
|
|
@ -0,0 +1,70 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
-include ../makefile.init
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
# All of the sources participating in the build are defined here
|
||||
-include sources.mk
|
||||
-include subdir.mk
|
||||
-include src/subdir.mk
|
||||
-include FreeRTOS_Source/subdir.mk
|
||||
-include FreeRTOS_Source/portable/MemMang/subdir.mk
|
||||
-include FreeRTOS_Source/portable/GCC/MicroBlaze/subdir.mk
|
||||
-include objects.mk
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(strip $(C_DEPS)),)
|
||||
-include $(C_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(S_UPPER_DEPS)),)
|
||||
-include $(S_UPPER_DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
-include ../makefile.defs
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
ELFSIZE += \
|
||||
RTOSDemoSource.elf.size \
|
||||
|
||||
ELFCHECK += \
|
||||
RTOSDemoSource.elf.elfcheck \
|
||||
|
||||
|
||||
# All Target
|
||||
all: RTOSDemoSource.elf secondary-outputs
|
||||
|
||||
# Tool invocations
|
||||
RTOSDemoSource.elf: $(OBJS) ../src/lscript.ld $(USER_OBJS)
|
||||
@echo Building target: $@
|
||||
@echo Invoking: MicroBlaze gcc linker
|
||||
mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../RTOSDemoBSP/microblaze_0/lib -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -o"RTOSDemoSource.elf" $(OBJS) $(USER_OBJS) $(LIBS)
|
||||
@echo Finished building target: $@
|
||||
@echo ' '
|
||||
|
||||
RTOSDemoSource.elf.size: RTOSDemoSource.elf
|
||||
@echo Invoking: MicroBlaze Print Size
|
||||
mb-size RTOSDemoSource.elf |tee "RTOSDemoSource.elf.size"
|
||||
@echo Finished building: $@
|
||||
@echo ' '
|
||||
|
||||
RTOSDemoSource.elf.elfcheck: RTOSDemoSource.elf
|
||||
@echo Invoking: Xilinx ELF Check
|
||||
elfcheck RTOSDemoSource.elf -hw ../../HardwareWithEthernetLite/system.xml -pe microblaze_0 |tee "RTOSDemoSource.elf.elfcheck"
|
||||
@echo Finished building: $@
|
||||
@echo ' '
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES)$(ELFSIZE)$(ELFCHECK)$(S_UPPER_DEPS) RTOSDemoSource.elf
|
||||
-@echo ' '
|
||||
|
||||
secondary-outputs: $(ELFSIZE) $(ELFCHECK)
|
||||
|
||||
.PHONY: all clean dependents
|
||||
.SECONDARY:
|
||||
|
||||
-include ../makefile.targets
|
|
@ -0,0 +1,8 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
USER_OBJS :=
|
||||
|
||||
LIBS :=
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
O_SRCS :=
|
||||
C_SRCS :=
|
||||
LD_SRCS :=
|
||||
S_UPPER_SRCS :=
|
||||
S_SRCS :=
|
||||
OBJ_SRCS :=
|
||||
OBJS :=
|
||||
C_DEPS :=
|
||||
EXECUTABLES :=
|
||||
ELFSIZE :=
|
||||
ELFCHECK :=
|
||||
S_UPPER_DEPS :=
|
||||
|
||||
# Every subdirectory with source files must be described here
|
||||
SUBDIRS := \
|
||||
src \
|
||||
. \
|
||||
FreeRTOS_Source \
|
||||
FreeRTOS_Source/portable/MemMang \
|
||||
FreeRTOS_Source/portable/GCC/MicroBlaze \
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../src/testperiph.c \
|
||||
../src/xemaclite_example_util.c \
|
||||
../src/xemaclite_intr_example.c \
|
||||
../src/xemaclite_polled_example.c \
|
||||
../src/xgpio_intr_tapp_example.c \
|
||||
../src/xgpio_tapp_example.c \
|
||||
../src/xintc_tapp_example.c \
|
||||
../src/xtmrctr_intr_example.c \
|
||||
../src/xtmrctr_selftest_example.c \
|
||||
../src/xuartlite_selftest_example.c
|
||||
|
||||
LD_SRCS += \
|
||||
../src/lscript.ld
|
||||
|
||||
OBJS += \
|
||||
./src/testperiph.o \
|
||||
./src/xemaclite_example_util.o \
|
||||
./src/xemaclite_intr_example.o \
|
||||
./src/xemaclite_polled_example.o \
|
||||
./src/xgpio_intr_tapp_example.o \
|
||||
./src/xgpio_tapp_example.o \
|
||||
./src/xintc_tapp_example.o \
|
||||
./src/xtmrctr_intr_example.o \
|
||||
./src/xtmrctr_selftest_example.o \
|
||||
./src/xuartlite_selftest_example.o
|
||||
|
||||
C_DEPS += \
|
||||
./src/testperiph.d \
|
||||
./src/xemaclite_example_util.d \
|
||||
./src/xemaclite_intr_example.d \
|
||||
./src/xemaclite_polled_example.d \
|
||||
./src/xgpio_intr_tapp_example.d \
|
||||
./src/xgpio_tapp_example.d \
|
||||
./src/xintc_tapp_example.d \
|
||||
./src/xtmrctr_intr_example.d \
|
||||
./src/xtmrctr_selftest_example.d \
|
||||
./src/xuartlite_selftest_example.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
src/%.o: ../src/%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\Demo_Source\Common_Demo_Files\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\portable\GCC\MicroBlaze" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
src/testperiph.d src/testperiph.o: ../src/testperiph.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h ../src/intc_header.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h ../src/gpio_header.h \
|
||||
../src/gpio_intr_header.h ../src/uartlite_header.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h \
|
||||
../src/tmrctr_header.h ../src/tmrctr_intr_header.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h \
|
||||
../src/xemaclite_example.h ../src/emaclite_header.h \
|
||||
../src/emaclite_intr_header.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../src/intc_header.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h:
|
||||
|
||||
../src/gpio_header.h:
|
||||
|
||||
../src/gpio_intr_header.h:
|
||||
|
||||
../src/uartlite_header.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h:
|
||||
|
||||
../src/tmrctr_header.h:
|
||||
|
||||
../src/tmrctr_intr_header.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h:
|
||||
|
||||
../src/xemaclite_example.h:
|
||||
|
||||
../src/emaclite_header.h:
|
||||
|
||||
../src/emaclite_intr_header.h:
|
|
@ -0,0 +1,40 @@
|
|||
src/xemaclite_example_util.d src/xemaclite_example_util.o: \
|
||||
../src/xemaclite_example_util.c ../src/xemaclite_example.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h
|
||||
|
||||
../src/xemaclite_example.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
|
@ -0,0 +1,52 @@
|
|||
src/xemaclite_intr_example.d src/xemaclite_intr_example.o: \
|
||||
../src/xemaclite_intr_example.c ../src/xemaclite_example.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h
|
||||
|
||||
../src/xemaclite_example.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
|
@ -0,0 +1,40 @@
|
|||
src/xemaclite_polled_example.d src/xemaclite_polled_example.o: \
|
||||
../src/xemaclite_polled_example.c ../src/xemaclite_example.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h
|
||||
|
||||
../src/xemaclite_example.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xenv_standalone.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/mb_interface.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xemaclite_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
|
@ -0,0 +1,38 @@
|
|||
src/xgpio_intr_tapp_example.d src/xgpio_intr_tapp_example.o: \
|
||||
../src/xgpio_intr_tapp_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
|
@ -0,0 +1,29 @@
|
|||
src/xgpio_tapp_example.d src/xgpio_tapp_example.o: \
|
||||
../src/xgpio_tapp_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xgpio_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
|
@ -0,0 +1,35 @@
|
|||
src/xintc_tapp_example.d src/xintc_tapp_example.o: \
|
||||
../src/xintc_tapp_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
|
@ -0,0 +1,38 @@
|
|||
src/xtmrctr_intr_example.d src/xtmrctr_intr_example.o: \
|
||||
../src/xtmrctr_intr_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xintc_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_exception.h:
|
|
@ -0,0 +1,26 @@
|
|||
src/xtmrctr_selftest_example.d src/xtmrctr_selftest_example.o: \
|
||||
../src/xtmrctr_selftest_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xtmrctr_l.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_io.h:
|
|
@ -0,0 +1,20 @@
|
|||
src/xuartlite_selftest_example.d src/xuartlite_selftest_example.o: \
|
||||
../src/xuartlite_selftest_example.c \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xuartlite.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h \
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xparameters.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xuartlite.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_types.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xil_assert.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xstatus.h:
|
||||
|
||||
../../RTOSDemoBSP/microblaze_0/include/xbasic_types.h:
|
|
@ -0,0 +1,27 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../ParTest.c \
|
||||
../main-blinky.c
|
||||
|
||||
OBJS += \
|
||||
./ParTest.o \
|
||||
./main-blinky.o
|
||||
|
||||
C_DEPS += \
|
||||
./ParTest.d \
|
||||
./main-blinky.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
%.o: ../%.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: MicroBlaze gcc compiler
|
||||
mb-gcc -Wall -O0 -g3 -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\Demo_Source\Common_Demo_Files\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\include" -I"C:\E\Dev\FreeRTOS\WorkingCopy\Demo\MicroBlaze_Spartan-6_EthernetLite\SDKProjects\RTOSDemoSource\FreeRTOS_Source\portable\GCC\MicroBlaze" -c -fmessage-length=0 -I../../RTOSDemoBSP/microblaze_0/include -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.10.a -mno-xl-soft-mul -mhard-float -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo Finished building: $<
|
||||
@echo ' '
|
||||
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
|
||||
/* The following #error directive is to remind users that a batch file must be
|
||||
* executed prior to this project being built. The batch file *cannot* be
|
||||
* executed from within older versions of Eclipse, but probably can be executed
|
||||
* from within the Xilinx SDK. Once it has been executed, re-open or refresh
|
||||
* the Eclipse project and remove the #error line below.
|
||||
*/
|
||||
//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configCPU_CLOCK_HZ ( XPAR_MICROBLAZE_CORE_CLOCK_FREQ_HZ ) /* Not actually used in this demo as the timer is set up in main() and uses the peripheral clock, not the CPU clock. */
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( 6 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 64 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )
|
||||
#define configINTERRUPT_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
/* If configINSTALL_EXCEPTION_HANDLERS is set to 1, then the kernel will
|
||||
automatically install its own exception handlers before the kernel is started,
|
||||
if the application writer has not already caused them to be installed using the
|
||||
vPortExceptionsInstallHandlers() API function. See the documentation page for
|
||||
this demo on the FreeRTOS.org web site for more information. */
|
||||
#define configINSTALL_EXCEPTION_HANDLERS 1
|
||||
|
||||
/* configINTERRUPT_CONTROLLER_TO_USE must be set to the ID of the interrupt
|
||||
controller that is going to be used directly by FreeRTOS itself. Most hardware
|
||||
designs will only include on interrupt controller. */
|
||||
#define configINTERRUPT_CONTROLLER_TO_USE XPAR_INTC_SINGLE_DEVICE_ID
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
|
||||
|
||||
/* Run time stats gathering definitions. The conditional compilation is to
|
||||
prevent the C syntax being included in assembly files. */
|
||||
#ifndef __ASSEMBLER__
|
||||
unsigned long ulMainGetRunTimeCounterValue( void );
|
||||
void vMainConfigureTimerForRunTimeStats( void );
|
||||
#endif
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vMainConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulMainGetRunTimeCounterValue()
|
||||
|
||||
|
||||
|
||||
#define configLWIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* MAC address configuration. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x12
|
||||
#define configMAC_ADDR2 0x13
|
||||
#define configMAC_ADDR3 0x10
|
||||
#define configMAC_ADDR4 0x15
|
||||
#define configMAC_ADDR5 0x11
|
||||
|
||||
/* IP address configuration. */
|
||||
#define configIP_ADDR0 192
|
||||
#define configIP_ADDR1 168
|
||||
#define configIP_ADDR2 0
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* Gateway IP address configuration. */
|
||||
#define configGW_IP_ADDR0 192
|
||||
#define configGW_IP_ADDR1 168
|
||||
#define configGW_IP_ADDR2 0
|
||||
#define configGW_IP_ADDR3 3
|
||||
|
||||
/* Netmask configuration. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 255
|
||||
#define configNET_MASK2 255
|
||||
#define configNET_MASK3 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
160
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/ParTest.c
Normal file
160
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/ParTest.c
Normal file
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Simple digital IO routines.
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Demo application includes. */
|
||||
#include "partest.h"
|
||||
|
||||
/* Library includes. */
|
||||
#include "xgpio.h"
|
||||
|
||||
/* The hardware design that accompanies this demo project has four LED
|
||||
outputs. */
|
||||
#define partstMAX_LED 4
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* A hardware specific constant required to use the Xilinx driver library. */
|
||||
static const unsigned portBASE_TYPE uxGPIOOutputChannel = 1UL;
|
||||
|
||||
/* The current state of the output port. */
|
||||
static unsigned char ucGPIOState = 0U;
|
||||
|
||||
/* Structure that hold the state of the ouptut peripheral used by this demo.
|
||||
This is used by the Xilinx peripheral driver API functions. */
|
||||
static XGpio xOutputGPIOInstance;
|
||||
|
||||
/*
|
||||
* Setup the IO for the LED outputs.
|
||||
*/
|
||||
void vParTestInitialise( void )
|
||||
{
|
||||
portBASE_TYPE xStatus;
|
||||
const unsigned char ucSetToOutput = 0U;
|
||||
|
||||
/* Initialise the GPIO for the LEDs. */
|
||||
xStatus = XGpio_Initialize( &xOutputGPIOInstance, XPAR_LEDS_4BITS_DEVICE_ID );
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* All bits on this channel are going to be outputs (LEDs). */
|
||||
XGpio_SetDataDirection( &xOutputGPIOInstance, uxGPIOOutputChannel, ucSetToOutput );
|
||||
|
||||
/* Start with all LEDs off. */
|
||||
ucGPIOState = 0U;
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
|
||||
configASSERT( xStatus == XST_SUCCESS );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||
{
|
||||
unsigned char ucLED = 1U;
|
||||
|
||||
/* Only attempt to set the LED if it is in range. */
|
||||
if( uxLED < partstMAX_LED )
|
||||
{
|
||||
ucLED <<= ( unsigned char ) uxLED;
|
||||
|
||||
portENTER_CRITICAL();
|
||||
{
|
||||
if( xValue == pdFALSE )
|
||||
{
|
||||
ucGPIOState &= ~ucLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucGPIOState |= ucLED;
|
||||
}
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
portEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||
{
|
||||
unsigned char ucLED = 1U;
|
||||
|
||||
/* Only attempt to toggle the LED if it is in range. */
|
||||
if( uxLED < partstMAX_LED )
|
||||
{
|
||||
ucLED <<= ( unsigned char ) uxLED;
|
||||
|
||||
portENTER_CRITICAL();
|
||||
{
|
||||
if( ( ucGPIOState & ucLED ) != 0 )
|
||||
{
|
||||
ucGPIOState &= ~ucLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucGPIOState |= ucLED;
|
||||
}
|
||||
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, uxGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
portEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/*
|
||||
* The register test task as described in the comments at the top of main-full.c.
|
||||
*/
|
||||
void vRegisterTest1( void *pvParameters );
|
||||
void vRegisterTest2( void *pvParameters );
|
||||
|
||||
/* Variables that are incremented on each iteration of the reg test tasks -
|
||||
provided the tasks have not reported any errors. The check timer inspects these
|
||||
variables to ensure they are still incrementing as expected. If a variable
|
||||
stops incrementing then it is likely that its associate task has stalled or
|
||||
detected an error. */
|
||||
volatile unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vRegisterTest1( void *pvParameters )
|
||||
{
|
||||
/* This task uses an infinite loop that is implemented in the assembly
|
||||
code.
|
||||
|
||||
First fill the relevant registers with known values. */
|
||||
asm volatile ( " addi r3, r0, 3 \n\t" \
|
||||
" addi r4, r0, 4 \n\t" \
|
||||
" addi r6, r0, 6 \n\t" \
|
||||
" addi r7, r0, 7 \n\t" \
|
||||
" addi r8, r0, 8 \n\t" \
|
||||
" addi r9, r0, 9 \n\t" \
|
||||
" addi r10, r0, 10 \n\t" \
|
||||
" addi r11, r0, 11 \n\t" \
|
||||
" addi r12, r0, 12 \n\t" \
|
||||
" addi r16, r0, 16 \n\t" \
|
||||
" addi r19, r0, 19 \n\t" \
|
||||
" addi r20, r0, 20 \n\t" \
|
||||
" addi r21, r0, 21 \n\t" \
|
||||
" addi r22, r0, 22 \n\t" \
|
||||
" addi r23, r0, 23 \n\t" \
|
||||
" addi r24, r0, 24 \n\t" \
|
||||
" addi r25, r0, 25 \n\t" \
|
||||
" addi r26, r0, 26 \n\t" \
|
||||
" addi r27, r0, 27 \n\t" \
|
||||
" addi r28, r0, 28 \n\t" \
|
||||
" addi r29, r0, 29 \n\t" \
|
||||
" addi r30, r0, 30 \n\t" \
|
||||
" addi r31, r0, 31 \n\t"
|
||||
);
|
||||
|
||||
/* Now test the register values to ensure they contain the same value that
|
||||
was written to them above. This task will get preempted frequently so
|
||||
other tasks are likely to have executed since the register values were
|
||||
written. If any register contains an unexpected value then the task will
|
||||
branch to Error_Loop_1, which in turn prevents it from incrementing its
|
||||
loop counter, enabling the check timer to determine that all is not as it
|
||||
should be. */
|
||||
|
||||
asm volatile ( "Loop_Start_1: \n\t" \
|
||||
" xori r18, r3, 3 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r4, 4 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r6, 6 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r7, 7 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r8, 8 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r9, 9 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r10, 10 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r11, 11 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r12, 12 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r16, 16 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r19, 19 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r20, 20 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r21, 21 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r22, 22 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r23, 23 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r24, 24 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r25, 25 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r26, 26 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r27, 27 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r28, 28 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r29, 29 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r30, 30 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t" \
|
||||
" xori r18, r31, 31 \n\t" \
|
||||
" bnei r18, Error_Loop_1 \n\t"
|
||||
);
|
||||
|
||||
/* If this task has not branched to the error loop, then everything is ok,
|
||||
and the check variable can be incremented to indicate that this task
|
||||
is still running. Then, brach back to the top to check the register
|
||||
contents again. */
|
||||
asm volatile ( " lwi r18, r0, ulRegTest1CycleCount \n\t" \
|
||||
" addik r18, r18, 1 \n\t" \
|
||||
" swi r18, r0, ulRegTest1CycleCount \n\t" \
|
||||
" \n\t" \
|
||||
" bri Loop_Start_1 "
|
||||
);
|
||||
|
||||
/* The test function will branch here if it discovers an error. This part
|
||||
of the code just sits in a NULL loop, which prevents the check variable
|
||||
incrementing any further to allow the check timer to recognize that this
|
||||
test has failed. */
|
||||
asm volatile ( "Error_Loop_1: \n\t" \
|
||||
" bri 0 \n\t" \
|
||||
" nop \n\t" \
|
||||
);
|
||||
|
||||
( void ) pvParameters;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vRegisterTest2( void *pvParameters )
|
||||
{
|
||||
/* This task uses an infinite loop that is implemented in the assembly
|
||||
code.
|
||||
|
||||
First fill the registers with known values. */
|
||||
asm volatile ( " addi r16, r0, 1016 \n\t" \
|
||||
" addi r19, r0, 1019 \n\t" \
|
||||
" addi r20, r0, 1020 \n\t" \
|
||||
" addi r21, r0, 1021 \n\t" \
|
||||
" addi r22, r0, 1022 \n\t" \
|
||||
" addi r23, r0, 1023 \n\t" \
|
||||
" addi r24, r0, 1024 \n\t" \
|
||||
" addi r25, r0, 1025 \n\t" \
|
||||
" addi r26, r0, 1026 \n\t" \
|
||||
" addi r27, r0, 1027 \n\t" \
|
||||
" addi r28, r0, 1028 \n\t" \
|
||||
" addi r29, r0, 1029 \n\t" \
|
||||
" addi r30, r0, 1030 \n\t" \
|
||||
" addi r31, r0, 1031 \n\t" \
|
||||
" " \
|
||||
"Loop_Start_2: "
|
||||
);
|
||||
|
||||
/* Unlike vRegisterTest1, vRegisterTest2 performs a yield. This increases
|
||||
the test coverage, but does mean volatile registers need re-loading with
|
||||
their exepcted values. */
|
||||
taskYIELD();
|
||||
|
||||
/* taskYIELD() could have changed temporaries - set them back to those
|
||||
expected by the reg test task. */
|
||||
asm volatile ( " addi r3, r0, 103 \n\t" \
|
||||
" addi r4, r0, 104 \n\t" \
|
||||
" addi r6, r0, 106 \n\t" \
|
||||
" addi r7, r0, 107 \n\t" \
|
||||
" addi r8, r0, 108 \n\t" \
|
||||
" addi r9, r0, 109 \n\t" \
|
||||
" addi r10, r0, 1010 \n\t" \
|
||||
" addi r11, r0, 1011 \n\t" \
|
||||
" addi r12, r0, 1012 \n\t" \
|
||||
);
|
||||
|
||||
|
||||
/* Now test the register values to ensure they contain the same value that
|
||||
was written to them above. This task will get preempted frequently so
|
||||
other tasks are likely to have executed since the register values were
|
||||
written. */
|
||||
asm volatile ( " xori r18, r3, 103 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r4, 104 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r6, 106 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r7, 107 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r8, 108 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r9, 109 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r10, 1010 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r11, 1011 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r12, 1012 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r16, 1016 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r19, 1019 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r20, 1020 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r21, 1021 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r22, 1022 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r23, 1023 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r24, 1024 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r25, 1025 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r26, 1026 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r27, 1027 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r28, 1028 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r29, 1029 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r30, 1030 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t" \
|
||||
" xori r18, r31, 1031 \n\t" \
|
||||
" bnei r18, Error_Loop_2 \n\t"
|
||||
);
|
||||
|
||||
/* If this task has not branched to the error loop, then everything is ok,
|
||||
and the check variable should be incremented to indicate that this task
|
||||
is still running. Then, brach back to the top to check the registers
|
||||
again. */
|
||||
asm volatile ( " lwi r18, r0, ulRegTest2CycleCount \n\t" \
|
||||
" addik r18, r18, 1 \n\t" \
|
||||
" swi r18, r0, ulRegTest2CycleCount \n\t" \
|
||||
" \n\t" \
|
||||
" bri Loop_Start_2 "
|
||||
);
|
||||
|
||||
/* The test function will branch here if it discovers an error. This part
|
||||
of the code just sits in a NULL loop, which prevents the check variable
|
||||
incrementing any further to allow the check timer to recognize that this
|
||||
test has failed. */
|
||||
asm volatile ( "Error_Loop_2: \n\t" \
|
||||
" bri 0 \n\t" \
|
||||
" nop \n\t" \
|
||||
);
|
||||
|
||||
( void ) pvParameters;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/def.h"
|
||||
#include "fs.h"
|
||||
#include "fsdata.h"
|
||||
#include <string.h>
|
||||
|
||||
/** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the
|
||||
* file system (to prevent changing the file included in CVS) */
|
||||
#ifndef HTTPD_USE_CUSTUM_FSDATA
|
||||
#define HTTPD_USE_CUSTUM_FSDATA 0
|
||||
#endif
|
||||
|
||||
#if HTTPD_USE_CUSTUM_FSDATA
|
||||
#include "fsdata_custom.c"
|
||||
#else /* HTTPD_USE_CUSTUM_FSDATA */
|
||||
#include "fsdata.c"
|
||||
#endif /* HTTPD_USE_CUSTUM_FSDATA */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Define the number of open files that we can support. */
|
||||
#ifndef LWIP_MAX_OPEN_FILES
|
||||
#define LWIP_MAX_OPEN_FILES 10
|
||||
#endif
|
||||
|
||||
/* Define the file system memory allocation structure. */
|
||||
struct fs_table {
|
||||
struct fs_file file;
|
||||
u8_t inuse;
|
||||
};
|
||||
|
||||
/* Allocate file system memory */
|
||||
struct fs_table fs_memory[LWIP_MAX_OPEN_FILES];
|
||||
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
int fs_open_custom(struct fs_file *file, const char *name);
|
||||
void fs_close_custom(struct fs_file *file);
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static struct fs_file *
|
||||
fs_malloc(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < LWIP_MAX_OPEN_FILES; i++) {
|
||||
if(fs_memory[i].inuse == 0) {
|
||||
fs_memory[i].inuse = 1;
|
||||
return(&fs_memory[i].file);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
fs_free(struct fs_file *file)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < LWIP_MAX_OPEN_FILES; i++) {
|
||||
if(&fs_memory[i].file == file) {
|
||||
fs_memory[i].inuse = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct fs_file *
|
||||
fs_open(const char *name)
|
||||
{
|
||||
struct fs_file *file;
|
||||
const struct fsdata_file *f;
|
||||
|
||||
file = fs_malloc();
|
||||
if(file == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if(fs_open_custom(file, name)) {
|
||||
file->is_custom_file = 1;
|
||||
return file;
|
||||
}
|
||||
file->is_custom_file = 0;
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
|
||||
for(f = FS_ROOT; f != NULL; f = f->next) {
|
||||
if (!strcmp(name, (char *)f->name)) {
|
||||
file->data = (const char *)f->data;
|
||||
file->len = f->len;
|
||||
file->index = f->len;
|
||||
file->pextension = NULL;
|
||||
file->http_header_included = f->http_header_included;
|
||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||
file->chksum_count = f->chksum_count;
|
||||
file->chksum = f->chksum;
|
||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
file->state = fs_state_init(file, name);
|
||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||
return file;
|
||||
}
|
||||
}
|
||||
fs_free(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
fs_close(struct fs_file *file)
|
||||
{
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if (file->is_custom_file) {
|
||||
fs_close_custom(file);
|
||||
}
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
fs_state_free(file, file->state);
|
||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||
fs_free(file);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
fs_read(struct fs_file *file, char *buffer, int count)
|
||||
{
|
||||
int read;
|
||||
|
||||
if(file->index == file->len) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
read = file->len - file->index;
|
||||
if(read > count) {
|
||||
read = count;
|
||||
}
|
||||
|
||||
MEMCPY(buffer, (file->data + file->index), read);
|
||||
file->index += read;
|
||||
|
||||
return(read);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int fs_bytes_left(struct fs_file *file)
|
||||
{
|
||||
return file->len - file->index;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __FS_H__
|
||||
#define __FS_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
/** Set this to 1 and provide the functions:
|
||||
* - "int fs_open_custom(struct fs_file *file, const char *name)"
|
||||
* Called first for every opened file to allow opening files
|
||||
* that are not included in fsdata(_custom).c
|
||||
* - "void fs_close_custom(struct fs_file *file)"
|
||||
* Called to free resources allocated by fs_open_custom().
|
||||
*/
|
||||
#ifndef LWIP_HTTPD_CUSTOM_FILES
|
||||
#define LWIP_HTTPD_CUSTOM_FILES 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to include an application state argument per file
|
||||
* that is opened. This allows to keep a state per connection/file.
|
||||
*/
|
||||
#ifndef LWIP_HTTPD_FILE_STATE
|
||||
#define LWIP_HTTPD_FILE_STATE 0
|
||||
#endif
|
||||
|
||||
/** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for
|
||||
* predefined (MSS-sized) chunks of the files to prevent having to calculate
|
||||
* the checksums at runtime. */
|
||||
#ifndef HTTPD_PRECALCULATED_CHECKSUM
|
||||
#define HTTPD_PRECALCULATED_CHECKSUM 0
|
||||
#endif
|
||||
|
||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||
struct fsdata_chksum {
|
||||
u32_t offset;
|
||||
u16_t chksum;
|
||||
u16_t len;
|
||||
};
|
||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||
|
||||
struct fs_file {
|
||||
const char *data;
|
||||
int len;
|
||||
int index;
|
||||
void *pextension;
|
||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||
const struct fsdata_chksum *chksum;
|
||||
u16_t chksum_count;
|
||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||
u8_t http_header_included;
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
u8_t is_custom_file;
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
void *state;
|
||||
#endif /* LWIP_HTTPD_FILE_STATE */
|
||||
};
|
||||
|
||||
struct fs_file *fs_open(const char *name);
|
||||
void fs_close(struct fs_file *file);
|
||||
int fs_read(struct fs_file *file, char *buffer, int count);
|
||||
int fs_bytes_left(struct fs_file *file);
|
||||
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
/** This user-defined function is called when a file is opened. */
|
||||
void *fs_state_init(struct fs_file *file, const char *name);
|
||||
/** This user-defined function is called when a file is closed. */
|
||||
void fs_state_free(struct fs_file *file, void *state);
|
||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||
|
||||
#endif /* __FS_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __FSDATA_H__
|
||||
#define __FSDATA_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "fs.h"
|
||||
|
||||
struct fsdata_file {
|
||||
const struct fsdata_file *next;
|
||||
const unsigned char *name;
|
||||
const unsigned char *data;
|
||||
int len;
|
||||
u8_t http_header_included;
|
||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||
u16_t chksum_count;
|
||||
const struct fsdata_chksum *chksum;
|
||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||
};
|
||||
|
||||
#endif /* __FSDATA_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,236 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* This version of the file has been modified by Texas Instruments to offer
|
||||
* simple server-side-include (SSI) and Common Gateway Interface (CGI)
|
||||
* capability.
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_H__
|
||||
#define __HTTPD_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
|
||||
/** Set this to 1 to support CGI */
|
||||
#ifndef LWIP_HTTPD_CGI
|
||||
#define LWIP_HTTPD_CGI 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to support SSI (Server-Side-Includes) */
|
||||
#ifndef LWIP_HTTPD_SSI
|
||||
#define LWIP_HTTPD_SSI 1
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to support HTTP POST */
|
||||
#ifndef LWIP_HTTPD_SUPPORT_POST
|
||||
#define LWIP_HTTPD_SUPPORT_POST 0
|
||||
#endif
|
||||
|
||||
|
||||
#if LWIP_HTTPD_CGI
|
||||
|
||||
/*
|
||||
* Function pointer for a CGI script handler.
|
||||
*
|
||||
* This function is called each time the HTTPD server is asked for a file
|
||||
* whose name was previously registered as a CGI function using a call to
|
||||
* http_set_cgi_handler. The iIndex parameter provides the index of the
|
||||
* CGI within the ppcURLs array passed to http_set_cgi_handler. Parameters
|
||||
* pcParam and pcValue provide access to the parameters provided along with
|
||||
* the URI. iNumParams provides a count of the entries in the pcParam and
|
||||
* pcValue arrays. Each entry in the pcParam array contains the name of a
|
||||
* parameter with the corresponding entry in the pcValue array containing the
|
||||
* value for that parameter. Note that pcParam may contain multiple elements
|
||||
* with the same name if, for example, a multi-selection list control is used
|
||||
* in the form generating the data.
|
||||
*
|
||||
* The function should return a pointer to a character string which is the
|
||||
* path and filename of the response that is to be sent to the connected
|
||||
* browser, for example "/thanks.htm" or "/response/error.ssi".
|
||||
*
|
||||
* The maximum number of parameters that will be passed to this function via
|
||||
* iNumParams is defined by LWIP_HTTPD_MAX_CGI_PARAMETERS. Any parameters in the incoming
|
||||
* HTTP request above this number will be discarded.
|
||||
*
|
||||
* Requests intended for use by this CGI mechanism must be sent using the GET
|
||||
* method (which encodes all parameters within the URI rather than in a block
|
||||
* later in the request). Attempts to use the POST method will result in the
|
||||
* request being ignored.
|
||||
*
|
||||
*/
|
||||
typedef const char *(*tCGIHandler)(int iIndex, int iNumParams, char *pcParam[],
|
||||
char *pcValue[]);
|
||||
|
||||
/*
|
||||
* Structure defining the base filename (URL) of a CGI and the associated
|
||||
* function which is to be called when that URL is requested.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *pcCGIName;
|
||||
tCGIHandler pfnCGIHandler;
|
||||
} tCGI;
|
||||
|
||||
void http_set_cgi_handlers(const tCGI *pCGIs, int iNumHandlers);
|
||||
|
||||
|
||||
/* The maximum number of parameters that the CGI handler can be sent. */
|
||||
#ifndef LWIP_HTTPD_MAX_CGI_PARAMETERS
|
||||
#define LWIP_HTTPD_MAX_CGI_PARAMETERS 16
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HTTPD_CGI */
|
||||
|
||||
#if LWIP_HTTPD_SSI
|
||||
|
||||
/** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more
|
||||
* arguments indicating a counter for insert string that are too long to be
|
||||
* inserted at once: the SSI handler function must then set 'next_tag_part'
|
||||
* which will be passed back to it in the next call. */
|
||||
#ifndef LWIP_HTTPD_SSI_MULTIPART
|
||||
#define LWIP_HTTPD_SSI_MULTIPART 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function pointer for the SSI tag handler callback.
|
||||
*
|
||||
* This function will be called each time the HTTPD server detects a tag of the
|
||||
* form <!--#name--> in a .shtml, .ssi or .shtm file where "name" appears as
|
||||
* one of the tags supplied to http_set_ssi_handler in the ppcTags array. The
|
||||
* returned insert string, which will be appended after the the string
|
||||
* "<!--#name-->" in file sent back to the client,should be written to pointer
|
||||
* pcInsert. iInsertLen contains the size of the buffer pointed to by
|
||||
* pcInsert. The iIndex parameter provides the zero-based index of the tag as
|
||||
* found in the ppcTags array and identifies the tag that is to be processed.
|
||||
*
|
||||
* The handler returns the number of characters written to pcInsert excluding
|
||||
* any terminating NULL or a negative number to indicate a failure (tag not
|
||||
* recognized, for example).
|
||||
*
|
||||
* Note that the behavior of this SSI mechanism is somewhat different from the
|
||||
* "normal" SSI processing as found in, for example, the Apache web server. In
|
||||
* this case, the inserted text is appended following the SSI tag rather than
|
||||
* replacing the tag entirely. This allows for an implementation that does not
|
||||
* require significant additional buffering of output data yet which will still
|
||||
* offer usable SSI functionality. One downside to this approach is when
|
||||
* attempting to use SSI within JavaScript. The SSI tag is structured to
|
||||
* resemble an HTML comment but this syntax does not constitute a comment
|
||||
* within JavaScript and, hence, leaving the tag in place will result in
|
||||
* problems in these cases. To work around this, any SSI tag which needs to
|
||||
* output JavaScript code must do so in an encapsulated way, sending the whole
|
||||
* HTML <script>...</script> section as a single include.
|
||||
*/
|
||||
typedef u16_t (*tSSIHandler)(int iIndex, char *pcInsert, int iInsertLen
|
||||
#if LWIP_HTTPD_SSI_MULTIPART
|
||||
, u16_t current_tag_part, u16_t *next_tag_part
|
||||
#endif /* LWIP_HTTPD_SSI_MULTIPART */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
, void *connection_state
|
||||
#endif /* LWIP_HTTPD_FILE_STATE */
|
||||
);
|
||||
|
||||
void http_set_ssi_handler(tSSIHandler pfnSSIHandler,
|
||||
const char **ppcTags, int iNumTags);
|
||||
|
||||
/* The maximum length of the string comprising the tag name */
|
||||
#ifndef LWIP_HTTPD_MAX_TAG_NAME_LEN
|
||||
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 8
|
||||
#endif
|
||||
|
||||
/* The maximum length of string that can be returned to replace any given tag */
|
||||
#ifndef LWIP_HTTPD_MAX_TAG_INSERT_LEN
|
||||
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HTTPD_SSI */
|
||||
|
||||
#if LWIP_HTTPD_SUPPORT_POST
|
||||
|
||||
/* These functions must be implemented by the application */
|
||||
|
||||
/** Called when a POST request has been received. The application can decide
|
||||
* whether to accept it or not.
|
||||
*
|
||||
* @param connection Unique connection identifier, valid until httpd_post_end
|
||||
* is called.
|
||||
* @param uri The HTTP header URI receiving the POST request.
|
||||
* @param http_request The raw HTTP request (the first packet, normally).
|
||||
* @param http_request_len Size of 'http_request'.
|
||||
* @param content_len Content-Length from HTTP header.
|
||||
* @param response_uri Filename of response file, to be filled when denying the
|
||||
* request
|
||||
* @param response_uri_len Size of the 'response_uri' buffer.
|
||||
* @param post_auto_wnd Set this to 0 to let the callback code handle window
|
||||
* updates by calling 'httpd_post_data_recved' (to throttle rx speed)
|
||||
* default is 1 (httpd handles window updates automatically)
|
||||
* @return ERR_OK: Accept the POST request, data may be passed in
|
||||
* another err_t: Deny the POST request, send back 'bad request'.
|
||||
*/
|
||||
err_t httpd_post_begin(void *connection, const char *uri, const char *http_request,
|
||||
u16_t http_request_len, int content_len, char *response_uri,
|
||||
u16_t response_uri_len, u8_t *post_auto_wnd);
|
||||
|
||||
/** Called for each pbuf of data that has been received for a POST.
|
||||
* ATTENTION: The application is responsible for freeing the pbufs passed in!
|
||||
*
|
||||
* @param connection Unique connection identifier.
|
||||
* @param p Received data.
|
||||
* @return ERR_OK: Data accepted.
|
||||
* another err_t: Data denied, http_post_get_response_uri will be called.
|
||||
*/
|
||||
err_t httpd_post_receive_data(void *connection, struct pbuf *p);
|
||||
|
||||
/** Called when all data is received or when the connection is closed.
|
||||
* The application must return the filename/URI of a file to send in response
|
||||
* to this POST request. If the response_uri buffer is untouched, a 404
|
||||
* response is returned.
|
||||
*
|
||||
* @param connection Unique connection identifier.
|
||||
* @param response_uri Filename of response file, to be filled when denying the request
|
||||
* @param response_uri_len Size of the 'response_uri' buffer.
|
||||
*/
|
||||
void httpd_post_finished(void *connection, char *response_uri, u16_t response_uri_len);
|
||||
|
||||
#ifndef LWIP_HTTPD_POST_MANUAL_WND
|
||||
#define LWIP_HTTPD_POST_MANUAL_WND 0
|
||||
#endif
|
||||
|
||||
#if LWIP_HTTPD_POST_MANUAL_WND
|
||||
void httpd_post_data_recved(void *connection, u16_t recved_len);
|
||||
#endif /* LWIP_HTTPD_POST_MANUAL_WND */
|
||||
|
||||
#endif /* LWIP_HTTPD_SUPPORT_POST */
|
||||
|
||||
void httpd_init(void);
|
||||
|
||||
#endif /* __HTTPD_H__ */
|
|
@ -0,0 +1,115 @@
|
|||
#ifndef __HTTPD_STRUCTS_H__
|
||||
#define __HTTPD_STRUCTS_H__
|
||||
|
||||
#include "httpd.h"
|
||||
|
||||
/** This string is passed in the HTTP header as "Server: " */
|
||||
#ifndef HTTPD_SERVER_AGENT
|
||||
#define HTTPD_SERVER_AGENT "lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)"
|
||||
#endif
|
||||
|
||||
/** Set this to 1 if you want to include code that creates HTTP headers
|
||||
* at runtime. Default is off: HTTP headers are then created statically
|
||||
* by the makefsdata tool. Static headers mean smaller code size, but
|
||||
* the (readonly) fsdata will grow a bit as every file includes the HTTP
|
||||
* header. */
|
||||
#ifndef LWIP_HTTPD_DYNAMIC_HEADERS
|
||||
#define LWIP_HTTPD_DYNAMIC_HEADERS 0
|
||||
#endif
|
||||
|
||||
|
||||
#if LWIP_HTTPD_DYNAMIC_HEADERS
|
||||
/** This struct is used for a list of HTTP header strings for various
|
||||
* filename extensions. */
|
||||
typedef struct
|
||||
{
|
||||
const char *extension;
|
||||
int headerIndex;
|
||||
} tHTTPHeader;
|
||||
|
||||
/** A list of strings used in HTTP headers */
|
||||
static const char * const g_psHTTPHeaderStrings[] =
|
||||
{
|
||||
"Content-type: text/html\r\n\r\n",
|
||||
"Content-type: text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache\r\n\r\n",
|
||||
"Content-type: image/gif\r\n\r\n",
|
||||
"Content-type: image/png\r\n\r\n",
|
||||
"Content-type: image/jpeg\r\n\r\n",
|
||||
"Content-type: image/bmp\r\n\r\n",
|
||||
"Content-type: image/x-icon\r\n\r\n",
|
||||
"Content-type: application/octet-stream\r\n\r\n",
|
||||
"Content-type: application/x-javascript\r\n\r\n",
|
||||
"Content-type: application/x-javascript\r\n\r\n",
|
||||
"Content-type: text/css\r\n\r\n",
|
||||
"Content-type: application/x-shockwave-flash\r\n\r\n",
|
||||
"Content-type: text/xml\r\n\r\n",
|
||||
"Content-type: text/plain\r\n\r\n",
|
||||
"HTTP/1.0 200 OK\r\n",
|
||||
"HTTP/1.0 404 File not found\r\n",
|
||||
"HTTP/1.0 400 Bad Request\r\n",
|
||||
"HTTP/1.0 501 Not Implemented\r\n",
|
||||
"HTTP/1.1 200 OK\r\n",
|
||||
"HTTP/1.1 404 File not found\r\n",
|
||||
"HTTP/1.1 400 Bad Request\r\n",
|
||||
"HTTP/1.1 501 Not Implemented\r\n",
|
||||
"Content-Length: ",
|
||||
"Connection: Close\r\n",
|
||||
"Server: "HTTPD_SERVER_AGENT"\r\n",
|
||||
"\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
|
||||
};
|
||||
|
||||
/* Indexes into the g_psHTTPHeaderStrings array */
|
||||
#define HTTP_HDR_HTML 0 /* text/html */
|
||||
#define HTTP_HDR_SSI 1 /* text/html Expires... */
|
||||
#define HTTP_HDR_GIF 2 /* image/gif */
|
||||
#define HTTP_HDR_PNG 3 /* image/png */
|
||||
#define HTTP_HDR_JPG 4 /* image/jpeg */
|
||||
#define HTTP_HDR_BMP 5 /* image/bmp */
|
||||
#define HTTP_HDR_ICO 6 /* image/x-icon */
|
||||
#define HTTP_HDR_APP 7 /* application/octet-stream */
|
||||
#define HTTP_HDR_JS 8 /* application/x-javascript */
|
||||
#define HTTP_HDR_RA 9 /* application/x-javascript */
|
||||
#define HTTP_HDR_CSS 10 /* text/css */
|
||||
#define HTTP_HDR_SWF 11 /* application/x-shockwave-flash */
|
||||
#define HTTP_HDR_XML 12 /* text/xml */
|
||||
#define HTTP_HDR_DEFAULT_TYPE 13 /* text/plain */
|
||||
#define HTTP_HDR_OK 14 /* 200 OK */
|
||||
#define HTTP_HDR_NOT_FOUND 15 /* 404 File not found */
|
||||
#define HTTP_HDR_BAD_REQUEST 16 /* 400 Bad request */
|
||||
#define HTTP_HDR_NOT_IMPL 17 /* 501 Not Implemented */
|
||||
#define HTTP_HDR_OK_11 18 /* 200 OK */
|
||||
#define HTTP_HDR_NOT_FOUND_11 19 /* 404 File not found */
|
||||
#define HTTP_HDR_BAD_REQUEST_11 20 /* 400 Bad request */
|
||||
#define HTTP_HDR_NOT_IMPL_11 21 /* 501 Not Implemented */
|
||||
#define HTTP_HDR_CONTENT_LENGTH 22 /* Content-Length: (HTTP 1.1)*/
|
||||
#define HTTP_HDR_CONN_CLOSE 23 /* Connection: Close (HTTP 1.1) */
|
||||
#define HTTP_HDR_SERVER 24 /* Server: HTTPD_SERVER_AGENT */
|
||||
#define DEFAULT_404_HTML 25 /* default 404 body */
|
||||
|
||||
/** A list of extension-to-HTTP header strings */
|
||||
const static tHTTPHeader g_psHTTPHeaders[] =
|
||||
{
|
||||
{ "html", HTTP_HDR_HTML},
|
||||
{ "htm", HTTP_HDR_HTML},
|
||||
{ "shtml",HTTP_HDR_SSI},
|
||||
{ "shtm", HTTP_HDR_SSI},
|
||||
{ "ssi", HTTP_HDR_SSI},
|
||||
{ "gif", HTTP_HDR_GIF},
|
||||
{ "png", HTTP_HDR_PNG},
|
||||
{ "jpg", HTTP_HDR_JPG},
|
||||
{ "bmp", HTTP_HDR_BMP},
|
||||
{ "ico", HTTP_HDR_ICO},
|
||||
{ "class",HTTP_HDR_APP},
|
||||
{ "cls", HTTP_HDR_APP},
|
||||
{ "js", HTTP_HDR_JS},
|
||||
{ "ram", HTTP_HDR_RA},
|
||||
{ "css", HTTP_HDR_CSS},
|
||||
{ "swf", HTTP_HDR_SWF},
|
||||
{ "xml", HTTP_HDR_XML}
|
||||
};
|
||||
|
||||
#define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader))
|
||||
|
||||
#endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
|
||||
|
||||
#endif /* __HTTPD_STRUCTS_H__ */
|
|
@ -0,0 +1,21 @@
|
|||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack</title></head>
|
||||
<body bgcolor="white" text="black">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top"><td width="80">
|
||||
<a href="http://www.sics.se/"><img src="/img/sics.gif"
|
||||
border="0" alt="SICS logo" title="SICS logo"></a>
|
||||
</td><td width="500">
|
||||
<h1>lwIP - A Lightweight TCP/IP Stack</h1>
|
||||
<h2>404 - Page not found</h2>
|
||||
<p>
|
||||
Sorry, the page you are requesting was not found on this
|
||||
server.
|
||||
</p>
|
||||
</td><td>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>FreeRTOS.org uIP WEB server demo</title>
|
||||
</head>
|
||||
<BODY onLoad="window.setTimeout("location.href='index.shtml'",2000)">
|
||||
<font face="arial">
|
||||
<a href="index.shtml">Task Stats</a> <b>|</b> <a href="runtime.shtml">Run Time Stats</a> <b>|</b> <a href="stats.shtml">TCP Stats</a> <b>|</b> <a href="tcp.shtml">Connections</a> <b>|</b> <a href="http://www.freertos.org/">FreeRTOS Homepage</a> <b>|</b> <a href="io.shtml">IO</a> <b>|</b> <a href="logo.jpg">37K jpg</a>
|
||||
<br><p>
|
||||
<hr>
|
||||
<br><p>
|
||||
<h2>Task statistics</h2>
|
||||
Page will refresh every 2 seconds.<p>
|
||||
<font face="courier"><pre>Task State Priority Stack #<br>************************************************<br>
|
||||
<!--#rtos_stats-->
|
||||
</pre></font>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>FreeRTOS.org uIP WEB server demo</title>
|
||||
</head>
|
||||
<BODY onLoad="window.setTimeout("location.href='runtime.shtml'",2000)">
|
||||
<font face="arial">
|
||||
<a href="index.shtml">Task Stats</a> <b>|</b> <a href="runtime.shtml">Run Time Stats</a> <b>|</b> <a href="stats.shtml">TCP Stats</a> <b>|</b> <a href="tcp.shtml">Connections</a> <b>|</b> <a href="http://www.freertos.org/">FreeRTOS Homepage</a> <b>|</b> <a href="io.shtml">IO</a> <b>|</b> <a href="logo.jpg">37K jpg</a>
|
||||
<br><p>
|
||||
<hr>
|
||||
<br><p>
|
||||
<h2>Run-time statistics</h2>
|
||||
Page will refresh every 2 seconds.<p>
|
||||
<font face="courier"><pre>Task Abs Time % Time<br>****************************************<br>
|
||||
<!--#run_stats-->
|
||||
</pre></font>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,610 @@
|
|||
/**
|
||||
* makefsdata: Converts a directory structure for use with the lwIP httpd.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Jim Pettinato
|
||||
* Simon Goldschmidt
|
||||
*
|
||||
* @todo:
|
||||
* - take TCP_MSS, LWIP_TCP_TIMESTAMPS and
|
||||
* PAYLOAD_ALIGN_TYPE/PAYLOAD_ALIGNMENT as arguments
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "windows.h"
|
||||
#else
|
||||
#include <dir.h>
|
||||
#endif
|
||||
#include <dos.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Compatibility defines Win32 vs. DOS */
|
||||
#ifdef WIN32
|
||||
|
||||
#define FIND_T WIN32_FIND_DATAA
|
||||
#define FIND_T_FILENAME(fInfo) (fInfo.cFileName)
|
||||
#define FIND_T_IS_DIR(fInfo) ((fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
||||
#define FIND_T_IS_FILE(fInfo) ((fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
#define FIND_RET_T HANDLE
|
||||
#define FINDFIRST_FILE(path, result) FindFirstFileA(path, result)
|
||||
#define FINDFIRST_DIR(path, result) FindFirstFileA(path, result)
|
||||
#define FINDNEXT(ff_res, result) FindNextFileA(ff_res, result)
|
||||
#define FINDFIRST_SUCCEEDED(ret) (ret != INVALID_HANDLE_VALUE)
|
||||
#define FINDNEXT_SUCCEEDED(ret) (ret == TRUE)
|
||||
|
||||
#define GETCWD(path, len) GetCurrentDirectoryA(len, path)
|
||||
#define CHDIR(path) SetCurrentDirectoryA(path)
|
||||
|
||||
#define NEWLINE "\r\n"
|
||||
#define NEWLINE_LEN 2
|
||||
|
||||
#else
|
||||
|
||||
#define FIND_T struct fflbk
|
||||
#define FIND_T_FILENAME(fInfo) (fInfo.ff_name)
|
||||
#define FIND_T_IS_DIR(fInfo) ((fInfo.ff_attrib & FA_DIREC) == FA_DIREC)
|
||||
#define FIND_T_IS_FILE(fInfo) (1)
|
||||
#define FIND_RET_T int
|
||||
#define FINDFIRST_FILE(path, result) findfirst(path, result, FA_ARCH)
|
||||
#define FINDFIRST_DIR(path, result) findfirst(path, result, FA_DIREC)
|
||||
#define FINDNEXT(ff_res, result) FindNextFileA(ff_res, result)
|
||||
#define FINDFIRST_SUCCEEDED(ret) (ret == 0)
|
||||
#define FINDNEXT_SUCCEEDED(ret) (ret == 0)
|
||||
|
||||
#define GETCWD(path, len) getcwd(path, len)
|
||||
#define CHDIR(path) chdir(path)
|
||||
|
||||
#endif
|
||||
|
||||
/* define this to get the header variables we use to build HTTP headers */
|
||||
#define LWIP_HTTPD_DYNAMIC_HEADERS 1
|
||||
#include "../httpd_structs.h"
|
||||
|
||||
#include "../../../lwip-1.4.0/src/core/ipv4/inet_chksum.c"
|
||||
#include "../../../lwip-1.4.0/src/core/def.c"
|
||||
|
||||
/** (Your server name here) */
|
||||
const char *serverID = "Server: "HTTPD_SERVER_AGENT"\r\n";
|
||||
|
||||
/* change this to suit your MEM_ALIGNMENT */
|
||||
#define PAYLOAD_ALIGNMENT 4
|
||||
/* set this to 0 to prevent aligning payload */
|
||||
#define ALIGN_PAYLOAD 1
|
||||
/* define this to a type that has the required alignment */
|
||||
#define PAYLOAD_ALIGN_TYPE "unsigned int"
|
||||
static int payload_alingment_dummy_counter = 0;
|
||||
|
||||
#define HEX_BYTES_PER_LINE 16
|
||||
|
||||
#define MAX_PATH_LEN 256
|
||||
|
||||
#define COPY_BUFSIZE 10240
|
||||
|
||||
int process_sub(FILE *data_file, FILE *struct_file);
|
||||
int process_file(FILE *data_file, FILE *struct_file, const char *filename);
|
||||
int file_write_http_header(FILE *data_file, const char *filename, int file_size,
|
||||
u16_t *http_hdr_len, u16_t *http_hdr_chksum);
|
||||
int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i);
|
||||
int s_put_ascii(char *buf, const char *ascii_string, int len, int *i);
|
||||
void concat_files(const char *file1, const char *file2, const char *targetfile);
|
||||
|
||||
static unsigned char file_buffer_raw[COPY_BUFSIZE];
|
||||
/* 5 bytes per char + 3 bytes per line */
|
||||
static char file_buffer_c[COPY_BUFSIZE * 5 + ((COPY_BUFSIZE / HEX_BYTES_PER_LINE) * 3)];
|
||||
|
||||
char curSubdir[MAX_PATH_LEN];
|
||||
char lastFileVar[MAX_PATH_LEN];
|
||||
char hdr_buf[4096];
|
||||
|
||||
unsigned char processSubs = 1;
|
||||
unsigned char includeHttpHeader = 1;
|
||||
unsigned char useHttp11 = 0;
|
||||
unsigned char precalcChksum = 0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FIND_T fInfo;
|
||||
FIND_RET_T fret;
|
||||
char path[MAX_PATH_LEN];
|
||||
char appPath[MAX_PATH_LEN];
|
||||
FILE *data_file;
|
||||
FILE *struct_file;
|
||||
int filesProcessed;
|
||||
int i;
|
||||
char targetfile[MAX_PATH_LEN];
|
||||
strcpy(targetfile, "fsdata.c");
|
||||
|
||||
memset(path, 0, sizeof(path));
|
||||
memset(appPath, 0, sizeof(appPath));
|
||||
|
||||
printf(NEWLINE " makefsdata - HTML to C source converter" NEWLINE);
|
||||
printf(" by Jim Pettinato - circa 2003 " NEWLINE);
|
||||
printf(" extended by Simon Goldschmidt - 2009 " NEWLINE NEWLINE);
|
||||
|
||||
strcpy(path, "fs");
|
||||
for(i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
if (strstr(argv[i], "-s")) {
|
||||
processSubs = 0;
|
||||
} else if (strstr(argv[i], "-e")) {
|
||||
includeHttpHeader = 0;
|
||||
} else if (strstr(argv[i], "-11")) {
|
||||
useHttp11 = 1;
|
||||
} else if (strstr(argv[i], "-c")) {
|
||||
precalcChksum = 1;
|
||||
} else if((argv[i][1] == 'f') && (argv[i][2] == ':')) {
|
||||
strcpy(targetfile, &argv[i][3]);
|
||||
printf("Writing to file \"%s\"\n", targetfile);
|
||||
}
|
||||
} else {
|
||||
strcpy(path, argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* if command line param or subdir named 'fs' not found spout usage verbiage */
|
||||
fret = FINDFIRST_DIR(path, &fInfo);
|
||||
if (!FINDFIRST_SUCCEEDED(fret)) {
|
||||
/* if no subdir named 'fs' (or the one which was given) exists, spout usage verbiage */
|
||||
printf(" Failed to open directory \"%s\"." NEWLINE NEWLINE, path);
|
||||
printf(" Usage: htmlgen [targetdir] [-s] [-i] [-f:<filename>]" NEWLINE NEWLINE);
|
||||
printf(" targetdir: relative or absolute path to files to convert" NEWLINE);
|
||||
printf(" switch -s: toggle processing of subdirectories (default is on)" NEWLINE);
|
||||
printf(" switch -e: exclude HTTP header from file (header is created at runtime, default is off)" NEWLINE);
|
||||
printf(" switch -11: include HTTP 1.1 header (1.0 is default)" NEWLINE);
|
||||
printf(" switch -c: precalculate checksums for all pages (default is off)" NEWLINE);
|
||||
printf(" switch -f: target filename (default is \"fsdata.c\")" NEWLINE);
|
||||
printf(" if targetdir not specified, htmlgen will attempt to" NEWLINE);
|
||||
printf(" process files in subdirectory 'fs'" NEWLINE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("HTTP %sheader will %s statically included." NEWLINE,
|
||||
(includeHttpHeader ? (useHttp11 ? "1.1 " : "1.0 ") : ""),
|
||||
(includeHttpHeader ? "be" : "not be"));
|
||||
|
||||
sprintf(curSubdir, ""); /* start off in web page's root directory - relative paths */
|
||||
printf(" Processing all files in directory %s", path);
|
||||
if (processSubs) {
|
||||
printf(" and subdirectories..." NEWLINE NEWLINE);
|
||||
} else {
|
||||
printf("..." NEWLINE NEWLINE);
|
||||
}
|
||||
|
||||
GETCWD(appPath, MAX_PATH_LEN);
|
||||
data_file = fopen("fsdata.tmp", "wb");
|
||||
if (data_file == NULL) {
|
||||
printf("Failed to create file \"fsdata.tmp\"\n");
|
||||
exit(-1);
|
||||
}
|
||||
struct_file = fopen("fshdr.tmp", "wb");
|
||||
if (struct_file == NULL) {
|
||||
printf("Failed to create file \"fshdr.tmp\"\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
CHDIR(path);
|
||||
|
||||
fprintf(data_file, "#include \"fs.h\"" NEWLINE);
|
||||
fprintf(data_file, "#include \"lwip/def.h\"" NEWLINE);
|
||||
fprintf(data_file, "#include \"fsdata.h\"" NEWLINE NEWLINE NEWLINE);
|
||||
|
||||
fprintf(data_file, "#define file_NULL (struct fsdata_file *) NULL" NEWLINE NEWLINE NEWLINE);
|
||||
|
||||
sprintf(lastFileVar, "NULL");
|
||||
|
||||
filesProcessed = process_sub(data_file, struct_file);
|
||||
|
||||
/* data_file now contains all of the raw data.. now append linked list of
|
||||
* file header structs to allow embedded app to search for a file name */
|
||||
fprintf(data_file, NEWLINE NEWLINE);
|
||||
fprintf(struct_file, "#define FS_ROOT file_%s" NEWLINE, lastFileVar);
|
||||
fprintf(struct_file, "#define FS_NUMFILES %d" NEWLINE NEWLINE, filesProcessed);
|
||||
|
||||
fclose(data_file);
|
||||
fclose(struct_file);
|
||||
|
||||
CHDIR(appPath);
|
||||
/* append struct_file to data_file */
|
||||
printf(NEWLINE "Creating target file..." NEWLINE NEWLINE);
|
||||
concat_files("fsdata.tmp", "fshdr.tmp", targetfile);
|
||||
|
||||
/* if succeeded, delete the temporary files */
|
||||
remove("fsdata.tmp");
|
||||
remove("fshdr.tmp");
|
||||
|
||||
printf(NEWLINE "Processed %d files - done." NEWLINE NEWLINE, filesProcessed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void copy_file(const char *filename_in, FILE *fout)
|
||||
{
|
||||
FILE *fin;
|
||||
size_t len;
|
||||
fin = fopen(filename_in, "rb");
|
||||
if (fin == NULL) {
|
||||
printf("Failed to open file \"%s\"\n", filename_in);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
while((len = fread(file_buffer_raw, 1, COPY_BUFSIZE, fin)) > 0)
|
||||
{
|
||||
fwrite(file_buffer_raw, 1, len, fout);
|
||||
}
|
||||
fclose(fin);
|
||||
}
|
||||
|
||||
void concat_files(const char *file1, const char *file2, const char *targetfile)
|
||||
{
|
||||
FILE *fout;
|
||||
fout = fopen(targetfile, "wb");
|
||||
if (fout == NULL) {
|
||||
printf("Failed to open file \"%s\"\n", targetfile);
|
||||
exit(-1);
|
||||
}
|
||||
copy_file(file1, fout);
|
||||
copy_file(file2, fout);
|
||||
fclose(fout);
|
||||
}
|
||||
|
||||
int process_sub(FILE *data_file, FILE *struct_file)
|
||||
{
|
||||
FIND_T fInfo;
|
||||
FIND_RET_T fret;
|
||||
int filesProcessed = 0;
|
||||
char oldSubdir[MAX_PATH_LEN];
|
||||
|
||||
if (processSubs) {
|
||||
/* process subs recursively */
|
||||
strcpy(oldSubdir, curSubdir);
|
||||
fret = FINDFIRST_DIR("*", &fInfo);
|
||||
if (FINDFIRST_SUCCEEDED(fret)) {
|
||||
do {
|
||||
const char *curName = FIND_T_FILENAME(fInfo);
|
||||
if (curName == NULL) continue;
|
||||
if (curName[0] == '.') continue;
|
||||
if (strcmp(curName, "CVS") == 0) continue;
|
||||
if (!FIND_T_IS_DIR(fInfo)) continue;
|
||||
CHDIR(curName);
|
||||
strcat(curSubdir, "/");
|
||||
strcat(curSubdir, curName);
|
||||
printf(NEWLINE "processing subdirectory %s/..." NEWLINE, curSubdir);
|
||||
filesProcessed += process_sub(data_file, struct_file);
|
||||
CHDIR("..");
|
||||
strcpy(curSubdir, oldSubdir);
|
||||
} while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo)));
|
||||
}
|
||||
}
|
||||
|
||||
fret = FINDFIRST_FILE("*.*", &fInfo);
|
||||
if (FINDFIRST_SUCCEEDED(fret)) {
|
||||
/* at least one file in directory */
|
||||
do {
|
||||
if (FIND_T_IS_FILE(fInfo)) {
|
||||
const char *curName = FIND_T_FILENAME(fInfo);
|
||||
printf("processing %s/%s..." NEWLINE, curSubdir, curName);
|
||||
if (process_file(data_file, struct_file, curName) < 0) {
|
||||
printf(NEWLINE "Error... aborting" NEWLINE);
|
||||
return -1;
|
||||
}
|
||||
filesProcessed++;
|
||||
}
|
||||
} while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo)));
|
||||
}
|
||||
return filesProcessed;
|
||||
}
|
||||
|
||||
int get_file_size(const char* filename)
|
||||
{
|
||||
FILE *inFile;
|
||||
int file_size = -1;
|
||||
inFile = fopen(filename, "rb");
|
||||
if (inFile == NULL) {
|
||||
printf("Failed to open file \"%s\"\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
fseek(inFile, 0, SEEK_END);
|
||||
file_size = ftell(inFile);
|
||||
fclose(inFile);
|
||||
return file_size;
|
||||
}
|
||||
|
||||
void process_file_data(const char *filename, FILE *data_file)
|
||||
{
|
||||
FILE *source_file;
|
||||
size_t len, written, i, src_off=0;
|
||||
|
||||
source_file = fopen(filename, "rb");
|
||||
|
||||
do {
|
||||
size_t off = 0;
|
||||
len = fread(file_buffer_raw, 1, COPY_BUFSIZE, source_file);
|
||||
if (len > 0) {
|
||||
for (i = 0; i < len; i++) {
|
||||
sprintf(&file_buffer_c[off], "0x%02.2x,", file_buffer_raw[i]);
|
||||
off += 5;
|
||||
if ((++src_off % HEX_BYTES_PER_LINE) == 0) {
|
||||
memcpy(&file_buffer_c[off], NEWLINE, NEWLINE_LEN);
|
||||
off += NEWLINE_LEN;
|
||||
}
|
||||
}
|
||||
written = fwrite(file_buffer_c, 1, off, data_file);
|
||||
}
|
||||
} while(len > 0);
|
||||
fclose(source_file);
|
||||
}
|
||||
|
||||
int write_checksums(FILE *struct_file, const char *filename, const char *varname,
|
||||
u16_t hdr_len, u16_t hdr_chksum)
|
||||
{
|
||||
int chunk_size = TCP_MSS;
|
||||
int offset;
|
||||
size_t len;
|
||||
int i = 0;
|
||||
FILE *f;
|
||||
#if LWIP_TCP_TIMESTAMPS
|
||||
/* when timestamps are used, usable space is 12 bytes less per segment */
|
||||
chunk_size -= 12;
|
||||
#endif
|
||||
|
||||
fprintf(struct_file, "#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE);
|
||||
fprintf(struct_file, "const struct fsdata_chksum chksums_%s[] = {" NEWLINE, varname);
|
||||
|
||||
memset(file_buffer_raw, 0xab, sizeof(file_buffer_raw));
|
||||
f = fopen(filename, "rb");
|
||||
if (f == INVALID_HANDLE_VALUE) {
|
||||
printf("Failed to open file \"%s\"\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
if (hdr_len > 0) {
|
||||
/* add checksum for HTTP header */
|
||||
fprintf(struct_file, "{%d, 0x%04x, %d}," NEWLINE, 0, hdr_chksum, hdr_len);
|
||||
i++;
|
||||
}
|
||||
for (offset = hdr_len; ; offset += len) {
|
||||
unsigned short chksum;
|
||||
len = fread(file_buffer_raw, 1, chunk_size, f);
|
||||
if (len == 0) {
|
||||
break;
|
||||
}
|
||||
chksum = ~inet_chksum(file_buffer_raw, (u16_t)len);
|
||||
/* add checksum for data */
|
||||
fprintf(struct_file, "{%d, 0x%04x, %d}," NEWLINE, offset, chksum, len);
|
||||
i++;
|
||||
}
|
||||
fclose(f);
|
||||
fprintf(struct_file, "};" NEWLINE);
|
||||
fprintf(struct_file, "#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE);
|
||||
return i;
|
||||
}
|
||||
|
||||
int process_file(FILE *data_file, FILE *struct_file, const char *filename)
|
||||
{
|
||||
char *pch;
|
||||
char varname[MAX_PATH_LEN];
|
||||
int i = 0;
|
||||
char qualifiedName[MAX_PATH_LEN];
|
||||
int file_size;
|
||||
u16_t http_hdr_chksum = 0;
|
||||
u16_t http_hdr_len = 0;
|
||||
int chksum_count = 0;
|
||||
|
||||
/* create qualified name (TODO: prepend slash or not?) */
|
||||
sprintf(qualifiedName,"%s/%s", curSubdir, filename);
|
||||
/* create C variable name */
|
||||
strcpy(varname, qualifiedName);
|
||||
/* convert slashes & dots to underscores */
|
||||
while ((pch = strpbrk(varname, "./\\")) != NULL) {
|
||||
*pch = '_';
|
||||
}
|
||||
#if ALIGN_PAYLOAD
|
||||
/* to force even alignment of array */
|
||||
fprintf(data_file, "static const " PAYLOAD_ALIGN_TYPE " dummy_align_%s = %d;" NEWLINE, varname, payload_alingment_dummy_counter++);
|
||||
#endif /* ALIGN_PAYLOAD */
|
||||
fprintf(data_file, "static const unsigned char data_%s[] = {" NEWLINE, varname);
|
||||
/* encode source file name (used by file system, not returned to browser) */
|
||||
fprintf(data_file, "/* %s (%d chars) */" NEWLINE, qualifiedName, strlen(qualifiedName)+1);
|
||||
file_put_ascii(data_file, qualifiedName, strlen(qualifiedName)+1, &i);
|
||||
#if ALIGN_PAYLOAD
|
||||
/* pad to even number of bytes to assure payload is on aligned boundary */
|
||||
while(i % PAYLOAD_ALIGNMENT != 0) {
|
||||
fprintf(data_file, "0x%02.2x,", 0);
|
||||
i++;
|
||||
}
|
||||
#endif /* ALIGN_PAYLOAD */
|
||||
fprintf(data_file, NEWLINE);
|
||||
|
||||
file_size = get_file_size(filename);
|
||||
if (includeHttpHeader) {
|
||||
file_write_http_header(data_file, filename, file_size, &http_hdr_len, &http_hdr_chksum);
|
||||
}
|
||||
if (precalcChksum) {
|
||||
chksum_count = write_checksums(struct_file, filename, varname, http_hdr_len, http_hdr_chksum);
|
||||
}
|
||||
|
||||
/* build declaration of struct fsdata_file in temp file */
|
||||
fprintf(struct_file, "const struct fsdata_file file_%s[] = { {" NEWLINE, varname);
|
||||
fprintf(struct_file, "file_%s," NEWLINE, lastFileVar);
|
||||
fprintf(struct_file, "data_%s," NEWLINE, varname);
|
||||
fprintf(struct_file, "data_%s + %d," NEWLINE, varname, i);
|
||||
fprintf(struct_file, "sizeof(data_%s) - %d," NEWLINE, varname, i);
|
||||
fprintf(struct_file, "%d," NEWLINE, includeHttpHeader);
|
||||
if (precalcChksum) {
|
||||
fprintf(struct_file, "#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE);
|
||||
fprintf(struct_file, "%d, chksums_%s," NEWLINE, chksum_count, varname);
|
||||
fprintf(struct_file, "#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE);
|
||||
}
|
||||
fprintf(struct_file, "}};" NEWLINE NEWLINE);
|
||||
strcpy(lastFileVar, varname);
|
||||
|
||||
/* write actual file contents */
|
||||
i = 0;
|
||||
fprintf(data_file, NEWLINE "/* raw file data (%d bytes) */" NEWLINE, file_size);
|
||||
process_file_data(filename, data_file);
|
||||
fprintf(data_file, "};" NEWLINE NEWLINE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int file_write_http_header(FILE *data_file, const char *filename, int file_size,
|
||||
u16_t *http_hdr_len, u16_t *http_hdr_chksum)
|
||||
{
|
||||
int i = 0;
|
||||
int response_type = HTTP_HDR_OK;
|
||||
int file_type = HTTP_HDR_DEFAULT_TYPE;
|
||||
const char *cur_string;
|
||||
size_t cur_len;
|
||||
int written = 0;
|
||||
size_t hdr_len = 0;
|
||||
u16_t acc;
|
||||
const char *file_ext;
|
||||
int j;
|
||||
|
||||
memset(hdr_buf, 0, sizeof(hdr_buf));
|
||||
|
||||
if (useHttp11) {
|
||||
response_type = HTTP_HDR_OK_11;
|
||||
}
|
||||
|
||||
fprintf(data_file, NEWLINE "/* HTTP header */");
|
||||
if (strstr(filename, "404") == filename) {
|
||||
response_type = HTTP_HDR_NOT_FOUND;
|
||||
if (useHttp11) {
|
||||
response_type = HTTP_HDR_NOT_FOUND_11;
|
||||
}
|
||||
} else if (strstr(filename, "400") == filename) {
|
||||
response_type = HTTP_HDR_BAD_REQUEST;
|
||||
if (useHttp11) {
|
||||
response_type = HTTP_HDR_BAD_REQUEST_11;
|
||||
}
|
||||
} else if (strstr(filename, "501") == filename) {
|
||||
response_type = HTTP_HDR_NOT_IMPL;
|
||||
if (useHttp11) {
|
||||
response_type = HTTP_HDR_NOT_IMPL_11;
|
||||
}
|
||||
}
|
||||
cur_string = g_psHTTPHeaderStrings[response_type];
|
||||
cur_len = strlen(cur_string);
|
||||
fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len);
|
||||
written += file_put_ascii(data_file, cur_string, cur_len, &i);
|
||||
i = 0;
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], cur_string, cur_len);
|
||||
hdr_len += cur_len;
|
||||
}
|
||||
|
||||
cur_string = serverID;
|
||||
cur_len = strlen(cur_string);
|
||||
fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len);
|
||||
written += file_put_ascii(data_file, cur_string, cur_len, &i);
|
||||
i = 0;
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], cur_string, cur_len);
|
||||
hdr_len += cur_len;
|
||||
}
|
||||
|
||||
file_ext = filename;
|
||||
while(strstr(file_ext, ".") != NULL) {
|
||||
file_ext = strstr(file_ext, ".");
|
||||
file_ext++;
|
||||
}
|
||||
if((file_ext == NULL) || (*file_ext == 0)) {
|
||||
printf("failed to get extension for file \"%s\", using default.\n", filename);
|
||||
} else {
|
||||
for(j = 0; j < NUM_HTTP_HEADERS; j++) {
|
||||
if(!strcmp(file_ext, g_psHTTPHeaders[j].extension)) {
|
||||
file_type = g_psHTTPHeaders[j].headerIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= NUM_HTTP_HEADERS) {
|
||||
printf("failed to get file type for extension \"%s\", using default.\n", file_ext);
|
||||
file_type = HTTP_HDR_DEFAULT_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
if (useHttp11) {
|
||||
char intbuf[MAX_PATH_LEN];
|
||||
memset(intbuf, 0, sizeof(intbuf));
|
||||
|
||||
cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONTENT_LENGTH];
|
||||
cur_len = strlen(cur_string);
|
||||
fprintf(data_file, NEWLINE "/* \"%s%d\r\n\" (%d+ bytes) */" NEWLINE, cur_string, file_size, cur_len+2);
|
||||
written += file_put_ascii(data_file, cur_string, cur_len, &i);
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], cur_string, cur_len);
|
||||
hdr_len += cur_len;
|
||||
}
|
||||
|
||||
_itoa(file_size, intbuf, 10);
|
||||
strcat(intbuf, "\r\n");
|
||||
cur_len = strlen(intbuf);
|
||||
written += file_put_ascii(data_file, intbuf, cur_len, &i);
|
||||
i = 0;
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], intbuf, cur_len);
|
||||
hdr_len += cur_len;
|
||||
}
|
||||
|
||||
cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONN_CLOSE];
|
||||
cur_len = strlen(cur_string);
|
||||
fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len);
|
||||
written += file_put_ascii(data_file, cur_string, cur_len, &i);
|
||||
i = 0;
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], cur_string, cur_len);
|
||||
hdr_len += cur_len;
|
||||
}
|
||||
}
|
||||
|
||||
cur_string = g_psHTTPHeaderStrings[file_type];
|
||||
cur_len = strlen(cur_string);
|
||||
fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len);
|
||||
written += file_put_ascii(data_file, cur_string, cur_len, &i);
|
||||
i = 0;
|
||||
if (precalcChksum) {
|
||||
memcpy(&hdr_buf[hdr_len], cur_string, cur_len);
|
||||
hdr_len += cur_len;
|
||||
|
||||
LWIP_ASSERT("hdr_len <= 0xffff", hdr_len <= 0xffff);
|
||||
LWIP_ASSERT("strlen(hdr_buf) == hdr_len", strlen(hdr_buf) == hdr_len);
|
||||
acc = ~inet_chksum(hdr_buf, (u16_t)hdr_len);
|
||||
*http_hdr_len = (u16_t)hdr_len;
|
||||
*http_hdr_chksum = acc;
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
int file_put_ascii(FILE *file, const char* ascii_string, int len, int *i)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < len; x++) {
|
||||
unsigned char cur = ascii_string[x];
|
||||
fprintf(file, "0x%02.2x,", cur);
|
||||
if ((++(*i) % HEX_BYTES_PER_LINE) == 0) {
|
||||
fprintf(file, NEWLINE);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int s_put_ascii(char *buf, const char *ascii_string, int len, int *i)
|
||||
{
|
||||
int x;
|
||||
int idx = 0;
|
||||
for(x = 0; x < len; x++) {
|
||||
unsigned char cur = ascii_string[x];
|
||||
sprintf(&buf[idx], "0x%02.2x,", cur);
|
||||
idx += 5;
|
||||
if ((++(*i) % HEX_BYTES_PER_LINE) == 0) {
|
||||
sprintf(&buf[idx], NEWLINE);
|
||||
idx += NEWLINE_LEN;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <string.h>
|
||||
|
||||
/* lwIP core includes */
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timers.h"
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/init.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/dhcp.h"
|
||||
#include "lwip/autoip.h"
|
||||
|
||||
/* lwIP netif includes */
|
||||
#include "netif/etharp.h"
|
||||
|
||||
/* applications includes */
|
||||
#include "apps/httpserver_raw/httpd.h"
|
||||
|
||||
|
||||
#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 )
|
||||
#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), configGW_IP_ADDR0, configGW_IP_ADDR1, configGW_IP_ADDR2, configGW_IP_ADDR3 )
|
||||
#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), configNET_MASK0,configNET_MASK1,configNET_MASK2,configNET_MASK3)
|
||||
|
||||
/* remember to change this MAC address to suit your needs!
|
||||
the last octet will be increased by netif->num for each netif */
|
||||
#define LWIP_MAC_ADDR_BASE { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 }
|
||||
|
||||
/* configuration for applications */
|
||||
|
||||
#define LWIP_CHARGEN_APP 0
|
||||
#define LWIP_DNS_APP 0
|
||||
#define LWIP_HTTPD_APP 1
|
||||
|
||||
static struct netif netif;
|
||||
|
||||
static void apps_init( void );
|
||||
|
||||
#define ssiTASK_STATS_INDEX 0
|
||||
#define ssiRUN_TIME_STATS_INDEX 1
|
||||
|
||||
|
||||
/*
|
||||
* The SSI handler callback function passed to lwIP.
|
||||
*/
|
||||
static unsigned short uslwIPAppsSSIHandler( int iIndex, char *pcBuffer, int iBufferLength );
|
||||
|
||||
|
||||
/* The SSI strings that are embedded in the served html files. */
|
||||
static const char *pccSSITags[] =
|
||||
{
|
||||
"rtos_stats",
|
||||
"run_stats"
|
||||
};
|
||||
|
||||
|
||||
/* Called from the TCP/IP thread. */
|
||||
void lwIPAppsInit( void *pvArgument )
|
||||
{
|
||||
ip_addr_t ipaddr, netmask, gw;
|
||||
extern err_t ethernetif_init( struct netif *netif );
|
||||
|
||||
( void ) pvArgument;
|
||||
|
||||
ip_addr_set_zero( &gw );
|
||||
ip_addr_set_zero( &ipaddr );
|
||||
ip_addr_set_zero( &netmask );
|
||||
|
||||
LWIP_PORT_INIT_GW(&gw);
|
||||
LWIP_PORT_INIT_IPADDR(&ipaddr);
|
||||
LWIP_PORT_INIT_NETMASK(&netmask);
|
||||
|
||||
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input));
|
||||
|
||||
netif_set_up( &netif );
|
||||
apps_init();
|
||||
http_set_ssi_handler( uslwIPAppsSSIHandler, pccSSITags, sizeof( pccSSITags ) / sizeof( char * ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This function initializes applications */
|
||||
static void apps_init( void )
|
||||
{
|
||||
/* Taken from the lwIP example code. */
|
||||
|
||||
#if LWIP_HTTPD_APP && LWIP_TCP
|
||||
{
|
||||
httpd_init();
|
||||
}
|
||||
#endif /* LWIP_HTTPD_APP && LWIP_TCP */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static unsigned short uslwIPAppsSSIHandler( int iIndex, char *pcBuffer, int iBufferLength )
|
||||
{
|
||||
static unsigned int uiUpdateCount = 0;
|
||||
static char cUpdateString[ 200 ];
|
||||
extern char *pcMainGetTaskStatusMessage( void );
|
||||
|
||||
( void ) iBufferLength;
|
||||
|
||||
/* The SSI handler function that generates text depending on the index of
|
||||
the SSI tag encountered. */
|
||||
|
||||
switch( iIndex )
|
||||
{
|
||||
case ssiTASK_STATS_INDEX :
|
||||
vTaskList( ( signed char * ) pcBuffer );
|
||||
break;
|
||||
|
||||
case ssiRUN_TIME_STATS_INDEX :
|
||||
vTaskGetRunTimeStats( ( signed char * ) pcBuffer );
|
||||
break;
|
||||
}
|
||||
|
||||
uiUpdateCount++;
|
||||
sprintf( cUpdateString, "\r\n\r\n%u\r\nStatus - %s", uiUpdateCount, pcMainGetTaskStatusMessage() );
|
||||
strcat( pcBuffer, cUpdateString );
|
||||
return strlen( pcBuffer );
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 )
|
||||
#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), configGW_IP_ADDR0, configGW_IP_ADDR1, configGW_IP_ADDR2, configGW_IP_ADDR3 )
|
||||
#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), configNET_MASK0,configNET_MASK1,configNET_MASK2,configNET_MASK3)
|
||||
|
||||
/* remember to change this MAC address to suit your needs!
|
||||
the last octet will be increased by netif->num for each netif */
|
||||
#define LWIP_MAC_ADDR_BASE { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 }
|
||||
|
||||
/* configuration for applications */
|
||||
|
||||
#define LWIP_CHARGEN_APP 0
|
||||
#define LWIP_DNS_APP 0
|
||||
#define LWIP_HTTPD_APP 1
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include "xparameters.h"
|
||||
|
||||
/* Define platform endianness (might already be defined) */
|
||||
#ifndef BYTE_ORDER
|
||||
#if XPAR_MICROBLAZE_0_ENDIANNESS == 1
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#endif
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#define XLWIP_CONFIG_INCLUDE_EMACLITE 1
|
||||
|
||||
/* SSI options. */
|
||||
#define TCPIP_THREAD_NAME "tcpip"
|
||||
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 20
|
||||
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 1024
|
||||
#define TCPIP_THREAD_PRIO configLWIP_TASK_PRIORITY
|
||||
#define TCPIP_THREAD_STACKSIZE configMINIMAL_STACK_SIZE * 3
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET (NO_SYS==0)
|
||||
#define LWIP_NETCONN (NO_SYS==0)
|
||||
|
||||
#define LWIP_IGMP 0
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_SNMP 0
|
||||
|
||||
#define LWIP_DNS 1
|
||||
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_LOOPBACK_MAX_PBUFS 10
|
||||
|
||||
#define TCP_LISTEN_BACKLOG 0
|
||||
|
||||
#define LWIP_COMPAT_SOCKETS 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
|
||||
#define LWIP_TCPIP_CORE_LOCKING 0
|
||||
|
||||
#define LWIP_NETIF_LINK_CALLBACK 0
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 0
|
||||
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL 0
|
||||
#define PPP_DEBUG LWIP_DBG_OFF
|
||||
#define MEM_DEBUG LWIP_DBG_OFF
|
||||
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||
#define PBUF_DEBUG LWIP_DBG_OFF
|
||||
#define API_LIB_DEBUG LWIP_DBG_ON
|
||||
#define API_MSG_DEBUG LWIP_DBG_ON
|
||||
#define TCPIP_DEBUG LWIP_DBG_ON
|
||||
#define NETIF_DEBUG LWIP_DBG_ON
|
||||
#define SOCKETS_DEBUG LWIP_DBG_OFF
|
||||
#define DNS_DEBUG LWIP_DBG_OFF
|
||||
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_DEBUG LWIP_DBG_O
|
||||
#define IP_REASS_DEBUG LWIP_DBG_ON
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define IGMP_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_ON
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_ON
|
||||
#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
|
||||
#define TCP_RTO_DEBUG LWIP_DBG_ON
|
||||
#define TCP_CWND_DEBUG LWIP_DBG_ON
|
||||
#define TCP_WND_DEBUG LWIP_DBG_ON
|
||||
#define TCP_FR_DEBUG LWIP_DBG_ON
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_ON
|
||||
#define TCP_RST_DEBUG LWIP_DBG_ON
|
||||
#endif
|
||||
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
#define TCPIP_MBOX_SIZE 10
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
/* MSVC port: intel processors don't need 4-byte alignment,
|
||||
but are faster that way! */
|
||||
#define MEM_ALIGNMENT 4
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEM_SIZE 10240
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 16
|
||||
/* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
|
||||
per active RAW "connection". */
|
||||
#define MEMP_NUM_RAW_PCB 3
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 5
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 15
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG_API 16
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 16
|
||||
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 100
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/** SYS_LIGHTWEIGHT_PROT
|
||||
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
|
||||
* for certain critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
|
||||
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define TCP_TTL 255
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 1024
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF 2048
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
|
||||
|
||||
/* TCP writable space (bytes). This must be less than or equal
|
||||
to TCP_SND_BUF. It is the amount of space which must be
|
||||
available in the tcp snd_buf for select to return writable */
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 8096
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 1
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 1
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
#define MEMP_NUM_REASSDATA 10
|
||||
#define IP_FRAG 1
|
||||
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. */
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
|
||||
|
||||
|
||||
/* ---------- AUTOIP options ------- */
|
||||
#define LWIP_AUTOIP 0
|
||||
#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
|
||||
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_UDPLITE 1
|
||||
#define UDP_TTL 255
|
||||
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS_DISPLAY 1
|
||||
|
||||
#if LWIP_STATS
|
||||
#define LINK_STATS 1
|
||||
#define IP_STATS 1
|
||||
#define ICMP_STATS 1
|
||||
#define IGMP_STATS 1
|
||||
#define IPFRAG_STATS 1
|
||||
#define UDP_STATS 1
|
||||
#define TCP_STATS 1
|
||||
#define MEM_STATS 1
|
||||
#define MEMP_STATS 1
|
||||
#define PBUF_STATS 1
|
||||
#define SYS_STATS 1
|
||||
#endif /* LWIP_STATS */
|
||||
|
||||
|
||||
/* ---------- PPP options ---------- */
|
||||
|
||||
#define PPP_SUPPORT 0 /* Set > 0 for PPP */
|
||||
|
||||
#if PPP_SUPPORT
|
||||
|
||||
#define NUM_PPP 1 /* Max PPP sessions. */
|
||||
|
||||
|
||||
/* Select modules to enable. Ideally these would be set in the makefile but
|
||||
* we're limited by the command line length so you need to modify the settings
|
||||
* in this file.
|
||||
*/
|
||||
#define PPPOE_SUPPORT 1
|
||||
#define PPPOS_SUPPORT 1
|
||||
|
||||
#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
|
||||
#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
|
||||
#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
|
||||
#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
|
||||
#define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
|
||||
#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
|
||||
#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
|
||||
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
540
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/main-blinky.c
Normal file
540
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/main-blinky.c
Normal file
|
@ -0,0 +1,540 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:
|
||||
Atollic AB - Atollic provides professional embedded systems development
|
||||
tools for C/C++ development, code analysis and test automation.
|
||||
See http://www.atollic.com
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/*
|
||||
* main-blinky.c is included when the "Blinky" build configuration is used.
|
||||
* main-full.c is included when the "Full" build configuration is used.
|
||||
*
|
||||
* main-blinky.c (this file) defines a very simple demo that creates two tasks,
|
||||
* one queue, and one timer. It also demonstrates how MicroBlaze interrupts
|
||||
* can interact with FreeRTOS tasks/timers.
|
||||
*
|
||||
* This simple demo project was developed and tested on the Spartan-6 SP605
|
||||
* development board, using the hardware configuration found in the hardware
|
||||
* project that is already included in the Eclipse project.
|
||||
*
|
||||
* The idle hook function:
|
||||
* The idle hook function demonstrates how to query the amount of FreeRTOS heap
|
||||
* space that is remaining (see vApplicationIdleHook() defined in this file).
|
||||
*
|
||||
* The main() Function:
|
||||
* main() creates one software timer, one queue, and two tasks. It then starts
|
||||
* the scheduler.
|
||||
*
|
||||
* The Queue Send Task:
|
||||
* The queue send task is implemented by the prvQueueSendTask() function in
|
||||
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
|
||||
* block for 200 milliseconds, before sending the value 100 to the queue that
|
||||
* was created within main(). Once the value is sent, the task loops back
|
||||
* around to block for another 200 milliseconds.
|
||||
*
|
||||
* The Queue Receive Task:
|
||||
* The queue receive task is implemented by the prvQueueReceiveTask() function
|
||||
* in this file. prvQueueReceiveTask() sits in a loop that causes it to
|
||||
* repeatedly attempt to read data from the queue that was created within
|
||||
* main(). When data is received, the task checks the value of the data, and
|
||||
* if the value equals the expected 100, toggles an LED. The 'block time'
|
||||
* parameter passed to the queue receive function specifies that the task
|
||||
* should be held in the Blocked state indefinitely to wait for data to be
|
||||
* available on the queue. The queue receive task will only leave the Blocked
|
||||
* state when the queue send task writes to the queue. As the queue send task
|
||||
* writes to the queue every 200 milliseconds, the queue receive task leaves
|
||||
* the Blocked state every 200 milliseconds, and therefore toggles the LED
|
||||
* every 200 milliseconds.
|
||||
*
|
||||
* The LED Software Timer and the Button Interrupt:
|
||||
* The user buttons are configured to generate an interrupt each time one is
|
||||
* pressed. The interrupt service routine switches an LED on, and resets the
|
||||
* LED software timer. The LED timer has a 5000 millisecond (5 second) period,
|
||||
* and uses a callback function that is defined to just turn the LED off again.
|
||||
* Therefore, pressing the user button will turn the LED on, and the LED will
|
||||
* remain on until a full five seconds pass without the button being pressed.
|
||||
*/
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "timers.h"
|
||||
|
||||
/* BSP includes. */
|
||||
#include "xtmrctr.h"
|
||||
#include "xgpio.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/* The rate at which data is sent to the queue, specified in milliseconds, and
|
||||
converted to ticks using the portTICK_RATE_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_RATE_MS )
|
||||
|
||||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added because it has the higher priority, meaning
|
||||
the send task should always find the queue empty. */
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
|
||||
/* The LED toggled by the queue receive task. */
|
||||
#define mainTASK_CONTROLLED_LED 0x01UL
|
||||
|
||||
/* The LED turned on by the button interrupt, and turned off by the LED timer. */
|
||||
#define mainTIMER_CONTROLLED_LED 0x02UL
|
||||
|
||||
/* A block time of 0 simply means, "don't block". */
|
||||
#define mainDONT_BLOCK ( portTickType ) 0
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Setup the NVIC, LED outputs, and button inputs.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/*
|
||||
* The tasks as described in the comments at the top of this file.
|
||||
*/
|
||||
static void prvQueueReceiveTask( void *pvParameters );
|
||||
static void prvQueueSendTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* The LED timer callback function. This does nothing but switch off the
|
||||
* LED defined by the mainTIMER_CONTROLLED_LED constant.
|
||||
*/
|
||||
static void vLEDTimerCallback( xTimerHandle xTimer );
|
||||
|
||||
/*
|
||||
* The handler executed each time a button interrupt is generated. This ensures
|
||||
* the LED defined by mainTIMER_CONTROLLED_LED is on, and resets the timer so
|
||||
* the timer will not turn the LED off for a full 5 seconds after the button
|
||||
* interrupt occurred.
|
||||
*/
|
||||
static void prvButtonInputInterruptHandler( void *pvUnused );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queue used by the queue send and queue receive tasks. */
|
||||
static xQueueHandle xQueue = NULL;
|
||||
|
||||
/* The LED software timer. This uses vLEDTimerCallback() as its callback
|
||||
function. */
|
||||
static xTimerHandle xLEDTimer = NULL;
|
||||
|
||||
/* Maintains the current LED output state. */
|
||||
static volatile unsigned char ucGPIOState = 0U;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Structures that hold the state of the various peripherals used by this demo.
|
||||
These are used by the Xilinx peripheral driver API functions. */
|
||||
static XTmrCtr xTimer0Instance;
|
||||
static XGpio xOutputGPIOInstance, xInputGPIOInstance;
|
||||
|
||||
/* Constants required by the Xilinx peripheral driver API functions that are
|
||||
relevant to the particular hardware set up. */
|
||||
static const unsigned long ulGPIOOutputChannel = 1UL, ulGPIOInputChannel = 1UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* *************************************************************************
|
||||
This is a very simple project suitable for getting started with FreeRTOS.
|
||||
If you would prefer a more complex project that demonstrates a lot more
|
||||
features and tests, then select the 'Full' build configuration within the
|
||||
SDK Eclipse IDE.
|
||||
***************************************************************************/
|
||||
|
||||
/* Configure the interrupt controller, LED outputs and button inputs. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* Create the queue used by the queue send and queue receive tasks as
|
||||
described in the comments at the top of this file. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
|
||||
/* Sanity check that the queue was created. */
|
||||
configASSERT( xQueue );
|
||||
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
file. */
|
||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the software timer that is responsible for turning off the LED
|
||||
if the button is not pushed within 5000ms, as described at the top of
|
||||
this file. The timer is not actually started until a button interrupt is
|
||||
pushed, as it is not until that point that the LED is turned on. */
|
||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||
);
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following line
|
||||
will never be reached. If the following line does execute, then there was
|
||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||
to be created. See the memory management section on the FreeRTOS web site
|
||||
for more details. */
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The callback is executed when the LED timer expires. */
|
||||
static void vLEDTimerCallback( xTimerHandle xTimer )
|
||||
{
|
||||
/* The timer has expired - so no button pushes have occurred in the last
|
||||
five seconds - turn the LED off. NOTE - accessing the LED port should use
|
||||
a critical section because it is accessed from multiple tasks, and the
|
||||
button interrupt - in this trivial case, for simplicity, the critical
|
||||
section is omitted. */
|
||||
ucGPIOState &= ~mainTIMER_CONTROLLED_LED;
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The ISR is executed when the user button is pushed. */
|
||||
static void prvButtonInputInterruptHandler( void *pvUnused )
|
||||
{
|
||||
long lHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
/* The button was pushed, so ensure the LED is on before resetting the
|
||||
LED timer. The LED timer will turn the LED off if the button is not
|
||||
pushed within 5000ms. */
|
||||
ucGPIOState |= mainTIMER_CONTROLLED_LED;
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
|
||||
|
||||
/* Ensure only the ISR safe reset API function is used, as this is executed
|
||||
in an interrupt context. */
|
||||
xTimerResetFromISR( xLEDTimer, &lHigherPriorityTaskWoken );
|
||||
|
||||
/* Clear the interrupt before leaving. */
|
||||
XGpio_InterruptClear( &xInputGPIOInstance, ulGPIOInputChannel );
|
||||
|
||||
/* If calling xTimerResetFromISR() caused a task (in this case the timer
|
||||
service/daemon task) to unblock, and the unblocked task has a priority
|
||||
higher than or equal to the task that was interrupted, then
|
||||
lHigherPriorityTaskWoken will now be set to pdTRUE, and calling
|
||||
portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */
|
||||
portYIELD_FROM_ISR( lHigherPriorityTaskWoken );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSendTask( void *pvParameters )
|
||||
{
|
||||
portTickType xNextWakeTime;
|
||||
const unsigned long ulValueToSend = 100UL;
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again.
|
||||
The block time is specified in ticks, the constant used converts ticks
|
||||
to ms. While in the Blocked state this task will not consume any CPU
|
||||
time. */
|
||||
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
toggle an LED. 0 is used as the block time so the sending operation
|
||||
will not block - it shouldn't need to block as the queue should always
|
||||
be empty at this point in the code. */
|
||||
xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueReceiveTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulReceivedValue;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
FreeRTOSConfig.h. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
|
||||
/* To get here something must have been received from the queue, but
|
||||
is it the expected value? If it is, toggle the green LED. */
|
||||
if( ulReceivedValue == 100UL )
|
||||
{
|
||||
/* NOTE - accessing the LED port should use a critical section
|
||||
because it is accessed from multiple tasks, and the button interrupt
|
||||
- in this trivial case, for simplicity, the critical section is
|
||||
omitted. */
|
||||
if( ( ucGPIOState & mainTASK_CONTROLLED_LED ) != 0 )
|
||||
{
|
||||
ucGPIOState &= ~mainTASK_CONTROLLED_LED;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucGPIOState |= mainTASK_CONTROLLED_LED;
|
||||
}
|
||||
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
portBASE_TYPE xStatus;
|
||||
const unsigned char ucSetToOutput = 0U;
|
||||
|
||||
/* Initialize the GPIO for the LEDs. */
|
||||
xStatus = XGpio_Initialize( &xOutputGPIOInstance, XPAR_LEDS_4BITS_DEVICE_ID );
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* All bits on this channel are going to be outputs (LEDs). */
|
||||
XGpio_SetDataDirection( &xOutputGPIOInstance, ulGPIOOutputChannel, ucSetToOutput );
|
||||
|
||||
/* Start with all LEDs off. */
|
||||
ucGPIOState = 0U;
|
||||
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
|
||||
}
|
||||
|
||||
/* Initialise the GPIO for the button inputs. */
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
xStatus = XGpio_Initialize( &xInputGPIOInstance, XPAR_PUSH_BUTTONS_4BITS_DEVICE_ID );
|
||||
}
|
||||
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Install the handler defined in this task for the button input.
|
||||
*NOTE* The FreeRTOS defined xPortInstallInterruptHandler() API function
|
||||
must be used for this purpose. */
|
||||
xStatus = xPortInstallInterruptHandler( XPAR_MICROBLAZE_0_INTC_PUSH_BUTTONS_4BITS_IP2INTC_IRPT_INTR, prvButtonInputInterruptHandler, NULL );
|
||||
|
||||
if( xStatus == pdPASS )
|
||||
{
|
||||
/* Set buttons to input. */
|
||||
XGpio_SetDataDirection( &xInputGPIOInstance, ulGPIOInputChannel, ~( ucSetToOutput ) );
|
||||
|
||||
/* Enable the button input interrupts in the interrupt controller.
|
||||
*NOTE* The vPortEnableInterrupt() API function must be used for this
|
||||
purpose. */
|
||||
vPortEnableInterrupt( XPAR_MICROBLAZE_0_INTC_PUSH_BUTTONS_4BITS_IP2INTC_IRPT_INTR );
|
||||
|
||||
/* Enable GPIO channel interrupts. */
|
||||
XGpio_InterruptEnable( &xInputGPIOInstance, ulGPIOInputChannel );
|
||||
XGpio_InterruptGlobalEnable( &xInputGPIOInstance );
|
||||
}
|
||||
}
|
||||
|
||||
configASSERT( ( xStatus == pdPASS ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue or
|
||||
semaphore is created. It is also called by various parts of the demo
|
||||
application. If heap_1.c or heap_2.c are used, then the size of the heap
|
||||
available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
|
||||
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
|
||||
to query the size of free heap space that remains (although it does not
|
||||
provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* vApplicationStackOverflowHook() will only be called if
|
||||
configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2. The handle and name
|
||||
of the offending task will be passed into the hook function via its
|
||||
parameters. However, when a stack has overflowed, it is possible that the
|
||||
parameters will have been corrupted, in which case the pxCurrentTCB variable
|
||||
can be inspected directly. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
volatile size_t xFreeHeapSpace;
|
||||
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If the application makes use of the
|
||||
vTaskDelete() API function (as this demo application does) then it is also
|
||||
important that vApplicationIdleHook() is permitted to return to its calling
|
||||
function, because it is the responsibility of the idle task to clean up
|
||||
memory allocated by the kernel to any task that has since been deleted. */
|
||||
|
||||
/* This implementation of vApplicationIdleHook() simply demonstrates how
|
||||
the xPortGetFreeHeapSize() function can be used. */
|
||||
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||
|
||||
if( xFreeHeapSpace > 100 )
|
||||
{
|
||||
/* By now, the kernel has allocated everything it is going to, so
|
||||
if there is a lot of heap remaining unallocated then
|
||||
the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be
|
||||
reduced accordingly. */
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* vApplicationTickHook() will only be called if configUSE_TICK_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It executes from an interrupt context so must
|
||||
not use any FreeRTOS API functions that do not end in ...FromISR().
|
||||
|
||||
This simple blinky demo does not use the tick hook, but a tick hook is
|
||||
required to be defined as the blinky and full demos share a
|
||||
FreeRTOSConfig.h header file. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is an application defined callback function used to install the tick
|
||||
interrupt handler. It is provided as an application callback because the kernel
|
||||
will run on lots of different MicroBlaze and FPGA configurations - not all of
|
||||
which will have the same timer peripherals defined or available. This example
|
||||
uses the AXI Timer 0. If that is available on your hardware platform then this
|
||||
example callback implementation should not require modification. The name of
|
||||
the interrupt handler that should be installed is vPortTickISR(), which the
|
||||
function below declares as an extern. */
|
||||
void vApplicationSetupTimerInterrupt( void )
|
||||
{
|
||||
portBASE_TYPE xStatus;
|
||||
const unsigned char ucTimerCounterNumber = ( unsigned char ) 0U;
|
||||
const unsigned long ulCounterValue = ( ( XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
extern void vPortTickISR( void *pvUnused );
|
||||
|
||||
/* Initialise the timer/counter. */
|
||||
xStatus = XTmrCtr_Initialize( &xTimer0Instance, XPAR_AXI_TIMER_0_DEVICE_ID );
|
||||
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Install the tick interrupt handler as the timer ISR.
|
||||
*NOTE* The xPortInstallInterruptHandler() API function must be used for
|
||||
this purpose. */
|
||||
xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_TMRCTR_0_VEC_ID, vPortTickISR, NULL );
|
||||
}
|
||||
|
||||
if( xStatus == pdPASS )
|
||||
{
|
||||
/* Enable the timer interrupt in the interrupt controller.
|
||||
*NOTE* The vPortEnableInterrupt() API function must be used for this
|
||||
purpose. */
|
||||
vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );
|
||||
|
||||
/* Configure the timer interrupt handler. */
|
||||
XTmrCtr_SetHandler( &xTimer0Instance, ( void * ) vPortTickISR, NULL );
|
||||
|
||||
/* Set the correct period for the timer. */
|
||||
XTmrCtr_SetResetValue( &xTimer0Instance, ucTimerCounterNumber, ulCounterValue );
|
||||
|
||||
/* Enable the interrupts. Auto-reload mode is used to generate a
|
||||
periodic tick. Note that interrupts are disabled when this function is
|
||||
called, so interrupts will not start to be processed until the first
|
||||
task has started to run. */
|
||||
XTmrCtr_SetOptions( &xTimer0Instance, ucTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );
|
||||
|
||||
/* Start the timer. */
|
||||
XTmrCtr_Start( &xTimer0Instance, ucTimerCounterNumber );
|
||||
}
|
||||
|
||||
/* Sanity check that the function executed as expected. */
|
||||
configASSERT( ( xStatus == pdPASS ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is an application defined callback function used to clear whichever
|
||||
interrupt was installed by the the vApplicationSetupTimerInterrupt() callback
|
||||
function - in this case the interrupt generated by the AXI timer. It is
|
||||
provided as an application callback because the kernel will run on lots of
|
||||
different MicroBlaze and FPGA configurations - not all of which will have the
|
||||
same timer peripherals defined or available. This example uses the AXI Timer 0.
|
||||
If that is available on your hardware platform then this example callback
|
||||
implementation should not require modification provided the example definition
|
||||
of vApplicationSetupTimerInterrupt() is also not modified. */
|
||||
void vApplicationClearTimerInterrupt( void )
|
||||
{
|
||||
unsigned long ulCSR;
|
||||
|
||||
/* Clear the timer interrupt */
|
||||
ulCSR = XTmrCtr_GetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0 );
|
||||
XTmrCtr_SetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0, ulCSR );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* These functions are not used by the Blinky build configuration. However,
|
||||
they need to be defined because the Blinky and Full build configurations share
|
||||
a FreeRTOSConifg.h configuration file. */
|
||||
void vMainConfigureTimerForRunTimeStats( void ) {}
|
||||
unsigned long ulMainGetRunTimeCounterValue( void ) { return 1; }
|
617
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/main-full.c
Normal file
617
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/main-full.c
Normal file
|
@ -0,0 +1,617 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* main-blinky.c is included when the "Blinky" build configuration is used.
|
||||
* main-full.c is included when the "Full" build configuration is used.
|
||||
*
|
||||
* main-full.c creates a lot of demo and test tasks and timers, and is
|
||||
* therefore very comprehensive but also complex. If you would prefer a much
|
||||
* simpler project to get started with, then select the 'Blinky' build
|
||||
* configuration within the SDK Eclipse IDE. See the documentation page for
|
||||
* this demo on the http://www.FreeRTOS.org web site for more information.
|
||||
* ****************************************************************************
|
||||
*
|
||||
* main() creates all the demo application tasks and timers, then starts the
|
||||
* scheduler. The web documentation provides more details of the standard demo
|
||||
* application tasks, which provide no particular functionality, but do provide
|
||||
* a good example of how to use the FreeRTOS API.
|
||||
*
|
||||
* In addition to the standard demo tasks, the following tasks and tests are
|
||||
* defined and/or created within this file:
|
||||
*
|
||||
* TCP/IP ("lwIP") task - TBD _RB_
|
||||
*
|
||||
* "Reg test" tasks - These test the task context switch mechanism by first
|
||||
* filling the MicroBlaze registers with known values, before checking that each
|
||||
* register maintains the value that was written to it as the tasks are switched
|
||||
* in and out. The two register test tasks do not use the same values, and
|
||||
* execute at a very low priority to ensure they are pre-empted regularly.
|
||||
*
|
||||
* "Check" timer - The check timer period is initially set to five seconds.
|
||||
* The check timer callback function checks that all the standard demo tasks,
|
||||
* and the register check tasks, are not only still executing, but are executing
|
||||
* without reporting any errors. If the check timer discovers that a task has
|
||||
* either stalled, or reported an error, then it changes its own period from
|
||||
* the initial five seconds, to just 200ms. The check timer callback function
|
||||
* also toggles an LED each time it is called. This provides a visual
|
||||
* indication of the system status: If the LED toggles every five seconds then
|
||||
* no issues have been discovered. If the LED toggles every 200ms then an issue
|
||||
* has been discovered with at least one task. The last reported issue is
|
||||
* latched into the pcStatusMessage variable.
|
||||
*
|
||||
* This file also includes example implementations of the vApplicationTickHook(),
|
||||
* vApplicationIdleHook(), vApplicationStackOverflowHook(),
|
||||
* vApplicationMallocFailedHook(), vApplicationClearTimerInterrupt(), and
|
||||
* vApplicationSetupTimerInterrupt() callback (hook) functions.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* BSP includes. */
|
||||
#include "xtmrctr.h"
|
||||
#include "microblaze_exceptions_g.h"
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
|
||||
/* Standard demo includes. */
|
||||
#include "partest.h"
|
||||
#include "flash.h"
|
||||
#include "BlockQ.h"
|
||||
#include "death.h"
|
||||
#include "blocktim.h"
|
||||
#include "semtest.h"
|
||||
#include "PollQ.h"
|
||||
#include "GenQTest.h"
|
||||
#include "QPeek.h"
|
||||
#include "recmutex.h"
|
||||
#include "flop.h"
|
||||
#include "dynamic.h"
|
||||
#include "comtest_strings.h"
|
||||
#include "TimerDemo.h"
|
||||
|
||||
/* lwIP includes. */
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
|
||||
/* Priorities at which the various tasks are created. */
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* The LED toggled by the check task. */
|
||||
#define mainCHECK_LED ( 3 )
|
||||
|
||||
/* The rate at which mainCHECK_LED will toggle when all the tasks are running
|
||||
without error. See the description of the check timer in the comments at the
|
||||
top of this file. */
|
||||
#define mainNO_ERROR_CHECK_TIMER_PERIOD ( 5000 / portTICK_RATE_MS )
|
||||
|
||||
/* The rate at which mainCHECK_LED will toggle when an error has been reported
|
||||
by at least one task. See the description of the check timer in the comments at
|
||||
the top of this file. */
|
||||
#define mainERROR_CHECK_TIMER_PERIOD ( 200 / portTICK_RATE_MS )
|
||||
|
||||
/* A block time of zero simply means "don't block". */
|
||||
#define mainDONT_BLOCK ( ( portTickType ) 0 )
|
||||
|
||||
/* The LED used by the comtest tasks. See the comtest_strings.c file for more
|
||||
information. In this case an invalid LED number is provided as all four
|
||||
available LEDs (LEDs 0 to 3) are already in use. */
|
||||
#define mainCOM_TEST_LED ( 4 )
|
||||
|
||||
/* Baud rate used by the comtest tasks. The baud rate used is actually fixed in
|
||||
UARTLite IP when the hardware was built, but the standard serial init function
|
||||
required a baud rate parameter to be provided - in this case it is just
|
||||
ignored. */
|
||||
#define mainCOM_TEST_BAUD_RATE ( XPAR_RS232_UART_1_BAUDRATE )
|
||||
|
||||
/* The timer test task generates a lot of timers that all use a different
|
||||
period that is a multiple of the mainTIMER_TEST_PERIOD definition. */
|
||||
#define mainTIMER_TEST_PERIOD ( 20 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* The register test tasks as described in the comments at the top of this file.
|
||||
* The nature of the register test tasks means they have to be implemented in
|
||||
* assembler.
|
||||
*/
|
||||
extern void vRegisterTest1( void *pvParameters );
|
||||
extern void vRegisterTest2( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Defines the 'check' timer functionality as described at the top of this file.
|
||||
* This function is the callback function associated with the 'check' timer.
|
||||
*/
|
||||
static void vCheckTimerCallback( xTimerHandle xTimer );
|
||||
|
||||
/*
|
||||
* Configure the interrupt controller, LED outputs and button inputs.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/* Defined in lwIPApps.c. */
|
||||
extern void lwIPAppsInit( void *pvArguments );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The check timer callback function sets pcStatusMessage to a string that
|
||||
indicates the last reported error that it discovered. */
|
||||
static const char *pcStatusMessage = NULL;
|
||||
|
||||
/* Structures that hold the state of the various peripherals used by this demo.
|
||||
These are used by the Xilinx peripheral driver API functions. In this case,
|
||||
only the timer/counter is used directly within this file. */
|
||||
static XTmrCtr xTimer0Instance;
|
||||
|
||||
/* The 'check' timer, as described at the top of this file. */
|
||||
static xTimerHandle xCheckTimer = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/***************************************************************************
|
||||
This project includes a lot of demo and test tasks and timers, and is
|
||||
therefore comprehensive, but complex. If you would prefer a much simpler
|
||||
project to get started with, then select the 'Blinky' build configuration
|
||||
within the SDK Eclipse IDE.
|
||||
***************************************************************************/
|
||||
|
||||
/* Configure the interrupt controller, LED outputs and button inputs. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* This call creates the TCP/IP thread. */
|
||||
tcpip_init( lwIPAppsInit, NULL );
|
||||
|
||||
/* Start the reg test tasks, as described in the comments at the top of this
|
||||
file. */
|
||||
xTaskCreate( vRegisterTest1, ( const signed char * const ) "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreate( vRegisterTest2, ( const signed char * const ) "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
|
||||
/* Create the standard demo tasks. */
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vCreateBlockTimeTasks();
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||
vStartQueuePeekTasks();
|
||||
vStartRecursiveMutexTasks();
|
||||
vStartComTestStringsTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||
|
||||
/* Note - the set of standard demo tasks contains two versions of
|
||||
vStartMathTasks.c. One is defined in flop.c, and uses double precision
|
||||
floating point numbers and variables. The other is defined in sp_flop.c,
|
||||
and uses single precision floating point numbers and variables. The
|
||||
MicroBlaze floating point unit only handles single precision floating.
|
||||
Therefore, to test the floating point hardware, sp_flop.c should be included
|
||||
in this project. */
|
||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||
|
||||
/* The suicide tasks must be created last as they need to know how many
|
||||
tasks were running prior to their creation. This then allows them to
|
||||
ascertain whether or not the correct/expected number of tasks are running at
|
||||
any given time. */
|
||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||
|
||||
/* Create the 'check' timer - the timer that periodically calls the
|
||||
check function as described in the comments at the top of this file. Note
|
||||
that, for reasons stated in the comments within vApplicationIdleHook()
|
||||
(defined in this file), the check timer is not actually started until after
|
||||
the scheduler has been started. */
|
||||
xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );
|
||||
|
||||
/* Start the scheduler running. From this point on, only tasks and
|
||||
interrupts will be executing. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well then the following line will never be reached. If
|
||||
execution does reach here, then it is highly probably that the heap size
|
||||
is too small for the idle and/or timer tasks to be created within
|
||||
vTaskStartScheduler(). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vCheckTimerCallback( xTimerHandle xTimer )
|
||||
{
|
||||
extern unsigned long ulRegTest1CycleCount, ulRegTest2CycleCount;
|
||||
static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;
|
||||
static long lErrorAlreadyLatched = pdFALSE;
|
||||
portTickType xExecutionRate = mainNO_ERROR_CHECK_TIMER_PERIOD;
|
||||
|
||||
/* This is the callback function used by the 'check' timer, as described
|
||||
in the comments at the top of this file. */
|
||||
|
||||
/* Check the standard demo tasks are running without error. */
|
||||
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: GenQueue";
|
||||
}
|
||||
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: QueuePeek\r\n";
|
||||
}
|
||||
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: BlockQueue\r\n";
|
||||
}
|
||||
else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: BlockTime\r\n";
|
||||
}
|
||||
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: SemTest\r\n";
|
||||
}
|
||||
else if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: PollQueue\r\n";
|
||||
}
|
||||
else if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: Death\r\n";
|
||||
}
|
||||
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: RecMutex\r\n";
|
||||
}
|
||||
else if( xAreMathsTaskStillRunning() != pdPASS )
|
||||
{
|
||||
pcStatusMessage = "Error: Flop\r\n";
|
||||
}
|
||||
else if( xAreComTestTasksStillRunning() != pdPASS )
|
||||
{
|
||||
pcStatusMessage = "Error: Comtest\r\n";
|
||||
}
|
||||
else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
|
||||
{
|
||||
pcStatusMessage = "Error: Dynamic\r\n";
|
||||
}
|
||||
else if( xAreTimerDemoTasksStillRunning( xExecutionRate ) != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: TimerDemo";
|
||||
}
|
||||
else if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
|
||||
{
|
||||
/* Check the reg test tasks are still cycling. They will stop
|
||||
incrementing their loop counters if they encounter an error. */
|
||||
pcStatusMessage = "Error: RegTest1\r\n";
|
||||
}
|
||||
else if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
|
||||
{
|
||||
pcStatusMessage = "Error: RegTest2\r\n";
|
||||
}
|
||||
|
||||
/* Store a local copy of the current reg test loop counters. If these have
|
||||
not incremented the next time this callback function is executed then the
|
||||
reg test tasks have either stalled or discovered an error. */
|
||||
ulLastRegTest1CycleCount = ulRegTest1CycleCount;
|
||||
ulLastRegTest2CycleCount = ulRegTest2CycleCount;
|
||||
|
||||
/* Toggle the check LED to give an indication of the system status. If
|
||||
the LED toggles every 5 seconds then everything is ok. A faster toggle
|
||||
indicates an error. */
|
||||
vParTestToggleLED( mainCHECK_LED );
|
||||
|
||||
if( pcStatusMessage != NULL )
|
||||
{
|
||||
if( lErrorAlreadyLatched == pdFALSE )
|
||||
{
|
||||
/* An error has occurred, so change the period of the timer that
|
||||
calls this callback function. This results in the LED toggling at
|
||||
a faster rate - giving the user visual feedback that something is not
|
||||
as it should be. This function is called from the context of the
|
||||
timer service task so must ***not*** attempt to block while calling
|
||||
this function. */
|
||||
if( xTimerChangePeriod( xTimer, mainERROR_CHECK_TIMER_PERIOD, mainDONT_BLOCK ) == pdPASS )
|
||||
{
|
||||
/* If the command to change the timer period was sent to the
|
||||
timer command queue successfully, then latch the fact that the
|
||||
timer period has already been changed. This is just done to
|
||||
prevent xTimerChangePeriod() being called on every execution of
|
||||
this function once an error has been discovered. */
|
||||
lErrorAlreadyLatched = pdTRUE;
|
||||
}
|
||||
|
||||
/* Update the xExecutionRate variable too as the rate at which this
|
||||
callback is executed has to be passed into the
|
||||
xAreTimerDemoTasksStillRunning() function. */
|
||||
xExecutionRate = mainERROR_CHECK_TIMER_PERIOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is an application defined callback function used to install the tick
|
||||
interrupt handler. It is provided as an application callback because the kernel
|
||||
will run on lots of different MicroBlaze and FPGA configurations - not all of
|
||||
which will have the same timer peripherals defined or available. This example
|
||||
uses the AXI Timer 0. If that is available on your hardware platform then this
|
||||
example callback implementation should not require modification. The name of
|
||||
the interrupt handler that should be installed is vPortTickISR(), which the
|
||||
function below declares as an extern. */
|
||||
void vApplicationSetupTimerInterrupt( void )
|
||||
{
|
||||
portBASE_TYPE xStatus;
|
||||
const unsigned char ucTimerCounterNumber = ( unsigned char ) 0U;
|
||||
const unsigned long ulCounterValue = ( ( XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
extern void vPortTickISR( void *pvUnused );
|
||||
|
||||
/* Initialise the timer/counter. */
|
||||
xStatus = XTmrCtr_Initialize( &xTimer0Instance, XPAR_AXI_TIMER_0_DEVICE_ID );
|
||||
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Install the tick interrupt handler as the timer ISR.
|
||||
*NOTE* The xPortInstallInterruptHandler() API function must be used for
|
||||
this purpose. */
|
||||
xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_TMRCTR_0_VEC_ID, vPortTickISR, NULL );
|
||||
}
|
||||
|
||||
if( xStatus == pdPASS )
|
||||
{
|
||||
/* Enable the timer interrupt in the interrupt controller.
|
||||
*NOTE* The vPortEnableInterrupt() API function must be used for this
|
||||
purpose. */
|
||||
vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );
|
||||
|
||||
/* Configure the timer interrupt handler. */
|
||||
XTmrCtr_SetHandler( &xTimer0Instance, ( void * ) vPortTickISR, NULL );
|
||||
|
||||
/* Set the correct period for the timer. */
|
||||
XTmrCtr_SetResetValue( &xTimer0Instance, ucTimerCounterNumber, ulCounterValue );
|
||||
|
||||
/* Enable the interrupts. Auto-reload mode is used to generate a
|
||||
periodic tick. Note that interrupts are disabled when this function is
|
||||
called, so interrupts will not start to be processed until the first
|
||||
task has started to run. */
|
||||
XTmrCtr_SetOptions( &xTimer0Instance, ucTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );
|
||||
|
||||
/* Start the timer. */
|
||||
XTmrCtr_Start( &xTimer0Instance, ucTimerCounterNumber );
|
||||
}
|
||||
|
||||
/* Sanity check that the function executed as expected. */
|
||||
configASSERT( ( xStatus == pdPASS ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is an application defined callback function used to clear whichever
|
||||
interrupt was installed by the the vApplicationSetupTimerInterrupt() callback
|
||||
function - in this case the interrupt generated by the AXI timer. It is
|
||||
provided as an application callback because the kernel will run on lots of
|
||||
different MicroBlaze and FPGA configurations - not all of which will have the
|
||||
same timer peripherals defined or available. This example uses the AXI Timer 0.
|
||||
If that is available on your hardware platform then this example callback
|
||||
implementation should not require modification provided the example definition
|
||||
of vApplicationSetupTimerInterrupt() is also not modified. */
|
||||
void vApplicationClearTimerInterrupt( void )
|
||||
{
|
||||
unsigned long ulCSR;
|
||||
|
||||
/* Clear the timer interrupt */
|
||||
ulCSR = XTmrCtr_GetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0 );
|
||||
XTmrCtr_SetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0, ulCSR );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue or
|
||||
semaphore is created. It is also called by various parts of the demo
|
||||
application. If heap_1.c or heap_2.c are used, then the size of the heap
|
||||
available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
|
||||
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
|
||||
to query the size of free heap space that remains (although it does not
|
||||
provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* vApplicationStackOverflowHook() will only be called if
|
||||
configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2. The handle and name
|
||||
of the offending task will be passed into the hook function via its
|
||||
parameters. However, when a stack has overflowed, it is possible that the
|
||||
parameters will have been corrupted, in which case the pxCurrentTCB variable
|
||||
can be inspected directly. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
static long lCheckTimerStarted = pdFALSE;
|
||||
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If the application makes use of the
|
||||
vTaskDelete() API function (as this demo application does) then it is also
|
||||
important that vApplicationIdleHook() is permitted to return to its calling
|
||||
function, because it is the responsibility of the idle task to clean up
|
||||
memory allocated by the kernel to any task that has since been deleted. */
|
||||
|
||||
/* If the check timer has not already been started, then start it now.
|
||||
Normally, the xTimerStart() API function can be called immediately after the
|
||||
timer is created - how this demo application includes the timer demo tasks.
|
||||
The timer demo tasks, as part of their test function, deliberately fill up
|
||||
the timer command queue - meaning the check timer cannot be started until
|
||||
after the scheduler has been started - at which point the timer command
|
||||
queue will have been drained. */
|
||||
if( lCheckTimerStarted == pdFALSE )
|
||||
{
|
||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||
lCheckTimerStarted = pdTRUE;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* vApplicationTickHook() will only be called if configUSE_TICK_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It executes from an interrupt context so must
|
||||
not use any FreeRTOS API functions that do not end in ...FromISR(). */
|
||||
|
||||
/* Call the periodic timer test, which tests the timer API functions that
|
||||
can be called from an ISR. */
|
||||
vTimerPeriodicISRTests();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump )
|
||||
{
|
||||
( void ) xRegisterDump;
|
||||
|
||||
/* If configINSTALL_EXCEPTION_HANDLERS is set to 1 in FreeRTOSConfig.h, then
|
||||
the kernel will automatically install its own exception handlers before the
|
||||
kernel is started, if the application writer has not already caused them to
|
||||
be installed by calling either of the vPortExceptionsInstallHandlers()
|
||||
or xPortInstallInterruptHandler() API functions before that time. The
|
||||
kernels exception handler populates an xPortRegisterDump structure with
|
||||
the processor state at the point that the exception was triggered - and also
|
||||
includes a strings that say what the exception cause was and which task was
|
||||
running at the time. The exception handler then passes the populated
|
||||
xPortRegisterDump structure into vApplicationExceptionRegisterDump() to
|
||||
allow the application writer to perform any debugging that may be necessary.
|
||||
However, defining vApplicationExceptionRegisterDump() within the application
|
||||
itself is optional. The kernel will use a default implementation if the
|
||||
application writer chooses not to provide their own. */
|
||||
for( ;; )
|
||||
{
|
||||
portNOP();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
taskDISABLE_INTERRUPTS();
|
||||
|
||||
/* Configure the LED outputs. */
|
||||
vParTestInitialise();
|
||||
|
||||
/* Tasks inherit the exception and cache configuration of the MicroBlaze
|
||||
at the point that they are created. */
|
||||
#if MICROBLAZE_EXCEPTIONS_ENABLED == 1
|
||||
microblaze_enable_exceptions();
|
||||
#endif
|
||||
|
||||
#if XPAR_MICROBLAZE_USE_ICACHE == 1
|
||||
microblaze_invalidate_icache();
|
||||
microblaze_enable_icache();
|
||||
#endif
|
||||
|
||||
#if XPAR_MICROBLAZE_USE_DCACHE == 1
|
||||
microblaze_invalidate_dcache();
|
||||
microblaze_enable_dcache();
|
||||
#endif
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vMainConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
unsigned long ulRunTimeStatsDivisor;
|
||||
|
||||
/* How many times does the counter counter increment in 10ms? */
|
||||
ulRunTimeStatsDivisor = 0UL / 1000UL; //_RB_
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulMainGetRunTimeCounterValue( void )
|
||||
{
|
||||
unsigned long ulReturn, ulCurrentCount;
|
||||
|
||||
ulCurrentCount = 0UL;
|
||||
ulReturn = 0UL;
|
||||
|
||||
return ulReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
char *pcMainGetTaskStatusMessage( void )
|
||||
{
|
||||
return ( char * ) pcStatusMessage;
|
||||
}
|
||||
|
||||
|
||||
|
209
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/serial.c
Normal file
209
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/serial.c
Normal file
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/*
|
||||
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR a UARTLite peripheral.
|
||||
*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
#include "comtest_strings.h"
|
||||
|
||||
/* Library includes. */
|
||||
#include "xuartlite.h"
|
||||
#include "xuartlite_l.h"
|
||||
|
||||
/* Demo application includes. */
|
||||
#include "serial.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Functions that are installed as the handler for interrupts that are caused by
|
||||
Rx and Tx events respectively. */
|
||||
static void prvRxHandler( void *pvUnused, unsigned portBASE_TYPE uxByteCount );
|
||||
static void prvTxHandler( void *pvUnused, unsigned portBASE_TYPE uxByteCount );
|
||||
|
||||
/* Structure that hold the state of the UARTLite peripheral used by this demo.
|
||||
This is used by the Xilinx peripheral driver API functions. */
|
||||
static XUartLite xUartLiteInstance;
|
||||
|
||||
/* The queue used to hold received characters. */
|
||||
static xQueueHandle xRxedChars;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||
{
|
||||
portBASE_TYPE xStatus;
|
||||
|
||||
/* The standard demo header file requires a baud rate to be passed into this
|
||||
function. However, in this case the baud rate is configured when the
|
||||
hardware is generated, leaving the ulWantedBaud parameter redundant. */
|
||||
( void ) ulWantedBaud;
|
||||
|
||||
/* Create the queue used to hold Rx characters. */
|
||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
|
||||
|
||||
/* If the queue was created correctly, then setup the serial port
|
||||
hardware. */
|
||||
if( xRxedChars != NULL )
|
||||
{
|
||||
xStatus = XUartLite_Initialize( &xUartLiteInstance, XPAR_UARTLITE_1_DEVICE_ID );
|
||||
|
||||
if( xStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Complete initialisation of the UART and its associated
|
||||
interrupts. */
|
||||
XUartLite_ResetFifos( &xUartLiteInstance );
|
||||
|
||||
/* Install the handlers that the standard Xilinx library interrupt
|
||||
service routine will call when Rx and Tx events occur
|
||||
respectively. */
|
||||
XUartLite_SetRecvHandler( &xUartLiteInstance, ( XUartLite_Handler ) prvRxHandler, NULL );
|
||||
XUartLite_SetSendHandler( &xUartLiteInstance, ( XUartLite_Handler ) prvTxHandler, NULL );
|
||||
|
||||
/* Install the standard Xilinx library interrupt handler itself.
|
||||
*NOTE* The xPortInstallInterruptHandler() API function must be used
|
||||
for this purpose. */
|
||||
xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_UARTLITE_1_VEC_ID, ( XInterruptHandler ) XUartLite_InterruptHandler, &xUartLiteInstance );
|
||||
|
||||
/* Enable the interrupt in the peripheral. */
|
||||
XUartLite_EnableIntr( xUartLiteInstance.RegBaseAddress );
|
||||
|
||||
/* Enable the interrupt in the interrupt controller.
|
||||
*NOTE* The vPortEnableInterrupt() API function must be used for this
|
||||
purpose. */
|
||||
vPortEnableInterrupt( XPAR_INTC_0_UARTLITE_1_VEC_ID );
|
||||
}
|
||||
|
||||
configASSERT( xStatus == pdPASS );
|
||||
}
|
||||
|
||||
/* This demo file only supports a single port but something must be
|
||||
returned to comply with the standard demo header file. */
|
||||
return ( xComPortHandle ) 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||
{
|
||||
/* The port handle is not required as this driver only supports one port. */
|
||||
( void ) pxPort;
|
||||
|
||||
/* Get the next character from the receive queue. Return false if no
|
||||
characters are available, or arrive before xBlockTime expires. */
|
||||
if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
|
||||
{
|
||||
return pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pdFALSE;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||
{
|
||||
( void ) pxPort;
|
||||
|
||||
/* Output uxStringLength bytes starting from pcString. */
|
||||
XUartLite_Send( &xUartLiteInstance, ( unsigned char * ) pcString, usStringLength );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRxHandler( void *pvUnused, unsigned portBASE_TYPE uxByteCount )
|
||||
{
|
||||
signed char cRxedChar;
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
( void ) pvUnused;
|
||||
( void ) uxByteCount;
|
||||
|
||||
/* Place any received characters into the receive queue. */
|
||||
while( XUartLite_IsReceiveEmpty( xUartLiteInstance.RegBaseAddress ) == pdFALSE )
|
||||
{
|
||||
cRxedChar = XUartLite_ReadReg( xUartLiteInstance.RegBaseAddress, XUL_RX_FIFO_OFFSET);
|
||||
xQueueSendFromISR( xRxedChars, &cRxedChar, &xHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
/* If calling xQueueSendFromISR() caused a task to unblock, and the task
|
||||
that unblocked has a priority equal to or greater than the task currently
|
||||
in the Running state (the task that was interrupted), then
|
||||
xHigherPriorityTaskWoken will have been set to pdTRUE internally within the
|
||||
xQueueSendFromISR() API function. If xHigherPriorityTaskWoken is equal to
|
||||
pdTRUE then a context switch should be requested to ensure that the
|
||||
interrupt returns to the highest priority task that is able to run. */
|
||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvTxHandler( void *pvUnused, unsigned portBASE_TYPE uxByteCount )
|
||||
{
|
||||
( void ) pvUnused;
|
||||
( void ) uxByteCount;
|
||||
|
||||
/* Nothing to do here. The Xilinx library function takes care of the
|
||||
transmission. */
|
||||
portNOP();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: emaclite_header.h,v 1.1.2.2 2010/09/16 12:57:34 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef EMACLITE_HEADER_H /* prevent circular inclusions */
|
||||
#define EMACLITE_HEADER_H /* by using protection macros */
|
||||
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int EmacLitePolledExample(u16 DeviceId);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: emaclite_intr_header.h,v 1.1.2.2 2010/09/16 12:57:34 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef EMACLITE_INTR_HEADER_H /* prevent circular inclusions */
|
||||
#define EMACLITE_INTR_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int EmacLiteIntrExample(XIntc* IntcInstancePtr,
|
||||
XEmacLite* EmacLiteInstPtr,
|
||||
u16 EmacLiteDeviceId,
|
||||
u16 EmacLiteIntrId);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: gpio_header.h,v 1.1.2.2 2010/09/16 13:03:37 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef GPIO_HEADER_H /* prevent circular inclusions */
|
||||
#define GPIO_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int GpioOutputExample(u16 DeviceId, u32 GpioWidth);
|
||||
int GpioInputExample(u16 DeviceId, u32 *DataRead);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: gpio_intr_header.h,v 1.1.2.2 2010/09/16 13:03:37 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef GPIO_INTR_HEADER_H /* prevent circular inclusions */
|
||||
#define GPIO_INTR_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
|
||||
int GpioIntrExample(XIntc* IntcInstancePtr,
|
||||
XGpio* InstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u16 IntrMask,
|
||||
u32 *DataRead);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: intc_header.h,v 1.1.4.1 2010/09/17 05:32:46 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2006-2009 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef INTC_HEADER_H /* prevent circular inclusions */
|
||||
#define INTC_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_assert.h"
|
||||
#include "xil_types.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int IntcSelfTestExample(u16 DeviceId);
|
||||
int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId);
|
||||
|
||||
#endif
|
||||
|
213
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/src/lscript.ld
Normal file
213
Demo/MicroBlaze_Spartan-6_Ethernet/RTOSDemoSource/src/lscript.ld
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*******************************************************************/
|
||||
/* */
|
||||
/* This file is automatically generated by linker script generator.*/
|
||||
/* */
|
||||
/* Version: Xilinx EDK 13.1 EDK_O.40d */
|
||||
/* */
|
||||
/* Copyright (c) 2010 Xilinx, Inc. All rights reserved. */
|
||||
/* */
|
||||
/* Description : MicroBlaze Linker Script */
|
||||
/* */
|
||||
/*******************************************************************/
|
||||
|
||||
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400;
|
||||
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x8;
|
||||
|
||||
/* Define Memories in the system */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
microblaze_0_i_bram_ctrl_microblaze_0_d_bram_ctrl : ORIGIN = 0x00000050, LENGTH = 0x00001FB0
|
||||
MCB_DDR3_S0_AXI_BASEADDR : ORIGIN = 0xC0000000, LENGTH = 0x08000000
|
||||
}
|
||||
|
||||
/* Specify the default entry point to the program */
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
/* Define the sections, and where they are mapped in memory */
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.vectors.reset 0x00000000 : {
|
||||
*(.vectors.reset)
|
||||
}
|
||||
|
||||
.vectors.sw_exception 0x00000008 : {
|
||||
*(.vectors.sw_exception)
|
||||
}
|
||||
|
||||
.vectors.interrupt 0x00000010 : {
|
||||
*(.vectors.interrupt)
|
||||
}
|
||||
|
||||
.vectors.hw_exception 0x00000020 : {
|
||||
*(.vectors.hw_exception)
|
||||
}
|
||||
|
||||
.text : {
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.init : {
|
||||
KEEP (*(.init))
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.fini : {
|
||||
KEEP (*(.fini))
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.rodata : {
|
||||
__rodata_start = .;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
__rodata_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.sdata2 : {
|
||||
. = ALIGN(8);
|
||||
__sdata2_start = .;
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
. = ALIGN(8);
|
||||
__sdata2_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.sbss2 : {
|
||||
__sbss2_start = .;
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
__sbss2_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.data : {
|
||||
. = ALIGN(4);
|
||||
__data_start = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
__data_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.got : {
|
||||
*(.got)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.got1 : {
|
||||
*(.got1)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.got2 : {
|
||||
*(.got2)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.ctors : {
|
||||
__CTOR_LIST__ = .;
|
||||
___CTORS_LIST___ = .;
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
__CTOR_END__ = .;
|
||||
___CTORS_END___ = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.dtors : {
|
||||
__DTOR_LIST__ = .;
|
||||
___DTORS_LIST___ = .;
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
__DTOR_END__ = .;
|
||||
___DTORS_END___ = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.eh_frame : {
|
||||
*(.eh_frame)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.jcr : {
|
||||
*(.jcr)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.gcc_except_table : {
|
||||
*(.gcc_except_table)
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.sdata : {
|
||||
. = ALIGN(8);
|
||||
__sdata_start = .;
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
__sdata_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.sbss : {
|
||||
. = ALIGN(4);
|
||||
__sbss_start = .;
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
. = ALIGN(8);
|
||||
__sbss_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.tdata : {
|
||||
__tdata_start = .;
|
||||
*(.tdata)
|
||||
*(.tdata.*)
|
||||
*(.gnu.linkonce.td.*)
|
||||
__tdata_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.tbss : {
|
||||
__tbss_start = .;
|
||||
*(.tbss)
|
||||
*(.tbss.*)
|
||||
*(.gnu.linkonce.tb.*)
|
||||
__tbss_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.bss : {
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
|
||||
|
||||
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
|
||||
|
||||
/* Generate Stack and Heap definitions */
|
||||
|
||||
.heap : {
|
||||
. = ALIGN(8);
|
||||
_heap = .;
|
||||
_heap_start = .;
|
||||
. += _HEAP_SIZE;
|
||||
_heap_end = .;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
.stack : {
|
||||
_stack_end = .;
|
||||
. += _STACK_SIZE;
|
||||
. = ALIGN(8);
|
||||
_stack = .;
|
||||
__stack = _stack;
|
||||
} > MCB_DDR3_S0_AXI_BASEADDR
|
||||
|
||||
_end = .;
|
||||
}
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#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"
|
||||
|
||||
|
||||
#define GPIO_CHANNEL1 1
|
||||
|
||||
int xmain()
|
||||
{
|
||||
|
||||
static XIntc intc;
|
||||
static XGpio Push_Buttons_4Bits_Gpio;
|
||||
static XTmrCtr axi_timer_0_Timer;
|
||||
static XEmacLite Ethernet_Lite_EmacLite;
|
||||
|
||||
XCACHE_ENABLE_ICACHE();
|
||||
XCACHE_ENABLE_DCACHE();
|
||||
|
||||
print("---Entering main---\n\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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print("---Exiting main---\n\r");
|
||||
|
||||
XCACHE_DISABLE_ICACHE();
|
||||
XCACHE_DISABLE_DCACHE();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: tmrctr_header.h,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TMRCTR_HEADER_H /* prevent circular inclusions */
|
||||
#define TMRCTR_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: tmrctr_intr_header.h,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2005-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TMRCTR_INTR_HEADER_H /* prevent circular inclusions */
|
||||
#define TMRCTR_INTR_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
|
||||
int TmrCtrIntrExample(XIntc* IntcInstancePtr,
|
||||
XTmrCtr* InstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u8 TmrCtrNumber);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: uartlite_header.h,v 1.1.2.2 2010/09/16 12:12:57 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2006-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef UARTLITE_HEADER_H /* prevent circular inclusions */
|
||||
#define UARTLITE_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int UartLiteSelfTestExample(u16 DeviceId);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xemaclite_example.h,v 1.1.2.1 2010/07/12 08:34:24 svemula Exp $
|
||||
*/
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xemaclite_example.h
|
||||
*
|
||||
* Defines common data types, prototypes, and includes the proper headers
|
||||
* for use with the EmacLite example code residing in this directory.
|
||||
*
|
||||
* This file along with xemaclite_example_util.c are utilized with the specific
|
||||
* example code in the other source code files provided.
|
||||
*
|
||||
* These examples are designed to be compiled and utilized within the EDK
|
||||
* standalone BSP development environment. The readme file contains more
|
||||
* information on build requirements needed by these examples.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 2.00a ktn 04/13/09 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef XEMACLITE_EXAMPLE_H
|
||||
#define XEMACLITE_EXAMPLE_H
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xemaclite.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
#define PHY_REG0_OFFSET 0 /* Register 0 of PHY device */
|
||||
#define PHY_REG1_OFFSET 1 /* Register 1 of PHY device */
|
||||
|
||||
#define PHY_REG0_RESET_MASK 0x8000 /* Reset Phy device */
|
||||
#define PHY_REG0_LOOPBACK_MASK 0x4000 /* Loopback Enable in Phy */
|
||||
#define PHY_REG0_SPD_100_MASK 0x2000 /* Speed of 100Mbps for Phy */
|
||||
|
||||
#define PHY_REG1_DETECT_MASK 0x1808 /* Mask to detect PHY device */
|
||||
|
||||
#define EMACLITE_PHY_DELAY_SEC 4 /* Amount of time to delay waiting on
|
||||
* PHY to reset.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define EMAC_DEVICE_ID XPAR_EMACLITE_0_DEVICE_ID
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
/*
|
||||
* Utility functions implemented in xemaclite_example_util.c
|
||||
*/
|
||||
void EmacLitePhyDelay(unsigned int Seconds);
|
||||
u32 EmacLitePhyDetect(XEmacLite *InstancePtr);
|
||||
int EmacLiteEnablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress);
|
||||
int EmacLiteDisablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress);
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
/*
|
||||
* Set up valid local MAC addresses. This loop back test uses the LocalAddress
|
||||
* both as a source and destination MAC address.
|
||||
*/
|
||||
|
||||
XEmacLite EmacLiteInstance; /* Instance of the EmacLite */
|
||||
|
||||
/*
|
||||
* Buffers used for Transmission and Reception of Packets. These are declared
|
||||
* as global so that they are not a part of the stack.
|
||||
*/
|
||||
u8 TxFrame[XEL_MAX_FRAME_SIZE];
|
||||
u8 RxFrame[XEL_MAX_FRAME_SIZE];
|
||||
|
||||
volatile u32 RecvFrameLength; /* Indicates the length of the Received packet
|
||||
*/
|
||||
volatile int TransmitComplete; /* Flag to indicate that the Transmission
|
||||
* is complete
|
||||
*/
|
||||
#endif /* XTEMAC_EXAMPLE_H */
|
||||
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xemaclite_example_util.c,v 1.1.2.1 2010/07/12 08:34:25 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xemaclite_example_util.c
|
||||
*
|
||||
* This file implements the utility functions for the EmacLite example code.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 2.00a ktn 04/13/09 First release
|
||||
* 2.00a ktn 06/13/09 Changed the EmacLitePhyDetect function so that
|
||||
* the function is not in an infinite loop in case of a
|
||||
* faulty Phy device.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xemaclite_example.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function detects the PHY address by looking for successful MII status
|
||||
* register contents (PHY register 1). It looks for a PHY that supports
|
||||
* auto-negotiation and 10Mbps full-duplex and half-duplex. So, this code
|
||||
* won't work for PHYs that don't support those features, but it's a bit more
|
||||
* general purpose than matching a specific PHY manufacturer ID.
|
||||
*
|
||||
* Note also that on some (older) Xilinx ML4xx boards, PHY address 0 does not
|
||||
* properly respond to this query. But, since the default is 0 and assuming
|
||||
* no other address responds, then it seems to work OK.
|
||||
*
|
||||
* @param InstancePtr is the pointer to the instance of EmacLite driver.
|
||||
*
|
||||
* @return The address of the PHY device detected (returns 0 if not
|
||||
* detected).
|
||||
*
|
||||
* @note
|
||||
* The bit mask (0x1808) of the MII status register
|
||||
* (PHY Register 1) used in this function are:
|
||||
* 0x1000: 10Mbps full duplex support.
|
||||
* 0x0800: 10Mbps half duplex support.
|
||||
* 0x0008: Auto-negotiation support.
|
||||
*
|
||||
******************************************************************************/
|
||||
u32 EmacLitePhyDetect(XEmacLite *InstancePtr)
|
||||
{
|
||||
u16 PhyData;
|
||||
int PhyAddr;
|
||||
|
||||
/*
|
||||
* Verify all 32 MDIO ports.
|
||||
*/
|
||||
for (PhyAddr = 31; PhyAddr >= 0; PhyAddr--) {
|
||||
XEmacLite_PhyRead(InstancePtr, PhyAddr, PHY_REG1_OFFSET,
|
||||
&PhyData);
|
||||
|
||||
if (PhyData != 0xFFFF) {
|
||||
if ((PhyData & PHY_REG1_DETECT_MASK) ==
|
||||
PHY_REG1_DETECT_MASK) {
|
||||
return PhyAddr; /* Found a valid PHY device */
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Unable to detect PHY device returning the default address of 0.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function enables the MAC loopback on the PHY.
|
||||
*
|
||||
* @param InstancePtr is the pointer to the instance of EmacLite driver.
|
||||
* @param PhyAddress is the address of the Phy device.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the loop back is enabled.
|
||||
* - XST_FAILURE if the loop back was not enabled.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int EmacLiteEnablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress)
|
||||
{
|
||||
int Status;
|
||||
u16 PhyData = 0;
|
||||
|
||||
/*
|
||||
* Set the speed and put the PHY in reset.
|
||||
*/
|
||||
PhyData |= PHY_REG0_SPD_100_MASK;
|
||||
Status = XEmacLite_PhyWrite(InstancePtr, PhyAddress, PHY_REG0_OFFSET,
|
||||
PhyData | PHY_REG0_RESET_MASK);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give sufficient delay for Phy Reset.
|
||||
*/
|
||||
EmacLitePhyDelay(EMACLITE_PHY_DELAY_SEC);
|
||||
|
||||
/*
|
||||
* Set the PHY in loop back.
|
||||
*/
|
||||
XEmacLite_PhyWrite(InstancePtr, PhyAddress, PHY_REG0_OFFSET,
|
||||
PhyData | PHY_REG0_LOOPBACK_MASK);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give sufficient delay for Phy Loopback Enable.
|
||||
*/
|
||||
EmacLitePhyDelay(1);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the MAC loopback on the PHY.
|
||||
*
|
||||
* @param InstancePtr is the pointer to the instance of EmacLite driver.
|
||||
* @param PhyAddress is the address of the Phy device.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the loop back was disabled.
|
||||
* - XST_FAILURE if the loop back was not disabled.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int EmacLiteDisablePhyLoopBack(XEmacLite *InstancePtr, u32 PhyAddress)
|
||||
{
|
||||
int Status;
|
||||
u16 PhyData;
|
||||
|
||||
/*
|
||||
* Disable loop back through PHY register using MDIO support.
|
||||
*/
|
||||
Status = XEmacLite_PhyRead(InstancePtr, PhyAddress, PHY_REG0_OFFSET,
|
||||
&PhyData);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = XEmacLite_PhyWrite(InstancePtr,PhyAddress, PHY_REG0_OFFSET,
|
||||
PhyData & ~(PHY_REG0_LOOPBACK_MASK));
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* For PPC we use a usleep call, for Microblaze we use an assembly loop that
|
||||
* is roughly the same regardless of optimization level, although caches and
|
||||
* memory access time can make the delay vary. Just keep in mind that after
|
||||
* resetting or updating the PHY modes, the PHY typically needs time to recover.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
******************************************************************************/
|
||||
void EmacLitePhyDelay(unsigned int Seconds)
|
||||
{
|
||||
#ifdef __MICROBLAZE__
|
||||
static int WarningFlag = 0;
|
||||
|
||||
/* If MB caches are disabled or do not exist, this delay loop could
|
||||
* take minutes instead of seconds (e.g., 30x longer). Print a warning
|
||||
* message for the user (once). If only MB had a built-in timer!
|
||||
*/
|
||||
if (((mfmsr() & 0x20) == 0) && (!WarningFlag)) {
|
||||
#ifdef STDOUT_BASEADDRESS
|
||||
xil_printf("Warning: This example will take ");
|
||||
xil_printf("minutes to complete without I-cache enabled \r\n");
|
||||
#endif
|
||||
WarningFlag = 1;
|
||||
}
|
||||
|
||||
#define ITERS_PER_SEC (XPAR_CPU_CORE_CLOCK_FREQ_HZ / 6)
|
||||
asm volatile ("\n"
|
||||
"1: \n\t"
|
||||
"addik r7, r0, %0 \n\t"
|
||||
"2: \n\t"
|
||||
"addik r7, r7, -1 \n\t"
|
||||
"bneid r7, 2b \n\t"
|
||||
"or r0, r0, r0 \n\t"
|
||||
"bneid %1, 1b \n\t"
|
||||
"addik %1, %1, -1 \n\t"
|
||||
:: "i"(ITERS_PER_SEC), "d" (Seconds));
|
||||
|
||||
#else
|
||||
|
||||
usleep(Seconds * 1000000);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,684 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xemaclite_intr_example.c,v 1.1.2.2 2010/08/06 15:11:04 anirudh Exp $
|
||||
*/
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2003-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
2* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xemaclite_intr_example.c
|
||||
*
|
||||
* This file contains an example for using the EmacLite hardware and driver.
|
||||
* This file contains an interrupt example outlining the use of interrupts and
|
||||
* callbacks in the transmission/reception of an Ethernet frame of 1000 bytes of
|
||||
* payload.
|
||||
*
|
||||
* If the MDIO interface is NOT configured in the EmacLite core then this example
|
||||
* will transmit a frame.
|
||||
* If the MDIO interface is configured in the EmacLite core then this example
|
||||
* will enable the MAC loopback in the PHY device, then transmit the frame and
|
||||
* compare the received frame.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.01a ecm 05/21/04 First release
|
||||
* 1.01a sv 06/06/05 Minor changes to comply to Doxygen and coding guidelines
|
||||
* 1.01a sv 06/06/06 Minor changes for supporting Test App Interrupt examples
|
||||
* 2.00a ktn 02/25/09 Updated to use PHY loop back if MDIO is configured in
|
||||
* core
|
||||
* 3.00a ktn 10/22/09 Updated the example to use the HAL APIs/macros.
|
||||
* Updated example to use the macros that have been changed
|
||||
* in the driver to remove _m from the name of the macro.
|
||||
* 3.01a ktn 07/08/10 Updated example to support Little Endian MicroBlaze.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xemaclite_example.h"
|
||||
#include "xintc.h"
|
||||
#include "xil_exception.h"
|
||||
#include "xil_io.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
|
||||
#define INTC_EMACLITE_ID XPAR_INTC_0_EMACLITE_0_VEC_ID
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Size of the Test Frame.
|
||||
*/
|
||||
#define EMACLITE_TEST_FRAME_SIZE 1000
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int EmacLiteIntrExample(XIntc *IntcInstancePtr,
|
||||
XEmacLite *EmacLiteInstPtr,
|
||||
u16 EmacLiteDeviceId,
|
||||
u16 EmacLiteIntrId);
|
||||
|
||||
static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr,
|
||||
u32 PayloadSize);
|
||||
static int EmacLiteRecvFrame(u32 PayloadSize);
|
||||
static void EmacLiteRecvHandler(void *CallBackRef);
|
||||
static void EmacLiteSendHandler(void *CallBackRef);
|
||||
static void EmacLiteDisableIntrSystem(XIntc *IntcInstancePtr,
|
||||
u16 EmacLiteIntrId);
|
||||
static int EmacLiteSetupIntrSystem(XIntc *IntcInstancePtr,
|
||||
XEmacLite *EmacLiteInstPtr, u16 EmacLiteIntrId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
XIntc IntcInstance; /* Instance of the Interrupt Controller */
|
||||
|
||||
/*
|
||||
* Set up valid local and remote MAC addresses. This loop back test uses the
|
||||
* LocalAddress both as a source and destination MAC address.
|
||||
*/
|
||||
static u8 RemoteAddress[XEL_MAC_ADDR_SIZE] =
|
||||
{
|
||||
0x00, 0x10, 0xa4, 0xb6, 0xfd, 0x09
|
||||
};
|
||||
static u8 LocalAddress[XEL_MAC_ADDR_SIZE] =
|
||||
{
|
||||
0x00, 0x0A, 0x35, 0x01, 0x02, 0x03
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function is the main function of the EmacLite interrupt example.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main()
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Run the EmacLite interrupt example , specify the parameters
|
||||
* generated in xparameters.h.
|
||||
*/
|
||||
Status = EmacLiteIntrExample(&IntcInstance,
|
||||
&EmacLiteInstance,
|
||||
EMAC_DEVICE_ID,
|
||||
INTC_EMACLITE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* The main entry point for the EmacLite driver example in interrupt mode.
|
||||
|
||||
* This function will transmit/receive the Ethernet frames and verify the
|
||||
* data in the received frame (if the MDIO interface is configured in the
|
||||
* EmacLite core).
|
||||
* This function simply transmits a frame if the MDIO interface is not
|
||||
* configured in the EmacLite core.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the instance of the Intc.
|
||||
* @param EmacLiteInstPtr is a pointer to the instance of the EmacLite.
|
||||
* @param EmacLiteDeviceId is device ID of the XEmacLite Device ,
|
||||
* typically XPAR_<EMACLITE_instance>_DEVICE_ID value from
|
||||
* xparameters.h.
|
||||
* @param EmacLiteIntrId is the interrupt ID and is typically
|
||||
* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID value from
|
||||
* xparameters.h.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int EmacLiteIntrExample(XIntc *IntcInstancePtr,
|
||||
XEmacLite *EmacLiteInstPtr,
|
||||
u16 EmacLiteDeviceId,
|
||||
u16 EmacLiteIntrId)
|
||||
{
|
||||
int Status;
|
||||
u32 PhyAddress = 0;
|
||||
XEmacLite_Config *ConfigPtr;
|
||||
|
||||
/*
|
||||
* Initialize the EmacLite device.
|
||||
*/
|
||||
ConfigPtr = XEmacLite_LookupConfig(EmacLiteDeviceId);
|
||||
if (ConfigPtr == NULL) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,
|
||||
ConfigPtr,
|
||||
ConfigPtr->BaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the MAC address.
|
||||
*/
|
||||
XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalAddress);
|
||||
|
||||
/*
|
||||
* Empty any existing receive frames.
|
||||
*/
|
||||
XEmacLite_FlushReceive(EmacLiteInstPtr);
|
||||
|
||||
|
||||
/*
|
||||
* Check if there is a Tx buffer available, if there isn't it is an
|
||||
* error.
|
||||
*/
|
||||
if (XEmacLite_TxBufferAvailable(EmacLiteInstPtr) != TRUE) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set up the interrupt infrastructure.
|
||||
*/
|
||||
Status = EmacLiteSetupIntrSystem(IntcInstancePtr,
|
||||
EmacLiteInstPtr,
|
||||
EmacLiteIntrId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the EmacLite handlers.
|
||||
*/
|
||||
XEmacLite_SetRecvHandler((EmacLiteInstPtr), (void *)(EmacLiteInstPtr),
|
||||
(XEmacLite_Handler)EmacLiteRecvHandler);
|
||||
XEmacLite_SetSendHandler((EmacLiteInstPtr), (void *)(EmacLiteInstPtr),
|
||||
(XEmacLite_Handler)EmacLiteSendHandler);
|
||||
|
||||
|
||||
/*
|
||||
* Enable the interrupts in the EmacLite controller.
|
||||
*/
|
||||
XEmacLite_EnableInterrupts(EmacLiteInstPtr);
|
||||
RecvFrameLength = 0;
|
||||
|
||||
/*
|
||||
* If the MDIO is configured in the device.
|
||||
*/
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
/*
|
||||
* Detect the PHY device and enable the MAC Loop back
|
||||
* in the PHY.
|
||||
*/
|
||||
PhyAddress = EmacLitePhyDetect(EmacLiteInstPtr);
|
||||
Status = EmacLiteEnablePhyLoopBack(EmacLiteInstPtr,
|
||||
PhyAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
XEmacLite_DisableInterrupts(EmacLiteInstPtr);
|
||||
EmacLiteDisableIntrSystem(IntcInstancePtr,
|
||||
EmacLiteIntrId);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Transmit an Ethernet frame.
|
||||
*/
|
||||
Status = EmacLiteSendFrame(EmacLiteInstPtr,
|
||||
EMACLITE_TEST_FRAME_SIZE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
/*
|
||||
* Disable the MAC Loop back in the PHY and
|
||||
* disable/disconnect the EmacLite Interrupts.
|
||||
*/
|
||||
EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,
|
||||
PhyAddress);
|
||||
XEmacLite_DisableInterrupts(EmacLiteInstPtr);
|
||||
EmacLiteDisableIntrSystem(IntcInstancePtr,
|
||||
EmacLiteIntrId);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the frame to be transmitted.
|
||||
*/
|
||||
while (TransmitComplete == FALSE);
|
||||
|
||||
/*
|
||||
* If the MDIO is not configured in the core then return XST_SUCCESS
|
||||
* as the frame has been transmitted.
|
||||
*/
|
||||
if (!XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
|
||||
/*
|
||||
* Disable and disconnect the EmacLite Interrupts.
|
||||
*/
|
||||
XEmacLite_DisableInterrupts(EmacLiteInstPtr);
|
||||
EmacLiteDisableIntrSystem(IntcInstancePtr, EmacLiteIntrId);
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the frame to be received.
|
||||
*/
|
||||
while (RecvFrameLength == 0);
|
||||
|
||||
/*
|
||||
* Check the received frame.
|
||||
*/
|
||||
Status = EmacLiteRecvFrame(EMACLITE_TEST_FRAME_SIZE);
|
||||
|
||||
/*
|
||||
* Diasble the Loop Back.
|
||||
*/
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
/*
|
||||
* Disable the MAC Loop back in the PHY.
|
||||
*/
|
||||
Status |= EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,
|
||||
PhyAddress);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable and disconnect the EmacLite Interrupts.
|
||||
*/
|
||||
XEmacLite_DisableInterrupts(EmacLiteInstPtr);
|
||||
EmacLiteDisableIntrSystem(IntcInstancePtr, EmacLiteIntrId);
|
||||
if ((Status != XST_SUCCESS) && (Status != XST_NO_DATA)) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function sends a frame of given size. This function assumes interrupt
|
||||
* mode and sends the frame.
|
||||
*
|
||||
* @param EmacLiteInstPtr is a pointer to the EmacLite instance.
|
||||
* @param PayloadSize is the size of the frame to create. The size only
|
||||
* reflects the payload size, it does not include the Ethernet
|
||||
* header size (14 bytes) nor the Ethernet CRC size (4 bytes).
|
||||
*
|
||||
* @return XST_SUCCESS if successful, else XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr, u32 PayloadSize)
|
||||
{
|
||||
int Status;
|
||||
u8 *FramePtr;
|
||||
u32 Index;
|
||||
|
||||
/*
|
||||
* Set the Complete flag to false.
|
||||
*/
|
||||
TransmitComplete = FALSE;
|
||||
|
||||
/*
|
||||
* Assemble the frame with a destination address and the source address.
|
||||
*/
|
||||
FramePtr = (u8 *)TxFrame;
|
||||
|
||||
/*
|
||||
* Set up the destination address as the local address for
|
||||
* Phy Loopback and Internal loopback.
|
||||
*/
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr) ||
|
||||
XEmacLite_IsLoopbackConfigured(EmacLiteInstPtr)) {
|
||||
|
||||
*FramePtr++ = LocalAddress[0];
|
||||
*FramePtr++ = LocalAddress[1];
|
||||
*FramePtr++ = LocalAddress[2];
|
||||
*FramePtr++ = LocalAddress[3];
|
||||
*FramePtr++ = LocalAddress[4];
|
||||
*FramePtr++ = LocalAddress[5];
|
||||
} else {
|
||||
/*
|
||||
* Fill in the valid Destination MAC address if
|
||||
* the Loopback is not enabled.
|
||||
*/
|
||||
*FramePtr++ = RemoteAddress[0];
|
||||
*FramePtr++ = RemoteAddress[1];
|
||||
*FramePtr++ = RemoteAddress[2];
|
||||
*FramePtr++ = RemoteAddress[3];
|
||||
*FramePtr++ = RemoteAddress[4];
|
||||
*FramePtr++ = RemoteAddress[5];
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the source MAC address.
|
||||
*/
|
||||
*FramePtr++ = LocalAddress[0];
|
||||
*FramePtr++ = LocalAddress[1];
|
||||
*FramePtr++ = LocalAddress[2];
|
||||
*FramePtr++ = LocalAddress[3];
|
||||
*FramePtr++ = LocalAddress[4];
|
||||
*FramePtr++ = LocalAddress[5];
|
||||
|
||||
/*
|
||||
* Set up the type/length field - be sure its in network order.
|
||||
*/
|
||||
*((u16 *)FramePtr) = Xil_Htons(PayloadSize);
|
||||
FramePtr++;
|
||||
FramePtr++;
|
||||
|
||||
/*
|
||||
* Now fill in the data field with known values so we can verify them.
|
||||
*/
|
||||
for (Index = 0; Index < PayloadSize; Index++) {
|
||||
*FramePtr++ = (u8)Index;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now send the frame.
|
||||
*/
|
||||
Status = XEmacLite_Send(EmacLiteInstPtr, (u8 *)TxFrame,
|
||||
PayloadSize + XEL_HEADER_SIZE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function receives a frame of given size. This function assumes interrupt
|
||||
* mode, receives the frame and verifies its contents.
|
||||
*
|
||||
* @param PayloadSize is the size of the frame to receive.
|
||||
* The size only reflects the payload size, it does not include the
|
||||
* Ethernet header size (14 bytes) nor the Ethernet CRC size (4
|
||||
* bytes).
|
||||
*
|
||||
* @return XST_SUCCESS if successful, a driver-specific return code if not.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int EmacLiteRecvFrame(u32 PayloadSize)
|
||||
{
|
||||
u8 *FramePtr;
|
||||
|
||||
/*
|
||||
* This assumes MAC does not strip padding or CRC.
|
||||
*/
|
||||
if (RecvFrameLength != 0) {
|
||||
int Index;
|
||||
|
||||
/*
|
||||
* Verify length, which should be the payload size.
|
||||
*/
|
||||
if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=
|
||||
PayloadSize) {
|
||||
return XST_LOOPBACK_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the contents of the Received Frame.
|
||||
*/
|
||||
FramePtr = (u8 *)RxFrame;
|
||||
FramePtr += XEL_HEADER_SIZE; /* Get past the header */
|
||||
|
||||
for (Index = 0; Index < PayloadSize; Index++) {
|
||||
if (*FramePtr++ != (u8)Index) {
|
||||
return XST_LOOPBACK_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function handles the receive callback from the EmacLite driver.
|
||||
*
|
||||
* @param CallBackRef is the call back reference provided to the Handler.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void EmacLiteRecvHandler(void *CallBackRef)
|
||||
{
|
||||
XEmacLite *XEmacInstancePtr;
|
||||
|
||||
/*
|
||||
* Convert the argument to something useful.
|
||||
*/
|
||||
XEmacInstancePtr = (XEmacLite *)CallBackRef;
|
||||
|
||||
/*
|
||||
* Handle the Receive callback.
|
||||
*/
|
||||
RecvFrameLength = XEmacLite_Recv(XEmacInstancePtr, (u8 *)RxFrame);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function handles the transmit callback from the EmacLite driver.
|
||||
*
|
||||
* @param CallBackRef is the call back reference provided to the Handler.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void EmacLiteSendHandler(void *CallBackRef)
|
||||
{
|
||||
XEmacLite *XEmacInstancePtr;
|
||||
|
||||
/*
|
||||
* Convert the argument to something useful.
|
||||
*/
|
||||
XEmacInstancePtr = (XEmacLite *)CallBackRef;
|
||||
|
||||
/*
|
||||
* Handle the Transmit callback.
|
||||
*/
|
||||
TransmitComplete = TRUE;
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function setups the interrupt system such that interrupts can occur
|
||||
* for the EmacLite device. This function is application specific since the
|
||||
* actual system may or may not have an interrupt controller. The EmacLite
|
||||
* could be directly connected to a processor without an interrupt controller.
|
||||
* The user should modify this function to fit the application.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the instance of the Intc.
|
||||
* @param EmacLiteInstPtr is a pointer to the instance of the EmacLite.
|
||||
* @param EmacLiteIntrId is the interrupt ID and is typically
|
||||
* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID
|
||||
* value from xparameters.h
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int EmacLiteSetupIntrSystem(XIntc *IntcInstancePtr,
|
||||
XEmacLite *EmacLiteInstPtr, u16 EmacLiteIntrId)
|
||||
{
|
||||
int Status;
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it is ready to
|
||||
* use.
|
||||
*/
|
||||
Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Connect a device driver handler that will be called when an interrupt
|
||||
* for the device occurs, the device driver handler performs the
|
||||
* specific interrupt processing for the device.
|
||||
*/
|
||||
Status = XIntc_Connect(IntcInstancePtr,
|
||||
EmacLiteIntrId,
|
||||
XEmacLite_InterruptHandler,
|
||||
(void *)(EmacLiteInstPtr));
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Start the interrupt controller such that interrupts are enabled for
|
||||
* all devices that cause interrupts, specific real mode so that
|
||||
* the EmacLite can cause interrupts thru the interrupt controller.
|
||||
*/
|
||||
Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable the interrupt for the EmacLite in the Interrupt controller.
|
||||
*/
|
||||
XIntc_Enable(IntcInstancePtr, EmacLiteIntrId);
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
|
||||
/*
|
||||
* Initialize the exception table.
|
||||
*/
|
||||
Xil_ExceptionInit();
|
||||
|
||||
/*
|
||||
* Register the interrupt controller handler with the exception table.
|
||||
*/
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
|
||||
(Xil_ExceptionHandler) XIntc_InterruptHandler,
|
||||
IntcInstancePtr);
|
||||
|
||||
/*
|
||||
* Enable non-critical exceptions.
|
||||
*/
|
||||
Xil_ExceptionEnable();
|
||||
|
||||
#endif /* TESTAPP_GEN */
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the interrupts that occur for the EmacLite device.
|
||||
*
|
||||
* @param IntcInstancePtr is the pointer to the instance of the INTC
|
||||
* component.
|
||||
* @param EmacLiteIntrId is the interrupt ID and is typically
|
||||
* XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID
|
||||
* value from xparameters.h.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void EmacLiteDisableIntrSystem(XIntc *IntcInstancePtr,
|
||||
u16 EmacLiteIntrId)
|
||||
{
|
||||
/*
|
||||
* Disconnect and disable the interrupts for the EmacLite device.
|
||||
*/
|
||||
XIntc_Disconnect(IntcInstancePtr, EmacLiteIntrId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,409 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xemaclite_polled_example.c,v 1.1.2.2 2010/08/06 15:11:04 anirudh Exp $
|
||||
*/
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2004-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xemaclite_polled_example.c
|
||||
*
|
||||
* This file contains an example for using the EmacLite hardware and driver.
|
||||
* This file contains an polled mode example outlining the transmission/reception
|
||||
* of an Ethernet frame of 1000 bytes of payload.
|
||||
*
|
||||
* If the MDIO interface is NOT configured in the EmacLite core then this example
|
||||
* will only transmit a frame.
|
||||
* If the MDIO interface is configured in the EmacLite core then this example
|
||||
* will enable the MAC loopback in the PHY device, then transmit the frame and
|
||||
* compare the received frame.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.01a ecm 21/05/04 First release
|
||||
* 1.01a sv 06/06/05 Minor changes to comply to Doxygen and coding guidelines
|
||||
* 2.00a ktn 02/25/09 Updated to use PHY loop back if MDIO is configured in
|
||||
* core and updated to be used in Test App
|
||||
* 3.00a ktn 10/22/09 Updated example to use the macros that have been changed
|
||||
* in the driver to remove _m from the name of the macro.
|
||||
* 3.01a ktn 07/08/10 Updated example to support Little Endian MicroBlaze.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xemaclite_example.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The Size of the Test Frame.
|
||||
*/
|
||||
#define EMACLITE_TEST_FRAME_SIZE 1000
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int EmacLitePolledExample(u16 DeviceId);
|
||||
|
||||
static int EmacLiteSendFrame(XEmacLite *InstancePtr, u32 PayloadSize);
|
||||
|
||||
static int EmacLiteRecvFrame(u32 PayloadSize);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
/*
|
||||
* Set up valid local and remote MAC addresses. This loop back test uses the
|
||||
* LocalAddress both as a source and destination MAC address.
|
||||
*/
|
||||
static u8 LocalAddress[XEL_MAC_ADDR_SIZE] =
|
||||
{
|
||||
0x00, 0x0A, 0x35, 0x01, 0x02, 0x03
|
||||
};
|
||||
static u8 RemoteAddress[XEL_MAC_ADDR_SIZE] =
|
||||
{
|
||||
0x00, 0x10, 0xa4, 0xb6, 0xfd, 0x09
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function is the main function of the EmacLite polled example.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE .
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main()
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Run the EmacLite Polled example, specify the Device ID that is
|
||||
* generated in xparameters.h.
|
||||
*/
|
||||
Status = EmacLitePolledExample(EMAC_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* The main entry point for the EmacLite driver example in polled mode.
|
||||
*
|
||||
* This function will transmit/receive the Ethernet frames and verify the
|
||||
* data in the received frame (if the MDIO interface is configured in the
|
||||
* EmacLite core).
|
||||
* This function simply transmits a frame if the MDIO interface is not
|
||||
* configured in the EmacLite core.
|
||||
*
|
||||
* @param DeviceId is device ID of the XEmacLite Device , typically
|
||||
* XPAR_<EMAC_instance>_DEVICE_ID value from xparameters.h.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int EmacLitePolledExample(u16 DeviceId)
|
||||
{
|
||||
int Status;
|
||||
XEmacLite *EmacLiteInstPtr = &EmacLiteInstance;
|
||||
u32 PhyAddress = 0;
|
||||
RecvFrameLength = 0;
|
||||
XEmacLite_Config *ConfigPtr;
|
||||
|
||||
/*
|
||||
* Initialize the EmacLite device.
|
||||
*/
|
||||
ConfigPtr = XEmacLite_LookupConfig(DeviceId);
|
||||
if (ConfigPtr == NULL) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,
|
||||
ConfigPtr,
|
||||
ConfigPtr->BaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the MAC address.
|
||||
*/
|
||||
XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalAddress);
|
||||
|
||||
/*
|
||||
* Empty any existing receive frames.
|
||||
*/
|
||||
XEmacLite_FlushReceive(EmacLiteInstPtr);
|
||||
|
||||
/*
|
||||
* Check if there is a TX buffer available, if there isn't it is an
|
||||
* error.
|
||||
*/
|
||||
if (XEmacLite_TxBufferAvailable(EmacLiteInstPtr) != TRUE) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the MDIO is configured in the device.
|
||||
*/
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
/*
|
||||
* Detect the PHY device and enable the MAC Loop back
|
||||
* in the PHY.
|
||||
*/
|
||||
PhyAddress = EmacLitePhyDetect(EmacLiteInstPtr);
|
||||
Status = EmacLiteEnablePhyLoopBack(EmacLiteInstPtr,
|
||||
PhyAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reset the receive frame length to zero.
|
||||
*/
|
||||
RecvFrameLength = 0;
|
||||
Status = EmacLiteSendFrame(EmacLiteInstPtr, EMACLITE_TEST_FRAME_SIZE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
/*
|
||||
* Disable the MAC Loop back in the PHY.
|
||||
*/
|
||||
EmacLiteDisablePhyLoopBack(EmacLiteInstPtr,
|
||||
PhyAddress);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the MDIO is not configured in the core then return XST_SUCCESS
|
||||
* as the frame has been transmitted.
|
||||
*/
|
||||
if (!XEmacLite_IsMdioConfigured(EmacLiteInstPtr)) {
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Poll for receive packet.
|
||||
*/
|
||||
while ((volatile u32)RecvFrameLength == 0) {
|
||||
RecvFrameLength = XEmacLite_Recv(EmacLiteInstPtr,
|
||||
(u8 *)RxFrame);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the received frame.
|
||||
*/
|
||||
Status = EmacLiteRecvFrame(EMACLITE_TEST_FRAME_SIZE);
|
||||
if ((Status != XST_SUCCESS) && (Status != XST_NO_DATA)) {
|
||||
/*
|
||||
* Disable the MAC Loop back in the PHY.
|
||||
*/
|
||||
EmacLiteDisablePhyLoopBack(EmacLiteInstPtr, PhyAddress);
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Disable the MAC Loop back in the PHY.
|
||||
*/
|
||||
EmacLiteDisablePhyLoopBack(EmacLiteInstPtr, PhyAddress);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function sends a frame of given size.
|
||||
*
|
||||
* @param XEmacInstancePtr is a pointer to the XEmacLite instance.
|
||||
* @param PayloadSize is the size of the frame to create. The size only
|
||||
* reflects the payload size, it does not include the Ethernet
|
||||
* header size (14 bytes) nor the Ethernet CRC size (4 bytes).
|
||||
*
|
||||
* @return XST_SUCCESS if successful, else a driver-specific return code.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int EmacLiteSendFrame(XEmacLite *InstancePtr, u32 PayloadSize)
|
||||
{
|
||||
u8 *FramePtr;
|
||||
int Index;
|
||||
FramePtr = (u8 *)TxFrame;
|
||||
|
||||
/*
|
||||
* Set up the destination address as the local address for
|
||||
* Phy Loopback.
|
||||
*/
|
||||
if (XEmacLite_IsMdioConfigured(InstancePtr)) {
|
||||
|
||||
*FramePtr++ = LocalAddress[0];
|
||||
*FramePtr++ = LocalAddress[1];
|
||||
*FramePtr++ = LocalAddress[2];
|
||||
*FramePtr++ = LocalAddress[3];
|
||||
*FramePtr++ = LocalAddress[4];
|
||||
*FramePtr++ = LocalAddress[5];
|
||||
} else {
|
||||
/*
|
||||
* Fill in the valid Destination MAC address if
|
||||
* the Loopback is not enabled.
|
||||
*/
|
||||
*FramePtr++ = RemoteAddress[0];
|
||||
*FramePtr++ = RemoteAddress[1];
|
||||
*FramePtr++ = RemoteAddress[2];
|
||||
*FramePtr++ = RemoteAddress[3];
|
||||
*FramePtr++ = RemoteAddress[4];
|
||||
*FramePtr++ = RemoteAddress[5];
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the source MAC address.
|
||||
*/
|
||||
*FramePtr++ = LocalAddress[0];
|
||||
*FramePtr++ = LocalAddress[1];
|
||||
*FramePtr++ = LocalAddress[2];
|
||||
*FramePtr++ = LocalAddress[3];
|
||||
*FramePtr++ = LocalAddress[4];
|
||||
*FramePtr++ = LocalAddress[5];
|
||||
|
||||
/*
|
||||
* Set up the type/length field - be sure its in network order.
|
||||
*/
|
||||
*((u16 *)FramePtr) = Xil_Htons(PayloadSize);
|
||||
FramePtr++;
|
||||
FramePtr++;
|
||||
|
||||
/*
|
||||
* Now fill in the data field with known values so we can verify them
|
||||
* on receive.
|
||||
*/
|
||||
for (Index = 0; Index < PayloadSize; Index++) {
|
||||
*FramePtr++ = (u8)Index;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now send the frame.
|
||||
*/
|
||||
return XEmacLite_Send(InstancePtr, (u8 *)TxFrame,
|
||||
PayloadSize + XEL_HEADER_SIZE);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function receives a frame of given size. This function assumes interrupt
|
||||
* mode, receives the frame and verifies its contents.
|
||||
*
|
||||
* @param PayloadSize is the size of the frame to receive.
|
||||
* The size only reflects the payload size, it does not include the
|
||||
* Ethernet header size (14 bytes) nor the Ethernet CRC size (4
|
||||
* bytes).
|
||||
*
|
||||
* @return XST_SUCCESS if successful, a driver-specific return code if not.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int EmacLiteRecvFrame(u32 PayloadSize)
|
||||
{
|
||||
u8 *FramePtr;
|
||||
|
||||
/*
|
||||
* This assumes MAC does not strip padding or CRC.
|
||||
*/
|
||||
if (RecvFrameLength != 0) {
|
||||
int Index;
|
||||
|
||||
/*
|
||||
* Verify length, which should be the payload size.
|
||||
*/
|
||||
if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=
|
||||
PayloadSize) {
|
||||
return XST_LOOPBACK_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the contents of the Received Frame.
|
||||
*/
|
||||
FramePtr = (u8 *)RxFrame;
|
||||
FramePtr += XEL_HEADER_SIZE; /* Get past the header */
|
||||
|
||||
for (Index = 0; Index < PayloadSize; Index++) {
|
||||
if (*FramePtr++ != (u8)Index) {
|
||||
return XST_LOOPBACK_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,386 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xgpio_intr_tapp_example.c,v 1.1.2.1 2009/11/25 07:38:15 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2002-2009 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xgpio_intr_tapp_example.c
|
||||
*
|
||||
* This file contains a design example using the GPIO driver (XGpio) in an
|
||||
* interrupt driven mode of operation. This example does assume that there is
|
||||
* an interrupt controller in the hardware system and the GPIO device is
|
||||
* connected to the interrupt controller.
|
||||
*
|
||||
* This file is used by the TestAppGen utility to include a simplified test for
|
||||
* gpio interrupts.
|
||||
|
||||
* The buttons and LEDs are on 2 seperate channels of the GPIO so that interrupts
|
||||
* are not caused when the LEDs are turned on and off.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 2.01a sn 05/09/06 Modified to be used by TestAppGen to include test for
|
||||
* interrupts.
|
||||
* 3.00a ktn 11/21/09 Updated to use HAL Processor APIs and minior changes
|
||||
* as per coding guidelines.
|
||||
*</pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xgpio.h"
|
||||
#include "xil_exception.h"
|
||||
#include "xintc.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* The following constants map to the names of the hardware instances that
|
||||
* were created in the EDK XPS system. They are only defined here such that
|
||||
* a user can easily change all the needed device IDs in one place.
|
||||
*/
|
||||
#define GPIO_DEVICE_ID XPAR_PUSH_BUTTONS_5BIT_DEVICE_ID
|
||||
#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
|
||||
#define INTC_GPIO_INTERRUPT_ID XPAR_INTC_0_GPIO_3_VEC_ID
|
||||
#define GPIO_CHANNEL1 1
|
||||
/*
|
||||
* The following constants define the positions of the buttons and LEDs each
|
||||
* channel of the GPIO
|
||||
*/
|
||||
#define GPIO_ALL_LEDS 0xFFFF
|
||||
#define GPIO_ALL_BUTTONS 0xFFFF
|
||||
|
||||
/*
|
||||
* The following constants define the GPIO channel that is used for the buttons
|
||||
* and the LEDs. They allow the channels to be reversed easily.
|
||||
*/
|
||||
#define BUTTON_CHANNEL 1 /* Channel 1 of the GPIO Device */
|
||||
#define LED_CHANNEL 2 /* Channel 2 of the GPIO Device */
|
||||
#define BUTTON_INTERRUPT XGPIO_IR_CH1_MASK /* Channel 1 Interrupt Mask */
|
||||
|
||||
/*
|
||||
* The following constant determines which buttons must be pressed at the same
|
||||
* time to cause interrupt processing to stop and start
|
||||
*/
|
||||
#define INTERRUPT_CONTROL_VALUE 0x7
|
||||
|
||||
/*
|
||||
* The following constant is used to wait after an LED is turned on to make
|
||||
* sure that it is visible to the human eye. This constant might need to be
|
||||
* tuned for faster or slower processor speeds.
|
||||
*/
|
||||
#define LED_DELAY 1000000
|
||||
|
||||
#endif
|
||||
|
||||
#define INTR_DELAY 0x00FFFFFF
|
||||
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
void GpioDriverHandler(void *CallBackRef);
|
||||
|
||||
int GpioIntrExample(XIntc* IntcInstancePtr, XGpio* InstancePtr,
|
||||
u16 DeviceId, u16 IntrId,
|
||||
u16 IntrMask, u32 *DataRead);
|
||||
|
||||
int GpioSetupIntrSystem(XIntc* IntcInstancePtr, XGpio* InstancePtr,
|
||||
u16 DeviceId, u16 IntrId, u16 IntrMask);
|
||||
|
||||
void GpioDisableIntr(XIntc* IntcInstancePtr, XGpio* InstancePtr,
|
||||
u16 IntrId, u16 IntrMask);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The following are declared globally so they are zeroed and so they are
|
||||
* easily accessible from a debugger
|
||||
*/
|
||||
XGpio Gpio; /* The Instance of the GPIO Driver */
|
||||
|
||||
XIntc Intc; /* The Instance of the Interrupt Controller Driver */
|
||||
|
||||
|
||||
static u16 GlobalIntrMask; /* GPIO channel mask that is needed by
|
||||
* the Interrupt Handler */
|
||||
|
||||
static volatile u32 IntrFlag; /* Interrupt Handler Flag */
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* This function is the main function of the GPIO example. It is responsible
|
||||
* for initializing the GPIO device, setting up interrupts and providing a
|
||||
* foreground loop such that interrupt can occur in the background.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS to indicate success.
|
||||
* - XST_FAILURE to indicate failure.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
u32 DataRead;
|
||||
|
||||
print(" Press button to Generate Interrupt\r\n");
|
||||
|
||||
Status = GpioIntrExample(&Intc, &Gpio,
|
||||
GPIO_DEVICE_ID,
|
||||
INTC_GPIO_INTERRUPT_ID,
|
||||
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");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This is the entry function from the TestAppGen tool generated application
|
||||
* which tests the interrupts when enabled in the GPIO
|
||||
*
|
||||
* @param IntcInstancePtr is a reference to the Interrupt Controller
|
||||
* driver Instance
|
||||
* @param InstancePtr is a reference to the GPIO driver Instance
|
||||
* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR
|
||||
* value from xparameters.h
|
||||
* @param IntrMask is the GPIO channel mask
|
||||
* @param DataRead is the pointer where the data read from GPIO Input is
|
||||
* returned
|
||||
*
|
||||
* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int GpioIntrExample(XIntc* IntcInstancePtr, XGpio* InstancePtr, u16 DeviceId,
|
||||
u16 IntrId, u16 IntrMask, u32 *DataRead)
|
||||
{
|
||||
int Status;
|
||||
u32 delay;
|
||||
|
||||
/* Initialize the GPIO driver. If an error occurs then exit */
|
||||
|
||||
Status = XGpio_Initialize(InstancePtr, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = GpioSetupIntrSystem(IntcInstancePtr,
|
||||
InstancePtr,
|
||||
DeviceId,
|
||||
IntrId,
|
||||
IntrMask);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
IntrFlag = 0;
|
||||
delay = 0;
|
||||
|
||||
while(!IntrFlag && (delay < INTR_DELAY)) {
|
||||
delay++;
|
||||
}
|
||||
|
||||
GpioDisableIntr(IntcInstancePtr,
|
||||
InstancePtr,
|
||||
IntrId,
|
||||
IntrMask);
|
||||
|
||||
*DataRead = IntrFlag;
|
||||
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function performs the GPIO set up for Interrupts
|
||||
*
|
||||
* @param IntcInstancePtr is a reference to the Interrupt Controller
|
||||
* driver Instance
|
||||
* @param InstancePtr is a reference to the GPIO driver Instance
|
||||
* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR
|
||||
* value from xparameters.h
|
||||
* @param IntrMask is the GPIO channel mask
|
||||
*
|
||||
* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int GpioSetupIntrSystem(XIntc* IntcInstancePtr, XGpio* InstancePtr,
|
||||
u16 DeviceId, u16 IntrId, u16 IntrMask)
|
||||
|
||||
{
|
||||
int Result;
|
||||
|
||||
GlobalIntrMask = IntrMask;
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it's ready to use.
|
||||
* specify the device ID that was generated in xparameters.h
|
||||
*/
|
||||
Result = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
|
||||
if (Result != XST_SUCCESS) {
|
||||
return Result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Hook up simple interrupt service routine for TestApp */
|
||||
|
||||
Result = XIntc_Connect(IntcInstancePtr, IntrId,
|
||||
(XInterruptHandler)GpioDriverHandler,
|
||||
InstancePtr);
|
||||
|
||||
/*
|
||||
* Enable the GPIO channel interrupts so that push button can be detected
|
||||
* and enable interrupts for the GPIO device
|
||||
*/
|
||||
XGpio_InterruptEnable(InstancePtr, IntrMask);
|
||||
XGpio_InterruptGlobalEnable(InstancePtr);
|
||||
|
||||
/* Enable the interrupt vector at the interrupt controller */
|
||||
XIntc_Enable(IntcInstancePtr, IntrId);
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
|
||||
/*
|
||||
* Initialize the exception table and register the interrupt
|
||||
* controller handler with the exception table
|
||||
*/
|
||||
Xil_ExceptionInit();
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
|
||||
(Xil_ExceptionHandler)XIntc_InterruptHandler,
|
||||
IntcInstancePtr);
|
||||
|
||||
/* Enable non-critical exceptions */
|
||||
Xil_ExceptionEnable();
|
||||
|
||||
/*
|
||||
* Start the interrupt controller such that interrupts are recognized
|
||||
* and handled by the processor
|
||||
*/
|
||||
Result = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
|
||||
#endif
|
||||
|
||||
if (Result != XST_SUCCESS) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This is the interrupt handler routine for the GPIO for this example.
|
||||
*
|
||||
* @param CallbackRef is the Callback reference for the handler.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void GpioDriverHandler(void *CallbackRef)
|
||||
{
|
||||
XGpio *GpioPtr = (XGpio *)CallbackRef;
|
||||
|
||||
IntrFlag = 1;
|
||||
/*
|
||||
* Clear the Interrupt
|
||||
*/
|
||||
XGpio_InterruptClear(GpioPtr, GlobalIntrMask);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the interrupts for the GPIO
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the Interrupt Controller
|
||||
* driver Instance
|
||||
* @param InstancePtr is a pointer to the GPIO driver Instance
|
||||
* @param IntrId is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR
|
||||
* value from xparameters.h
|
||||
* @param IntrMask is the GPIO channel mask
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void GpioDisableIntr(XIntc* IntcInstancePtr, XGpio* InstancePtr,
|
||||
u16 IntrId, u16 IntrMask)
|
||||
{
|
||||
XGpio_InterruptDisable(InstancePtr, IntrMask);
|
||||
XIntc_Disable(IntcInstancePtr, IntrId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xgpio_tapp_example.c,v 1.1.2.1 2009/11/25 07:38:15 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2005-2009 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xgpio_tapp_example.c
|
||||
*
|
||||
* This file contains a example for using GPIO hardware and driver.
|
||||
* This example assumes that there is a UART Device or STDIO Device in the
|
||||
* hardware system.
|
||||
*
|
||||
* This example can be run on the Xilinx ML300 board using the Prototype Pins &
|
||||
* LEDs of the board connected to the GPIO and the Push Buttons connected.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00a sv 04/15/05 Initial release for TestApp integration.
|
||||
* 3.00a sv 11/21/09 Updated to use HAL Processor APIs.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xgpio.h"
|
||||
#include "stdio.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constant is used to wait after an LED is turned on to make
|
||||
* sure that it is visible to the human eye. This constant might need to be
|
||||
* tuned for faster or slower processor speeds.
|
||||
*/
|
||||
#define LED_DELAY 1000000
|
||||
|
||||
/* following constant is used to determine which channel of the GPIO is
|
||||
* used if there are 2 channels supported in the GPIO.
|
||||
*/
|
||||
#define LED_CHANNEL 1
|
||||
|
||||
#define LED_MAX_BLINK 0x1 /* Number of times the LED Blinks */
|
||||
|
||||
#define GPIO_BITWIDTH 16 /* This is the width of the GPIO */
|
||||
|
||||
#define printf xil_printf /* A smaller footprint printf */
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#ifndef TESTAPP_GEN
|
||||
#define GPIO_OUTPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID
|
||||
#define GPIO_INPUT_DEVICE_ID XPAR_LEDS_4BIT_DEVICE_ID
|
||||
#endif /* TESTAPP_GEN */
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *******************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ****************************/
|
||||
|
||||
int GpioOutputExample(u16 DeviceId, u32 GpioWidth);
|
||||
|
||||
int GpioInputExample(u16 DeviceId, u32 *DataRead);
|
||||
|
||||
void GpioDriverHandler(void *CallBackRef);
|
||||
|
||||
|
||||
/************************** Variable Definitions **************************/
|
||||
|
||||
/*
|
||||
* The following are declared globally so they are zeroed and so they are
|
||||
* easily accessible from a debugger
|
||||
*/
|
||||
XGpio GpioOutput; /* The driver instance for GPIO Device configured as O/P */
|
||||
XGpio GpioInput; /* The driver instance for GPIO Device configured as I/P */
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Main function to call the example.This function is not included if the
|
||||
* example is generated from the TestAppGen test tool.
|
||||
*
|
||||
* @param None
|
||||
*
|
||||
* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
u32 InputData;
|
||||
|
||||
Status = GpioOutputExample(GPIO_OUTPUT_DEVICE_ID, GPIO_BITWIDTH);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
printf("Data read from GPIO Input is 0x%x \n", (int)InputData);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function does a minimal test on the GPIO device configured as OUTPUT
|
||||
* and driver as a example.
|
||||
*
|
||||
*
|
||||
* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param GpioWidth is the width of the GPIO
|
||||
*
|
||||
* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
****************************************************************************/
|
||||
int GpioOutputExample(u16 DeviceId, u32 GpioWidth)
|
||||
{
|
||||
u32 Data;
|
||||
volatile int Delay;
|
||||
u32 LedBit;
|
||||
u32 LedLoop;
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the GPIO driver so that it's ready to use,
|
||||
* specify the device ID that is generated in xparameters.h
|
||||
*/
|
||||
Status = XGpio_Initialize(&GpioOutput, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the direction for all signals to be outputs
|
||||
*/
|
||||
XGpio_SetDataDirection(&GpioOutput, LED_CHANNEL, 0x0);
|
||||
|
||||
/*
|
||||
* Set the GPIO outputs to low
|
||||
*/
|
||||
XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 0x0);
|
||||
|
||||
for (LedBit = 0x0; LedBit < GpioWidth; LedBit++) {
|
||||
|
||||
for (LedLoop = 0; LedLoop < LED_MAX_BLINK; LedLoop++) {
|
||||
|
||||
/*
|
||||
* Set the GPIO Output to High
|
||||
*/
|
||||
XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL,
|
||||
1 << LedBit);
|
||||
|
||||
#ifndef __SIM__
|
||||
/*
|
||||
* Wait a small amount of time so the LED is visible
|
||||
*/
|
||||
for (Delay = 0; Delay < LED_DELAY; Delay++);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Clear the GPIO Output
|
||||
*/
|
||||
XGpio_DiscreteClear(&GpioOutput, LED_CHANNEL,
|
||||
1 << LedBit);
|
||||
|
||||
|
||||
#ifndef __SIM__
|
||||
/*
|
||||
* Wait a small amount of time so the LED is visible
|
||||
*/
|
||||
for (Delay = 0; Delay < LED_DELAY; Delay++);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function performs a test on the GPIO driver/device with the GPIO
|
||||
* configured as INPUT
|
||||
*
|
||||
* @param DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param DataRead is the pointer where the data read from GPIO Input is
|
||||
* returned
|
||||
*
|
||||
* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int GpioInputExample(u16 DeviceId, u32 *DataRead)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the GPIO driver so that it's ready to use,
|
||||
* specify the device ID that is generated in xparameters.h
|
||||
*/
|
||||
Status = XGpio_Initialize(&GpioInput, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the direction for all signals to be inputs
|
||||
*/
|
||||
XGpio_SetDataDirection(&GpioInput, LED_CHANNEL, 0xFFFFFFFF);
|
||||
|
||||
/*
|
||||
* Read the state of the data so that it can be verified
|
||||
*/
|
||||
*DataRead = XGpio_DiscreteRead(&GpioInput, LED_CHANNEL);
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
|
||||
/* $Id: xintc_tapp_example.c,v 1.1.4.1 2010/09/17 05:32:46 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2002-2009 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xintc_tapp_example.c
|
||||
*
|
||||
* This file contains a self test example using the Interrupt Controller driver
|
||||
* (XIntc) and hardware device. Please reference other device driver examples to
|
||||
* see more examples of how the Intc and interrupts can be used by a software
|
||||
* application.
|
||||
*
|
||||
* This example shows the use of the Interrupt Controller both with a PowerPC405
|
||||
* and MicroBlaze processor.
|
||||
*
|
||||
* The TestApp Gen utility uses this file to perform the self test and setup
|
||||
* of Intc for interrupts.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- --------------------------------------------------------
|
||||
* 1.00a sv 06/29/05 Created for Test App Integration
|
||||
* 1.00c sn 05/09/06 Added Interrupt Setup Function
|
||||
* 2.00a ktn 10/20/09 Updated to use HAL Processor APIs and minor changes as
|
||||
* per coding guidelines.
|
||||
* </pre>
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xstatus.h"
|
||||
#include "xintc.h"
|
||||
#include "xil_exception.h"
|
||||
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place. This definition is not
|
||||
* included if the example is generated from the TestAppGen test tool.
|
||||
*/
|
||||
#ifndef TESTAPP_GEN
|
||||
#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
|
||||
#endif
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int IntcSelfTestExample(u16 DeviceId);
|
||||
int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
static XIntc InterruptController; /* Instance of the Interrupt Controller */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This is the main function for the Interrupt Controller example. This
|
||||
* function is not included if the example is generated from the TestAppGen test
|
||||
* tool.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Run the Intc example , specify the Device ID generated in
|
||||
* xparameters.h.
|
||||
*/
|
||||
Status = IntcSelfTestExample(INTC_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function runs a self-test on the driver/device. This is a destructive
|
||||
* test. This function is an example of how to use the interrupt controller
|
||||
* driver component (XIntc) and the hardware device. This function is designed
|
||||
* to work without any hardware devices to cause interrupts. It may not return
|
||||
* if the interrupt controller is not properly connected to the processor in
|
||||
* either software or hardware.
|
||||
*
|
||||
* This function relies on the fact that the interrupt controller hardware
|
||||
* has come out of the reset state such that it will allow interrupts to be
|
||||
* simulated by the software.
|
||||
*
|
||||
* @param DeviceId is device ID of the Interrupt Controller Device,
|
||||
* typically XPAR_<INTC_instance>_DEVICE_ID value from
|
||||
* xparameters.h.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int IntcSelfTestExample(u16 DeviceId)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it is ready to use.
|
||||
*/
|
||||
Status = XIntc_Initialize(&InterruptController, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built correctly.
|
||||
*/
|
||||
Status = XIntc_SelfTest(&InterruptController);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function is used by the TestAppGen generated application to setup
|
||||
* the interrupt controller.
|
||||
*
|
||||
* @param IntcInstancePtr is the reference to the Interrupt Controller
|
||||
* instance.
|
||||
* @param DeviceId is device ID of the Interrupt Controller Device,
|
||||
* typically XPAR_<INTC_instance>_DEVICE_ID value from
|
||||
* xparameters.h.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId)
|
||||
{
|
||||
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it is
|
||||
* ready to use.
|
||||
*/
|
||||
Status = XIntc_Initialize(IntcInstancePtr, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built correctly.
|
||||
*/
|
||||
Status = XIntc_SelfTest(IntcInstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the exception table.
|
||||
*/
|
||||
Xil_ExceptionInit();
|
||||
|
||||
/*
|
||||
* Register the interrupt controller handler with the exception table.
|
||||
*/
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
|
||||
(Xil_ExceptionHandler)XIntc_DeviceInterruptHandler,
|
||||
(void*) 0);
|
||||
|
||||
/*
|
||||
* Enable exceptions.
|
||||
*/
|
||||
Xil_ExceptionEnable();
|
||||
|
||||
/*
|
||||
* Start the interrupt controller such that interrupts are enabled for
|
||||
* all devices that cause interrupts.
|
||||
*/
|
||||
Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,457 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xtmrctr_intr_example.c,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2002-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xtmrctr_intr_example.c
|
||||
*
|
||||
* This file contains a design example using the timer counter driver
|
||||
* (XTmCtr) and hardware device using interrupt mode.This example assumes
|
||||
* that the interrupt controller is also present as a part of the system
|
||||
*
|
||||
* This file can be used as a standalone example or by the TestAppGen utility
|
||||
* to include a test for Timer interrupts.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00b jhl 02/13/02 First release
|
||||
* 1.00b sv 04/26/05 Minor changes to comply to Doxygen and coding guidelines
|
||||
* 1.00b sn 05/09/06 Modified to be used by TestAppGen to include test for
|
||||
* interrupts.
|
||||
* 2.00a ktn 10/30/09 Updated to use HAL API's and minor changes as per coding
|
||||
* guidelines.
|
||||
*</pre>
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xtmrctr.h"
|
||||
#include "xintc.h"
|
||||
#include "xil_exception.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are only defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define TMRCTR_DEVICE_ID XPAR_TMRCTR_0_DEVICE_ID
|
||||
#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
|
||||
#define TMRCTR_INTERRUPT_ID XPAR_INTC_0_TMRCTR_0_VEC_ID
|
||||
|
||||
/*
|
||||
* The following constant determines which timer counter of the device that is
|
||||
* used for this example, there are currently 2 timer counters in a device
|
||||
* and this example uses the first one, 0, the timer numbers are 0 based
|
||||
*/
|
||||
#define TIMER_CNTR_0 0
|
||||
|
||||
#endif
|
||||
/*
|
||||
* The following constant is used to set the reset value of the timer counter,
|
||||
* making this number larger reduces the amount of time this example consumes
|
||||
* because it is the value the timer counter is loaded with when it is started
|
||||
*/
|
||||
#define RESET_VALUE 0xF0000000
|
||||
|
||||
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int TmrCtrIntrExample(XIntc* IntcInstancePtr,
|
||||
XTmrCtr* InstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u8 TmrCtrNumber);
|
||||
|
||||
static int TmrCtrSetupIntrSystem(XIntc* IntcInstancePtr,
|
||||
XTmrCtr* InstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u8 TmrCtrNumber);
|
||||
|
||||
void TimerCounterHandler(void *CallBackRef, u8 TmrCtrNumber);
|
||||
|
||||
void TmrCtrDisableIntr(XIntc* IntcInstancePtr, u16 IntrId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
XIntc InterruptController; /* The instance of the Interrupt Controller */
|
||||
|
||||
XTmrCtr TimerCounterInst; /* The instance of the Timer Counter */
|
||||
#endif
|
||||
/*
|
||||
* The following variables are shared between non-interrupt processing and
|
||||
* interrupt processing such that they must be global.
|
||||
*/
|
||||
volatile int TimerExpired;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function is the main function of the Tmrctr example using Interrupts.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, else XST_FAILURE to indicate a
|
||||
* Failure.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Run the Timer Counter - Interrupt example.
|
||||
*/
|
||||
Status = TmrCtrIntrExample(&InterruptController,
|
||||
&TimerCounterInst,
|
||||
TMRCTR_DEVICE_ID,
|
||||
TMRCTR_INTERRUPT_ID,
|
||||
TIMER_CNTR_0);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function does a minimal test on the timer counter device and driver as a
|
||||
* design example. The purpose of this function is to illustrate how to use the
|
||||
* XTmrCtr component. It initializes a timer counter and then sets it up in
|
||||
* compare mode with auto reload such that a periodic interrupt is generated.
|
||||
*
|
||||
* This function uses interrupt driven mode of the timer counter.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the Interrupt Controller
|
||||
* driver Instance
|
||||
* @param TmrCtrInstancePtr is a pointer to the XTmrCtr driver Instance
|
||||
* @param DeviceId is the XPAR_<TmrCtr_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param IntrId is XPAR_<INTC_instance>_<TmrCtr_instance>_INTERRUPT_INTR
|
||||
* value from xparameters.h
|
||||
* @param TmrCtrNumber is the number of the timer to which this
|
||||
* handler is associated with.
|
||||
*
|
||||
* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
|
||||
*
|
||||
* @note This function contains an infinite loop such that if interrupts
|
||||
* are not working it may never return.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TmrCtrIntrExample(XIntc* IntcInstancePtr,
|
||||
XTmrCtr* TmrCtrInstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u8 TmrCtrNumber)
|
||||
{
|
||||
int Status;
|
||||
int LastTimerExpired = 0;
|
||||
|
||||
/*
|
||||
* Initialize the timer counter so that it's ready to use,
|
||||
* specify the device ID that is generated in xparameters.h
|
||||
*/
|
||||
Status = XTmrCtr_Initialize(TmrCtrInstancePtr, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built
|
||||
* correctly, use the 1st timer in the device (0)
|
||||
*/
|
||||
Status = XTmrCtr_SelfTest(TmrCtrInstancePtr, TmrCtrNumber);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Connect the timer counter to the interrupt subsystem such that
|
||||
* interrupts can occur. This function is application specific.
|
||||
*/
|
||||
Status = TmrCtrSetupIntrSystem(IntcInstancePtr,
|
||||
TmrCtrInstancePtr,
|
||||
DeviceId,
|
||||
IntrId,
|
||||
TmrCtrNumber);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the handler for the timer counter that will be called from the
|
||||
* interrupt context when the timer expires, specify a pointer to the
|
||||
* timer counter driver instance as the callback reference so the handler
|
||||
* is able to access the instance data
|
||||
*/
|
||||
XTmrCtr_SetHandler(TmrCtrInstancePtr, TimerCounterHandler,
|
||||
TmrCtrInstancePtr);
|
||||
|
||||
/*
|
||||
* Enable the interrupt of the timer counter so interrupts will occur
|
||||
* and use auto reload mode such that the timer counter will reload
|
||||
* itself automatically and continue repeatedly, without this option
|
||||
* it would expire once only
|
||||
*/
|
||||
XTmrCtr_SetOptions(TmrCtrInstancePtr, TmrCtrNumber,
|
||||
XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION);
|
||||
|
||||
/*
|
||||
* Set a reset value for the timer counter such that it will expire
|
||||
* eariler than letting it roll over from 0, the reset value is loaded
|
||||
* into the timer counter when it is started
|
||||
*/
|
||||
XTmrCtr_SetResetValue(TmrCtrInstancePtr, TmrCtrNumber, RESET_VALUE);
|
||||
|
||||
/*
|
||||
* Start the timer counter such that it's incrementing by default,
|
||||
* then wait for it to timeout a number of times
|
||||
*/
|
||||
XTmrCtr_Start(TmrCtrInstancePtr, TmrCtrNumber);
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* Wait for the first timer counter to expire as indicated by the
|
||||
* shared variable which the handler will increment
|
||||
*/
|
||||
while (TimerExpired == LastTimerExpired) {
|
||||
}
|
||||
LastTimerExpired = TimerExpired;
|
||||
|
||||
/*
|
||||
* If it has expired a number of times, then stop the timer counter
|
||||
* and stop this example
|
||||
*/
|
||||
if (TimerExpired == 3) {
|
||||
|
||||
XTmrCtr_Stop(TmrCtrInstancePtr, TmrCtrNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TmrCtrDisableIntr(IntcInstancePtr, DeviceId);
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function is the handler which performs processing for the timer counter.
|
||||
* It is called from an interrupt context such that the amount of processing
|
||||
* performed should be minimized. It is called when the timer counter expires
|
||||
* if interrupts are enabled.
|
||||
*
|
||||
* This handler provides an example of how to handle timer counter interrupts
|
||||
* but is application specific.
|
||||
*
|
||||
* @param CallBackRef is a pointer to the callback function
|
||||
* @param TmrCtrNumber is the number of the timer to which this
|
||||
* handler is associated with.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void TimerCounterHandler(void *CallBackRef, u8 TmrCtrNumber)
|
||||
{
|
||||
XTmrCtr *InstancePtr = (XTmrCtr *)CallBackRef;
|
||||
|
||||
/*
|
||||
* Check if the timer counter has expired, checking is not necessary
|
||||
* since that's the reason this function is executed, this just shows
|
||||
* how the callback reference can be used as a pointer to the instance
|
||||
* of the timer counter that expired, increment a shared variable so
|
||||
* the main thread of execution can see the timer expired
|
||||
*/
|
||||
if (XTmrCtr_IsExpired(InstancePtr, TmrCtrNumber)) {
|
||||
TimerExpired++;
|
||||
if(TimerExpired == 3) {
|
||||
XTmrCtr_SetOptions(InstancePtr, TmrCtrNumber, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function setups the interrupt system such that interrupts can occur
|
||||
* for the timer counter. This function is application specific since the actual
|
||||
* system may or may not have an interrupt controller. The timer counter could
|
||||
* be directly connected to a processor without an interrupt controller. The
|
||||
* user should modify this function to fit the application.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the Interrupt Controller
|
||||
* driver Instance.
|
||||
* @param TmrCtrInstancePtr is a pointer to the XTmrCtr driver Instance.
|
||||
* @param DeviceId is the XPAR_<TmrCtr_instance>_DEVICE_ID value from
|
||||
* xparameters.h.
|
||||
* @param IntrId is XPAR_<INTC_instance>_<TmrCtr_instance>_VEC_ID
|
||||
* value from xparameters.h.
|
||||
* @param TmrCtrNumber is the number of the timer to which this
|
||||
* handler is associated with.
|
||||
*
|
||||
* @return XST_SUCCESS if the Test is successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note This function contains an infinite loop such that if interrupts
|
||||
* are not working it may never return.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int TmrCtrSetupIntrSystem(XIntc* IntcInstancePtr,
|
||||
XTmrCtr* TmrCtrInstancePtr,
|
||||
u16 DeviceId,
|
||||
u16 IntrId,
|
||||
u8 TmrCtrNumber)
|
||||
{
|
||||
int Status;
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that
|
||||
* it's ready to use, specify the device ID that is generated in
|
||||
* xparameters.h
|
||||
*/
|
||||
Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Connect a device driver handler that will be called when an interrupt
|
||||
* for the device occurs, the device driver handler performs the specific
|
||||
* interrupt processing for the device
|
||||
*/
|
||||
Status = XIntc_Connect(IntcInstancePtr, IntrId,
|
||||
(XInterruptHandler)XTmrCtr_InterruptHandler,
|
||||
(void *)TmrCtrInstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Start the interrupt controller such that interrupts are enabled for
|
||||
* all devices that cause interrupts, specific real mode so that
|
||||
* the timer counter can cause interrupts thru the interrupt controller.
|
||||
*/
|
||||
Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable the interrupt for the timer counter
|
||||
*/
|
||||
XIntc_Enable(IntcInstancePtr, IntrId);
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Initialize the exception table.
|
||||
*/
|
||||
Xil_ExceptionInit();
|
||||
|
||||
/*
|
||||
* Register the interrupt controller handler with the exception table.
|
||||
*/
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
|
||||
(Xil_ExceptionHandler)
|
||||
XIntc_InterruptHandler,
|
||||
IntcInstancePtr);
|
||||
|
||||
/*
|
||||
* Enable non-critical exceptions.
|
||||
*/
|
||||
Xil_ExceptionEnable();
|
||||
|
||||
#endif
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the interrupts for the Timer.
|
||||
*
|
||||
* @param IntcInstancePtr is a reference to the Interrupt Controller
|
||||
* driver Instance.
|
||||
* @param IntrId is XPAR_<INTC_instance>_<Timer_instance>_VEC_ID
|
||||
* value from xparameters.h.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void TmrCtrDisableIntr(XIntc* IntcInstancePtr, u16 IntrId)
|
||||
{
|
||||
/*
|
||||
* Disable the interrupt for the timer counter
|
||||
*/
|
||||
XIntc_Disable(IntcInstancePtr, IntrId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xtmrctr_selftest_example.c,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2002-2010 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xtmrctr_selftest_example.c
|
||||
*
|
||||
* This file contains a example for using the Timer Counter hardware and
|
||||
* driver
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00a sv 04/25/05 Initial release for TestApp integration.
|
||||
* 2.00a ktn 11/26/09 Minor changes as per coding guidelines.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xtmrctr.h"
|
||||
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define TMRCTR_DEVICE_ID XPAR_TMRCTR_0_DEVICE_ID
|
||||
|
||||
/*
|
||||
* This example only uses the 1st of the 2 timer counters contained in a
|
||||
* single timer counter hardware device
|
||||
*/
|
||||
#define TIMER_COUNTER_0 0
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *******************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ****************************/
|
||||
|
||||
int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber);
|
||||
|
||||
/************************** Variable Definitions **************************/
|
||||
|
||||
XTmrCtr TimerCounter; /* The instance of the timer counter */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Main function to call the example. This function is not included if the
|
||||
* example is generated from the TestAppGen test tool.
|
||||
*
|
||||
* @param None
|
||||
*
|
||||
* @return XST_SUCCESS to indicate success, else XST_FAILURE to indicate
|
||||
* a Failure.
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
|
||||
Status = TmrCtrSelfTestExample(TMRCTR_DEVICE_ID, TIMER_COUNTER_0);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function does a minimal test on the TmrCtr device and driver as a
|
||||
* design example. The purpose of this function is to illustrate
|
||||
* how to use the XTmrCtr component.
|
||||
*
|
||||
*
|
||||
* @param DeviceId is the XPAR_<TMRCTR_instance>_DEVICE_ID value from
|
||||
* xparameters.h
|
||||
* @param TmrCtrNumber is the timer counter of the device to operate on.
|
||||
* Each device may contain multiple timer counters.
|
||||
* The timer number is a zero based number with a range of
|
||||
* 0 - (XTC_DEVICE_TIMER_COUNT - 1).
|
||||
*
|
||||
* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
****************************************************************************/
|
||||
int TmrCtrSelfTestExample(u16 DeviceId, u8 TmrCtrNumber)
|
||||
{
|
||||
int Status;
|
||||
XTmrCtr *TmrCtrInstancePtr = &TimerCounter;
|
||||
|
||||
/*
|
||||
* Initialize the TmrCtr driver so that it iss ready to use
|
||||
*/
|
||||
Status = XTmrCtr_Initialize(TmrCtrInstancePtr, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built
|
||||
* correctly, use the 1st timer in the device (0)
|
||||
*/
|
||||
Status = XTmrCtr_SelfTest(TmrCtrInstancePtr, TmrCtrNumber);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
#define TESTAPP_GEN
|
||||
|
||||
/* $Id: xuartlite_selftest_example.c,v 1.1.2.1 2009/11/24 05:14:25 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2005-2009 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xuartlite_selftest_example.c
|
||||
*
|
||||
* This file contains a design example using the UartLite driver (XUartLite) and
|
||||
* hardware device.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
* <pre>
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00a ecm 01/25/04 First Release.
|
||||
* 1.00a sv 06/13/05 Minor changes to comply to Doxygen and Coding guidelines
|
||||
* 2.00a ktn 10/20/09 Minor changes as per coding guidelines.
|
||||
* </pre>
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xuartlite.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define UARTLITE_DEVICE_ID XPAR_UARTLITE_0_DEVICE_ID
|
||||
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int UartLiteSelfTestExample(u16 DeviceId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
XUartLite UartLite; /* Instance of the UartLite device */
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Main function to call the example. This function is not included if the
|
||||
* example is generated from the TestAppGen test tool.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Run the UartLite self test example, specify the Device ID that is
|
||||
* generated in xparameters.h
|
||||
*/
|
||||
Status = UartLiteSelfTestExample(UARTLITE_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function does a minimal test on the UartLite device and driver as a
|
||||
* design example. The purpose of this function is to illustrate
|
||||
* how to use the XUartLite component.
|
||||
*
|
||||
*
|
||||
* @param DeviceId is the XPAR_<uartlite_instance>_DEVICE_ID value from
|
||||
* xparameters.h.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
****************************************************************************/
|
||||
int UartLiteSelfTestExample(u16 DeviceId)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the UartLite driver so that it is ready to use.
|
||||
*/
|
||||
Status = XUartLite_Initialize(&UartLite, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built correctly.
|
||||
*/
|
||||
Status = XUartLite_SelfTest(&UartLite);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue