mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Add a few extra standard demo tasks to the Win32 demo.
Make use of the new trace specific function calls from the Win32 demo - just to check the function as expected.
This commit is contained in:
parent
cc06119b86
commit
07c326fad3
Binary file not shown.
|
@ -67,6 +67,7 @@
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||||
|
<AdditionalOptions>/wd4210 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -129,6 +130,8 @@
|
||||||
<ClCompile Include="..\Common\Minimal\BlockQ.c" />
|
<ClCompile Include="..\Common\Minimal\BlockQ.c" />
|
||||||
<ClCompile Include="..\Common\Minimal\blocktim.c" />
|
<ClCompile Include="..\Common\Minimal\blocktim.c" />
|
||||||
<ClCompile Include="..\Common\Minimal\countsem.c" />
|
<ClCompile Include="..\Common\Minimal\countsem.c" />
|
||||||
|
<ClCompile Include="..\Common\Minimal\death.c" />
|
||||||
|
<ClCompile Include="..\Common\Minimal\dynamic.c" />
|
||||||
<ClCompile Include="..\Common\Minimal\flop.c" />
|
<ClCompile Include="..\Common\Minimal\flop.c" />
|
||||||
<ClCompile Include="..\Common\Minimal\GenQTest.c" />
|
<ClCompile Include="..\Common\Minimal\GenQTest.c" />
|
||||||
<ClCompile Include="..\Common\Minimal\integer.c" />
|
<ClCompile Include="..\Common\Minimal\integer.c" />
|
||||||
|
|
|
@ -88,6 +88,12 @@
|
||||||
<ClCompile Include="..\Common\Minimal\countsem.c">
|
<ClCompile Include="..\Common\Minimal\countsem.c">
|
||||||
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Common\Minimal\death.c">
|
||||||
|
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Common\Minimal\dynamic.c">
|
||||||
|
<Filter>Demo App Source\Common Demo Tasks</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="FreeRTOSConfig.h">
|
<ClInclude Include="FreeRTOSConfig.h">
|
||||||
|
|
|
@ -100,6 +100,8 @@
|
||||||
#include "flop.h"
|
#include "flop.h"
|
||||||
#include "TimerDemo.h"
|
#include "TimerDemo.h"
|
||||||
#include "countsem.h"
|
#include "countsem.h"
|
||||||
|
#include "death.h"
|
||||||
|
#include "dynamic.h"
|
||||||
|
|
||||||
/* Priorities at which the tasks are created. */
|
/* Priorities at which the tasks are created. */
|
||||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||||
|
@ -121,9 +123,9 @@ static void prvCheckTask( void *pvParameters );
|
||||||
/* The variable into which error messages are latched. */
|
/* The variable into which error messages are latched. */
|
||||||
static char *pcStatusMessage = "OK";
|
static char *pcStatusMessage = "OK";
|
||||||
|
|
||||||
/* This semaphore is created purely to test using the vSemaphoreDelete() API
|
/* This semaphore is created purely to test using the vSemaphoreDelete() and
|
||||||
function. It has no other purpose. */
|
semaphore tracing API functions. It has no other purpose. */
|
||||||
static xSemaphoreHandle xSemaphoreToDelete = NULL;
|
static xSemaphoreHandle xMutexToDelete = NULL;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -143,10 +145,17 @@ int main( void )
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
vStartCountingSemaphoreTasks();
|
vStartCountingSemaphoreTasks();
|
||||||
|
vStartDynamicPriorityTasks();
|
||||||
|
|
||||||
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
|
tasks were running prior to their creation. This then allows them to
|
||||||
|
ascertain whether or not the correct/expected number of tasks are running at
|
||||||
|
any given time. */
|
||||||
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the semaphore that will be deleted in the idle task hook. This
|
/* Create the semaphore that will be deleted in the idle task hook. This
|
||||||
is done purely to test the use of vSemaphoreDelete(). */
|
is done purely to test the use of vSemaphoreDelete(). */
|
||||||
xSemaphoreToDelete = xSemaphoreCreateMutex();
|
xMutexToDelete = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
/* Start the scheduler itself. */
|
/* Start the scheduler itself. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -214,6 +223,14 @@ const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS;
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: CountSem";
|
pcStatusMessage = "Error: CountSem";
|
||||||
}
|
}
|
||||||
|
else if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
pcStatusMessage = "Error: Death";
|
||||||
|
}
|
||||||
|
else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
|
||||||
|
{
|
||||||
|
pcStatusMessage = "Error: Dynamic\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
/* This is the only task that uses stdout so its ok to call printf()
|
/* This is the only task that uses stdout so its ok to call printf()
|
||||||
directly. */
|
directly. */
|
||||||
|
@ -227,15 +244,27 @@ void vApplicationIdleHook( void )
|
||||||
const unsigned long ulMSToSleep = 5;
|
const unsigned long ulMSToSleep = 5;
|
||||||
xTaskHandle xIdleTaskHandle, xTimerTaskHandle;
|
xTaskHandle xIdleTaskHandle, xTimerTaskHandle;
|
||||||
signed char *pcTaskName;
|
signed char *pcTaskName;
|
||||||
|
const unsigned char ucConstQueueNumber = 0xaaU, ucConstTaskNumber = 0x55U;
|
||||||
|
|
||||||
|
/* These three functions are only meant for use by trace code, and not for
|
||||||
|
direct use from application code, hence their prototypes are not in queue.h. */
|
||||||
|
extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );
|
||||||
|
extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );
|
||||||
|
extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );
|
||||||
|
extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );
|
||||||
|
extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );
|
||||||
|
|
||||||
/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
|
/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
|
||||||
tasks waiting to be terminated by the idle task. */
|
tasks waiting to be terminated by the idle task. */
|
||||||
Sleep( ulMSToSleep );
|
Sleep( ulMSToSleep );
|
||||||
|
|
||||||
/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and
|
/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and
|
||||||
xTaskGetIdleTaskHandle() functions. */
|
xTaskGetIdleTaskHandle() functions. Also try using the function that sets
|
||||||
|
the task number. */
|
||||||
xIdleTaskHandle = xTaskGetIdleTaskHandle();
|
xIdleTaskHandle = xTaskGetIdleTaskHandle();
|
||||||
xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();
|
xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();
|
||||||
|
vTaskSetTaskNumber( xIdleTaskHandle, ( unsigned long ) ucConstTaskNumber );
|
||||||
|
configASSERT( uxTaskGetTaskNumber( xIdleTaskHandle ) == ucConstTaskNumber );
|
||||||
|
|
||||||
/* This is the idle hook, so the current task handle should equal the
|
/* This is the idle hook, so the current task handle should equal the
|
||||||
returned idle task handle. */
|
returned idle task handle. */
|
||||||
|
@ -251,14 +280,24 @@ signed char *pcTaskName;
|
||||||
pcStatusMessage = "Error: Returned timer task handle was incorrect";
|
pcStatusMessage = "Error: Returned timer task handle was incorrect";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If xSemaphoreToDelete has not already been deleted, then delete it now.
|
/* If xMutexToDelete has not already been deleted, then delete it now.
|
||||||
This is done purely to demonstrate the use of, and test, the
|
This is done purely to demonstrate the use of, and test, the
|
||||||
vSemaphoreDelete() macro. Care must be taken not to delete a semaphore
|
vSemaphoreDelete() macro. Care must be taken not to delete a semaphore
|
||||||
that has tasks blocked on it. */
|
that has tasks blocked on it. */
|
||||||
if( xSemaphoreToDelete != NULL )
|
if( xMutexToDelete != NULL )
|
||||||
{
|
{
|
||||||
vSemaphoreDelete( xSemaphoreToDelete );
|
/* Before deleting the semaphore, test the function used to set its
|
||||||
xSemaphoreToDelete = NULL;
|
number. This would normally only be done from trace software, rather
|
||||||
|
than application code. */
|
||||||
|
vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber );
|
||||||
|
|
||||||
|
/* Before deleting the semaphore, test the functions used to get its
|
||||||
|
type and number. Again, these would normally only be done from trace
|
||||||
|
software, rather than application code. */
|
||||||
|
configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber );
|
||||||
|
configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX );
|
||||||
|
vSemaphoreDelete( xMutexToDelete );
|
||||||
|
xMutexToDelete = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue