* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
*----------------------------------------------------------*/\r
+#define configUSE_PREEMPTION 1\r
+#define configUSE_IDLE_HOOK 1\r
+#define configUSE_TICK_HOOK 0\r
+#define configTICK_RATE_HZ ( ( portTickType ) 50 )\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 ( 12 )\r
+#define configUSE_TRACE_FACILITY 1\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 1\r
+#define configUSE_CO_ROUTINES 0\r
+#define configUSE_MUTEXES 1\r
+#define configGENERATE_RUN_TIME_STATS 0\r
+#define configCHECK_FOR_STACK_OVERFLOW 0\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
+#define configQUEUE_REGISTRY_SIZE 0\r
+#define configUSE_MALLOC_FAILED_HOOK 1\r
+#define configUSE_APPLICATION_TASK_TAG 0\r
+\r
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\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
/* 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
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 1\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+#define INCLUDE_uxTaskGetStackHighWaterMark 1\r
+#define INCLUDE_xTaskGetSchedulerState 1\r
\r
\r
#endif /* FREERTOS_CONFIG_H */\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
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<MinimalRebuild>true</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
<WarningLevel>Level4</WarningLevel>\r
<SuppressStartupBanner>true</SuppressStartupBanner>\r
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
+ <DisableLanguageExtensions>false</DisableLanguageExtensions>\r
</ClCompile>\r
<ResourceCompile>\r
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>\r
<SubSystem>Console</SubSystem>\r
<TargetMachine>MachineX86</TargetMachine>\r
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\r
</Link>\r
<Bscmake>\r
<SuppressStartupBanner>true</SuppressStartupBanner>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
<ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />\r
+ <ClCompile Include="..\Common\Minimal\BlockQ.c" />\r
+ <ClCompile Include="..\Common\Minimal\blocktim.c" />\r
+ <ClCompile Include="..\Common\Minimal\flop.c" />\r
+ <ClCompile Include="..\Common\Minimal\GenQTest.c" />\r
+ <ClCompile Include="..\Common\Minimal\integer.c" />\r
+ <ClCompile Include="..\Common\Minimal\PollQ.c" />\r
+ <ClCompile Include="..\Common\Minimal\QPeek.c" />\r
+ <ClCompile Include="..\Common\Minimal\recmutex.c" />\r
+ <ClCompile Include="..\Common\Minimal\semtest.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
<UniqueIdentifier>{34567deb-d5ab-4a56-8640-0aaec609521a}</UniqueIdentifier>\r
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>\r
</Filter>\r
+ <Filter Include="Demo App Source\Common Demo Tasks">\r
+ <UniqueIdentifier>{2d4a700c-06e3-4dd2-afbe-ab1be71ebe2a}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="FreeRTOS Source\Source\Portable">\r
+ <UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>\r
+ </Filter>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="main.c">\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\portable\MemMang\heap_3.c">\r
<Filter>FreeRTOS Source\Source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c">\r
+ <Filter>FreeRTOS Source\Source\Portable</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\flop.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\GenQTest.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\integer.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\PollQ.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\QPeek.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\recmutex.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\semtest.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\BlockQ.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\Common\Minimal\blocktim.c">\r
+ <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="Board.h">\r
licensing and training services.\r
*/\r
\r
+/* Standard includes. */\r
#include <stdio.h>\r
+\r
+/* Kernel includes. */\r
#include <FreeRTOS.h>\r
#include "task.h"\r
#include "queue.h"\r
\r
-/* Task priorities. */\r
-#define mainSTDOUT_TASK_PRIORITY tskIDLE_PRIORITY\r
+/* Standard demo includes. */\r
+#include "partest.h"\r
+#include "BlockQ.h"\r
+#include "death.h"\r
+#include "integer.h"\r
+//#include "blocktim.h"\r
+#include "semtest.h"\r
+#include "PollQ.h"\r
+#include "GenQTest.h"\r
+#include "QPeek.h"\r
+#include "recmutex.h"\r
+#include "flop.h"\r
+\r
+/* Priorities at which the tasks are created. */\r
+#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
+#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )\r
+#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
\r
/* Stack sizes. */\r
#define mainSTDOUT_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 4 )\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
+static void prvCheckTask( 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
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
+ /* Start the check task as described at the top of this file. */\r
+ xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+ /* Create the standard demo tasks. */\r
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+// vCreateBlockTimeTasks();\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
+ vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
+ vStartQueuePeekTasks();\r
+ vStartRecursiveMutexTasks();\r
+ vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
+\r
+ /* Start the scheduler itself. */\r
vTaskStartScheduler();\r
\r
/* Should never get here unless there was not enough heap space to create \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
+static void prvCheckTask( void *pvParameters )\r
{\r
-const char *pcTask1Message = "Task 1 running\r\n";\r
-const portTickType xTicksToDelay = 1000 / portTICK_RATE_MS;\r
+portTickType xNextWakeTime;\r
+const portTickType xCycleFrequency = 5000 / portTICK_RATE_MS;\r
+char *pcStatusMessage = "OK";\r
+long lCycleCount = 0;\r
\r
- /* Just to remove compiler warnings. */\r
+ /* Just to remove compiler warning. */\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
+ /* Initialise xNextWakeTime - this only needs to be done once. */\r
+ xNextWakeTime = xTaskGetTickCount();\r
\r
for( ;; )\r
{\r
-// ul2++;\r
- vMainConsolePrint( pcTask2Message, 0 );\r
- vTaskDelay( xTicksToDelay );\r
- ulT2Count++;\r
-// taskYIELD();\r
+ /* Place this task in the blocked state until it is time to run again. */\r
+ vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
+\r
+ /* Check the standard demo tasks are running without error. */\r
+ if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: IntMath";\r
+ } \r
+ else if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ { \r
+ pcStatusMessage = "Error: GenQueue";\r
+ }\r
+ else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: QueuePeek";\r
+ }\r
+ else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: BlockQueue";\r
+ }\r
+// else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+// {\r
+// pcStatusMessage = "Error: BlockTime";\r
+// }\r
+ else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: SemTest";\r
+ }\r
+ else if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: PollQueue";\r
+ }\r
+ else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: RecMutex";\r
+ }\r
+ else if( xAreMathsTaskStillRunning() != pdPASS )\r
+ {\r
+ pcStatusMessage = "Error: Flop";\r
+ }\r
+\r
+ /* This is the only task that uses stdout so its ok to call printf() \r
+ directly. */\r
+ printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vApplicationIdleHook()\r
+void vApplicationIdleHook( void )\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
+ #if( configUSE_PREEMPTION != 0 )\r
{\r
SleepEx( INFINITE, TRUE );\r
}\r
#else\r
{\r
+ const unsigned long ulMSToSleep = 5;\r
+\r
SleepEx( ulMSToSleep, TRUE );\r
}\r
#endif\r
+}\r
+/*-----------------------------------------------------------*/\r
\r
- ulIdleCount++;\r
+void vApplicationMallocFailedHook( void )\r
+{\r
+ /* Can be implemented if required, but probably not required in this \r
+ environment and running this demo. */\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationStackOverflowHook( void )\r
+{\r
+ /* Can be implemented if required, but not required in this \r
+ environment and running this demo. */\r
+}\r
+\r