mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-22 01:30:31 -05:00
Fix formatting in kernel demo application files (#1148)
* Fix formatting in kernel demo application files * Fix header check fail in the demo files * Add ignored patterns in core header check file * Fix formatting * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationMallocFailedHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Fix formatting AVR32_UC3 --------- Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
This commit is contained in:
parent
85ed21bcfb
commit
121fbe295b
169 changed files with 22211 additions and 21557 deletions
|
|
@ -107,18 +107,18 @@
|
|||
#include "MessageBufferAMP.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||
|
||||
/*
|
||||
* Exercises code that is not otherwise covered by the standard demo/test
|
||||
|
|
@ -127,11 +127,11 @@
|
|||
extern BaseType_t xRunCodeCoverageTestAdditions( void );
|
||||
|
||||
/* Task function prototypes. */
|
||||
static void prvCheckTask( void *pvParameters );
|
||||
static void prvCheckTask( void * pvParameters );
|
||||
|
||||
/* A task that is created from the idle task to test the functionality of
|
||||
eTaskStateGet(). */
|
||||
static void prvTestTask( void *pvParameters );
|
||||
* eTaskStateGet(). */
|
||||
static void prvTestTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* Called from the idle task hook function to demonstrate a few utility
|
||||
|
|
@ -149,7 +149,8 @@ static void prvDemonstratePendingFunctionCall( void );
|
|||
/*
|
||||
* The function that is pended by prvDemonstratePendingFunctionCall().
|
||||
*/
|
||||
static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 );
|
||||
static void prvPendedFunction( void * pvParameter1,
|
||||
uint32_t ulParameter2 );
|
||||
|
||||
/*
|
||||
* prvDemonstrateTimerQueryFunctions() is called from the idle task hook
|
||||
|
|
@ -163,28 +164,28 @@ static void prvTestTimerCallback( TimerHandle_t xTimer );
|
|||
/*
|
||||
* A task to demonstrate the use of the xQueueSpacesAvailable() function.
|
||||
*/
|
||||
static void prvDemoQueueSpaceFunctions( void *pvParameters );
|
||||
static void prvDemoQueueSpaceFunctions( void * pvParameters );
|
||||
|
||||
/*
|
||||
* Tasks that ensure indefinite delays are truly indefinite.
|
||||
*/
|
||||
static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters );
|
||||
static void prvPermanentlyBlockingNotificationTask( void *pvParameters );
|
||||
static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters );
|
||||
static void prvPermanentlyBlockingNotificationTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* The test function and callback function used when exercising the timer AP
|
||||
* function that changes the timer's auto-reload mode.
|
||||
*/
|
||||
static void prvDemonstrateChangingTimerReloadMode( void *pvParameters );
|
||||
static void prvDemonstrateChangingTimerReloadMode( void * pvParameters );
|
||||
static void prvReloadModeTestTimerCallback( TimerHandle_t xTimer );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The variable into which error messages are latched. */
|
||||
static char *pcStatusMessage = "No errors";
|
||||
static char * pcStatusMessage = "No errors";
|
||||
|
||||
/* This semaphore is created purely to test using the vSemaphoreDelete() and
|
||||
semaphore tracing API functions. It has no other purpose. */
|
||||
* semaphore tracing API functions. It has no other purpose. */
|
||||
static SemaphoreHandle_t xMutexToDelete = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -224,13 +225,13 @@ int main_full( void )
|
|||
vStartStreamBufferInterruptDemo();
|
||||
vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE );
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
vStartStaticallyAllocatedTasks();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if( configUSE_PREEMPTION != 0 )
|
||||
#if ( configUSE_PREEMPTION != 0 )
|
||||
{
|
||||
/* Don't expect these tasks to pass when preemption is not used. */
|
||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||
|
|
@ -238,29 +239,29 @@ int main_full( void )
|
|||
#endif
|
||||
|
||||
/* 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. */
|
||||
* 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
|
||||
is done purely to test the use of vSemaphoreDelete(). */
|
||||
* is done purely to test the use of vSemaphoreDelete(). */
|
||||
xMutexToDelete = xSemaphoreCreateMutex();
|
||||
|
||||
/* Start the scheduler itself. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Should never get here unless there was not enough heap space to create
|
||||
the idle and other system tasks. */
|
||||
* the idle and other system tasks. */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCheckTask( void *pvParameters )
|
||||
static void prvCheckTask( void * pvParameters )
|
||||
{
|
||||
TickType_t xNextWakeTime;
|
||||
const TickType_t xCyclePeriod = pdMS_TO_TICKS( 5000UL );
|
||||
HeapStats_t xHeapStats;
|
||||
TickType_t xNextWakeTime;
|
||||
const TickType_t xCyclePeriod = pdMS_TO_TICKS( 5000UL );
|
||||
HeapStats_t xHeapStats;
|
||||
|
||||
/* Just to remove compiler warning. */
|
||||
( void ) pvParameters;
|
||||
|
|
@ -268,13 +269,13 @@ HeapStats_t xHeapStats;
|
|||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
for( ; ; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again. */
|
||||
vTaskDelayUntil( &xNextWakeTime, xCyclePeriod );
|
||||
|
||||
/* Check the standard demo tasks are running without error. */
|
||||
#if( configUSE_PREEMPTION != 0 )
|
||||
#if ( configUSE_PREEMPTION != 0 )
|
||||
{
|
||||
/* These tasks are only created when preemption is used. */
|
||||
if( xAreTimerDemoTasksStillRunning( xCyclePeriod ) != pdTRUE )
|
||||
|
|
@ -377,7 +378,7 @@ HeapStats_t xHeapStats;
|
|||
pcStatusMessage = "Error: Message buffer AMP";
|
||||
}
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
else if( xAreStaticAllocationTasksStillRunning() != pdPASS )
|
||||
{
|
||||
pcStatusMessage = "Error: Static allocation";
|
||||
|
|
@ -385,38 +386,38 @@ HeapStats_t xHeapStats;
|
|||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/* This is the only task that uses stdout so its ok to call printf()
|
||||
directly. */
|
||||
* directly. */
|
||||
vPortGetHeapStats( &xHeapStats );
|
||||
|
||||
configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() );
|
||||
configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() );
|
||||
|
||||
printf( "%s - tick count %u - free heap %u - min free heap %u - largest free block %u - number of free blocks %u\r\n",
|
||||
pcStatusMessage,
|
||||
xTaskGetTickCount(),
|
||||
xHeapStats.xAvailableHeapSpaceInBytes,
|
||||
xHeapStats.xMinimumEverFreeBytesRemaining,
|
||||
xHeapStats.xSizeOfLargestFreeBlockInBytes,
|
||||
xHeapStats.xNumberOfFreeBlocks );
|
||||
pcStatusMessage,
|
||||
xTaskGetTickCount(),
|
||||
xHeapStats.xAvailableHeapSpaceInBytes,
|
||||
xHeapStats.xMinimumEverFreeBytesRemaining,
|
||||
xHeapStats.xSizeOfLargestFreeBlockInBytes,
|
||||
xHeapStats.xNumberOfFreeBlocks );
|
||||
|
||||
fflush( stdout );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvTestTask( void *pvParameters )
|
||||
static void prvTestTask( void * pvParameters )
|
||||
{
|
||||
const unsigned long ulMSToSleep = 5;
|
||||
const unsigned long ulMSToSleep = 5;
|
||||
|
||||
/* Just to remove compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* This task is just used to test the eTaskStateGet() function. It
|
||||
does not have anything to do. */
|
||||
for( ;; )
|
||||
* does not have anything to do. */
|
||||
for( ; ; )
|
||||
{
|
||||
/* 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 );
|
||||
}
|
||||
}
|
||||
|
|
@ -425,35 +426,35 @@ const unsigned long ulMSToSleep = 5;
|
|||
/* Called from vApplicationIdleHook(), which is defined in main.c. */
|
||||
void vFullDemoIdleFunction( void )
|
||||
{
|
||||
const unsigned long ulMSToSleep = 15;
|
||||
void *pvAllocated;
|
||||
const unsigned long ulMSToSleep = 15;
|
||||
void * pvAllocated;
|
||||
|
||||
/* 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 );
|
||||
|
||||
/* Demonstrate a few utility functions that are not demonstrated by any of
|
||||
the standard demo tasks. */
|
||||
* the standard demo tasks. */
|
||||
prvDemonstrateTaskStateAndHandleGetFunctions();
|
||||
|
||||
/* Demonstrate the use of xTimerPendFunctionCall(), which is not
|
||||
demonstrated by any of the standard demo tasks. */
|
||||
* demonstrated by any of the standard demo tasks. */
|
||||
prvDemonstratePendingFunctionCall();
|
||||
|
||||
/* Demonstrate the use of functions that query information about a software
|
||||
timer. */
|
||||
* timer. */
|
||||
prvDemonstrateTimerQueryFunctions();
|
||||
|
||||
/* If xMutexToDelete has not already been deleted, then delete it now.
|
||||
This is done purely to demonstrate the use of, and test, the
|
||||
vSemaphoreDelete() macro. Care must be taken not to delete a semaphore
|
||||
that has tasks blocked on it. */
|
||||
* This is done purely to demonstrate the use of, and test, the
|
||||
* vSemaphoreDelete() macro. Care must be taken not to delete a semaphore
|
||||
* that has tasks blocked on it. */
|
||||
if( xMutexToDelete != NULL )
|
||||
{
|
||||
/* For test purposes, add the mutex to the registry, then remove it
|
||||
again, before it is deleted - checking its name is as expected before
|
||||
and after the assertion into the registry and its removal from the
|
||||
registry. */
|
||||
* again, before it is deleted - checking its name is as expected before
|
||||
* and after the assertion into the registry and its removal from the
|
||||
* registry. */
|
||||
configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );
|
||||
vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" );
|
||||
configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 );
|
||||
|
|
@ -465,13 +466,13 @@ void *pvAllocated;
|
|||
}
|
||||
|
||||
/* Exercise heap_5 a bit. The malloc failed hook will trap failed
|
||||
allocations so there is no need to test here. */
|
||||
* allocations so there is no need to test here. */
|
||||
pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );
|
||||
vPortFree( pvAllocated );
|
||||
|
||||
/* Exit after a fixed time so code coverage results are written to the
|
||||
disk. */
|
||||
#if( projCOVERAGE_TEST == 1 )
|
||||
* disk. */
|
||||
#if ( projCOVERAGE_TEST == 1 )
|
||||
{
|
||||
const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL );
|
||||
|
||||
|
|
@ -486,18 +487,18 @@ void *pvAllocated;
|
|||
vTaskEndScheduler();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* if ( projCOVERAGE_TEST == 1 ) */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Called by vApplicationTickHook(), which is defined in main.c. */
|
||||
void vFullDemoTickHookFunction( void )
|
||||
{
|
||||
TaskHandle_t xTimerTask;
|
||||
TaskHandle_t xTimerTask;
|
||||
|
||||
/* Call the periodic timer test, which tests the timer API functions that
|
||||
can be called from an ISR. */
|
||||
#if( configUSE_PREEMPTION != 0 )
|
||||
* can be called from an ISR. */
|
||||
#if ( configUSE_PREEMPTION != 0 )
|
||||
{
|
||||
/* Only created when preemption is used. */
|
||||
vTimerPeriodicISRTests();
|
||||
|
|
@ -508,7 +509,7 @@ TaskHandle_t xTimerTask;
|
|||
vQueueOverwritePeriodicISRDemo();
|
||||
|
||||
/* Write to a queue that is in use as part of the queue set demo to
|
||||
demonstrate using queue sets from an ISR. */
|
||||
* demonstrate using queue sets from an ISR. */
|
||||
vQueueSetAccessQueueSetFromISR();
|
||||
vQueueSetPollingInterruptAccess();
|
||||
|
||||
|
|
@ -522,11 +523,11 @@ TaskHandle_t xTimerTask;
|
|||
xNotifyTaskFromISR();
|
||||
|
||||
/* Writes to stream buffer byte by byte to test the stream buffer trigger
|
||||
level functionality. */
|
||||
* level functionality. */
|
||||
vPeriodicStreamBufferProcessing();
|
||||
|
||||
/* Writes a string to a string buffer four bytes at a time to demonstrate
|
||||
a stream being sent from an interrupt to a task. */
|
||||
* a stream being sent from an interrupt to a task. */
|
||||
vBasicStreamBufferSendFromISR();
|
||||
|
||||
/* For code coverage purposes. */
|
||||
|
|
@ -536,10 +537,11 @@ TaskHandle_t xTimerTask;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 )
|
||||
static void prvPendedFunction( void * pvParameter1,
|
||||
uint32_t ulParameter2 )
|
||||
{
|
||||
static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL;
|
||||
uint32_t ulParameter1;
|
||||
static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL;
|
||||
uint32_t ulParameter1;
|
||||
|
||||
ulParameter1 = ( uint32_t ) pvParameter1;
|
||||
|
||||
|
|
@ -560,17 +562,17 @@ uint32_t ulParameter1;
|
|||
static void prvTestTimerCallback( TimerHandle_t xTimer )
|
||||
{
|
||||
/* This is the callback function for the timer accessed by
|
||||
prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */
|
||||
* prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */
|
||||
( void ) xTimer;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvDemonstrateTimerQueryFunctions( void )
|
||||
{
|
||||
static TimerHandle_t xTimer = NULL;
|
||||
const char *pcTimerName = "TestTimer";
|
||||
volatile TickType_t xExpiryTime;
|
||||
const TickType_t xDontBlock = 0;
|
||||
static TimerHandle_t xTimer = NULL;
|
||||
const char * pcTimerName = "TestTimer";
|
||||
volatile TickType_t xExpiryTime;
|
||||
const TickType_t xDontBlock = 0;
|
||||
|
||||
if( xTimer == NULL )
|
||||
{
|
||||
|
|
@ -579,7 +581,7 @@ const TickType_t xDontBlock = 0;
|
|||
if( xTimer != NULL )
|
||||
{
|
||||
/* Called from the idle task so a block time must not be
|
||||
specified. */
|
||||
* specified. */
|
||||
xTimerStart( xTimer, xDontBlock );
|
||||
}
|
||||
}
|
||||
|
|
@ -593,11 +595,11 @@ const TickType_t xDontBlock = 0;
|
|||
configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY );
|
||||
|
||||
/* Demonstrate querying a timer's next expiry time, although nothing is
|
||||
done with the returned value. Note if the expiry time is less than the
|
||||
maximum tick count then the expiry time has overflowed from the current
|
||||
time. In this case the expiry time was set to portMAX_DELAY, so it is
|
||||
expected to be less than the current time until the current time has
|
||||
itself overflowed. */
|
||||
* done with the returned value. Note if the expiry time is less than the
|
||||
* maximum tick count then the expiry time has overflowed from the current
|
||||
* time. In this case the expiry time was set to portMAX_DELAY, so it is
|
||||
* expected to be less than the current time until the current time has
|
||||
* itself overflowed. */
|
||||
xExpiryTime = xTimerGetExpiryTime( xTimer );
|
||||
( void ) xExpiryTime;
|
||||
}
|
||||
|
|
@ -606,11 +608,12 @@ const TickType_t xDontBlock = 0;
|
|||
|
||||
static void prvDemonstratePendingFunctionCall( void )
|
||||
{
|
||||
static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL;
|
||||
const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */
|
||||
static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL;
|
||||
const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */
|
||||
|
||||
/* prvPendedFunction() just expects the parameters to be incremented by one
|
||||
each time it is called. */
|
||||
* each time it is called. */
|
||||
|
||||
ulParameter1++;
|
||||
ulParameter2++;
|
||||
|
||||
|
|
@ -621,30 +624,30 @@ const TickType_t xDontBlock = 0; /* This is called from the idle task so must *n
|
|||
|
||||
static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
|
||||
{
|
||||
TaskHandle_t xIdleTaskHandle, xTimerTaskHandle;
|
||||
char *pcTaskName;
|
||||
static portBASE_TYPE xPerformedOneShotTests = pdFALSE;
|
||||
TaskHandle_t xTestTask;
|
||||
TaskStatus_t xTaskInfo;
|
||||
extern StackType_t uxTimerTaskStack[];
|
||||
static uint32_t ulLastIdleExecutionTime = 0;
|
||||
uint32_t ulIdleExecutionTime;
|
||||
TaskHandle_t xIdleTaskHandle, xTimerTaskHandle;
|
||||
char * pcTaskName;
|
||||
static portBASE_TYPE xPerformedOneShotTests = pdFALSE;
|
||||
TaskHandle_t xTestTask;
|
||||
TaskStatus_t xTaskInfo;
|
||||
extern StackType_t uxTimerTaskStack[];
|
||||
static uint32_t ulLastIdleExecutionTime = 0;
|
||||
uint32_t ulIdleExecutionTime;
|
||||
|
||||
/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and
|
||||
xTaskGetIdleTaskHandle() functions. Also try using the function that sets
|
||||
the task number. */
|
||||
* xTaskGetIdleTaskHandle() functions. Also try using the function that sets
|
||||
* the task number. */
|
||||
xIdleTaskHandle = xTaskGetIdleTaskHandle();
|
||||
xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();
|
||||
|
||||
/* This is the idle hook, so the current task handle should equal the
|
||||
returned idle task handle. */
|
||||
* returned idle task handle. */
|
||||
if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle )
|
||||
{
|
||||
pcStatusMessage = "Error: Returned idle task handle was incorrect";
|
||||
}
|
||||
|
||||
/* Check the same handle is obtained using the idle task's name. First try
|
||||
with the wrong name, then the right name. */
|
||||
* with the wrong name, then the right name. */
|
||||
if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle )
|
||||
{
|
||||
pcStatusMessage = "Error: Returned handle for name Idle was incorrect";
|
||||
|
|
@ -657,6 +660,7 @@ uint32_t ulIdleExecutionTime;
|
|||
|
||||
/* Check the timer task handle was returned correctly. */
|
||||
pcTaskName = pcTaskGetName( xTimerTaskHandle );
|
||||
|
||||
if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )
|
||||
{
|
||||
pcStatusMessage = "Error: Returned timer task handle was incorrect";
|
||||
|
|
@ -680,24 +684,24 @@ uint32_t ulIdleExecutionTime;
|
|||
}
|
||||
|
||||
/* Also with the vTaskGetInfo() function. */
|
||||
vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */
|
||||
&xTaskInfo, /* The structure into which information on the task will be written. */
|
||||
pdTRUE, /* Include the task's high watermark in the structure. */
|
||||
eInvalid ); /* Include the task state in the structure. */
|
||||
vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */
|
||||
&xTaskInfo, /* The structure into which information on the task will be written. */
|
||||
pdTRUE, /* Include the task's high watermark in the structure. */
|
||||
eInvalid ); /* Include the task state in the structure. */
|
||||
|
||||
/* Check the information returned by vTaskGetInfo() is as expected. */
|
||||
if( ( xTaskInfo.eCurrentState != eBlocked ) ||
|
||||
( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) ||
|
||||
if( ( xTaskInfo.eCurrentState != eBlocked ) ||
|
||||
( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) ||
|
||||
( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) ||
|
||||
( xTaskInfo.pxStackBase != uxTimerTaskStack ) ||
|
||||
( xTaskInfo.pxStackBase != uxTimerTaskStack ) ||
|
||||
( xTaskInfo.xHandle != xTimerTaskHandle ) )
|
||||
{
|
||||
pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task";
|
||||
}
|
||||
|
||||
/* Other tests that should only be performed once follow. The test task
|
||||
is not created on each iteration because to do so would cause the death
|
||||
task to report an error (too many tasks running). */
|
||||
* is not created on each iteration because to do so would cause the death
|
||||
* task to report an error (too many tasks running). */
|
||||
if( xPerformedOneShotTests == pdFALSE )
|
||||
{
|
||||
/* Don't run this part of the test again. */
|
||||
|
|
@ -714,6 +718,7 @@ uint32_t ulIdleExecutionTime;
|
|||
|
||||
/* Now suspend the test task and check its state is reported correctly. */
|
||||
vTaskSuspend( xTestTask );
|
||||
|
||||
if( eTaskStateGet( xTestTask ) != eSuspended )
|
||||
{
|
||||
pcStatusMessage = "Error: Returned test task state was incorrect 2";
|
||||
|
|
@ -721,6 +726,7 @@ uint32_t ulIdleExecutionTime;
|
|||
|
||||
/* Now delete the task and check its state is reported correctly. */
|
||||
vTaskDelete( xTestTask );
|
||||
|
||||
if( eTaskStateGet( xTestTask ) != eDeleted )
|
||||
{
|
||||
pcStatusMessage = "Error: Returned test task state was incorrect 3";
|
||||
|
|
@ -729,29 +735,31 @@ uint32_t ulIdleExecutionTime;
|
|||
}
|
||||
|
||||
ulIdleExecutionTime = ulTaskGetIdleRunTimeCounter();
|
||||
|
||||
if( ulIdleExecutionTime == ulLastIdleExecutionTime )
|
||||
{
|
||||
pcStatusMessage = "Error: Total amount of Idle task execution time did not change";
|
||||
}
|
||||
|
||||
ulLastIdleExecutionTime = ulIdleExecutionTime;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvDemoQueueSpaceFunctions( void *pvParameters )
|
||||
static void prvDemoQueueSpaceFunctions( void * pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue = NULL;
|
||||
const unsigned portBASE_TYPE uxQueueLength = 10;
|
||||
unsigned portBASE_TYPE uxReturn, x;
|
||||
QueueHandle_t xQueue = NULL;
|
||||
const unsigned portBASE_TYPE uxQueueLength = 10;
|
||||
unsigned portBASE_TYPE uxReturn, x;
|
||||
|
||||
/* Remove compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Create the queue that will be used. Nothing is actually going to be
|
||||
sent or received so the queue item size is set to 0. */
|
||||
* sent or received so the queue item size is set to 0. */
|
||||
xQueue = xQueueCreate( uxQueueLength, 0 );
|
||||
configASSERT( xQueue );
|
||||
|
||||
for( ;; )
|
||||
for( ; ; )
|
||||
{
|
||||
for( x = 0; x < uxQueueLength; x++ )
|
||||
{
|
||||
|
|
@ -759,11 +767,11 @@ unsigned portBASE_TYPE uxReturn, x;
|
|||
uxReturn = uxQueueMessagesWaiting( xQueue );
|
||||
|
||||
/* Check the number of messages being reported as being available
|
||||
is as expected, and force an assert if not. */
|
||||
* is as expected, and force an assert if not. */
|
||||
if( uxReturn != x )
|
||||
{
|
||||
/* xQueue cannot be NULL so this is deliberately causing an
|
||||
assert to be triggered as there is an error. */
|
||||
* assert to be triggered as there is an error. */
|
||||
configASSERT( xQueue == NULL );
|
||||
}
|
||||
|
||||
|
|
@ -771,11 +779,11 @@ unsigned portBASE_TYPE uxReturn, x;
|
|||
uxReturn = uxQueueSpacesAvailable( xQueue );
|
||||
|
||||
/* Check the number of spaces being reported as being available
|
||||
is as expected, and force an assert if not. */
|
||||
* is as expected, and force an assert if not. */
|
||||
if( uxReturn != ( uxQueueLength - x ) )
|
||||
{
|
||||
/* xQueue cannot be NULL so this is deliberately causing an
|
||||
assert to be triggered as there is an error. */
|
||||
* assert to be triggered as there is an error. */
|
||||
configASSERT( xQueue == NULL );
|
||||
}
|
||||
|
||||
|
|
@ -785,6 +793,7 @@ unsigned portBASE_TYPE uxReturn, x;
|
|||
|
||||
/* Perform the same check while the queue is full. */
|
||||
uxReturn = uxQueueMessagesWaiting( xQueue );
|
||||
|
||||
if( uxReturn != uxQueueLength )
|
||||
{
|
||||
configASSERT( xQueue == NULL );
|
||||
|
|
@ -800,19 +809,19 @@ unsigned portBASE_TYPE uxReturn, x;
|
|||
/* The queue is full, start again. */
|
||||
xQueueReset( xQueue );
|
||||
|
||||
#if( configUSE_PREEMPTION == 0 )
|
||||
#if ( configUSE_PREEMPTION == 0 )
|
||||
taskYIELD();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters )
|
||||
static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters )
|
||||
{
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
|
||||
/* Prevent compiler warning about unused parameter in the case that
|
||||
configASSERT() is not defined. */
|
||||
* configASSERT() is not defined. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* This task should block on a semaphore, and never return. */
|
||||
|
|
@ -822,23 +831,23 @@ SemaphoreHandle_t xSemaphore;
|
|||
xSemaphoreTake( xSemaphore, portMAX_DELAY );
|
||||
|
||||
/* The above xSemaphoreTake() call should never return, force an assert if
|
||||
it does. */
|
||||
* it does. */
|
||||
configASSERT( pvParameters != NULL );
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvPermanentlyBlockingNotificationTask( void *pvParameters )
|
||||
static void prvPermanentlyBlockingNotificationTask( void * pvParameters )
|
||||
{
|
||||
/* Prevent compiler warning about unused parameter in the case that
|
||||
configASSERT() is not defined. */
|
||||
* configASSERT() is not defined. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* This task should block on a task notification, and never return. */
|
||||
ulTaskNotifyTake( pdTRUE, portMAX_DELAY );
|
||||
|
||||
/* The above ulTaskNotifyTake() call should never return, force an assert
|
||||
if it does. */
|
||||
* if it does. */
|
||||
configASSERT( pvParameters != NULL );
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
|
|
@ -846,7 +855,7 @@ static void prvPermanentlyBlockingNotificationTask( void *pvParameters )
|
|||
|
||||
static void prvReloadModeTestTimerCallback( TimerHandle_t xTimer )
|
||||
{
|
||||
uint32_t ulTimerID;
|
||||
uint32_t ulTimerID;
|
||||
|
||||
/* Increment the timer's ID to show the callback has executed. */
|
||||
ulTimerID = ( uint32_t ) pvTimerGetTimerID( xTimer );
|
||||
|
|
@ -855,7 +864,7 @@ uint32_t ulTimerID;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvDemonstrateChangingTimerReloadMode( void *pvParameters )
|
||||
static void prvDemonstrateChangingTimerReloadMode( void * pvParameters )
|
||||
{
|
||||
TimerHandle_t xTimer;
|
||||
const char * const pcTimerName = "TestTimer";
|
||||
|
|
@ -865,7 +874,7 @@ static void prvDemonstrateChangingTimerReloadMode( void *pvParameters )
|
|||
( void ) pvParameters;
|
||||
|
||||
/* The duration of 1 period is kept at 50ms to allow IDLE task to
|
||||
* free up this task's resources before suicidal tests can run. */
|
||||
* free up this task's resources before suicidal tests can run. */
|
||||
xTimer = xTimerCreate( pcTimerName,
|
||||
x50ms,
|
||||
pdFALSE, /* Created as a one-shot timer. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue