/*\r
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
\r
- FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT \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
FreeRTOS WEB site.\r
\r
1 tab == 4 spaces!\r
- \r
+\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
* *\r
***************************************************************************\r
\r
- \r
- http://www.FreeRTOS.org - Documentation, training, latest versions, license \r
- and contact details. \r
- \r
+\r
+ http://www.FreeRTOS.org - Documentation, training, latest versions, license\r
+ and contact details.\r
+\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool.\r
\r
- Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
- the code with commercial support, indemnification, and middleware, under \r
+ Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+ the code with commercial support, indemnification, and middleware, under\r
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also\r
- provide a safety engineered and independently SIL3 certified version under \r
+ provide a safety engineered and independently SIL3 certified version under\r
the SafeRTOS brand: http://www.SafeRTOS.com.\r
*/\r
\r
#define configQUEUE_REGISTRY_SIZE 10\r
#define configGENERATE_RUN_TIME_STATS 1\r
#define configUSE_MALLOC_FAILED_HOOK 1\r
+#define configUSE_QUEUE_SETS 1\r
\r
#define configMAX_PRIORITIES ( 5UL )\r
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
version. */\r
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
\r
+/* Disable interrupts and sit in a null loop if assert is called. */\r
+#define configASSERT( x ) if( ( x == 0 ) ) { taskDISABLE_INTERRUPTS(); for( ;; ); }\r
+\r
#endif /* FREERTOS_CONFIG_H */\r
<file file_name="../Common/include/death.h"/>
<file file_name="../Common/include/GenQTest.h"/>
<file file_name="../Common/include/integer.h"/>
+ <file file_name="../Common/include/QueueSet.h"/>
</folder>
+ <file file_name="../Common/Minimal/QueueSet.c"/>
</folder>
<folder Name="WEB Server">
<file file_name="webserver/uIP_Task.c"/>
<ProjectSessionItem path="RTOSDemo" name="unnamed" />
<ProjectSessionItem path="RTOSDemo;RTOSDemo" name="unnamed" />
<ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files" name="unnamed" />
- <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;FreeRTOS" name="unnamed" />
<ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;include" name="unnamed" />
- <ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;WEB Server" name="unnamed" />
</Project>
<Register1>
<RegisterWindow openNodes="CPU;CPU/xPSR;CPU/CFBP" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU" decimalNodes="" octalNodes="" asciiNodes="" />
<Watches active="0" update="Never" />
</Watch4>
<Files>
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" y="238" path="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" left="0" selected="1" name="unnamed" top="63" />
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" y="241" path="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_LM3Sxxxx_Rowley\main.c" left="0" selected="1" name="unnamed" top="59" />
</Files>
- <ARMCrossStudioWindow activeProject="RTOSDemo" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Source\portable\MemMang" fileDialogDefaultFilter="*.*" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
+ <ARMCrossStudioWindow activeProject="RTOSDemo" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\Common\include" fileDialogDefaultFilter="*.*" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
</session>
/*\r
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
\r
- FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT \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
FreeRTOS WEB site.\r
\r
1 tab == 4 spaces!\r
- \r
+\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
* *\r
***************************************************************************\r
\r
- \r
- http://www.FreeRTOS.org - Documentation, training, latest versions, license \r
- and contact details. \r
- \r
+\r
+ http://www.FreeRTOS.org - Documentation, training, latest versions, license\r
+ and contact details.\r
+\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool.\r
\r
- Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
- the code with commercial support, indemnification, and middleware, under \r
+ Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+ the code with commercial support, indemnification, and middleware, under\r
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also\r
- provide a safety engineered and independently SIL3 certified version under \r
+ provide a safety engineered and independently SIL3 certified version under\r
the SafeRTOS brand: http://www.SafeRTOS.com.\r
*/\r
\r
#include "QPeek.h"\r
#include "recmutex.h"\r
#include "IntQueue.h"\r
+#include "QueueSet.h"\r
\r
/*-----------------------------------------------------------*/\r
\r
vStartQueuePeekTasks();\r
vStartRecursiveMutexTasks();\r
vStartInterruptQueueTasks();\r
+ vStartQueueSetTasks();\r
\r
/* Start the tasks defined within this file/specific to this demo. */\r
xTaskCreate( vOLEDTask, ( signed char * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
{\r
xMessage.pcMessage = "ERROR IN INT QUEUE";\r
}\r
-\r
+ else if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN QUEUE SET";\r
+ }\r
\r
/* Send the message to the OLED gatekeeper for display. */\r
xHigherPriorityTaskWoken = pdFALSE;\r
xQueueSendFromISR( xOLEDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
}\r
+\r
+ /* Exercise the queue sets from an ISR. */\r
+ vQueueSetAccessQueueSetFromISR();\r
}\r
/*-----------------------------------------------------------*/\r
\r
#include <stdint.h>\r
extern uint32_t SystemCoreClock;\r
\r
-#define configUSE_PREEMPTION 1\r
-#define configUSE_IDLE_HOOK 0\r
-#define configUSE_TICK_HOOK 1\r
-#define configCPU_CLOCK_HZ ( SystemCoreClock )\r
-#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
-#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 40960 ) )\r
-#define configMAX_TASK_NAME_LEN ( 10 )\r
-#define configUSE_TRACE_FACILITY 0\r
-#define configUSE_16_BIT_TICKS 0\r
-#define configIDLE_SHOULD_YIELD 1\r
-#define configUSE_MUTEXES 1\r
-#define configQUEUE_REGISTRY_SIZE 0\r
-#define configCHECK_FOR_STACK_OVERFLOW 2\r
-#define configUSE_RECURSIVE_MUTEXES 1\r
-#define configUSE_MALLOC_FAILED_HOOK 1\r
-#define configUSE_APPLICATION_TASK_TAG 0\r
-#define configUSE_COUNTING_SEMAPHORES 1\r
-#define configUSE_QUEUE_SETS 1\r
-#define configGENERATE_RUN_TIME_STATS 0\r
+#define configUSE_PREEMPTION 1\r
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
+#define configUSE_IDLE_HOOK 0\r
+#define configUSE_TICK_HOOK 1\r
+#define configCPU_CLOCK_HZ ( SystemCoreClock )\r
+#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
+#define configMAX_PRIORITIES ( 5 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 40960 ) )\r
+#define configMAX_TASK_NAME_LEN ( 10 )\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 1\r
+#define configUSE_MUTEXES 1\r
+#define configQUEUE_REGISTRY_SIZE 0\r
+#define configCHECK_FOR_STACK_OVERFLOW 2\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
+#define configUSE_MALLOC_FAILED_HOOK 1\r
+#define configUSE_APPLICATION_TASK_TAG 0\r
+#define configUSE_COUNTING_SEMAPHORES 1\r
+#define configUSE_QUEUE_SETS 1\r
+#define configGENERATE_RUN_TIME_STATS 0\r
\r
/* Co-routine definitions. */\r
#define configUSE_CO_ROUTINES 0\r
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
{\r
/* In this case the tick hook is used as part of the queue set test. */\r
- vQueueSetWriteToQueueFromISR();\r
+ vQueueSetAccessQueueSetFromISR();\r
}\r
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
}\r
#define queuesetPRIORITY_CHANGE_LOOPS 100UL\r
\r
/* The ISR sends to the queue every queuesetISR_TX_PERIOD ticks. */\r
-#define queuesetISR_TX_PERIOD 2//( 100UL )\r
+#define queuesetISR_TX_PERIOD ( 100UL )\r
\r
/* The allowable maximum deviation between a received value and the expected\r
received value. A deviation will occur when data is received from a queue\r
inside an ISR in between a task receiving from a queue and the task checking\r
the received value. */\r
-#define queuesetALLOWABLE_RX_DEVIATION 5\r
+#define queuesetALLOWABLE_RX_DEVIATION 3\r
+\r
+/* Ignore values that are at the boundaries of allowable values to make the\r
+testing of limits easier (don't have to deal with wrapping values). */\r
+#define queuesetIGNORED_BOUNDARY ( queuesetALLOWABLE_RX_DEVIATION * 2 )\r
+\r
/*\r
* The task that periodically sends to the queue set.\r
*/\r
if( ulReceived >= queuesetINITIAL_ISR_TX_VALUE )\r
{\r
/* The value was sent from the ISR. */\r
- if( ( ulReceived - queuesetINITIAL_ISR_TX_VALUE ) < queuesetALLOWABLE_RX_DEVIATION )\r
+ if( ( ulReceived - queuesetINITIAL_ISR_TX_VALUE ) < queuesetIGNORED_BOUNDARY )\r
{\r
/* The value received is at the lower limit of the expected range.\r
Don't test it and expect to receive one higher next time. */\r
ulExpectedReceivedFromISR++;\r
}\r
- else if( ( ULONG_MAX - ulReceived ) <= queuesetALLOWABLE_RX_DEVIATION )\r
+ else if( ( ULONG_MAX - ulReceived ) <= queuesetIGNORED_BOUNDARY )\r
{\r
/* The value received is at the higher limit of the expected range.\r
Don't test it and expect to wrap soon. */\r
- ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;\r
+ ulExpectedReceivedFromISR++;\r
+ if( ulExpectedReceivedFromISR == 0 )\r
+ {\r
+ ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;\r
+ }\r
}\r
else\r
{\r
else\r
{\r
/* The value was sent from the Tx task. */\r
- if( ulReceived < queuesetALLOWABLE_RX_DEVIATION )\r
+ if( ulReceived < queuesetIGNORED_BOUNDARY )\r
{\r
/* The value received is at the lower limit of the expected range.\r
Don't test it, and expect to receive one higher next time. */\r
ulExpectedReceivedFromTask++;\r
}\r
- else if( ( ( queuesetINITIAL_ISR_TX_VALUE - 1 ) - ulReceived ) <= queuesetALLOWABLE_RX_DEVIATION )\r
+ else if( ( ( queuesetINITIAL_ISR_TX_VALUE - 1 ) - ulReceived ) <= queuesetIGNORED_BOUNDARY )\r
{\r
/* The value received is at the higher limit of the expected range.\r
Don't test it and expect to wrap soon. */\r
- ulExpectedReceivedFromTask = 0;\r
+ ulExpectedReceivedFromTask++;\r
+ if( ulExpectedReceivedFromTask >= queuesetINITIAL_ISR_TX_VALUE )\r
+ {\r
+ ulExpectedReceivedFromTask = 0;\r
+ }\r
}\r
else\r
{\r
#define configUSE_TICK_HOOK 1\r
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 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 configTOTAL_HEAP_SIZE ( ( size_t ) ( 20 * 1024 ) )\r
#define configMAX_TASK_NAME_LEN ( 12 )\r
#define configUSE_TRACE_FACILITY 1\r
#define configUSE_16_BIT_TICKS 0\r
<ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcKernel.c" />\r
<ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcPort.c" />\r
<ClCompile Include="..\..\..\FreeRTOS-Plus\FreeRTOS-Plus-Trace\trcUser.c" />\r
- <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />\r
+ <ClCompile Include="..\..\Source\portable\MemMang\heap_4.c" />\r
<ClCompile Include="..\..\Source\timers.c" />\r
<ClCompile Include="..\Common\Minimal\BlockQ.c" />\r
<ClCompile Include="..\Common\Minimal\blocktim.c" />\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
<ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c">\r
<Filter>FreeRTOS Source\Source\Portable</Filter>\r
</ClCompile>\r
<ClCompile Include="Run-time-stats-utils.c">\r
<Filter>Demo App Source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\Source\portable\MemMang\heap_4.c">\r
+ <Filter>FreeRTOS Source\Source\Portable</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="FreeRTOSConfig.h">\r
\r
/* Standard includes. */\r
#include <stdio.h>\r
+#include <stdlib.h>\r
\r
/* Kernel includes. */\r
#include <FreeRTOS.h>\r
xTaskHandle xIdleTaskHandle, xTimerTaskHandle, xTestTask;\r
signed char *pcTaskName;\r
const unsigned char ucConstQueueNumber = 0xaaU, ucConstTaskNumber = 0x55U;\r
+void *pvAllocated;\r
\r
/* These three functions are only meant for use by trace code, and not for\r
direct use from application code, hence their prototypes are not in queue.h. */\r
}\r
}\r
}\r
+\r
+ /* Exercise heap_4 a bit. The malloc failed hook will trap failed \r
+ allocations so there is no need to test here. */\r
+ pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
+ vPortFree( pvAllocated );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vApplicationMallocFailedHook( void )\r
{\r
- /* Can be implemented if required, but probably not required in this \r
- environment and running this demo. */\r
+ vAssertCalled();\r
}\r
/*-----------------------------------------------------------*/\r
\r