--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\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
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public \r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it \r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+\r
+#ifndef FREERTOS_CONFIG_H\r
+#define FREERTOS_CONFIG_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Application specific definitions.\r
+ *\r
+ * These definitions should be adjusted for your particular hardware and\r
+ * application requirements.\r
+ *\r
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
+ *----------------------------------------------------------*/\r
+\r
+#define configUSE_PREEMPTION 0\r
+#define configUSE_IDLE_HOOK 1\r
+#define configUSE_TICK_HOOK 0\r
+#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 47923200 )\r
+#define configTICK_RATE_HZ ( ( portTickType ) 100 )\r
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */\r
+#define configMAX_TASK_NAME_LEN ( 16 )\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 1\r
+\r
+/* Co-routine definitions. */\r
+#define configUSE_CO_ROUTINES 0\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+\r
+/* Set the following definitions to 1 to include the API function, or zero\r
+to exclude the API function. */\r
+\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 0\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+\r
+\r
+#endif /* FREERTOS_CONFIG_H */\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 11.00\r
+# Visual C++ Express 2010\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WIN32", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32\r
+ {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32\r
+ {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Debug|Win32">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|Win32">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>\r
+ <ProjectName>RTOSDemo</ProjectName>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseOfMfc>false</UseOfMfc>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseOfMfc>false</UseOfMfc>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup>\r
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>\r
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>\r
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <Midl>\r
+ <TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>\r
+ <HeaderFileName>\r
+ </HeaderFileName>\r
+ </Midl>\r
+ <ClCompile>\r
+ <Optimization>Disabled</Optimization>\r
+ <AdditionalIncludeDirectories>..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\Include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0400;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <MinimalRebuild>true</MinimalRebuild>\r
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
+ <PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>\r
+ <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>\r
+ <ObjectFileName>.\Debug/</ObjectFileName>\r
+ <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>\r
+ <WarningLevel>Level4</WarningLevel>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
+ </ClCompile>\r
+ <ResourceCompile>\r
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <Culture>0x0c09</Culture>\r
+ </ResourceCompile>\r
+ <Link>\r
+ <OutputFile>.\Debug/RTOSDemo.exe</OutputFile>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>\r
+ <SubSystem>Console</SubSystem>\r
+ <TargetMachine>MachineX86</TargetMachine>\r
+ </Link>\r
+ <Bscmake>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ <OutputFile>.\Debug/WIN32.bsc</OutputFile>\r
+ </Bscmake>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <Midl>\r
+ <TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>\r
+ <HeaderFileName>\r
+ </HeaderFileName>\r
+ </Midl>\r
+ <ClCompile>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>\r
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <StringPooling>true</StringPooling>\r
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>\r
+ <AssemblerListingLocation>.\Release/</AssemblerListingLocation>\r
+ <ObjectFileName>.\Release/</ObjectFileName>\r
+ <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ </ClCompile>\r
+ <ResourceCompile>\r
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <Culture>0x0c09</Culture>\r
+ </ResourceCompile>\r
+ <Link>\r
+ <OutputFile>.\Release/WIN32.exe</OutputFile>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ <ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>\r
+ <SubSystem>Console</SubSystem>\r
+ <TargetMachine>MachineX86</TargetMachine>\r
+ </Link>\r
+ <Bscmake>\r
+ <SuppressStartupBanner>true</SuppressStartupBanner>\r
+ <OutputFile>.\Release/WIN32.bsc</OutputFile>\r
+ </Bscmake>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />\r
+ <ClCompile Include="main.c">\r
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\list.c">\r
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c">\r
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\queue.c">\r
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\tasks.c">\r
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="Board.h" />\r
+ <ClInclude Include="FreeRTOSConfig.h" />\r
+ <ClInclude Include="..\..\Source\include\croutine.h" />\r
+ <ClInclude Include="..\..\Source\include\FreeRTOS.h" />\r
+ <ClInclude Include="..\..\Source\include\list.h" />\r
+ <ClInclude Include="..\..\Source\include\portable.h" />\r
+ <ClInclude Include="..\..\Source\include\projdefs.h" />\r
+ <ClInclude Include="..\..\Source\include\queue.h" />\r
+ <ClInclude Include="..\..\Source\include\semphr.h" />\r
+ <ClInclude Include="..\..\Source\include\task.h" />\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <Filter Include="Header Files">\r
+ <UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier>\r
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>\r
+ </Filter>\r
+ <Filter Include="Resource Files">\r
+ <UniqueIdentifier>{38712199-cebf-4124-bf15-398f7c3419ea}</UniqueIdentifier>\r
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>\r
+ </Filter>\r
+ <Filter Include="FreeRTOS Source">\r
+ <UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="FreeRTOS Source\Source">\r
+ <UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>\r
+ <Extensions>*.c</Extensions>\r
+ </Filter>\r
+ <Filter Include="FreeRTOS Source\Include">\r
+ <UniqueIdentifier>{a60060e3-3949-4f60-b025-cb84164ae9ed}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="Demo App Source">\r
+ <UniqueIdentifier>{34567deb-d5ab-4a56-8640-0aaec609521a}</UniqueIdentifier>\r
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="main.c">\r
+ <Filter>Demo App Source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\list.c">\r
+ <Filter>FreeRTOS Source\Source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\portable\WIN32\port.c">\r
+ <Filter>FreeRTOS Source\Source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\queue.c">\r
+ <Filter>FreeRTOS Source\Source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\tasks.c">\r
+ <Filter>FreeRTOS Source\Source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c">\r
+ <Filter>FreeRTOS Source\Source</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="Board.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="FreeRTOSConfig.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\croutine.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\FreeRTOS.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\list.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\portable.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\projdefs.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\queue.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\semphr.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\Source\include\task.h">\r
+ <Filter>FreeRTOS Source\Include</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\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
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+#include <stdio.h>\r
+#include <FreeRTOS.h>\r
+#include "task.h"\r
+#include "queue.h"\r
+\r
+/* Task priorities. */\r
+#define mainSTDOUT_TASK_PRIORITY tskIDLE_PRIORITY\r
+\r
+/* Stack sizes. */\r
+#define mainSTDOUT_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 4 )\r
+\r
+/* File scope variables. */\r
+static volatile unsigned long ul1 = 0, ul2 = 0;\r
+static xQueueHandle xStdoutQueue = NULL;\r
+\r
+/* Task function prototypes. */\r
+static void prvTask1( void *pvParameters );\r
+static void prvTask2( void *pvParameters );\r
+static void prvStdoutTask( void *pvParameters );\r
+\r
+/* Create a queue on which console output strings can be posted, then start the\r
+task that processes the queue - printf()'ing each string that is received. */\r
+static void prvStartStdoutTask( void );\r
+\r
+/* Post a message for output by the stdout task. Basically queues the message\r
+pointed to by pcTextToPrint for output to stdout in a thread safe manner. */\r
+void vMainConsolePrint( const char *pcTextToPrint, portTickType xTicksToWait );\r
+\r
+volatile unsigned long ulIdleCount = 0UL, ulT1Count = 0UL, ulT2Count = 0UL, ulTicks = 0UL;\r
+/*-----------------------------------------------------------*/\r
+\r
+int main( void )\r
+{\r
+ prvStartStdoutTask();\r
+ xTaskCreate( prvTask1, "t1", 100, NULL, 0, NULL );\r
+ xTaskCreate( prvTask2, "t2", 100, NULL, 0, NULL );\r
+ vTaskStartScheduler();\r
+\r
+ /* Should never get here unless there was not enough heap space to create \r
+ the idle and other system tasks. */\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vMainConsolePrint( const char *pcTextToPrint, portTickType xTicksToWait )\r
+{\r
+ if( xStdoutQueue != NULL )\r
+ {\r
+ xQueueSend( xStdoutQueue, &pcTextToPrint, xTicksToWait );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvStartStdoutTask( void )\r
+{\r
+const unsigned long ulQueueLength = 20;\r
+\r
+ /* Create the queue on which starings for output will be stored. */\r
+ xStdoutQueue = xQueueCreate( ulQueueLength, ( unsigned portBASE_TYPE ) sizeof( char * ) );\r
+\r
+ if( xStdoutQueue != NULL )\r
+ {\r
+ /* Create the task that processes the stdout messages. */\r
+ xTaskCreate( prvStdoutTask, "stdout task", mainSTDOUT_TASK_STACK_SIZE, NULL, mainSTDOUT_TASK_PRIORITY, NULL );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvStdoutTask( void *pvParameters )\r
+{\r
+char *pcString;\r
+\r
+ /* Just to remove compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+ /* This task would not have been created if the queue had not been created\r
+ successfully too. Also, because of the FreeRTOSConfig.h settings using\r
+ portMAX_DELAY in this case means wait forever, so when this function returns\r
+ we know there is a string to print. */\r
+ xQueueReceive( xStdoutQueue, &pcString, portMAX_DELAY );\r
+ printf( "%s", pcString );\r
+ //fflush( stdout );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTask1( void *pvParameters )\r
+{\r
+const char *pcTask1Message = "Task 1 running\r\n";\r
+const portTickType xTicksToDelay = 1000 / portTICK_RATE_MS;\r
+\r
+ /* Just to remove compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+// ul1++;\r
+ vMainConsolePrint( pcTask1Message, 0 );\r
+ vTaskDelay( xTicksToDelay );\r
+ ulT1Count++;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTask2( void *pvParameters )\r
+{\r
+const char *pcTask2Message = "Task 2 running\r\n";\r
+const portTickType xTicksToDelay = 500 / portTICK_RATE_MS;\r
+\r
+ /* Just to remove compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+// ul2++;\r
+ vMainConsolePrint( pcTask2Message, 0 );\r
+ vTaskDelay( xTicksToDelay );\r
+ ulT2Count++;\r
+// taskYIELD();\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationIdleHook()\r
+{\r
+const unsigned long ulMSToSleep = 5;\r
+\r
+ /* Sleep to reduce CPU load, but don't sleep indefinitely if not using \r
+ preemption as as nothing will cause a task switch. */\r
+ #if configUSE_PREEMPTION != 0\r
+ {\r
+ SleepEx( INFINITE, TRUE );\r
+ }\r
+ #else\r
+ {\r
+ SleepEx( ulMSToSleep, TRUE );\r
+ }\r
+ #endif\r
+\r
+ ulIdleCount++;\r
+}\r