]> git.sur5r.net Git - freertos/commitdiff
Demo project only:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 1 Oct 2014 17:28:42 +0000 (17:28 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 1 Oct 2014 17:28:42 +0000 (17:28 +0000)
Added comprehensive demo including FreeRTOS+CLI to the Cyclone V SoC project.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2309 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/.cproject
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/.project
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/include/uart0_support.h [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/uart0_support.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main.c
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/reg_test.S [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c [new file with mode: 0644]

index d94e9777907ebe2b522be808281efc20c5ed6c6f..72d6f0a04970b436b57718dab9f03cc4eec483ca 100644 (file)
                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1039712839" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>\r
                                                        <builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="cdt.managedbuild.builder.gnu.cross.89590670" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>\r
                                                        <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.909202128" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">\r
-                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.743924763" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>\r
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.743924763" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" value="gnu.c.optimization.level.none" valueType="enumerated"/>\r
                                                                <option id="gnu.c.compiler.option.debugging.level.972637953" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>\r
                                                                <option id="gnu.c.compiler.option.include.paths.291093471" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/include}&quot;"/>\r
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS+CLI}&quot;"/>\r
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Standard_Demo_Tasks/include}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Altera_Code/SoCSupport/include}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Altera_Code/HardwareLibrary/include}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>\r
                                                        </tool>\r
                                                </toolChain>\r
                                        </folderInfo>\r
+                                       <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.840887560.620646012" name="/" resourcePath="FreeRTOS+CLI/Examples">\r
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.2111927848" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug" unusedChildren="">\r
+                                                       <option id="cdt.managedbuild.option.gnu.cross.prefix.1982152472.1688335078" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix.1982152472"/>\r
+                                                       <option id="cdt.managedbuild.option.gnu.cross.path.859871788.1933970670" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path.859871788"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.941709227" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler.909202128"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.2304967" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler.81973727"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.344179079" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker.451869963"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.285236367" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker.372124763"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1219871621" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver.550935274"/>\r
+                                                       <tool id="cdt.managedbuild.tool.gnu.cross.assembler.105343637" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler.738229482"/>\r
+                                               </toolChain>\r
+                                       </folderInfo>\r
                                        <sourceEntries>\r
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
                                        </sourceEntries>\r
index 8d3b688eef83587e0ff9b27d9d4288176ace5e2d..b15285eb01d1077553262a274b9cb0550a214df7 100644 (file)
                <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>\r
        </natures>\r
        <linkedResources>\r
+               <link>\r
+                       <name>FreeRTOS+CLI</name>\r
+                       <type>2</type>\r
+                       <locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI</locationURI>\r
+               </link>\r
                <link>\r
                        <name>FreeRTOS_Source</name>\r
                        <type>2</type>\r
                        <locationURI>FREERTOS_ROOT/FreeRTOS/Source</locationURI>\r
                </link>\r
+               <link>\r
+                       <name>Standard_Demo_Tasks</name>\r
+                       <type>2</type>\r
+                       <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS+CLI/Examples</name>\r
+                       <type>2</type>\r
+                       <locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos</locationURI>\r
+               </link>\r
        </linkedResources>\r
        <filteredResources>\r
+               <filter>\r
+                       <id>0</id>\r
+                       <name>Standard_Demo_Tasks</name>\r
+                       <type>9</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-Minimal</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>0</id>\r
+                       <name>Standard_Demo_Tasks</name>\r
+                       <type>9</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-include</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412167807232</id>\r
+                       <name>FreeRTOS+CLI/Examples</name>\r
+                       <type>5</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-Sample-CLI-commands.c</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412167807242</id>\r
+                       <name>FreeRTOS+CLI/Examples</name>\r
+                       <type>5</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-UARTCommandConsole.c</arguments>\r
+                       </matcher>\r
+               </filter>\r
                <filter>\r
                        <id>1411907231532</id>\r
                        <name>FreeRTOS_Source/portable</name>\r
                                <arguments>1.0-name-matches-false-false-MemMang</arguments>\r
                        </matcher>\r
                </filter>\r
+               <filter>\r
+                       <id>1412161957514</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-Alt*.*</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412161957519</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-comtest*.*</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412161957525</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-cr*.*</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412161957530</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-flash*.*</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412161957535</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-IntQueue.c</arguments>\r
+                       </matcher>\r
+               </filter>\r
+               <filter>\r
+                       <id>1412161957541</id>\r
+                       <name>Standard_Demo_Tasks/Minimal</name>\r
+                       <type>6</type>\r
+                       <matcher>\r
+                               <id>org.eclipse.ui.ide.multiFilter</id>\r
+                               <arguments>1.0-name-matches-false-false-sp*.*</arguments>\r
+                       </matcher>\r
+               </filter>\r
                <filter>\r
                        <id>1411907280295</id>\r
                        <name>FreeRTOS_Source/portable/GCC</name>\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/include/uart0_support.h b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/include/uart0_support.h
new file mode 100644 (file)
index 0000000..e1536fd
--- /dev/null
@@ -0,0 +1,47 @@
+/******************************************************************************
+*
+* Copyright 2013 Altera Corporation. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* 3. The name of the author may not be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
+* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+* OF SUCH DAMAGE.
+*
+******************************************************************************/
+
+#ifndef UART0_SUPPORT_H_
+#define UART0_SUPPORT_H_
+
+#include "hwlib.h"
+
+#ifndef MIN
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#endif
+
+ALT_STATUS_CODE uart0_init(void);
+ALT_STATUS_CODE uart0_uninit(void);
+ALT_STATUS_CODE uart0_print(const char *in_str);
+int uart0_printf(const char *fmt, ...);
+int uart0_getc(void);
+
+#endif /* UART0_SUPPORT_H_ */
+/* md5sum:92afebd032496f820e400acbb3658d11 2013-09-28 20:48:16 */
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/uart0_support.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/SoCSupport/uart0_support.c
new file mode 100644 (file)
index 0000000..356a3e1
--- /dev/null
@@ -0,0 +1,179 @@
+/******************************************************************************
+*
+* Copyright 2013 Altera Corporation. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* 3. The name of the author may not be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
+* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+* OF SUCH DAMAGE.
+*
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include "alt_16550_uart.h"
+#include "uart0_support.h"
+
+
+static ALT_16550_HANDLE_t g_uart0_handle;
+
+ALT_STATUS_CODE uart0_init(void) {
+
+       ALT_STATUS_CODE status;
+
+    status = alt_16550_init(ALT_16550_DEVICE_SOCFPGA_UART0, 0, 0, &g_uart0_handle);
+
+    status += alt_16550_line_config_set(&g_uart0_handle, ALT_16550_DATABITS_8, ALT_16550_PARITY_DISABLE, ALT_16550_STOPBITS_1);
+
+    status += alt_16550_baudrate_set(&g_uart0_handle, ALT_16550_BAUDRATE_115200);
+
+    status += alt_16550_fifo_enable(&g_uart0_handle);
+
+    status += alt_16550_enable(&g_uart0_handle);
+
+       return status;
+}
+
+ALT_STATUS_CODE uart0_uninit(void) {
+
+       ALT_STATUS_CODE status;
+
+       status += alt_16550_disable(&g_uart0_handle);
+
+       status += alt_16550_fifo_disable(&g_uart0_handle);
+
+    status += alt_16550_uninit(&g_uart0_handle);
+
+       return status;
+}
+
+ALT_STATUS_CODE uart0_print(const char *in_str) {
+
+       ALT_STATUS_CODE status = ALT_E_SUCCESS;
+       int i;
+    int len = strlen(in_str);
+
+       uint32_t size_tx;
+       if (status == ALT_E_SUCCESS) {
+               status = alt_16550_fifo_size_get_tx(&g_uart0_handle, &size_tx);
+       }
+
+       for (i = 0; i < 1000; ++i)
+       {
+               if (status != ALT_E_SUCCESS) {
+                       break;
+               }
+
+               if (len == 0) {
+                       break;
+               }
+
+               // Wait for the THRE line status
+               int j = 1000000;
+               while (--j) {
+                       uint32_t line_status = 0;
+                       status = alt_16550_line_status_get(&g_uart0_handle, &line_status);
+                       if (status != ALT_E_SUCCESS) {
+                               break;
+                       }
+                       if (line_status & (ALT_16550_LINE_STATUS_THRE | ALT_16550_LINE_STATUS_TEMT)) {
+                               break;
+                       }
+               }
+               if (j == 0) {
+                       status = ALT_E_TMO;
+               }
+
+               uint32_t level_tx;
+
+               if (status == ALT_E_SUCCESS) {
+                       status = alt_16550_fifo_level_get_tx(&g_uart0_handle, &level_tx);
+               }
+
+               if (status == ALT_E_SUCCESS) {
+                       uint32_t size_write = MIN(len, size_tx - level_tx);
+                       status = alt_16550_fifo_write(&g_uart0_handle, in_str, size_write);
+                       if (status == ALT_E_SUCCESS) {
+                               len -= size_write;
+                               in_str += size_write;
+                       }
+               }
+       }
+
+       return status;
+}
+
+int uart0_printf(const char *fmt, ...) {
+
+       ALT_STATUS_CODE status = ALT_E_SUCCESS;
+       int len = 0;
+       char buffer[1024];
+
+       va_list  vl;
+       va_start(vl, fmt);
+       len = vsnprintf(buffer, sizeof(buffer), fmt, vl);
+       va_end(vl);
+
+       if(len >= sizeof(buffer)) {
+
+               buffer[sizeof(buffer) - 1] = '\0';
+
+               status = uart0_print(buffer);
+               if( status != ALT_E_SUCCESS)
+                       return status;
+
+               status = uart0_print("\r\nERROR: uart0_printf_buffer overflow...\r\n");
+               if( status != ALT_E_SUCCESS)
+                       return status;
+
+       } else {
+               status = uart0_print(buffer);
+               if( status != ALT_E_SUCCESS)
+                       return status;
+       }
+
+       return len;
+}
+
+int uart0_getc(void) {
+
+       ALT_STATUS_CODE status = ALT_E_SUCCESS;
+       int ret_val = EOF;
+
+       uint32_t level;
+       status = alt_16550_fifo_level_get_rx(&g_uart0_handle, &level);
+       if(status != ALT_E_SUCCESS)
+               return ret_val;
+
+       if(level > 0) {
+               char buffer;
+               status = alt_16550_fifo_read(&g_uart0_handle, &buffer, 1);
+               if(status != ALT_E_SUCCESS)
+                       return ret_val;
+               else
+                       return buffer;
+       }
+
+       return ret_val;
+}
+/* md5sum:3086bef986334caa60e4e70a63fba834 2013-09-28 20:48:16 */
index 30c8e0a42ed2949e1a4fd18934685feac2046cf5..5f5d9d57ed0377a3308459bffa74a2a13694acd6 100644 (file)
 #ifndef FREERTOS_CONFIG_H\r
 #define FREERTOS_CONFIG_H\r
 \r
+/* Altera library includes. */\r
+#include "alt_timers.h"\r
+#include "alt_interrupt.h"\r
+#include "alt_globaltmr.h"\r
+\r
 /*-----------------------------------------------------------\r
  * Application specific definitions.\r
  *\r
  * "FromISR".  FreeRTOS maintains a separate interrupt safe API to enable\r
  * interrupt entry to be shorter, faster, simpler and smaller.\r
  *\r
- * The Cyclone V SoC implements 256 unique interrupt priorities.  For the\r
- * purpose of setting configMAX_API_CALL_INTERRUPT_PRIORITY 255 represents the\r
+ * The Cyclone V SoC implements 32 unique interrupt priorities.  For the\r
+ * purpose of setting configMAX_API_CALL_INTERRUPT_PRIORITY 32 represents the\r
  * lowest priority.\r
  */\r
 #define configMAX_API_CALL_INTERRUPT_PRIORITY  18\r
 #define configUSE_TICK_HOOK                                            1\r
 #define configMAX_PRIORITIES                                   ( 7 )\r
 #define configMINIMAL_STACK_SIZE                               ( ( unsigned short ) 200 )\r
-#define configTOTAL_HEAP_SIZE                                  ( 5 * 1024 )\r
+#define configTOTAL_HEAP_SIZE                                  ( 50 * 1024 )\r
 #define configMAX_TASK_NAME_LEN                                        ( 10 )\r
 #define configUSE_TRACE_FACILITY                               1\r
 #define configUSE_16_BIT_TICKS                                 0\r
@@ -155,8 +160,11 @@ readable ASCII form.  See the notes in the implementation of vTaskList() within
 FreeRTOS/Source/tasks.c for limitations. */\r
 #define configUSE_STATS_FORMATTING_FUNCTIONS   1\r
 \r
+/* Run time stats related definitions. */\r
+#define configGENERATE_RUN_TIME_STATS 1\r
+#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() alt_globaltmr_start()\r
+#define portGET_RUN_TIME_COUNTER_VALUE()  ( ( uint32_t ) ( alt_globaltmr_get64() >> ( uint64_t ) 16 ) )\r
 \r
-#define configGENERATE_RUN_TIME_STATS 0\r
 \r
 /* The size of the global output buffer that is available for use when there\r
 are multiple command interpreters running at once (for example, one on a UART\r
@@ -180,25 +188,6 @@ nothing to return to.  To avoid this define configTASK_RETURN_ADDRESS to 0.  */
 \r
 /****** Hardware specific settings. *******************************************/\r
 \r
-/* Rename the FreeRTOS interrupt handlers to the names used in the vector\r
-table. */\r
-//#define FreeRTOS_IRQ_Handler __cs3_isr_irq\r
-//#define FreeRTOS_SWI_Handler __cs3_isr_swi\r
-// --defsym=__cs3_isr_irq=FreeRTOS_IRQ_Handler --defsym=__cs3_isr_swi=FreeRTOS_SWI_Handler\r
-\r
-\r
-/* Altera library includes. */\r
-#include "hwlib.h"\r
-#include "alt_timers.h"\r
-#include "alt_clock_manager.h"\r
-#include "alt_interrupt.h"\r
-#include "alt_globaltmr.h"\r
-#include "alt_address_space.h"\r
-#include "alt_watchdog.h"\r
-#include "mmu_support.h"\r
-#include "cache_support.h"\r
-#include "fpga_support.h"\r
-\r
  typedef struct INT_DISPATCH_s\r
  {\r
      alt_int_callback_t pxISR;\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c
new file mode 100644 (file)
index 0000000..73d0965
--- /dev/null
@@ -0,0 +1,140 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 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
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\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
+    >>!   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
+    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 from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and 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
+ * Simple IO routines to control the LEDs.\r
+ *-----------------------------------------------------------*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Demo includes. */\r
+#include "partest.h"\r
+\r
+/* Altera library includes. */\r
+#include "socal/socal.h"\r
+#include "socal/alt_gpio.h"\r
+#include "alt_generalpurpose_io.h"\r
+#include "alt_address_space.h"\r
+\r
+\r
+#define partstNUM_LEDS 4\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+const uint32_t ulLEDs[ partstNUM_LEDS ] = { ALT_GPIO_BIT12, ALT_GPIO_BIT13, ALT_GPIO_BIT14, ALT_GPIO_BIT15 };\r
+const uint32_t ulAllLEDs = ALT_GPIO_BIT12 | ALT_GPIO_BIT13 | ALT_GPIO_BIT14 | ALT_GPIO_BIT15;\r
+const uint32_t *pulPortBData = ALT_GPIO1_SWPORTA_DR_ADDR;\r
+static uint32_t ulPortValue;\r
+\r
+void vParTestInitialise( void )\r
+{\r
+       /* Set GPIO direction. */\r
+       alt_gpio_port_datadir_set( ALT_GPIO_PORTB, ulAllLEDs, ulAllLEDs );\r
+\r
+       /* Start with all LEDs off. */\r
+       alt_gpio_port_data_write( ALT_GPIO_PORTB, ulAllLEDs, ulAllLEDs );\r
+       ulPortValue = ulAllLEDs;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )\r
+{\r
+       if( uxLED < partstNUM_LEDS )\r
+       {\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       if( xValue == pdFALSE )\r
+                       {\r
+                               ulPortValue |= ulLEDs[ uxLED ];\r
+                       }\r
+                       else\r
+                       {\r
+                               ulPortValue &= ~ulLEDs[ uxLED ];\r
+                       }\r
+\r
+                       alt_replbits_word( pulPortBData, ulAllLEDs, ulPortValue );\r
+               }\r
+               taskEXIT_CRITICAL();\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+       if( uxLED < partstNUM_LEDS )\r
+       {\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       ulPortValue ^= ulLEDs[ uxLED ];\r
+                       alt_replbits_word( pulPortBData, ulAllLEDs, ulPortValue );\r
+               }\r
+               taskEXIT_CRITICAL();\r
+       }\r
+}\r
+\r
+\r
+\r
index e7000fcab11ed33c4b138d1cf5d2c5b025519efc..27580cdb12fa3e22433d5c78ed75a8b7913bd5ac 100644 (file)
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 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
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\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
+    >>!   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
+    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 from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and 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
+ * This project provides two demo applications.  A simple blinky style project,\r
+ * and a more comprehensive test and demo application.  The\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to\r
+ * select between the two.  The simply blinky demo is implemented and described\r
+ * in main_blinky.c.  The more comprehensive test and demo application is\r
+ * implemented and described in main_full.c.\r
+ *\r
+ * This file implements the code that is not demo specific, including the\r
+ * hardware setup and FreeRTOS hook functions.\r
+ *\r
+ * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
+ * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
+ * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!\r
+ *\r
+ */\r
+\r
 /* Standard includes. */\r
-#include <stdint.h>\r
+#include <stdio.h>\r
+#include <limits.h>\r
 \r
-/* FreeRTOS includes. */\r
+/* Scheduler include files. */\r
 #include "FreeRTOS.h"\r
 #include "task.h"\r
+#include "semphr.h"\r
+\r
+/* Standard demo includes. */\r
+#include "partest.h"\r
+#include "TimerDemo.h"\r
+#include "QueueOverwrite.h"\r
+#include "EventGroupsDemo.h"\r
+#include "IntSemTest.h"\r
+\r
+/* Altera library includes. */\r
+#include "alt_timers.h"\r
+#include "alt_clock_manager.h"\r
+#include "alt_interrupt.h"\r
+#include "alt_globaltmr.h"\r
+#include "alt_address_space.h"\r
+#include "mmu_support.h"\r
+#include "cache_support.h"\r
+\r
+/* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is used to select between two demo\r
+ * applications, as described at the top of this file.\r
+ *\r
+ * When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 the simple blinky example\r
+ * will be run.\r
+ *\r
+ * When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0 the comprehensive test\r
+ * and demo application will be run.\r
+ */\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
-/* Perform any hardware initialisation necessary. */\r
+/*\r
+ * Configure the hardware as necessary to run this demo.\r
+ */\r
 static void prvSetupHardware( void );\r
 \r
+/*\r
+ * See the comments at the top of this file and above the\r
+ * mainSELECTED_APPLICATION definition.\r
+ */\r
+#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
+       extern void main_blinky( void );\r
+#else\r
+       extern void main_full( void );\r
+#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
+\r
 /* Prototypes for the standard FreeRTOS callback/hook functions implemented\r
 within this file. */\r
 void vApplicationMallocFailedHook( void );\r
@@ -21,8 +144,22 @@ void vApplicationTickHook( void );
 \r
 int main( void )\r
 {\r
+       /* Configure the hardware ready to run the demo. */\r
        prvSetupHardware();\r
-       vTaskStartScheduler();\r
+\r
+       /* The mainSELECTED_APPLICATION setting is described at the top\r
+       of this file. */\r
+       #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
+       {\r
+               main_blinky();\r
+       }\r
+       #else\r
+       {\r
+               main_full();\r
+       }\r
+       #endif\r
+\r
+       /* Don't expect to reach here. */\r
        return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -34,6 +171,7 @@ uint32_t ulSCTLR, ulVectorTable = ( uint32_t ) &__cs3_interrupt_vector;
 const uint32_t ulVBit = 13U;\r
 \r
        alt_int_global_init();\r
+       alt_int_cpu_binary_point_set( 0 );\r
 \r
        /* Clear SCTLR.V for low vectors and map the vector table to the beginning\r
        of the code. */\r
@@ -44,47 +182,10 @@ const uint32_t ulVBit = 13U;
 \r
        cache_init();\r
        mmu_init();\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vConfigureTickInterrupt( void )\r
-{\r
-alt_freq_t ulTempFrequency;\r
-const alt_freq_t ulMicroSecondsPerSecond = 1000000UL;\r
-void FreeRTOS_Tick_Handler( void );\r
-\r
-       /* Interrupts are disabled when this function is called. */\r
-\r
-       /* Initialise the general purpose timer modules. */\r
-       alt_gpt_all_tmr_init();\r
-\r
-       /* ALT_CLK_MPU_PERIPH = mpu_periph_clk */\r
-       alt_clk_freq_get( ALT_CLK_MPU_PERIPH, &ulTempFrequency );\r
-\r
-       /* Use the local private timer. */\r
-       alt_gpt_counter_set( ALT_GPT_CPU_PRIVATE_TMR, ulTempFrequency / configTICK_RATE_HZ );\r
-\r
-       /* Sanity check. */\r
-       configASSERT( alt_gpt_time_microsecs_get( ALT_GPT_CPU_PRIVATE_TMR ) == ( ulMicroSecondsPerSecond / configTICK_RATE_HZ ) );\r
-\r
-       /* Set to periodic mode. */\r
-       alt_gpt_mode_set( ALT_GPT_CPU_PRIVATE_TMR, ALT_GPT_RESTART_MODE_PERIODIC );\r
-\r
-       /* The timer can be started here as interrupts are disabled. */\r
-       alt_gpt_tmr_start( ALT_GPT_CPU_PRIVATE_TMR );\r
-\r
-       /* Register the standard FreeRTOS Cortex-A tick handler as the timer's\r
-       interrupt handler.  The handler clears the interrupt using the\r
-       configCLEAR_TICK_INTERRUPT() macro, which is defined in FreeRTOSConfig.h. */\r
-       vRegisterIRQHandler( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, ( alt_int_callback_t ) FreeRTOS_Tick_Handler, NULL );\r
-\r
-       /* Ensure the interrupt is forwarded to the CPU. */\r
-    alt_int_dist_enable( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE );\r
-\r
-    /* Finally, enable the interrupt. */\r
-       alt_gpt_int_clear_pending( ALT_GPT_CPU_PRIVATE_TMR );\r
-       alt_gpt_int_enable( ALT_GPT_CPU_PRIVATE_TMR );\r
 \r
+       /* GPIO for LEDs.  ParTest is a historic name which used to stand for\r
+       parallel port test. */\r
+       vParTestInitialise();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -153,7 +254,7 @@ volatile unsigned long ul = 0;
 \r
 void vApplicationTickHook( void )\r
 {\r
-       #if( mainSELECTED_APPLICATION == 1 )\r
+       #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
        {\r
                /* The full demo includes a software timer demo/test that requires\r
                prodding periodically from the tick interrupt. */\r
@@ -164,11 +265,58 @@ void vApplicationTickHook( void )
 \r
                /* Call the periodic event group from ISR demo. */\r
                vPeriodicEventGroupsProcessing();\r
+\r
+               /* Call the periodic test that uses mutexes form an interrupt. */\r
+               vInterruptSemaphorePeriodicTest();\r
        }\r
        #endif\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vConfigureTickInterrupt( void )\r
+{\r
+alt_freq_t ulTempFrequency;\r
+const alt_freq_t ulMicroSecondsPerSecond = 1000000UL;\r
+void FreeRTOS_Tick_Handler( void );\r
+\r
+       /* Interrupts are disabled when this function is called. */\r
+\r
+       /* Initialise the general purpose timer modules. */\r
+       alt_gpt_all_tmr_init();\r
+\r
+       /* ALT_CLK_MPU_PERIPH = mpu_periph_clk */\r
+       alt_clk_freq_get( ALT_CLK_MPU_PERIPH, &ulTempFrequency );\r
+\r
+       /* Use the local private timer. */\r
+       alt_gpt_counter_set( ALT_GPT_CPU_PRIVATE_TMR, ulTempFrequency / configTICK_RATE_HZ );\r
+\r
+       /* Sanity check. */\r
+       configASSERT( alt_gpt_time_microsecs_get( ALT_GPT_CPU_PRIVATE_TMR ) == ( ulMicroSecondsPerSecond / configTICK_RATE_HZ ) );\r
+\r
+       /* Set to periodic mode. */\r
+       alt_gpt_mode_set( ALT_GPT_CPU_PRIVATE_TMR, ALT_GPT_RESTART_MODE_PERIODIC );\r
+\r
+       /* The timer can be started here as interrupts are disabled. */\r
+       alt_gpt_tmr_start( ALT_GPT_CPU_PRIVATE_TMR );\r
+\r
+       /* Register the standard FreeRTOS Cortex-A tick handler as the timer's\r
+       interrupt handler.  The handler clears the interrupt using the\r
+       configCLEAR_TICK_INTERRUPT() macro, which is defined in FreeRTOSConfig.h. */\r
+       vRegisterIRQHandler( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, ( alt_int_callback_t ) FreeRTOS_Tick_Handler, NULL );\r
+\r
+       /* This tick interrupt must run at the lowest priority. */\r
+#warning Is this the correct way of specifying the priority value?\r
+       alt_int_dist_priority_set( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );\r
+\r
+       /* Ensure the interrupt is forwarded to the CPU. */\r
+    alt_int_dist_enable( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE );\r
+\r
+    /* Finally, enable the interrupt. */\r
+       alt_gpt_int_clear_pending( ALT_GPT_CPU_PRIVATE_TMR );\r
+       alt_gpt_int_enable( ALT_GPT_CPU_PRIVATE_TMR );\r
+\r
+}\r
+/*-----------------------------------------------------------*/\r
 \r
 #warning A separate array of handlers is maintained as the drivers array is static so cannot be reached and the handler is incompatible.\r
 static INT_DISPATCH_t xISRHandlers[ ALT_INT_PROVISION_INT_COUNT ];\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c
new file mode 100644 (file)
index 0000000..c4a6392
--- /dev/null
@@ -0,0 +1,226 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 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
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\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
+    >>!   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
+    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 from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and 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
+ * NOTE 1:  This project provides two demo applications.  A simple blinky\r
+ * style project, and a more comprehensive test and demo application.  The \r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select \r
+ * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
+ * in main.c.  This file implements the simply blinky style version.\r
+ *\r
+ * NOTE 2:  This file only contains the source code that is specific to the\r
+ * basic demo.  Generic functions, such FreeRTOS hook functions, and functions\r
+ * required to configure the hardware are defined in main.c.\r
+ ******************************************************************************\r
+ *\r
+ * main_blinky() creates one queue, and two tasks.  It then starts the\r
+ * scheduler.\r
+ *\r
+ * The Queue Send Task:\r
+ * The queue send task is implemented by the prvQueueSendTask() function in\r
+ * this file.  prvQueueSendTask() sits in a loop that causes it to repeatedly\r
+ * block for 200 milliseconds, before sending the value 100 to the queue that\r
+ * was created within main_blinky().  Once the value is sent, the task loops\r
+ * back around to block for another 200 milliseconds...and so on.\r
+ *\r
+ * The Queue Receive Task:\r
+ * The queue receive task is implemented by the prvQueueReceiveTask() function\r
+ * in this file.  prvQueueReceiveTask() sits in a loop where it repeatedly\r
+ * blocks on attempts to read data from the queue that was created within\r
+ * main_blinky().  When data is received, the task checks the value of the\r
+ * data, and if the value equals the expected 100, toggles an LED.  The 'block\r
+ * time' parameter passed to the queue receive function specifies that the\r
+ * task should be held in the Blocked state indefinitely to wait for data to\r
+ * be available on the queue.  The queue receive task will only leave the\r
+ * Blocked state when the queue send task writes to the queue.  As the queue\r
+ * send task writes to the queue every 200 milliseconds, the queue receive\r
+ * task leaves the Blocked state every 200 milliseconds, and therefore toggles\r
+ * the LED every 200 milliseconds.\r
+ */\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* Standard demo includes. */\r
+#include "partest.h"\r
+\r
+/* Priorities at which the tasks are created. */\r
+#define mainQUEUE_RECEIVE_TASK_PRIORITY                ( tskIDLE_PRIORITY + 2 )\r
+#define        mainQUEUE_SEND_TASK_PRIORITY            ( tskIDLE_PRIORITY + 1 )\r
+\r
+/* The rate at which data is sent to the queue.  The 200ms value is converted\r
+to ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainQUEUE_SEND_FREQUENCY_MS                    ( 200 / portTICK_PERIOD_MS )\r
+\r
+/* The number of items the queue can hold.  This is 1 as the receive task\r
+will remove items as they are added, meaning the send task should always find\r
+the queue empty. */\r
+#define mainQUEUE_LENGTH                                       ( 1 )\r
+\r
+/* The LED toggled by the Rx task. */\r
+#define mainTASK_LED                                           ( 0 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The tasks as described in the comments at the top of this file.\r
+ */\r
+static void prvQueueReceiveTask( void *pvParameters );\r
+static void prvQueueSendTask( void *pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The queue used by both tasks. */\r
+static QueueHandle_t xQueue = NULL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main_blinky( void )\r
+{\r
+       /* Create the queue. */\r
+       xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
+\r
+       if( xQueue != NULL )\r
+       {\r
+               /* Start the two tasks as described in the comments at the top of this\r
+               file. */\r
+               xTaskCreate( prvQueueReceiveTask,                               /* The function that implements the task. */\r
+                                       "Rx",                                                           /* The text name assigned to the task - for debug only as it is not used by the kernel. */\r
+                                       configMINIMAL_STACK_SIZE,                       /* The size of the stack to allocate to the task. */\r
+                                       NULL,                                                           /* The parameter passed to the task - not used in this case. */\r
+                                       mainQUEUE_RECEIVE_TASK_PRIORITY,        /* The priority assigned to the task. */\r
+                                       NULL );                                                         /* The task handle is not required, so NULL is passed. */\r
+\r
+               xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );\r
+\r
+               /* Start the tasks and timer running. */\r
+               vTaskStartScheduler();\r
+       }\r
+\r
+       /* If all is well, the scheduler will now be running, and the following\r
+       line will never be reached.  If the following line does execute, then\r
+       there was either insufficient FreeRTOS heap memory available for the idle\r
+       and/or timer tasks to be created, or vTaskStartScheduler() was called from\r
+       User mode.  See the memory management section on the FreeRTOS web site for\r
+       more details on the FreeRTOS heap http://www.freertos.org/a00111.html.  The\r
+       mode from which main() is called is set in the C start up code and must be\r
+       a privileged mode (not user mode). */\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvQueueSendTask( void *pvParameters )\r
+{\r
+TickType_t xNextWakeTime;\r
+const unsigned long ulValueToSend = 100UL;\r
+\r
+       /* Remove compiler warning about unused parameter. */\r
+       ( void ) pvParameters;\r
+\r
+       /* Initialise xNextWakeTime - this only needs to be done once. */\r
+       xNextWakeTime = xTaskGetTickCount();\r
+\r
+       for( ;; )\r
+       {\r
+               /* Place this task in the blocked state until it is time to run again. */\r
+               vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
+\r
+               /* Send to the queue - causing the queue receive task to unblock and\r
+               toggle the LED.  0 is used as the block time so the sending operation\r
+               will not block - it shouldn't need to block as the queue should always\r
+               be empty at this point in the code. */\r
+               xQueueSend( xQueue, &ulValueToSend, 0U );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvQueueReceiveTask( void *pvParameters )\r
+{\r
+unsigned long ulReceivedValue;\r
+const unsigned long ulExpectedValue = 100UL;\r
+\r
+       /* Remove compiler warning about unused parameter. */\r
+       ( void ) pvParameters;\r
+\r
+       for( ;; )\r
+       {\r
+               /* Wait until something arrives in the queue - this task will block\r
+               indefinitely provided INCLUDE_vTaskSuspend is set to 1 in\r
+               FreeRTOSConfig.h. */\r
+               xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );\r
+\r
+               /*  To get here something must have been received from the queue, but\r
+               is it the expected value?  If it is, toggle the LED. */\r
+               if( ulReceivedValue == ulExpectedValue )\r
+               {\r
+                       vParTestToggleLED( mainTASK_LED );\r
+                       ulReceivedValue = 0U;\r
+               }\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c
new file mode 100644 (file)
index 0000000..69c7849
--- /dev/null
@@ -0,0 +1,481 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 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
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\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
+    >>!   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
+    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 from the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and 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
+ * NOTE 1:  This project provides two demo applications.  A simple blinky\r
+ * style project, and a more comprehensive test and demo application.  The\r
+ * mainCREATE_SIMPLY_BLINKY_DEMO_ONLY setting in main.c is used to select\r
+ * between the two.  See the notes on using mainCREATE_SIMPLY_BLINKY_DEMO_ONLY\r
+ * in main.c.  This file implements the comprehensive version.\r
+ *\r
+ * NOTE 2:  This file only contains the source code that is specific to the\r
+ * full demo.  Generic functions, such FreeRTOS hook functions, and functions\r
+ * required to configure the hardware, are defined in main.c.\r
+ *\r
+ ******************************************************************************\r
+ *\r
+ * main_full() creates all the demo application tasks and software timers, then\r
+ * starts the scheduler.  The web documentation provides more details of the\r
+ * standard demo application tasks, which provide no particular functionality,\r
+ * but do provide a good example of how to use the FreeRTOS API.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks and tests are\r
+ * defined and/or created within this file:\r
+ *\r
+ * "Reg test" tasks - These fill both the core and floating point registers with\r
+ * known values, then check that each register maintains its expected value for\r
+ * the lifetime of the task.  Each task uses a different set of values.  The reg\r
+ * test tasks execute with a very low priority, so get preempted very\r
+ * frequently.  A register containing an unexpected value is indicative of an\r
+ * error in the context switching mechanism.\r
+ *\r
+ * "Check" task - The check task period is initially set to three seconds.  The\r
+ * task checks that all the standard demo tasks, and the register check tasks,\r
+ * are not only still executing, but are executing without reporting any errors.\r
+ * If the check task discovers that a task has either stalled, or reported an\r
+ * error, then it changes its own execution period from the initial three\r
+ * seconds, to just 200ms.  The check task also toggles an LED each time it is\r
+ * called.  This provides a visual indication of the system status:  If the LED\r
+ * toggles every three seconds, then no issues have been discovered.  If the LED\r
+ * toggles every 200ms, then an issue has been discovered with at least one\r
+ * task.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "timers.h"\r
+#include "semphr.h"\r
+\r
+/* Standard demo application includes. */\r
+#include "flop.h"\r
+#include "semtest.h"\r
+#include "dynamic.h"\r
+#include "BlockQ.h"\r
+#include "blocktim.h"\r
+#include "countsem.h"\r
+#include "GenQTest.h"\r
+#include "recmutex.h"\r
+#include "death.h"\r
+#include "partest.h"\r
+#include "comtest2.h"\r
+#include "serial.h"\r
+#include "TimerDemo.h"\r
+#include "QueueOverwrite.h"\r
+#include "EventGroupsDemo.h"\r
+#include "IntSemTest.h"\r
+\r
+/* Priorities for the demo application tasks. */\r
+#define mainSEM_TEST_PRIORITY                          ( tskIDLE_PRIORITY + 1UL )\r
+#define mainBLOCK_Q_PRIORITY                           ( tskIDLE_PRIORITY + 2UL )\r
+#define mainCREATOR_TASK_PRIORITY                      ( tskIDLE_PRIORITY + 3UL )\r
+#define mainFLOP_TASK_PRIORITY                         ( tskIDLE_PRIORITY )\r
+#define mainUART_COMMAND_CONSOLE_STACK_SIZE    ( configMINIMAL_STACK_SIZE * 3UL )\r
+#define mainCOM_TEST_TASK_PRIORITY                     ( tskIDLE_PRIORITY + 2 )\r
+#define mainCHECK_TASK_PRIORITY                                ( configMAX_PRIORITIES - 1 )\r
+#define mainQUEUE_OVERWRITE_PRIORITY           ( tskIDLE_PRIORITY )\r
+\r
+/* The priority used by the UART command console task.  This is very basic and\r
+uses the Altera polling UART driver - so *must* run at the idle priority. */\r
+#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+\r
+/* The LED used by the check timer. */\r
+#define mainCHECK_LED                                          ( 0 )\r
+\r
+/* A block time of zero simply means "don't block". */\r
+#define mainDONT_BLOCK                                         ( 0UL )\r
+\r
+/* The period after which the check timer will expire, in ms, provided no errors\r
+have been reported by any of the standard demo tasks.  ms are converted to the\r
+equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainNO_ERROR_CHECK_TASK_PERIOD         ( 3000UL / portTICK_PERIOD_MS )\r
+\r
+/* The period at which the check timer will expire, in ms, if an error has been\r
+reported in one of the standard demo tasks.  ms are converted to the equivalent\r
+in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainERROR_CHECK_TASK_PERIOD            ( 200UL / portTICK_PERIOD_MS )\r
+\r
+/* Parameters that are passed into the register check tasks solely for the\r
+purpose of ensuring parameters are passed into tasks correctly. */\r
+#define mainREG_TEST_TASK_1_PARAMETER          ( ( void * ) 0x12345678 )\r
+#define mainREG_TEST_TASK_2_PARAMETER          ( ( void * ) 0x87654321 )\r
+\r
+/* The base period used by the timer test tasks. */\r
+#define mainTIMER_TEST_PERIOD                          ( 50 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/*\r
+ * The check task, as described at the top of this file.\r
+ */\r
+static void prvCheckTask( void *pvParameters );\r
+\r
+/*\r
+ * Register check tasks, and the tasks used to write over and check the contents\r
+ * of the FPU registers, as described at the top of this file.  The nature of\r
+ * these files necessitates that they are written in an assembly file, but the\r
+ * entry points are kept in the C file for the convenience of checking the task\r
+ * parameter.\r
+ */\r
+static void prvRegTestTaskEntry1( void *pvParameters );\r
+extern void vRegTest1Implementation( void );\r
+static void prvRegTestTaskEntry2( void *pvParameters );\r
+extern void vRegTest2Implementation( void );\r
+\r
+/*\r
+ * Register commands that can be used with FreeRTOS+CLI.  The commands are\r
+ * defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.\r
+ */\r
+extern void vRegisterSampleCLICommands( void );\r
+\r
+/*\r
+ * The task that manages the FreeRTOS+CLI input and output.\r
+ */\r
+extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
+\r
+/*\r
+ * A high priority task that does nothing other than execute at a pseudo random\r
+ * time to ensure the other test tasks don't just execute in a repeating\r
+ * pattern.\r
+ */\r
+static void prvPseudoRandomiser( void *pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The following two variables are used to communicate the status of the\r
+register check tasks to the check task.  If the variables keep incrementing,\r
+then the register check tasks has not discovered any errors.  If a variable\r
+stops incrementing, then an error has been found. */\r
+volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main_full( void )\r
+{\r
+       /* Start all the other standard demo/test tasks.  They have not particular\r
+       functionality, but do demonstrate how to use the FreeRTOS API and test the\r
+       kernel port. */\r
+       vStartDynamicPriorityTasks();\r
+       vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+       vCreateBlockTimeTasks();\r
+       vStartCountingSemaphoreTasks();\r
+       vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
+       vStartRecursiveMutexTasks();\r
+       vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+       vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
+       vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+       vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
+       vStartEventGroupTasks();\r
+       vStartInterruptSemaphoreTasks();\r
+\r
+       /* Start the tasks that implements the command console on the UART, as\r
+       described above. */\r
+       vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );\r
+\r
+       /* Register the standard CLI commands. */\r
+       vRegisterSampleCLICommands();\r
+\r
+       /* Create the register check tasks, as described at the top of this     file */\r
+       xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+\r
+       /* Create the task that just adds a little random behaviour. */\r
+       xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );\r
+\r
+       /* Create the task that performs the 'check' functionality,     as described at\r
+       the top of this file. */\r
+       xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+       /* The set of tasks created by the following function call have to be\r
+       created last as they keep account of the number of tasks they expect to see\r
+       running. */\r
+       vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
+\r
+       /* Start the scheduler. */\r
+       vTaskStartScheduler();\r
+\r
+       /* If all is well, the scheduler will now be running, and the following\r
+       line will never be reached.  If the following line does execute, then\r
+       there was either insufficient FreeRTOS heap memory available for the idle\r
+       and/or timer tasks to be created, or vTaskStartScheduler() was called from\r
+       User mode.  See the memory management section on the FreeRTOS web site for\r
+       more details on the FreeRTOS heap http://www.freertos.org/a00111.html.  The\r
+       mode from which main() is called is set in the C start up code and must be\r
+       a privileged mode (not user mode). */\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCheckTask( void *pvParameters )\r
+{\r
+TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
+TickType_t xLastExecutionTime;\r
+static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
+unsigned long ulErrorFound = pdFALSE;\r
+\r
+       /* Just to stop compiler warnings. */\r
+       ( void ) pvParameters;\r
+\r
+       /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
+       works correctly. */\r
+       xLastExecutionTime = xTaskGetTickCount();\r
+\r
+       /* Cycle for ever, delaying then checking all the other tasks are still\r
+       operating without error.  The onboard LED is toggled on each iteration.\r
+       If an error is detected then the delay period is decreased from\r
+       mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD.  This has the\r
+       effect of increasing the rate at which the onboard LED toggles, and in so\r
+       doing gives visual feedback of the system status. */\r
+       for( ;; )\r
+       {\r
+               /* Delay until it is time to execute again. */\r
+               vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
+\r
+               /* Check all the demo tasks (other than the flash tasks) to ensure\r
+               that they are all still running, and that none have detected an error. */\r
+               if( xAreMathsTaskStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 1;\r
+               }\r
+\r
+               if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 2;\r
+               }\r
+\r
+               if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 3;\r
+               }\r
+\r
+               if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 4;\r
+               }\r
+\r
+               if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 5;\r
+               }\r
+\r
+               if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 6;\r
+               }\r
+\r
+               if( xIsCreateTaskStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 7;\r
+               }\r
+\r
+               if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 8;\r
+               }\r
+\r
+               if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )\r
+               {\r
+                       ulErrorFound = 1 << 9;\r
+               }\r
+\r
+               if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulErrorFound = 1 << 10;\r
+               }\r
+\r
+               if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
+               {\r
+                       ulErrorFound = 1 << 11;\r
+               }\r
+\r
+               if( xAreEventGroupTasksStillRunning() != pdPASS )\r
+               {\r
+                       ulErrorFound = 1 << 12;\r
+               }\r
+\r
+               if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS )\r
+               {\r
+                       ulErrorFound = 1 << 13;\r
+               }\r
+\r
+               /* Check that the register test 1 task is still running. */\r
+               if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
+               {\r
+                       ulErrorFound = 1 << 14;\r
+               }\r
+               ulLastRegTest1Value = ulRegTest1LoopCounter;\r
+\r
+               /* Check that the register test 2 task is still running. */\r
+               if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
+               {\r
+                       ulErrorFound = 1 << 15;\r
+               }\r
+               ulLastRegTest2Value = ulRegTest2LoopCounter;\r
+\r
+               /* Toggle the check LED to give an indication of the system status.  If\r
+               the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then\r
+               everything is ok.  A faster toggle indicates an error. */\r
+               vParTestToggleLED( mainCHECK_LED );\r
+\r
+               if( ulErrorFound != pdFALSE )\r
+               {\r
+                       /* An error has been detected in one of the tasks - flash the LED\r
+                       at a higher frequency to give visible feedback that something has\r
+                       gone wrong (it might just be that the loop back connector required\r
+                       by the comtest tasks has not been fitted). */\r
+                       xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;\r
+               }\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry1( void *pvParameters )\r
+{\r
+       /* Although the regtest task is written in assembler, its entry point is\r
+       written in C for convenience of checking the task parameter is being passed\r
+       in correctly. */\r
+       if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )\r
+       {\r
+               /* The reg test task also tests the floating point registers.  Tasks\r
+               that use the floating point unit must call vPortTaskUsesFPU() before\r
+               any floating point instructions are executed. */\r
+               vPortTaskUsesFPU();\r
+\r
+               /* Start the part of the test that is written in assembler. */\r
+               vRegTest1Implementation();\r
+       }\r
+\r
+       /* The following line will only execute if the task parameter is found to\r
+       be incorrect.  The check timer will detect that the regtest loop counter is\r
+       not being incremented and flag an error. */\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry2( void *pvParameters )\r
+{\r
+       /* Although the regtest task is written in assembler, its entry point is\r
+       written in C for convenience of checking the task parameter is being passed\r
+       in correctly. */\r
+       if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )\r
+       {\r
+               /* The reg test task also tests the floating point registers.  Tasks\r
+               that use the floating point unit must call vPortTaskUsesFPU() before\r
+               any floating point instructions are executed. */\r
+               vPortTaskUsesFPU();\r
+\r
+               /* Start the part of the test that is written in assembler. */\r
+               vRegTest2Implementation();\r
+       }\r
+\r
+       /* The following line will only execute if the task parameter is found to\r
+       be incorrect.  The check timer will detect that the regtest loop counter is\r
+       not being incremented and flag an error. */\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvPseudoRandomiser( void *pvParameters )\r
+{\r
+const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS );\r
+volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;\r
+\r
+\r
+       /* This task does nothing other than ensure there is a little bit of\r
+       disruption in the scheduling pattern of the other tasks.  Normally this is\r
+       done by generating interrupts at pseudo random times. */\r
+       for( ;; )\r
+       {\r
+               ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;\r
+               ulValue = ( ulNextRand >> 16UL ) & 0xffUL;\r
+\r
+               if( ulValue < ulMinDelay )\r
+               {\r
+                       ulValue = ulMinDelay;\r
+               }\r
+\r
+               vTaskDelay( ulValue );\r
+\r
+               while( ulValue > 0 )\r
+               {\r
+                       __asm volatile( "NOP" );\r
+                       __asm volatile( "NOP" );\r
+                       __asm volatile( "NOP" );\r
+                       __asm volatile( "NOP" );\r
+\r
+                       ulValue--;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/reg_test.S b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/reg_test.S
new file mode 100644 (file)
index 0000000..019e3af
--- /dev/null
@@ -0,0 +1,658 @@
+/*\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+\r
+    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
+    http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
+     *    Complete, revised, and edited pdf reference manuals are also       *\r
+     *    available.                                                         *\r
+     *                                                                       *\r
+     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
+     *    ensuring you get running as quickly as possible and with an        *\r
+     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
+     *    the FreeRTOS project to continue with its mission of providing     *\r
+     *    professional grade, cross platform, de facto standard solutions    *\r
+     *    for microcontrollers - completely free of charge!                  *\r
+     *                                                                       *\r
+     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
+     *                                                                       *\r
+     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\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
+    >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
+    distribute a combined work that includes FreeRTOS without being obliged to\r
+    provide the source code for proprietary components outside of the FreeRTOS\r
+    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.  See the GNU General Public License for more\r
+    details. You should have received a copy of the GNU General Public License\r
+    and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
+    viewed here: http://www.freertos.org/a00114.html and also obtained by\r
+    writing to Real Time Engineers Ltd., contact details for whom are available\r
+    on the FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?"                                     *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+\r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
+    fully thread aware and reentrant UDP/IP stack.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems, who sell the code with commercial support,\r
+    indemnification and middleware, under the OpenRTOS brand.\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
+\r
+       .global vRegTest1Implementation\r
+       .global vRegTest2Implementation\r
+       .extern ulRegTest1LoopCounter\r
+       .extern ulRegTest2LoopCounter\r
+\r
+       .text\r
+       .arm\r
+\r
+       /* This function is explained in the comments at the top of main-full.c. */\r
+.type vRegTest1Implementation, %function\r
+vRegTest1Implementation:\r
+\r
+       /* Fill each general purpose register with a known value. */\r
+       mov             r0,  #0xFF\r
+       mov             r1,  #0x11\r
+       mov             r2,  #0x22\r
+       mov             r3,  #0x33\r
+       mov     r4,  #0x44\r
+       mov     r5,  #0x55\r
+       mov     r6,  #0x66\r
+       mov     r7,  #0x77\r
+       mov     r8,  #0x88\r
+       mov     r9,  #0x99\r
+       mov     r10, #0xAA\r
+       mov     r11, #0xBB\r
+       mov     r12, #0xCC\r
+       mov             r14, #0xEE\r
+\r
+       /* Fill each FPU register with a known value. */\r
+       vmov    d0, r0, r1\r
+       vmov    d1, r2, r3\r
+       vmov    d2, r4, r5\r
+       vmov    d3, r6, r7\r
+       vmov    d4, r8, r9\r
+       vmov    d5, r10, r11\r
+       vmov    d6, r0, r1\r
+       vmov    d7, r2, r3\r
+       vmov    d8, r4, r5\r
+       vmov    d9, r6, r7\r
+       vmov    d10, r8, r9\r
+       vmov    d11, r10, r11\r
+       vmov    d12, r0, r1\r
+       vmov    d13, r2, r3\r
+       vmov    d14, r4, r5\r
+       vmov    d15, r6, r7\r
+\r
+       vmov    d16, r0, r1\r
+       vmov    d17, r2, r3\r
+       vmov    d18, r4, r5\r
+       vmov    d19, r6, r7\r
+       vmov    d20, r8, r9\r
+       vmov    d21, r10, r11\r
+       vmov    d22, r0, r1\r
+       vmov    d23, r2, r3\r
+       vmov    d24, r4, r5\r
+       vmov    d25, r6, r7\r
+       vmov    d26, r8, r9\r
+       vmov    d27, r10, r11\r
+       vmov    d28, r0, r1\r
+       vmov    d29, r2, r3\r
+       vmov    d30, r4, r5\r
+       vmov    d31, r6, r7\r
+\r
+       /* Loop, checking each itteration that each register still contains the\r
+       expected value. */\r
+reg1_loop:\r
+       /* Yield to increase test coverage */\r
+       svc 0\r
+\r
+       /* Check all the VFP registers still contain the values set above.\r
+       First save registers that are clobbered by the test. */\r
+       push { r0-r1 }\r
+\r
+       vmov    r0, r1, d0\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d1\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d2\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d3\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d4\r
+       cmp     r0, #0x88\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x99\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d5\r
+       cmp     r0, #0xAA\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0xBB\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d6\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d7\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d8\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d9\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d10\r
+       cmp     r0, #0x88\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x99\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d11\r
+       cmp     r0, #0xAA\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0xBB\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d12\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d13\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d14\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d15\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+\r
+       vmov    r0, r1, d16\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d17\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d18\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d19\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d20\r
+       cmp     r0, #0x88\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x99\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d21\r
+       cmp     r0, #0xAA\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0xBB\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d22\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d23\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d24\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d25\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d26\r
+       cmp     r0, #0x88\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x99\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d27\r
+       cmp     r0, #0xAA\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0xBB\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d28\r
+       cmp     r0, #0xFF\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x11\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d29\r
+       cmp     r0, #0x22\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x33\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d30\r
+       cmp     r0, #0x44\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x55\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d31\r
+       cmp     r0, #0x66\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #0x77\r
+       bne     reg1_error_loopf\r
+\r
+       /* Restore the registers that were clobbered by the test. */\r
+       pop     {r0-r1}\r
+\r
+       /* VFP register test passed.  Jump to the core register test. */\r
+       b               reg1_loopf_pass\r
+\r
+reg1_error_loopf:\r
+       /* If this line is hit then a VFP register value was found to be\r
+       incorrect. */\r
+       b reg1_error_loopf\r
+\r
+reg1_loopf_pass:\r
+\r
+       /* Test each general purpose register to check that it still contains the\r
+       expected known value, jumping to reg1_error_loop if any register contains\r
+       an unexpected value. */\r
+       cmp             r0, #0xFF\r
+       bne             reg1_error_loop\r
+       cmp             r1, #0x11\r
+       bne             reg1_error_loop\r
+       cmp             r2, #0x22\r
+       bne             reg1_error_loop\r
+       cmp             r3, #0x33\r
+       bne             reg1_error_loop\r
+       cmp             r4, #0x44\r
+       bne             reg1_error_loop\r
+       cmp             r5, #0x55\r
+       bne             reg1_error_loop\r
+       cmp             r6, #0x66\r
+       bne             reg1_error_loop\r
+       cmp             r7, #0x77\r
+       bne             reg1_error_loop\r
+       cmp             r8, #0x88\r
+       bne             reg1_error_loop\r
+       cmp             r9, #0x99\r
+       bne             reg1_error_loop\r
+       cmp             r10, #0xAA\r
+       bne             reg1_error_loop\r
+       cmp             r11, #0xBB\r
+       bne             reg1_error_loop\r
+       cmp             r12, #0xCC\r
+       bne             reg1_error_loop\r
+       cmp             r14, #0xEE\r
+       bne             reg1_error_loop\r
+\r
+       /* Everything passed, increment the loop counter. */\r
+       push { r0-r1 }\r
+       ldr     r0, =ulRegTest1LoopCounter\r
+       ldr r1, [r0]\r
+       adds r1, r1, #1\r
+       str r1, [r0]\r
+       pop { r0-r1 }\r
+\r
+       /* Start again. */\r
+       b reg1_loop\r
+\r
+reg1_error_loop:\r
+       /* If this line is hit then there was an error in a core register value.\r
+       The loop ensures the loop counter stops incrementing. */\r
+       b reg1_error_loop\r
+       nop\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+.type vRegTest2Implementation, %function\r
+vRegTest2Implementation:\r
+\r
+       /* Put a known value in each register. */\r
+       mov             r0,  #0xFF000000\r
+       mov             r1,  #0x11000000\r
+       mov             r2,  #0x22000000\r
+       mov             r3,  #0x33000000\r
+       mov     r4,  #0x44000000\r
+       mov     r5,  #0x55000000\r
+       mov     r6,  #0x66000000\r
+       mov     r7,  #0x77000000\r
+       mov     r8,  #0x88000000\r
+       mov     r9,  #0x99000000\r
+       mov     r10, #0xAA000000\r
+       mov     r11, #0xBB000000\r
+       mov     r12, #0xCC000000\r
+       mov     r14, #0xEE000000\r
+\r
+       /* Likewise the floating point registers */\r
+       vmov    d0, r0, r1\r
+       vmov    d1, r2, r3\r
+       vmov    d2, r4, r5\r
+       vmov    d3, r6, r7\r
+       vmov    d4, r8, r9\r
+       vmov    d5, r10, r11\r
+       vmov    d6, r0, r1\r
+       vmov    d7, r2, r3\r
+       vmov    d8, r4, r5\r
+       vmov    d9, r6, r7\r
+       vmov    d10, r8, r9\r
+       vmov    d11, r10, r11\r
+       vmov    d12, r0, r1\r
+       vmov    d13, r2, r3\r
+       vmov    d14, r4, r5\r
+       vmov    d15, r6, r7\r
+\r
+       vmov    d16, r0, r1\r
+       vmov    d17, r2, r3\r
+       vmov    d18, r4, r5\r
+       vmov    d19, r6, r7\r
+       vmov    d20, r8, r9\r
+       vmov    d21, r10, r11\r
+       vmov    d22, r0, r1\r
+       vmov    d23, r2, r3\r
+       vmov    d24, r4, r5\r
+       vmov    d25, r6, r7\r
+       vmov    d26, r8, r9\r
+       vmov    d27, r10, r11\r
+       vmov    d28, r0, r1\r
+       vmov    d29, r2, r3\r
+       vmov    d30, r4, r5\r
+       vmov    d31, r6, r7\r
+\r
+       /* Loop, checking each itteration that each register still contains the\r
+       expected value. */\r
+reg2_loop:\r
+       /* Check all the VFP registers still contain the values set above.\r
+       First save registers that are clobbered by the test. */\r
+       push    { r0-r1 }\r
+\r
+       vmov    r0, r1, d0\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d1\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d2\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d3\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d4\r
+       cmp     r0, #0x88000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x99000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d5\r
+       cmp     r0, #0xAA000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0xBB000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d6\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d7\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d8\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d9\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d10\r
+       cmp     r0, #0x88000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x99000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d11\r
+       cmp     r0, #0xAA000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0xBB000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d12\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d13\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d14\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d15\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+\r
+       vmov    r0, r1, d16\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d17\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d18\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d19\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d20\r
+       cmp     r0, #0x88000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x99000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d21\r
+       cmp     r0, #0xAA000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0xBB000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d22\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d23\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d24\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d25\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d26\r
+       cmp     r0, #0x88000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x99000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d27\r
+       cmp     r0, #0xAA000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0xBB000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d28\r
+       cmp     r0, #0xFF000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x11000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d29\r
+       cmp     r0, #0x22000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x33000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d30\r
+       cmp     r0, #0x44000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x55000000\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d31\r
+       cmp     r0, #0x66000000\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #0x77000000\r
+       bne     reg2_error_loopf\r
+\r
+       /* Restore the registers that were clobbered by the test. */\r
+       pop     {r0-r1}\r
+\r
+       /* VFP register test passed.  Jump to the core register test. */\r
+       b               reg2_loopf_pass\r
+\r
+reg2_error_loopf:\r
+       /* If this line is hit then a VFP register value was found to be\r
+       incorrect. */\r
+       b               reg2_error_loopf\r
+\r
+reg2_loopf_pass:\r
+\r
+       cmp             r0, #0xFF000000\r
+       bne             reg2_error_loop\r
+       cmp             r1, #0x11000000\r
+       bne             reg2_error_loop\r
+       cmp             r2, #0x22000000\r
+       bne             reg2_error_loop\r
+       cmp             r3, #0x33000000\r
+       bne             reg2_error_loop\r
+       cmp             r4, #0x44000000\r
+       bne             reg2_error_loop\r
+       cmp             r5, #0x55000000\r
+       bne             reg2_error_loop\r
+       cmp             r6, #0x66000000\r
+       bne             reg2_error_loop\r
+       cmp             r7, #0x77000000\r
+       bne             reg2_error_loop\r
+       cmp             r8, #0x88000000\r
+       bne             reg2_error_loop\r
+       cmp             r9, #0x99000000\r
+       bne             reg2_error_loop\r
+       cmp             r10, #0xAA000000\r
+       bne             reg2_error_loop\r
+       cmp             r11, #0xBB000000\r
+       bne             reg2_error_loop\r
+       cmp             r12, #0xCC000000\r
+       bne             reg2_error_loop\r
+       cmp     r14, #0xEE000000\r
+       bne             reg2_error_loop\r
+\r
+       /* Everything passed, increment the loop counter. */\r
+       push    { r0-r1 }\r
+       ldr             r0, =ulRegTest2LoopCounter\r
+       ldr     r1, [r0]\r
+       adds    r1, r1, #1\r
+       str     r1, [r0]\r
+       pop     { r0-r1 }\r
+\r
+       /* Start again. */\r
+       b               reg2_loop\r
+\r
+reg2_error_loop:\r
+       /* If this line is hit then there was an error in a core register value.\r
+       The loop ensures the loop counter stops incrementing. */\r
+       b               reg2_error_loop\r
+       nop\r
+\r
+\r
+       .end\r
+\r
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c
new file mode 100644 (file)
index 0000000..1384ebd
--- /dev/null
@@ -0,0 +1,158 @@
+/*\r
+ FreeRTOS V8.1.2 - Copyright (C) 2014 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
+ ***************************************************************************\r
+ *                                                                       *\r
+ *    FreeRTOS provides completely free yet professionally developed,    *\r
+ *    robust, strictly quality controlled, supported, and cross          *\r
+ *    platform software that has become a de facto standard.             *\r
+ *                                                                       *\r
+ *    Help yourself get started quickly and support the FreeRTOS         *\r
+ *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+ *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
+ *                                                                       *\r
+ *    Thank you!                                                         *\r
+ *                                                                       *\r
+ ***************************************************************************\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
+    >>!   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
+ 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 from the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ ***************************************************************************\r
+ *                                                                       *\r
+ *    Having a problem?  Start by reading the FAQ "My application does   *\r
+ *    not run, what could be wrong?"                                     *\r
+ *                                                                       *\r
+ *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+ *                                                                       *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and 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
+       BASIC SERIAL PORT DRIVER.\r
+\r
+       This file just maps generic functions used by FreeRTOS example code to the\r
+       simple UART drivers provided by Altera.\r
+*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "queue.h"\r
+#include "semphr.h"\r
+\r
+/* Demo application includes. */\r
+#include "serial.h"\r
+\r
+/* Altera library includes. */\r
+#include "uart0_support.h"\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * See the serial2.h header file.\r
+ */\r
+xComPortHandle xSerialPortInitMinimal( uint32_t ulWantedBaud, UBaseType_t uxQueueLength )\r
+{\r
+       /* Just call into the Altera support function, which has its own parameters,\r
+       so the parameters passed in here are not used. */\r
+       ( void ) ulWantedBaud;\r
+       ( void ) uxQueueLength;\r
+       uart0_init();\r
+\r
+       return ( xComPortHandle ) 0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )\r
+{\r
+BaseType_t xReturn;\r
+\r
+       /* Just call into the Altera support function, which has its own parameters,\r
+       so the parameters passed in here are not used. */\r
+       ( void ) pxPort;\r
+       ( void ) xBlockTime;\r
+\r
+       *pcRxedChar = uart0_getc();\r
+\r
+       if( *pcRxedChar != -1 )\r
+       {\r
+               xReturn = pdPASS;\r
+       }\r
+       else\r
+       {\r
+               xReturn = pdFAIL;\r
+       }\r
+\r
+       return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )\r
+{\r
+       /* Just call into the Altera support function, which has its own parameters,\r
+       so the parameters passed in here are not used. */\r
+       ( void ) pxPort;\r
+\r
+       uart0_print( ( char * ) pcString );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )\r
+{\r
+char cOutBytes[ 2 ];\r
+\r
+       /* Just call into the Altera support function, which has its own parameters,\r
+       so the parameters passed in here are not used. */\r
+       ( void ) pxPort;\r
+\r
+       cOutBytes[ 0 ] = cOutChar;\r
+       cOutBytes[ 1 ] = 0x00;\r
+       uart0_print( cOutBytes );\r
+\r
+       return pdPASS;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSerialClose(xComPortHandle xPort)\r
+{\r
+       /* Not supported as not required by the demo application. */\r
+       ( void ) xPort;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r