]> git.sur5r.net Git - freertos/commitdiff
Add FreeRTOS BSP for Xilinx SDK.
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 5 Aug 2015 10:21:59 +0000 (10:21 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 5 Aug 2015 10:21:59 +0000 (10:21 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2364 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

30 files changed:
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.cproject
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/.project
FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/.sdkproject
FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/.cproject
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/CreateRepoDirectoryStructure.bat [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mld [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mss [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.tcl [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_microblaze [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_ps7_cortexa9 [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/FreeRTOS.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/StackMacros.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/croutine.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/deprecated_definitions.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/event_groups.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/list.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/mpu_wrappers.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/portable.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/projdefs.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/queue.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/semphr.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/task.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/timers.h [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/portZynq7000.c [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/port_asm_vectors.S [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/MicroBlazeV8/portmicroblaze.c [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.mss [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.tcl [new file with mode: 0644]
FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/src/freertos_hello_world.c [new file with mode: 0644]

index 64d94f29733f46069c7f71da82f467cb6f984431..545e39ce628a465c09efa550a350c9540115c500 100644 (file)
@@ -23,7 +23,7 @@
                                                                <inputType id="xilinx.gnu.assembler.input.1210492545" superClass="xilinx.gnu.assembler.input"/>\r
                                                        </tool>\r
                                                        <tool id="xilinx.gnu.arm.c.toolchain.compiler.debug.1720434900" name="ARM gcc compiler" superClass="xilinx.gnu.arm.c.toolchain.compiler.debug">\r
-                                                               <option defaultValue="gnu.c.optimization.level.none" id="xilinx.gnu.compiler.option.optimization.level.1197002886" name="Optimization Level" superClass="xilinx.gnu.compiler.option.optimization.level" value="gnu.c.optimization.level.size" valueType="enumerated"/>\r
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="xilinx.gnu.compiler.option.optimization.level.1197002886" name="Optimization Level" superClass="xilinx.gnu.compiler.option.optimization.level" value="gnu.c.optimization.level.none" valueType="enumerated"/>\r
                                                                <option id="xilinx.gnu.compiler.option.debugging.level.1441612435" name="Debug Level" superClass="xilinx.gnu.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>\r
                                                                <option id="xilinx.gnu.compiler.inferred.swplatform.includes.2110847612" name="Software Platform Include Path" superClass="xilinx.gnu.compiler.inferred.swplatform.includes" valueType="includePath">\r
                                                                        <listOptionValue builtIn="false" value="../../RTOSDemo_bsp/ps7_cortexa9_0/include"/>\r
@@ -61,6 +61,8 @@
                                                                <option id="xilinx.gnu.c.linker.option.lscript.1669492416" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>\r
                                                                <option id="xilinx.gnu.c.link.option.other.712574482" name="Other options (-XLinker [option])" superClass="xilinx.gnu.c.link.option.other" valueType="stringList">\r
                                                                        <listOptionValue builtIn="false" value="--gc-sections"/>\r
+                                                                       <listOptionValue builtIn="false" value="-Map"/>\r
+                                                                       <listOptionValue builtIn="false" value="RTOSDemo.map"/>\r
                                                                </option>\r
                                                                <inputType id="xilinx.gnu.linker.input.1960859838" superClass="xilinx.gnu.linker.input">\r
                                                                        <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>\r
index 7699a4f05b577af65dbb7e7ec334b33699034ff1..b696240dd4f6d5cf4de52b214b72ed0a31874c93 100644 (file)
@@ -370,7 +370,7 @@ volatile size_t x;
 int memcmp( const void *pvMem1, const void *pvMem2, size_t xBytes )\r
 {\r
 const volatile unsigned char *pucMem1 = pvMem1, *pucMem2 = pvMem2;\r
-register size_t x;\r
+volatile size_t x;\r
 \r
        /* Extremely crude standard library implementations in lieu of having a C\r
        library. */\r
index b58d8788e071195788775afc9da2c78b1f914ee1..c2e6883451dc6700a333a44dc68a7a294f17aadc 100644 (file)
@@ -3,7 +3,6 @@
        <name>BSP</name>\r
        <comment>Created by SDK v2014.4</comment>\r
        <projects>\r
-               <project>Hardware</project>\r
        </projects>\r
        <buildSpec>\r
                <buildCommand>\r
index d75738c3f227bfdf545bcfc8d8c0b9809e784252..0394781023fc48d7b64c11038258f4a938358cca 100644 (file)
@@ -1,3 +1,4 @@
 THIRPARTY=false
+HW_PROJECT_REFERENCE=Hardware
 PROCESSOR=microblaze_0
 MSS_FILE=system.mss
index 48c2d851e87b336d1c72206c9161c116abf39ce3..ce066cd977834510496b46c9c5a737e8b43e18b8 100644 (file)
                                                        <tool id="xilinx.gnu.mb.size.debug.725684245" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/>\r
                                                </toolChain>\r
                                        </folderInfo>\r
-                                       <fileInfo id="xilinx.gnu.mb.exe.debug.1168698469.494031543" name="fsdata.c" rcbsApplicability="disable" resourcePath="src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/fsdata.c" toolsToInvoke="xilinx.gnu.mb.c.toolchain.compiler.debug.610152912.1752708935">\r
-                                               <tool id="xilinx.gnu.mb.c.toolchain.compiler.debug.610152912.1752708935" name="MicroBlaze gcc compiler" superClass="xilinx.gnu.mb.c.toolchain.compiler.debug.610152912"/>\r
-                                       </fileInfo>\r
                                        <sourceEntries>\r
                                                <entry excluding="src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/fsdata.c|src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/makefsdata|src/platform.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
                                        </sourceEntries>\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/CreateRepoDirectoryStructure.bat b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/CreateRepoDirectoryStructure.bat
new file mode 100644 (file)
index 0000000..7ff3800
--- /dev/null
@@ -0,0 +1,9 @@
+REM Copy the FreeRTOS source files, including the Cortex-A9 and Microblaze port\r
+REM layers into the repository directory structure.\r
+\r
+copy ..\..\Source\*.c .\repo\bsp\freertos822_xilinx_v1_0\src\Source\r
+copy ..\..\Source\include\*.h .\repo\bsp\freertos822_xilinx_v1_0\src\Source\include\r
+copy ..\..\Source\portable\GCC\ARM_CA9\*.* .\repo\bsp\freertos822_xilinx_v1_0\src\Source\portable\GCC\ARM_CA9\r
+copy ..\..\Source\portable\GCC\MicroBlazeV8\*.* .\repo\bsp\freertos822_xilinx_v1_0\src\Source\portable\GCC\MicroBlazeV8\r
+copy ..\..\Source\portable\MemMang\heap_4.c .\repo\bsp\freertos822_xilinx_v1_0\src\Source\portable\MemMang\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mld b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mld
new file mode 100644 (file)
index 0000000..a49bc75
--- /dev/null
@@ -0,0 +1,82 @@
+#\r
+# Copyright (C) 2015 Xilinx, Inc.\r
+#\r
+# This file is part of the FreeRTOS port.\r
+#\r
+# FreeRTOS is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License (version 2) as published by the\r
+# Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+#\r
+# NOTE: The modification to the GPL is included to allow you to distribute a\r
+# combined work that includes FreeRTOS without being obliged to provide the\r
+# source code for proprietary components outside of the FreeRTOS kernel.\r
+#\r
+# FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+# FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+# link: http://www.freertos.org/a00114.html\r
+#\r
+\r
+OPTION psf_version = 2.1.0 ;\r
+BEGIN OS freertos822_xilinx\r
+\r
+OPTION DRC = FreeRTOS_drc ;\r
+# _RB_ Not sure if line below is valid.\r
+OPTION supported_peripherals = ps7_cortexa9 microblaze\r
+OPTION COPYFILES = all;\r
+OPTION NAME = freertos822_xilinx;\r
+OPTION VERSION = 1.0;\r
+OPTION DEPENDS = (standalone_v5_0);\r
+OPTION APP_LINKER_FLAGS = "-Wl,--start-group,-lxil,-lfreertos,-lgcc,-lc,--end-group";\r
+OPTION DESC = "FreeRTOS is a market leading open source RTOS";\r
+\r
+# STDIN/STDOUT\r
+PARAM name = stdin, desc = "stdin peripheral", type = peripheral_instance, requires_interface = stdin, default=none, range = (ps7_uart, ps7_coresight_comp, iomodule, axi_uartlite, axi_uart16550, mdm);\r
+PARAM name = stdout, desc = "stdout peripheral", type = peripheral_instance, requires_interface = stdout, default=none, range = (ps7_uart, ps7_coresight_comp, iomodule, axi_uartlite, axi_uart16550, mdm);\r
+\r
+BEGIN CATEGORY kernel_behavior\r
+       PARAM name = kernel_behavior, type = bool, default = true, desc = "Parameters relating to the kernel behavior", permit = none;\r
+       PARAM name = max_api_call_interrupt_priority, type = int, default = 18, desc = "The maximum interrupt priority from which interrupt safe FreeRTOS API calls can be made.";\r
+       PARAM name = use_preemption, type = bool, default = true, desc = "Set to true to use the preemptive scheduler, or false to use the cooperative scheduler.";\r
+       PARAM name = tick_rate, type = int, default = 100, desc = "Number of RTOS ticks per sec";\r
+       PARAM name = idle_yield, type = bool, default = true, desc = "Set to true if the Idle task should yield if another idle priority task is able to run, or false if the idle task should always use its entire time slice unless it is preempted.";\r
+       PARAM name = max_priorities, type = int, default = 4, desc = "The number of task priorities that will be available.  Priorities can be assigned from zero to (max_priorities - 1)";\r
+       PARAM name = minimal_stack_size, type = int, default = 180, desc = "The size of the stack allocated to the Idle task. Also used by standard demo and test tasks found in the main FreeRTOS download.";\r
+       PARAM name = total_heap_size, type = int, default = 32768, desc = "Sets the amount of RAM reserved for use by FreeRTOS - used when tasks, queues, semaphores and event groups are created.";\r
+       PARAM name = max_task_name_len, type = int, default = 8, desc = "The maximum number of characters that can be in the name of a task.";\r
+       PARAM name = use_timeslicing, type = bool, default = true, desc = "When true equal priority ready tasks will share CPU time with a context switch on each tick interrupt.";\r
+       PARAM name = use_port_optimized_task_selection, type = bool, default = true, desc ="When true task selection will be faster at the cost of limiting the maximum number of unique priorities to 32.";\r
+END CATEGORY\r
+\r
+BEGIN CATEGORY kernel_features\r
+       PARAM name = kernel_features, type = bool, default = true, desc = "Include or exclude kernel features", permit = none;\r
+       PARAM name = use_freertos_asserts, type = bool, default = true, desc = "Defines configASSERT() to assist development and debugging.  The application can override the default implementation of vApplicationAssert( char *pcFile, uint32_t ulLine )";\r
+       PARAM name = use_mutexes, type = bool, default = true, desc = "Set to true to include mutex functionality, or false to exclude mutex functionality.";\r
+       PARAM name = use_recursive_mutexes, type = bool, default = true, desc = "Set to true to include recursive mutex functionality, or false to exclude recursive mutex functionality.";\r
+       PARAM name = use_counting_semaphores, type = bool, default = true, desc = "Set to true to include counting semaphore functionality, or false to exclude recursive mutex functionality.";\r
+       PARAM name = queue_registry_size, type = int, default = 10, desc = "The maximum number of queues that can be registered at any one time. Only registered queues can be viewed in the Eclipse/GDB kernel aware debugger plug-in.";\r
+       PARAM name = use_trace_facility, type = bool, default = true, desc = "Set to true to include the legacy trace functionality, and a few other features.  traceMACROS are the preferred method of tracing now.";\r
+       PARAM name = use_newlib_reent, type = bool, default = false, desc = "When true each task will have its own Newlib reent structure.";\r
+       PARAM name = use_queue_sets, type = bool, default = false, desc = "Set to true to include queue set functionality.";\r
+       PARAM name = use_task_notifications, type = bool, default = true, desc = "Set to true to include direct to task notification functionality.";\r
+       PARAM name = check_for_stack_overflow, type = int, default = 2, desc = "Set to 0 for no overflow checking.  Set to 1 to include basic run time task stack checking.  Set to 2 to include more comprehensive run time task stack checking.";\r
+       PARAM name = use_stats_formatting_functions, type = bool, default = true, desc = "Set to 1 to include the vTaskList() and vTaskGetRunTimeStats() functions, which format run-time data into human readable text.";\r
+       PARAM name = num_thread_local_storage_pointers, type = int, default = 0, desc ="Sets the number of pointers each task has to store thread local values.";\r
+END CATEGORY\r
+\r
+BEGIN CATEGORY hook_functions\r
+       PARAM name = hook_functions, type = bool, default = true, desc = "Include or exclude application defined hook (callback) functions.  Callback functions must be defined by the application that is using FreeRTOS", permit = none;\r
+       PARAM name = use_idle_hook, type = bool, default = false, desc = "Set to true for the kernel to call vApplicationIdleHook() on each iteration of the idle task.  The application must provide an implementation of vApplicationIdleHook().";\r
+       PARAM name = use_tick_hook, type = bool, default = false, desc = "Set to true for the kernel to call vApplicationTickHook() during each tick interrupt.  The application must provide an implementation of vApplicationTickHook().";\r
+       PARAM name = use_malloc_failed_hook, type = bool, default = true, desc = "Only used if a FreeRTOS memory manager (heap_n.c) is included in the project.  Set to true for the kernel to call vApplicationMallocFailedHookHook() if there is insufficient FreeRTOS heap available for a task, queue or semaphore to be created.  The application can override the default implementation of vApplicationMallocFailedHook().";\r
+END CATEGORY\r
+\r
+BEGIN CATEGORY software_timers\r
+       PARAM name = software_timers, type = bool, default = true, desc = "Options relating to the software timers functionality", permit = user;\r
+       PARAM name = use_timers, type = bool, default = true, desc = "Set to true to include software timer functionality, or false to exclude software timer functionality";\r
+       PARAM name = timer_task_priority, type = string, default = "(configMAX_PRIORITIES - 1)", desc = "The priority at which the software timer service/daemon task will execute.";\r
+       PARAM name = timer_command_queue_length, type = int, default = 10, desc = "The number of commands the timer command queue can hold at any one time.";\r
+       PARAM name = timer_task_stack_depth, type = string, default = "(configMINIMAL_STACK_SIZE), desc = "The size of the stack allocated to the timer service/daemon task.";\r
+END CATEGORY\r
+\r
+END OS\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mss b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.mss
new file mode 100644 (file)
index 0000000..da6b216
--- /dev/null
@@ -0,0 +1,29 @@
+#\r
+# Copyright (C) 2015 Xilinx, Inc.\r
+#\r
+# This file is part of the FreeRTOS port.\r
+#\r
+# FreeRTOS is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License (version 2) as published by the\r
+# Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+#\r
+# NOTE: The modification to the GPL is included to allow you to distribute a\r
+# combined work that includes FreeRTOS without being obliged to provide the\r
+# source code for proprietary components outside of the FreeRTOS kernel.\r
+#\r
+# FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+# FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+# link: http://www.freertos.org/a00114.html\r
+#\r
+\r
+PARAMETER VERSION = 2.2.0\r
+\r
+BEGIN OS\r
+ PARAMETER OS_NAME = freertos822_xilinx\r
+ PARAMETER STDIN =  *\r
+ PARAMETER STDOUT = *\r
+ PARAMETER SYSTMR_SPEC = true\r
+ PARAMETER SYSTMR_DEV = *\r
+ PARAMETER SYSINTC_SPEC = *\r
+END\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.tcl b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/data/freertos822_xilinx.tcl
new file mode 100644 (file)
index 0000000..3bf7035
--- /dev/null
@@ -0,0 +1,766 @@
+#\r
+# Copyright (C) 2015 Xilinx, Inc.\r
+#\r
+# This file is part of the FreeRTOS port.\r
+#\r
+# FreeRTOS is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License (version 2) as published by the\r
+# Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+#\r
+# NOTE: The modification to the GPL is included to allow you to distribute a\r
+# combined work that includes FreeRTOS without being obliged to provide the\r
+# source code for proprietary components outside of the FreeRTOS kernel.\r
+#\r
+# FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+# FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+# link: http://www.freertos.org/a00114.html\r
+#\r
+\r
+\r
+# standalone bsp version. set this to the latest "ACTIVE" version.\r
+set standalone_version standalone_v5_0\r
+\r
+proc FreeRTOS_drc {os_handle} {\r
+\r
+       global env\r
+\r
+       set sw_proc_handle [hsi::get_sw_processor]\r
+       set hw_proc_handle [hsi::get_cells [common::get_property HW_INSTANCE $sw_proc_handle] ]\r
+       set proctype [common::get_property IPNAME $hw_proc_handle]\r
+\r
+       if { $proctype == "microblaze" } {\r
+               mb_drc_checks\r
+       }\r
+}\r
+\r
+proc generate {os_handle} {\r
+\r
+       variable standalone_version\r
+       set have_tick_timer 0\r
+       set sw_proc_handle [hsi::get_sw_processor]\r
+       set hw_proc_handle [hsi::get_cells [common::get_property HW_INSTANCE $sw_proc_handle] ]\r
+       set proctype [common::get_property IP_NAME $hw_proc_handle]\r
+       set need_config_file "false"\r
+\r
+       set commonsrcdir "../${standalone_version}/src/common"\r
+       set mbsrcdir "../${standalone_version}/src/microblaze"\r
+       set arma9srcdir "../${standalone_version}/src/cortexa9"\r
+       set arma9gccdir "../${standalone_version}/src/cortexa9/gcc"\r
+       set arma9armccdir "../${standalone_version}/src/cortexa9/armcc"\r
+       set arma9iarccdir "../${standalone_version}/src/cortexa9/iarcc"\r
+\r
+       foreach entry [glob -nocomplain [file join $commonsrcdir *]] {\r
+               file copy -force $entry [file join ".." "${standalone_version}" "src"]\r
+       }\r
+\r
+       switch $proctype {\r
+\r
+               "ps7_cortexa9"  {\r
+                               puts "In start copy ps7_cortexa9"\r
+                               file copy -force "./src/Makefile_ps7_cortexa9" "./src/Makefile"\r
+                               file copy -force "./src/Makefile" "./src/Makefile_dep"\r
+\r
+                               foreach entry [glob -nocomplain [file join $arma9srcdir *]] {\r
+                                       file copy -force $entry [file join ".." "${standalone_version}" "src"]\r
+                               }\r
+\r
+                               foreach entry [glob -nocomplain [file join $arma9gccdir *]] {\r
+                                       file copy -force $entry [file join ".." "${standalone_version}" "src"]\r
+                               }\r
+\r
+                               file delete -force "../${standalone_version}/src/gcc"\r
+\r
+                               set need_config_file "true"\r
+\r
+                               set file_handle [::hsi::utils::open_include_file "xparameters.h"]\r
+                               puts $file_handle "#include \"xparameters_ps.h\""\r
+                               puts $file_handle ""\r
+                               close $file_handle\r
+                       }\r
+\r
+               "microblaze"  {\r
+                               puts "In start copy microblaze"\r
+                               file copy -force "./src/Makefile_microblaze" "./src/Makefile"\r
+                               file copy -force "./src/Makefile" "./src/Makefile_dep"\r
+\r
+                               foreach entry [glob -nocomplain [file join $mbsrcdir *]] {\r
+                                       if { [string first "microblaze_interrupt_handler" $entry] == -1 } { ;# Do not copy over the Standalone BSP exception handler\r
+                                               file copy -force $entry [file join ".." "${standalone_version}" "src"]\r
+                                       }\r
+                               }\r
+\r
+                               set need_config_file "true"\r
+                       }\r
+\r
+               "default" {\r
+                       puts "processor type $proctype not supported\n"\r
+               }\r
+       }\r
+\r
+       # Write the Config.make file\r
+       set makeconfig [open "../${standalone_version}/src/config.make" w]\r
+       file rename -force -- "../${standalone_version}/src/Makefile" "../${standalone_version}/src/Makefile_depends"\r
+\r
+       if { $proctype == "ps7_cortexa9" || $proctype == "microblaze" } {\r
+               puts $makeconfig "LIBSOURCES = *.c *.S"\r
+               puts $makeconfig "LIBS = standalone_libs"\r
+       }\r
+\r
+       close $makeconfig\r
+\r
+       # Remove arm directory...\r
+       file delete -force $arma9srcdir\r
+       file delete -force $mbsrcdir\r
+\r
+       # Copy core kernel files to the main src directory\r
+       file copy -force [file join src Source tasks.c] ./src\r
+       file copy -force [file join src Source queue.c] ./src\r
+       file copy -force [file join src Source list.c] ./src\r
+       file copy -force [file join src Source timers.c] ./src\r
+       file copy -force [file join src Source event_groups.c] ./src\r
+       file copy -force [file join src Source portable MemMang heap_4.c] ./src\r
+\r
+       if { $proctype == "ps7_cortexa9" } {\r
+               file copy -force [file join src Source portable GCC ARM_CA9 port.c] ./src\r
+               file copy -force [file join src Source portable GCC ARM_CA9 portASM.S] ./src\r
+               file copy -force [file join src Source portable GCC ARM_CA9 port_asm_vectors.S] ./src\r
+               file copy -force [file join src Source portable GCC ARM_CA9 portmacro.h] ./src\r
+               file copy -force [file join src Source portable GCC ARM_CA9 portZynq7000.c] ./src\r
+       }\r
+\r
+       if { $proctype == "microblaze" } {\r
+               file copy -force [file join src Source portable GCC MicroBlazeV8 port.c] ./src\r
+               file copy -force [file join src Source portable GCC MicroBlazeV8 port_exceptions.c] ./src\r
+               file copy -force [file join src Source portable GCC MicroBlazeV8 portasm.S] ./src\r
+               file copy -force [file join src Source portable GCC MicroBlazeV8 portmacro.h] ./src\r
+               file copy -force [file join src Source portable GCC MicroBlazeV8 portmicroblaze.c] ./src\r
+\r
+               # Create config file for microblaze interrupt handling\r
+               if {[string compare -nocase $need_config_file "true"] == 0} {\r
+                       xhandle_mb_interrupts\r
+               }\r
+\r
+               # Create config files for Microblaze exception handling\r
+               if { [mb_has_exceptions $hw_proc_handle] } {\r
+                       xcreate_mb_exc_config_file\r
+               }\r
+\r
+               # Create bspconfig file\r
+               set bspcfg_fn [file join ".." "${standalone_version}" "src"  "bspconfig.h"]\r
+               file delete $bspcfg_fn\r
+               set bspcfg_fh [open $bspcfg_fn w]\r
+               xprint_generated_header $bspcfg_fh "Configurations for Standalone BSP"\r
+\r
+               if { [mb_has_pvr $hw_proc_handle] } {\r
+\r
+                       set pvr [get_property CONFIG.C_PVR $hw_proc_handle]\r
+\r
+                       switch $pvr {\r
+                               "0" {\r
+                                       puts $bspcfg_fh "#define MICROBLAZE_PVR_NONE"\r
+                               }\r
+                               "1" {\r
+                                       puts $bspcfg_fh "#define MICROBLAZE_PVR_BASIC"\r
+                               }\r
+                               "2" {\r
+                                       puts $bspcfg_fh "#define MICROBLAZE_PVR_FULL"\r
+                               }\r
+                               "default" {\r
+                                       puts $bspcfg_fh "#define MICROBLAZE_PVR_NONE"\r
+                               }\r
+                       }\r
+               }\r
+\r
+               close $bspcfg_fh\r
+       }\r
+\r
+       set headers [glob -join ./src/Source/include *.\[h\]]\r
+       foreach header $headers {\r
+               file copy -force $header src\r
+       }\r
+\r
+       file delete -force [file join src Source]\r
+\r
+       # Remove microblaze, cortexa9 and common directories...\r
+       file delete -force $mbsrcdir\r
+       file delete -force $commonsrcdir\r
+       file delete -force $arma9srcdir\r
+       file delete -force $arma9gccdir\r
+       file delete -force $arma9armccdir\r
+       file delete -force $arma9iarccdir\r
+\r
+       # Handle stdin and stdout\r
+       ::hsi::utils::handle_stdin $os_handle\r
+       ::hsi::utils::handle_stdout $os_handle\r
+\r
+       file copy -force "./src/outbyte.c" "../${standalone_version}/src/"\r
+       file copy -force "./src/inbyte.c" "../${standalone_version}/src/"\r
+\r
+       set file_handle [::hsi::utils::open_include_file "xparameters.h"]\r
+       puts $file_handle "\n/******************************************************************/\n"\r
+       close $file_handle\r
+\r
+       ############################################################################\r
+       ## Add constants common to all architectures to the configuration file.\r
+       ############################################################################\r
+\r
+       set config_file [xopen_new_include_file "./src/FreeRTOSConfig.h" "FreeRTOS Configuration parameters"]\r
+       puts $config_file "\#include \"xparameters.h\" \n"\r
+\r
+       set val [common::get_property CONFIG.use_preemption $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_PREEMPTION" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_PREEMPTION" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_mutexes $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_MUTEXES" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_MUTEXES" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_recursive_mutexes $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_RECURSIVE_MUTEXES" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_RECURSIVE_MUTEXES" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_counting_semaphores $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_COUNTING_SEMAPHORES" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_COUNTING_SEMAPHORES" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_timers $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_TIMERS" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_TIMERS" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_idle_hook $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_IDLE_HOOK"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_IDLE_HOOK"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_tick_hook $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_TICK_HOOK"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_TICK_HOOK"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_malloc_failed_hook $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_MALLOC_FAILED_HOOK" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_MALLOC_FAILED_HOOK" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_trace_facility $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_TRACE_FACILITY" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_TRACE_FACILITY" "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_task_notifications $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_TASK_NOTIFICATIONS" "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_TASK_NOTIFICATIONS" "1"\r
+       }\r
+\r
+       xput_define $config_file "configUSE_16_BIT_TICKS"                  "0"\r
+       xput_define $config_file "configUSE_APPLICATION_TASK_TAG"   "0"\r
+       xput_define $config_file "configUSE_CO_ROUTINES"                        "0"\r
+\r
+       set tick_rate [common::get_property CONFIG.tick_rate $os_handle]\r
+       xput_define $config_file "configTICK_RATE_HZ"    "($tick_rate)"\r
+\r
+       set max_priorities [common::get_property CONFIG.max_priorities $os_handle]\r
+       xput_define $config_file "configMAX_PRIORITIES"   "($max_priorities)"\r
+       xput_define $config_file "configMAX_CO_ROUTINE_PRIORITIES" "2"\r
+\r
+       set min_stack [common::get_property CONFIG.minimal_stack_size $os_handle]\r
+       set min_stack [expr [expr $min_stack + 3] & 0xFFFFFFFC]\r
+       xput_define $config_file "configMINIMAL_STACK_SIZE" "( ( unsigned short ) $min_stack)"\r
+\r
+       set total_heap_size [common::get_property CONFIG.total_heap_size $os_handle]\r
+       xput_define $config_file "configTOTAL_HEAP_SIZE"  "( ( size_t ) ( $total_heap_size ) )"\r
+\r
+       set max_task_name_len [common::get_property CONFIG.max_task_name_len $os_handle]\r
+       xput_define $config_file "configMAX_TASK_NAME_LEN"  $max_task_name_len\r
+\r
+       set val [common::get_property CONFIG.idle_yield $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configIDLE_SHOULD_YIELD"  "0"\r
+       } else {\r
+               xput_define $config_file "configIDLE_SHOULD_YIELD"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.timer_task_priority $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configTIMER_TASK_PRIORITY"  "0"\r
+       } else {\r
+               xput_define $config_file "configTIMER_TASK_PRIORITY"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.timer_command_queue_length $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configTIMER_QUEUE_LENGTH"  "0"\r
+       } else {\r
+               xput_define $config_file "configTIMER_QUEUE_LENGTH"  "10"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.timer_task_stack_depth $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configTIMER_TASK_STACK_DEPTH"  "0"\r
+       } else {\r
+               xput_define $config_file "configTIMER_TASK_STACK_DEPTH"  $min_stack\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_newlib_reent $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_NEWLIB_REENTRANT"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_NEWLIB_REENTRANT"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_timeslicing $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_TIME_SLICING"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_TIME_SLICING"  "1"\r
+       }\r
+\r
+       set val [get_property CONFIG.use_freertos_asserts $os_handle]\r
+       if {$val == "true"} {\r
+               puts $config_file "#define configASSERT( x ) if( ( x ) == 0 ) vApplicationAssert( __FILE__, __LINE__ )\n"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.use_queue_sets $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_QUEUE_SETS"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_QUEUE_SETS"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.check_for_stack_overflow $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configCHECK_FOR_STACK_OVERFLOW"  "0"\r
+       } else {\r
+               if { $val > 2 } {\r
+                       error "ERROR: check_for_stack_overflow must be between 0 and 2"\r
+               } else {\r
+                       xput_define $config_file "configCHECK_FOR_STACK_OVERFLOW"  $val\r
+               }\r
+       }\r
+\r
+\r
+       set val [common::get_property CONFIG.queue_registry_size $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configQUEUE_REGISTRY_SIZE"  "0"\r
+       } else {\r
+               xput_define $config_file "configQUEUE_REGISTRY_SIZE"  $val\r
+       }\r
+\r
+\r
+       set val [common::get_property CONFIG.use_stats_formatting_functions  $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configUSE_STATS_FORMATTING_FUNCTIONS"  "0"\r
+       } else {\r
+               xput_define $config_file "configUSE_STATS_FORMATTING_FUNCTIONS"  "1"\r
+       }\r
+\r
+       set val [common::get_property CONFIG.num_thread_local_storage_pointers $os_handle]\r
+       if {$val == "false"} {\r
+               xput_define $config_file "configNUM_THREAD_LOCAL_STORAGE_POINTERS"  "0"\r
+       } else {\r
+               xput_define $config_file "configNUM_THREAD_LOCAL_STORAGE_POINTERS"  $val\r
+       }\r
+\r
+       puts $config_file "#define configTASK_RETURN_ADDRESS    NULL"\r
+\r
+       puts $config_file "#define INCLUDE_vTaskPrioritySet             1"\r
+       puts $config_file "#define INCLUDE_uxTaskPriorityGet            1"\r
+       puts $config_file "#define INCLUDE_vTaskDelete                  1"\r
+       puts $config_file "#define INCLUDE_vTaskCleanUpResources        0"\r
+       puts $config_file "#define INCLUDE_vTaskSuspend                 1"\r
+       puts $config_file "#define INCLUDE_vTaskDelayUntil              1"\r
+       puts $config_file "#define INCLUDE_vTaskDelay                   1"\r
+       puts $config_file "#define INCLUDE_uxTaskGetStackHighWaterMark  1"\r
+       puts $config_file "#define INCLUDE_xTaskGetSchedulerState       1"\r
+       puts $config_file "#define INCLUDE_xTimerGetTimerTaskHandle     1"\r
+       puts $config_file "#define INCLUDE_xTaskGetIdleTaskHandle       1"\r
+       puts $config_file "#define INCLUDE_xQueueGetMutexHolder         1"\r
+       puts $config_file "#define INCLUDE_eTaskGetState                1"\r
+       puts $config_file "#define INCLUDE_xEventGroupSetBitFromISR     1"\r
+       puts $config_file "#define INCLUDE_xTimerPendFunctionCall       1"\r
+       puts $config_file "#define INCLUDE_pcTaskGetTaskName            1"\r
+       puts $config_file "#define INCLUDE_xTaskResumeFromISR           1"\r
+       puts $config_file "#define INCLUDE_xTaskGetCurrentTaskHandle    1"\r
+       puts $config_file "#define INCLUDE_xSemaphoreGetMutexHolder     1"\r
+\r
+\r
+       ############################################################################\r
+       ## Add constants specific to the ps7_cortexa9\r
+       ############################################################################\r
+       if { $proctype == "ps7_cortexa9" } {\r
+               set max_api_call_interrupt_priority [common::get_property CONFIG.max_api_call_interrupt_priority $os_handle]\r
+               xput_define $config_file "configMAX_API_CALL_INTERRUPT_PRIORITY"   "($max_api_call_interrupt_priority)"\r
+\r
+               set val [common::get_property CONFIG.use_port_optimized_task_selection $os_handle]\r
+               if {$val == "false"} {\r
+                       xput_define $config_file "configUSE_PORT_OPTIMISED_TASK_SELECTION"  "0"\r
+               } else {\r
+                       xput_define $config_file "configUSE_PORT_OPTIMISED_TASK_SELECTION"  "1"\r
+               }\r
+\r
+               puts $config_file "#define configINTERRUPT_CONTROLLER_BASE_ADDRESS         ( XPAR_PS7_SCUGIC_0_DIST_BASEADDR )"\r
+               puts $config_file "#define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ( -0xf00 )"\r
+               puts $config_file "#define configUNIQUE_INTERRUPT_PRIORITIES                32"\r
+\r
+               # Function prototypes cannot be in the common code as some compilers or\r
+               # ports require pre-processor guards to ensure they are not visible from\r
+               # assembly files.\r
+               puts $config_file "void vApplicationAssert( const char *pcFile, uint32_t ulLine );"\r
+               puts $config_file "void FreeRTOS_SetupTickInterrupt( void );"\r
+               puts $config_file "#define configSETUP_TICK_INTERRUPT() FreeRTOS_SetupTickInterrupt()\n"\r
+               puts $config_file "void FreeRTOS_ClearTickInterrupt( void );"\r
+               puts $config_file "#define portCLEAR_TICK_INTERRUPT()   FreeRTOS_ClearTickInterrupt()\n"\r
+       }\r
+       # end of if $proctype == "ps7_cortexa9"\r
+\r
+\r
+\r
+       ############################################################################\r
+       ## Add constants specific to the microblaze\r
+       ############################################################################\r
+       if { $proctype == "microblaze" } {\r
+               # Interrupt controller setting assumes only one is in use.\r
+               puts $config_file "#define configINTERRUPT_CONTROLLER_TO_USE XPAR_INTC_SINGLE_DEVICE_ID"\r
+               puts $config_file "#define configINSTALL_EXCEPTION_HANDLERS 1"\r
+\r
+               # Avoid non #define statements getting included in assembly files.\r
+               puts $config_file "#ifndef __ASSEMBLER__"\r
+               puts $config_file "void vApplicationAssert( const char *pcFile, uint32_t ulLine );"\r
+               puts $config_file "#endif"\r
+       }\r
+       # end of if $proctype == "microblaze"\r
+\r
+\r
+       # complete the header protectors\r
+       puts $config_file "\#endif"\r
+       close $config_file\r
+}\r
+\r
+proc xopen_new_include_file { filename description } {\r
+       set inc_file [open $filename w]\r
+       xprint_generated_header $inc_file $description\r
+       set newfname [string map {. _} [lindex [split $filename {\/}] end]]\r
+       puts $inc_file "\#ifndef _[string toupper $newfname]"\r
+       puts $inc_file "\#define _[string toupper $newfname]\n\n"\r
+       return $inc_file\r
+}\r
+\r
+proc xput_define { config_file parameter param_value } {\r
+       puts $config_file "#define $parameter $param_value\n"\r
+}\r
+\r
+proc xhandle_mb_interrupts {} {\r
+\r
+       set default_interrupt_handler "XNullHandler"\r
+       set default_arg "XNULL"\r
+\r
+       set source_interrupt_handler $default_interrupt_handler\r
+       set source_handler_arg $default_arg\r
+\r
+       # Handle the interrupt pin\r
+       set sw_proc_handle [get_sw_processor]\r
+       set periph [get_cells $sw_proc_handle]\r
+       set source_ports [xget_interrupt_sources $periph]\r
+       if {[llength $source_ports] > 1} {\r
+               error "Too many interrupting ports on the MicroBlaze.  Should only find 1" "" "error"\r
+               return\r
+       }\r
+\r
+       if {[llength $source_ports] == 1} {\r
+               set source_port [lindex $source_ports 0]\r
+               if {[llength $source_port] != 0} {\r
+                       set source_port_name [get_property NAME $source_port]\r
+                       set source_periph [get_cells -of_objects $source_port]\r
+                       set source_name [get_property NAME $source_periph]\r
+                       set source_driver [get_drivers $source_name]\r
+\r
+                       if {[string compare -nocase $source_driver ""] != 0} {\r
+                               set int_array [get_arrays -of_objects $source_driver]\r
+                               if {[llength $int_array] != 0} {\r
+                                       set size [get_property PROPERTY.size $int_array]\r
+                                       for {set i 0 } { $i < $size } { incr $i } {\r
+                                               set int_port [lindex [get_property PARAM.int_port $int_array] $i]\r
+                                               if {[llength $int_port] != 0} {\r
+                                                       if {[string compare -nocase $int_port $source_port_name] == 0 } {\r
+                                                               set source_interrupt_handler [lindex [get_property PARAM.int_handler $int_array] $i ]\r
+                                                               set source_handler_arg [lindex [get_property PARAM.int_handler_arg $int_array] $i ]\r
+                                                               if {[string compare -nocase $source_handler_arg DEVICE_ID] == 0 } {\r
+                                                                       set source_handler_arg [xget_name $source_periph "DEVICE_ID"]\r
+                                                               } else {\r
+                                                                       if {[llength $source_periph] == 0} {\r
+                                                                               set source_handler_arg $default_arg\r
+                                                                       } else {\r
+                                                                               set source_handler_arg [xget_name $source_periph "C_BASEADDR"]\r
+                                                                       }\r
+                                                               }\r
+                                                               break\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+    }\r
+\r
+    # Generate microblaze_interrupts_g.c file...\r
+    xcreate_mb_intr_config_file $source_interrupt_handler $source_handler_arg\r
+}\r
+\r
+proc xcreate_mb_intr_config_file {handler arg} {\r
+\r
+    set mb_table "MB_InterruptVectorTable"\r
+       variable standalone_version\r
+\r
+       set filename [file join ".." "${standalone_version}" "src" "microblaze_interrupts_g.c"]\r
+    file delete $filename\r
+    set config_file [open $filename w]\r
+\r
+    xprint_generated_header $config_file "Interrupt Handler Table for MicroBlaze Processor"\r
+\r
+    puts $config_file "#include \"microblaze_interrupts_i.h\""\r
+    puts $config_file "#include \"xparameters.h\""\r
+    puts $config_file "\n"\r
+    puts $config_file [format "extern void %s (void *);" $handler]\r
+    puts $config_file "\n/*"\r
+    puts $config_file "* The interrupt handler table for microblaze processor"\r
+    puts $config_file "*/\n"\r
+    puts $config_file [format "%sEntry %s\[\] =" $mb_table $mb_table]\r
+    puts $config_file "\{"\r
+    puts -nonewline $config_file [format "\{\t%s" $handler]\r
+    puts -nonewline $config_file [format ",\n\t(void*) %s\}" $arg]\r
+    puts -nonewline $config_file "\n\};"\r
+    puts $config_file "\n"\r
+    close $config_file\r
+}\r
+\r
+# --------------------------------------\r
+# Return true if this MB has\r
+# exception handling support\r
+# --------------------------------------\r
+proc mb_has_exceptions { hw_proc_handle } {\r
+\r
+    # Check if the following parameters exist on this MicroBlaze's MPD\r
+    set ee [get_property CONFIG.C_UNALIGNED_EXCEPTIONS $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+\r
+    set ee [get_property CONFIG.C_ILL_OPCODE_EXCEPTION $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_IOPB_BUS_EXCEPTION  $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_DOPB_BUS_EXCEPTION  $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_DIV_BY_ZERO_EXCEPTION $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_DIV_ZERO_EXCEPTION $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_FPU_EXCEPTION   $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    set ee [get_property CONFIG.C_USE_MMU    $hw_proc_handle]\r
+    if { $ee != "" } {\r
+        return true\r
+    }\r
+    return false\r
+}\r
+\r
+# -------------------------------------------\r
+# Tcl procedure xcreate_mb_exc_config file\r
+# -------------------------------------------\r
+proc xcreate_mb_exc_config_file { } {\r
+\r
+    set hfilename [file join "src" "microblaze_exceptions_g.h"]\r
+    file delete $hfilename\r
+    set hconfig_file [open $hfilename w]\r
+\r
+    xprint_generated_header $hconfig_file "Exception Handling Header for MicroBlaze Processor"\r
+\r
+    puts $hconfig_file "\n"\r
+\r
+    set sw_proc_handle [get_sw_processor]\r
+    set hw_proc_handle [get_cells [get_property HW_INSTANCE $sw_proc_handle] ]\r
+    set proctype [get_property IP_NAME $hw_proc_handle]\r
+    set procver [get_ip_version $hw_proc_handle]\r
+\r
+    if { ![mb_has_exceptions $hw_proc_handle]} { ;# NO exceptions are enabled\r
+        close $hconfig_file              ;# Do not generate any info in either the header or the C file\r
+        return\r
+    }\r
+\r
+    puts $hconfig_file "\#define MICROBLAZE_EXCEPTIONS_ENABLED 1"\r
+    if { [mb_can_handle_exceptions_in_delay_slots $procver] } {\r
+        puts $hconfig_file "#define MICROBLAZE_CAN_HANDLE_EXCEPTIONS_IN_DELAY_SLOTS"\r
+    }\r
+\r
+    close $hconfig_file\r
+}\r
+\r
+# --------------------------------------\r
+# Return true if MB ver 'procver' has\r
+# support for handling exceptions in\r
+# delay slots\r
+# --------------------------------------\r
+proc mb_can_handle_exceptions_in_delay_slots { procver } {\r
+\r
+    if { [string compare -nocase $procver "5.00.a"] >= 0 } {\r
+        return true\r
+    } else {\r
+        return false\r
+    }\r
+}\r
+\r
+# --------------------------------------\r
+# Return true if this MB has PVR support\r
+# --------------------------------------\r
+proc mb_has_pvr { hw_proc_handle } {\r
+\r
+    # Check if the following parameters exist on this MicroBlaze's MPD\r
+    set pvr [get_property CONFIG.C_PVR $hw_proc_handle]\r
+    if { $pvr != "" } {\r
+        return true\r
+    }\r
+\r
+    return false\r
+}\r
+\r
+# --------------------------------------\r
+# Microblaze config checks\r
+# --------------------------------------\r
+proc mb_drc_checks { } {\r
+       set compiler [common::get_property CONFIG.compiler $sw_proc_handle]\r
+\r
+       # check for valid compiler\r
+       if { [string first "mb-gcc" $compiler] == 0 && [string first "mb-g++" $compiler] == 0} {\r
+               error "Wrong compiler requested. FreeRTOS can be compiled only with the GNU compiler for MicroBlaze." "" "mdt_error"\r
+       }\r
+\r
+       # check for valid stdio parameters\r
+       set stdin  [common::get_property CONFIG.stdin  $os_handle]\r
+       set stdout [common::get_property CONFIG.stdout $os_handle]\r
+       if { $stdin == "none" || $stdout == "none" } {\r
+               error "The STDIN/STDOUT parameters are not set. FreeRTOS requires stdin/stdout to be set." "" "mdt_error"\r
+       }\r
+\r
+       # check if the design has a intc\r
+       set intr_port [hsi::get_pins -of_objects $hw_proc_handle Interrupt]\r
+       set intr_flag 1\r
+       if { [llength $intr_port] == 0 } {\r
+               set intr_flag 0\r
+       } else {\r
+               set intr_net [hsi::get_nets -of_objects $intr_port]\r
+               if  { [llength $intr_port] == 0 }  {\r
+                       set intr_flag 0\r
+               }\r
+       }\r
+\r
+       if {$intr_flag == 0 } {\r
+               error "CPU has no connection to Interrupt controller." "" "mdt_error"\r
+       }\r
+\r
+       # support only AXI/PLB\r
+       set bus_name ""\r
+       set interconnect [common::get_property CONFIG.C_INTERCONNECT $hw_proc_handle]\r
+       puts [format "hw_proc_handle is %s" $hw_proc_handle]\r
+       if { $interconnect == 2 } {\r
+               set intf_pin [hsi::get_intf_pins -of_objects $hw_proc_handle "M_AXI_DP"]\r
+               if { [llength $intf_pin] } {\r
+                       set bus_name [hsi::get_intf_nets -of_objects $intf_pin]\r
+               }\r
+       } else {\r
+               error "FreeRTOS supports Microblaze with only a AXI interconnect" "" "mdt_error"\r
+       }\r
+\r
+       if { [llength $bus_name] == 0 } {\r
+               error "Microblaze M_AXI_DP is not connected to slave peripherals"\r
+       }\r
+\r
+       # obtain handles to all the peripherals in the design\r
+       set slave_ifs [hsi::get_intf_pins -of_objects $bus_name -filter "TYPE==SLAVE"]\r
+       puts [format "slave_ifs %s bus_name %s" $slave_ifs $bus_name]\r
+       set timer_count 0\r
+       set timer_has_intr 0\r
+\r
+       # check for a valid timer\r
+       foreach if $slave_ifs {\r
+               set ip_handle [hsi::get_cells -of_objects $if]\r
+\r
+               if {$ip_handle != $hw_proc_handle} {\r
+                       set type [common::get_property IP_NAME $ip_handle]\r
+                       if { $type == "axi_timer" } {\r
+                               incr timer_count\r
+\r
+                               # check if the timer interrupts are enabled\r
+                               set intr_port [hsi::get_pins -of_objects $ip_handle interrupt]\r
+                               if { [llength $intr_port] != 0 } {\r
+                                       set intr_net [hsi::get_nets -of_objects $intr_port]\r
+                                       if { [llength $intr_net] !=  0 } {\r
+                                               set timer_has_intr 1\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       if { $timer_count == 0 } {\r
+               error "FreeRTOS for Microblaze requires an axi_timer or xps_timer. The HW platform doesn't have a valid timer." "" "mdt_error"\r
+       }\r
+\r
+       if { $timer_has_intr == 0 } {\r
+               error "FreeRTOS for Microblaze requires interrupts enabled for a timer." "" "mdt_error"\r
+       }\r
+\r
+       set systmr_interval_ms [common::get_property CONFIG.systmr_interval $os_handle]\r
+       if { $systmr_interval_ms <= 0 } {\r
+               error "Invalid value for parameter systmr_interval specified. Please specify a positive value." "" "mdt_error"\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_microblaze b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_microblaze
new file mode 100644 (file)
index 0000000..fc24930
--- /dev/null
@@ -0,0 +1,165 @@
+#\r
+# Copyright (C) 2012-2013 Xilinx, Inc.\r
+#\r
+# This file is part of the port for FreeRTOS made by Xilinx to allow FreeRTOS\r
+# to operate with Xilinx Zynq devices.\r
+#\r
+# This file is free software; you can redistribute it and/or modify it under\r
+# the terms of the GNU General Public License (version 2) as published by the\r
+# Free Software Foundation AND MODIFIED BY the FreeRTOS exception\r
+# (see text further below).\r
+#\r
+# This file is distributed in the hope that it will be useful, but\r
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+# more details.\r
+#\r
+# You should have received a copy of the GNU General Public License; if not it\r
+# can be viewed here: <http://www.gnu.org/licenses/>\r
+#\r
+# The following exception language was found at\r
+# http://www.freertos.org/a00114.html on May 8, 2012.\r
+#\r
+# GNU General Public License Exception\r
+#\r
+# Any FreeRTOS source code, whether modified or in its original release form,\r
+# or whether in whole or in part, can only be distributed by you under the\r
+# terms of the GNU General Public License plus this exception. An independent\r
+# module is a module which is not derived from or based on FreeRTOS.\r
+#\r
+# EXCEPTION TEXT:\r
+#\r
+# Clause 1\r
+#\r
+# Linking FreeRTOS statically or dynamically with other modules is making a\r
+# combined work based on FreeRTOS. Thus, the terms and conditions of the\r
+# GNU General Public License cover the whole combination.\r
+#\r
+# As a special exception, the copyright holder of FreeRTOS gives you permission\r
+# to link FreeRTOS with independent modules that communicate with FreeRTOS\r
+# solely through the FreeRTOS API interface, regardless of the license terms\r
+# of these independent modules, and to copy and distribute the resulting\r
+# combined work under terms of your choice, provided that\r
+#\r
+# Every copy of the combined work is accompanied by a written statement that\r
+# details to the recipient the version of FreeRTOS used and an offer by\r
+# yourself to provide the FreeRTOS source code (including any modifications\r
+# you may have  made) should the recipient request it.\r
+# The combined work is not itself an RTOS, scheduler, kernel or related product.\r
+# The independent modules add significant and primary functionality to FreeRTOS\r
+# and do not merely extend the existing functionality already present\r
+# in FreeRTOS.\r
+#\r
+# Clause 2\r
+#\r
+# FreeRTOS may not be used for any competitive or comparative purpose,\r
+# including the publication of any form of run time or compile time metric,\r
+# without the express permission of Real Time Engineers Ltd. (this is the norm\r
+# within the industry and is intended to ensure information accuracy).\r
+#\r
+\r
+#\r
+# Processor architecture\r
+# microblaze\r
+#\r
+ARCH = microblaze\r
+\r
+SYSTEMDIR = ../../..\r
+\r
+TOPDIR = .\r
+\r
+ARCH_PREFIX = mb\r
+\r
+#\r
+# gnu tools for Makefile\r
+#\r
+CC = $(ARCH_PREFIX)-gcc\r
+AS = $(ARCH_PREFIX)-as\r
+AR = $(ARCH_PREFIX)-ar\r
+CP = cp\r
+\r
+#\r
+# Compiler, linker and other options.\r
+#\r
+CFLAGS = ${COMPILER_FLAGS} ${EXTRA_COMPILER_FLAGS}\r
+\r
+#\r
+# System project directories.\r
+#\r
+LIBDIR = $(SYSTEMDIR)/lib\r
+INCLUDEDIR = $(SYSTEMDIR)/include\r
+\r
+# Kernel library.\r
+LIBFREERTOS = ${LIBDIR}/libfreertos.a\r
+LIBXIL = ${LIBDIR}/libxil.a\r
+\r
+INCLUDEFILES = ${TOPDIR}/*.h\r
+\r
+INCLUDES = -I$(INCLUDEDIR) \\r
+       -I${TOPDIR}\r
+\r
+KERNEL_AR_OBJS = *.c *.S\r
+\r
+OUTS = *.o\r
+\r
+libs:  $(KERNEL_AR_OBJS)\r
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src libs\r
+       @echo "Compiling FreeRTOS"\r
+       @$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $^\r
+       @$(ARCHIVER) -r ${LIBFREERTOS} ${OUTS}\r
+       @$(ARCHIVER) -d ${LIBXIL} asm_vectors.o\r
+       @$(ARCHIVER) -s ${LIBXIL}\r
+\r
+       make clean\r
+\r
+\r
+\r
+\r
+include_standalone:\r
+       @echo "includes"\r
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src include\r
+       $(CP) -rf $(INCLUDEFILES) $(INCLUDEDIR)\r
+\r
+\r
+.PHONY: include\r
+include:\r
+       @echo "include"\r
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src include\r
+       ${CP} ${INCLUDEFILES} ${INCLUDEDIR}\r
+\r
+clean:\r
+       rm -rf ${OUTS}\r
+\r
+\r
+\r
+\r
+\r
+#PROCESSOR = microblaze_0\r
+#LIBRARIES = ${PROCESSOR}/lib/libxil.a\r
+#BSP_MAKEFILES := $(wildcard $(PROCESSOR)/libsrc/*/src/Makefile)\r
+#SUBDIRS := $(patsubst %/Makefile, %, $(BSP_MAKEFILES))\r
+#\r
+#ifneq (,$(findstring win,$(RDI_PLATFORM)))\r
+# SHELL = CMD\r
+#endif\r
+#\r
+#all: libs\r
+#      @echo 'Finished building libraries'\r
+#\r
+#include: $(addsuffix /make.include,$(SUBDIRS))\r
+#\r
+#libs: $(addsuffix /make.libs,$(SUBDIRS))\r
+#\r
+#$(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a\r
+#      cp -f $< $@\r
+#\r
+#%/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,)\r
+#      @echo "Running Make include in $(subst /make.include,,$@)"\r
+#      $(MAKE) -C $(subst /make.include,,$@) -s include  "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v9.4 -mhard-float -mlittle-endian #-mno-xl-soft-div -mno-xl-soft-mul -mxl-barrel-shift -mxl-float-convert -mxl-float-sqrt -mxl-multiply-high -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections #-fdata-sections"\r
+#\r
+#%/make.libs: include\r
+#      @echo "Running Make libs in $(subst /make.libs,,$@)"\r
+#      $(MAKE) -C $(subst /make.libs,,$@) -s libs  "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v9.4 -mhard-float -mlittle-endian #-mno-xl-soft-div -mno-xl-soft-mul -mxl-barrel-shift -mxl-float-convert -mxl-float-sqrt -mxl-multiply-high -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections #-fdata-sections"\r
+#\r
+#clean:\r
+#      rm -f ${PROCESSOR}/lib/libxil.a\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_ps7_cortexa9 b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Makefile_ps7_cortexa9
new file mode 100644 (file)
index 0000000..60c63f4
--- /dev/null
@@ -0,0 +1,133 @@
+#
+# Copyright (C) 2012-2013 Xilinx, Inc.
+#
+# This file is part of the port for FreeRTOS made by Xilinx to allow FreeRTOS
+# to operate with Xilinx Zynq devices.
+#
+# This file 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
+# (see text further below).
+#
+# This file 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; if not it
+# can be viewed here: <http://www.gnu.org/licenses/>
+#
+# The following exception language was found at
+# http://www.freertos.org/a00114.html on May 8, 2012.
+#
+# GNU General Public License Exception
+#
+# Any FreeRTOS source code, whether modified or in its original release form,
+# or whether in whole or in part, can only be distributed by you under the
+# terms of the GNU General Public License plus this exception. An independent
+# module is a module which is not derived from or based on FreeRTOS.
+#
+# EXCEPTION TEXT:
+#
+# Clause 1
+#
+# Linking FreeRTOS statically or dynamically with other modules is making a
+# combined work based on FreeRTOS. Thus, the terms and conditions of the
+# GNU General Public License cover the whole combination.
+#
+# As a special exception, the copyright holder of FreeRTOS gives you permission
+# to link FreeRTOS with independent modules that communicate with FreeRTOS
+# solely through the FreeRTOS API interface, regardless of the license terms
+# of these independent modules, and to copy and distribute the resulting
+# combined work under terms of your choice, provided that
+#
+# Every copy of the combined work is accompanied by a written statement that
+# details to the recipient the version of FreeRTOS used and an offer by
+# yourself to provide the FreeRTOS source code (including any modifications
+# you may have  made) should the recipient request it.
+# The combined work is not itself an RTOS, scheduler, kernel or related product.
+# The independent modules add significant and primary functionality to FreeRTOS
+# and do not merely extend the existing functionality already present
+# in FreeRTOS.
+#
+# Clause 2
+#
+# FreeRTOS may not be used for any competitive or comparative purpose,
+# including the publication of any form of run time or compile time metric,
+# without the express permission of Real Time Engineers Ltd. (this is the norm
+# within the industry and is intended to ensure information accuracy).
+#
+
+#
+# Processor architecture
+# ps7_cortexa9
+#
+ARCH = ps7_cortexa9
+
+SYSTEMDIR = ../../..
+
+TOPDIR = .
+
+ARCH_PREFIX = arm-none-eabi
+
+#
+# gnu tools for Makefile
+#
+CC = $(ARCH_PREFIX)-gcc
+AS = arm-none-eabi-as
+AR = $(ARCH_PREFIX)-ar
+CP = cp
+
+#
+# Compiler, linker and other options.
+#
+CFLAGS = ${COMPILER_FLAGS} ${EXTRA_COMPILER_FLAGS}
+
+#
+# System project directories.
+#
+LIBDIR = $(SYSTEMDIR)/lib
+INCLUDEDIR = $(SYSTEMDIR)/include
+
+# Kernel library.
+LIBFREERTOS = ${LIBDIR}/libfreertos.a
+LIBXIL = ${LIBDIR}/libxil.a
+
+INCLUDEFILES = ${TOPDIR}/*.h
+
+INCLUDES = -I$(INCLUDEDIR) \
+       -I${TOPDIR}
+
+KERNEL_AR_OBJS = *.c *.S *.s
+
+OUTS = *.o
+
+
+
+libs:  $(KERNEL_AR_OBJS)
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src libs
+       @echo "Compiling FreeRTOS"
+       @$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $^
+       @$(ARCHIVER) -r ${LIBFREERTOS} ${OUTS}
+       @$(ARCHIVER) -d ${LIBXIL} asm_vectors.o
+       @$(ARCHIVER) -s ${LIBXIL}
+
+       make clean
+
+
+
+
+include_standalone:
+       @echo "includes"
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src include
+       $(CP) -rf $(INCLUDEFILES) $(INCLUDEDIR)
+
+
+.PHONY: include
+include:
+       @echo "include"
+       $(MAKE) -f Makefile_depends -e "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" -C ../../standalone_v5_0/src include
+       ${CP} ${INCLUDEFILES} ${INCLUDEDIR}
+
+clean:
+       rm -rf ${OUTS}
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/FreeRTOS.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/FreeRTOS.h
new file mode 100644 (file)
index 0000000..9b8bae2
--- /dev/null
@@ -0,0 +1,799 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef INC_FREERTOS_H\r
+#define INC_FREERTOS_H\r
+\r
+/*\r
+ * Include the generic headers required for the FreeRTOS port being used.\r
+ */\r
+#include <stddef.h>\r
+\r
+/*\r
+ * If stdint.h cannot be located then:\r
+ *   + If using GCC ensure the -nostdint options is *not* being used.\r
+ *   + Ensure the project's include path includes the directory in which your\r
+ *     compiler stores stdint.h.\r
+ *   + Set any compiler options necessary for it to support C99, as technically\r
+ *     stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any\r
+ *     other way).\r
+ *   + The FreeRTOS download includes a simple stdint.h definition that can be\r
+ *     used in cases where none is provided by the compiler.  The files only\r
+ *     contains the typedefs required to build FreeRTOS.  Read the instructions\r
+ *     in FreeRTOS/source/stdint.readme for more information.\r
+ */\r
+#include <stdint.h> /* READ COMMENT ABOVE. */\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Application specific configuration options. */\r
+#include "FreeRTOSConfig.h"\r
+\r
+/* Basic FreeRTOS definitions. */\r
+#include "projdefs.h"\r
+\r
+/* Definitions specific to the port being used. */\r
+#include "portable.h"\r
+\r
+/*\r
+ * Check all the required application specific macros have been defined.\r
+ * These macros are application specific and (as downloaded) are defined\r
+ * within FreeRTOSConfig.h.\r
+ */\r
+\r
+#ifndef configMINIMAL_STACK_SIZE\r
+       #error Missing definition:  configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h.  configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task.  Refer to the demo project provided for your port for a suitable value.\r
+#endif\r
+\r
+#ifndef configMAX_PRIORITIES\r
+       #error Missing definition:  configMAX_PRIORITIES must be defined in FreeRTOSConfig.h.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef configUSE_PREEMPTION\r
+       #error Missing definition:  configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef configUSE_IDLE_HOOK\r
+       #error Missing definition:  configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef configUSE_TICK_HOOK\r
+       #error Missing definition:  configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_vTaskPrioritySet\r
+       #error Missing definition:  INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_uxTaskPriorityGet\r
+       #error Missing definition:  INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_vTaskDelete\r
+       #error Missing definition:  INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_vTaskSuspend\r
+       #error Missing definition:  INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_vTaskDelayUntil\r
+       #error Missing definition:  INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef INCLUDE_vTaskDelay\r
+       #error Missing definition:  INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef configUSE_16_BIT_TICKS\r
+       #error Missing definition:  configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#ifndef configMAX_PRIORITIES\r
+       #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.\r
+#endif\r
+\r
+#ifndef configUSE_CO_ROUTINES\r
+       #define configUSE_CO_ROUTINES 0\r
+#endif\r
+\r
+#if configUSE_CO_ROUTINES != 0\r
+       #ifndef configMAX_CO_ROUTINE_PRIORITIES\r
+               #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.\r
+       #endif\r
+#endif\r
+\r
+#ifndef INCLUDE_xTaskGetIdleTaskHandle\r
+       #define INCLUDE_xTaskGetIdleTaskHandle 0\r
+#endif\r
+\r
+#ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle\r
+       #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0\r
+#endif\r
+\r
+#ifndef INCLUDE_xQueueGetMutexHolder\r
+       #define INCLUDE_xQueueGetMutexHolder 0\r
+#endif\r
+\r
+#ifndef INCLUDE_xSemaphoreGetMutexHolder\r
+       #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder\r
+#endif\r
+\r
+#ifndef INCLUDE_pcTaskGetTaskName\r
+       #define INCLUDE_pcTaskGetTaskName 0\r
+#endif\r
+\r
+#ifndef configUSE_APPLICATION_TASK_TAG\r
+       #define configUSE_APPLICATION_TASK_TAG 0\r
+#endif\r
+\r
+#ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS\r
+       #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0\r
+#endif\r
+\r
+#ifndef INCLUDE_uxTaskGetStackHighWaterMark\r
+       #define INCLUDE_uxTaskGetStackHighWaterMark 0\r
+#endif\r
+\r
+#ifndef INCLUDE_eTaskGetState\r
+       #define INCLUDE_eTaskGetState 0\r
+#endif\r
+\r
+#ifndef configUSE_RECURSIVE_MUTEXES\r
+       #define configUSE_RECURSIVE_MUTEXES 0\r
+#endif\r
+\r
+#ifndef configUSE_MUTEXES\r
+       #define configUSE_MUTEXES 0\r
+#endif\r
+\r
+#ifndef configUSE_TIMERS\r
+       #define configUSE_TIMERS 0\r
+#endif\r
+\r
+#ifndef configUSE_COUNTING_SEMAPHORES\r
+       #define configUSE_COUNTING_SEMAPHORES 0\r
+#endif\r
+\r
+#ifndef configUSE_ALTERNATIVE_API\r
+       #define configUSE_ALTERNATIVE_API 0\r
+#endif\r
+\r
+#ifndef portCRITICAL_NESTING_IN_TCB\r
+       #define portCRITICAL_NESTING_IN_TCB 0\r
+#endif\r
+\r
+#ifndef configMAX_TASK_NAME_LEN\r
+       #define configMAX_TASK_NAME_LEN 16\r
+#endif\r
+\r
+#ifndef configIDLE_SHOULD_YIELD\r
+       #define configIDLE_SHOULD_YIELD         1\r
+#endif\r
+\r
+#if configMAX_TASK_NAME_LEN < 1\r
+       #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h\r
+#endif\r
+\r
+#ifndef INCLUDE_xTaskResumeFromISR\r
+       #define INCLUDE_xTaskResumeFromISR 1\r
+#endif\r
+\r
+#ifndef INCLUDE_xEventGroupSetBitFromISR\r
+       #define INCLUDE_xEventGroupSetBitFromISR 0\r
+#endif\r
+\r
+#ifndef INCLUDE_xTimerPendFunctionCall\r
+       #define INCLUDE_xTimerPendFunctionCall 0\r
+#endif\r
+\r
+#ifndef configASSERT\r
+       #define configASSERT( x )\r
+       #define configASSERT_DEFINED 0\r
+#else\r
+       #define configASSERT_DEFINED 1\r
+#endif\r
+\r
+/* The timers module relies on xTaskGetSchedulerState(). */\r
+#if configUSE_TIMERS == 1\r
+\r
+       #ifndef configTIMER_TASK_PRIORITY\r
+               #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.\r
+       #endif /* configTIMER_TASK_PRIORITY */\r
+\r
+       #ifndef configTIMER_QUEUE_LENGTH\r
+               #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.\r
+       #endif /* configTIMER_QUEUE_LENGTH */\r
+\r
+       #ifndef configTIMER_TASK_STACK_DEPTH\r
+               #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.\r
+       #endif /* configTIMER_TASK_STACK_DEPTH */\r
+\r
+#endif /* configUSE_TIMERS */\r
+\r
+#ifndef INCLUDE_xTaskGetSchedulerState\r
+       #define INCLUDE_xTaskGetSchedulerState 0\r
+#endif\r
+\r
+#ifndef INCLUDE_xTaskGetCurrentTaskHandle\r
+       #define INCLUDE_xTaskGetCurrentTaskHandle 0\r
+#endif\r
+\r
+\r
+#ifndef portSET_INTERRUPT_MASK_FROM_ISR\r
+       #define portSET_INTERRUPT_MASK_FROM_ISR() 0\r
+#endif\r
+\r
+#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR\r
+       #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue\r
+#endif\r
+\r
+#ifndef portCLEAN_UP_TCB\r
+       #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB\r
+#endif\r
+\r
+#ifndef portPRE_TASK_DELETE_HOOK\r
+       #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )\r
+#endif\r
+\r
+#ifndef portSETUP_TCB\r
+       #define portSETUP_TCB( pxTCB ) ( void ) pxTCB\r
+#endif\r
+\r
+#ifndef configQUEUE_REGISTRY_SIZE\r
+       #define configQUEUE_REGISTRY_SIZE 0U\r
+#endif\r
+\r
+#if ( configQUEUE_REGISTRY_SIZE < 1 )\r
+       #define vQueueAddToRegistry( xQueue, pcName )\r
+       #define vQueueUnregisterQueue( xQueue )\r
+#endif\r
+\r
+#ifndef portPOINTER_SIZE_TYPE\r
+       #define portPOINTER_SIZE_TYPE uint32_t\r
+#endif\r
+\r
+/* Remove any unused trace macros. */\r
+#ifndef traceSTART\r
+       /* Used to perform any necessary initialisation - for example, open a file\r
+       into which trace is to be written. */\r
+       #define traceSTART()\r
+#endif\r
+\r
+#ifndef traceEND\r
+       /* Use to close a trace, for example close a file into which trace has been\r
+       written. */\r
+       #define traceEND()\r
+#endif\r
+\r
+#ifndef traceTASK_SWITCHED_IN\r
+       /* Called after a task has been selected to run.  pxCurrentTCB holds a pointer\r
+       to the task control block of the selected task. */\r
+       #define traceTASK_SWITCHED_IN()\r
+#endif\r
+\r
+#ifndef traceINCREASE_TICK_COUNT\r
+       /* Called before stepping the tick count after waking from tickless idle\r
+       sleep. */\r
+       #define traceINCREASE_TICK_COUNT( x )\r
+#endif\r
+\r
+#ifndef traceLOW_POWER_IDLE_BEGIN\r
+       /* Called immediately before entering tickless idle. */\r
+       #define traceLOW_POWER_IDLE_BEGIN()\r
+#endif\r
+\r
+#ifndef        traceLOW_POWER_IDLE_END\r
+       /* Called when returning to the Idle task after a tickless idle. */\r
+       #define traceLOW_POWER_IDLE_END()\r
+#endif\r
+\r
+#ifndef traceTASK_SWITCHED_OUT\r
+       /* Called before a task has been selected to run.  pxCurrentTCB holds a pointer\r
+       to the task control block of the task being switched out. */\r
+       #define traceTASK_SWITCHED_OUT()\r
+#endif\r
+\r
+#ifndef traceTASK_PRIORITY_INHERIT\r
+       /* Called when a task attempts to take a mutex that is already held by a\r
+       lower priority task.  pxTCBOfMutexHolder is a pointer to the TCB of the task\r
+       that holds the mutex.  uxInheritedPriority is the priority the mutex holder\r
+       will inherit (the priority of the task that is attempting to obtain the\r
+       muted. */\r
+       #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )\r
+#endif\r
+\r
+#ifndef traceTASK_PRIORITY_DISINHERIT\r
+       /* Called when a task releases a mutex, the holding of which had resulted in\r
+       the task inheriting the priority of a higher priority task.\r
+       pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the\r
+       mutex.  uxOriginalPriority is the task's configured (base) priority. */\r
+       #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )\r
+#endif\r
+\r
+#ifndef traceBLOCKING_ON_QUEUE_RECEIVE\r
+       /* Task is about to block because it cannot read from a\r
+       queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
+       upon which the read was attempted.  pxCurrentTCB points to the TCB of the\r
+       task that attempted the read. */\r
+       #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )\r
+#endif\r
+\r
+#ifndef traceBLOCKING_ON_QUEUE_SEND\r
+       /* Task is about to block because it cannot write to a\r
+       queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
+       upon which the write was attempted.  pxCurrentTCB points to the TCB of the\r
+       task that attempted the write. */\r
+       #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )\r
+#endif\r
+\r
+#ifndef configCHECK_FOR_STACK_OVERFLOW\r
+       #define configCHECK_FOR_STACK_OVERFLOW 0\r
+#endif\r
+\r
+/* The following event macros are embedded in the kernel API calls. */\r
+\r
+#ifndef traceMOVED_TASK_TO_READY_STATE\r
+       #define traceMOVED_TASK_TO_READY_STATE( pxTCB )\r
+#endif\r
+\r
+#ifndef traceQUEUE_CREATE\r
+       #define traceQUEUE_CREATE( pxNewQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_CREATE_FAILED\r
+       #define traceQUEUE_CREATE_FAILED( ucQueueType )\r
+#endif\r
+\r
+#ifndef traceCREATE_MUTEX\r
+       #define traceCREATE_MUTEX( pxNewQueue )\r
+#endif\r
+\r
+#ifndef traceCREATE_MUTEX_FAILED\r
+       #define traceCREATE_MUTEX_FAILED()\r
+#endif\r
+\r
+#ifndef traceGIVE_MUTEX_RECURSIVE\r
+       #define traceGIVE_MUTEX_RECURSIVE( pxMutex )\r
+#endif\r
+\r
+#ifndef traceGIVE_MUTEX_RECURSIVE_FAILED\r
+       #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )\r
+#endif\r
+\r
+#ifndef traceTAKE_MUTEX_RECURSIVE\r
+       #define traceTAKE_MUTEX_RECURSIVE( pxMutex )\r
+#endif\r
+\r
+#ifndef traceTAKE_MUTEX_RECURSIVE_FAILED\r
+       #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )\r
+#endif\r
+\r
+#ifndef traceCREATE_COUNTING_SEMAPHORE\r
+       #define traceCREATE_COUNTING_SEMAPHORE()\r
+#endif\r
+\r
+#ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED\r
+       #define traceCREATE_COUNTING_SEMAPHORE_FAILED()\r
+#endif\r
+\r
+#ifndef traceQUEUE_SEND\r
+       #define traceQUEUE_SEND( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_SEND_FAILED\r
+       #define traceQUEUE_SEND_FAILED( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_RECEIVE\r
+       #define traceQUEUE_RECEIVE( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_PEEK\r
+       #define traceQUEUE_PEEK( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_PEEK_FROM_ISR\r
+       #define traceQUEUE_PEEK_FROM_ISR( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_RECEIVE_FAILED\r
+       #define traceQUEUE_RECEIVE_FAILED( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_SEND_FROM_ISR\r
+       #define traceQUEUE_SEND_FROM_ISR( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_SEND_FROM_ISR_FAILED\r
+       #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_RECEIVE_FROM_ISR\r
+       #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
+       #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_PEEK_FROM_ISR_FAILED\r
+       #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )\r
+#endif\r
+\r
+#ifndef traceQUEUE_DELETE\r
+       #define traceQUEUE_DELETE( pxQueue )\r
+#endif\r
+\r
+#ifndef traceTASK_CREATE\r
+       #define traceTASK_CREATE( pxNewTCB )\r
+#endif\r
+\r
+#ifndef traceTASK_CREATE_FAILED\r
+       #define traceTASK_CREATE_FAILED()\r
+#endif\r
+\r
+#ifndef traceTASK_DELETE\r
+       #define traceTASK_DELETE( pxTaskToDelete )\r
+#endif\r
+\r
+#ifndef traceTASK_DELAY_UNTIL\r
+       #define traceTASK_DELAY_UNTIL()\r
+#endif\r
+\r
+#ifndef traceTASK_DELAY\r
+       #define traceTASK_DELAY()\r
+#endif\r
+\r
+#ifndef traceTASK_PRIORITY_SET\r
+       #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )\r
+#endif\r
+\r
+#ifndef traceTASK_SUSPEND\r
+       #define traceTASK_SUSPEND( pxTaskToSuspend )\r
+#endif\r
+\r
+#ifndef traceTASK_RESUME\r
+       #define traceTASK_RESUME( pxTaskToResume )\r
+#endif\r
+\r
+#ifndef traceTASK_RESUME_FROM_ISR\r
+       #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )\r
+#endif\r
+\r
+#ifndef traceTASK_INCREMENT_TICK\r
+       #define traceTASK_INCREMENT_TICK( xTickCount )\r
+#endif\r
+\r
+#ifndef traceTIMER_CREATE\r
+       #define traceTIMER_CREATE( pxNewTimer )\r
+#endif\r
+\r
+#ifndef traceTIMER_CREATE_FAILED\r
+       #define traceTIMER_CREATE_FAILED()\r
+#endif\r
+\r
+#ifndef traceTIMER_COMMAND_SEND\r
+       #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )\r
+#endif\r
+\r
+#ifndef traceTIMER_EXPIRED\r
+       #define traceTIMER_EXPIRED( pxTimer )\r
+#endif\r
+\r
+#ifndef traceTIMER_COMMAND_RECEIVED\r
+       #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )\r
+#endif\r
+\r
+#ifndef traceMALLOC\r
+    #define traceMALLOC( pvAddress, uiSize )\r
+#endif\r
+\r
+#ifndef traceFREE\r
+    #define traceFREE( pvAddress, uiSize )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_CREATE\r
+       #define traceEVENT_GROUP_CREATE( xEventGroup )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_CREATE_FAILED\r
+       #define traceEVENT_GROUP_CREATE_FAILED()\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_SYNC_BLOCK\r
+       #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_SYNC_END\r
+       #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK\r
+       #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_WAIT_BITS_END\r
+       #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_CLEAR_BITS\r
+       #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR\r
+       #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_SET_BITS\r
+       #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR\r
+       #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )\r
+#endif\r
+\r
+#ifndef traceEVENT_GROUP_DELETE\r
+       #define traceEVENT_GROUP_DELETE( xEventGroup )\r
+#endif\r
+\r
+#ifndef tracePEND_FUNC_CALL\r
+       #define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)\r
+#endif\r
+\r
+#ifndef tracePEND_FUNC_CALL_FROM_ISR\r
+       #define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)\r
+#endif\r
+\r
+#ifndef traceQUEUE_REGISTRY_ADD\r
+       #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)\r
+#endif\r
+\r
+#ifndef configGENERATE_RUN_TIME_STATS\r
+       #define configGENERATE_RUN_TIME_STATS 0\r
+#endif\r
+\r
+#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
+\r
+       #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS\r
+               #error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined.  portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.\r
+       #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */\r
+\r
+       #ifndef portGET_RUN_TIME_COUNTER_VALUE\r
+               #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE\r
+                       #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined.  See the examples provided and the FreeRTOS web site for more information.\r
+               #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */\r
+       #endif /* portGET_RUN_TIME_COUNTER_VALUE */\r
+\r
+#endif /* configGENERATE_RUN_TIME_STATS */\r
+\r
+#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS\r
+       #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()\r
+#endif\r
+\r
+#ifndef configUSE_MALLOC_FAILED_HOOK\r
+       #define configUSE_MALLOC_FAILED_HOOK 0\r
+#endif\r
+\r
+#ifndef portPRIVILEGE_BIT\r
+       #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )\r
+#endif\r
+\r
+#ifndef portYIELD_WITHIN_API\r
+       #define portYIELD_WITHIN_API portYIELD\r
+#endif\r
+\r
+#ifndef pvPortMallocAligned\r
+       #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )\r
+#endif\r
+\r
+#ifndef vPortFreeAligned\r
+       #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )\r
+#endif\r
+\r
+#ifndef portSUPPRESS_TICKS_AND_SLEEP\r
+       #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )\r
+#endif\r
+\r
+#ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP\r
+       #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2\r
+#endif\r
+\r
+#if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2\r
+       #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2\r
+#endif\r
+\r
+#ifndef configUSE_TICKLESS_IDLE\r
+       #define configUSE_TICKLESS_IDLE 0\r
+#endif\r
+\r
+#ifndef configPRE_SLEEP_PROCESSING\r
+       #define configPRE_SLEEP_PROCESSING( x )\r
+#endif\r
+\r
+#ifndef configPOST_SLEEP_PROCESSING\r
+       #define configPOST_SLEEP_PROCESSING( x )\r
+#endif\r
+\r
+#ifndef configUSE_QUEUE_SETS\r
+       #define configUSE_QUEUE_SETS 0\r
+#endif\r
+\r
+#ifndef portTASK_USES_FLOATING_POINT\r
+       #define portTASK_USES_FLOATING_POINT()\r
+#endif\r
+\r
+#ifndef configUSE_TIME_SLICING\r
+       #define configUSE_TIME_SLICING 1\r
+#endif\r
+\r
+#ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS\r
+       #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0\r
+#endif\r
+\r
+#ifndef configUSE_NEWLIB_REENTRANT\r
+       #define configUSE_NEWLIB_REENTRANT 0\r
+#endif\r
+\r
+#ifndef configUSE_STATS_FORMATTING_FUNCTIONS\r
+       #define configUSE_STATS_FORMATTING_FUNCTIONS 0\r
+#endif\r
+\r
+#ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID\r
+       #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()\r
+#endif\r
+\r
+#ifndef configUSE_TRACE_FACILITY\r
+       #define configUSE_TRACE_FACILITY 0\r
+#endif\r
+\r
+#ifndef mtCOVERAGE_TEST_MARKER\r
+       #define mtCOVERAGE_TEST_MARKER()\r
+#endif\r
+\r
+#ifndef mtCOVERAGE_TEST_DELAY\r
+       #define mtCOVERAGE_TEST_DELAY()\r
+#endif\r
+\r
+#ifndef portASSERT_IF_IN_ISR\r
+       #define portASSERT_IF_IN_ISR()\r
+#endif\r
+\r
+#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION\r
+       #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0\r
+#endif\r
+\r
+#ifndef configAPPLICATION_ALLOCATED_HEAP\r
+       #define configAPPLICATION_ALLOCATED_HEAP 0\r
+#endif\r
+\r
+#ifndef configUSE_TASK_NOTIFICATIONS\r
+       #define configUSE_TASK_NOTIFICATIONS 1\r
+#endif\r
+\r
+#ifndef portTICK_TYPE_IS_ATOMIC\r
+       #define portTICK_TYPE_IS_ATOMIC 0\r
+#endif\r
+\r
+#if( portTICK_TYPE_IS_ATOMIC == 0 )\r
+       /* Either variables of tick type cannot be read atomically, or\r
+       portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when\r
+       the tick count is returned to the standard critical section macros. */\r
+       #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()\r
+       #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()\r
+       #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()\r
+       #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )\r
+#else\r
+       /* The tick type can be read atomically, so critical sections used when the\r
+       tick count is returned can be defined away. */\r
+       #define portTICK_TYPE_ENTER_CRITICAL()\r
+       #define portTICK_TYPE_EXIT_CRITICAL()\r
+       #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0\r
+       #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x\r
+#endif\r
+\r
+/* Definitions to allow backward compatibility with FreeRTOS versions prior to\r
+V8 if desired. */\r
+#ifndef configENABLE_BACKWARD_COMPATIBILITY\r
+       #define configENABLE_BACKWARD_COMPATIBILITY 1\r
+#endif\r
+\r
+#if configENABLE_BACKWARD_COMPATIBILITY == 1\r
+       #define eTaskStateGet eTaskGetState\r
+       #define portTickType TickType_t\r
+       #define xTaskHandle TaskHandle_t\r
+       #define xQueueHandle QueueHandle_t\r
+       #define xSemaphoreHandle SemaphoreHandle_t\r
+       #define xQueueSetHandle QueueSetHandle_t\r
+       #define xQueueSetMemberHandle QueueSetMemberHandle_t\r
+       #define xTimeOutType TimeOut_t\r
+       #define xMemoryRegion MemoryRegion_t\r
+       #define xTaskParameters TaskParameters_t\r
+       #define xTaskStatusType TaskStatus_t\r
+       #define xTimerHandle TimerHandle_t\r
+       #define xCoRoutineHandle CoRoutineHandle_t\r
+       #define pdTASK_HOOK_CODE TaskHookFunction_t\r
+       #define portTICK_RATE_MS portTICK_PERIOD_MS\r
+\r
+       /* Backward compatibility within the scheduler code only - these definitions\r
+       are not really required but are included for completeness. */\r
+       #define tmrTIMER_CALLBACK TimerCallbackFunction_t\r
+       #define pdTASK_CODE TaskFunction_t\r
+       #define xListItem ListItem_t\r
+       #define xList List_t\r
+#endif /* configENABLE_BACKWARD_COMPATIBILITY */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* INC_FREERTOS_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/StackMacros.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/StackMacros.h
new file mode 100644 (file)
index 0000000..18c6a7f
--- /dev/null
@@ -0,0 +1,184 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef STACK_MACROS_H\r
+#define STACK_MACROS_H\r
+\r
+/*\r
+ * Call the stack overflow hook function if the stack of the task being swapped\r
+ * out is currently overflowed, or looks like it might have overflowed in the\r
+ * past.\r
+ *\r
+ * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check\r
+ * the current stack state only - comparing the current top of stack value to\r
+ * the stack limit.  Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1\r
+ * will also cause the last few stack bytes to be checked to ensure the value\r
+ * to which the bytes were set when the task was created have not been\r
+ * overwritten.  Note this second test does not guarantee that an overflowed\r
+ * stack will always be recognised.\r
+ */\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configCHECK_FOR_STACK_OVERFLOW == 0 )\r
+\r
+       /* FreeRTOSConfig.h is not set to check for stack overflows. */\r
+       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()\r
+       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()\r
+\r
+#endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configCHECK_FOR_STACK_OVERFLOW == 1 )\r
+\r
+       /* FreeRTOSConfig.h is only set to use the first method of\r
+       overflow checking. */\r
+       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()\r
+\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )\r
+\r
+       /* Only the current stack state is to be checked. */\r
+       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
+       {                                                                                                                                                                                                       \\r
+               /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
+               if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                                                               \\r
+               {                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );       \\r
+               }                                                                                                                                                                                               \\r
+       }\r
+\r
+#endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )\r
+\r
+       /* Only the current stack state is to be checked. */\r
+       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
+       {                                                                                                                                                                                                       \\r
+                                                                                                                                                                                                               \\r
+               /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
+               if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack )                                                                  \\r
+               {                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );       \\r
+               }                                                                                                                                                                                               \\r
+       }\r
+\r
+#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )\r
+\r
+       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                           \\r
+       {                                                                                                                                                                                                                                                                       \\r
+       static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };       \\r
+                                                                                                                                                                                                                                                                               \\r
+                                                                                                                                                                                                                                                                               \\r
+               /* Has the extremity of the task stack ever been written over? */                                                                                                                               \\r
+               if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                  \\r
+               {                                                                                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                       \\r
+               }                                                                                                                                                                                                                                                               \\r
+       }\r
+\r
+#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )\r
+\r
+       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                           \\r
+       {                                                                                                                                                                                                                                                                       \\r
+       int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack;                                                                                                                                         \\r
+       static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };       \\r
+                                                                                                                                                                                                                                                                               \\r
+                                                                                                                                                                                                                                                                               \\r
+               pcEndOfStack -= sizeof( ucExpectedStackBytes );                                                                                                                                                                 \\r
+                                                                                                                                                                                                                                                                               \\r
+               /* Has the extremity of the task stack ever been written over? */                                                                                                                               \\r
+               if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                                   \\r
+               {                                                                                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                       \\r
+               }                                                                                                                                                                                                                                                               \\r
+       }\r
+\r
+#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
+/*-----------------------------------------------------------*/\r
+\r
+#endif /* STACK_MACROS_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/croutine.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/croutine.h
new file mode 100644 (file)
index 0000000..b833067
--- /dev/null
@@ -0,0 +1,762 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef CO_ROUTINE_H\r
+#define CO_ROUTINE_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h must appear in source files before include croutine.h"\r
+#endif\r
+\r
+#include "list.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Used to hide the implementation of the co-routine control block.  The\r
+control block structure however has to be included in the header due to\r
+the macro implementation of the co-routine functionality. */\r
+typedef void * CoRoutineHandle_t;\r
+\r
+/* Defines the prototype to which co-routine functions must conform. */\r
+typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t );\r
+\r
+typedef struct corCoRoutineControlBlock\r
+{\r
+       crCOROUTINE_CODE        pxCoRoutineFunction;\r
+       ListItem_t                      xGenericListItem;       /*< List item used to place the CRCB in ready and blocked queues. */\r
+       ListItem_t                      xEventListItem;         /*< List item used to place the CRCB in event lists. */\r
+       UBaseType_t             uxPriority;                     /*< The priority of the co-routine in relation to other co-routines. */\r
+       UBaseType_t             uxIndex;                        /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */\r
+       uint16_t                        uxState;                        /*< Used internally by the co-routine implementation. */\r
+} CRCB_t; /* Co-routine control block.  Note must be identical in size down to uxPriority with TCB_t. */\r
+\r
+/**\r
+ * croutine. h\r
+ *<pre>\r
+ BaseType_t xCoRoutineCreate(\r
+                                 crCOROUTINE_CODE pxCoRoutineCode,\r
+                                 UBaseType_t uxPriority,\r
+                                 UBaseType_t uxIndex\r
+                               );</pre>\r
+ *\r
+ * Create a new co-routine and add it to the list of co-routines that are\r
+ * ready to run.\r
+ *\r
+ * @param pxCoRoutineCode Pointer to the co-routine function.  Co-routine\r
+ * functions require special syntax - see the co-routine section of the WEB\r
+ * documentation for more information.\r
+ *\r
+ * @param uxPriority The priority with respect to other co-routines at which\r
+ *  the co-routine will run.\r
+ *\r
+ * @param uxIndex Used to distinguish between different co-routines that\r
+ * execute the same function.  See the example below and the co-routine section\r
+ * of the WEB documentation for further information.\r
+ *\r
+ * @return pdPASS if the co-routine was successfully created and added to a ready\r
+ * list, otherwise an error code defined with ProjDefs.h.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Co-routine to be created.\r
+ void vFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ // This may not be necessary for const variables.\r
+ static const char cLedToFlash[ 2 ] = { 5, 6 };\r
+ static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };\r
+\r
+     // Must start every co-routine with a call to crSTART();\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+         // This co-routine just delays for a fixed period, then toggles\r
+         // an LED.  Two co-routines are created using this function, so\r
+         // the uxIndex parameter is used to tell the co-routine which\r
+         // LED to flash and how int32_t to delay.  This assumes xQueue has\r
+         // already been created.\r
+         vParTestToggleLED( cLedToFlash[ uxIndex ] );\r
+         crDELAY( xHandle, uxFlashRates[ uxIndex ] );\r
+     }\r
+\r
+     // Must end every co-routine with a call to crEND();\r
+     crEND();\r
+ }\r
+\r
+ // Function that creates two co-routines.\r
+ void vOtherFunction( void )\r
+ {\r
+ uint8_t ucParameterToPass;\r
+ TaskHandle_t xHandle;\r
+\r
+     // Create two co-routines at priority 0.  The first is given index 0\r
+     // so (from the code above) toggles LED 5 every 200 ticks.  The second\r
+     // is given index 1 so toggles LED 6 every 400 ticks.\r
+     for( uxIndex = 0; uxIndex < 2; uxIndex++ )\r
+     {\r
+         xCoRoutineCreate( vFlashCoRoutine, 0, uxIndex );\r
+     }\r
+ }\r
+   </pre>\r
+ * \defgroup xCoRoutineCreate xCoRoutineCreate\r
+ * \ingroup Tasks\r
+ */\r
+BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );\r
+\r
+\r
+/**\r
+ * croutine. h\r
+ *<pre>\r
+ void vCoRoutineSchedule( void );</pre>\r
+ *\r
+ * Run a co-routine.\r
+ *\r
+ * vCoRoutineSchedule() executes the highest priority co-routine that is able\r
+ * to run.  The co-routine will execute until it either blocks, yields or is\r
+ * preempted by a task.  Co-routines execute cooperatively so one\r
+ * co-routine cannot be preempted by another, but can be preempted by a task.\r
+ *\r
+ * If an application comprises of both tasks and co-routines then\r
+ * vCoRoutineSchedule should be called from the idle task (in an idle task\r
+ * hook).\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // This idle task hook will schedule a co-routine each time it is called.\r
+ // The rest of the idle task will execute between co-routine calls.\r
+ void vApplicationIdleHook( void )\r
+ {\r
+       vCoRoutineSchedule();\r
+ }\r
+\r
+ // Alternatively, if you do not require any other part of the idle task to\r
+ // execute, the idle task hook can call vCoRoutineScheduler() within an\r
+ // infinite loop.\r
+ void vApplicationIdleHook( void )\r
+ {\r
+    for( ;; )\r
+    {\r
+        vCoRoutineSchedule();\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup vCoRoutineSchedule vCoRoutineSchedule\r
+ * \ingroup Tasks\r
+ */\r
+void vCoRoutineSchedule( void );\r
+\r
+/**\r
+ * croutine. h\r
+ * <pre>\r
+ crSTART( CoRoutineHandle_t xHandle );</pre>\r
+ *\r
+ * This macro MUST always be called at the start of a co-routine function.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Co-routine to be created.\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ static int32_t ulAVariable;\r
+\r
+     // Must start every co-routine with a call to crSTART();\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+          // Co-routine functionality goes here.\r
+     }\r
+\r
+     // Must end every co-routine with a call to crEND();\r
+     crEND();\r
+ }</pre>\r
+ * \defgroup crSTART crSTART\r
+ * \ingroup Tasks\r
+ */\r
+#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:\r
+\r
+/**\r
+ * croutine. h\r
+ * <pre>\r
+ crEND();</pre>\r
+ *\r
+ * This macro MUST always be called at the end of a co-routine function.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Co-routine to be created.\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ static int32_t ulAVariable;\r
+\r
+     // Must start every co-routine with a call to crSTART();\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+          // Co-routine functionality goes here.\r
+     }\r
+\r
+     // Must end every co-routine with a call to crEND();\r
+     crEND();\r
+ }</pre>\r
+ * \defgroup crSTART crSTART\r
+ * \ingroup Tasks\r
+ */\r
+#define crEND() }\r
+\r
+/*\r
+ * These macros are intended for internal use by the co-routine implementation\r
+ * only.  The macros should not be used directly by application writers.\r
+ */\r
+#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
+#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
+\r
+/**\r
+ * croutine. h\r
+ *<pre>\r
+ crDELAY( CoRoutineHandle_t xHandle, TickType_t xTicksToDelay );</pre>\r
+ *\r
+ * Delay a co-routine for a fixed period of time.\r
+ *\r
+ * crDELAY can only be called from the co-routine function itself - not\r
+ * from within a function called by the co-routine function.  This is because\r
+ * co-routines do not maintain their own stack.\r
+ *\r
+ * @param xHandle The handle of the co-routine to delay.  This is the xHandle\r
+ * parameter of the co-routine function.\r
+ *\r
+ * @param xTickToDelay The number of ticks that the co-routine should delay\r
+ * for.  The actual amount of time this equates to is defined by\r
+ * configTICK_RATE_HZ (set in FreeRTOSConfig.h).  The constant portTICK_PERIOD_MS\r
+ * can be used to convert ticks to milliseconds.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Co-routine to be created.\r
+ void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ // This may not be necessary for const variables.\r
+ // We are to delay for 200ms.\r
+ static const xTickType xDelayTime = 200 / portTICK_PERIOD_MS;\r
+\r
+     // Must start every co-routine with a call to crSTART();\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+        // Delay for 200ms.\r
+        crDELAY( xHandle, xDelayTime );\r
+\r
+        // Do something here.\r
+     }\r
+\r
+     // Must end every co-routine with a call to crEND();\r
+     crEND();\r
+ }</pre>\r
+ * \defgroup crDELAY crDELAY\r
+ * \ingroup Tasks\r
+ */\r
+#define crDELAY( xHandle, xTicksToDelay )                                                                                              \\r
+       if( ( xTicksToDelay ) > 0 )                                                                                                                     \\r
+       {                                                                                                                                                                       \\r
+               vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL );                                                  \\r
+       }                                                                                                                                                                       \\r
+       crSET_STATE0( ( xHandle ) );\r
+\r
+/**\r
+ * <pre>\r
+ crQUEUE_SEND(\r
+                  CoRoutineHandle_t xHandle,\r
+                  QueueHandle_t pxQueue,\r
+                  void *pvItemToQueue,\r
+                  TickType_t xTicksToWait,\r
+                  BaseType_t *pxResult\r
+             )</pre>\r
+ *\r
+ * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
+ * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.\r
+ *\r
+ * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas\r
+ * xQueueSend() and xQueueReceive() can only be used from tasks.\r
+ *\r
+ * crQUEUE_SEND can only be called from the co-routine function itself - not\r
+ * from within a function called by the co-routine function.  This is because\r
+ * co-routines do not maintain their own stack.\r
+ *\r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
+ * co-routines.\r
+ *\r
+ * @param xHandle The handle of the calling co-routine.  This is the xHandle\r
+ * parameter of the co-routine function.\r
+ *\r
+ * @param pxQueue The handle of the queue on which the data will be posted.\r
+ * The handle is obtained as the return value when the queue is created using\r
+ * the xQueueCreate() API function.\r
+ *\r
+ * @param pvItemToQueue A pointer to the data being posted onto the queue.\r
+ * The number of bytes of each queued item is specified when the queue is\r
+ * created.  This number of bytes is copied from pvItemToQueue into the queue\r
+ * itself.\r
+ *\r
+ * @param xTickToDelay The number of ticks that the co-routine should block\r
+ * to wait for space to become available on the queue, should space not be\r
+ * available immediately. The actual amount of time this equates to is defined\r
+ * by configTICK_RATE_HZ (set in FreeRTOSConfig.h).  The constant\r
+ * portTICK_PERIOD_MS can be used to convert ticks to milliseconds (see example\r
+ * below).\r
+ *\r
+ * @param pxResult The variable pointed to by pxResult will be set to pdPASS if\r
+ * data was successfully posted onto the queue, otherwise it will be set to an\r
+ * error defined within ProjDefs.h.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Co-routine function that blocks for a fixed period then posts a number onto\r
+ // a queue.\r
+ static void prvCoRoutineFlashTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ static BaseType_t xNumberToPost = 0;\r
+ static BaseType_t xResult;\r
+\r
+    // Co-routines must begin with a call to crSTART().\r
+    crSTART( xHandle );\r
+\r
+    for( ;; )\r
+    {\r
+        // This assumes the queue has already been created.\r
+        crQUEUE_SEND( xHandle, xCoRoutineQueue, &xNumberToPost, NO_DELAY, &xResult );\r
+\r
+        if( xResult != pdPASS )\r
+        {\r
+            // The message was not posted!\r
+        }\r
+\r
+        // Increment the number to be posted onto the queue.\r
+        xNumberToPost++;\r
+\r
+        // Delay for 100 ticks.\r
+        crDELAY( xHandle, 100 );\r
+    }\r
+\r
+    // Co-routines must end with a call to crEND().\r
+    crEND();\r
+ }</pre>\r
+ * \defgroup crQUEUE_SEND crQUEUE_SEND\r
+ * \ingroup Tasks\r
+ */\r
+#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult )                        \\r
+{                                                                                                                                                                              \\r
+       *( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) );       \\r
+       if( *( pxResult ) == errQUEUE_BLOCKED )                                                                                         \\r
+       {                                                                                                                                                                       \\r
+               crSET_STATE0( ( xHandle ) );                                                                                                    \\r
+               *pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 );                                  \\r
+       }                                                                                                                                                                       \\r
+       if( *pxResult == errQUEUE_YIELD )                                                                                                       \\r
+       {                                                                                                                                                                       \\r
+               crSET_STATE1( ( xHandle ) );                                                                                                    \\r
+               *pxResult = pdPASS;                                                                                                                             \\r
+       }                                                                                                                                                                       \\r
+}\r
+\r
+/**\r
+ * croutine. h\r
+ * <pre>\r
+  crQUEUE_RECEIVE(\r
+                     CoRoutineHandle_t xHandle,\r
+                     QueueHandle_t pxQueue,\r
+                     void *pvBuffer,\r
+                     TickType_t xTicksToWait,\r
+                     BaseType_t *pxResult\r
+                 )</pre>\r
+ *\r
+ * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine\r
+ * equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.\r
+ *\r
+ * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas\r
+ * xQueueSend() and xQueueReceive() can only be used from tasks.\r
+ *\r
+ * crQUEUE_RECEIVE can only be called from the co-routine function itself - not\r
+ * from within a function called by the co-routine function.  This is because\r
+ * co-routines do not maintain their own stack.\r
+ *\r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
+ * co-routines.\r
+ *\r
+ * @param xHandle The handle of the calling co-routine.  This is the xHandle\r
+ * parameter of the co-routine function.\r
+ *\r
+ * @param pxQueue The handle of the queue from which the data will be received.\r
+ * The handle is obtained as the return value when the queue is created using\r
+ * the xQueueCreate() API function.\r
+ *\r
+ * @param pvBuffer The buffer into which the received item is to be copied.\r
+ * The number of bytes of each queued item is specified when the queue is\r
+ * created.  This number of bytes is copied into pvBuffer.\r
+ *\r
+ * @param xTickToDelay The number of ticks that the co-routine should block\r
+ * to wait for data to become available from the queue, should data not be\r
+ * available immediately. The actual amount of time this equates to is defined\r
+ * by configTICK_RATE_HZ (set in FreeRTOSConfig.h).  The constant\r
+ * portTICK_PERIOD_MS can be used to convert ticks to milliseconds (see the\r
+ * crQUEUE_SEND example).\r
+ *\r
+ * @param pxResult The variable pointed to by pxResult will be set to pdPASS if\r
+ * data was successfully retrieved from the queue, otherwise it will be set to\r
+ * an error code as defined within ProjDefs.h.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ // A co-routine receives the number of an LED to flash from a queue.  It\r
+ // blocks on the queue until the number is received.\r
+ static void prvCoRoutineFlashWorkTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // Variables in co-routines must be declared static if they must maintain value across a blocking call.\r
+ static BaseType_t xResult;\r
+ static UBaseType_t uxLEDToFlash;\r
+\r
+    // All co-routines must start with a call to crSTART().\r
+    crSTART( xHandle );\r
+\r
+    for( ;; )\r
+    {\r
+        // Wait for data to become available on the queue.\r
+        crQUEUE_RECEIVE( xHandle, xCoRoutineQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );\r
+\r
+        if( xResult == pdPASS )\r
+        {\r
+            // We received the LED to flash - flash it!\r
+            vParTestToggleLED( uxLEDToFlash );\r
+        }\r
+    }\r
+\r
+    crEND();\r
+ }</pre>\r
+ * \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE\r
+ * \ingroup Tasks\r
+ */\r
+#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult )                  \\r
+{                                                                                                                                                                              \\r
+       *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) );         \\r
+       if( *( pxResult ) == errQUEUE_BLOCKED )                                                                                         \\r
+       {                                                                                                                                                                       \\r
+               crSET_STATE0( ( xHandle ) );                                                                                                    \\r
+               *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 );                                \\r
+       }                                                                                                                                                                       \\r
+       if( *( pxResult ) == errQUEUE_YIELD )                                                                                           \\r
+       {                                                                                                                                                                       \\r
+               crSET_STATE1( ( xHandle ) );                                                                                                    \\r
+               *( pxResult ) = pdPASS;                                                                                                                 \\r
+       }                                                                                                                                                                       \\r
+}\r
+\r
+/**\r
+ * croutine. h\r
+ * <pre>\r
+  crQUEUE_SEND_FROM_ISR(\r
+                            QueueHandle_t pxQueue,\r
+                            void *pvItemToQueue,\r
+                            BaseType_t xCoRoutinePreviouslyWoken\r
+                       )</pre>\r
+ *\r
+ * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
+ * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()\r
+ * functions used by tasks.\r
+ *\r
+ * crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to\r
+ * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and\r
+ * xQueueReceiveFromISR() can only be used to pass data between a task and and\r
+ * ISR.\r
+ *\r
+ * crQUEUE_SEND_FROM_ISR can only be called from an ISR to send data to a queue\r
+ * that is being used from within a co-routine.\r
+ *\r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
+ * co-routines.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param xCoRoutinePreviouslyWoken This is included so an ISR can post onto\r
+ * the same queue multiple times from a single interrupt.  The first call\r
+ * should always pass in pdFALSE.  Subsequent calls should pass in\r
+ * the value returned from the previous call.\r
+ *\r
+ * @return pdTRUE if a co-routine was woken by posting onto the queue.  This is\r
+ * used by the ISR to determine if a context switch may be required following\r
+ * the ISR.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ // A co-routine that blocks on a queue waiting for characters to be received.\r
+ static void vReceivingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ char cRxedChar;\r
+ BaseType_t xResult;\r
+\r
+     // All co-routines must start with a call to crSTART().\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+         // Wait for data to become available on the queue.  This assumes the\r
+         // queue xCommsRxQueue has already been created!\r
+         crQUEUE_RECEIVE( xHandle, xCommsRxQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );\r
+\r
+         // Was a character received?\r
+         if( xResult == pdPASS )\r
+         {\r
+             // Process the character here.\r
+         }\r
+     }\r
+\r
+     // All co-routines must end with a call to crEND().\r
+     crEND();\r
+ }\r
+\r
+ // An ISR that uses a queue to send characters received on a serial port to\r
+ // a co-routine.\r
+ void vUART_ISR( void )\r
+ {\r
+ char cRxedChar;\r
+ BaseType_t xCRWokenByPost = pdFALSE;\r
+\r
+     // We loop around reading characters until there are none left in the UART.\r
+     while( UART_RX_REG_NOT_EMPTY() )\r
+     {\r
+         // Obtain the character from the UART.\r
+         cRxedChar = UART_RX_REG;\r
+\r
+         // Post the character onto a queue.  xCRWokenByPost will be pdFALSE\r
+         // the first time around the loop.  If the post causes a co-routine\r
+         // to be woken (unblocked) then xCRWokenByPost will be set to pdTRUE.\r
+         // In this manner we can ensure that if more than one co-routine is\r
+         // blocked on the queue only one is woken by this ISR no matter how\r
+         // many characters are posted to the queue.\r
+         xCRWokenByPost = crQUEUE_SEND_FROM_ISR( xCommsRxQueue, &cRxedChar, xCRWokenByPost );\r
+     }\r
+ }</pre>\r
+ * \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR\r
+ * \ingroup Tasks\r
+ */\r
+#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )\r
+\r
+\r
+/**\r
+ * croutine. h\r
+ * <pre>\r
+  crQUEUE_SEND_FROM_ISR(\r
+                            QueueHandle_t pxQueue,\r
+                            void *pvBuffer,\r
+                            BaseType_t * pxCoRoutineWoken\r
+                       )</pre>\r
+ *\r
+ * The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the\r
+ * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()\r
+ * functions used by tasks.\r
+ *\r
+ * crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to\r
+ * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and\r
+ * xQueueReceiveFromISR() can only be used to pass data between a task and and\r
+ * ISR.\r
+ *\r
+ * crQUEUE_RECEIVE_FROM_ISR can only be called from an ISR to receive data\r
+ * from a queue that is being used from within a co-routine (a co-routine\r
+ * posted to the queue).\r
+ *\r
+ * See the co-routine section of the WEB documentation for information on\r
+ * passing data between tasks and co-routines and between ISR's and\r
+ * co-routines.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvBuffer A pointer to a buffer into which the received item will be\r
+ * placed.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from the queue into\r
+ * pvBuffer.\r
+ *\r
+ * @param pxCoRoutineWoken A co-routine may be blocked waiting for space to become\r
+ * available on the queue.  If crQUEUE_RECEIVE_FROM_ISR causes such a\r
+ * co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise\r
+ * *pxCoRoutineWoken will remain unchanged.\r
+ *\r
+ * @return pdTRUE an item was successfully received from the queue, otherwise\r
+ * pdFALSE.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ // A co-routine that posts a character to a queue then blocks for a fixed\r
+ // period.  The character is incremented each time.\r
+ static void vSendingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )\r
+ {\r
+ // cChar holds its value while this co-routine is blocked and must therefore\r
+ // be declared static.\r
+ static char cCharToTx = 'a';\r
+ BaseType_t xResult;\r
+\r
+     // All co-routines must start with a call to crSTART().\r
+     crSTART( xHandle );\r
+\r
+     for( ;; )\r
+     {\r
+         // Send the next character to the queue.\r
+         crQUEUE_SEND( xHandle, xCoRoutineQueue, &cCharToTx, NO_DELAY, &xResult );\r
+\r
+         if( xResult == pdPASS )\r
+         {\r
+             // The character was successfully posted to the queue.\r
+         }\r
+                else\r
+                {\r
+                       // Could not post the character to the queue.\r
+                }\r
+\r
+         // Enable the UART Tx interrupt to cause an interrupt in this\r
+                // hypothetical UART.  The interrupt will obtain the character\r
+                // from the queue and send it.\r
+                ENABLE_RX_INTERRUPT();\r
+\r
+                // Increment to the next character then block for a fixed period.\r
+                // cCharToTx will maintain its value across the delay as it is\r
+                // declared static.\r
+                cCharToTx++;\r
+                if( cCharToTx > 'x' )\r
+                {\r
+                       cCharToTx = 'a';\r
+                }\r
+                crDELAY( 100 );\r
+     }\r
+\r
+     // All co-routines must end with a call to crEND().\r
+     crEND();\r
+ }\r
+\r
+ // An ISR that uses a queue to receive characters to send on a UART.\r
+ void vUART_ISR( void )\r
+ {\r
+ char cCharToTx;\r
+ BaseType_t xCRWokenByPost = pdFALSE;\r
+\r
+     while( UART_TX_REG_EMPTY() )\r
+     {\r
+         // Are there any characters in the queue waiting to be sent?\r
+                // xCRWokenByPost will automatically be set to pdTRUE if a co-routine\r
+                // is woken by the post - ensuring that only a single co-routine is\r
+                // woken no matter how many times we go around this loop.\r
+         if( crQUEUE_RECEIVE_FROM_ISR( pxQueue, &cCharToTx, &xCRWokenByPost ) )\r
+                {\r
+                        SEND_CHARACTER( cCharToTx );\r
+                }\r
+     }\r
+ }</pre>\r
+ * \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR\r
+ * \ingroup Tasks\r
+ */\r
+#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )\r
+\r
+/*\r
+ * This function is intended for internal use by the co-routine macros only.\r
+ * The macro nature of the co-routine implementation requires that the\r
+ * prototype appears here.  The function should not be used by application\r
+ * writers.\r
+ *\r
+ * Removes the current co-routine from its ready list and places it in the\r
+ * appropriate delayed list.\r
+ */\r
+void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );\r
+\r
+/*\r
+ * This function is intended for internal use by the queue implementation only.\r
+ * The function should not be used by application writers.\r
+ *\r
+ * Removes the highest priority co-routine from the event list and places it in\r
+ * the pending ready list.\r
+ */\r
+BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* CO_ROUTINE_H */\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/deprecated_definitions.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/deprecated_definitions.h
new file mode 100644 (file)
index 0000000..83f0931
--- /dev/null
@@ -0,0 +1,321 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef DEPRECATED_DEFINITIONS_H\r
+#define DEPRECATED_DEFINITIONS_H\r
+\r
+\r
+/* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
+pre-processor definition was used to ensure the pre-processor found the correct\r
+portmacro.h file for the port being used.  That scheme was deprecated in favour\r
+of setting the compiler's include path such that it found the correct\r
+portmacro.h file - removing the need for the constant and allowing the\r
+portmacro.h file to be located anywhere in relation to the port being used.  The\r
+definitions below remain in the code for backward compatibility only.  New\r
+projects should not use them. */\r
+\r
+#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT\r
+       #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"\r
+       typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT\r
+       #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"\r
+       typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef GCC_MEGA_AVR\r
+       #include "../portable/GCC/ATMega323/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_MEGA_AVR\r
+       #include "../portable/IAR/ATMega323/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC24_PORT\r
+       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_DSPIC_PORT\r
+       #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC18F_PORT\r
+       #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"\r
+#endif\r
+\r
+#ifdef MPLAB_PIC32MX_PORT\r
+       #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"\r
+#endif\r
+\r
+#ifdef _FEDPICC\r
+       #include "libFreeRTOS/Include/portmacro.h"\r
+#endif\r
+\r
+#ifdef SDCC_CYGNAL\r
+       #include "../../Source/portable/SDCC/Cygnal/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARM7\r
+       #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARM7_ECLIPSE\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+#ifdef ROWLEY_LPC23xx\r
+       #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_MSP430\r
+       #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_MSP430\r
+       #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
+#endif\r
+\r
+#ifdef ROWLEY_MSP430\r
+       #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"\r
+#endif\r
+\r
+#ifdef ARM7_LPC21xx_KEIL_RVDS\r
+       #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM7_GCC\r
+       #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM7_IAR\r
+       #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"\r
+#endif\r
+\r
+#ifdef SAM9XE_IAR\r
+       #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"\r
+#endif\r
+\r
+#ifdef LPC2000_IAR\r
+       #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR71X_IAR\r
+       #include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR75X_IAR\r
+       #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR75X_GCC\r
+       #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
+#endif\r
+\r
+#ifdef STR91X_IAR\r
+       #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_H8S\r
+       #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_AT91FR40008\r
+       #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"\r
+#endif\r
+\r
+#ifdef RVDS_ARMCM3_LM3S102\r
+       #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARMCM3_LM3S102\r
+       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_ARMCM3\r
+       #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_ARM_CM3\r
+       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef IAR_ARMCM3_LM\r
+       #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
+#endif\r
+\r
+#ifdef HCS12_CODE_WARRIOR\r
+       #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
+#endif\r
+\r
+#ifdef MICROBLAZE_GCC\r
+       #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
+#endif\r
+\r
+#ifdef TERN_EE\r
+       #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_HCS12\r
+       #include "../../Source/portable/GCC/HCS12/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_MCF5235\r
+    #include "../../Source/portable/GCC/MCF5235/portmacro.h"\r
+#endif\r
+\r
+#ifdef COLDFIRE_V2_GCC\r
+       #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"\r
+#endif\r
+\r
+#ifdef COLDFIRE_V2_CODEWARRIOR\r
+       #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_PPC405\r
+       #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"\r
+#endif\r
+\r
+#ifdef GCC_PPC440\r
+       #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"\r
+#endif\r
+\r
+#ifdef _16FX_SOFTUNE\r
+       #include "..\..\Source\portable\Softune\MB96340\portmacro.h"\r
+#endif\r
+\r
+#ifdef BCC_INDUSTRIAL_PC_PORT\r
+       /* A short file name has to be used in place of the normal\r
+       FreeRTOSConfig.h when using the Borland compiler. */\r
+       #include "frconfig.h"\r
+       #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"\r
+    typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef BCC_FLASH_LITE_186_PORT\r
+       /* A short file name has to be used in place of the normal\r
+       FreeRTOSConfig.h when using the Borland compiler. */\r
+       #include "frconfig.h"\r
+       #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"\r
+    typedef void ( __interrupt __far *pxISR )();\r
+#endif\r
+\r
+#ifdef __GNUC__\r
+   #ifdef __AVR32_AVR32A__\r
+          #include "portmacro.h"\r
+   #endif\r
+#endif\r
+\r
+#ifdef __ICCAVR32__\r
+   #ifdef __CORE__\r
+      #if __CORE__ == __AVR32A__\r
+             #include "portmacro.h"\r
+      #endif\r
+   #endif\r
+#endif\r
+\r
+#ifdef __91467D\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+#ifdef __96340\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+\r
+#ifdef __IAR_V850ES_Fx3__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx3__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx3_L__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Jx2__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_V850ES_Hx2__\r
+       #include "../../Source/portable/IAR/V850ES/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_78K0R_Kx3__\r
+       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
+#endif\r
+\r
+#ifdef __IAR_78K0R_Kx3L__\r
+       #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
+#endif\r
+\r
+#endif /* DEPRECATED_DEFINITIONS_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/event_groups.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/event_groups.h
new file mode 100644 (file)
index 0000000..70dc5f2
--- /dev/null
@@ -0,0 +1,730 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef EVENT_GROUPS_H\r
+#define EVENT_GROUPS_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h" must appear in source files before "include event_groups.h"\r
+#endif\r
+\r
+#include "timers.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/**\r
+ * An event group is a collection of bits to which an application can assign a\r
+ * meaning.  For example, an application may create an event group to convey\r
+ * the status of various CAN bus related events in which bit 0 might mean "A CAN\r
+ * message has been received and is ready for processing", bit 1 might mean "The\r
+ * application has queued a message that is ready for sending onto the CAN\r
+ * network", and bit 2 might mean "It is time to send a SYNC message onto the\r
+ * CAN network" etc.  A task can then test the bit values to see which events\r
+ * are active, and optionally enter the Blocked state to wait for a specified\r
+ * bit or a group of specified bits to be active.  To continue the CAN bus\r
+ * example, a CAN controlling task can enter the Blocked state (and therefore\r
+ * not consume any processing time) until either bit 0, bit 1 or bit 2 are\r
+ * active, at which time the bit that was actually active would inform the task\r
+ * which action it had to take (process a received message, send a message, or\r
+ * send a SYNC).\r
+ *\r
+ * The event groups implementation contains intelligence to avoid race\r
+ * conditions that would otherwise occur were an application to use a simple\r
+ * variable for the same purpose.  This is particularly important with respect\r
+ * to when a bit within an event group is to be cleared, and when bits have to\r
+ * be set and then tested atomically - as is the case where event groups are\r
+ * used to create a synchronisation point between multiple tasks (a\r
+ * 'rendezvous').\r
+ *\r
+ * \defgroup EventGroup\r
+ */\r
+\r
+\r
+\r
+/**\r
+ * event_groups.h\r
+ *\r
+ * Type by which event groups are referenced.  For example, a call to\r
+ * xEventGroupCreate() returns an EventGroupHandle_t variable that can then\r
+ * be used as a parameter to other event group functions.\r
+ *\r
+ * \defgroup EventGroupHandle_t EventGroupHandle_t\r
+ * \ingroup EventGroup\r
+ */\r
+typedef void * EventGroupHandle_t;\r
+\r
+/* \r
+ * The type that holds event bits always matches TickType_t - therefore the\r
+ * number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,\r
+ * 32 bits if set to 0. \r
+ *\r
+ * \defgroup EventBits_t EventBits_t\r
+ * \ingroup EventGroup\r
+ */\r
+typedef TickType_t EventBits_t;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+ EventGroupHandle_t xEventGroupCreate( void );\r
+ </pre>\r
+ *\r
+ * Create a new event group.  This function cannot be called from an interrupt.\r
+ *\r
+ * Although event groups are not related to ticks, for internal implementation\r
+ * reasons the number of bits available for use in an event group is dependent\r
+ * on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h.  If\r
+ * configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit\r
+ * 0 to bit 7).  If configUSE_16_BIT_TICKS is set to 0 then each event group has\r
+ * 24 usable bits (bit 0 to bit 23).  The EventBits_t type is used to store\r
+ * event bits within an event group.\r
+ *\r
+ * @return If the event group was created then a handle to the event group is\r
+ * returned.  If there was insufficient FreeRTOS heap available to create the\r
+ * event group then NULL is returned.  See http://www.freertos.org/a00111.html\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+       // Declare a variable to hold the created event group.\r
+       EventGroupHandle_t xCreatedEventGroup;\r
+\r
+       // Attempt to create the event group.\r
+       xCreatedEventGroup = xEventGroupCreate();\r
+\r
+       // Was the event group created successfully?\r
+       if( xCreatedEventGroup == NULL )\r
+       {\r
+               // The event group was not created because there was insufficient\r
+               // FreeRTOS heap available.\r
+       }\r
+       else\r
+       {\r
+               // The event group was created.\r
+       }\r
+   </pre>\r
+ * \defgroup xEventGroupCreate xEventGroupCreate\r
+ * \ingroup EventGroup\r
+ */\r
+EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupWaitBits(        EventGroupHandle_t xEventGroup,\r
+                                                                               const EventBits_t uxBitsToWaitFor,\r
+                                                                               const BaseType_t xClearOnExit,\r
+                                                                               const BaseType_t xWaitForAllBits,\r
+                                                                               const TickType_t xTicksToWait );\r
+ </pre>\r
+ *\r
+ * [Potentially] block to wait for one or more bits to be set within a\r
+ * previously created event group.\r
+ *\r
+ * This function cannot be called from an interrupt.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are being tested.  The\r
+ * event group must have previously been created using a call to\r
+ * xEventGroupCreate().\r
+ *\r
+ * @param uxBitsToWaitFor A bitwise value that indicates the bit or bits to test\r
+ * inside the event group.  For example, to wait for bit 0 and/or bit 2 set\r
+ * uxBitsToWaitFor to 0x05.  To wait for bits 0 and/or bit 1 and/or bit 2 set\r
+ * uxBitsToWaitFor to 0x07.  Etc.\r
+ *\r
+ * @param xClearOnExit If xClearOnExit is set to pdTRUE then any bits within\r
+ * uxBitsToWaitFor that are set within the event group will be cleared before\r
+ * xEventGroupWaitBits() returns if the wait condition was met (if the function\r
+ * returns for a reason other than a timeout).  If xClearOnExit is set to\r
+ * pdFALSE then the bits set in the event group are not altered when the call to\r
+ * xEventGroupWaitBits() returns.\r
+ *\r
+ * @param xWaitForAllBits If xWaitForAllBits is set to pdTRUE then\r
+ * xEventGroupWaitBits() will return when either all the bits in uxBitsToWaitFor\r
+ * are set or the specified block time expires.  If xWaitForAllBits is set to\r
+ * pdFALSE then xEventGroupWaitBits() will return when any one of the bits set\r
+ * in uxBitsToWaitFor is set or the specified block time expires.  The block\r
+ * time is specified by the xTicksToWait parameter.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait\r
+ * for one/all (depending on the xWaitForAllBits value) of the bits specified by\r
+ * uxBitsToWaitFor to become set.\r
+ *\r
+ * @return The value of the event group at the time either the bits being waited\r
+ * for became set, or the block time expired.  Test the return value to know\r
+ * which bits were set.  If xEventGroupWaitBits() returned because its timeout\r
+ * expired then not all the bits being waited for will be set.  If\r
+ * xEventGroupWaitBits() returned because the bits it was waiting for were set\r
+ * then the returned value is the event group value before any bits were\r
+ * automatically cleared in the case that xClearOnExit parameter was set to\r
+ * pdTRUE.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+   #define BIT_0       ( 1 << 0 )\r
+   #define BIT_4       ( 1 << 4 )\r
+\r
+   void aFunction( EventGroupHandle_t xEventGroup )\r
+   {\r
+   EventBits_t uxBits;\r
+   const TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;\r
+\r
+               // Wait a maximum of 100ms for either bit 0 or bit 4 to be set within\r
+               // the event group.  Clear the bits before exiting.\r
+               uxBits = xEventGroupWaitBits(\r
+                                       xEventGroup,    // The event group being tested.\r
+                                       BIT_0 | BIT_4,  // The bits within the event group to wait for.\r
+                                       pdTRUE,                 // BIT_0 and BIT_4 should be cleared before returning.\r
+                                       pdFALSE,                // Don't wait for both bits, either bit will do.\r
+                                       xTicksToWait ); // Wait a maximum of 100ms for either bit to be set.\r
+\r
+               if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )\r
+               {\r
+                       // xEventGroupWaitBits() returned because both bits were set.\r
+               }\r
+               else if( ( uxBits & BIT_0 ) != 0 )\r
+               {\r
+                       // xEventGroupWaitBits() returned because just BIT_0 was set.\r
+               }\r
+               else if( ( uxBits & BIT_4 ) != 0 )\r
+               {\r
+                       // xEventGroupWaitBits() returned because just BIT_4 was set.\r
+               }\r
+               else\r
+               {\r
+                       // xEventGroupWaitBits() returned because xTicksToWait ticks passed\r
+                       // without either BIT_0 or BIT_4 becoming set.\r
+               }\r
+   }\r
+   </pre>\r
+ * \defgroup xEventGroupWaitBits xEventGroupWaitBits\r
+ * \ingroup EventGroup\r
+ */\r
+EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );\r
+ </pre>\r
+ *\r
+ * Clear bits within an event group.  This function cannot be called from an\r
+ * interrupt.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are to be cleared.\r
+ *\r
+ * @param uxBitsToClear A bitwise value that indicates the bit or bits to clear\r
+ * in the event group.  For example, to clear bit 3 only, set uxBitsToClear to\r
+ * 0x08.  To clear bit 3 and bit 0 set uxBitsToClear to 0x09.\r
+ *\r
+ * @return The value of the event group before the specified bits were cleared.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+   #define BIT_0       ( 1 << 0 )\r
+   #define BIT_4       ( 1 << 4 )\r
+\r
+   void aFunction( EventGroupHandle_t xEventGroup )\r
+   {\r
+   EventBits_t uxBits;\r
+\r
+               // Clear bit 0 and bit 4 in xEventGroup.\r
+               uxBits = xEventGroupClearBits(\r
+                                                               xEventGroup,    // The event group being updated.\r
+                                                               BIT_0 | BIT_4 );// The bits being cleared.\r
+\r
+               if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )\r
+               {\r
+                       // Both bit 0 and bit 4 were set before xEventGroupClearBits() was\r
+                       // called.  Both will now be clear (not set).\r
+               }\r
+               else if( ( uxBits & BIT_0 ) != 0 )\r
+               {\r
+                       // Bit 0 was set before xEventGroupClearBits() was called.  It will\r
+                       // now be clear.\r
+               }\r
+               else if( ( uxBits & BIT_4 ) != 0 )\r
+               {\r
+                       // Bit 4 was set before xEventGroupClearBits() was called.  It will\r
+                       // now be clear.\r
+               }\r
+               else\r
+               {\r
+                       // Neither bit 0 nor bit 4 were set in the first place.\r
+               }\r
+   }\r
+   </pre>\r
+ * \defgroup xEventGroupClearBits xEventGroupClearBits\r
+ * \ingroup EventGroup\r
+ */\r
+EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );\r
+ </pre>\r
+ *\r
+ * A version of xEventGroupClearBits() that can be called from an interrupt.\r
+ *\r
+ * Setting bits in an event group is not a deterministic operation because there\r
+ * are an unknown number of tasks that may be waiting for the bit or bits being\r
+ * set.  FreeRTOS does not allow nondeterministic operations to be performed\r
+ * while interrupts are disabled, so protects event groups that are accessed\r
+ * from tasks by suspending the scheduler rather than disabling interrupts.  As\r
+ * a result event groups cannot be accessed directly from an interrupt service\r
+ * routine.  Therefore xEventGroupClearBitsFromISR() sends a message to the \r
+ * timer task to have the clear operation performed in the context of the timer \r
+ * task.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are to be cleared.\r
+ *\r
+ * @param uxBitsToClear A bitwise value that indicates the bit or bits to clear.\r
+ * For example, to clear bit 3 only, set uxBitsToClear to 0x08.  To clear bit 3\r
+ * and bit 0 set uxBitsToClear to 0x09.\r
+ *\r
+ * @return If the request to execute the function was posted successfully then \r
+ * pdPASS is returned, otherwise pdFALSE is returned.  pdFALSE will be returned \r
+ * if the timer service queue was full.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+   #define BIT_0       ( 1 << 0 )\r
+   #define BIT_4       ( 1 << 4 )\r
+\r
+   // An event group which it is assumed has already been created by a call to\r
+   // xEventGroupCreate().\r
+   EventGroupHandle_t xEventGroup;\r
+\r
+   void anInterruptHandler( void )\r
+   {\r
+               // Clear bit 0 and bit 4 in xEventGroup.\r
+               xResult = xEventGroupClearBitsFromISR(\r
+                                                       xEventGroup,     // The event group being updated.\r
+                                                       BIT_0 | BIT_4 ); // The bits being set.\r
+\r
+               if( xResult == pdPASS )\r
+               {\r
+                       // The message was posted successfully.\r
+               }\r
+  }\r
+   </pre>\r
+ * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR\r
+ * \ingroup EventGroup\r
+ */\r
+#if( configUSE_TRACE_FACILITY == 1 )\r
+       BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;\r
+#else\r
+       #define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL )\r
+#endif\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );\r
+ </pre>\r
+ *\r
+ * Set bits within an event group.\r
+ * This function cannot be called from an interrupt.  xEventGroupSetBitsFromISR()\r
+ * is a version that can be called from an interrupt.\r
+ *\r
+ * Setting bits in an event group will automatically unblock tasks that are\r
+ * blocked waiting for the bits.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are to be set.\r
+ *\r
+ * @param uxBitsToSet A bitwise value that indicates the bit or bits to set.\r
+ * For example, to set bit 3 only, set uxBitsToSet to 0x08.  To set bit 3\r
+ * and bit 0 set uxBitsToSet to 0x09.\r
+ *\r
+ * @return The value of the event group at the time the call to\r
+ * xEventGroupSetBits() returns.  There are two reasons why the returned value\r
+ * might have the bits specified by the uxBitsToSet parameter cleared.  First,\r
+ * if setting a bit results in a task that was waiting for the bit leaving the\r
+ * blocked state then it is possible the bit will be cleared automatically\r
+ * (see the xClearBitOnExit parameter of xEventGroupWaitBits()).  Second, any\r
+ * unblocked (or otherwise Ready state) task that has a priority above that of\r
+ * the task that called xEventGroupSetBits() will execute and may change the\r
+ * event group value before the call to xEventGroupSetBits() returns.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+   #define BIT_0       ( 1 << 0 )\r
+   #define BIT_4       ( 1 << 4 )\r
+\r
+   void aFunction( EventGroupHandle_t xEventGroup )\r
+   {\r
+   EventBits_t uxBits;\r
+\r
+               // Set bit 0 and bit 4 in xEventGroup.\r
+               uxBits = xEventGroupSetBits(\r
+                                                       xEventGroup,    // The event group being updated.\r
+                                                       BIT_0 | BIT_4 );// The bits being set.\r
+\r
+               if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )\r
+               {\r
+                       // Both bit 0 and bit 4 remained set when the function returned.\r
+               }\r
+               else if( ( uxBits & BIT_0 ) != 0 )\r
+               {\r
+                       // Bit 0 remained set when the function returned, but bit 4 was\r
+                       // cleared.  It might be that bit 4 was cleared automatically as a\r
+                       // task that was waiting for bit 4 was removed from the Blocked\r
+                       // state.\r
+               }\r
+               else if( ( uxBits & BIT_4 ) != 0 )\r
+               {\r
+                       // Bit 4 remained set when the function returned, but bit 0 was\r
+                       // cleared.  It might be that bit 0 was cleared automatically as a\r
+                       // task that was waiting for bit 0 was removed from the Blocked\r
+                       // state.\r
+               }\r
+               else\r
+               {\r
+                       // Neither bit 0 nor bit 4 remained set.  It might be that a task\r
+                       // was waiting for both of the bits to be set, and the bits were\r
+                       // cleared as the task left the Blocked state.\r
+               }\r
+   }\r
+   </pre>\r
+ * \defgroup xEventGroupSetBits xEventGroupSetBits\r
+ * \ingroup EventGroup\r
+ */\r
+EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );\r
+ </pre>\r
+ *\r
+ * A version of xEventGroupSetBits() that can be called from an interrupt.\r
+ *\r
+ * Setting bits in an event group is not a deterministic operation because there\r
+ * are an unknown number of tasks that may be waiting for the bit or bits being\r
+ * set.  FreeRTOS does not allow nondeterministic operations to be performed in\r
+ * interrupts or from critical sections.  Therefore xEventGroupSetBitFromISR()\r
+ * sends a message to the timer task to have the set operation performed in the\r
+ * context of the timer task - where a scheduler lock is used in place of a\r
+ * critical section.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are to be set.\r
+ *\r
+ * @param uxBitsToSet A bitwise value that indicates the bit or bits to set.\r
+ * For example, to set bit 3 only, set uxBitsToSet to 0x08.  To set bit 3\r
+ * and bit 0 set uxBitsToSet to 0x09.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken As mentioned above, calling this function\r
+ * will result in a message being sent to the timer daemon task.  If the\r
+ * priority of the timer daemon task is higher than the priority of the\r
+ * currently running task (the task the interrupt interrupted) then\r
+ * *pxHigherPriorityTaskWoken will be set to pdTRUE by\r
+ * xEventGroupSetBitsFromISR(), indicating that a context switch should be\r
+ * requested before the interrupt exits.  For that reason\r
+ * *pxHigherPriorityTaskWoken must be initialised to pdFALSE.  See the\r
+ * example code below.\r
+ *\r
+ * @return If the request to execute the function was posted successfully then \r
+ * pdPASS is returned, otherwise pdFALSE is returned.  pdFALSE will be returned \r
+ * if the timer service queue was full.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+   #define BIT_0       ( 1 << 0 )\r
+   #define BIT_4       ( 1 << 4 )\r
+\r
+   // An event group which it is assumed has already been created by a call to\r
+   // xEventGroupCreate().\r
+   EventGroupHandle_t xEventGroup;\r
+\r
+   void anInterruptHandler( void )\r
+   {\r
+   BaseType_t xHigherPriorityTaskWoken, xResult;\r
+\r
+               // xHigherPriorityTaskWoken must be initialised to pdFALSE.\r
+               xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+               // Set bit 0 and bit 4 in xEventGroup.\r
+               xResult = xEventGroupSetBitsFromISR(\r
+                                                       xEventGroup,    // The event group being updated.\r
+                                                       BIT_0 | BIT_4   // The bits being set.\r
+                                                       &xHigherPriorityTaskWoken );\r
+\r
+               // Was the message posted successfully?\r
+               if( xResult == pdPASS )\r
+               {\r
+                       // If xHigherPriorityTaskWoken is now set to pdTRUE then a context\r
+                       // switch should be requested.  The macro used is port specific and \r
+                       // will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - \r
+                       // refer to the documentation page for the port being used.\r
+                       portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+               }\r
+  }\r
+   </pre>\r
+ * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR\r
+ * \ingroup EventGroup\r
+ */\r
+#if( configUSE_TRACE_FACILITY == 1 )\r
+       BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+#else\r
+       #define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken )\r
+#endif\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupSync(    EventGroupHandle_t xEventGroup,\r
+                                                                       const EventBits_t uxBitsToSet,\r
+                                                                       const EventBits_t uxBitsToWaitFor,\r
+                                                                       TickType_t xTicksToWait );\r
+ </pre>\r
+ *\r
+ * Atomically set bits within an event group, then wait for a combination of\r
+ * bits to be set within the same event group.  This functionality is typically\r
+ * used to synchronise multiple tasks, where each task has to wait for the other\r
+ * tasks to reach a synchronisation point before proceeding.\r
+ *\r
+ * This function cannot be used from an interrupt.\r
+ *\r
+ * The function will return before its block time expires if the bits specified\r
+ * by the uxBitsToWait parameter are set, or become set within that time.  In\r
+ * this case all the bits specified by uxBitsToWait will be automatically\r
+ * cleared before the function returns.\r
+ *\r
+ * @param xEventGroup The event group in which the bits are being tested.  The\r
+ * event group must have previously been created using a call to\r
+ * xEventGroupCreate().\r
+ *\r
+ * @param uxBitsToSet The bits to set in the event group before determining\r
+ * if, and possibly waiting for, all the bits specified by the uxBitsToWait\r
+ * parameter are set.\r
+ *\r
+ * @param uxBitsToWaitFor A bitwise value that indicates the bit or bits to test\r
+ * inside the event group.  For example, to wait for bit 0 and bit 2 set\r
+ * uxBitsToWaitFor to 0x05.  To wait for bits 0 and bit 1 and bit 2 set\r
+ * uxBitsToWaitFor to 0x07.  Etc.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait\r
+ * for all of the bits specified by uxBitsToWaitFor to become set.\r
+ *\r
+ * @return The value of the event group at the time either the bits being waited\r
+ * for became set, or the block time expired.  Test the return value to know\r
+ * which bits were set.  If xEventGroupSync() returned because its timeout\r
+ * expired then not all the bits being waited for will be set.  If\r
+ * xEventGroupSync() returned because all the bits it was waiting for were\r
+ * set then the returned value is the event group value before any bits were\r
+ * automatically cleared.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ // Bits used by the three tasks.\r
+ #define TASK_0_BIT            ( 1 << 0 )\r
+ #define TASK_1_BIT            ( 1 << 1 )\r
+ #define TASK_2_BIT            ( 1 << 2 )\r
+\r
+ #define ALL_SYNC_BITS ( TASK_0_BIT | TASK_1_BIT | TASK_2_BIT )\r
+\r
+ // Use an event group to synchronise three tasks.  It is assumed this event\r
+ // group has already been created elsewhere.\r
+ EventGroupHandle_t xEventBits;\r
+\r
+ void vTask0( void *pvParameters )\r
+ {\r
+ EventBits_t uxReturn;\r
+ TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;\r
+\r
+        for( ;; )\r
+        {\r
+               // Perform task functionality here.\r
+\r
+               // Set bit 0 in the event flag to note this task has reached the\r
+               // sync point.  The other two tasks will set the other two bits defined\r
+               // by ALL_SYNC_BITS.  All three tasks have reached the synchronisation\r
+               // point when all the ALL_SYNC_BITS are set.  Wait a maximum of 100ms\r
+               // for this to happen.\r
+               uxReturn = xEventGroupSync( xEventBits, TASK_0_BIT, ALL_SYNC_BITS, xTicksToWait );\r
+\r
+               if( ( uxReturn & ALL_SYNC_BITS ) == ALL_SYNC_BITS )\r
+               {\r
+                       // All three tasks reached the synchronisation point before the call\r
+                       // to xEventGroupSync() timed out.\r
+               }\r
+       }\r
+ }\r
+\r
+ void vTask1( void *pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+               // Perform task functionality here.\r
+\r
+               // Set bit 1 in the event flag to note this task has reached the\r
+               // synchronisation point.  The other two tasks will set the other two\r
+               // bits defined by ALL_SYNC_BITS.  All three tasks have reached the\r
+               // synchronisation point when all the ALL_SYNC_BITS are set.  Wait\r
+               // indefinitely for this to happen.\r
+               xEventGroupSync( xEventBits, TASK_1_BIT, ALL_SYNC_BITS, portMAX_DELAY );\r
+\r
+               // xEventGroupSync() was called with an indefinite block time, so\r
+               // this task will only reach here if the syncrhonisation was made by all\r
+               // three tasks, so there is no need to test the return value.\r
+        }\r
+ }\r
+\r
+ void vTask2( void *pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+               // Perform task functionality here.\r
+\r
+               // Set bit 2 in the event flag to note this task has reached the\r
+               // synchronisation point.  The other two tasks will set the other two\r
+               // bits defined by ALL_SYNC_BITS.  All three tasks have reached the\r
+               // synchronisation point when all the ALL_SYNC_BITS are set.  Wait\r
+               // indefinitely for this to happen.\r
+               xEventGroupSync( xEventBits, TASK_2_BIT, ALL_SYNC_BITS, portMAX_DELAY );\r
+\r
+               // xEventGroupSync() was called with an indefinite block time, so\r
+               // this task will only reach here if the syncrhonisation was made by all\r
+               // three tasks, so there is no need to test the return value.\r
+       }\r
+ }\r
+\r
+ </pre>\r
+ * \defgroup xEventGroupSync xEventGroupSync\r
+ * \ingroup EventGroup\r
+ */\r
+EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );\r
+ </pre>\r
+ *\r
+ * Returns the current value of the bits in an event group.  This function\r
+ * cannot be used from an interrupt.\r
+ *\r
+ * @param xEventGroup The event group being queried.\r
+ *\r
+ * @return The event group bits at the time xEventGroupGetBits() was called.\r
+ *\r
+ * \defgroup xEventGroupGetBits xEventGroupGetBits\r
+ * \ingroup EventGroup\r
+ */\r
+#define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 )\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );\r
+ </pre>\r
+ *\r
+ * A version of xEventGroupGetBits() that can be called from an ISR.\r
+ *\r
+ * @param xEventGroup The event group being queried.\r
+ *\r
+ * @return The event group bits at the time xEventGroupGetBitsFromISR() was called.\r
+ *\r
+ * \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR\r
+ * \ingroup EventGroup\r
+ */\r
+EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * event_groups.h\r
+ *<pre>\r
+       void xEventGroupDelete( EventGroupHandle_t xEventGroup );\r
+ </pre>\r
+ *\r
+ * Delete an event group that was previously created by a call to\r
+ * xEventGroupCreate().  Tasks that are blocked on the event group will be\r
+ * unblocked and obtain 0 as the event group's value.\r
+ *\r
+ * @param xEventGroup The event group being deleted.\r
+ */\r
+void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;\r
+\r
+/* For internal use only. */\r
+void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;\r
+void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;\r
+\r
+#if (configUSE_TRACE_FACILITY == 1)\r
+       UBaseType_t uxEventGroupGetNumber( void* xEventGroup ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* EVENT_GROUPS_H */\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/list.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/list.h
new file mode 100644 (file)
index 0000000..21353f3
--- /dev/null
@@ -0,0 +1,405 @@
+/*\r
+       OpenRTOS V8.2.1  Copyright (C) 2015 Real Time Engineers Ltd.\r
+\r
+       This file is part of the OpenRTOS product.\r
+\r
+       OpenRTOS is distributed exclusively by WITTENSTEIN high integrity systems,\r
+       and is subject to the terms of the License granted to your organization,\r
+       including its warranties and limitations on use and distribution. It cannot be\r
+       copied or reproduced in any way except as permitted by the License.\r
+\r
+       Licenses authorize use by processor, compiler, business unit, and product.\r
+       \r
+       WITTENSTEIN high integrity systems is a trading name of WITTENSTEIN\r
+       aerospace & simulation ltd, Registered Office: Brown's Court, Long Ashton\r
+       Business Park, Yanley Lane, Long Ashton, Bristol, BS41 9LB, UK.\r
+       Tel: +44 (0) 1275 395 600, fax: +44 (0) 1275 393 630.\r
+       E-mail: info@HighIntegritySystems.com\r
+\r
+       http://www.HighIntegritySystems.com\r
+*/\r
+\r
+/*\r
+ * This is the list implementation used by the scheduler.  While it is tailored\r
+ * heavily for the schedulers needs, it is also available for use by\r
+ * application code.\r
+ *\r
+ * list_ts can only store pointers to list_item_ts.  Each ListItem_t contains a\r
+ * numeric value (xItemValue).  Most of the time the lists are sorted in\r
+ * descending item value order.\r
+ *\r
+ * Lists are created already containing one list item.  The value of this\r
+ * item is the maximum possible that can be stored, it is therefore always at\r
+ * the end of the list and acts as a marker.  The list member pxHead always\r
+ * points to this marker - even though it is at the tail of the list.  This\r
+ * is because the tail contains a wrap back pointer to the true head of\r
+ * the list.\r
+ *\r
+ * In addition to it's value, each list item contains a pointer to the next\r
+ * item in the list (pxNext), a pointer to the list it is in (pxContainer)\r
+ * and a pointer to back to the object that contains it.  These later two\r
+ * pointers are included for efficiency of list manipulation.  There is\r
+ * effectively a two way link between the object containing the list item and\r
+ * the list item itself.\r
+ *\r
+ *\r
+ * \page ListIntroduction List Implementation\r
+ * \ingroup FreeRTOSIntro\r
+ */\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error FreeRTOS.h must be included before list.h\r
+#endif\r
+\r
+#ifndef LIST_H\r
+#define LIST_H\r
+\r
+/*\r
+ * The list structure members are modified from within interrupts, and therefore\r
+ * by rights should be declared volatile.  However, they are only modified in a\r
+ * functionally atomic way (within critical sections of with the scheduler\r
+ * suspended) and are either passed by reference into a function or indexed via\r
+ * a volatile variable.  Therefore, in all use cases tested so far, the volatile\r
+ * qualifier can be omitted in order to provide a moderate performance\r
+ * improvement without adversely affecting functional behaviour.  The assembly\r
+ * instructions generated by the IAR, ARM and GCC compilers when the respective\r
+ * compiler's options were set for maximum optimisation has been inspected and\r
+ * deemed to be as intended.  That said, as compiler technology advances, and\r
+ * especially if aggressive cross module optimisation is used (a use case that\r
+ * has not been exercised to any great extend) then it is feasible that the\r
+ * volatile qualifier will be needed for correct optimisation.  It is expected\r
+ * that a compiler removing essential code because, without the volatile\r
+ * qualifier on the list structure members and with aggressive cross module\r
+ * optimisation, the compiler deemed the code unnecessary will result in\r
+ * complete and obvious failure of the scheduler.  If this is ever experienced\r
+ * then the volatile qualifier can be inserted in the relevant places within the\r
+ * list structures by simply defining configLIST_VOLATILE to volatile in\r
+ * FreeRTOSConfig.h (as per the example at the bottom of this comment block).\r
+ * If configLIST_VOLATILE is not defined then the preprocessor directives below\r
+ * will simply #define configLIST_VOLATILE away completely.\r
+ *\r
+ * To use volatile list structure members then add the following line to\r
+ * FreeRTOSConfig.h (without the quotes):\r
+ * "#define configLIST_VOLATILE volatile"\r
+ */\r
+#ifndef configLIST_VOLATILE\r
+       #define configLIST_VOLATILE\r
+#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Macros that can be used to place known values within the list structures,\r
+then check that the known values do not get corrupted during the execution of\r
+the application.   These may catch the list data structures being overwritten in\r
+memory.  They will not catch data errors caused by incorrect configuration or\r
+use of FreeRTOS.*/\r
+#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )\r
+       /* Define the macros to do nothing. */\r
+       #define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE\r
+       #define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE\r
+       #define listFIRST_LIST_INTEGRITY_CHECK_VALUE\r
+       #define listSECOND_LIST_INTEGRITY_CHECK_VALUE\r
+       #define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )\r
+       #define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )\r
+       #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )\r
+       #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )\r
+       #define listTEST_LIST_ITEM_INTEGRITY( pxItem )\r
+       #define listTEST_LIST_INTEGRITY( pxList )\r
+#else\r
+       /* Define macros that add new members into the list structures. */\r
+       #define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE                               TickType_t xListItemIntegrityValue1;\r
+       #define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE                              TickType_t xListItemIntegrityValue2;\r
+       #define listFIRST_LIST_INTEGRITY_CHECK_VALUE                                    TickType_t xListIntegrityValue1;\r
+       #define listSECOND_LIST_INTEGRITY_CHECK_VALUE                                   TickType_t xListIntegrityValue2;\r
+\r
+       /* Define macros that set the new structure members to known values. */\r
+       #define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )         ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )        ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )          ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE\r
+       #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )          ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE\r
+\r
+       /* Define macros that will assert if one of the structure members does not\r
+       contain its expected value. */\r
+       #define listTEST_LIST_ITEM_INTEGRITY( pxItem )          configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )\r
+       #define listTEST_LIST_INTEGRITY( pxList )                       configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )\r
+#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */\r
+\r
+\r
+/*\r
+ * Definition of the only type of object that a list can contain.\r
+ */\r
+struct xLIST_ITEM\r
+{\r
+       listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE                               /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       configLIST_VOLATILE TickType_t xItemValue;                      /*< The value being listed.  In most cases this is used to sort the list in descending order. */\r
+       struct xLIST_ITEM * configLIST_VOLATILE pxNext;         /*< Pointer to the next ListItem_t in the list. */\r
+       struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;     /*< Pointer to the previous ListItem_t in the list. */\r
+       void * pvOwner;                                                                         /*< Pointer to the object (normally a TCB) that contains the list item.  There is therefore a two way link between the object containing the list item and the list item itself. */\r
+       void * configLIST_VOLATILE pvContainer;                         /*< Pointer to the list in which this list item is placed (if any). */\r
+       listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE                              /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+};\r
+typedef struct xLIST_ITEM ListItem_t;                                  /* For some reason lint wants this as two separate definitions. */\r
+\r
+struct xMINI_LIST_ITEM\r
+{\r
+       listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE                               /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       configLIST_VOLATILE TickType_t xItemValue;\r
+       struct xLIST_ITEM * configLIST_VOLATILE pxNext;\r
+       struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;\r
+};\r
+typedef struct xMINI_LIST_ITEM MiniListItem_t;\r
+\r
+/*\r
+ * Definition of the type of queue used by the scheduler.\r
+ */\r
+typedef struct xLIST\r
+{\r
+       listFIRST_LIST_INTEGRITY_CHECK_VALUE                            /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       configLIST_VOLATILE UBaseType_t uxNumberOfItems;\r
+       ListItem_t * configLIST_VOLATILE pxIndex;               /*< Used to walk through the list.  Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */\r
+       MiniListItem_t xListEnd;                                                /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */\r
+       listSECOND_LIST_INTEGRITY_CHECK_VALUE                           /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+} List_t;\r
+\r
+/*\r
+ * Access macro to set the owner of a list item.  The owner of a list item\r
+ * is the object (usually a TCB) that contains the list item.\r
+ *\r
+ * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER\r
+ * \ingroup LinkedList\r
+ */\r
+#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner )         ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )\r
+\r
+/*\r
+ * Access macro to get the owner of a list item.  The owner of a list item\r
+ * is the object (usually a TCB) that contains the list item.\r
+ *\r
+ * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_LIST_ITEM_OWNER( pxListItem )  ( ( pxListItem )->pvOwner )\r
+\r
+/*\r
+ * Access macro to set the value of the list item.  In most cases the value is\r
+ * used to sort the list in descending order.\r
+ *\r
+ * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE\r
+ * \ingroup LinkedList\r
+ */\r
+#define listSET_LIST_ITEM_VALUE( pxListItem, xValue )  ( ( pxListItem )->xItemValue = ( xValue ) )\r
+\r
+/*\r
+ * Access macro to retrieve the value of the list item.  The value can\r
+ * represent anything - for example the priority of a task, or the time at\r
+ * which a task should be unblocked.\r
+ *\r
+ * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_LIST_ITEM_VALUE( pxListItem )  ( ( pxListItem )->xItemValue )\r
+\r
+/*\r
+ * Access macro to retrieve the value of the list item at the head of a given\r
+ * list.\r
+ *\r
+ * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList )     ( ( ( pxList )->xListEnd ).pxNext->xItemValue )\r
+\r
+/*\r
+ * Return the list item at the head of the list.\r
+ *\r
+ * \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_HEAD_ENTRY( pxList )   ( ( ( pxList )->xListEnd ).pxNext )\r
+\r
+/*\r
+ * Return the list item at the head of the list.\r
+ *\r
+ * \page listGET_NEXT listGET_NEXT\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_NEXT( pxListItem )     ( ( pxListItem )->pxNext )\r
+\r
+/*\r
+ * Return the list item that marks the end of the list\r
+ *\r
+ * \page listGET_END_MARKER listGET_END_MARKER\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_END_MARKER( pxList )   ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) )\r
+\r
+/*\r
+ * Access macro to determine if a list contains any items.  The macro will\r
+ * only have the value true if the list is empty.\r
+ *\r
+ * \page listLIST_IS_EMPTY listLIST_IS_EMPTY\r
+ * \ingroup LinkedList\r
+ */\r
+#define listLIST_IS_EMPTY( pxList )    ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) )\r
+\r
+/*\r
+ * Access macro to return the number of items in the list.\r
+ */\r
+#define listCURRENT_LIST_LENGTH( pxList )      ( ( pxList )->uxNumberOfItems )\r
+\r
+/*\r
+ * Access function to obtain the owner of the next entry in a list.\r
+ *\r
+ * The list member pxIndex is used to walk through a list.  Calling\r
+ * listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list\r
+ * and returns that entry's pxOwner parameter.  Using multiple calls to this\r
+ * function it is therefore possible to move through every item contained in\r
+ * a list.\r
+ *\r
+ * The pxOwner parameter of a list item is a pointer to the object that owns\r
+ * the list item.  In the scheduler this is normally a task control block.\r
+ * The pxOwner parameter effectively creates a two way link between the list\r
+ * item and its owner.\r
+ *\r
+ * @param pxTCB pxTCB is set to the address of the owner of the next list item.\r
+ * @param pxList The list from which the next item owner is to be returned.\r
+ *\r
+ * \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )                                                                           \\r
+{                                                                                                                                                                                      \\r
+List_t * const pxConstList = ( pxList );                                                                                                       \\r
+       /* Increment the index to the next item and return the item, ensuring */                                \\r
+       /* we don't return the marker used at the end of the list.  */                                                  \\r
+       ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                                    \\r
+       if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) )  \\r
+       {                                                                                                                                                                               \\r
+               ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                            \\r
+       }                                                                                                                                                                               \\r
+       ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;                                                                                  \\r
+}\r
+\r
+\r
+/*\r
+ * Access function to obtain the owner of the first entry in a list.  Lists\r
+ * are normally sorted in ascending item value order.\r
+ *\r
+ * This function returns the pxOwner member of the first item in the list.\r
+ * The pxOwner parameter of a list item is a pointer to the object that owns\r
+ * the list item.  In the scheduler this is normally a task control block.\r
+ * The pxOwner parameter effectively creates a two way link between the list\r
+ * item and its owner.\r
+ *\r
+ * @param pxList The list from which the owner of the head item is to be\r
+ * returned.\r
+ *\r
+ * \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY\r
+ * \ingroup LinkedList\r
+ */\r
+#define listGET_OWNER_OF_HEAD_ENTRY( pxList )  ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )\r
+\r
+/*\r
+ * Check to see if a list item is within a list.  The list item maintains a\r
+ * "container" pointer that points to the list it is in.  All this macro does\r
+ * is check to see if the container and the list match.\r
+ *\r
+ * @param pxList The list we want to know if the list item is within.\r
+ * @param pxListItem The list item we want to know if is in the list.\r
+ * @return pdTRUE if the list item is in the list, otherwise pdFALSE.\r
+ */\r
+#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( BaseType_t ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )\r
+\r
+/*\r
+ * Return the list a list item is contained within (referenced from).\r
+ *\r
+ * @param pxListItem The list item being queried.\r
+ * @return A pointer to the List_t object that references the pxListItem\r
+ */\r
+#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer )\r
+\r
+/*\r
+ * This provides a crude means of knowing if a list has been initialised, as\r
+ * pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()\r
+ * function.\r
+ */\r
+#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )\r
+\r
+/*\r
+ * Must be called before a list is used!  This initialises all the members\r
+ * of the list structure and inserts the xListEnd item into the list as a\r
+ * marker to the back of the list.\r
+ *\r
+ * @param pxList Pointer to the list being initialised.\r
+ *\r
+ * \page vListInitialise vListInitialise\r
+ * \ingroup LinkedList\r
+ */\r
+void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Must be called before a list item is used.  This sets the list container to\r
+ * null so the item does not think that it is already contained in a list.\r
+ *\r
+ * @param pxItem Pointer to the list item being initialised.\r
+ *\r
+ * \page vListInitialiseItem vListInitialiseItem\r
+ * \ingroup LinkedList\r
+ */\r
+void vListInitialiseItem( ListItem_t * const pxItem ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Insert a list item into a list.  The item will be inserted into the list in\r
+ * a position determined by its item value (descending item value order).\r
+ *\r
+ * @param pxList The list into which the item is to be inserted.\r
+ *\r
+ * @param pxNewListItem The item that is to be placed in the list.\r
+ *\r
+ * \page vListInsert vListInsert\r
+ * \ingroup LinkedList\r
+ */\r
+void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Insert a list item into a list.  The item will be inserted in a position\r
+ * such that it will be the last item within the list returned by multiple\r
+ * calls to listGET_OWNER_OF_NEXT_ENTRY.\r
+ *\r
+ * The list member pvIndex is used to walk through a list.  Calling\r
+ * listGET_OWNER_OF_NEXT_ENTRY increments pvIndex to the next item in the list.\r
+ * Placing an item in a list using vListInsertEnd effectively places the item\r
+ * in the list position pointed to by pvIndex.  This means that every other\r
+ * item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before\r
+ * the pvIndex parameter again points to the item being inserted.\r
+ *\r
+ * @param pxList The list into which the item is to be inserted.\r
+ *\r
+ * @param pxNewListItem The list item to be inserted into the list.\r
+ *\r
+ * \page vListInsertEnd vListInsertEnd\r
+ * \ingroup LinkedList\r
+ */\r
+void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Remove an item from a list.  The list item has a pointer to the list that\r
+ * it is in, so only the list item need be passed into the function.\r
+ *\r
+ * @param uxListRemove The item to be removed.  The item will remove itself from\r
+ * the list pointed to by it's pxContainer parameter.\r
+ *\r
+ * @return The number of items that remain in the list after the list item has\r
+ * been removed.\r
+ *\r
+ * \page uxListRemove uxListRemove\r
+ * \ingroup LinkedList\r
+ */\r
+UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTION;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/mpu_wrappers.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/mpu_wrappers.h
new file mode 100644 (file)
index 0000000..b7073a9
--- /dev/null
@@ -0,0 +1,157 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef MPU_WRAPPERS_H\r
+#define MPU_WRAPPERS_H\r
+\r
+/* This file redefines API functions to be called through a wrapper macro, but\r
+only for ports that are using the MPU. */\r
+#ifdef portUSING_MPU_WRAPPERS\r
+\r
+       /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is\r
+       included from queue.c or task.c to prevent it from having an effect within\r
+       those files. */\r
+       #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+\r
+               #define xTaskGenericCreate                              MPU_xTaskGenericCreate\r
+               #define vTaskAllocateMPURegions                 MPU_vTaskAllocateMPURegions\r
+               #define vTaskDelete                                             MPU_vTaskDelete\r
+               #define vTaskDelayUntil                                 MPU_vTaskDelayUntil\r
+               #define vTaskDelay                                              MPU_vTaskDelay\r
+               #define uxTaskPriorityGet                               MPU_uxTaskPriorityGet\r
+               #define vTaskPrioritySet                                MPU_vTaskPrioritySet\r
+               #define eTaskGetState                                   MPU_eTaskGetState\r
+               #define vTaskSuspend                                    MPU_vTaskSuspend\r
+               #define vTaskResume                                             MPU_vTaskResume\r
+               #define vTaskSuspendAll                                 MPU_vTaskSuspendAll\r
+               #define xTaskResumeAll                                  MPU_xTaskResumeAll\r
+               #define xTaskGetTickCount                               MPU_xTaskGetTickCount\r
+               #define uxTaskGetNumberOfTasks                  MPU_uxTaskGetNumberOfTasks\r
+               #define vTaskList                                               MPU_vTaskList\r
+               #define vTaskGetRunTimeStats                    MPU_vTaskGetRunTimeStats\r
+               #define vTaskSetApplicationTaskTag              MPU_vTaskSetApplicationTaskTag\r
+               #define xTaskGetApplicationTaskTag              MPU_xTaskGetApplicationTaskTag\r
+               #define xTaskCallApplicationTaskHook    MPU_xTaskCallApplicationTaskHook\r
+               #define uxTaskGetStackHighWaterMark             MPU_uxTaskGetStackHighWaterMark\r
+               #define xTaskGetCurrentTaskHandle               MPU_xTaskGetCurrentTaskHandle\r
+               #define xTaskGetSchedulerState                  MPU_xTaskGetSchedulerState\r
+               #define xTaskGetIdleTaskHandle                  MPU_xTaskGetIdleTaskHandle\r
+               #define uxTaskGetSystemState                    MPU_uxTaskGetSystemState\r
+\r
+               #define xQueueGenericCreate                             MPU_xQueueGenericCreate\r
+               #define xQueueCreateMutex                               MPU_xQueueCreateMutex\r
+               #define xQueueGiveMutexRecursive                MPU_xQueueGiveMutexRecursive\r
+               #define xQueueTakeMutexRecursive                MPU_xQueueTakeMutexRecursive\r
+               #define xQueueCreateCountingSemaphore   MPU_xQueueCreateCountingSemaphore\r
+               #define xQueueGenericSend                               MPU_xQueueGenericSend\r
+               #define xQueueAltGenericSend                    MPU_xQueueAltGenericSend\r
+               #define xQueueAltGenericReceive                 MPU_xQueueAltGenericReceive\r
+               #define xQueueGenericReceive                    MPU_xQueueGenericReceive\r
+               #define uxQueueMessagesWaiting                  MPU_uxQueueMessagesWaiting\r
+               #define vQueueDelete                                    MPU_vQueueDelete\r
+               #define xQueueGenericReset                              MPU_xQueueGenericReset\r
+               #define xQueueCreateSet                                 MPU_xQueueCreateSet\r
+               #define xQueueSelectFromSet                             MPU_xQueueSelectFromSet\r
+               #define xQueueAddToSet                                  MPU_xQueueAddToSet\r
+               #define xQueueRemoveFromSet                             MPU_xQueueRemoveFromSet\r
+               #define xQueuePeekFromISR                               MPU_xQueuePeekFromISR\r
+               #define xQueueGetMutexHolder                    MPU_xQueueGetMutexHolder\r
+\r
+               #define pvPortMalloc                                    MPU_pvPortMalloc\r
+               #define vPortFree                                               MPU_vPortFree\r
+               #define xPortGetFreeHeapSize                    MPU_xPortGetFreeHeapSize\r
+               #define vPortInitialiseBlocks                   MPU_vPortInitialiseBlocks\r
+\r
+               #if configQUEUE_REGISTRY_SIZE > 0\r
+                       #define vQueueAddToRegistry                             MPU_vQueueAddToRegistry\r
+                       #define vQueueUnregisterQueue                   MPU_vQueueUnregisterQueue\r
+               #endif\r
+\r
+               /* Remove the privileged function macro. */\r
+               #define PRIVILEGED_FUNCTION\r
+\r
+       #else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */\r
+\r
+               /* Ensure API functions go in the privileged execution section. */\r
+               #define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))\r
+               #define PRIVILEGED_DATA __attribute__((section("privileged_data")))\r
+\r
+       #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */\r
+\r
+#else /* portUSING_MPU_WRAPPERS */\r
+\r
+       #define PRIVILEGED_FUNCTION\r
+       #define PRIVILEGED_DATA\r
+       #define portUSING_MPU_WRAPPERS 0\r
+\r
+#endif /* portUSING_MPU_WRAPPERS */\r
+\r
+\r
+#endif /* MPU_WRAPPERS_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/portable.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/portable.h
new file mode 100644 (file)
index 0000000..8e30301
--- /dev/null
@@ -0,0 +1,207 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+/*-----------------------------------------------------------\r
+ * Portable layer API.  Each function must be defined for each port.\r
+ *----------------------------------------------------------*/\r
+\r
+#ifndef PORTABLE_H\r
+#define PORTABLE_H\r
+\r
+/* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
+pre-processor definition was used to ensure the pre-processor found the correct\r
+portmacro.h file for the port being used.  That scheme was deprecated in favour\r
+of setting the compiler's include path such that it found the correct\r
+portmacro.h file - removing the need for the constant and allowing the\r
+portmacro.h file to be located anywhere in relation to the port being used.\r
+Purely for reasons of backward compatibility the old method is still valid, but\r
+to make it clear that new projects should not use it, support for the port\r
+specific constants has been moved into the deprecated_definitions.h header\r
+file. */\r
+#include "deprecated_definitions.h"\r
+\r
+/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h\r
+did not result in a portmacro.h header file being included - and it should be\r
+included here.  In this case the path to the correct portmacro.h header file\r
+must be set in the compiler's include path. */\r
+#ifndef portENTER_CRITICAL\r
+       #include "portmacro.h"\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 32\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x001f )\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 16\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x000f )\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 8\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x0007 )\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 4\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x0003 )\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 2\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x0001 )\r
+#endif\r
+\r
+#if portBYTE_ALIGNMENT == 1\r
+       #define portBYTE_ALIGNMENT_MASK ( 0x0000 )\r
+#endif\r
+\r
+#ifndef portBYTE_ALIGNMENT_MASK\r
+       #error "Invalid portBYTE_ALIGNMENT definition"\r
+#endif\r
+\r
+#ifndef portNUM_CONFIGURABLE_REGIONS\r
+       #define portNUM_CONFIGURABLE_REGIONS 1\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#include "mpu_wrappers.h"\r
+\r
+/*\r
+ * Setup the stack of a new task so it is ready to be placed under the\r
+ * scheduler control.  The registers have to be placed on the stack in\r
+ * the order that the port expects to find them.\r
+ *\r
+ */\r
+#if( portUSING_MPU_WRAPPERS == 1 )\r
+       StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;\r
+#else\r
+       StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+/* Used by heap_5.c. */\r
+typedef struct HeapRegion\r
+{\r
+       uint8_t *pucStartAddress;\r
+       size_t xSizeInBytes;\r
+} HeapRegion_t;\r
+\r
+/*\r
+ * Used to define multiple heap regions for use by heap_5.c.  This function\r
+ * must be called before any calls to pvPortMalloc() - not creating a task,\r
+ * queue, semaphore, mutex, software timer, event group, etc. will result in\r
+ * pvPortMalloc being called.\r
+ *\r
+ * pxHeapRegions passes in an array of HeapRegion_t structures - each of which\r
+ * defines a region of memory that can be used as the heap.  The array is\r
+ * terminated by a HeapRegions_t structure that has a size of 0.  The region\r
+ * with the lowest start address must appear first in the array.\r
+ */\r
+void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;\r
+\r
+\r
+/*\r
+ * Map to the memory management routines required for the port.\r
+ */\r
+void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;\r
+void vPortFree( void *pv ) PRIVILEGED_FUNCTION;\r
+void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;\r
+size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
+size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Setup the hardware ready for the scheduler to take control.  This generally\r
+ * sets up a tick interrupt and sets timers for the correct tick frequency.\r
+ */\r
+BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so\r
+ * the hardware is left in its original condition after the scheduler stops\r
+ * executing.\r
+ */\r
+void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * The structures and methods of manipulating the MPU are contained within the\r
+ * port layer.\r
+ *\r
+ * Fills the xMPUSettings structure with the memory region information\r
+ * contained in xRegions.\r
+ */\r
+#if( portUSING_MPU_WRAPPERS == 1 )\r
+       struct xMEMORY_REGION;\r
+       void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* PORTABLE_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/projdefs.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/projdefs.h
new file mode 100644 (file)
index 0000000..115d356
--- /dev/null
@@ -0,0 +1,156 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef PROJDEFS_H\r
+#define PROJDEFS_H\r
+\r
+/*\r
+ * Defines the prototype to which task functions must conform.  Defined in this\r
+ * file to ensure the type is known before portable.h is included.\r
+ */\r
+typedef void (*TaskFunction_t)( void * );\r
+\r
+/* Converts a time in milliseconds to a time in ticks. */\r
+#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )\r
+\r
+#define pdFALSE                        ( ( BaseType_t ) 0 )\r
+#define pdTRUE                 ( ( BaseType_t ) 1 )\r
+\r
+#define pdPASS                 ( pdTRUE )\r
+#define pdFAIL                 ( pdFALSE )\r
+#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )\r
+#define errQUEUE_FULL  ( ( BaseType_t ) 0 )\r
+\r
+/* FreeRTOS error definitions. */\r
+#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY  ( -1 )\r
+#define errQUEUE_BLOCKED                                               ( -4 )\r
+#define errQUEUE_YIELD                                                 ( -5 )\r
+\r
+/* Macros used for basic data corruption checks. */\r
+#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES\r
+       #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0\r
+#endif\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+       #define pdINTEGRITY_CHECK_VALUE 0x5a5a\r
+#else\r
+       #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL\r
+#endif\r
+\r
+/* The following errno values are used by FreeRTOS+ components, not FreeRTOS\r
+itself. */\r
+#define pdFREERTOS_ERRNO_NONE                  0       /* No errors */\r
+#define        pdFREERTOS_ERRNO_ENOENT                 2       /* No such file or directory */\r
+#define        pdFREERTOS_ERRNO_EIO                    5       /* I/O error */\r
+#define        pdFREERTOS_ERRNO_ENXIO                  6       /* No such device or address */\r
+#define        pdFREERTOS_ERRNO_EBADF                  9       /* Bad file number */\r
+#define        pdFREERTOS_ERRNO_EAGAIN                 11      /* No more processes */\r
+#define        pdFREERTOS_ERRNO_EWOULDBLOCK    11      /* Operation would block */\r
+#define        pdFREERTOS_ERRNO_ENOMEM                 12      /* Not enough memory */\r
+#define        pdFREERTOS_ERRNO_EACCES                 13      /* Permission denied */\r
+#define        pdFREERTOS_ERRNO_EFAULT                 14      /* Bad address */\r
+#define        pdFREERTOS_ERRNO_EBUSY                  16      /* Mount device busy */\r
+#define        pdFREERTOS_ERRNO_EEXIST                 17      /* File exists */\r
+#define        pdFREERTOS_ERRNO_EXDEV                  18      /* Cross-device link */\r
+#define        pdFREERTOS_ERRNO_ENODEV                 19      /* No such device */\r
+#define        pdFREERTOS_ERRNO_ENOTDIR                20      /* Not a directory */\r
+#define        pdFREERTOS_ERRNO_EISDIR                 21      /* Is a directory */\r
+#define        pdFREERTOS_ERRNO_EINVAL                 22      /* Invalid argument */\r
+#define        pdFREERTOS_ERRNO_ENOSPC                 28      /* No space left on device */\r
+#define        pdFREERTOS_ERRNO_ESPIPE                 29      /* Illegal seek */\r
+#define        pdFREERTOS_ERRNO_EROFS                  30      /* Read only file system */\r
+#define        pdFREERTOS_ERRNO_EUNATCH                42      /* Protocol driver not attached */\r
+#define        pdFREERTOS_ERRNO_EBADE                  50      /* Invalid exchange */\r
+#define        pdFREERTOS_ERRNO_EFTYPE                 79      /* Inappropriate file type or format */\r
+#define        pdFREERTOS_ERRNO_ENMFILE                89      /* No more files */\r
+#define        pdFREERTOS_ERRNO_ENOTEMPTY              90      /* Directory not empty */\r
+#define        pdFREERTOS_ERRNO_ENAMETOOLONG   91      /* File or path name too long */\r
+#define        pdFREERTOS_ERRNO_EOPNOTSUPP             95      /* Operation not supported on transport endpoint */\r
+#define        pdFREERTOS_ERRNO_ENOBUFS                105     /* No buffer space available */\r
+#define        pdFREERTOS_ERRNO_ENOPROTOOPT    109     /* Protocol not available */\r
+#define        pdFREERTOS_ERRNO_EADDRINUSE             112     /* Address already in use */\r
+#define        pdFREERTOS_ERRNO_ETIMEDOUT              116     /* Connection timed out */\r
+#define        pdFREERTOS_ERRNO_EINPROGRESS    119     /* Connection already in progress */\r
+#define        pdFREERTOS_ERRNO_EALREADY               120     /* Socket already connected */\r
+#define        pdFREERTOS_ERRNO_EADDRNOTAVAIL  125     /* Address not available */\r
+#define        pdFREERTOS_ERRNO_EISCONN                127     /* Socket is already connected */\r
+#define        pdFREERTOS_ERRNO_ENOTCONN               128     /* Socket is not connected */\r
+#define        pdFREERTOS_ERRNO_ENOMEDIUM              135     /* No medium inserted */\r
+#define        pdFREERTOS_ERRNO_EILSEQ                 138     /* An invalid UTF-16 sequence was encountered. */\r
+#define        pdFREERTOS_ERRNO_ECANCELED              140     /* Operation canceled. */\r
+\r
+/* The following endian values are used by FreeRTOS+ components, not FreeRTOS\r
+itself. */\r
+#define pdFREERTOS_LITTLE_ENDIAN       0\r
+#define pdFREERTOS_BIG_ENDIAN          1\r
+\r
+#endif /* PROJDEFS_H */\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/queue.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/queue.h
new file mode 100644 (file)
index 0000000..623497a
--- /dev/null
@@ -0,0 +1,1691 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+#ifndef QUEUE_H\r
+#define QUEUE_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h" must appear in source files before "include queue.h"\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/**\r
+ * Type by which queues are referenced.  For example, a call to xQueueCreate()\r
+ * returns an QueueHandle_t variable that can then be used as a parameter to\r
+ * xQueueSend(), xQueueReceive(), etc.\r
+ */\r
+typedef void * QueueHandle_t;\r
+\r
+/**\r
+ * Type by which queue sets are referenced.  For example, a call to\r
+ * xQueueCreateSet() returns an xQueueSet variable that can then be used as a\r
+ * parameter to xQueueSelectFromSet(), xQueueAddToSet(), etc.\r
+ */\r
+typedef void * QueueSetHandle_t;\r
+\r
+/**\r
+ * Queue sets can contain both queues and semaphores, so the\r
+ * QueueSetMemberHandle_t is defined as a type to be used where a parameter or\r
+ * return value can be either an QueueHandle_t or an SemaphoreHandle_t.\r
+ */\r
+typedef void * QueueSetMemberHandle_t;\r
+\r
+/* For internal use only. */\r
+#define        queueSEND_TO_BACK               ( ( BaseType_t ) 0 )\r
+#define        queueSEND_TO_FRONT              ( ( BaseType_t ) 1 )\r
+#define queueOVERWRITE                 ( ( BaseType_t ) 2 )\r
+\r
+/* For internal use only.  These definitions *must* match those in queue.c. */\r
+#define queueQUEUE_TYPE_BASE                           ( ( uint8_t ) 0U )\r
+#define queueQUEUE_TYPE_SET                                    ( ( uint8_t ) 0U )\r
+#define queueQUEUE_TYPE_MUTEX                          ( ( uint8_t ) 1U )\r
+#define queueQUEUE_TYPE_COUNTING_SEMAPHORE     ( ( uint8_t ) 2U )\r
+#define queueQUEUE_TYPE_BINARY_SEMAPHORE       ( ( uint8_t ) 3U )\r
+#define queueQUEUE_TYPE_RECURSIVE_MUTEX                ( ( uint8_t ) 4U )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ QueueHandle_t xQueueCreate(\r
+                                                         UBaseType_t uxQueueLength,\r
+                                                         UBaseType_t uxItemSize\r
+                                                 );\r
+ * </pre>\r
+ *\r
+ * Creates a new queue instance.  This allocates the storage required by the\r
+ * new queue and returns a handle for the queue.\r
+ *\r
+ * @param uxQueueLength The maximum number of items that the queue can contain.\r
+ *\r
+ * @param uxItemSize The number of bytes each item in the queue will require.\r
+ * Items are queued by copy, not by reference, so this is the number of bytes\r
+ * that will be copied for each posted item.  Each item on the queue must be\r
+ * the same size.\r
+ *\r
+ * @return If the queue is successfully create then a handle to the newly\r
+ * created queue is returned.  If the queue cannot be created then 0 is\r
+ * returned.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ };\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1, xQueue2;\r
+\r
+       // Create a queue capable of containing 10 uint32_t values.\r
+       xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );\r
+       if( xQueue1 == 0 )\r
+       {\r
+               // Queue was not created and must not be used.\r
+       }\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+       if( xQueue2 == 0 )\r
+       {\r
+               // Queue was not created and must not be used.\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueCreate xQueueCreate\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueCreate( uxQueueLength, uxItemSize ) xQueueGenericCreate( uxQueueLength, uxItemSize, queueQUEUE_TYPE_BASE )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSendToToFront(\r
+                                                                  QueueHandle_t        xQueue,\r
+                                                                  const void           *pvItemToQueue,\r
+                                                                  TickType_t           xTicksToWait\r
+                                                          );\r
+ * </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSend().\r
+ *\r
+ * Post an item to the front of a queue.  The item is queued by copy, not by\r
+ * reference.  This function must not be called from an interrupt service\r
+ * routine.  See xQueueSendFromISR () for an alternative which may be used\r
+ * in an ISR.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for space to become available on the queue, should it already\r
+ * be full.  The call will return immediately if this is set to 0 and the\r
+ * queue is full.  The time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ *\r
+ * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ uint32_t ulVar = 10UL;\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1, xQueue2;\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 uint32_t values.\r
+       xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+\r
+       // ...\r
+\r
+       if( xQueue1 != 0 )\r
+       {\r
+               // Send an uint32_t.  Wait for 10 ticks for space to become\r
+               // available if necessary.\r
+               if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )\r
+               {\r
+                       // Failed to post the message, even after 10 ticks.\r
+               }\r
+       }\r
+\r
+       if( xQueue2 != 0 )\r
+       {\r
+               // Send a pointer to a struct AMessage object.  Don't block if the\r
+               // queue is already full.\r
+               pxMessage = & xMessage;\r
+               xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueSend xQueueSend\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSendToBack(\r
+                                                                  QueueHandle_t        xQueue,\r
+                                                                  const void           *pvItemToQueue,\r
+                                                                  TickType_t           xTicksToWait\r
+                                                          );\r
+ * </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSend().\r
+ *\r
+ * Post an item to the back of a queue.  The item is queued by copy, not by\r
+ * reference.  This function must not be called from an interrupt service\r
+ * routine.  See xQueueSendFromISR () for an alternative which may be used\r
+ * in an ISR.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for space to become available on the queue, should it already\r
+ * be full.  The call will return immediately if this is set to 0 and the queue\r
+ * is full.  The  time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ *\r
+ * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ uint32_t ulVar = 10UL;\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1, xQueue2;\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 uint32_t values.\r
+       xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+\r
+       // ...\r
+\r
+       if( xQueue1 != 0 )\r
+       {\r
+               // Send an uint32_t.  Wait for 10 ticks for space to become\r
+               // available if necessary.\r
+               if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )\r
+               {\r
+                       // Failed to post the message, even after 10 ticks.\r
+               }\r
+       }\r
+\r
+       if( xQueue2 != 0 )\r
+       {\r
+               // Send a pointer to a struct AMessage object.  Don't block if the\r
+               // queue is already full.\r
+               pxMessage = & xMessage;\r
+               xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueSend xQueueSend\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSend(\r
+                                                         QueueHandle_t xQueue,\r
+                                                         const void * pvItemToQueue,\r
+                                                         TickType_t xTicksToWait\r
+                                                );\r
+ * </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSend().  It is included for\r
+ * backward compatibility with versions of FreeRTOS.org that did not\r
+ * include the xQueueSendToFront() and xQueueSendToBack() macros.  It is\r
+ * equivalent to xQueueSendToBack().\r
+ *\r
+ * Post an item on a queue.  The item is queued by copy, not by reference.\r
+ * This function must not be called from an interrupt service routine.\r
+ * See xQueueSendFromISR () for an alternative which may be used in an ISR.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for space to become available on the queue, should it already\r
+ * be full.  The call will return immediately if this is set to 0 and the\r
+ * queue is full.  The time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ *\r
+ * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ uint32_t ulVar = 10UL;\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1, xQueue2;\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 uint32_t values.\r
+       xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+\r
+       // ...\r
+\r
+       if( xQueue1 != 0 )\r
+       {\r
+               // Send an uint32_t.  Wait for 10 ticks for space to become\r
+               // available if necessary.\r
+               if( xQueueSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )\r
+               {\r
+                       // Failed to post the message, even after 10 ticks.\r
+               }\r
+       }\r
+\r
+       if( xQueue2 != 0 )\r
+       {\r
+               // Send a pointer to a struct AMessage object.  Don't block if the\r
+               // queue is already full.\r
+               pxMessage = & xMessage;\r
+               xQueueSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueSend xQueueSend\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSend( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueOverwrite(\r
+                                                         QueueHandle_t xQueue,\r
+                                                         const void * pvItemToQueue\r
+                                                );\r
+ * </pre>\r
+ *\r
+ * Only for use with queues that have a length of one - so the queue is either\r
+ * empty or full.\r
+ *\r
+ * Post an item on a queue.  If the queue is already full then overwrite the\r
+ * value held in the queue.  The item is queued by copy, not by reference.\r
+ *\r
+ * This function must not be called from an interrupt service routine.\r
+ * See xQueueOverwriteFromISR () for an alternative which may be used in an ISR.\r
+ *\r
+ * @param xQueue The handle of the queue to which the data is being sent.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @return xQueueOverwrite() is a macro that calls xQueueGenericSend(), and\r
+ * therefore has the same return values as xQueueSendToFront().  However, pdPASS\r
+ * is the only value that can be returned because xQueueOverwrite() will write\r
+ * to the queue even when the queue is already full.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+\r
+ void vFunction( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue;\r
+ uint32_t ulVarToSend, ulValReceived;\r
+\r
+       // Create a queue to hold one uint32_t value.  It is strongly\r
+       // recommended *not* to use xQueueOverwrite() on queues that can\r
+       // contain more than one value, and doing so will trigger an assertion\r
+       // if configASSERT() is defined.\r
+       xQueue = xQueueCreate( 1, sizeof( uint32_t ) );\r
+\r
+       // Write the value 10 to the queue using xQueueOverwrite().\r
+       ulVarToSend = 10;\r
+       xQueueOverwrite( xQueue, &ulVarToSend );\r
+\r
+       // Peeking the queue should now return 10, but leave the value 10 in\r
+       // the queue.  A block time of zero is used as it is known that the\r
+       // queue holds a value.\r
+       ulValReceived = 0;\r
+       xQueuePeek( xQueue, &ulValReceived, 0 );\r
+\r
+       if( ulValReceived != 10 )\r
+       {\r
+               // Error unless the item was removed by a different task.\r
+       }\r
+\r
+       // The queue is still full.  Use xQueueOverwrite() to overwrite the\r
+       // value held in the queue with 100.\r
+       ulVarToSend = 100;\r
+       xQueueOverwrite( xQueue, &ulVarToSend );\r
+\r
+       // This time read from the queue, leaving the queue empty once more.\r
+       // A block time of 0 is used again.\r
+       xQueueReceive( xQueue, &ulValReceived, 0 );\r
+\r
+       // The value read should be the last value written, even though the\r
+       // queue was already full when the value was written.\r
+       if( ulValReceived != 100 )\r
+       {\r
+               // Error!\r
+       }\r
+\r
+       // ...\r
+}\r
+ </pre>\r
+ * \defgroup xQueueOverwrite xQueueOverwrite\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueOverwrite( xQueue, pvItemToQueue ) xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), 0, queueOVERWRITE )\r
+\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueGenericSend(\r
+                                                                       QueueHandle_t xQueue,\r
+                                                                       const void * pvItemToQueue,\r
+                                                                       TickType_t xTicksToWait\r
+                                                                       BaseType_t xCopyPosition\r
+                                                               );\r
+ * </pre>\r
+ *\r
+ * It is preferred that the macros xQueueSend(), xQueueSendToFront() and\r
+ * xQueueSendToBack() are used in place of calling this function directly.\r
+ *\r
+ * Post an item on a queue.  The item is queued by copy, not by reference.\r
+ * This function must not be called from an interrupt service routine.\r
+ * See xQueueSendFromISR () for an alternative which may be used in an ISR.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for space to become available on the queue, should it already\r
+ * be full.  The call will return immediately if this is set to 0 and the\r
+ * queue is full.  The time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ *\r
+ * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the\r
+ * item at the back of the queue, or queueSEND_TO_FRONT to place the item\r
+ * at the front of the queue (for high priority messages).\r
+ *\r
+ * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ uint32_t ulVar = 10UL;\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1, xQueue2;\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 uint32_t values.\r
+       xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+\r
+       // ...\r
+\r
+       if( xQueue1 != 0 )\r
+       {\r
+               // Send an uint32_t.  Wait for 10 ticks for space to become\r
+               // available if necessary.\r
+               if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10, queueSEND_TO_BACK ) != pdPASS )\r
+               {\r
+                       // Failed to post the message, even after 10 ticks.\r
+               }\r
+       }\r
+\r
+       if( xQueue2 != 0 )\r
+       {\r
+               // Send a pointer to a struct AMessage object.  Don't block if the\r
+               // queue is already full.\r
+               pxMessage = & xMessage;\r
+               xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0, queueSEND_TO_BACK );\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueSend xQueueSend\r
+ * \ingroup QueueManagement\r
+ */\r
+BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueuePeek(\r
+                                                        QueueHandle_t xQueue,\r
+                                                        void *pvBuffer,\r
+                                                        TickType_t xTicksToWait\r
+                                                );</pre>\r
+ *\r
+ * This is a macro that calls the xQueueGenericReceive() function.\r
+ *\r
+ * Receive an item from a queue without removing the item from the queue.\r
+ * The item is received by copy so a buffer of adequate size must be\r
+ * provided.  The number of bytes copied into the buffer was defined when\r
+ * the queue was created.\r
+ *\r
+ * Successfully received items remain on the queue so will be returned again\r
+ * by the next call, or a call to xQueueReceive().\r
+ *\r
+ * This macro must not be used in an interrupt service routine.  See\r
+ * xQueuePeekFromISR() for an alternative that can be called from an interrupt\r
+ * service routine.\r
+ *\r
+ * @param xQueue The handle to the queue from which the item is to be\r
+ * received.\r
+ *\r
+ * @param pvBuffer Pointer to the buffer into which the received item will\r
+ * be copied.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for an item to receive should the queue be empty at the time\r
+ * of the call.         The time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ * xQueuePeek() will return immediately if xTicksToWait is 0 and the queue\r
+ * is empty.\r
+ *\r
+ * @return pdTRUE if an item was successfully received from the queue,\r
+ * otherwise pdFALSE.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ QueueHandle_t xQueue;\r
+\r
+ // Task to create a queue and post a value.\r
+ void vATask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+       if( xQueue == 0 )\r
+       {\r
+               // Failed to create the queue.\r
+       }\r
+\r
+       // ...\r
+\r
+       // Send a pointer to a struct AMessage object.  Don't block if the\r
+       // queue is already full.\r
+       pxMessage = & xMessage;\r
+       xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+\r
+       // ... Rest of task code.\r
+ }\r
+\r
+ // Task to peek the data from the queue.\r
+ void vADifferentTask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxRxedMessage;\r
+\r
+       if( xQueue != 0 )\r
+       {\r
+               // Peek a message on the created queue.  Block for 10 ticks if a\r
+               // message is not immediately available.\r
+               if( xQueuePeek( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )\r
+               {\r
+                       // pcRxedMessage now points to the struct AMessage variable posted\r
+                       // by vATask, but the item still remains on the queue.\r
+               }\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueReceive xQueueReceive\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueuePeek( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdTRUE )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueuePeekFromISR(\r
+                                                                       QueueHandle_t xQueue,\r
+                                                                       void *pvBuffer,\r
+                                                               );</pre>\r
+ *\r
+ * A version of xQueuePeek() that can be called from an interrupt service\r
+ * routine (ISR).\r
+ *\r
+ * Receive an item from a queue without removing the item from the queue.\r
+ * The item is received by copy so a buffer of adequate size must be\r
+ * provided.  The number of bytes copied into the buffer was defined when\r
+ * the queue was created.\r
+ *\r
+ * Successfully received items remain on the queue so will be returned again\r
+ * by the next call, or a call to xQueueReceive().\r
+ *\r
+ * @param xQueue The handle to the queue from which the item is to be\r
+ * received.\r
+ *\r
+ * @param pvBuffer Pointer to the buffer into which the received item will\r
+ * be copied.\r
+ *\r
+ * @return pdTRUE if an item was successfully received from the queue,\r
+ * otherwise pdFALSE.\r
+ *\r
+ * \defgroup xQueuePeekFromISR xQueuePeekFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueReceive(\r
+                                                                QueueHandle_t xQueue,\r
+                                                                void *pvBuffer,\r
+                                                                TickType_t xTicksToWait\r
+                                                       );</pre>\r
+ *\r
+ * This is a macro that calls the xQueueGenericReceive() function.\r
+ *\r
+ * Receive an item from a queue.  The item is received by copy so a buffer of\r
+ * adequate size must be provided.  The number of bytes copied into the buffer\r
+ * was defined when the queue was created.\r
+ *\r
+ * Successfully received items are removed from the queue.\r
+ *\r
+ * This function must not be used in an interrupt service routine.  See\r
+ * xQueueReceiveFromISR for an alternative that can.\r
+ *\r
+ * @param xQueue The handle to the queue from which the item is to be\r
+ * received.\r
+ *\r
+ * @param pvBuffer Pointer to the buffer into which the received item will\r
+ * be copied.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for an item to receive should the queue be empty at the time\r
+ * of the call.         xQueueReceive() will return immediately if xTicksToWait\r
+ * is zero and the queue is empty.  The time is defined in tick periods so the\r
+ * constant portTICK_PERIOD_MS should be used to convert to real time if this is\r
+ * required.\r
+ *\r
+ * @return pdTRUE if an item was successfully received from the queue,\r
+ * otherwise pdFALSE.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ QueueHandle_t xQueue;\r
+\r
+ // Task to create a queue and post a value.\r
+ void vATask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+       if( xQueue == 0 )\r
+       {\r
+               // Failed to create the queue.\r
+       }\r
+\r
+       // ...\r
+\r
+       // Send a pointer to a struct AMessage object.  Don't block if the\r
+       // queue is already full.\r
+       pxMessage = & xMessage;\r
+       xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+\r
+       // ... Rest of task code.\r
+ }\r
+\r
+ // Task to receive from the queue.\r
+ void vADifferentTask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxRxedMessage;\r
+\r
+       if( xQueue != 0 )\r
+       {\r
+               // Receive a message on the created queue.  Block for 10 ticks if a\r
+               // message is not immediately available.\r
+               if( xQueueReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )\r
+               {\r
+                       // pcRxedMessage now points to the struct AMessage variable posted\r
+                       // by vATask.\r
+               }\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueReceive xQueueReceive\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueReceive( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )\r
+\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueGenericReceive(\r
+                                                                          QueueHandle_t        xQueue,\r
+                                                                          void *pvBuffer,\r
+                                                                          TickType_t   xTicksToWait\r
+                                                                          BaseType_t   xJustPeek\r
+                                                                       );</pre>\r
+ *\r
+ * It is preferred that the macro xQueueReceive() be used rather than calling\r
+ * this function directly.\r
+ *\r
+ * Receive an item from a queue.  The item is received by copy so a buffer of\r
+ * adequate size must be provided.  The number of bytes copied into the buffer\r
+ * was defined when the queue was created.\r
+ *\r
+ * This function must not be used in an interrupt service routine.  See\r
+ * xQueueReceiveFromISR for an alternative that can.\r
+ *\r
+ * @param xQueue The handle to the queue from which the item is to be\r
+ * received.\r
+ *\r
+ * @param pvBuffer Pointer to the buffer into which the received item will\r
+ * be copied.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time the task should block\r
+ * waiting for an item to receive should the queue be empty at the time\r
+ * of the call.         The time is defined in tick periods so the constant\r
+ * portTICK_PERIOD_MS should be used to convert to real time if this is required.\r
+ * xQueueGenericReceive() will return immediately if the queue is empty and\r
+ * xTicksToWait is 0.\r
+ *\r
+ * @param xJustPeek When set to true, the item received from the queue is not\r
+ * actually removed from the queue - meaning a subsequent call to\r
+ * xQueueReceive() will return the same item.  When set to false, the item\r
+ * being received from the queue is also removed from the queue.\r
+ *\r
+ * @return pdTRUE if an item was successfully received from the queue,\r
+ * otherwise pdFALSE.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ struct AMessage\r
+ {\r
+       char ucMessageID;\r
+       char ucData[ 20 ];\r
+ } xMessage;\r
+\r
+ QueueHandle_t xQueue;\r
+\r
+ // Task to create a queue and post a value.\r
+ void vATask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxMessage;\r
+\r
+       // Create a queue capable of containing 10 pointers to AMessage structures.\r
+       // These should be passed by pointer as they contain a lot of data.\r
+       xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
+       if( xQueue == 0 )\r
+       {\r
+               // Failed to create the queue.\r
+       }\r
+\r
+       // ...\r
+\r
+       // Send a pointer to a struct AMessage object.  Don't block if the\r
+       // queue is already full.\r
+       pxMessage = & xMessage;\r
+       xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );\r
+\r
+       // ... Rest of task code.\r
+ }\r
+\r
+ // Task to receive from the queue.\r
+ void vADifferentTask( void *pvParameters )\r
+ {\r
+ struct AMessage *pxRxedMessage;\r
+\r
+       if( xQueue != 0 )\r
+       {\r
+               // Receive a message on the created queue.  Block for 10 ticks if a\r
+               // message is not immediately available.\r
+               if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )\r
+               {\r
+                       // pcRxedMessage now points to the struct AMessage variable posted\r
+                       // by vATask.\r
+               }\r
+       }\r
+\r
+       // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueReceive xQueueReceive\r
+ * \ingroup QueueManagement\r
+ */\r
+BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeek ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue );</pre>\r
+ *\r
+ * Return the number of messages stored in a queue.\r
+ *\r
+ * @param xQueue A handle to the queue being queried.\r
+ *\r
+ * @return The number of messages available in the queue.\r
+ *\r
+ * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting\r
+ * \ingroup QueueManagement\r
+ */\r
+UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue );</pre>\r
+ *\r
+ * Return the number of free spaces available in a queue.  This is equal to the\r
+ * number of items that can be sent to the queue before the queue becomes full\r
+ * if no items are removed.\r
+ *\r
+ * @param xQueue A handle to the queue being queried.\r
+ *\r
+ * @return The number of spaces available in the queue.\r
+ *\r
+ * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting\r
+ * \ingroup QueueManagement\r
+ */\r
+UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>void vQueueDelete( QueueHandle_t xQueue );</pre>\r
+ *\r
+ * Delete a queue - freeing all the memory allocated for storing of items\r
+ * placed on the queue.\r
+ *\r
+ * @param xQueue A handle to the queue to be deleted.\r
+ *\r
+ * \defgroup vQueueDelete vQueueDelete\r
+ * \ingroup QueueManagement\r
+ */\r
+void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSendToFrontFromISR(\r
+                                                                                QueueHandle_t xQueue,\r
+                                                                                const void *pvItemToQueue,\r
+                                                                                BaseType_t *pxHigherPriorityTaskWoken\r
+                                                                         );\r
+ </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSendFromISR().\r
+ *\r
+ * Post an item to the front of a queue.  It is safe to use this macro from\r
+ * within an interrupt service routine.\r
+ *\r
+ * Items are queued by copy not reference so it is preferable to only\r
+ * queue small items, especially when called from an ISR.  In most cases\r
+ * it would be preferable to store a pointer to the item being queued.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xQueueSendToFromFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
+ *\r
+ * Example usage for buffered IO (where the ISR can obtain more than one value\r
+ * per call):\r
+   <pre>\r
+ void vBufferISR( void )\r
+ {\r
+ char cIn;\r
+ BaseType_t xHigherPrioritTaskWoken;\r
+\r
+       // We have not woken a task at the start of the ISR.\r
+       xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       // Loop until the buffer is empty.\r
+       do\r
+       {\r
+               // Obtain a byte from the buffer.\r
+               cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );\r
+\r
+               // Post the byte.\r
+               xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
+\r
+       } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
+\r
+       // Now the buffer is empty we can switch context if necessary.\r
+       if( xHigherPriorityTaskWoken )\r
+       {\r
+               taskYIELD ();\r
+       }\r
+ }\r
+ </pre>\r
+ *\r
+ * \defgroup xQueueSendFromISR xQueueSendFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSendToFrontFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_FRONT )\r
+\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSendToBackFromISR(\r
+                                                                                QueueHandle_t xQueue,\r
+                                                                                const void *pvItemToQueue,\r
+                                                                                BaseType_t *pxHigherPriorityTaskWoken\r
+                                                                         );\r
+ </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSendFromISR().\r
+ *\r
+ * Post an item to the back of a queue.  It is safe to use this macro from\r
+ * within an interrupt service routine.\r
+ *\r
+ * Items are queued by copy not reference so it is preferable to only\r
+ * queue small items, especially when called from an ISR.  In most cases\r
+ * it would be preferable to store a pointer to the item being queued.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xQueueSendToBackFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xQueueSendToBackFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
+ *\r
+ * Example usage for buffered IO (where the ISR can obtain more than one value\r
+ * per call):\r
+   <pre>\r
+ void vBufferISR( void )\r
+ {\r
+ char cIn;\r
+ BaseType_t xHigherPriorityTaskWoken;\r
+\r
+       // We have not woken a task at the start of the ISR.\r
+       xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       // Loop until the buffer is empty.\r
+       do\r
+       {\r
+               // Obtain a byte from the buffer.\r
+               cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );\r
+\r
+               // Post the byte.\r
+               xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
+\r
+       } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
+\r
+       // Now the buffer is empty we can switch context if necessary.\r
+       if( xHigherPriorityTaskWoken )\r
+       {\r
+               taskYIELD ();\r
+       }\r
+ }\r
+ </pre>\r
+ *\r
+ * \defgroup xQueueSendFromISR xQueueSendFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSendToBackFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueOverwriteFromISR(\r
+                                                         QueueHandle_t xQueue,\r
+                                                         const void * pvItemToQueue,\r
+                                                         BaseType_t *pxHigherPriorityTaskWoken\r
+                                                );\r
+ * </pre>\r
+ *\r
+ * A version of xQueueOverwrite() that can be used in an interrupt service\r
+ * routine (ISR).\r
+ *\r
+ * Only for use with queues that can hold a single item - so the queue is either\r
+ * empty or full.\r
+ *\r
+ * Post an item on a queue.  If the queue is already full then overwrite the\r
+ * value held in the queue.  The item is queued by copy, not by reference.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xQueueOverwriteFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xQueueOverwriteFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return xQueueOverwriteFromISR() is a macro that calls\r
+ * xQueueGenericSendFromISR(), and therefore has the same return values as\r
+ * xQueueSendToFrontFromISR().  However, pdPASS is the only value that can be\r
+ * returned because xQueueOverwriteFromISR() will write to the queue even when\r
+ * the queue is already full.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+\r
+ QueueHandle_t xQueue;\r
+\r
+ void vFunction( void *pvParameters )\r
+ {\r
+       // Create a queue to hold one uint32_t value.  It is strongly\r
+       // recommended *not* to use xQueueOverwriteFromISR() on queues that can\r
+       // contain more than one value, and doing so will trigger an assertion\r
+       // if configASSERT() is defined.\r
+       xQueue = xQueueCreate( 1, sizeof( uint32_t ) );\r
+}\r
+\r
+void vAnInterruptHandler( void )\r
+{\r
+// xHigherPriorityTaskWoken must be set to pdFALSE before it is used.\r
+BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+uint32_t ulVarToSend, ulValReceived;\r
+\r
+       // Write the value 10 to the queue using xQueueOverwriteFromISR().\r
+       ulVarToSend = 10;\r
+       xQueueOverwriteFromISR( xQueue, &ulVarToSend, &xHigherPriorityTaskWoken );\r
+\r
+       // The queue is full, but calling xQueueOverwriteFromISR() again will still\r
+       // pass because the value held in the queue will be overwritten with the\r
+       // new value.\r
+       ulVarToSend = 100;\r
+       xQueueOverwriteFromISR( xQueue, &ulVarToSend, &xHigherPriorityTaskWoken );\r
+\r
+       // Reading from the queue will now return 100.\r
+\r
+       // ...\r
+\r
+       if( xHigherPrioritytaskWoken == pdTRUE )\r
+       {\r
+               // Writing to the queue caused a task to unblock and the unblocked task\r
+               // has a priority higher than or equal to the priority of the currently\r
+               // executing task (the task this interrupt interrupted).  Perform a context\r
+               // switch so this interrupt returns directly to the unblocked task.\r
+               portYIELD_FROM_ISR(); // or portEND_SWITCHING_ISR() depending on the port.\r
+       }\r
+}\r
+ </pre>\r
+ * \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueOverwriteFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueOVERWRITE )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueSendFromISR(\r
+                                                                        QueueHandle_t xQueue,\r
+                                                                        const void *pvItemToQueue,\r
+                                                                        BaseType_t *pxHigherPriorityTaskWoken\r
+                                                               );\r
+ </pre>\r
+ *\r
+ * This is a macro that calls xQueueGenericSendFromISR().  It is included\r
+ * for backward compatibility with versions of FreeRTOS.org that did not\r
+ * include the xQueueSendToBackFromISR() and xQueueSendToFrontFromISR()\r
+ * macros.\r
+ *\r
+ * Post an item to the back of a queue.  It is safe to use this function from\r
+ * within an interrupt service routine.\r
+ *\r
+ * Items are queued by copy not reference so it is preferable to only\r
+ * queue small items, especially when called from an ISR.  In most cases\r
+ * it would be preferable to store a pointer to the item being queued.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xQueueSendFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xQueueSendFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
+ *\r
+ * Example usage for buffered IO (where the ISR can obtain more than one value\r
+ * per call):\r
+   <pre>\r
+ void vBufferISR( void )\r
+ {\r
+ char cIn;\r
+ BaseType_t xHigherPriorityTaskWoken;\r
+\r
+       // We have not woken a task at the start of the ISR.\r
+       xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       // Loop until the buffer is empty.\r
+       do\r
+       {\r
+               // Obtain a byte from the buffer.\r
+               cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );\r
+\r
+               // Post the byte.\r
+               xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
+\r
+       } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
+\r
+       // Now the buffer is empty we can switch context if necessary.\r
+       if( xHigherPriorityTaskWoken )\r
+       {\r
+               // Actual macro used here is port specific.\r
+               portYIELD_FROM_ISR ();\r
+       }\r
+ }\r
+ </pre>\r
+ *\r
+ * \defgroup xQueueSendFromISR xQueueSendFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+#define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueGenericSendFromISR(\r
+                                                                                  QueueHandle_t                xQueue,\r
+                                                                                  const        void    *pvItemToQueue,\r
+                                                                                  BaseType_t   *pxHigherPriorityTaskWoken,\r
+                                                                                  BaseType_t   xCopyPosition\r
+                                                                          );\r
+ </pre>\r
+ *\r
+ * It is preferred that the macros xQueueSendFromISR(),\r
+ * xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place\r
+ * of calling this function directly.  xQueueGiveFromISR() is an\r
+ * equivalent for use by semaphores that don't actually copy any data.\r
+ *\r
+ * Post an item on a queue.  It is safe to use this function from within an\r
+ * interrupt service routine.\r
+ *\r
+ * Items are queued by copy not reference so it is preferable to only\r
+ * queue small items, especially when called from an ISR.  In most cases\r
+ * it would be preferable to store a pointer to the item being queued.\r
+ *\r
+ * @param xQueue The handle to the queue on which the item is to be posted.\r
+ *\r
+ * @param pvItemToQueue A pointer to the item that is to be placed on the\r
+ * queue.  The size of the items the queue will hold was defined when the\r
+ * queue was created, so this many bytes will be copied from pvItemToQueue\r
+ * into the queue storage area.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xQueueGenericSendFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xQueueGenericSendFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the\r
+ * item at the back of the queue, or queueSEND_TO_FRONT to place the item\r
+ * at the front of the queue (for high priority messages).\r
+ *\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
+ *\r
+ * Example usage for buffered IO (where the ISR can obtain more than one value\r
+ * per call):\r
+   <pre>\r
+ void vBufferISR( void )\r
+ {\r
+ char cIn;\r
+ BaseType_t xHigherPriorityTaskWokenByPost;\r
+\r
+       // We have not woken a task at the start of the ISR.\r
+       xHigherPriorityTaskWokenByPost = pdFALSE;\r
+\r
+       // Loop until the buffer is empty.\r
+       do\r
+       {\r
+               // Obtain a byte from the buffer.\r
+               cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );\r
+\r
+               // Post each byte.\r
+               xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK );\r
+\r
+       } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
+\r
+       // Now the buffer is empty we can switch context if necessary.  Note that the\r
+       // name of the yield function required is port specific.\r
+       if( xHigherPriorityTaskWokenByPost )\r
+       {\r
+               taskYIELD_YIELD_FROM_ISR();\r
+       }\r
+ }\r
+ </pre>\r
+ *\r
+ * \defgroup xQueueSendFromISR xQueueSendFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ BaseType_t xQueueReceiveFromISR(\r
+                                                                          QueueHandle_t        xQueue,\r
+                                                                          void *pvBuffer,\r
+                                                                          BaseType_t *pxTaskWoken\r
+                                                                  );\r
+ * </pre>\r
+ *\r
+ * Receive an item from a queue.  It is safe to use this function from within an\r
+ * interrupt service routine.\r
+ *\r
+ * @param xQueue The handle to the queue from which the item is to be\r
+ * received.\r
+ *\r
+ * @param pvBuffer Pointer to the buffer into which the received item will\r
+ * be copied.\r
+ *\r
+ * @param pxTaskWoken A task may be blocked waiting for space to become\r
+ * available on the queue.  If xQueueReceiveFromISR causes such a task to\r
+ * unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will\r
+ * remain unchanged.\r
+ *\r
+ * @return pdTRUE if an item was successfully received from the queue,\r
+ * otherwise pdFALSE.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+\r
+ QueueHandle_t xQueue;\r
+\r
+ // Function to create a queue and post some values.\r
+ void vAFunction( void *pvParameters )\r
+ {\r
+ char cValueToPost;\r
+ const TickType_t xTicksToWait = ( TickType_t )0xff;\r
+\r
+       // Create a queue capable of containing 10 characters.\r
+       xQueue = xQueueCreate( 10, sizeof( char ) );\r
+       if( xQueue == 0 )\r
+       {\r
+               // Failed to create the queue.\r
+       }\r
+\r
+       // ...\r
+\r
+       // Post some characters that will be used within an ISR.  If the queue\r
+       // is full then this task will block for xTicksToWait ticks.\r
+       cValueToPost = 'a';\r
+       xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );\r
+       cValueToPost = 'b';\r
+       xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );\r
+\r
+       // ... keep posting characters ... this task may block when the queue\r
+       // becomes full.\r
+\r
+       cValueToPost = 'c';\r
+       xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );\r
+ }\r
+\r
+ // ISR that outputs all the characters received on the queue.\r
+ void vISR_Routine( void )\r
+ {\r
+ BaseType_t xTaskWokenByReceive = pdFALSE;\r
+ char cRxedChar;\r
+\r
+       while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) )\r
+       {\r
+               // A character was received.  Output the character now.\r
+               vOutputCharacter( cRxedChar );\r
+\r
+               // If removing the character from the queue woke the task that was\r
+               // posting onto the queue cTaskWokenByReceive will have been set to\r
+               // pdTRUE.  No matter how many times this loop iterates only one\r
+               // task will be woken.\r
+       }\r
+\r
+       if( cTaskWokenByPost != ( char ) pdFALSE;\r
+       {\r
+               taskYIELD ();\r
+       }\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR\r
+ * \ingroup QueueManagement\r
+ */\r
+BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Utilities to query queues that are safe to use from an ISR.  These utilities\r
+ * should be used only from witin an ISR, or within a critical section.\r
+ */\r
+BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+\r
+\r
+/*\r
+ * xQueueAltGenericSend() is an alternative version of xQueueGenericSend().\r
+ * Likewise xQueueAltGenericReceive() is an alternative version of\r
+ * xQueueGenericReceive().\r
+ *\r
+ * The source code that implements the alternative (Alt) API is much\r
+ * simpler     because it executes everything from within a critical section.\r
+ * This is     the approach taken by many other RTOSes, but FreeRTOS.org has the\r
+ * preferred fully featured API too.  The fully featured API has more\r
+ * complex     code that takes longer to execute, but makes much less use of\r
+ * critical sections.  Therefore the alternative API sacrifices interrupt\r
+ * responsiveness to gain execution speed, whereas the fully featured API\r
+ * sacrifices execution speed to ensure better interrupt responsiveness.\r
+ */\r
+BaseType_t xQueueAltGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueAltGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ) PRIVILEGED_FUNCTION;\r
+#define xQueueAltSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )\r
+#define xQueueAltSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )\r
+#define xQueueAltReceive( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )\r
+#define xQueueAltPeek( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdTRUE )\r
+\r
+/*\r
+ * The functions defined above are for passing data to and from tasks.  The\r
+ * functions below are the equivalents for passing data to and from\r
+ * co-routines.\r
+ *\r
+ * These functions are called from the co-routine macro implementation and\r
+ * should not be called directly from application code.  Instead use the macro\r
+ * wrappers defined within croutine.h.\r
+ */\r
+BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken );\r
+BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxTaskWoken );\r
+BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait );\r
+BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait );\r
+\r
+/*\r
+ * For internal use only.  Use xSemaphoreCreateMutex(),\r
+ * xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling\r
+ * these functions directly.\r
+ */\r
+QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;\r
+QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;\r
+void* xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * For internal use only.  Use xSemaphoreTakeMutexRecursive() or\r
+ * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.\r
+ */\r
+BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Reset a queue back to its original empty state.  The return value is now\r
+ * obsolete and is always set to pdPASS.\r
+ */\r
+#define xQueueReset( xQueue ) xQueueGenericReset( xQueue, pdFALSE )\r
+\r
+/*\r
+ * The registry is provided as a means for kernel aware debuggers to\r
+ * locate queues, semaphores and mutexes.  Call vQueueAddToRegistry() add\r
+ * a queue, semaphore or mutex handle to the registry if you want the handle\r
+ * to be available to a kernel aware debugger.  If you are not using a kernel\r
+ * aware debugger then this function can be ignored.\r
+ *\r
+ * configQUEUE_REGISTRY_SIZE defines the maximum number of handles the\r
+ * registry can hold.  configQUEUE_REGISTRY_SIZE must be greater than 0\r
+ * within FreeRTOSConfig.h for the registry to be available.  Its value\r
+ * does not effect the number of queues, semaphores and mutexes that can be\r
+ * created - just the number that the registry can hold.\r
+ *\r
+ * @param xQueue The handle of the queue being added to the registry.  This\r
+ * is the handle returned by a call to xQueueCreate().  Semaphore and mutex\r
+ * handles can also be passed in here.\r
+ *\r
+ * @param pcName The name to be associated with the handle.  This is the\r
+ * name that the kernel aware debugger will display.  The queue registry only\r
+ * stores a pointer to the string - so the string must be persistent (global or\r
+ * preferably in ROM/Flash), not on the stack.\r
+ */\r
+#if configQUEUE_REGISTRY_SIZE > 0\r
+       void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+#endif\r
+\r
+/*\r
+ * The registry is provided as a means for kernel aware debuggers to\r
+ * locate queues, semaphores and mutexes.  Call vQueueAddToRegistry() add\r
+ * a queue, semaphore or mutex handle to the registry if you want the handle\r
+ * to be available to a kernel aware debugger, and vQueueUnregisterQueue() to\r
+ * remove the queue, semaphore or mutex from the register.  If you are not using\r
+ * a kernel aware debugger then this function can be ignored.\r
+ *\r
+ * @param xQueue The handle of the queue being removed from the registry.\r
+ */\r
+#if configQUEUE_REGISTRY_SIZE > 0\r
+       void vQueueUnregisterQueue( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+/*\r
+ * Generic version of the queue creation function, which is in turn called by\r
+ * any queue, semaphore or mutex creation function or macro.\r
+ */\r
+QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Queue sets provide a mechanism to allow a task to block (pend) on a read\r
+ * operation from multiple queues or semaphores simultaneously.\r
+ *\r
+ * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this\r
+ * function.\r
+ *\r
+ * A queue set must be explicitly created using a call to xQueueCreateSet()\r
+ * before it can be used.  Once created, standard FreeRTOS queues and semaphores\r
+ * can be added to the set using calls to xQueueAddToSet().\r
+ * xQueueSelectFromSet() is then used to determine which, if any, of the queues\r
+ * or semaphores contained in the set is in a state where a queue read or\r
+ * semaphore take operation would be successful.\r
+ *\r
+ * Note 1:  See the documentation on http://wwwFreeRTOS.org/RTOS-queue-sets.html\r
+ * for reasons why queue sets are very rarely needed in practice as there are\r
+ * simpler methods of blocking on multiple objects.\r
+ *\r
+ * Note 2:  Blocking on a queue set that contains a mutex will not cause the\r
+ * mutex holder to inherit the priority of the blocked task.\r
+ *\r
+ * Note 3:  An additional 4 bytes of RAM is required for each space in a every\r
+ * queue added to a queue set.  Therefore counting semaphores that have a high\r
+ * maximum count value should not be added to a queue set.\r
+ *\r
+ * Note 4:  A receive (in the case of a queue) or take (in the case of a\r
+ * semaphore) operation must not be performed on a member of a queue set unless\r
+ * a call to xQueueSelectFromSet() has first returned a handle to that set member.\r
+ *\r
+ * @param uxEventQueueLength Queue sets store events that occur on\r
+ * the queues and semaphores contained in the set.  uxEventQueueLength specifies\r
+ * the maximum number of events that can be queued at once.  To be absolutely\r
+ * certain that events are not lost uxEventQueueLength should be set to the\r
+ * total sum of the length of the queues added to the set, where binary\r
+ * semaphores and mutexes have a length of 1, and counting semaphores have a\r
+ * length set by their maximum count value.  Examples:\r
+ *  + If a queue set is to hold a queue of length 5, another queue of length 12,\r
+ *    and a binary semaphore, then uxEventQueueLength should be set to\r
+ *    (5 + 12 + 1), or 18.\r
+ *  + If a queue set is to hold three binary semaphores then uxEventQueueLength\r
+ *    should be set to (1 + 1 + 1 ), or 3.\r
+ *  + If a queue set is to hold a counting semaphore that has a maximum count of\r
+ *    5, and a counting semaphore that has a maximum count of 3, then\r
+ *    uxEventQueueLength should be set to (5 + 3), or 8.\r
+ *\r
+ * @return If the queue set is created successfully then a handle to the created\r
+ * queue set is returned.  Otherwise NULL is returned.\r
+ */\r
+QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Adds a queue or semaphore to a queue set that was previously created by a\r
+ * call to xQueueCreateSet().\r
+ *\r
+ * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this\r
+ * function.\r
+ *\r
+ * Note 1:  A receive (in the case of a queue) or take (in the case of a\r
+ * semaphore) operation must not be performed on a member of a queue set unless\r
+ * a call to xQueueSelectFromSet() has first returned a handle to that set member.\r
+ *\r
+ * @param xQueueOrSemaphore The handle of the queue or semaphore being added to\r
+ * the queue set (cast to an QueueSetMemberHandle_t type).\r
+ *\r
+ * @param xQueueSet The handle of the queue set to which the queue or semaphore\r
+ * is being added.\r
+ *\r
+ * @return If the queue or semaphore was successfully added to the queue set\r
+ * then pdPASS is returned.  If the queue could not be successfully added to the\r
+ * queue set because it is already a member of a different queue set then pdFAIL\r
+ * is returned.\r
+ */\r
+BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Removes a queue or semaphore from a queue set.  A queue or semaphore can only\r
+ * be removed from a set if the queue or semaphore is empty.\r
+ *\r
+ * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this\r
+ * function.\r
+ *\r
+ * @param xQueueOrSemaphore The handle of the queue or semaphore being removed\r
+ * from the queue set (cast to an QueueSetMemberHandle_t type).\r
+ *\r
+ * @param xQueueSet The handle of the queue set in which the queue or semaphore\r
+ * is included.\r
+ *\r
+ * @return If the queue or semaphore was successfully removed from the queue set\r
+ * then pdPASS is returned.  If the queue was not in the queue set, or the\r
+ * queue (or semaphore) was not empty, then pdFAIL is returned.\r
+ */\r
+BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * xQueueSelectFromSet() selects from the members of a queue set a queue or\r
+ * semaphore that either contains data (in the case of a queue) or is available\r
+ * to take (in the case of a semaphore).  xQueueSelectFromSet() effectively\r
+ * allows a task to block (pend) on a read operation on all the queues and\r
+ * semaphores in a queue set simultaneously.\r
+ *\r
+ * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this\r
+ * function.\r
+ *\r
+ * Note 1:  See the documentation on http://wwwFreeRTOS.org/RTOS-queue-sets.html\r
+ * for reasons why queue sets are very rarely needed in practice as there are\r
+ * simpler methods of blocking on multiple objects.\r
+ *\r
+ * Note 2:  Blocking on a queue set that contains a mutex will not cause the\r
+ * mutex holder to inherit the priority of the blocked task.\r
+ *\r
+ * Note 3:  A receive (in the case of a queue) or take (in the case of a\r
+ * semaphore) operation must not be performed on a member of a queue set unless\r
+ * a call to xQueueSelectFromSet() has first returned a handle to that set member.\r
+ *\r
+ * @param xQueueSet The queue set on which the task will (potentially) block.\r
+ *\r
+ * @param xTicksToWait The maximum time, in ticks, that the calling task will\r
+ * remain in the Blocked state (with other tasks executing) to wait for a member\r
+ * of the queue set to be ready for a successful queue read or semaphore take\r
+ * operation.\r
+ *\r
+ * @return xQueueSelectFromSet() will return the handle of a queue (cast to\r
+ * a QueueSetMemberHandle_t type) contained in the queue set that contains data,\r
+ * or the handle of a semaphore (cast to a QueueSetMemberHandle_t type) contained\r
+ * in the queue set that is available, or NULL if no such queue or semaphore\r
+ * exists before before the specified block time expires.\r
+ */\r
+QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * A version of xQueueSelectFromSet() that can be used from an ISR.\r
+ */\r
+QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;\r
+\r
+/* Not public API functions. */\r
+void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;\r
+void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* QUEUE_H */\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/semphr.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/semphr.h
new file mode 100644 (file)
index 0000000..20afb76
--- /dev/null
@@ -0,0 +1,844 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+#ifndef SEMAPHORE_H\r
+#define SEMAPHORE_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h" must appear in source files before "include semphr.h"\r
+#endif\r
+\r
+#include "queue.h"\r
+\r
+typedef QueueHandle_t SemaphoreHandle_t;\r
+\r
+#define semBINARY_SEMAPHORE_QUEUE_LENGTH       ( ( uint8_t ) 1U )\r
+#define semSEMAPHORE_QUEUE_ITEM_LENGTH         ( ( uint8_t ) 0U )\r
+#define semGIVE_BLOCK_TIME                                     ( ( TickType_t ) 0U )\r
+\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )</pre>\r
+ *\r
+ * This old vSemaphoreCreateBinary() macro is now deprecated in favour of the\r
+ * xSemaphoreCreateBinary() function.  Note that binary semaphores created using\r
+ * the vSemaphoreCreateBinary() macro are created in a state such that the\r
+ * first call to 'take' the semaphore would pass, whereas binary semaphores\r
+ * created using xSemaphoreCreateBinary() are created in a state such that the\r
+ * the semaphore must first be 'given' before it can be 'taken'.\r
+ *\r
+ * <i>Macro</i> that implements a semaphore by using the existing queue mechanism.\r
+ * The queue length is 1 as this is a binary semaphore.  The data size is 0\r
+ * as we don't want to actually store any data - we just want to know if the\r
+ * queue is empty or full.\r
+ *\r
+ * This type of semaphore can be used for pure synchronisation between tasks or\r
+ * between an interrupt and a task.  The semaphore need not be given back once\r
+ * obtained, so one task/interrupt can continuously 'give' the semaphore while\r
+ * another continuously 'takes' the semaphore.  For this reason this type of\r
+ * semaphore does not use a priority inheritance mechanism.  For an alternative\r
+ * that does use priority inheritance see xSemaphoreCreateMutex().\r
+ *\r
+ * @param xSemaphore Handle to the created semaphore.  Should be of type SemaphoreHandle_t.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Semaphore cannot be used before a call to vSemaphoreCreateBinary ().\r
+    // This is a macro so pass the variable in directly.\r
+    vSemaphoreCreateBinary( xSemaphore );\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // The semaphore was created successfully.\r
+        // The semaphore can now be used.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary\r
+ * \ingroup Semaphores\r
+ */\r
+#define vSemaphoreCreateBinary( xSemaphore )                                                                                                                                                                                   \\r
+       {                                                                                                                                                                                                                                                                       \\r
+               ( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE );    \\r
+               if( ( xSemaphore ) != NULL )                                                                                                                                                                                                    \\r
+               {                                                                                                                                                                                                                                                               \\r
+                       ( void ) xSemaphoreGive( ( xSemaphore ) );                                                                                                                                                                      \\r
+               }                                                                                                                                                                                                                                                               \\r
+       }\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>SemaphoreHandle_t xSemaphoreCreateBinary( void )</pre>\r
+ *\r
+ * The old vSemaphoreCreateBinary() macro is now deprecated in favour of this\r
+ * xSemaphoreCreateBinary() function.  Note that binary semaphores created using\r
+ * the vSemaphoreCreateBinary() macro are created in a state such that the\r
+ * first call to 'take' the semaphore would pass, whereas binary semaphores\r
+ * created using xSemaphoreCreateBinary() are created in a state such that the\r
+ * the semaphore must first be 'given' before it can be 'taken'.\r
+ *\r
+ * Function that creates a semaphore by using the existing queue mechanism.\r
+ * The queue length is 1 as this is a binary semaphore.  The data size is 0\r
+ * as nothing is actually stored - all that is important is whether the queue is\r
+ * empty or full (the binary semaphore is available or not).\r
+ *\r
+ * This type of semaphore can be used for pure synchronisation between tasks or\r
+ * between an interrupt and a task.  The semaphore need not be given back once\r
+ * obtained, so one task/interrupt can continuously 'give' the semaphore while\r
+ * another continuously 'takes' the semaphore.  For this reason this type of\r
+ * semaphore does not use a priority inheritance mechanism.  For an alternative\r
+ * that does use priority inheritance see xSemaphoreCreateMutex().\r
+ *\r
+ * @return Handle to the created semaphore.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Semaphore cannot be used before a call to vSemaphoreCreateBinary ().\r
+    // This is a macro so pass the variable in directly.\r
+    xSemaphore = xSemaphoreCreateBinary();\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // The semaphore was created successfully.\r
+        // The semaphore can now be used.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>xSemaphoreTake(\r
+ *                   SemaphoreHandle_t xSemaphore,\r
+ *                   TickType_t xBlockTime\r
+ *               )</pre>\r
+ *\r
+ * <i>Macro</i> to obtain a semaphore.  The semaphore must have previously been\r
+ * created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or\r
+ * xSemaphoreCreateCounting().\r
+ *\r
+ * @param xSemaphore A handle to the semaphore being taken - obtained when\r
+ * the semaphore was created.\r
+ *\r
+ * @param xBlockTime The time in ticks to wait for the semaphore to become\r
+ * available.  The macro portTICK_PERIOD_MS can be used to convert this to a\r
+ * real time.  A block time of zero can be used to poll the semaphore.  A block\r
+ * time of portMAX_DELAY can be used to block indefinitely (provided\r
+ * INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h).\r
+ *\r
+ * @return pdTRUE if the semaphore was obtained.  pdFALSE\r
+ * if xBlockTime expired without the semaphore becoming available.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+ // A task that creates a semaphore.\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Create the semaphore to guard a shared resource.\r
+    vSemaphoreCreateBinary( xSemaphore );\r
+ }\r
+\r
+ // A task that uses the semaphore.\r
+ void vAnotherTask( void * pvParameters )\r
+ {\r
+    // ... Do other things.\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // See if we can obtain the semaphore.  If the semaphore is not available\r
+        // wait 10 ticks to see if it becomes free.\r
+        if( xSemaphoreTake( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )\r
+        {\r
+            // We were able to obtain the semaphore and can now access the\r
+            // shared resource.\r
+\r
+            // ...\r
+\r
+            // We have finished accessing the shared resource.  Release the\r
+            // semaphore.\r
+            xSemaphoreGive( xSemaphore );\r
+        }\r
+        else\r
+        {\r
+            // We could not obtain the semaphore and can therefore not access\r
+            // the shared resource safely.\r
+        }\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreTake xSemaphoreTake\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreTake( xSemaphore, xBlockTime )               xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )\r
+\r
+/**\r
+ * semphr. h\r
+ * xSemaphoreTakeRecursive(\r
+ *                          SemaphoreHandle_t xMutex,\r
+ *                          TickType_t xBlockTime\r
+ *                        )\r
+ *\r
+ * <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.\r
+ * The mutex must have previously been created using a call to\r
+ * xSemaphoreCreateRecursiveMutex();\r
+ *\r
+ * configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this\r
+ * macro to be available.\r
+ *\r
+ * This macro must not be used on mutexes created using xSemaphoreCreateMutex().\r
+ *\r
+ * A mutex used recursively can be 'taken' repeatedly by the owner. The mutex\r
+ * doesn't become available again until the owner has called\r
+ * xSemaphoreGiveRecursive() for each successful 'take' request.  For example,\r
+ * if a task successfully 'takes' the same mutex 5 times then the mutex will\r
+ * not be available to any other task until it has also  'given' the mutex back\r
+ * exactly five times.\r
+ *\r
+ * @param xMutex A handle to the mutex being obtained.  This is the\r
+ * handle returned by xSemaphoreCreateRecursiveMutex();\r
+ *\r
+ * @param xBlockTime The time in ticks to wait for the semaphore to become\r
+ * available.  The macro portTICK_PERIOD_MS can be used to convert this to a\r
+ * real time.  A block time of zero can be used to poll the semaphore.  If\r
+ * the task already owns the semaphore then xSemaphoreTakeRecursive() will\r
+ * return immediately no matter what the value of xBlockTime.\r
+ *\r
+ * @return pdTRUE if the semaphore was obtained.  pdFALSE if xBlockTime\r
+ * expired without the semaphore becoming available.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xMutex = NULL;\r
+\r
+ // A task that creates a mutex.\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Create the mutex to guard a shared resource.\r
+    xMutex = xSemaphoreCreateRecursiveMutex();\r
+ }\r
+\r
+ // A task that uses the mutex.\r
+ void vAnotherTask( void * pvParameters )\r
+ {\r
+    // ... Do other things.\r
+\r
+    if( xMutex != NULL )\r
+    {\r
+        // See if we can obtain the mutex.  If the mutex is not available\r
+        // wait 10 ticks to see if it becomes free.\r
+        if( xSemaphoreTakeRecursive( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )\r
+        {\r
+            // We were able to obtain the mutex and can now access the\r
+            // shared resource.\r
+\r
+            // ...\r
+            // For some reason due to the nature of the code further calls to\r
+                       // xSemaphoreTakeRecursive() are made on the same mutex.  In real\r
+                       // code these would not be just sequential calls as this would make\r
+                       // no sense.  Instead the calls are likely to be buried inside\r
+                       // a more complex call structure.\r
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );\r
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );\r
+\r
+            // The mutex has now been 'taken' three times, so will not be\r
+                       // available to another task until it has also been given back\r
+                       // three times.  Again it is unlikely that real code would have\r
+                       // these calls sequentially, but instead buried in a more complex\r
+                       // call structure.  This is just for illustrative purposes.\r
+            xSemaphoreGiveRecursive( xMutex );\r
+                       xSemaphoreGiveRecursive( xMutex );\r
+                       xSemaphoreGiveRecursive( xMutex );\r
+\r
+                       // Now the mutex can be taken by other tasks.\r
+        }\r
+        else\r
+        {\r
+            // We could not obtain the mutex and can therefore not access\r
+            // the shared resource safely.\r
+        }\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreTakeRecursive( xMutex, xBlockTime )  xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )\r
+\r
+\r
+/*\r
+ * xSemaphoreAltTake() is an alternative version of xSemaphoreTake().\r
+ *\r
+ * The source code that implements the alternative (Alt) API is much\r
+ * simpler     because it executes everything from within a critical section.\r
+ * This is     the approach taken by many other RTOSes, but FreeRTOS.org has the\r
+ * preferred fully featured API too.  The fully featured API has more\r
+ * complex     code that takes longer to execute, but makes much less use of\r
+ * critical sections.  Therefore the alternative API sacrifices interrupt\r
+ * responsiveness to gain execution speed, whereas the fully featured API\r
+ * sacrifices execution speed to ensure better interrupt responsiveness.\r
+ */\r
+#define xSemaphoreAltTake( xSemaphore, xBlockTime )            xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>xSemaphoreGive( SemaphoreHandle_t xSemaphore )</pre>\r
+ *\r
+ * <i>Macro</i> to release a semaphore.  The semaphore must have previously been\r
+ * created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or\r
+ * xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().\r
+ *\r
+ * This macro must not be used from an ISR.  See xSemaphoreGiveFromISR () for\r
+ * an alternative which can be used from an ISR.\r
+ *\r
+ * This macro must also not be used on semaphores created using\r
+ * xSemaphoreCreateRecursiveMutex().\r
+ *\r
+ * @param xSemaphore A handle to the semaphore being released.  This is the\r
+ * handle returned when the semaphore was created.\r
+ *\r
+ * @return pdTRUE if the semaphore was released.  pdFALSE if an error occurred.\r
+ * Semaphores are implemented using queues.  An error can occur if there is\r
+ * no space on the queue to post a message - indicating that the\r
+ * semaphore was not first obtained correctly.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Create the semaphore to guard a shared resource.\r
+    vSemaphoreCreateBinary( xSemaphore );\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        if( xSemaphoreGive( xSemaphore ) != pdTRUE )\r
+        {\r
+            // We would expect this call to fail because we cannot give\r
+            // a semaphore without first "taking" it!\r
+        }\r
+\r
+        // Obtain the semaphore - don't block if the semaphore is not\r
+        // immediately available.\r
+        if( xSemaphoreTake( xSemaphore, ( TickType_t ) 0 ) )\r
+        {\r
+            // We now have the semaphore and can access the shared resource.\r
+\r
+            // ...\r
+\r
+            // We have finished accessing the shared resource so can free the\r
+            // semaphore.\r
+            if( xSemaphoreGive( xSemaphore ) != pdTRUE )\r
+            {\r
+                // We would not expect this call to fail because we must have\r
+                // obtained the semaphore to get here.\r
+            }\r
+        }\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreGive xSemaphoreGive\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreGive( xSemaphore )           xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex )</pre>\r
+ *\r
+ * <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.\r
+ * The mutex must have previously been created using a call to\r
+ * xSemaphoreCreateRecursiveMutex();\r
+ *\r
+ * configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this\r
+ * macro to be available.\r
+ *\r
+ * This macro must not be used on mutexes created using xSemaphoreCreateMutex().\r
+ *\r
+ * A mutex used recursively can be 'taken' repeatedly by the owner. The mutex\r
+ * doesn't become available again until the owner has called\r
+ * xSemaphoreGiveRecursive() for each successful 'take' request.  For example,\r
+ * if a task successfully 'takes' the same mutex 5 times then the mutex will\r
+ * not be available to any other task until it has also  'given' the mutex back\r
+ * exactly five times.\r
+ *\r
+ * @param xMutex A handle to the mutex being released, or 'given'.  This is the\r
+ * handle returned by xSemaphoreCreateMutex();\r
+ *\r
+ * @return pdTRUE if the semaphore was given.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xMutex = NULL;\r
+\r
+ // A task that creates a mutex.\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Create the mutex to guard a shared resource.\r
+    xMutex = xSemaphoreCreateRecursiveMutex();\r
+ }\r
+\r
+ // A task that uses the mutex.\r
+ void vAnotherTask( void * pvParameters )\r
+ {\r
+    // ... Do other things.\r
+\r
+    if( xMutex != NULL )\r
+    {\r
+        // See if we can obtain the mutex.  If the mutex is not available\r
+        // wait 10 ticks to see if it becomes free.\r
+        if( xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 ) == pdTRUE )\r
+        {\r
+            // We were able to obtain the mutex and can now access the\r
+            // shared resource.\r
+\r
+            // ...\r
+            // For some reason due to the nature of the code further calls to\r
+                       // xSemaphoreTakeRecursive() are made on the same mutex.  In real\r
+                       // code these would not be just sequential calls as this would make\r
+                       // no sense.  Instead the calls are likely to be buried inside\r
+                       // a more complex call structure.\r
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );\r
+            xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );\r
+\r
+            // The mutex has now been 'taken' three times, so will not be\r
+                       // available to another task until it has also been given back\r
+                       // three times.  Again it is unlikely that real code would have\r
+                       // these calls sequentially, it would be more likely that the calls\r
+                       // to xSemaphoreGiveRecursive() would be called as a call stack\r
+                       // unwound.  This is just for demonstrative purposes.\r
+            xSemaphoreGiveRecursive( xMutex );\r
+                       xSemaphoreGiveRecursive( xMutex );\r
+                       xSemaphoreGiveRecursive( xMutex );\r
+\r
+                       // Now the mutex can be taken by other tasks.\r
+        }\r
+        else\r
+        {\r
+            // We could not obtain the mutex and can therefore not access\r
+            // the shared resource safely.\r
+        }\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreGiveRecursive( xMutex )      xQueueGiveMutexRecursive( ( xMutex ) )\r
+\r
+/*\r
+ * xSemaphoreAltGive() is an alternative version of xSemaphoreGive().\r
+ *\r
+ * The source code that implements the alternative (Alt) API is much\r
+ * simpler     because it executes everything from within a critical section.\r
+ * This is     the approach taken by many other RTOSes, but FreeRTOS.org has the\r
+ * preferred fully featured API too.  The fully featured API has more\r
+ * complex     code that takes longer to execute, but makes much less use of\r
+ * critical sections.  Therefore the alternative API sacrifices interrupt\r
+ * responsiveness to gain execution speed, whereas the fully featured API\r
+ * sacrifices execution speed to ensure better interrupt responsiveness.\r
+ */\r
+#define xSemaphoreAltGive( xSemaphore )                xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>\r
+ xSemaphoreGiveFromISR(\r
+                          SemaphoreHandle_t xSemaphore,\r
+                          BaseType_t *pxHigherPriorityTaskWoken\r
+                      )</pre>\r
+ *\r
+ * <i>Macro</i> to  release a semaphore.  The semaphore must have previously been\r
+ * created with a call to vSemaphoreCreateBinary() or xSemaphoreCreateCounting().\r
+ *\r
+ * Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())\r
+ * must not be used with this macro.\r
+ *\r
+ * This macro can be used from an ISR.\r
+ *\r
+ * @param xSemaphore A handle to the semaphore being released.  This is the\r
+ * handle returned when the semaphore was created.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xSemaphoreGiveFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if giving the semaphore caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xSemaphoreGiveFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ \#define LONG_TIME 0xffff\r
+ \#define TICKS_TO_WAIT        10\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+ // Repetitive task.\r
+ void vATask( void * pvParameters )\r
+ {\r
+    for( ;; )\r
+    {\r
+        // We want this task to run every 10 ticks of a timer.  The semaphore\r
+        // was created before this task was started.\r
+\r
+        // Block waiting for the semaphore to become available.\r
+        if( xSemaphoreTake( xSemaphore, LONG_TIME ) == pdTRUE )\r
+        {\r
+            // It is time to execute.\r
+\r
+            // ...\r
+\r
+            // We have finished our task.  Return to the top of the loop where\r
+            // we will block on the semaphore until it is time to execute\r
+            // again.  Note when using the semaphore for synchronisation with an\r
+                       // ISR in this manner there is no need to 'give' the semaphore back.\r
+        }\r
+    }\r
+ }\r
+\r
+ // Timer ISR\r
+ void vTimerISR( void * pvParameters )\r
+ {\r
+ static uint8_t ucLocalTickCount = 0;\r
+ static BaseType_t xHigherPriorityTaskWoken;\r
+\r
+    // A timer tick has occurred.\r
+\r
+    // ... Do other time functions.\r
+\r
+    // Is it time for vATask () to run?\r
+       xHigherPriorityTaskWoken = pdFALSE;\r
+    ucLocalTickCount++;\r
+    if( ucLocalTickCount >= TICKS_TO_WAIT )\r
+    {\r
+        // Unblock the task by releasing the semaphore.\r
+        xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );\r
+\r
+        // Reset the count so we release the semaphore again in 10 ticks time.\r
+        ucLocalTickCount = 0;\r
+    }\r
+\r
+    if( xHigherPriorityTaskWoken != pdFALSE )\r
+    {\r
+        // We can force a context switch here.  Context switching from an\r
+        // ISR uses port specific syntax.  Check the demo task for your port\r
+        // to find the syntax required.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>\r
+ xSemaphoreTakeFromISR(\r
+                          SemaphoreHandle_t xSemaphore,\r
+                          BaseType_t *pxHigherPriorityTaskWoken\r
+                      )</pre>\r
+ *\r
+ * <i>Macro</i> to  take a semaphore from an ISR.  The semaphore must have\r
+ * previously been created with a call to vSemaphoreCreateBinary() or\r
+ * xSemaphoreCreateCounting().\r
+ *\r
+ * Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())\r
+ * must not be used with this macro.\r
+ *\r
+ * This macro can be used from an ISR, however taking a semaphore from an ISR\r
+ * is not a common operation.  It is likely to only be useful when taking a\r
+ * counting semaphore when an interrupt is obtaining an object from a resource\r
+ * pool (when the semaphore count indicates the number of resources available).\r
+ *\r
+ * @param xSemaphore A handle to the semaphore being taken.  This is the\r
+ * handle returned when the semaphore was created.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken xSemaphoreTakeFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if taking the semaphore caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task.  If xSemaphoreTakeFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
+ *\r
+ * @return pdTRUE if the semaphore was successfully taken, otherwise\r
+ * pdFALSE\r
+ */\r
+#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>SemaphoreHandle_t xSemaphoreCreateMutex( void )</pre>\r
+ *\r
+ * <i>Macro</i> that implements a mutex semaphore by using the existing queue\r
+ * mechanism.\r
+ *\r
+ * Mutexes created using this macro can be accessed using the xSemaphoreTake()\r
+ * and xSemaphoreGive() macros.  The xSemaphoreTakeRecursive() and\r
+ * xSemaphoreGiveRecursive() macros should not be used.\r
+ *\r
+ * This type of semaphore uses a priority inheritance mechanism so a task\r
+ * 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the\r
+ * semaphore it is no longer required.\r
+ *\r
+ * Mutex type semaphores cannot be used from within interrupt service routines.\r
+ *\r
+ * See vSemaphoreCreateBinary() for an alternative implementation that can be\r
+ * used for pure synchronisation (where one task or interrupt always 'gives' the\r
+ * semaphore and another always 'takes' the semaphore) and from within interrupt\r
+ * service routines.\r
+ *\r
+ * @return xSemaphore Handle to the created mutex semaphore.  Should be of type\r
+ *             SemaphoreHandle_t.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Semaphore cannot be used before a call to xSemaphoreCreateMutex().\r
+    // This is a macro so pass the variable in directly.\r
+    xSemaphore = xSemaphoreCreateMutex();\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // The semaphore was created successfully.\r
+        // The semaphore can now be used.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )\r
+\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>\r
+ *\r
+ * <i>Macro</i> that implements a recursive mutex by using the existing queue\r
+ * mechanism.\r
+ *\r
+ * Mutexes created using this macro can be accessed using the\r
+ * xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() macros.  The\r
+ * xSemaphoreTake() and xSemaphoreGive() macros should not be used.\r
+ *\r
+ * A mutex used recursively can be 'taken' repeatedly by the owner. The mutex\r
+ * doesn't become available again until the owner has called\r
+ * xSemaphoreGiveRecursive() for each successful 'take' request.  For example,\r
+ * if a task successfully 'takes' the same mutex 5 times then the mutex will\r
+ * not be available to any other task until it has also  'given' the mutex back\r
+ * exactly five times.\r
+ *\r
+ * This type of semaphore uses a priority inheritance mechanism so a task\r
+ * 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the\r
+ * semaphore it is no longer required.\r
+ *\r
+ * Mutex type semaphores cannot be used from within interrupt service routines.\r
+ *\r
+ * See vSemaphoreCreateBinary() for an alternative implementation that can be\r
+ * used for pure synchronisation (where one task or interrupt always 'gives' the\r
+ * semaphore and another always 'takes' the semaphore) and from within interrupt\r
+ * service routines.\r
+ *\r
+ * @return xSemaphore Handle to the created mutex semaphore.  Should be of type\r
+ *             SemaphoreHandle_t.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+    // Semaphore cannot be used before a call to xSemaphoreCreateMutex().\r
+    // This is a macro so pass the variable in directly.\r
+    xSemaphore = xSemaphoreCreateRecursiveMutex();\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // The semaphore was created successfully.\r
+        // The semaphore can now be used.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount )</pre>\r
+ *\r
+ * <i>Macro</i> that creates a counting semaphore by using the existing\r
+ * queue mechanism.\r
+ *\r
+ * Counting semaphores are typically used for two things:\r
+ *\r
+ * 1) Counting events.\r
+ *\r
+ *    In this usage scenario an event handler will 'give' a semaphore each time\r
+ *    an event occurs (incrementing the semaphore count value), and a handler\r
+ *    task will 'take' a semaphore each time it processes an event\r
+ *    (decrementing the semaphore count value).  The count value is therefore\r
+ *    the difference between the number of events that have occurred and the\r
+ *    number that have been processed.  In this case it is desirable for the\r
+ *    initial count value to be zero.\r
+ *\r
+ * 2) Resource management.\r
+ *\r
+ *    In this usage scenario the count value indicates the number of resources\r
+ *    available.  To obtain control of a resource a task must first obtain a\r
+ *    semaphore - decrementing the semaphore count value.  When the count value\r
+ *    reaches zero there are no free resources.  When a task finishes with the\r
+ *    resource it 'gives' the semaphore back - incrementing the semaphore count\r
+ *    value.  In this case it is desirable for the initial count value to be\r
+ *    equal to the maximum count value, indicating that all resources are free.\r
+ *\r
+ * @param uxMaxCount The maximum count value that can be reached.  When the\r
+ *        semaphore reaches this value it can no longer be 'given'.\r
+ *\r
+ * @param uxInitialCount The count value assigned to the semaphore when it is\r
+ *        created.\r
+ *\r
+ * @return Handle to the created semaphore.  Null if the semaphore could not be\r
+ *         created.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ SemaphoreHandle_t xSemaphore;\r
+\r
+ void vATask( void * pvParameters )\r
+ {\r
+ SemaphoreHandle_t xSemaphore = NULL;\r
+\r
+    // Semaphore cannot be used before a call to xSemaphoreCreateCounting().\r
+    // The max value to which the semaphore can count should be 10, and the\r
+    // initial value assigned to the count should be 0.\r
+    xSemaphore = xSemaphoreCreateCounting( 10, 0 );\r
+\r
+    if( xSemaphore != NULL )\r
+    {\r
+        // The semaphore was created successfully.\r
+        // The semaphore can now be used.\r
+    }\r
+ }\r
+ </pre>\r
+ * \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting\r
+ * \ingroup Semaphores\r
+ */\r
+#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )\r
+\r
+/**\r
+ * semphr. h\r
+ * <pre>void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );</pre>\r
+ *\r
+ * Delete a semaphore.  This function must be used with care.  For example,\r
+ * do not delete a mutex type semaphore if the mutex is held by a task.\r
+ *\r
+ * @param xSemaphore A handle to the semaphore to be deleted.\r
+ *\r
+ * \defgroup vSemaphoreDelete vSemaphoreDelete\r
+ * \ingroup Semaphores\r
+ */\r
+#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )\r
+\r
+/**\r
+ * semphr.h\r
+ * <pre>TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );</pre>\r
+ *\r
+ * If xMutex is indeed a mutex type semaphore, return the current mutex holder.\r
+ * If xMutex is not a mutex type semaphore, or the mutex is available (not held\r
+ * by a task), return NULL.\r
+ *\r
+ * Note: This is a good way of determining if the calling task is the mutex\r
+ * holder, but not a good way of determining the identity of the mutex holder as\r
+ * the holder may change between the function exiting and the returned value\r
+ * being tested.\r
+ */\r
+#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )\r
+\r
+#endif /* SEMAPHORE_H */\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/task.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/task.h
new file mode 100644 (file)
index 0000000..7dd9f87
--- /dev/null
@@ -0,0 +1,2021 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+#ifndef INC_TASK_H\r
+#define INC_TASK_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h must appear in source files before include task.h"\r
+#endif\r
+\r
+#include "list.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*-----------------------------------------------------------\r
+ * MACROS AND DEFINITIONS\r
+ *----------------------------------------------------------*/\r
+\r
+#define tskKERNEL_VERSION_NUMBER "V8.2.1"\r
+#define tskKERNEL_VERSION_MAJOR 8\r
+#define tskKERNEL_VERSION_MINOR 2\r
+#define tskKERNEL_VERSION_BUILD 1\r
+\r
+/**\r
+ * task. h\r
+ *\r
+ * Type by which tasks are referenced.  For example, a call to xTaskCreate\r
+ * returns (via a pointer parameter) an TaskHandle_t variable that can then\r
+ * be used as a parameter to vTaskDelete to delete the task.\r
+ *\r
+ * \defgroup TaskHandle_t TaskHandle_t\r
+ * \ingroup Tasks\r
+ */\r
+typedef void * TaskHandle_t;\r
+\r
+/*\r
+ * Defines the prototype to which the application task hook function must\r
+ * conform.\r
+ */\r
+typedef BaseType_t (*TaskHookFunction_t)( void * );\r
+\r
+/* Task states returned by eTaskGetState. */\r
+typedef enum\r
+{\r
+       eRunning = 0,   /* A task is querying the state of itself, so must be running. */\r
+       eReady,                 /* The task being queried is in a read or pending ready list. */\r
+       eBlocked,               /* The task being queried is in the Blocked state. */\r
+       eSuspended,             /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */\r
+       eDeleted                /* The task being queried has been deleted, but its TCB has not yet been freed. */\r
+} eTaskState;\r
+\r
+/* Actions that can be performed when vTaskNotify() is called. */\r
+typedef enum\r
+{\r
+       eNoAction = 0,                          /* Notify the task without updating its notify value. */\r
+       eSetBits,                                       /* Set bits in the task's notification value. */\r
+       eIncrement,                                     /* Increment the task's notification value. */\r
+       eSetValueWithOverwrite,         /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */\r
+       eSetValueWithoutOverwrite       /* Set the task's notification value if the previous value has been read by the task. */\r
+} eNotifyAction;\r
+\r
+/*\r
+ * Used internally only.\r
+ */\r
+typedef struct xTIME_OUT\r
+{\r
+       BaseType_t xOverflowCount;\r
+       TickType_t xTimeOnEntering;\r
+} TimeOut_t;\r
+\r
+/*\r
+ * Defines the memory ranges allocated to the task when an MPU is used.\r
+ */\r
+typedef struct xMEMORY_REGION\r
+{\r
+       void *pvBaseAddress;\r
+       uint32_t ulLengthInBytes;\r
+       uint32_t ulParameters;\r
+} MemoryRegion_t;\r
+\r
+/*\r
+ * Parameters required to create an MPU protected task.\r
+ */\r
+typedef struct xTASK_PARAMETERS\r
+{\r
+       TaskFunction_t pvTaskCode;\r
+       const char * const pcName;      /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       uint16_t usStackDepth;\r
+       void *pvParameters;\r
+       UBaseType_t uxPriority;\r
+       StackType_t *puxStackBuffer;\r
+       MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];\r
+} TaskParameters_t;\r
+\r
+/* Used with the uxTaskGetSystemState() function to return the state of each task\r
+in the system. */\r
+typedef struct xTASK_STATUS\r
+{\r
+       TaskHandle_t xHandle;                   /* The handle of the task to which the rest of the information in the structure relates. */\r
+       const char *pcTaskName;                 /* A pointer to the task's name.  This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       UBaseType_t xTaskNumber;                /* A number unique to the task. */\r
+       eTaskState eCurrentState;               /* The state in which the task existed when the structure was populated. */\r
+       UBaseType_t uxCurrentPriority;  /* The priority at which the task was running (may be inherited) when the structure was populated. */\r
+       UBaseType_t uxBasePriority;             /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex.  Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */\r
+       uint32_t ulRunTimeCounter;              /* The total run time allocated to the task so far, as defined by the run time stats clock.  See http://www.freertos.org/rtos-run-time-stats.html.  Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */\r
+       uint16_t usStackHighWaterMark;  /* The minimum amount of stack space that has remained for the task since the task was created.  The closer this value is to zero the closer the task has come to overflowing its stack. */\r
+} TaskStatus_t;\r
+\r
+/* Possible return values for eTaskConfirmSleepModeStatus(). */\r
+typedef enum\r
+{\r
+       eAbortSleep = 0,                /* A task has been made ready or a context switch pended since portSUPPORESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */\r
+       eStandardSleep,                 /* Enter a sleep mode that will not last any longer than the expected idle time. */\r
+       eNoTasksWaitingTimeout  /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */\r
+} eSleepModeStatus;\r
+\r
+\r
+/**\r
+ * Defines the priority used by the idle task.  This must not be modified.\r
+ *\r
+ * \ingroup TaskUtils\r
+ */\r
+#define tskIDLE_PRIORITY                       ( ( UBaseType_t ) 0U )\r
+\r
+/**\r
+ * task. h\r
+ *\r
+ * Macro for forcing a context switch.\r
+ *\r
+ * \defgroup taskYIELD taskYIELD\r
+ * \ingroup SchedulerControl\r
+ */\r
+#define taskYIELD()                                    portYIELD()\r
+\r
+/**\r
+ * task. h\r
+ *\r
+ * Macro to mark the start of a critical code region.  Preemptive context\r
+ * switches cannot occur when in a critical region.\r
+ *\r
+ * NOTE: This may alter the stack (depending on the portable implementation)\r
+ * so must be used with care!\r
+ *\r
+ * \defgroup taskENTER_CRITICAL taskENTER_CRITICAL\r
+ * \ingroup SchedulerControl\r
+ */\r
+#define taskENTER_CRITICAL()           portENTER_CRITICAL()\r
+#define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()\r
+\r
+/**\r
+ * task. h\r
+ *\r
+ * Macro to mark the end of a critical code region.  Preemptive context\r
+ * switches cannot occur when in a critical region.\r
+ *\r
+ * NOTE: This may alter the stack (depending on the portable implementation)\r
+ * so must be used with care!\r
+ *\r
+ * \defgroup taskEXIT_CRITICAL taskEXIT_CRITICAL\r
+ * \ingroup SchedulerControl\r
+ */\r
+#define taskEXIT_CRITICAL()                    portEXIT_CRITICAL()\r
+#define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )\r
+/**\r
+ * task. h\r
+ *\r
+ * Macro to disable all maskable interrupts.\r
+ *\r
+ * \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS\r
+ * \ingroup SchedulerControl\r
+ */\r
+#define taskDISABLE_INTERRUPTS()       portDISABLE_INTERRUPTS()\r
+\r
+/**\r
+ * task. h\r
+ *\r
+ * Macro to enable microcontroller interrupts.\r
+ *\r
+ * \defgroup taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS\r
+ * \ingroup SchedulerControl\r
+ */\r
+#define taskENABLE_INTERRUPTS()                portENABLE_INTERRUPTS()\r
+\r
+/* Definitions returned by xTaskGetSchedulerState().  taskSCHEDULER_SUSPENDED is\r
+0 to generate more optimal code when configASSERT() is defined as the constant\r
+is used in assert() statements. */\r
+#define taskSCHEDULER_SUSPENDED                ( ( BaseType_t ) 0 )\r
+#define taskSCHEDULER_NOT_STARTED      ( ( BaseType_t ) 1 )\r
+#define taskSCHEDULER_RUNNING          ( ( BaseType_t ) 2 )\r
+\r
+\r
+/*-----------------------------------------------------------\r
+ * TASK CREATION API\r
+ *----------------------------------------------------------*/\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ BaseType_t xTaskCreate(\r
+                                                         TaskFunction_t pvTaskCode,\r
+                                                         const char * const pcName,\r
+                                                         uint16_t usStackDepth,\r
+                                                         void *pvParameters,\r
+                                                         UBaseType_t uxPriority,\r
+                                                         TaskHandle_t *pvCreatedTask\r
+                                                 );</pre>\r
+ *\r
+ * Create a new task and add it to the list of tasks that are ready to run.\r
+ *\r
+ * xTaskCreate() can only be used to create a task that has unrestricted\r
+ * access to the entire microcontroller memory map.  Systems that include MPU\r
+ * support can alternatively create an MPU constrained task using\r
+ * xTaskCreateRestricted().\r
+ *\r
+ * @param pvTaskCode Pointer to the task entry function.  Tasks\r
+ * must be implemented to never return (i.e. continuous loop).\r
+ *\r
+ * @param pcName A descriptive name for the task.  This is mainly used to\r
+ * facilitate debugging.  Max length defined by configMAX_TASK_NAME_LEN - default\r
+ * is 16.\r
+ *\r
+ * @param usStackDepth The size of the task stack specified as the number of\r
+ * variables the stack can hold - not the number of bytes.  For example, if\r
+ * the stack is 16 bits wide and usStackDepth is defined as 100, 200 bytes\r
+ * will be allocated for stack storage.\r
+ *\r
+ * @param pvParameters Pointer that will be used as the parameter for the task\r
+ * being created.\r
+ *\r
+ * @param uxPriority The priority at which the task should run.  Systems that\r
+ * include MPU support can optionally create tasks in a privileged (system)\r
+ * mode by setting bit portPRIVILEGE_BIT of the priority parameter.  For\r
+ * example, to create a privileged task at priority 2 the uxPriority parameter\r
+ * should be set to ( 2 | portPRIVILEGE_BIT ).\r
+ *\r
+ * @param pvCreatedTask Used to pass back a handle by which the created task\r
+ * can be referenced.\r
+ *\r
+ * @return pdPASS if the task was successfully created and added to a ready\r
+ * list, otherwise an error code defined in the file projdefs.h\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Task to be created.\r
+ void vTaskCode( void * pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+                // Task code goes here.\r
+        }\r
+ }\r
+\r
+ // Function that creates a task.\r
+ void vOtherFunction( void )\r
+ {\r
+ static uint8_t ucParameterToPass;\r
+ TaskHandle_t xHandle = NULL;\r
+\r
+        // Create the task, storing the handle.  Note that the passed parameter ucParameterToPass\r
+        // must exist for the lifetime of the task, so in this case is declared static.  If it was just an\r
+        // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time\r
+        // the new task attempts to access it.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );\r
+     configASSERT( xHandle );\r
+\r
+        // Use the handle to delete the task.\r
+     if( xHandle != NULL )\r
+     {\r
+            vTaskDelete( xHandle );\r
+     }\r
+ }\r
+   </pre>\r
+ * \defgroup xTaskCreate xTaskCreate\r
+ * \ingroup Tasks\r
+ */\r
+#define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask );</pre>\r
+ *\r
+ * xTaskCreateRestricted() should only be used in systems that include an MPU\r
+ * implementation.\r
+ *\r
+ * Create a new task and add it to the list of tasks that are ready to run.\r
+ * The function parameters define the memory regions and associated access\r
+ * permissions allocated to the task.\r
+ *\r
+ * @param pxTaskDefinition Pointer to a structure that contains a member\r
+ * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API\r
+ * documentation) plus an optional stack buffer and the memory region\r
+ * definitions.\r
+ *\r
+ * @param pxCreatedTask Used to pass back a handle by which the created task\r
+ * can be referenced.\r
+ *\r
+ * @return pdPASS if the task was successfully created and added to a ready\r
+ * list, otherwise an error code defined in the file projdefs.h\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+// Create an TaskParameters_t structure that defines the task to be created.\r
+static const TaskParameters_t xCheckTaskParameters =\r
+{\r
+       vATask,         // pvTaskCode - the function that implements the task.\r
+       "ATask",        // pcName - just a text name for the task to assist debugging.\r
+       100,            // usStackDepth - the stack size DEFINED IN WORDS.\r
+       NULL,           // pvParameters - passed into the task function as the function parameters.\r
+       ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.\r
+       cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.\r
+\r
+       // xRegions - Allocate up to three separate memory regions for access by\r
+       // the task, with appropriate access permissions.  Different processors have\r
+       // different memory alignment requirements - refer to the FreeRTOS documentation\r
+       // for full information.\r
+       {\r
+               // Base address                                 Length  Parameters\r
+        { cReadWriteArray,                             32,             portMPU_REGION_READ_WRITE },\r
+        { cReadOnlyArray,                              32,             portMPU_REGION_READ_ONLY },\r
+        { cPrivilegedOnlyAccessArray,  128,    portMPU_REGION_PRIVILEGED_READ_WRITE }\r
+       }\r
+};\r
+\r
+int main( void )\r
+{\r
+TaskHandle_t xHandle;\r
+\r
+       // Create a task from the const structure defined above.  The task handle\r
+       // is requested (the second parameter is not NULL) but in this case just for\r
+       // demonstration purposes as its not actually used.\r
+       xTaskCreateRestricted( &xRegTest1Parameters, &xHandle );\r
+\r
+       // Start the scheduler.\r
+       vTaskStartScheduler();\r
+\r
+       // Will only get here if there was insufficient memory to create the idle\r
+       // and/or timer task.\r
+       for( ;; );\r
+}\r
+   </pre>\r
+ * \defgroup xTaskCreateRestricted xTaskCreateRestricted\r
+ * \ingroup Tasks\r
+ */\r
+#define xTaskCreateRestricted( x, pxCreatedTask ) xTaskGenericCreate( ((x)->pvTaskCode), ((x)->pcName), ((x)->usStackDepth), ((x)->pvParameters), ((x)->uxPriority), (pxCreatedTask), ((x)->puxStackBuffer), ((x)->xRegions) )\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );</pre>\r
+ *\r
+ * Memory regions are assigned to a restricted task when the task is created by\r
+ * a call to xTaskCreateRestricted().  These regions can be redefined using\r
+ * vTaskAllocateMPURegions().\r
+ *\r
+ * @param xTask The handle of the task being updated.\r
+ *\r
+ * @param xRegions A pointer to an MemoryRegion_t structure that contains the\r
+ * new memory region definitions.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+// Define an array of MemoryRegion_t structures that configures an MPU region\r
+// allowing read/write access for 1024 bytes starting at the beginning of the\r
+// ucOneKByte array.  The other two of the maximum 3 definable regions are\r
+// unused so set to zero.\r
+static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =\r
+{\r
+       // Base address         Length          Parameters\r
+       { ucOneKByte,           1024,           portMPU_REGION_READ_WRITE },\r
+       { 0,                            0,                      0 },\r
+       { 0,                            0,                      0 }\r
+};\r
+\r
+void vATask( void *pvParameters )\r
+{\r
+       // This task was created such that it has access to certain regions of\r
+       // memory as defined by the MPU configuration.  At some point it is\r
+       // desired that these MPU regions are replaced with that defined in the\r
+       // xAltRegions const struct above.  Use a call to vTaskAllocateMPURegions()\r
+       // for this purpose.  NULL is used as the task handle to indicate that this\r
+       // function should modify the MPU regions of the calling task.\r
+       vTaskAllocateMPURegions( NULL, xAltRegions );\r
+\r
+       // Now the task can continue its function, but from this point on can only\r
+       // access its stack and the ucOneKByte array (unless any other statically\r
+       // defined or shared regions have been declared elsewhere).\r
+}\r
+   </pre>\r
+ * \defgroup xTaskCreateRestricted xTaskCreateRestricted\r
+ * \ingroup Tasks\r
+ */\r
+void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskDelete( TaskHandle_t xTask );</pre>\r
+ *\r
+ * INCLUDE_vTaskDelete must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Remove a task from the RTOS real time kernel's management.  The task being\r
+ * deleted will be removed from all ready, blocked, suspended and event lists.\r
+ *\r
+ * NOTE:  The idle task is responsible for freeing the kernel allocated\r
+ * memory from tasks that have been deleted.  It is therefore important that\r
+ * the idle task is not starved of microcontroller processing time if your\r
+ * application makes any calls to vTaskDelete ().  Memory allocated by the\r
+ * task code is not automatically freed, and should be freed before the task\r
+ * is deleted.\r
+ *\r
+ * See the demo application file death.c for sample code that utilises\r
+ * vTaskDelete ().\r
+ *\r
+ * @param xTask The handle of the task to be deleted.  Passing NULL will\r
+ * cause the calling task to be deleted.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vOtherFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+\r
+        // Create the task, storing the handle.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
+\r
+        // Use the handle to delete the task.\r
+        vTaskDelete( xHandle );\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskDelete vTaskDelete\r
+ * \ingroup Tasks\r
+ */\r
+void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;\r
+\r
+/*-----------------------------------------------------------\r
+ * TASK CONTROL API\r
+ *----------------------------------------------------------*/\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskDelay( const TickType_t xTicksToDelay );</pre>\r
+ *\r
+ * Delay a task for a given number of ticks.  The actual time that the\r
+ * task remains blocked depends on the tick rate.  The constant\r
+ * portTICK_PERIOD_MS can be used to calculate real time from the tick\r
+ * rate - with the resolution of one tick period.\r
+ *\r
+ * INCLUDE_vTaskDelay must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ *\r
+ * vTaskDelay() specifies a time at which the task wishes to unblock relative to\r
+ * the time at which vTaskDelay() is called.  For example, specifying a block\r
+ * period of 100 ticks will cause the task to unblock 100 ticks after\r
+ * vTaskDelay() is called.  vTaskDelay() does not therefore provide a good method\r
+ * of controlling the frequency of a periodic task as the path taken through the\r
+ * code, as well as other task and interrupt activity, will effect the frequency\r
+ * at which vTaskDelay() gets called and therefore the time at which the task\r
+ * next executes.  See vTaskDelayUntil() for an alternative API function designed\r
+ * to facilitate fixed frequency execution.  It does this by specifying an\r
+ * absolute time (rather than a relative time) at which the calling task should\r
+ * unblock.\r
+ *\r
+ * @param xTicksToDelay The amount of time, in tick periods, that\r
+ * the calling task should block.\r
+ *\r
+ * Example usage:\r
+\r
+ void vTaskFunction( void * pvParameters )\r
+ {\r
+ // Block for 500ms.\r
+ const TickType_t xDelay = 500 / portTICK_PERIOD_MS;\r
+\r
+        for( ;; )\r
+        {\r
+                // Simply toggle the LED every 500ms, blocking between each toggle.\r
+                vToggleLED();\r
+                vTaskDelay( xDelay );\r
+        }\r
+ }\r
+\r
+ * \defgroup vTaskDelay vTaskDelay\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );</pre>\r
+ *\r
+ * INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Delay a task until a specified time.  This function can be used by periodic\r
+ * tasks to ensure a constant execution frequency.\r
+ *\r
+ * This function differs from vTaskDelay () in one important aspect:  vTaskDelay () will\r
+ * cause a task to block for the specified number of ticks from the time vTaskDelay () is\r
+ * called.  It is therefore difficult to use vTaskDelay () by itself to generate a fixed\r
+ * execution frequency as the time between a task starting to execute and that task\r
+ * calling vTaskDelay () may not be fixed [the task may take a different path though the\r
+ * code between calls, or may get interrupted or preempted a different number of times\r
+ * each time it executes].\r
+ *\r
+ * Whereas vTaskDelay () specifies a wake time relative to the time at which the function\r
+ * is called, vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to\r
+ * unblock.\r
+ *\r
+ * The constant portTICK_PERIOD_MS can be used to calculate real time from the tick\r
+ * rate - with the resolution of one tick period.\r
+ *\r
+ * @param pxPreviousWakeTime Pointer to a variable that holds the time at which the\r
+ * task was last unblocked.  The variable must be initialised with the current time\r
+ * prior to its first use (see the example below).  Following this the variable is\r
+ * automatically updated within vTaskDelayUntil ().\r
+ *\r
+ * @param xTimeIncrement The cycle time period.  The task will be unblocked at\r
+ * time *pxPreviousWakeTime + xTimeIncrement.  Calling vTaskDelayUntil with the\r
+ * same xTimeIncrement parameter value will cause the task to execute with\r
+ * a fixed interface period.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ // Perform an action every 10 ticks.\r
+ void vTaskFunction( void * pvParameters )\r
+ {\r
+ TickType_t xLastWakeTime;\r
+ const TickType_t xFrequency = 10;\r
+\r
+        // Initialise the xLastWakeTime variable with the current time.\r
+        xLastWakeTime = xTaskGetTickCount ();\r
+        for( ;; )\r
+        {\r
+                // Wait for the next cycle.\r
+                vTaskDelayUntil( &xLastWakeTime, xFrequency );\r
+\r
+                // Perform action here.\r
+        }\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskDelayUntil vTaskDelayUntil\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask );</pre>\r
+ *\r
+ * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Obtain the priority of any task.\r
+ *\r
+ * @param xTask Handle of the task to be queried.  Passing a NULL\r
+ * handle results in the priority of the calling task being returned.\r
+ *\r
+ * @return The priority of xTask.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+\r
+        // Create a task, storing the handle.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
+\r
+        // ...\r
+\r
+        // Use the handle to obtain the priority of the created task.\r
+        // It was created with tskIDLE_PRIORITY, but may have changed\r
+        // it itself.\r
+        if( uxTaskPriorityGet( xHandle ) != tskIDLE_PRIORITY )\r
+        {\r
+                // The task has changed it's priority.\r
+        }\r
+\r
+        // ...\r
+\r
+        // Is our priority higher than the created task?\r
+        if( uxTaskPriorityGet( xHandle ) < uxTaskPriorityGet( NULL ) )\r
+        {\r
+                // Our priority (obtained using NULL handle) is higher.\r
+        }\r
+ }\r
+   </pre>\r
+ * \defgroup uxTaskPriorityGet uxTaskPriorityGet\r
+ * \ingroup TaskCtrl\r
+ */\r
+UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask );</pre>\r
+ *\r
+ * A version of uxTaskPriorityGet() that can be used from an ISR.\r
+ */\r
+UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>eTaskState eTaskGetState( TaskHandle_t xTask );</pre>\r
+ *\r
+ * INCLUDE_eTaskGetState must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Obtain the state of any task.  States are encoded by the eTaskState\r
+ * enumerated type.\r
+ *\r
+ * @param xTask Handle of the task to be queried.\r
+ *\r
+ * @return The state of xTask at the time the function was called.  Note the\r
+ * state of the task might change between the function being called, and the\r
+ * functions return value being tested by the calling task.\r
+ */\r
+eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );</pre>\r
+ *\r
+ * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Set the priority of any task.\r
+ *\r
+ * A context switch will occur before the function returns if the priority\r
+ * being set is higher than the currently executing task.\r
+ *\r
+ * @param xTask Handle to the task for which the priority is being set.\r
+ * Passing a NULL handle results in the priority of the calling task being set.\r
+ *\r
+ * @param uxNewPriority The priority to which the task will be set.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+\r
+        // Create a task, storing the handle.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
+\r
+        // ...\r
+\r
+        // Use the handle to raise the priority of the created task.\r
+        vTaskPrioritySet( xHandle, tskIDLE_PRIORITY + 1 );\r
+\r
+        // ...\r
+\r
+        // Use a NULL handle to raise our priority to the same value.\r
+        vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 );\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskPrioritySet vTaskPrioritySet\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskSuspend( TaskHandle_t xTaskToSuspend );</pre>\r
+ *\r
+ * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Suspend any task.  When suspended a task will never get any microcontroller\r
+ * processing time, no matter what its priority.\r
+ *\r
+ * Calls to vTaskSuspend are not accumulative -\r
+ * i.e. calling vTaskSuspend () twice on the same task still only requires one\r
+ * call to vTaskResume () to ready the suspended task.\r
+ *\r
+ * @param xTaskToSuspend Handle to the task being suspended.  Passing a NULL\r
+ * handle will cause the calling task to be suspended.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+\r
+        // Create a task, storing the handle.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
+\r
+        // ...\r
+\r
+        // Use the handle to suspend the created task.\r
+        vTaskSuspend( xHandle );\r
+\r
+        // ...\r
+\r
+        // The created task will not run during this period, unless\r
+        // another task calls vTaskResume( xHandle ).\r
+\r
+        //...\r
+\r
+\r
+        // Suspend ourselves.\r
+        vTaskSuspend( NULL );\r
+\r
+        // We cannot get here unless another task calls vTaskResume\r
+        // with our handle as the parameter.\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskSuspend vTaskSuspend\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskResume( TaskHandle_t xTaskToResume );</pre>\r
+ *\r
+ * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.\r
+ * See the configuration section for more information.\r
+ *\r
+ * Resumes a suspended task.\r
+ *\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
+ * will be made available for running again by a single call to\r
+ * vTaskResume ().\r
+ *\r
+ * @param xTaskToResume Handle to the task being readied.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+\r
+        // Create a task, storing the handle.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
+\r
+        // ...\r
+\r
+        // Use the handle to suspend the created task.\r
+        vTaskSuspend( xHandle );\r
+\r
+        // ...\r
+\r
+        // The created task will not run during this period, unless\r
+        // another task calls vTaskResume( xHandle ).\r
+\r
+        //...\r
+\r
+\r
+        // Resume the suspended task ourselves.\r
+        vTaskResume( xHandle );\r
+\r
+        // The created task will once again get microcontroller processing\r
+        // time in accordance with its priority within the system.\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskResume vTaskResume\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void xTaskResumeFromISR( TaskHandle_t xTaskToResume );</pre>\r
+ *\r
+ * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be\r
+ * available.  See the configuration section for more information.\r
+ *\r
+ * An implementation of vTaskResume() that can be called from within an ISR.\r
+ *\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
+ * will be made available for running again by a single call to\r
+ * xTaskResumeFromISR ().\r
+ *\r
+ * xTaskResumeFromISR() should not be used to synchronise a task with an\r
+ * interrupt if there is a chance that the interrupt could arrive prior to the\r
+ * task being suspended - as this can lead to interrupts being missed. Use of a\r
+ * semaphore as a synchronisation mechanism would avoid this eventuality.\r
+ *\r
+ * @param xTaskToResume Handle to the task being readied.\r
+ *\r
+ * @return pdTRUE if resuming the task should result in a context switch,\r
+ * otherwise pdFALSE. This is used by the ISR to determine if a context switch\r
+ * may be required following the ISR.\r
+ *\r
+ * \defgroup vTaskResumeFromISR vTaskResumeFromISR\r
+ * \ingroup TaskCtrl\r
+ */\r
+BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;\r
+\r
+/*-----------------------------------------------------------\r
+ * SCHEDULER CONTROL\r
+ *----------------------------------------------------------*/\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskStartScheduler( void );</pre>\r
+ *\r
+ * Starts the real time kernel tick processing.  After calling the kernel\r
+ * has control over which tasks are executed and when.\r
+ *\r
+ * See the demo application file main.c for an example of creating\r
+ * tasks and starting the kernel.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+        // Create at least one task before starting the kernel.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+\r
+        // Start the real time kernel with preemption.\r
+        vTaskStartScheduler ();\r
+\r
+        // Will not get here unless a task calls vTaskEndScheduler ()\r
+ }\r
+   </pre>\r
+ *\r
+ * \defgroup vTaskStartScheduler vTaskStartScheduler\r
+ * \ingroup SchedulerControl\r
+ */\r
+void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskEndScheduler( void );</pre>\r
+ *\r
+ * NOTE:  At the time of writing only the x86 real mode port, which runs on a PC\r
+ * in place of DOS, implements this function.\r
+ *\r
+ * Stops the real time kernel tick.  All created tasks will be automatically\r
+ * deleted and multitasking (either preemptive or cooperative) will\r
+ * stop.  Execution then resumes from the point where vTaskStartScheduler ()\r
+ * was called, as if vTaskStartScheduler () had just returned.\r
+ *\r
+ * See the demo application file main. c in the demo/PC directory for an\r
+ * example that uses vTaskEndScheduler ().\r
+ *\r
+ * vTaskEndScheduler () requires an exit function to be defined within the\r
+ * portable layer (see vPortEndScheduler () in port. c for the PC port).  This\r
+ * performs hardware specific operations such as stopping the kernel tick.\r
+ *\r
+ * vTaskEndScheduler () will cause all of the resources allocated by the\r
+ * kernel to be freed - but will not free resources allocated by application\r
+ * tasks.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vTaskCode( void * pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+                // Task code goes here.\r
+\r
+                // At some point we want to end the real time kernel processing\r
+                // so call ...\r
+                vTaskEndScheduler ();\r
+        }\r
+ }\r
+\r
+ void vAFunction( void )\r
+ {\r
+        // Create at least one task before starting the kernel.\r
+        xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+\r
+        // Start the real time kernel with preemption.\r
+        vTaskStartScheduler ();\r
+\r
+        // Will only get here when the vTaskCode () task has called\r
+        // vTaskEndScheduler ().  When we get here we are back to single task\r
+        // execution.\r
+ }\r
+   </pre>\r
+ *\r
+ * \defgroup vTaskEndScheduler vTaskEndScheduler\r
+ * \ingroup SchedulerControl\r
+ */\r
+void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskSuspendAll( void );</pre>\r
+ *\r
+ * Suspends the scheduler without disabling interrupts.  Context switches will\r
+ * not occur while the scheduler is suspended.\r
+ *\r
+ * After calling vTaskSuspendAll () the calling task will continue to execute\r
+ * without risk of being swapped out until a call to xTaskResumeAll () has been\r
+ * made.\r
+ *\r
+ * API functions that have the potential to cause a context switch (for example,\r
+ * vTaskDelayUntil(), xQueueSend(), etc.) must not be called while the scheduler\r
+ * is suspended.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vTask1( void * pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+                // Task code goes here.\r
+\r
+                // ...\r
+\r
+                // At some point the task wants to perform a long operation during\r
+                // which it does not want to get swapped out.  It cannot use\r
+                // taskENTER_CRITICAL ()/taskEXIT_CRITICAL () as the length of the\r
+                // operation may cause interrupts to be missed - including the\r
+                // ticks.\r
+\r
+                // Prevent the real time kernel swapping out the task.\r
+                vTaskSuspendAll ();\r
+\r
+                // Perform the operation here.  There is no need to use critical\r
+                // sections as we have all the microcontroller processing time.\r
+                // During this time interrupts will still operate and the kernel\r
+                // tick count will be maintained.\r
+\r
+                // ...\r
+\r
+                // The operation is complete.  Restart the kernel.\r
+                xTaskResumeAll ();\r
+        }\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskSuspendAll vTaskSuspendAll\r
+ * \ingroup SchedulerControl\r
+ */\r
+void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>BaseType_t xTaskResumeAll( void );</pre>\r
+ *\r
+ * Resumes scheduler activity after it was suspended by a call to\r
+ * vTaskSuspendAll().\r
+ *\r
+ * xTaskResumeAll() only resumes the scheduler.  It does not unsuspend tasks\r
+ * that were previously suspended by a call to vTaskSuspend().\r
+ *\r
+ * @return If resuming the scheduler caused a context switch then pdTRUE is\r
+ *               returned, otherwise pdFALSE is returned.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vTask1( void * pvParameters )\r
+ {\r
+        for( ;; )\r
+        {\r
+                // Task code goes here.\r
+\r
+                // ...\r
+\r
+                // At some point the task wants to perform a long operation during\r
+                // which it does not want to get swapped out.  It cannot use\r
+                // taskENTER_CRITICAL ()/taskEXIT_CRITICAL () as the length of the\r
+                // operation may cause interrupts to be missed - including the\r
+                // ticks.\r
+\r
+                // Prevent the real time kernel swapping out the task.\r
+                vTaskSuspendAll ();\r
+\r
+                // Perform the operation here.  There is no need to use critical\r
+                // sections as we have all the microcontroller processing time.\r
+                // During this time interrupts will still operate and the real\r
+                // time kernel tick count will be maintained.\r
+\r
+                // ...\r
+\r
+                // The operation is complete.  Restart the kernel.  We want to force\r
+                // a context switch - but there is no point if resuming the scheduler\r
+                // caused a context switch already.\r
+                if( !xTaskResumeAll () )\r
+                {\r
+                         taskYIELD ();\r
+                }\r
+        }\r
+ }\r
+   </pre>\r
+ * \defgroup xTaskResumeAll xTaskResumeAll\r
+ * \ingroup SchedulerControl\r
+ */\r
+BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*-----------------------------------------------------------\r
+ * TASK UTILITIES\r
+ *----------------------------------------------------------*/\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>TickType_t xTaskGetTickCount( void );</PRE>\r
+ *\r
+ * @return The count of ticks since vTaskStartScheduler was called.\r
+ *\r
+ * \defgroup xTaskGetTickCount xTaskGetTickCount\r
+ * \ingroup TaskUtils\r
+ */\r
+TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>TickType_t xTaskGetTickCountFromISR( void );</PRE>\r
+ *\r
+ * @return The count of ticks since vTaskStartScheduler was called.\r
+ *\r
+ * This is a version of xTaskGetTickCount() that is safe to be called from an\r
+ * ISR - provided that TickType_t is the natural word size of the\r
+ * microcontroller being used or interrupt nesting is either not supported or\r
+ * not being used.\r
+ *\r
+ * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR\r
+ * \ingroup TaskUtils\r
+ */\r
+TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>uint16_t uxTaskGetNumberOfTasks( void );</PRE>\r
+ *\r
+ * @return The number of tasks that the real time kernel is currently managing.\r
+ * This includes all ready, blocked and suspended tasks.  A task that\r
+ * has been deleted but not yet freed by the idle task will also be\r
+ * included in the count.\r
+ *\r
+ * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks\r
+ * \ingroup TaskUtils\r
+ */\r
+UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery );</PRE>\r
+ *\r
+ * @return The text (human readable) name of the task referenced by the handle\r
+ * xTaskToQuery.  A task can query its own name by either passing in its own\r
+ * handle, or by setting xTaskToQuery to NULL.  INCLUDE_pcTaskGetTaskName must be\r
+ * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.\r
+ *\r
+ * \defgroup pcTaskGetTaskName pcTaskGetTaskName\r
+ * \ingroup TaskUtils\r
+ */\r
+char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+ * task.h\r
+ * <PRE>UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );</PRE>\r
+ *\r
+ * INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for\r
+ * this function to be available.\r
+ *\r
+ * Returns the high water mark of the stack associated with xTask.  That is,\r
+ * the minimum free stack space there has been (in words, so on a 32 bit machine\r
+ * a value of 1 means 4 bytes) since the task started.  The smaller the returned\r
+ * number the closer the task has come to overflowing its stack.\r
+ *\r
+ * @param xTask Handle of the task associated with the stack to be checked.\r
+ * Set xTask to NULL to check the stack of the calling task.\r
+ *\r
+ * @return The smallest amount of free stack space there has been (in words, so\r
+ * actual spaces on the stack rather than bytes) since the task referenced by\r
+ * xTask was created.\r
+ */\r
+UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/* When using trace macros it is sometimes necessary to include task.h before\r
+FreeRTOS.h.  When this is done TaskHookFunction_t will not yet have been defined,\r
+so the following two prototypes will cause a compilation error.  This can be\r
+fixed by simply guarding against the inclusion of these two prototypes unless\r
+they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration\r
+constant. */\r
+#ifdef configUSE_APPLICATION_TASK_TAG\r
+       #if configUSE_APPLICATION_TASK_TAG == 1\r
+               /**\r
+                * task.h\r
+                * <pre>void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction );</pre>\r
+                *\r
+                * Sets pxHookFunction to be the task hook function used by the task xTask.\r
+                * Passing xTask as NULL has the effect of setting the calling tasks hook\r
+                * function.\r
+                */\r
+               void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION;\r
+\r
+               /**\r
+                * task.h\r
+                * <pre>void xTaskGetApplicationTaskTag( TaskHandle_t xTask );</pre>\r
+                *\r
+                * Returns the pxHookFunction value assigned to the task xTask.\r
+                */\r
+               TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+       #endif /* configUSE_APPLICATION_TASK_TAG ==1 */\r
+#endif /* ifdef configUSE_APPLICATION_TASK_TAG */\r
+\r
+#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )\r
+\r
+       /* Each task contains an array of pointers that is dimensioned by the\r
+       configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h.  The\r
+       kernel does not use the pointers itself, so the application writer can use\r
+       the pointers for any purpose they wish.  The following two functions are\r
+       used to set and query a pointer respectively. */\r
+       void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ) PRIVILEGED_FUNCTION;\r
+       void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) PRIVILEGED_FUNCTION;\r
+\r
+#endif\r
+\r
+/**\r
+ * task.h\r
+ * <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>\r
+ *\r
+ * Calls the hook function associated with xTask.  Passing xTask as NULL has\r
+ * the effect of calling the Running tasks (the calling task) hook function.\r
+ *\r
+ * pvParameter is passed to the hook function for the task to interpret as it\r
+ * wants.  The return value is the value returned by the task hook function\r
+ * registered by the user.\r
+ */\r
+BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * xTaskGetIdleTaskHandle() is only available if\r
+ * INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.\r
+ *\r
+ * Simply returns the handle of the idle task.  It is not valid to call\r
+ * xTaskGetIdleTaskHandle() before the scheduler has been started.\r
+ */\r
+TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for\r
+ * uxTaskGetSystemState() to be available.\r
+ *\r
+ * uxTaskGetSystemState() populates an TaskStatus_t structure for each task in\r
+ * the system.  TaskStatus_t structures contain, among other things, members\r
+ * for the task handle, task name, task priority, task state, and total amount\r
+ * of run time consumed by the task.  See the TaskStatus_t structure\r
+ * definition in this file for the full member list.\r
+ *\r
+ * NOTE:  This function is intended for debugging use only as its use results in\r
+ * the scheduler remaining suspended for an extended period.\r
+ *\r
+ * @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures.\r
+ * The array must contain at least one TaskStatus_t structure for each task\r
+ * that is under the control of the RTOS.  The number of tasks under the control\r
+ * of the RTOS can be determined using the uxTaskGetNumberOfTasks() API function.\r
+ *\r
+ * @param uxArraySize The size of the array pointed to by the pxTaskStatusArray\r
+ * parameter.  The size is specified as the number of indexes in the array, or\r
+ * the number of TaskStatus_t structures contained in the array, not by the\r
+ * number of bytes in the array.\r
+ *\r
+ * @param pulTotalRunTime If configGENERATE_RUN_TIME_STATS is set to 1 in\r
+ * FreeRTOSConfig.h then *pulTotalRunTime is set by uxTaskGetSystemState() to the\r
+ * total run time (as defined by the run time stats clock, see\r
+ * http://www.freertos.org/rtos-run-time-stats.html) since the target booted.\r
+ * pulTotalRunTime can be set to NULL to omit the total run time information.\r
+ *\r
+ * @return The number of TaskStatus_t structures that were populated by\r
+ * uxTaskGetSystemState().  This should equal the number returned by the\r
+ * uxTaskGetNumberOfTasks() API function, but will be zero if the value passed\r
+ * in the uxArraySize parameter was too small.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+    // This example demonstrates how a human readable table of run time stats\r
+       // information is generated from raw data provided by uxTaskGetSystemState().\r
+       // The human readable table is written to pcWriteBuffer\r
+       void vTaskGetRunTimeStats( char *pcWriteBuffer )\r
+       {\r
+       TaskStatus_t *pxTaskStatusArray;\r
+       volatile UBaseType_t uxArraySize, x;\r
+       uint32_t ulTotalRunTime, ulStatsAsPercentage;\r
+\r
+               // Make sure the write buffer does not contain a string.\r
+               *pcWriteBuffer = 0x00;\r
+\r
+               // Take a snapshot of the number of tasks in case it changes while this\r
+               // function is executing.\r
+               uxArraySize = uxTaskGetNumberOfTasks();\r
+\r
+               // Allocate a TaskStatus_t structure for each task.  An array could be\r
+               // allocated statically at compile time.\r
+               pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );\r
+\r
+               if( pxTaskStatusArray != NULL )\r
+               {\r
+                       // Generate raw status information about each task.\r
+                       uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );\r
+\r
+                       // For percentage calculations.\r
+                       ulTotalRunTime /= 100UL;\r
+\r
+                       // Avoid divide by zero errors.\r
+                       if( ulTotalRunTime > 0 )\r
+                       {\r
+                               // For each populated position in the pxTaskStatusArray array,\r
+                               // format the raw data as human readable ASCII data\r
+                               for( x = 0; x < uxArraySize; x++ )\r
+                               {\r
+                                       // What percentage of the total run time has the task used?\r
+                                       // This will always be rounded down to the nearest integer.\r
+                                       // ulTotalRunTimeDiv100 has already been divided by 100.\r
+                                       ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalRunTime;\r
+\r
+                                       if( ulStatsAsPercentage > 0UL )\r
+                                       {\r
+                                               sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               // If the percentage is zero here then the task has\r
+                                               // consumed less than 1% of the total run time.\r
+                                               sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+                                       }\r
+\r
+                                       pcWriteBuffer += strlen( ( char * ) pcWriteBuffer );\r
+                               }\r
+                       }\r
+\r
+                       // The array is no longer needed, free the memory it consumes.\r
+                       vPortFree( pxTaskStatusArray );\r
+               }\r
+       }\r
+       </pre>\r
+ */\r
+UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskList( char *pcWriteBuffer );</PRE>\r
+ *\r
+ * configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must\r
+ * both be defined as 1 for this function to be available.  See the\r
+ * configuration section of the FreeRTOS.org website for more information.\r
+ *\r
+ * NOTE 1: This function will disable interrupts for its duration.  It is\r
+ * not intended for normal application runtime use but as a debug aid.\r
+ *\r
+ * Lists all the current tasks, along with their current state and stack\r
+ * usage high water mark.\r
+ *\r
+ * Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or\r
+ * suspended ('S').\r
+ *\r
+ * PLEASE NOTE:\r
+ *\r
+ * This function is provided for convenience only, and is used by many of the\r
+ * demo applications.  Do not consider it to be part of the scheduler.\r
+ *\r
+ * vTaskList() calls uxTaskGetSystemState(), then formats part of the\r
+ * uxTaskGetSystemState() output into a human readable table that displays task\r
+ * names, states and stack usage.\r
+ *\r
+ * vTaskList() has a dependency on the sprintf() C library function that might\r
+ * bloat the code size, use a lot of stack, and provide different results on\r
+ * different platforms.  An alternative, tiny, third party, and limited\r
+ * functionality implementation of sprintf() is provided in many of the\r
+ * FreeRTOS/Demo sub-directories in a file called printf-stdarg.c (note\r
+ * printf-stdarg.c does not provide a full snprintf() implementation!).\r
+ *\r
+ * It is recommended that production systems call uxTaskGetSystemState()\r
+ * directly to get access to raw stats data, rather than indirectly through a\r
+ * call to vTaskList().\r
+ *\r
+ * @param pcWriteBuffer A buffer into which the above mentioned details\r
+ * will be written, in ASCII form.  This buffer is assumed to be large\r
+ * enough to contain the generated report.  Approximately 40 bytes per\r
+ * task should be sufficient.\r
+ *\r
+ * \defgroup vTaskList vTaskList\r
+ * \ingroup TaskUtils\r
+ */\r
+void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskGetRunTimeStats( char *pcWriteBuffer );</PRE>\r
+ *\r
+ * configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS\r
+ * must both be defined as 1 for this function to be available.  The application\r
+ * must also then provide definitions for\r
+ * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE()\r
+ * to configure a peripheral timer/counter and return the timers current count\r
+ * value respectively.  The counter should be at least 10 times the frequency of\r
+ * the tick count.\r
+ *\r
+ * NOTE 1: This function will disable interrupts for its duration.  It is\r
+ * not intended for normal application runtime use but as a debug aid.\r
+ *\r
+ * Setting configGENERATE_RUN_TIME_STATS to 1 will result in a total\r
+ * accumulated execution time being stored for each task.  The resolution\r
+ * of the accumulated time value depends on the frequency of the timer\r
+ * configured by the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro.\r
+ * Calling vTaskGetRunTimeStats() writes the total execution time of each\r
+ * task into a buffer, both as an absolute count value and as a percentage\r
+ * of the total system execution time.\r
+ *\r
+ * NOTE 2:\r
+ *\r
+ * This function is provided for convenience only, and is used by many of the\r
+ * demo applications.  Do not consider it to be part of the scheduler.\r
+ *\r
+ * vTaskGetRunTimeStats() calls uxTaskGetSystemState(), then formats part of the\r
+ * uxTaskGetSystemState() output into a human readable table that displays the\r
+ * amount of time each task has spent in the Running state in both absolute and\r
+ * percentage terms.\r
+ *\r
+ * vTaskGetRunTimeStats() has a dependency on the sprintf() C library function\r
+ * that might bloat the code size, use a lot of stack, and provide different\r
+ * results on different platforms.  An alternative, tiny, third party, and\r
+ * limited functionality implementation of sprintf() is provided in many of the\r
+ * FreeRTOS/Demo sub-directories in a file called printf-stdarg.c (note\r
+ * printf-stdarg.c does not provide a full snprintf() implementation!).\r
+ *\r
+ * It is recommended that production systems call uxTaskGetSystemState() directly\r
+ * to get access to raw stats data, rather than indirectly through a call to\r
+ * vTaskGetRunTimeStats().\r
+ *\r
+ * @param pcWriteBuffer A buffer into which the execution times will be\r
+ * written, in ASCII form.  This buffer is assumed to be large enough to\r
+ * contain the generated report.  Approximately 40 bytes per task should\r
+ * be sufficient.\r
+ *\r
+ * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats\r
+ * \ingroup TaskUtils\r
+ */\r
+void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ * eSetBits -\r
+ * The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ * always returns pdPASS in this case.\r
+ *\r
+ * eIncrement -\r
+ * The task's notification value is incremented.  ulValue is not used and\r
+ * xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ * eSetValueWithOverwrite -\r
+ * The task's notification value is set to the value of ulValue, even if the\r
+ * task being notified had not yet processed the previous notification (the\r
+ * task already had a notification pending).  xTaskNotify() always returns\r
+ * pdPASS in this case.\r
+ *\r
+ * eSetValueWithoutOverwrite -\r
+ * If the task being notified did not already have a notification pending then\r
+ * the task's notification value is set to ulValue and xTaskNotify() will\r
+ * return pdPASS.  If the task being notified already had a notification\r
+ * pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ * eNoAction -\r
+ * The task receives a notification without its notification value being\r
+ * updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ * this case.\r
+ *\r
+ *  pulPreviousNotificationValue -\r
+ *  Can be used to pass out the subject task's notification value before any\r
+ *  bits are modified by the notify function.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) PRIVILEGED_FUNCTION;\r
+#define xTaskNotify( xTaskToNotify, ulValue, eAction ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )\r
+#define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotify() that can be used from an interrupt service routine\r
+ * (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ * eSetBits -\r
+ * The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ * always returns pdPASS in this case.\r
+ *\r
+ * eIncrement -\r
+ * The task's notification value is incremented.  ulValue is not used and\r
+ * xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ * eSetValueWithOverwrite -\r
+ * The task's notification value is set to the value of ulValue, even if the\r
+ * task being notified had not yet processed the previous notification (the\r
+ * task already had a notification pending).  xTaskNotify() always returns\r
+ * pdPASS in this case.\r
+ *\r
+ * eSetValueWithoutOverwrite -\r
+ * If the task being notified did not already have a notification pending then\r
+ * the task's notification value is set to ulValue and xTaskNotify() will\r
+ * return pdPASS.  If the task being notified already had a notification\r
+ * pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ * eNoAction -\r
+ * The task receives a notification without its notification value being\r
+ * updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ * this case.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  xTaskNotifyFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * xTaskNotifyFromISR() sets this value to pdTRUE then a context switch should\r
+ * be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+#define xTaskNotifyFromISR( xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )\r
+#define xTaskNotifyAndQueryFromISR( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param ulBitsToClearOnEntry Bits that are set in ulBitsToClearOnEntry value\r
+ * will be cleared in the calling task's notification value before the task\r
+ * checks to see if any notifications are pending, and optionally blocks if no\r
+ * notifications are pending.  Setting ulBitsToClearOnEntry to ULONG_MAX (if\r
+ * limits.h is included) or 0xffffffffUL (if limits.h is not included) will have\r
+ * the effect of resetting the task's notification value to 0.  Setting\r
+ * ulBitsToClearOnEntry to 0 will leave the task's notification value unchanged.\r
+ *\r
+ * @param ulBitsToClearOnExit If a notification is pending or received before\r
+ * the calling task exits the xTaskNotifyWait() function then the task's\r
+ * notification value (see the xTaskNotify() API function) is passed out using\r
+ * the pulNotificationValue parameter.  Then any bits that are set in\r
+ * ulBitsToClearOnExit will be cleared in the task's notification value (note\r
+ * *pulNotificationValue is set before any bits are cleared).  Setting\r
+ * ulBitsToClearOnExit to ULONG_MAX (if limits.h is included) or 0xffffffffUL\r
+ * (if limits.h is not included) will have the effect of resetting the task's\r
+ * notification value to 0 before the function exits.  Setting\r
+ * ulBitsToClearOnExit to 0 will leave the task's notification value unchanged\r
+ * when the function exits (in which case the value passed out in\r
+ * pulNotificationValue will match the task's notification value).\r
+ *\r
+ * @param pulNotificationValue Used to pass the task's notification value out\r
+ * of the function.  Note the value passed out will not be effected by the\r
+ * clearing of any bits caused by ulBitsToClearOnExit being non-zero.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for a notification to be received, should a notification\r
+ * not already be pending when xTaskNotifyWait() was called.  The task\r
+ * will not consume any processing time while it is in the Blocked state.  This\r
+ * is specified in kernel ticks, the macro pdMS_TO_TICSK( value_in_ms ) can be\r
+ * used to convert a time specified in milliseconds to a time specified in\r
+ * ticks.\r
+ *\r
+ * @return If a notification was received (including notifications that were\r
+ * already pending when xTaskNotifyWait was called) then pdPASS is\r
+ * returned.  Otherwise pdFAIL is returned.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro\r
+ * to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * xTaskNotifyGive() is a helper macro intended for use when task notifications\r
+ * are used as light weight and faster binary or counting semaphore equivalents.\r
+ * Actual FreeRTOS semaphores are given using the xSemaphoreGive() API function,\r
+ * the equivalent action that instead uses a task notification is\r
+ * xTaskNotifyGive().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the\r
+ * eAction parameter set to eIncrement - so pdPASS is always returned.\r
+ *\r
+ * \defgroup xTaskNotifyGive xTaskNotifyGive\r
+ * \ingroup TaskNotifications\r
+ */\r
+#define xTaskNotifyGive( xTaskToNotify ) xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro\r
+ * to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotifyGive() that can be called from an interrupt service\r
+ * routine (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * vTaskNotifyGiveFromISR() is intended for use when task notifications are\r
+ * used as light weight and faster binary or counting semaphore equivalents.\r
+ * Actual FreeRTOS semaphores are given from an ISR using the\r
+ * xSemaphoreGiveFromISR() API function, the equivalent action that instead uses\r
+ * a task notification is vTaskNotifyGiveFromISR().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  vTaskNotifyGiveFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * vTaskNotifyGiveFromISR() sets this value to pdTRUE then a context switch\r
+ * should be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+void vTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * ulTaskNotifyTake() is intended for use when a task notification is used as a\r
+ * faster and lighter weight binary or counting semaphore alternative.  Actual\r
+ * FreeRTOS semaphores are taken using the xSemaphoreTake() API function, the\r
+ * equivalent action that instead uses a task notification is\r
+ * ulTaskNotifyTake().\r
+ *\r
+ * When a task is using its notification value as a binary or counting semaphore\r
+ * other tasks should send notifications to it using the xTaskNotifyGive()\r
+ * macro, or xTaskNotify() function with the eAction parameter set to\r
+ * eIncrement.\r
+ *\r
+ * ulTaskNotifyTake() can either clear the task's notification value to\r
+ * zero on exit, in which case the notification value acts like a binary\r
+ * semaphore, or decrement the task's notification value on exit, in which case\r
+ * the notification value acts like a counting semaphore.\r
+ *\r
+ * A task can use ulTaskNotifyTake() to [optionally] block to wait for a\r
+ * the task's notification value to be non-zero.  The task does not consume any\r
+ * CPU time while it is in the Blocked state.\r
+ *\r
+ * Where as xTaskNotifyWait() will return when a notification is pending,\r
+ * ulTaskNotifyTake() will return when the task's notification value is\r
+ * not zero.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xClearCountOnExit if xClearCountOnExit is pdFALSE then the task's\r
+ * notification value is decremented when the function exits.  In this way the\r
+ * notification value acts like a counting semaphore.  If xClearCountOnExit is\r
+ * not pdFALSE then the task's notification value is cleared to zero when the\r
+ * function exits.  In this way the notification value acts like a binary\r
+ * semaphore.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for the task's notification value to be greater than zero,\r
+ * should the count not already be greater than zero when\r
+ * ulTaskNotifyTake() was called.  The task will not consume any processing\r
+ * time while it is in the Blocked state.  This is specified in kernel ticks,\r
+ * the macro pdMS_TO_TICSK( value_in_ms ) can be used to convert a time\r
+ * specified in milliseconds to a time specified in ticks.\r
+ *\r
+ * @return The task's notification count before it is either cleared to zero or\r
+ * decremented (see the xClearCountOnExit parameter).\r
+ *\r
+ * \defgroup ulTaskNotifyTake ulTaskNotifyTake\r
+ * \ingroup TaskNotifications\r
+ */\r
+uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/*-----------------------------------------------------------\r
+ * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES\r
+ *----------------------------------------------------------*/\r
+\r
+/*\r
+ * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS ONLY\r
+ * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS\r
+ * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.\r
+ *\r
+ * Called from the real time kernel tick (either preemptive or cooperative),\r
+ * this increments the tick count and checks if any tasks that are blocked\r
+ * for a finite period required removing from a blocked list and placing on\r
+ * a ready list.  If a non-zero value is returned then a context switch is\r
+ * required because either:\r
+ *   + A task was removed from a blocked list because its timeout had expired,\r
+ *     or\r
+ *   + Time slicing is in use and there is a task of equal priority to the\r
+ *     currently running task.\r
+ */\r
+BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
+ * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.\r
+ *\r
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.\r
+ *\r
+ * Removes the calling task from the ready list and places it both\r
+ * on the list of tasks waiting for a particular event, and the\r
+ * list of delayed tasks.  The task will be removed from both lists\r
+ * and replaced on the ready list should either the event occur (and\r
+ * there be no higher priority tasks waiting on the same event) or\r
+ * the delay period expires.\r
+ *\r
+ * The 'unordered' version replaces the event list item value with the\r
+ * xItemValue value, and inserts the list item at the end of the list.\r
+ *\r
+ * The 'ordered' version uses the existing event list item value (which is the\r
+ * owning tasks priority) to insert the list item into the event list is task\r
+ * priority order.\r
+ *\r
+ * @param pxEventList The list containing tasks that are blocked waiting\r
+ * for the event to occur.\r
+ *\r
+ * @param xItemValue The item value to use for the event list item when the\r
+ * event list is not ordered by task priority.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait\r
+ * for the event to occur.  This is specified in kernel ticks,the constant\r
+ * portTICK_PERIOD_MS can be used to convert kernel ticks into a real time\r
+ * period.\r
+ */\r
+void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
+ * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.\r
+ *\r
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.\r
+ *\r
+ * This function performs nearly the same function as vTaskPlaceOnEventList().\r
+ * The difference being that this function does not permit tasks to block\r
+ * indefinitely, whereas vTaskPlaceOnEventList() does.\r
+ *\r
+ */\r
+void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
+ * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.\r
+ *\r
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.\r
+ *\r
+ * Removes a task from both the specified event list and the list of blocked\r
+ * tasks, and places it on a ready queue.\r
+ *\r
+ * xTaskRemoveFromEventList()/xTaskRemoveFromUnorderedEventList() will be called\r
+ * if either an event occurs to unblock a task, or the block timeout period\r
+ * expires.\r
+ *\r
+ * xTaskRemoveFromEventList() is used when the event list is in task priority\r
+ * order.  It removes the list item from the head of the event list as that will\r
+ * have the highest priority owning task of all the tasks on the event list.\r
+ * xTaskRemoveFromUnorderedEventList() is used when the event list is not\r
+ * ordered and the event list items hold something other than the owning tasks\r
+ * priority.  In this case the event list item value is updated to the value\r
+ * passed in the xItemValue parameter.\r
+ *\r
+ * @return pdTRUE if the task being removed has a higher priority than the task\r
+ * making the call, otherwise pdFALSE.\r
+ */\r
+BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;\r
+BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS ONLY\r
+ * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS\r
+ * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.\r
+ *\r
+ * Sets the pointer to the current TCB to the TCB of the highest priority task\r
+ * that is ready to run.\r
+ */\r
+void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE.  THEY ARE USED BY\r
+ * THE EVENT BITS MODULE.\r
+ */\r
+TickType_t uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Return the handle of the calling task.\r
+ */\r
+TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Capture the current time status for future reference.\r
+ */\r
+void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Compare the time status now with that previously captured to see if the\r
+ * timeout has expired.\r
+ */\r
+BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Shortcut used by the queue implementation to prevent unnecessary call to\r
+ * taskYIELD();\r
+ */\r
+void vTaskMissedYield( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Returns the scheduler state as taskSCHEDULER_RUNNING,\r
+ * taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED.\r
+ */\r
+BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Raises the priority of the mutex holder to that of the calling task should\r
+ * the mutex holder have a priority less than the calling task.\r
+ */\r
+void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Set the priority of a task back to its proper priority in the case that it\r
+ * inherited a higher priority while it was holding a semaphore.\r
+ */\r
+BaseType_t xTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Generic version of the task creation function which is in turn called by the\r
+ * xTaskCreate() and xTaskCreateRestricted() macros.\r
+ */\r
+BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/*\r
+ * Get the uxTCBNumber assigned to the task referenced by the xTask parameter.\r
+ */\r
+UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Set the uxTaskNumber of the task referenced by the xTask parameter to\r
+ * uxHandle.\r
+ */\r
+void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Only available when configUSE_TICKLESS_IDLE is set to 1.\r
+ * If tickless mode is being used, or a low power mode is implemented, then\r
+ * the tick interrupt will not execute during idle periods.  When this is the\r
+ * case, the tick count value maintained by the scheduler needs to be kept up\r
+ * to date with the actual execution time by being skipped forward by a time\r
+ * equal to the idle period.\r
+ */\r
+void vTaskStepTick( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * Only avilable when configUSE_TICKLESS_IDLE is set to 1.\r
+ * Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port\r
+ * specific sleep function to determine if it is ok to proceed with the sleep,\r
+ * and if it is ok to proceed, if it is ok to sleep indefinitely.\r
+ *\r
+ * This function is necessary because portSUPPRESS_TICKS_AND_SLEEP() is only\r
+ * called with the scheduler suspended, not from within a critical section.  It\r
+ * is therefore possible for an interrupt to request a context switch between\r
+ * portSUPPRESS_TICKS_AND_SLEEP() and the low power mode actually being\r
+ * entered.  eTaskConfirmSleepModeStatus() should be called from a short\r
+ * critical section between the timer being stopped and the sleep mode being\r
+ * entered to ensure it is ok to proceed into the sleep mode.\r
+ */\r
+eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * For internal use only.  Increment the mutex held count when a mutex is\r
+ * taken and return the handle of the task that has taken the mutex.\r
+ */\r
+void *pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* INC_TASK_H */\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/timers.h b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/include/timers.h
new file mode 100644 (file)
index 0000000..0bbbb02
--- /dev/null
@@ -0,0 +1,1146 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+#ifndef TIMERS_H\r
+#define TIMERS_H\r
+\r
+#ifndef INC_FREERTOS_H\r
+       #error "include FreeRTOS.h must appear in source files before include timers.h"\r
+#endif\r
+\r
+/*lint -e537 This headers are only multiply included if the application code\r
+happens to also be including task.h. */\r
+#include "task.h"\r
+/*lint +e537 */\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*-----------------------------------------------------------\r
+ * MACROS AND DEFINITIONS\r
+ *----------------------------------------------------------*/\r
+\r
+/* IDs for commands that can be sent/received on the timer queue.  These are to\r
+be used solely through the macros that make up the public software timer API,\r
+as defined below.  The commands that are sent from interrupts must use the\r
+highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task\r
+or interrupt version of the queue send function should be used. */\r
+#define tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR   ( ( BaseType_t ) -2 )\r
+#define tmrCOMMAND_EXECUTE_CALLBACK                            ( ( BaseType_t ) -1 )\r
+#define tmrCOMMAND_START_DONT_TRACE                            ( ( BaseType_t ) 0 )\r
+#define tmrCOMMAND_START                                           ( ( BaseType_t ) 1 )\r
+#define tmrCOMMAND_RESET                                               ( ( BaseType_t ) 2 )\r
+#define tmrCOMMAND_STOP                                                        ( ( BaseType_t ) 3 )\r
+#define tmrCOMMAND_CHANGE_PERIOD                               ( ( BaseType_t ) 4 )\r
+#define tmrCOMMAND_DELETE                                              ( ( BaseType_t ) 5 )\r
+\r
+#define tmrFIRST_FROM_ISR_COMMAND                              ( ( BaseType_t ) 6 )\r
+#define tmrCOMMAND_START_FROM_ISR                              ( ( BaseType_t ) 6 )\r
+#define tmrCOMMAND_RESET_FROM_ISR                              ( ( BaseType_t ) 7 )\r
+#define tmrCOMMAND_STOP_FROM_ISR                               ( ( BaseType_t ) 8 )\r
+#define tmrCOMMAND_CHANGE_PERIOD_FROM_ISR              ( ( BaseType_t ) 9 )\r
+\r
+\r
+/**\r
+ * Type by which software timers are referenced.  For example, a call to\r
+ * xTimerCreate() returns an TimerHandle_t variable that can then be used to\r
+ * reference the subject timer in calls to other software timer API functions\r
+ * (for example, xTimerStart(), xTimerReset(), etc.).\r
+ */\r
+typedef void * TimerHandle_t;\r
+\r
+/*\r
+ * Defines the prototype to which timer callback functions must conform.\r
+ */\r
+typedef void (*TimerCallbackFunction_t)( TimerHandle_t xTimer );\r
+\r
+/*\r
+ * Defines the prototype to which functions used with the\r
+ * xTimerPendFunctionCallFromISR() function must conform.\r
+ */\r
+typedef void (*PendedFunction_t)( void *, uint32_t );\r
+\r
+/**\r
+ * TimerHandle_t xTimerCreate(         const char * const pcTimerName,\r
+ *                                                             TickType_t xTimerPeriodInTicks,\r
+ *                                                             UBaseType_t uxAutoReload,\r
+ *                                                             void * pvTimerID,\r
+ *                                                             TimerCallbackFunction_t pxCallbackFunction );\r
+ *\r
+ * Creates a new software timer instance.  This allocates the storage required\r
+ * by the new timer, initialises the new timers internal state, and returns a\r
+ * handle by which the new timer can be referenced.\r
+ *\r
+ * Timers are created in the dormant state.  The xTimerStart(), xTimerReset(),\r
+ * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
+ * xTimerChangePeriodFromISR() API functions can all be used to transition a\r
+ * timer into the active state.\r
+ *\r
+ * @param pcTimerName A text name that is assigned to the timer.  This is done\r
+ * purely to assist debugging.  The kernel itself only ever references a timer\r
+ * by its handle, and never by its name.\r
+ *\r
+ * @param xTimerPeriodInTicks The timer period.  The time is defined in tick\r
+ * periods so the constant portTICK_PERIOD_MS can be used to convert a time that\r
+ * has been specified in milliseconds.  For example, if the timer must expire\r
+ * after 100 ticks, then xTimerPeriodInTicks should be set to 100.\r
+ * Alternatively, if the timer must expire after 500ms, then xPeriod can be set\r
+ * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or\r
+ * equal to 1000.\r
+ *\r
+ * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
+ * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.\r
+ * If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and\r
+ * enter the dormant state after it expires.\r
+ *\r
+ * @param pvTimerID An identifier that is assigned to the timer being created.\r
+ * Typically this would be used in the timer callback function to identify which\r
+ * timer expired when the same callback function is assigned to more than one\r
+ * timer.\r
+ *\r
+ * @param pxCallbackFunction The function to call when the timer expires.\r
+ * Callback functions must have the prototype defined by TimerCallbackFunction_t,\r
+ * which is    "void vCallbackFunction( TimerHandle_t xTimer );".\r
+ *\r
+ * @return If the timer is successfully created then a handle to the newly\r
+ * created timer is returned.  If the timer cannot be created (because either\r
+ * there is insufficient FreeRTOS heap remaining to allocate the timer\r
+ * structures, or the timer period was set to 0) then NULL is returned.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * #define NUM_TIMERS 5\r
+ *\r
+ * // An array to hold handles to the created timers.\r
+ * TimerHandle_t xTimers[ NUM_TIMERS ];\r
+ *\r
+ * // An array to hold a count of the number of times each timer expires.\r
+ * int32_t lExpireCounters[ NUM_TIMERS ] = { 0 };\r
+ *\r
+ * // Define a callback function that will be used by multiple timer instances.\r
+ * // The callback function does nothing but count the number of times the\r
+ * // associated timer expires, and stop the timer once the timer has expired\r
+ * // 10 times.\r
+ * void vTimerCallback( TimerHandle_t pxTimer )\r
+ * {\r
+ * int32_t lArrayIndex;\r
+ * const int32_t xMaxExpiryCountBeforeStopping = 10;\r
+ *\r
+ *        // Optionally do something if the pxTimer parameter is NULL.\r
+ *        configASSERT( pxTimer );\r
+ *\r
+ *     // Which timer expired?\r
+ *     lArrayIndex = ( int32_t ) pvTimerGetTimerID( pxTimer );\r
+ *\r
+ *     // Increment the number of times that pxTimer has expired.\r
+ *     lExpireCounters[ lArrayIndex ] += 1;\r
+ *\r
+ *     // If the timer has expired 10 times then stop it from running.\r
+ *     if( lExpireCounters[ lArrayIndex ] == xMaxExpiryCountBeforeStopping )\r
+ *     {\r
+ *         // Do not use a block time if calling a timer API function from a\r
+ *         // timer callback function, as doing so could cause a deadlock!\r
+ *         xTimerStop( pxTimer, 0 );\r
+ *     }\r
+ * }\r
+ *\r
+ * void main( void )\r
+ * {\r
+ * int32_t x;\r
+ *\r
+ *     // Create then start some timers.  Starting the timers before the scheduler\r
+ *     // has been started means the timers will start running immediately that\r
+ *     // the scheduler starts.\r
+ *     for( x = 0; x < NUM_TIMERS; x++ )\r
+ *     {\r
+ *         xTimers[ x ] = xTimerCreate(    "Timer",       // Just a text name, not used by the kernel.\r
+ *                                         ( 100 * x ),   // The timer period in ticks.\r
+ *                                         pdTRUE,        // The timers will auto-reload themselves when they expire.\r
+ *                                         ( void * ) x,  // Assign each timer a unique id equal to its array index.\r
+ *                                         vTimerCallback // Each timer calls the same callback when it expires.\r
+ *                                     );\r
+ *\r
+ *         if( xTimers[ x ] == NULL )\r
+ *         {\r
+ *             // The timer was not created.\r
+ *         }\r
+ *         else\r
+ *         {\r
+ *             // Start the timer.  No block time is specified, and even if one was\r
+ *             // it would be ignored because the scheduler has not yet been\r
+ *             // started.\r
+ *             if( xTimerStart( xTimers[ x ], 0 ) != pdPASS )\r
+ *             {\r
+ *                 // The timer could not be set into the Active state.\r
+ *             }\r
+ *         }\r
+ *     }\r
+ *\r
+ *     // ...\r
+ *     // Create tasks here.\r
+ *     // ...\r
+ *\r
+ *     // Starting the scheduler will start the timers running as they have already\r
+ *     // been set into the active state.\r
+ *     xTaskStartScheduler();\r
+ *\r
+ *     // Should not reach here.\r
+ *     for( ;; );\r
+ * }\r
+ * @endverbatim\r
+ */\r
+TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+ * void *pvTimerGetTimerID( TimerHandle_t xTimer );\r
+ *\r
+ * Returns the ID assigned to the timer.\r
+ *\r
+ * IDs are assigned to timers using the pvTimerID parameter of the call to\r
+ * xTimerCreated() that was used to create the timer, and by calling the\r
+ * vTimerSetTimerID() API function.\r
+ *\r
+ * If the same callback function is assigned to multiple timers then the timer\r
+ * ID can be used as time specific (timer local) storage.\r
+ *\r
+ * @param xTimer The timer being queried.\r
+ *\r
+ * @return The ID assigned to the timer being queried.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerCreate() API function example usage scenario.\r
+ */\r
+void *pvTimerGetTimerID( const TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );\r
+ *\r
+ * Sets the ID assigned to the timer.\r
+ *\r
+ * IDs are assigned to timers using the pvTimerID parameter of the call to\r
+ * xTimerCreated() that was used to create the timer.\r
+ *\r
+ * If the same callback function is assigned to multiple timers then the timer\r
+ * ID can be used as time specific (timer local) storage.\r
+ *\r
+ * @param xTimer The timer being updated.\r
+ *\r
+ * @param pvNewID The ID to assign to the timer.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerCreate() API function example usage scenario.\r
+ */\r
+void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );\r
+ *\r
+ * Queries a timer to see if it is active or dormant.\r
+ *\r
+ * A timer will be dormant if:\r
+ *     1) It has been created but not started, or\r
+ *     2) It is an expired one-shot timer that has not been restarted.\r
+ *\r
+ * Timers are created in the dormant state.  The xTimerStart(), xTimerReset(),\r
+ * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
+ * xTimerChangePeriodFromISR() API functions can all be used to transition a timer into the\r
+ * active state.\r
+ *\r
+ * @param xTimer The timer being queried.\r
+ *\r
+ * @return pdFALSE will be returned if the timer is dormant.  A value other than\r
+ * pdFALSE will be returned if the timer is active.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This function assumes xTimer has already been created.\r
+ * void vAFunction( TimerHandle_t xTimer )\r
+ * {\r
+ *     if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"\r
+ *     {\r
+ *         // xTimer is active, do something.\r
+ *     }\r
+ *     else\r
+ *     {\r
+ *         // xTimer is not active, do something else.\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );\r
+ *\r
+ * xTimerGetTimerDaemonTaskHandle() is only available if\r
+ * INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h.\r
+ *\r
+ * Simply returns the handle of the timer service/daemon task.  It it not valid\r
+ * to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.\r
+ */\r
+TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xTicksToWait );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task.  Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task\r
+ * through a queue called the timer command queue.  The timer command queue is\r
+ * private to the kernel itself and is not directly accessible to application\r
+ * code.  The length of the timer command queue is set by the\r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerStart() starts a timer that was previously created using the\r
+ * xTimerCreate() API function.  If the timer had already been started and was\r
+ * already in the active state, then xTimerStart() has equivalent functionality\r
+ * to the xTimerReset() API function.\r
+ *\r
+ * Starting a timer ensures the timer is in the active state.  If the timer\r
+ * is not stopped, deleted, or reset in the mean time, the callback function\r
+ * associated with the timer will get called 'n' ticks after xTimerStart() was\r
+ * called, where 'n' is the timers defined period.\r
+ *\r
+ * It is valid to call xTimerStart() before the scheduler has been started, but\r
+ * when this is done the timer will not actually start until the scheduler is\r
+ * started, and the timers expiry time will be relative to when the scheduler is\r
+ * started, not relative to when xTimerStart() was called.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerStart()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being started/restarted.\r
+ *\r
+ * @param xTicksToWait Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the start command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when\r
+ * xTimerStart() was called.  xTicksToWait is ignored if xTimerStart() is called\r
+ * before the scheduler is started.\r
+ *\r
+ * @return pdFAIL will be returned if the start command could not be sent to\r
+ * the timer command queue even after xTicksToWait ticks had passed.  pdPASS will\r
+ * be returned if the command was successfully sent to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system, although the\r
+ * timers expiry time is relative to when xTimerStart() is actually called.  The\r
+ * timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY\r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerCreate() API function example usage scenario.\r
+ *\r
+ */\r
+#define xTimerStart( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )\r
+\r
+/**\r
+ * BaseType_t xTimerStop( TimerHandle_t xTimer, TickType_t xTicksToWait );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task.  Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task\r
+ * through a queue called the timer command queue.  The timer command queue is\r
+ * private to the kernel itself and is not directly accessible to application\r
+ * code.  The length of the timer command queue is set by the\r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerStop() stops a timer that was previously started using either of the\r
+ * The xTimerStart(), xTimerReset(), xTimerStartFromISR(), xTimerResetFromISR(),\r
+ * xTimerChangePeriod() or xTimerChangePeriodFromISR() API functions.\r
+ *\r
+ * Stopping a timer ensures the timer is not in the active state.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerStop()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being stopped.\r
+ *\r
+ * @param xTicksToWait Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the stop command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when\r
+ * xTimerStop() was called.  xTicksToWait is ignored if xTimerStop() is called\r
+ * before the scheduler is started.\r
+ *\r
+ * @return pdFAIL will be returned if the stop command could not be sent to\r
+ * the timer command queue even after xTicksToWait ticks had passed.  pdPASS will\r
+ * be returned if the command was successfully sent to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system.  The timer\r
+ * service/daemon task priority is set by the configTIMER_TASK_PRIORITY\r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerCreate() API function example usage scenario.\r
+ *\r
+ */\r
+#define xTimerStop( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xTicksToWait ) )\r
+\r
+/**\r
+ * BaseType_t xTimerChangePeriod(      TimerHandle_t xTimer,\r
+ *                                                                             TickType_t xNewPeriod,\r
+ *                                                                             TickType_t xTicksToWait );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task.  Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task\r
+ * through a queue called the timer command queue.  The timer command queue is\r
+ * private to the kernel itself and is not directly accessible to application\r
+ * code.  The length of the timer command queue is set by the\r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerChangePeriod() changes the period of a timer that was previously\r
+ * created using the xTimerCreate() API function.\r
+ *\r
+ * xTimerChangePeriod() can be called to change the period of an active or\r
+ * dormant state timer.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for\r
+ * xTimerChangePeriod() to be available.\r
+ *\r
+ * @param xTimer The handle of the timer that is having its period changed.\r
+ *\r
+ * @param xNewPeriod The new period for xTimer. Timer periods are specified in\r
+ * tick periods, so the constant portTICK_PERIOD_MS can be used to convert a time\r
+ * that has been specified in milliseconds.  For example, if the timer must\r
+ * expire after 100 ticks, then xNewPeriod should be set to 100.  Alternatively,\r
+ * if the timer must expire after 500ms, then xNewPeriod can be set to\r
+ * ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than\r
+ * or equal to 1000.\r
+ *\r
+ * @param xTicksToWait Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the change period command to be\r
+ * successfully sent to the timer command queue, should the queue already be\r
+ * full when xTimerChangePeriod() was called.  xTicksToWait is ignored if\r
+ * xTimerChangePeriod() is called before the scheduler is started.\r
+ *\r
+ * @return pdFAIL will be returned if the change period command could not be\r
+ * sent to the timer command queue even after xTicksToWait ticks had passed.\r
+ * pdPASS will be returned if the command was successfully sent to the timer\r
+ * command queue.  When the command is actually processed will depend on the\r
+ * priority of the timer service/daemon task relative to other tasks in the\r
+ * system.  The timer service/daemon task priority is set by the\r
+ * configTIMER_TASK_PRIORITY configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This function assumes xTimer has already been created.  If the timer\r
+ * // referenced by xTimer is already active when it is called, then the timer\r
+ * // is deleted.  If the timer referenced by xTimer is not active when it is\r
+ * // called, then the period of the timer is set to 500ms and the timer is\r
+ * // started.\r
+ * void vAFunction( TimerHandle_t xTimer )\r
+ * {\r
+ *     if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"\r
+ *     {\r
+ *         // xTimer is already active - delete it.\r
+ *         xTimerDelete( xTimer );\r
+ *     }\r
+ *     else\r
+ *     {\r
+ *         // xTimer is not active, change its period to 500ms.  This will also\r
+ *         // cause the timer to start.  Block for a maximum of 100 ticks if the\r
+ *         // change period command cannot immediately be sent to the timer\r
+ *         // command queue.\r
+ *         if( xTimerChangePeriod( xTimer, 500 / portTICK_PERIOD_MS, 100 ) == pdPASS )\r
+ *         {\r
+ *             // The command was successfully sent.\r
+ *         }\r
+ *         else\r
+ *         {\r
+ *             // The command could not be sent, even after waiting for 100 ticks\r
+ *             // to pass.  Take appropriate action here.\r
+ *         }\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+ #define xTimerChangePeriod( xTimer, xNewPeriod, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xTicksToWait ) )\r
+\r
+/**\r
+ * BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task.  Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task\r
+ * through a queue called the timer command queue.  The timer command queue is\r
+ * private to the kernel itself and is not directly accessible to application\r
+ * code.  The length of the timer command queue is set by the\r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerDelete() deletes a timer that was previously created using the\r
+ * xTimerCreate() API function.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for\r
+ * xTimerDelete() to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being deleted.\r
+ *\r
+ * @param xTicksToWait Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the delete command to be\r
+ * successfully sent to the timer command queue, should the queue already be\r
+ * full when xTimerDelete() was called.  xTicksToWait is ignored if xTimerDelete()\r
+ * is called before the scheduler is started.\r
+ *\r
+ * @return pdFAIL will be returned if the delete command could not be sent to\r
+ * the timer command queue even after xTicksToWait ticks had passed.  pdPASS will\r
+ * be returned if the command was successfully sent to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system.  The timer\r
+ * service/daemon task priority is set by the configTIMER_TASK_PRIORITY\r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerChangePeriod() API function example usage scenario.\r
+ */\r
+#define xTimerDelete( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xTicksToWait ) )\r
+\r
+/**\r
+ * BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task.  Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task\r
+ * through a queue called the timer command queue.  The timer command queue is\r
+ * private to the kernel itself and is not directly accessible to application\r
+ * code.  The length of the timer command queue is set by the\r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerReset() re-starts a timer that was previously created using the\r
+ * xTimerCreate() API function.  If the timer had already been started and was\r
+ * already in the active state, then xTimerReset() will cause the timer to\r
+ * re-evaluate its expiry time so that it is relative to when xTimerReset() was\r
+ * called.  If the timer was in the dormant state then xTimerReset() has\r
+ * equivalent functionality to the xTimerStart() API function.\r
+ *\r
+ * Resetting a timer ensures the timer is in the active state.  If the timer\r
+ * is not stopped, deleted, or reset in the mean time, the callback function\r
+ * associated with the timer will get called 'n' ticks after xTimerReset() was\r
+ * called, where 'n' is the timers defined period.\r
+ *\r
+ * It is valid to call xTimerReset() before the scheduler has been started, but\r
+ * when this is done the timer will not actually start until the scheduler is\r
+ * started, and the timers expiry time will be relative to when the scheduler is\r
+ * started, not relative to when xTimerReset() was called.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerReset()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being reset/started/restarted.\r
+ *\r
+ * @param xTicksToWait Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the reset command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when\r
+ * xTimerReset() was called.  xTicksToWait is ignored if xTimerReset() is called\r
+ * before the scheduler is started.\r
+ *\r
+ * @return pdFAIL will be returned if the reset command could not be sent to\r
+ * the timer command queue even after xTicksToWait ticks had passed.  pdPASS will\r
+ * be returned if the command was successfully sent to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system, although the\r
+ * timers expiry time is relative to when xTimerStart() is actually called.  The\r
+ * timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY\r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // When a key is pressed, an LCD back-light is switched on.  If 5 seconds pass\r
+ * // without a key being pressed, then the LCD back-light is switched off.  In\r
+ * // this case, the timer is a one-shot timer.\r
+ *\r
+ * TimerHandle_t xBacklightTimer = NULL;\r
+ *\r
+ * // The callback function assigned to the one-shot timer.  In this case the\r
+ * // parameter is not used.\r
+ * void vBacklightTimerCallback( TimerHandle_t pxTimer )\r
+ * {\r
+ *     // The timer expired, therefore 5 seconds must have passed since a key\r
+ *     // was pressed.  Switch off the LCD back-light.\r
+ *     vSetBacklightState( BACKLIGHT_OFF );\r
+ * }\r
+ *\r
+ * // The key press event handler.\r
+ * void vKeyPressEventHandler( char cKey )\r
+ * {\r
+ *     // Ensure the LCD back-light is on, then reset the timer that is\r
+ *     // responsible for turning the back-light off after 5 seconds of\r
+ *     // key inactivity.  Wait 10 ticks for the command to be successfully sent\r
+ *     // if it cannot be sent immediately.\r
+ *     vSetBacklightState( BACKLIGHT_ON );\r
+ *     if( xTimerReset( xBacklightTimer, 100 ) != pdPASS )\r
+ *     {\r
+ *         // The reset command was not executed successfully.  Take appropriate\r
+ *         // action here.\r
+ *     }\r
+ *\r
+ *     // Perform the rest of the key processing here.\r
+ * }\r
+ *\r
+ * void main( void )\r
+ * {\r
+ * int32_t x;\r
+ *\r
+ *     // Create then start the one-shot timer that is responsible for turning\r
+ *     // the back-light off if no keys are pressed within a 5 second period.\r
+ *     xBacklightTimer = xTimerCreate( "BacklightTimer",           // Just a text name, not used by the kernel.\r
+ *                                     ( 5000 / portTICK_PERIOD_MS), // The timer period in ticks.\r
+ *                                     pdFALSE,                    // The timer is a one-shot timer.\r
+ *                                     0,                          // The id is not used by the callback so can take any value.\r
+ *                                     vBacklightTimerCallback     // The callback function that switches the LCD back-light off.\r
+ *                                   );\r
+ *\r
+ *     if( xBacklightTimer == NULL )\r
+ *     {\r
+ *         // The timer was not created.\r
+ *     }\r
+ *     else\r
+ *     {\r
+ *         // Start the timer.  No block time is specified, and even if one was\r
+ *         // it would be ignored because the scheduler has not yet been\r
+ *         // started.\r
+ *         if( xTimerStart( xBacklightTimer, 0 ) != pdPASS )\r
+ *         {\r
+ *             // The timer could not be set into the Active state.\r
+ *         }\r
+ *     }\r
+ *\r
+ *     // ...\r
+ *     // Create tasks here.\r
+ *     // ...\r
+ *\r
+ *     // Starting the scheduler will start the timer running as it has already\r
+ *     // been set into the active state.\r
+ *     xTaskStartScheduler();\r
+ *\r
+ *     // Should not reach here.\r
+ *     for( ;; );\r
+ * }\r
+ * @endverbatim\r
+ */\r
+#define xTimerReset( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )\r
+\r
+/**\r
+ * BaseType_t xTimerStartFromISR(      TimerHandle_t xTimer,\r
+ *                                                                     BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * A version of xTimerStart() that can be called from an interrupt service\r
+ * routine.\r
+ *\r
+ * @param xTimer The handle of the timer being started/restarted.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue.  Calling xTimerStartFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state.  If calling xTimerStartFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerStartFromISR() function.  If\r
+ * xTimerStartFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the start command could not be sent to\r
+ * the timer command queue.  pdPASS will be returned if the command was\r
+ * successfully sent to the timer command queue.  When the command is actually\r
+ * processed will depend on the priority of the timer service/daemon task\r
+ * relative to other tasks in the system, although the timers expiry time is\r
+ * relative to when xTimerStartFromISR() is actually called.  The timer\r
+ * service/daemon task priority is set by the configTIMER_TASK_PRIORITY\r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This scenario assumes xBacklightTimer has already been created.  When a\r
+ * // key is pressed, an LCD back-light is switched on.  If 5 seconds pass\r
+ * // without a key being pressed, then the LCD back-light is switched off.  In\r
+ * // this case, the timer is a one-shot timer, and unlike the example given for\r
+ * // the xTimerReset() function, the key press event handler is an interrupt\r
+ * // service routine.\r
+ *\r
+ * // The callback function assigned to the one-shot timer.  In this case the\r
+ * // parameter is not used.\r
+ * void vBacklightTimerCallback( TimerHandle_t pxTimer )\r
+ * {\r
+ *     // The timer expired, therefore 5 seconds must have passed since a key\r
+ *     // was pressed.  Switch off the LCD back-light.\r
+ *     vSetBacklightState( BACKLIGHT_OFF );\r
+ * }\r
+ *\r
+ * // The key press interrupt service routine.\r
+ * void vKeyPressEventInterruptHandler( void )\r
+ * {\r
+ * BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ *     // Ensure the LCD back-light is on, then restart the timer that is\r
+ *     // responsible for turning the back-light off after 5 seconds of\r
+ *     // key inactivity.  This is an interrupt service routine so can only\r
+ *     // call FreeRTOS API functions that end in "FromISR".\r
+ *     vSetBacklightState( BACKLIGHT_ON );\r
+ *\r
+ *     // xTimerStartFromISR() or xTimerResetFromISR() could be called here\r
+ *     // as both cause the timer to re-calculate its expiry time.\r
+ *     // xHigherPriorityTaskWoken was initialised to pdFALSE when it was\r
+ *     // declared (in this function).\r
+ *     if( xTimerStartFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ *     {\r
+ *         // The start command was not executed successfully.  Take appropriate\r
+ *         // action here.\r
+ *     }\r
+ *\r
+ *     // Perform the rest of the key processing here.\r
+ *\r
+ *     // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ *     // should be performed.  The syntax required to perform a context switch\r
+ *     // from inside an ISR varies from port to port, and from compiler to\r
+ *     // compiler.  Inspect the demos for the port you are using to find the\r
+ *     // actual syntax required.\r
+ *     if( xHigherPriorityTaskWoken != pdFALSE )\r
+ *     {\r
+ *         // Call the interrupt safe yield function here (actual function\r
+ *         // depends on the FreeRTOS port being used).\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
+\r
+/**\r
+ * BaseType_t xTimerStopFromISR(       TimerHandle_t xTimer,\r
+ *                                                                     BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * A version of xTimerStop() that can be called from an interrupt service\r
+ * routine.\r
+ *\r
+ * @param xTimer The handle of the timer being stopped.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue.  Calling xTimerStopFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state.  If calling xTimerStopFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerStopFromISR() function.  If\r
+ * xTimerStopFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the stop command could not be sent to\r
+ * the timer command queue.  pdPASS will be returned if the command was\r
+ * successfully sent to the timer command queue.  When the command is actually\r
+ * processed will depend on the priority of the timer service/daemon task\r
+ * relative to other tasks in the system.  The timer service/daemon task\r
+ * priority is set by the configTIMER_TASK_PRIORITY configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This scenario assumes xTimer has already been created and started.  When\r
+ * // an interrupt occurs, the timer should be simply stopped.\r
+ *\r
+ * // The interrupt service routine that stops the timer.\r
+ * void vAnExampleInterruptServiceRoutine( void )\r
+ * {\r
+ * BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ *     // The interrupt has occurred - simply stop the timer.\r
+ *     // xHigherPriorityTaskWoken was set to pdFALSE where it was defined\r
+ *     // (within this function).  As this is an interrupt service routine, only\r
+ *     // FreeRTOS API functions that end in "FromISR" can be used.\r
+ *     if( xTimerStopFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ *     {\r
+ *         // The stop command was not executed successfully.  Take appropriate\r
+ *         // action here.\r
+ *     }\r
+ *\r
+ *     // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ *     // should be performed.  The syntax required to perform a context switch\r
+ *     // from inside an ISR varies from port to port, and from compiler to\r
+ *     // compiler.  Inspect the demos for the port you are using to find the\r
+ *     // actual syntax required.\r
+ *     if( xHigherPriorityTaskWoken != pdFALSE )\r
+ *     {\r
+ *         // Call the interrupt safe yield function here (actual function\r
+ *         // depends on the FreeRTOS port being used).\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP_FROM_ISR, 0, ( pxHigherPriorityTaskWoken ), 0U )\r
+\r
+/**\r
+ * BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,\r
+ *                                                                              TickType_t xNewPeriod,\r
+ *                                                                              BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * A version of xTimerChangePeriod() that can be called from an interrupt\r
+ * service routine.\r
+ *\r
+ * @param xTimer The handle of the timer that is having its period changed.\r
+ *\r
+ * @param xNewPeriod The new period for xTimer. Timer periods are specified in\r
+ * tick periods, so the constant portTICK_PERIOD_MS can be used to convert a time\r
+ * that has been specified in milliseconds.  For example, if the timer must\r
+ * expire after 100 ticks, then xNewPeriod should be set to 100.  Alternatively,\r
+ * if the timer must expire after 500ms, then xNewPeriod can be set to\r
+ * ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than\r
+ * or equal to 1000.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue.  Calling xTimerChangePeriodFromISR() writes a message to the\r
+ * timer command queue, so has the potential to transition the timer service/\r
+ * daemon task out of the Blocked state.  If calling xTimerChangePeriodFromISR()\r
+ * causes the timer service/daemon task to leave the Blocked state, and the\r
+ * timer service/daemon task has a priority equal to or greater than the\r
+ * currently executing task (the task that was interrupted), then\r
+ * *pxHigherPriorityTaskWoken will get set to pdTRUE internally within the\r
+ * xTimerChangePeriodFromISR() function.  If xTimerChangePeriodFromISR() sets\r
+ * this value to pdTRUE then a context switch should be performed before the\r
+ * interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the command to change the timers period\r
+ * could not be sent to the timer command queue.  pdPASS will be returned if the\r
+ * command was successfully sent to the timer command queue.  When the command\r
+ * is actually processed will depend on the priority of the timer service/daemon\r
+ * task relative to other tasks in the system.  The timer service/daemon task\r
+ * priority is set by the configTIMER_TASK_PRIORITY configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This scenario assumes xTimer has already been created and started.  When\r
+ * // an interrupt occurs, the period of xTimer should be changed to 500ms.\r
+ *\r
+ * // The interrupt service routine that changes the period of xTimer.\r
+ * void vAnExampleInterruptServiceRoutine( void )\r
+ * {\r
+ * BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ *     // The interrupt has occurred - change the period of xTimer to 500ms.\r
+ *     // xHigherPriorityTaskWoken was set to pdFALSE where it was defined\r
+ *     // (within this function).  As this is an interrupt service routine, only\r
+ *     // FreeRTOS API functions that end in "FromISR" can be used.\r
+ *     if( xTimerChangePeriodFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ *     {\r
+ *         // The command to change the timers period was not executed\r
+ *         // successfully.  Take appropriate action here.\r
+ *     }\r
+ *\r
+ *     // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ *     // should be performed.  The syntax required to perform a context switch\r
+ *     // from inside an ISR varies from port to port, and from compiler to\r
+ *     // compiler.  Inspect the demos for the port you are using to find the\r
+ *     // actual syntax required.\r
+ *     if( xHigherPriorityTaskWoken != pdFALSE )\r
+ *     {\r
+ *         // Call the interrupt safe yield function here (actual function\r
+ *         // depends on the FreeRTOS port being used).\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD_FROM_ISR, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U )\r
+\r
+/**\r
+ * BaseType_t xTimerResetFromISR(      TimerHandle_t xTimer,\r
+ *                                                                     BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * A version of xTimerReset() that can be called from an interrupt service\r
+ * routine.\r
+ *\r
+ * @param xTimer The handle of the timer that is to be started, reset, or\r
+ * restarted.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue.  Calling xTimerResetFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state.  If calling xTimerResetFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerResetFromISR() function.  If\r
+ * xTimerResetFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the reset command could not be sent to\r
+ * the timer command queue.  pdPASS will be returned if the command was\r
+ * successfully sent to the timer command queue.  When the command is actually\r
+ * processed will depend on the priority of the timer service/daemon task\r
+ * relative to other tasks in the system, although the timers expiry time is\r
+ * relative to when xTimerResetFromISR() is actually called.  The timer service/daemon\r
+ * task priority is set by the configTIMER_TASK_PRIORITY configuration constant.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ * // This scenario assumes xBacklightTimer has already been created.  When a\r
+ * // key is pressed, an LCD back-light is switched on.  If 5 seconds pass\r
+ * // without a key being pressed, then the LCD back-light is switched off.  In\r
+ * // this case, the timer is a one-shot timer, and unlike the example given for\r
+ * // the xTimerReset() function, the key press event handler is an interrupt\r
+ * // service routine.\r
+ *\r
+ * // The callback function assigned to the one-shot timer.  In this case the\r
+ * // parameter is not used.\r
+ * void vBacklightTimerCallback( TimerHandle_t pxTimer )\r
+ * {\r
+ *     // The timer expired, therefore 5 seconds must have passed since a key\r
+ *     // was pressed.  Switch off the LCD back-light.\r
+ *     vSetBacklightState( BACKLIGHT_OFF );\r
+ * }\r
+ *\r
+ * // The key press interrupt service routine.\r
+ * void vKeyPressEventInterruptHandler( void )\r
+ * {\r
+ * BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ *     // Ensure the LCD back-light is on, then reset the timer that is\r
+ *     // responsible for turning the back-light off after 5 seconds of\r
+ *     // key inactivity.  This is an interrupt service routine so can only\r
+ *     // call FreeRTOS API functions that end in "FromISR".\r
+ *     vSetBacklightState( BACKLIGHT_ON );\r
+ *\r
+ *     // xTimerStartFromISR() or xTimerResetFromISR() could be called here\r
+ *     // as both cause the timer to re-calculate its expiry time.\r
+ *     // xHigherPriorityTaskWoken was initialised to pdFALSE when it was\r
+ *     // declared (in this function).\r
+ *     if( xTimerResetFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ *     {\r
+ *         // The reset command was not executed successfully.  Take appropriate\r
+ *         // action here.\r
+ *     }\r
+ *\r
+ *     // Perform the rest of the key processing here.\r
+ *\r
+ *     // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ *     // should be performed.  The syntax required to perform a context switch\r
+ *     // from inside an ISR varies from port to port, and from compiler to\r
+ *     // compiler.  Inspect the demos for the port you are using to find the\r
+ *     // actual syntax required.\r
+ *     if( xHigherPriorityTaskWoken != pdFALSE )\r
+ *     {\r
+ *         // Call the interrupt safe yield function here (actual function\r
+ *         // depends on the FreeRTOS port being used).\r
+ *     }\r
+ * }\r
+ * @endverbatim\r
+ */\r
+#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
+\r
+\r
+/**\r
+ * BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,\r
+ *                                          void *pvParameter1,\r
+ *                                          uint32_t ulParameter2,\r
+ *                                          BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ *\r
+ * Used from application interrupt service routines to defer the execution of a\r
+ * function to the RTOS daemon task (the timer service task, hence this function\r
+ * is implemented in timers.c and is prefixed with 'Timer').\r
+ *\r
+ * Ideally an interrupt service routine (ISR) is kept as short as possible, but\r
+ * sometimes an ISR either has a lot of processing to do, or needs to perform\r
+ * processing that is not deterministic.  In these cases\r
+ * xTimerPendFunctionCallFromISR() can be used to defer processing of a function\r
+ * to the RTOS daemon task.\r
+ *\r
+ * A mechanism is provided that allows the interrupt to return directly to the\r
+ * task that will subsequently execute the pended callback function.  This\r
+ * allows the callback function to execute contiguously in time with the\r
+ * interrupt - just as if the callback had executed in the interrupt itself.\r
+ *\r
+ * @param xFunctionToPend The function to execute from the timer service/\r
+ * daemon task.  The function must conform to the PendedFunction_t\r
+ * prototype.\r
+ *\r
+ * @param pvParameter1 The value of the callback function's first parameter.\r
+ * The parameter has a void * type to allow it to be used to pass any type.\r
+ * For example, unsigned longs can be cast to a void *, or the void * can be\r
+ * used to point to a structure.\r
+ *\r
+ * @param ulParameter2 The value of the callback function's second parameter.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken As mentioned above, calling this function\r
+ * will result in a message being sent to the timer daemon task.  If the\r
+ * priority of the timer daemon task (which is set using\r
+ * configTIMER_TASK_PRIORITY in FreeRTOSConfig.h) is higher than the priority of\r
+ * the currently running task (the task the interrupt interrupted) then\r
+ * *pxHigherPriorityTaskWoken will be set to pdTRUE within\r
+ * xTimerPendFunctionCallFromISR(), indicating that a context switch should be\r
+ * requested before the interrupt exits.  For that reason\r
+ * *pxHigherPriorityTaskWoken must be initialised to pdFALSE.  See the\r
+ * example code below.\r
+ *\r
+ * @return pdPASS is returned if the message was successfully sent to the\r
+ * timer daemon task, otherwise pdFALSE is returned.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ *\r
+ *     // The callback function that will execute in the context of the daemon task.\r
+ *  // Note callback functions must all use this same prototype.\r
+ *  void vProcessInterface( void *pvParameter1, uint32_t ulParameter2 )\r
+ *     {\r
+ *             BaseType_t xInterfaceToService;\r
+ *\r
+ *             // The interface that requires servicing is passed in the second\r
+ *      // parameter.  The first parameter is not used in this case.\r
+ *             xInterfaceToService = ( BaseType_t ) ulParameter2;\r
+ *\r
+ *             // ...Perform the processing here...\r
+ *     }\r
+ *\r
+ *     // An ISR that receives data packets from multiple interfaces\r
+ *  void vAnISR( void )\r
+ *     {\r
+ *             BaseType_t xInterfaceToService, xHigherPriorityTaskWoken;\r
+ *\r
+ *             // Query the hardware to determine which interface needs processing.\r
+ *             xInterfaceToService = prvCheckInterfaces();\r
+ *\r
+ *      // The actual processing is to be deferred to a task.  Request the\r
+ *      // vProcessInterface() callback function is executed, passing in the\r
+ *             // number of the interface that needs processing.  The interface to\r
+ *             // service is passed in the second parameter.  The first parameter is\r
+ *             // not used in this case.\r
+ *             xHigherPriorityTaskWoken = pdFALSE;\r
+ *             xTimerPendFunctionCallFromISR( vProcessInterface, NULL, ( uint32_t ) xInterfaceToService, &xHigherPriorityTaskWoken );\r
+ *\r
+ *             // If xHigherPriorityTaskWoken is now set to pdTRUE then a context\r
+ *             // switch should be requested.  The macro used is port specific and will\r
+ *             // be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - refer to\r
+ *             // the documentation page for the port being used.\r
+ *             portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ *\r
+ *     }\r
+ * @endverbatim\r
+ */\r
+BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+\r
+ /**\r
+  * BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,\r
+  *                                    void *pvParameter1,\r
+  *                                    uint32_t ulParameter2,\r
+  *                                    TickType_t xTicksToWait );\r
+  *\r
+  *\r
+  * Used to defer the execution of a function to the RTOS daemon task (the timer\r
+  * service task, hence this function is implemented in timers.c and is prefixed\r
+  * with 'Timer').\r
+  *\r
+  * @param xFunctionToPend The function to execute from the timer service/\r
+  * daemon task.  The function must conform to the PendedFunction_t\r
+  * prototype.\r
+  *\r
+  * @param pvParameter1 The value of the callback function's first parameter.\r
+  * The parameter has a void * type to allow it to be used to pass any type.\r
+  * For example, unsigned longs can be cast to a void *, or the void * can be\r
+  * used to point to a structure.\r
+  *\r
+  * @param ulParameter2 The value of the callback function's second parameter.\r
+  *\r
+  * @param xTicksToWait Calling this function will result in a message being\r
+  * sent to the timer daemon task on a queue.  xTicksToWait is the amount of\r
+  * time the calling task should remain in the Blocked state (so not using any\r
+  * processing time) for space to become available on the timer queue if the\r
+  * queue is found to be full.\r
+  *\r
+  * @return pdPASS is returned if the message was successfully sent to the\r
+  * timer daemon task, otherwise pdFALSE is returned.\r
+  *\r
+  */\r
+BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * const char * const pcTimerGetTimerName( TimerHandle_t xTimer );\r
+ *\r
+ * Returns the name that was assigned to a timer when the timer was created.\r
+ *\r
+ * @param xTimer The handle of the timer being queried.\r
+ *\r
+ * @return The name assigned to the timer specified by the xTimer parameter.\r
+ */\r
+const char * pcTimerGetTimerName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/*\r
+ * Functions beyond this part are not part of the public API and are intended\r
+ * for use by the kernel only.\r
+ */\r
+BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
+BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* TIMERS_H */\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/portZynq7000.c b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/portZynq7000.c
new file mode 100644 (file)
index 0000000..19f9e11
--- /dev/null
@@ -0,0 +1,266 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Xilinx includes. */\r
+#include "xscutimer.h"\r
+#include "xscugic.h"\r
+\r
+#define XSCUTIMER_CLOCK_HZ ( XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 2UL )\r
+\r
+/*\r
+ * Some FreeRTOSConfig.h settings require the application writer to provide the\r
+ * implementation of a callback function that has a specific name, and a linker\r
+ * error will result if the application does not provide the required function.\r
+ * To avoid the risk of a configuration file setting resulting in a linker error\r
+ * this file provides default implementations of each callback that might be\r
+ * required.  The default implementations are declared as weak symbols to allow\r
+ * the application writer to override the default implementation by providing\r
+ * their own implementation in the application itself.\r
+ */\r
+void vApplicationAssert( const char *pcFileName, uint32_t ulLine ) __attribute__((weak));\r
+void vApplicationTickHook( void ) __attribute__((weak));\r
+void vApplicationIdleHook( void ) __attribute__((weak));\r
+void vApplicationMallocFailedHook( void ) __attribute((weak));\r
+void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ) __attribute__((weak));\r
+\r
+/* Timer used to generate the tick interrupt. */\r
+static XScuTimer xTimer;\r
+\r
+/* The IRQ handler, which is also aliased to the name used in standalone\r
+projects. */\r
+void FreeRTOS_ApplicationIRQHandler( uint32_t ulICCIAR );\r
+void vApplicationIRQHandler( uint32_t ulICCIAR ) __attribute__ ( ( weak, alias ("FreeRTOS_ApplicationIRQHandler") ) );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void FreeRTOS_SetupTickInterrupt( void )\r
+{\r
+static XScuGic xInterruptController;   /* Interrupt controller instance */\r
+BaseType_t xStatus;\r
+extern void FreeRTOS_Tick_Handler( void );\r
+XScuTimer_Config *pxTimerConfig;\r
+XScuGic_Config *pxGICConfig;\r
+const uint8_t ucRisingEdge = 3;\r
+\r
+       /* This function is called with the IRQ interrupt disabled, and the IRQ\r
+       interrupt should be left disabled.  It is enabled automatically when the\r
+       scheduler is started. */\r
+\r
+       /* Ensure XScuGic_CfgInitialize() has been called.  In this demo it has\r
+       already been called from prvSetupHardware() in main(). */\r
+       pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );\r
+       xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );\r
+       configASSERT( xStatus == XST_SUCCESS );\r
+       ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */\r
+\r
+       /* The priority must be the lowest possible. */\r
+       XScuGic_SetPriorityTriggerType( &xInterruptController, XPAR_SCUTIMER_INTR, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT, ucRisingEdge );\r
+\r
+       /* Install the FreeRTOS tick handler. */\r
+       xStatus = XScuGic_Connect( &xInterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler) FreeRTOS_Tick_Handler, ( void * ) &xTimer );\r
+       configASSERT( xStatus == XST_SUCCESS );\r
+       ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */\r
+\r
+       /* Initialise the timer. */\r
+       pxTimerConfig = XScuTimer_LookupConfig( XPAR_SCUTIMER_DEVICE_ID );\r
+       xStatus = XScuTimer_CfgInitialize( &xTimer, pxTimerConfig, pxTimerConfig->BaseAddr );\r
+       configASSERT( xStatus == XST_SUCCESS );\r
+       ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */\r
+\r
+       /* Enable Auto reload mode. */\r
+       XScuTimer_EnableAutoReload( &xTimer );\r
+\r
+       /* Ensure there is no prescale. */\r
+       XScuTimer_SetPrescaler( &xTimer, 0 );\r
+\r
+       /* Load the timer counter register. */\r
+       XScuTimer_LoadTimer( &xTimer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ );\r
+\r
+       /* Start the timer counter and then wait for it to timeout a number of\r
+       times. */\r
+       XScuTimer_Start( &xTimer );\r
+\r
+       /* Enable the interrupt for the xTimer in the interrupt controller. */\r
+       XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR );\r
+\r
+       /* Enable the interrupt in the xTimer itself. */\r
+       FreeRTOS_ClearTickInterrupt();\r
+       XScuTimer_EnableInterrupt( &xTimer );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void FreeRTOS_ClearTickInterrupt( void )\r
+{\r
+       XScuTimer_ClearInterruptStatus( &xTimer );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void FreeRTOS_ApplicationIRQHandler( uint32_t ulICCIAR )\r
+{\r
+extern const XScuGic_Config XScuGic_ConfigTable[];\r
+static const XScuGic_VectorTableEntry *pxVectorTable = XScuGic_ConfigTable[ XPAR_SCUGIC_SINGLE_DEVICE_ID ].HandlerTable;\r
+uint32_t ulInterruptID;\r
+const XScuGic_VectorTableEntry *pxVectorEntry;\r
+\r
+       /* The ID of the interrupt is obtained by bitwise anding the ICCIAR value\r
+       with 0x3FF. */\r
+       ulInterruptID = ulICCIAR & 0x3FFUL;\r
+       if( ulInterruptID < XSCUGIC_MAX_NUM_INTR_INPUTS )\r
+       {\r
+               /* Call the function installed in the array of installed handler functions. */\r
+               pxVectorEntry = &( pxVectorTable[ ulInterruptID ] );\r
+               pxVectorEntry->Handler( pxVectorEntry->CallBackRef );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This version of vApplicationAssert() is declared as a weak symbol to allow it\r
+to be overridden by a version implemented within the application that is using\r
+this BSP. */\r
+void vApplicationAssert( const char *pcFileName, uint32_t ulLine )\r
+{\r
+volatile uint32_t ul = 0;\r
+volatile const char *pcLocalFileName = pcFileName; /* To prevent pcFileName being optimized away. */\r
+volatile uint32_t ulLocalLine = ulLine; /* To prevent ulLine being optimized away. */\r
+\r
+       /* Prevent compile warnings about the following two variables being set but\r
+       not referenced.  They are intended for viewing in the debugger. */\r
+       ( void ) pcLocalFileName;\r
+       ( void ) ulLocalLine;\r
+\r
+       xil_printf( "Assert failed in file %s, line %lu\r\n", pcLocalFileName, ulLocalLine );\r
+\r
+       /* If this function is entered then a call to configASSERT() failed in the\r
+       FreeRTOS code because of a fatal error.  The pcFileName and ulLine\r
+       parameters hold the file name and line number in that file of the assert\r
+       that failed.  Additionally, if using the debugger, the function call stack\r
+       can be viewed to find which line failed its configASSERT() test.  Finally,\r
+       the debugger can be used to set ul to a non-zero value, then step out of\r
+       this function to find where the assert function was entered. */\r
+       taskENTER_CRITICAL();\r
+       {\r
+               while( ul == 0 )\r
+               {\r
+                       __asm volatile( "NOP" );\r
+               }\r
+       }\r
+       taskEXIT_CRITICAL();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default tick hook does nothing and is declared as a weak symbol to allow\r
+the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationTickHook( void )\r
+{\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default idle hook does nothing and is declared as a weak symbol to allow\r
+the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationIdleHook( void )\r
+{\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default malloc failed hook does nothing and is declared as a weak symbol\r
+to allow the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationMallocFailedHook( void )\r
+{\r
+       xil_printf( "vApplicationMallocFailedHook() called\n" );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default stack overflow hook will stop the application for executing.  It\r
+is declared as a weak symbol to allow the application writer to override this\r
+default by providing their own implementation in the application code. */\r
+void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )\r
+{\r
+/* Attempt to prevent the handle and name of the task that overflowed its stack\r
+from being optimised away because they are not used. */\r
+volatile TaskHandle_t xOverflowingTaskHandle = xTask;\r
+volatile char *pcOverflowingTaskName = pcTaskName;\r
+\r
+       ( void ) xOverflowingTaskHandle;\r
+       ( void ) pcOverflowingTaskName;\r
+\r
+       xil_printf( "HALT: Task %s overflowed its stack.", pcOverflowingTaskName );\r
+       portDISABLE_INTERRUPTS();\r
+       for( ;; );\r
+}\r
+\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/port_asm_vectors.S b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/ARM_CA9/port_asm_vectors.S
new file mode 100644 (file)
index 0000000..5824033
--- /dev/null
@@ -0,0 +1,146 @@
+/******************************************************************************
+*
+* (c) Copyright 2009-13 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 asm_vectors.s
+*
+* This file contains the initial vector table for the Cortex A9 processor
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who     Date     Changes
+* ----- ------- -------- ---------------------------------------------------
+* 1.00a ecm/sdm 10/20/09 Initial version
+* 3.05a sdm    02/02/12 Save lr when profiling is enabled
+* 3.10a srt     04/18/13 Implemented ARM Erratas. Please refer to file
+*                       'xil_errata.h' for errata description
+* </pre>
+*
+* @note
+*
+* None.
+*
+******************************************************************************/
+
+#include "xil_errata.h"
+
+.org 0
+.text
+.arm
+
+.global _boot
+.global _freertos_vector_table
+.global _vector_table
+
+.global FIQInterrupt
+.global DataAbortInterrupt
+.global PrefetchAbortInterrupt
+.global vPortInstallFreeRTOSVectorTable
+
+.extern FreeRTOS_IRQ_Handler
+.extern FreeRTOS_SWI_Handler
+
+.section .vectors
+_vector_table:
+_freertos_vector_table:
+       B         _boot
+       B         FreeRTOS_Undefined
+       ldr   pc, _swi
+       B         FreeRTOS_PrefetchAbortHandler
+       B         FreeRTOS_DataAbortHandler
+       NOP       /* Placeholder for address exception vector*/
+       LDR   PC, _irq
+       B         FreeRTOS_FIQHandler
+
+_irq:   .word FreeRTOS_IRQ_Handler
+_swi:   .word FreeRTOS_SWI_Handler
+
+
+.align 4
+FreeRTOS_FIQHandler:                   /* FIQ vector handler */
+       stmdb   sp!,{r0-r3,r12,lr}      /* state save from compiled code */
+FIQLoop:
+       blx     FIQInterrupt                    /* FIQ vector */
+       ldmia   sp!,{r0-r3,r12,lr}      /* state restore from compiled code */
+       subs    pc, lr, #4                      /* adjust return */
+
+.align 4
+FreeRTOS_Undefined:                            /* Undefined handler */
+       b               .
+
+.align 4
+FreeRTOS_DataAbortHandler:             /* Data Abort handler */
+#ifdef CONFIG_ARM_ERRATA_775420
+       dsb
+#endif
+       stmdb   sp!,{r0-r3,r12,lr}      /* state save from compiled code */
+       blx     DataAbortInterrupt              /*DataAbortInterrupt :call C function here */
+       ldmia   sp!,{r0-r3,r12,lr}      /* state restore from compiled code */
+       subs    pc, lr, #4                      /* adjust return */
+
+.align 4
+FreeRTOS_PrefetchAbortHandler: /* Prefetch Abort handler */
+#ifdef CONFIG_ARM_ERRATA_775420
+       dsb
+#endif
+       stmdb   sp!,{r0-r3,r12,lr}      /* state save from compiled code */
+       blx     PrefetchAbortInterrupt  /* PrefetchAbortInterrupt: call C function here */
+       ldmia   sp!,{r0-r3,r12,lr}      /* state restore from compiled code */
+       subs    pc, lr, #4                      /* adjust return */
+
+.align 4
+.type vPortInstallFreeRTOSVectorTable, %function
+vPortInstallFreeRTOSVectorTable:
+
+       /* Set VBAR to the vector table that contains the FreeRTOS handlers. */
+       ldr     r0, =_freertos_vector_table
+       mcr     p15, 0, r0, c12, c0, 0
+       dsb
+       isb
+       bx lr
+
+
+.end
+
+
+
+
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/MicroBlazeV8/portmicroblaze.c b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/bsp/freertos822_xilinx_v1_0/src/Source/portable/GCC/MicroBlazeV8/portmicroblaze.c
new file mode 100644 (file)
index 0000000..e5def74
--- /dev/null
@@ -0,0 +1,274 @@
+/*\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Xilinx includes. */\r
+#include "xil_printf.h"\r
+#include "xparameters.h"\r
+\r
+#if defined( XPAR_XTMRCTR_NUM_INSTANCES )\r
+       #if( XPAR_XTMRCTR_NUM_INSTANCES > 0 )\r
+               #include "xtmrctr.h"\r
+               /* The timer is used to generate the RTOS tick interrupt. */\r
+               static XTmrCtr xTickTimerInstance;\r
+       #endif\r
+#endif\r
+\r
+/*\r
+ * Some FreeRTOSConfig.h settings require the application writer to provide the\r
+ * implementation of a callback function that has a specific name, and a linker\r
+ * error will result if the application does not provide the required function.\r
+ * To avoid the risk of a configuration file setting resulting in a linker error\r
+ * this file provides default implementations of each callback that might be\r
+ * required.  The default implementations are declared as weak symbols to allow\r
+ * the application writer to override the default implementation by providing\r
+ * their own implementation in the application itself.\r
+ */\r
+void vApplicationAssert( const char *pcFileName, uint32_t ulLine ) __attribute__((weak));\r
+void vApplicationTickHook( void ) __attribute__((weak));\r
+void vApplicationIdleHook( void ) __attribute__((weak));\r
+void vApplicationMallocFailedHook( void ) __attribute((weak));\r
+void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ) __attribute__((weak));\r
+void vApplicationSetupTimerInterrupt( void ) __attribute__((weak));\r
+void vApplicationClearTimerInterrupt( void ) __attribute__((weak));\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/* This version of vApplicationAssert() is declared as a weak symbol to allow it\r
+to be overridden by a version implemented within the application that is using\r
+this BSP. */\r
+void vApplicationAssert( const char *pcFileName, uint32_t ulLine )\r
+{\r
+volatile uint32_t ul = 0;\r
+volatile const char *pcLocalFileName = pcFileName; /* To prevent pcFileName being optimized away. */\r
+volatile uint32_t ulLocalLine = ulLine; /* To prevent ulLine being optimized away. */\r
+\r
+       /* Prevent compile warnings about the following two variables being set but\r
+       not referenced.  They are intended for viewing in the debugger. */\r
+       ( void ) pcLocalFileName;\r
+       ( void ) ulLocalLine;\r
+\r
+       xil_printf( "Assert failed in file %s, line %lu\r\n", pcLocalFileName, ulLocalLine );\r
+\r
+       /* If this function is entered then a call to configASSERT() failed in the\r
+       FreeRTOS code because of a fatal error.  The pcFileName and ulLine\r
+       parameters hold the file name and line number in that file of the assert\r
+       that failed.  Additionally, if using the debugger, the function call stack\r
+       can be viewed to find which line failed its configASSERT() test.  Finally,\r
+       the debugger can be used to set ul to a non-zero value, then step out of\r
+       this function to find where the assert function was entered. */\r
+       taskENTER_CRITICAL();\r
+       {\r
+               while( ul == 0 )\r
+               {\r
+                       __asm volatile( "NOP" );\r
+               }\r
+       }\r
+       taskEXIT_CRITICAL();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default tick hook does nothing and is declared as a weak symbol to allow\r
+the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationTickHook( void )\r
+{\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default idle hook does nothing and is declared as a weak symbol to allow\r
+the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationIdleHook( void )\r
+{\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default malloc failed hook does nothing and is declared as a weak symbol\r
+to allow the application writer to override this default by providing their own\r
+implementation in the application code. */\r
+void vApplicationMallocFailedHook( void )\r
+{\r
+       xil_printf( "vApplicationMallocFailedHook() called\n" );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This default stack overflow hook will stop the application for executing.  It\r
+is declared as a weak symbol to allow the application writer to override this\r
+default by providing their own implementation in the application code. */\r
+void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )\r
+{\r
+/* Attempt to prevent the handle and name of the task that overflowed its stack\r
+from being optimised away because they are not used. */\r
+volatile TaskHandle_t xOverflowingTaskHandle = xTask;\r
+volatile char *pcOverflowingTaskName = pcTaskName;\r
+\r
+       ( void ) xOverflowingTaskHandle;\r
+       ( void ) pcOverflowingTaskName;\r
+\r
+       xil_printf( "HALT: Task %s overflowed its stack.", pcOverflowingTaskName );\r
+       portDISABLE_INTERRUPTS();\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if defined( XPAR_XTMRCTR_NUM_INSTANCES )\r
+       #if( XPAR_XTMRCTR_NUM_INSTANCES > 0 )\r
+               /* This is a default implementation of what is otherwise an application defined\r
+               callback function used to install the tick interrupt handler.  It is provided as\r
+               an application callback because the kernel will run on lots of different\r
+               MicroBlaze and FPGA configurations - not all of which will have the same timer\r
+               peripherals defined or available.  vApplicationSetupTimerInterrupt() is declared\r
+               as a weak symbol, allowing the application writer to provide their own\r
+               implementation, if this default implementation is not suitable. */\r
+               void vApplicationSetupTimerInterrupt( void )\r
+               {\r
+               portBASE_TYPE xStatus;\r
+               const unsigned char ucTickTimerCounterNumber = ( unsigned char ) 0U;\r
+               const unsigned char ucRunTimeStatsCounterNumber = ( unsigned char ) 1U;\r
+               const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );\r
+               extern void vPortTickISR( void *pvUnused );\r
+\r
+                       /* Initialise the timer/counter. */\r
+                       xStatus = XTmrCtr_Initialize( &xTickTimerInstance, XPAR_TMRCTR_0_DEVICE_ID );\r
+\r
+                       if( xStatus == XST_SUCCESS )\r
+                       {\r
+                               /* Install the tick interrupt handler as the timer ISR.\r
+                               *NOTE* The xPortInstallInterruptHandler() API function must be used for\r
+                               this purpose. */\r
+                               xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_TMRCTR_0_VEC_ID, vPortTickISR, NULL );\r
+                       }\r
+\r
+                       if( xStatus == pdPASS )\r
+                       {\r
+                               /* Enable the timer interrupt in the interrupt controller.\r
+                               *NOTE* The vPortEnableInterrupt() API function must be used for this\r
+                               purpose. */\r
+                               vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );\r
+\r
+                               /* Configure the timer interrupt handler.  This installs the handler\r
+                               directly, rather than through the Xilinx driver.  This is done for\r
+                               efficiency. */\r
+                               XTmrCtr_SetHandler( &xTickTimerInstance, ( void * ) vPortTickISR, NULL );\r
+\r
+                               /* Set the correct period for the timer. */\r
+                               XTmrCtr_SetResetValue( &xTickTimerInstance, ucTickTimerCounterNumber, ulCounterValue );\r
+\r
+                               /* Enable the interrupts.  Auto-reload mode is used to generate a\r
+                               periodic tick.  Note that interrupts are disabled when this function is\r
+                               called, so interrupts will not start to be processed until the first\r
+                               task has started to run. */\r
+                               XTmrCtr_SetOptions( &xTickTimerInstance, ucTickTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );\r
+\r
+                               /* Start the timer. */\r
+                               XTmrCtr_Start( &xTickTimerInstance, ucTickTimerCounterNumber );\r
+\r
+\r
+\r
+\r
+                               /* The second timer is used as the time base for the run time stats.\r
+                               Auto-reload mode is used to ensure the timer does not stop. */\r
+                               XTmrCtr_SetOptions( &xTickTimerInstance, ucRunTimeStatsCounterNumber, XTC_AUTO_RELOAD_OPTION );\r
+\r
+                               /* Start the timer. */\r
+                               XTmrCtr_Start( &xTickTimerInstance, ucRunTimeStatsCounterNumber );\r
+                       }\r
+\r
+                       /* Sanity check that the function executed as expected. */\r
+                       configASSERT( ( xStatus == pdPASS ) );\r
+               }\r
+       #endif /* XPAR_XTMRCTR_NUM_INSTANCES > 0 */\r
+#endif /* XPAR_XTMRCTR_NUM_INSTANCES */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if defined( XPAR_XTMRCTR_NUM_INSTANCES )\r
+       #if( XPAR_XTMRCTR_NUM_INSTANCES > 0 )\r
+               /* This is a default implementation of what is otherwise an application defined\r
+               callback function used to clear whichever timer interrupt is used to generate\r
+               the tick interrupt.  It is provided as an application callback because the\r
+               kernel will run on lots of different MicroBlaze and FPGA configurations - not\r
+               all of which will have the same timer peripherals defined or available.\r
+               vApplicationSetupTimerInterrupt() is declared as a weak symbol, allowing the\r
+               application writer to provide their own implementation, if this default\r
+               implementation is not suitable. */\r
+               void vApplicationClearTimerInterrupt( void )\r
+               {\r
+               unsigned long ulCSR;\r
+\r
+                       /* Clear the timer interrupt */\r
+                       ulCSR = XTmrCtr_GetControlStatusReg( XPAR_TMRCTR_0_BASEADDR, 0 );\r
+                       XTmrCtr_SetControlStatusReg( XPAR_TMRCTR_0_BASEADDR, 0, ulCSR );\r
+               }\r
+       #endif /* XPAR_XTMRCTR_NUM_INSTANCES > 0 */\r
+#endif /* XPAR_XTMRCTR_NUM_INSTANCES */\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.mss b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.mss
new file mode 100644 (file)
index 0000000..012862a
--- /dev/null
@@ -0,0 +1,40 @@
+#/******************************************************************************\r
+#*\r
+#* Copyright (C) 2015 Xilinx, Inc.  All rights reserved.\r
+#*\r
+#* Permission is hereby granted, free of charge, to any person obtaining a copy\r
+#* of this software and associated documentation files (the "Software"), to deal\r
+#* in the Software without restriction, including without limitation the rights\r
+#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+#* copies of the Software, and to permit persons to whom the Software is\r
+#* furnished to do so, subject to the following conditions:\r
+#*\r
+#* The above copyright notice and this permission notice shall be included in\r
+#* all copies or substantial portions of the Software.\r
+#*\r
+#* Use of the Software is limited solely to applications:\r
+#* (a) running on a Xilinx device, or\r
+#* (b) that interact with a Xilinx device through a bus or interconnect.\r
+#*\r
+#* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+#* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+#* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+#* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r
+#* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\r
+#* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+#* SOFTWARE.\r
+#*\r
+#* Except as contained in this notice, the name of the Xilinx shall not be used\r
+#* in advertising or otherwise to promote the sale, use or other dealings in\r
+#* this Software without prior written authorization from Xilinx.\r
+#*\r
+#******************************************************************************/\r
+\r
+PARAMETER VERSION = 2.2.0\r
+\r
+\r
+BEGIN OS\r
+ PARAMETER OS_NAME = freertos822_xilinx\r
+ PARAMETER STDIN =  *\r
+ PARAMETER STDOUT = *\r
+END
\ No newline at end of file
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.tcl b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/data/freertos_hello_world.tcl
new file mode 100644 (file)
index 0000000..97bf573
--- /dev/null
@@ -0,0 +1,91 @@
+#/******************************************************************************\r
+#*\r
+#* Copyright (C) 2015 Xilinx, Inc.  All rights reserved.\r
+#*\r
+#* Permission is hereby granted, free of charge, to any person obtaining a copy\r
+#* of this software and associated documentation files (the "Software"), to deal\r
+#* in the Software without restriction, including without limitation the rights\r
+#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+#* copies of the Software, and to permit persons to whom the Software is\r
+#* furnished to do so, subject to the following conditions:\r
+#*\r
+#* The above copyright notice and this permission notice shall be included in\r
+#* all copies or substantial portions of the Software.\r
+#*\r
+#* Use of the Software is limited solely to applications:\r
+#* (a) running on a Xilinx device, or\r
+#* (b) that interact with a Xilinx device through a bus or interconnect.\r
+#*\r
+#* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+#* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+#* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+#* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r
+#* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\r
+#* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+#* SOFTWARE.\r
+#*\r
+#* Except as contained in this notice, the name of the Xilinx shall not be used\r
+#* in advertising or otherwise to promote the sale, use or other dealings in\r
+#* this Software without prior written authorization from Xilinx.\r
+#*\r
+#******************************************************************************/\r
+\r
+proc swapp_get_name {} {\r
+    return "FreeRTOS Hello World";\r
+}\r
+\r
+proc swapp_get_description {} {\r
+    return " FreeRTOS Hello World application";\r
+}\r
+\r
+proc check_freertos_os {} {\r
+    set oslist [get_os];\r
+\r
+    if { [llength $oslist] != 1 } {\r
+        return 0;\r
+    }\r
+    set os [lindex $oslist 0];\r
+\r
+    if { $os != "freertos822_xilinx" } {\r
+        error "This application is supported only on the freertos822_xilinx.";\r
+    }\r
+}\r
+\r
+proc swapp_is_supported_sw {} {\r
+\r
+    check_freertos_os\r
+\r
+    return 1;\r
+}\r
+\r
+proc swapp_is_supported_hw {} {\r
+\r
+    # check processor type\r
+    set proc_instance [get_sw_processor];\r
+    set hw_processor [common::get_property HW_INSTANCE $proc_instance]\r
+\r
+    set proc_type [common::get_property IP_NAME [get_cells $hw_processor]];\r
+\r
+    if { $proc_type != "ps7_cortexa9" && $proc_type != "microblaze" } {\r
+                error "This application is supported only for ps7_cortexa9 and microblaze processors.";\r
+    }\r
+\r
+    return 1;\r
+}\r
+\r
+\r
+proc get_stdout {} {\r
+    return;\r
+}\r
+\r
+proc check_stdout_hw {} {\r
+    return;\r
+}\r
+\r
+proc swapp_generate {} {\r
+    return;\r
+}\r
+\r
+proc swapp_get_linker_constraints {} {\r
+    return "";\r
+}\r
diff --git a/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/src/freertos_hello_world.c b/FreeRTOS/Demo/Xilinx_FreeRTOS_BSP/repo/sw_apps/freertos_hello_world/src/freertos_hello_world.c
new file mode 100644 (file)
index 0000000..a624fd4
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
+    All rights reserved
+
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+
+    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.  Full license text is available on the following
+    link: http://www.freertos.org/a00114.html
+
+    ***************************************************************************
+     *                                                                       *
+     *    FreeRTOS provides completely free yet professionally developed,    *
+     *    robust, strictly quality controlled, supported, and cross          *
+     *    platform software that is more than just the market leader, it     *
+     *    is the industry's de facto standard.                               *
+     *                                                                       *
+     *    Help yourself get started quickly while simultaneously helping     *
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *
+     *    tutorial book, reference manual, or both:                          *
+     *    http://www.FreeRTOS.org/Documentation                              *
+     *                                                                       *
+    ***************************************************************************
+
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
+    the FAQ page "My application does not run, what could be wrong?".  Have you
+    defined configASSERT()?
+
+    http://www.FreeRTOS.org/support - In return for receiving this top quality
+    embedded software for free we request you assist our global community by
+    participating in the support forum.
+
+    http://www.FreeRTOS.org/training - Investing in training allows your team to
+    be as productive as possible as early as possible.  Now you can receive
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
+    Ltd, and the world's leading authority on the world's leading RTOS.
+
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.
+
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
+
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
+    licenses offer ticketed support, indemnification and commercial middleware.
+
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+    engineered and independently SIL3 certified version for use in safety and
+    mission critical applications that require provable dependability.
+
+    1 tab == 4 spaces!
+*/
+
+/*
+ * This is a very simply blinky style example that can be generated
+ * automatically by the Xilinx SDK.
+ *
+ * The example generates a Tx task, an Rx task, and a queue.  The Tx task
+ * simply uses the queue to send a value to the Rx task every 500ms.  The Rx
+ * prints out a message each time it receives the value.
+ *
+ * The demo does little in the way of hardware configuration.  Separate projects
+ * are provided that include comprehensive demos which demonstrate additional
+ * hardware configuration, and additional FreeRTOS features.  See the following
+ * link for more details: http://www.freertos.org/a00090.html#XILINX
+ */
+
+/* FreeRTOS includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* Xilinx includes. */
+#include "xil_printf.h"
+#include "xparameters.h"
+
+/*-----------------------------------------------------------*/
+
+/* The Tx and Rx tasks as described at the top of this file. */
+static void prvTxTask( void *pvParameters );
+static void prvRxTask( void *pvParameters );
+
+/*-----------------------------------------------------------*/
+
+/* The queue used by the Tx and Rx tasks, as described at the top of this
+file. */
+static QueueHandle_t xQueue = NULL;
+
+int main( void )
+{
+       xil_printf( "Hello from Freertos\r\n" );
+
+       /* Create the two tasks.  The Tx task is given a lower priority than the
+       Rx task, so the Rx task will leave the Blocked state and pre-empt the Tx
+       task as soon as the Tx task places an item in the queue. */
+       xTaskCreate(    prvTxTask,                                      /* The function that implements the task. */
+                                       ( const char * ) "Tx",          /* Text name for the task, provided to assist debugging only. */
+                                       configMINIMAL_STACK_SIZE,       /* The stack allocated to the task. */
+                                       NULL,                                           /* The task parameter is not used, so set to NULL. */
+                                       tskIDLE_PRIORITY,                       /* The task runs at the idle priority. */
+                                       NULL );
+
+       xTaskCreate( prvRxTask, ( const char * ) "GB",  configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
+
+       /* Create the queue used by the tasks.  The Rx task has a higher priority
+       than the Tx task, so will preempt the Tx task and remove values from the
+       queue as soon as the Tx task writes to the queue - therefore the queue can
+       never have more than one item in it. */
+       xQueue = xQueueCreate(  1,                                              /* There is only one space in the queue. */
+                                                       sizeof( uint32_t ) );   /* Each space in the queue is large enough to hold a uint32_t. */
+
+       /* Check the queue was created. */
+       configASSERT( xQueue );
+
+       /* 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( ;; );
+}
+
+
+/*-----------------------------------------------------------*/
+static void prvTxTask( void *pvParameters )
+{
+const TickType_t x500ms = pdMS_TO_TICKS( 500UL );
+uint32_t ulValueToSend = 0;
+
+       for( ;; )
+       {
+               /* Delay for 500ms. */
+               vTaskDelay( x500ms );
+
+               /* Send the next value on the queue.  The queue should always be
+               empty at this point so a block time of 0 is used. */
+               xQueueSend( xQueue,                     /* The queue being written to. */
+                                       &ulValueToSend, /* The address of the data being sent. */
+                                       0UL );                  /* The block time. */
+       }
+}
+
+/*-----------------------------------------------------------*/
+static void prvRxTask( void *pvParameters )
+{
+uint32_t ulValueReceived;
+
+       for( ;; )
+       {
+               /* Block to wait for data arriving on the queue. */
+               xQueueReceive(  xQueue,                         /* The queue being read. */
+                                               &ulValueReceived,       /* Data is read into this address. */
+                                               portMAX_DELAY );        /* Wait without a timeout for data. */
+
+               /* Print the received data. */
+               xil_printf( "Rx task received %u\r\n", ( unsigned int ) ulValueReceived );
+       }
+}
+
+