static void prvMainCheckOtherTasksAreStillRunning( void ) { /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none of them have detected an error. */ /* This function is called from more than one task. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { lErrorInTask = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { lErrorInTask = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lErrorInTask = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lErrorInTask = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lErrorInTask = pdTRUE; } }
static long prvCheckOtherTasksAreStillRunning( void ) { long lReturn = ( long ) pdPASS; /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none of them have detected an error. */ if( xArePollingQueuesStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } return lReturn; }
static void vCheckTimerCallback( xTimerHandle xTimer ) { static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; /* Define the status message that is sent to the LCD task. By default the status is PASS. */ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; /* This is the callback function used by the 'check' timer, as described at the top of this file. */ /* The parameter is not used. */ ( void ) xTimer; /* See if the standard demo tasks are executing as expected, changing the message that is sent to the LCD task from PASS to an error code if any tasks set reports an error. */ if( xAreComTestTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_COM_TEST; } if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; } if( xAreGenericQueueTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; } if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_COUNT_SEM_TEST; } if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_TIMER_TEST; } /* Check the reg test tasks are still cycling. They will stop incrementing their loop counters if they encounter an error. */ if( usRegTest1Counter == usLastRegTest1Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } if( usRegTest2Counter == usLastRegTest2Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } usLastRegTest1Counter = usRegTest1Counter; usLastRegTest2Counter = usRegTest2Counter; /* This is called from a timer callback so must not block! */ xQueueSendToBack( xLCDQueue, &xStatusMessage, mainDONT_BLOCK ); }
/* See the description at the top of this file. */ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { static long lChangedTimerPeriodAlready = pdFALSE; static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; unsigned long ulErrorFound = pdFALSE; /* Check all the demo and test tasks to ensure that they are all still running, and that none have detected an error. */ if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { ulErrorFound |= ( 0x01UL << 0UL ); } if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) { ulErrorFound |= ( 0x01UL << 1UL ); } if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) { ulErrorFound |= ( 0x01UL << 2UL ); } if( xAreRecursiveMutexTasksStillRunning() != pdPASS ) { ulErrorFound |= ( 0x01UL << 3UL ); } /* Check that the register test 1 task is still running. */ if( ulLastRegTest1Value == ulRegTest1LoopCounter ) { ulErrorFound |= ( 0x01UL << 4UL ); } ulLastRegTest1Value = ulRegTest1LoopCounter; /* Check that the register test 2 task is still running. */ if( ulLastRegTest2Value == ulRegTest2LoopCounter ) { ulErrorFound |= ( 0x01UL << 5UL ); } ulLastRegTest2Value = ulRegTest2LoopCounter; /* Toggle the check LED to give an indication of the system status. If the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then everything is ok. A faster toggle indicates an error. */ vParTestToggleLED( mainCHECK_LED ); /* Have any errors been latched in ulErrorFound? If so, shorten the period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. This will result in an increase in the rate at which mainCHECK_LED toggles. */ if( ulErrorFound != pdFALSE ) { if( lChangedTimerPeriodAlready == pdFALSE ) { lChangedTimerPeriodAlready = pdTRUE; /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block. */ xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } } }
/*! * \brief Checks that all the demo application tasks are still executing without error. */ static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void ) { static portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreComTestTasksStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #if (BOARD != UC3L_EK) if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #endif #if (BOARD != UC3L_EK) if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #endif #if (BOARD != EVK1101) && (BOARD != UC3L_EK) if( xAreBlockingQueuesStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #endif #if (BOARD != UC3L_EK) if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #endif #if (BOARD != EVK1101) && (BOARD != UC3L_EK) if( xAreMathsTaskStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } #endif if( xIsCreateTaskStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } return ( xErrorHasOccurred ); }
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount ) { long lReturn = ( long ) pdPASS; /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none of them have detected an error. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreComTestTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xArePollingQueuesStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreMathsTaskStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) { /* The vMemCheckTask did not increment the counter - it must have failed. */ lReturn = ( long ) pdFAIL; } return lReturn; }
void vApplicationTickHook( void ) { unsigned portBASE_TYPE uxColumn = 0; static xLCDMessage xMessage = { 0, "PASS" }; static unsigned long ulTicksSinceLastDisplay = 0; static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* Called from every tick interrupt. Have enough ticks passed to make it time to perform our health status check again? */ ulTicksSinceLastDisplay++; if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) { ulTicksSinceLastDisplay = 0; /* Has an error been found in any task? */ if( xAreBlockingQueuesStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR - BLOCKQ"; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR - BLOCKTIM"; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR - GENQ"; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR - PEEKQ"; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR - DYNAMIC"; } xMessage.xColumn++; /* Send the message to the LCD gatekeeper for display. */ xHigherPriorityTaskWoken = pdFALSE; xQueueSendToBackFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); } }
static void prvCheckOtherTasksAreStillRunning( void ) { if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { ulErrorFlags |= 0x01; } if( xArePollingQueuesStillRunning() != pdTRUE ) { ulErrorFlags |= 0x02; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFlags |= 0x04; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorFlags |= 0x08; } if( xAreComTestTasksStillRunning() != pdTRUE ) { ulErrorFlags |= 0x10; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorFlags |= 0x20; } if( xAreMathsTaskStillRunning() != pdTRUE ) { ulErrorFlags |= 0x40; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorFlags |= 0x80; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { ulErrorFlags |= 0x100; } }
/* * Check each set of tasks in turn to see if they have experienced any * error conditions. */ static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount ) { long lNoErrorsDiscovered = ( long ) pdTRUE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xAreComTestTasksStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xAreMathsTaskStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lNoErrorsDiscovered = pdFALSE; } if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) { /* The vMemCheckTask task did not increment the counter - it must have failed. */ lNoErrorsDiscovered = pdFALSE; } return lNoErrorsDiscovered; }
static char prvCheckOtherTasksAreStillRunning( void ) { char cErrorHasOccurred = ( char ) pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { cErrorHasOccurred = ( char ) pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { cErrorHasOccurred = ( char ) pdTRUE; } return cErrorHasOccurred; }
static void prvCheckTask( void *pvParameters ) { ( void ) pvParameters; /* Check all the demo tasks to ensure that they are all still running, and that none of them have detected an error. */ for( ;; ) { /* Block until it is time to check again. */ vTaskDelay( mainCHECK_DELAY ); if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { usCheckStatus |= 0x01; } if( xArePollingQueuesStillRunning() != pdTRUE ) { usCheckStatus |= 0x02; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { usCheckStatus |= 0x04; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { usCheckStatus |= 0x08; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { usCheckStatus |= 0x10; } if( xIsCreateTaskStillRunning() != pdTRUE ) { usCheckStatus |= 0x20; } if( xAreComTestTasksStillRunning() != pdTRUE ) { usCheckStatus |= 0x40; } } }
static portLONG prvCheckOtherTasksAreStillRunning( void ) { portLONG lReturn = pdPASS; /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none of them have detected an error. */ if( xAreIntegerMathsTaskStillRunning() != pdPASS ) { lReturn = pdFAIL; } if( xAreComTestTasksStillRunning() != pdPASS ) { lReturn = pdFAIL; } #ifdef KEIL_THUMB_INTERWORK /* When using THUMB mode we can start more tasks without the executable exceeding the size limit imposed by the evaluation version of uVision3. */ if( xArePollingQueuesStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } #endif return lReturn; }
static portLONG prvCheckOtherTasksAreStillRunning( void ) { portLONG lReturn = ( portLONG ) pdPASS; /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none of them have detected an error. */ if( xArePollingQueuesStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xAreMathsTaskStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } if( xIsCreateTaskStillRunning() != pdTRUE ) { lReturn = ( portLONG ) pdFAIL; } return lReturn; }
void vApplicationTickHook( void ) { static unsigned long ulCounter = 0; static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS; long lHigherPriorityTaskWoken = pdFALSE; /* Define the status message that is sent to the LCD task. By default the status is PASS. */ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; /* This is called from within the tick interrupt and performs the 'check' functionality as described in the comments at the top of this file. Is it time to perform the 'check' functionality again? */ ulCounter++; if( ulCounter >= ulCheckFrequency ) { /* See if the standard demo tasks are executing as expected, changing the message that is sent to the LCD task from PASS to an error code if any tasks set reports an error. */ if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS; } if( xAreComTestTasksStillRunning() != pdPASS ) { xStatusMessage.lMessageValue = mainERROR_COM_TEST; } if( xAreGenericQueueTasksStillRunning() != pdPASS ) { xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST; } /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not needed (a context switch is going to be performed anyway), but it must still be provided. */ xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken ); ulCounter = 0; } }
static long prvCheckOtherTasksAreStillRunning( void ) { portBASE_TYPE xAllTasksPassed = pdPASS; if( xArePollingQueuesStillRunning() != pdTRUE ) { xAllTasksPassed = pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { xAllTasksPassed = pdFAIL; } if( xAreComTestTasksStillRunning() != pdTRUE ) { xAllTasksPassed = pdFALSE; } if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { xAllTasksPassed = pdFALSE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { xAllTasksPassed = pdFALSE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { xAllTasksPassed = pdFALSE; } /* Also check the status flag for the tasks defined within this function. */ if( xLocalError != pdFALSE ) { xAllTasksPassed = pdFAIL; } return xAllTasksPassed; }
static void prvCheckTimerCallback( TimerHandle_t xTimer ) { static long lChangedTimerPeriodAlready = pdFALSE; unsigned long ulErrorFound = pdFALSE; /* Check all the demo tasks (other than the flash tasks) to ensure they are all still running, and that none have detected an error. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } /* Toggle the check LED to give an indication of the system status. If the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then everything is ok. A faster toggle indicates an error. */ vParTestToggleLED( mainCHECK_LED ); /* Have any errors been latch in ulErrorFound? If so, shorten the period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. This will result in an increase in the rate at which mainCHECK_LED toggles. */ if( ulErrorFound != pdFALSE ) { if( lChangedTimerPeriodAlready == pdFALSE ) { lChangedTimerPeriodAlready = pdTRUE; /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block. */ xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } } }
static void prvCheckTask( void *pvParameters ) { TickType_t xNextWakeTime; const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS; /* Just to remove compiler warning. */ ( void ) pvParameters; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); for( ;; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); /* Check the standard demo tasks are running without error. */ #if( configUSE_PREEMPTION != 0 ) { /* These tasks are only created when preemption is used. */ if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) { pcStatusMessage = "Error: TimerDemo"; } } #endif if( xAreEventGroupTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: EventGroup"; } else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { pcStatusMessage = "Error: IntMath"; } else if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: GenQueue"; } else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: QueuePeek"; } else if( xAreBlockingQueuesStillRunning() != pdTRUE ) { pcStatusMessage = "Error: BlockQueue"; } else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: SemTest"; } else if( xArePollingQueuesStillRunning() != pdTRUE ) { pcStatusMessage = "Error: PollQueue"; } else if( xAreMathsTaskStillRunning() != pdPASS ) { pcStatusMessage = "Error: Flop"; } else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: RecMutex"; } else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: CountSem"; } else if( xIsCreateTaskStillRunning() != pdTRUE ) { pcStatusMessage = "Error: Death"; } else if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { pcStatusMessage = "Error: Dynamic"; } else if( xAreQueueSetTasksStillRunning() != pdPASS ) { pcStatusMessage = "Error: Queue set"; } else if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) { pcStatusMessage = "Error: Queue overwrite"; } /* This is the only task that uses stdout so its ok to call printf() directly. */ printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() ); } }
static void vCheckTask( void *pvParameters ) { static unsigned long ulErrorDetected = pdFALSE; portTickType xLastExecutionTime; unsigned char *ucErrorMessage = ( unsigned char * )" FAIL"; unsigned char *ucSuccessMessage = ( unsigned char * )" PASS"; unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN; LCDMessage xMessage; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() works correctly. */ xLastExecutionTime = xTaskGetTickCount(); for( ;; ) { /* Wait until it is time for the next cycle. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME ); /* Has an error been found in any of the standard demo tasks? */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { ulErrorDetected = pdTRUE; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorDetected = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorDetected = pdTRUE; } if( xAreComTestTasksStillRunning() != pdTRUE ) { ulErrorDetected = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorDetected = pdTRUE; } /* Calculate the LCD line on which we would like the message to be displayed. The column variable is used for convenience as it is incremented each cycle anyway. */ xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 ); /* The message displayed depends on whether an error was found or not. Any discovered error is latched. Here the column variable is used as an index into the text string as a simple way of moving the text from column to column. */ if( ulErrorDetected == pdFALSE ) { xMessage.pucString = ucSuccessMessage + uxColumn; } else { xMessage.pucString = ucErrorMessage + uxColumn; } /* Send the message to the print task for display. */ xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY ); /* Make sure the message is printed in a different column the next time around. */ uxColumn--; if( uxColumn == 0 ) { uxColumn = mainMAX_WRITE_COLUMN; } } }
static short prvCheckOtherTasksAreStillRunning( void ) { portBASE_TYPE lReturn = pdPASS; /* The demo tasks maintain a count that increments every cycle of the task provided that the task has never encountered an error. This function checks the counts maintained by the tasks to ensure they are still being incremented. A count remaining at the same value between calls therefore indicates that an error has been detected. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreComTestTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreMathsTaskStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xIsCreateTaskStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } if ( xAreQueuePeekTasksStillRunning() != pdTRUE ) { lReturn = pdFAIL; } /* Have the register test tasks found any errors? */ if( ulRegTestError != pdFALSE ) { lReturn = pdFAIL; } return lReturn; }
static void vCheckTask( void *pvParameters ) { portBASE_TYPE xErrorOccurred = pdFALSE; TickType_t xLastExecutionTime; const char * const pcPassMessage = "PASS\n"; const char * const pcFailMessage = "FAIL\n"; /* Just to remove compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() works correctly. */ xLastExecutionTime = xTaskGetTickCount(); for( ;; ) { /* Perform this check every mainCHECK_DELAY milliseconds. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); /* Has an error been found in any task? */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } #if configUSE_PREEMPTION == 1 { /* The timing of console output when not using the preemptive scheduler causes the block time tests to detect a timing problem. */ if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } } #endif if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { xErrorOccurred = pdTRUE; } /* Send either a pass or fail message. If an error is found it is never cleared again. */ if( xErrorOccurred == pdTRUE ) { xLED_Delay = mainERROR_LED_DELAY; xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); } else { xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); } } }
static void prvCheckTimerCallback( xTimerHandle xTimer ) { static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS; /* Inspect the status of the standard demo tasks. */ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { xErrorStatus = pdFAIL; } if( xArePollingQueuesStillRunning() != pdTRUE ) { xErrorStatus = pdFAIL; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { xErrorStatus = pdFAIL; } /* Inspect the status of the reg test tasks. */ if( sRegTestStatus != pdPASS ) { xErrorStatus = pdFAIL; } /* Ensure that the demo software timer has expired mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between each call of this function. A critical section is not required to access ulDemoSoftwareTimerCounter as the variable is only accessed from another software timer callback, and only one software timer callback can be executing at any time. */ if( ( ulDemoSoftwareTimerCounter < ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT - 1 ) ) || ( ulDemoSoftwareTimerCounter > ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT + 1 ) ) ) { xErrorStatus = pdFAIL; } else { ulDemoSoftwareTimerCounter = 0UL; } if( ( xErrorStatus == pdFAIL ) && ( xChangedTimerPeriodAlready == pdFALSE ) ) { /* An error has occurred, but the timer's period has not yet been changed, change it now, and remember that it has been changed. Shortening the timer's period means the LED will toggle at a faster rate, giving a visible indication that something has gone wrong. */ xChangedTimerPeriodAlready = pdTRUE; /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block. */ xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } /* Toggle the LED. The toggle rate will depend on whether or not an error has been found in any tasks. */ mainLED_0 = !mainLED_0; }
static void prvCheckTimerCallback( xTimerHandle xTimer ) { static long lChangeToRedLEDsAlready = pdFALSE; static unsigned long ulLastRegTest1Counter = 0, ulLastRegTest2Counter = 0; unsigned long ulErrorFound = pdFALSE; /* LEDs are defaulted to use the Green LEDs. The Red LEDs are used if an error is found. */ static unsigned long ulLED1 = 8, ulLED2 = 11; const unsigned long ulRedLED1 = 6, ulRedLED2 = 9; /* Check all the demo tasks (other than the flash tasks) to ensure they are all still running, and that none have detected an error. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreMathsTaskStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } if( xAreComTestTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } /* Check the reg test tasks are still cycling. They will stop incrementing their loop counters if they encounter an error. */ if( ulRegTest1Counter == ulLastRegTest1Counter ) { ulErrorFound = pdTRUE; } if( ulRegTest2Counter == ulLastRegTest2Counter ) { ulErrorFound = pdTRUE; } ulLastRegTest1Counter = ulRegTest1Counter; ulLastRegTest2Counter = ulRegTest2Counter; /* Toggle the check LEDs to give an indication of the system status. If the green LEDs are toggling, then no errors have been detected. If the red LEDs are toggling, then an error has been reported in at least one task. */ vParTestToggleLED( ulLED1 ); vParTestToggleLED( ulLED2 ); /* Have any errors been latch in ulErrorFound? If so, ensure the gree LEDs are off, then switch to using the red LEDs. */ if( ulErrorFound != pdFALSE ) { if( lChangeToRedLEDsAlready == pdFALSE ) { lChangeToRedLEDsAlready = pdTRUE; /* An error has been found. Switch to use the red LEDs. */ vParTestSetLED( ulLED1, pdFALSE ); vParTestSetLED( ulLED2, pdFALSE ); ulLED1 = ulRedLED1; ulLED2 = ulRedLED2; } } }
void vApplicationTickHook( void ) { static unsigned long ulCallCount = 0, ulErrorFound = pdFALSE; /* The rate at which LED D4 will toggle if an error has been found in one or more of the standard demo tasks. */ const unsigned long ulErrorFlashRate = 500 / portTICK_RATE_MS; /* The rate at which LED D4 will toggle if no errors have been found in any of the standard demo tasks. */ const unsigned long ulNoErrorCheckRate = 5000 / portTICK_RATE_MS; ulCallCount++; if( ulErrorFound != pdFALSE ) { /* We have already found an error, so flash the LED with the appropriate frequency. */ if( ulCallCount > ulErrorFlashRate ) { ulCallCount = 0; vParTestToggleLED( mainERROR_LED ); } } else { if( ulCallCount > ulNoErrorCheckRate ) { ulCallCount = 0; /* We have not yet found an error. Check all the demo tasks to ensure this is still the case. */ if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorFound |= 0x01; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorFound |= 0x02; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorFound |= 0x04; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorFound |= 0x08; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { ulErrorFound |= 0x10; } vParTestToggleLED( mainERROR_LED ); } } }
static void prvCheckTimerCallback( TimerHandle_t xTimer ) { /* Check the standard demo tasks are running without error. Latch the latest reported error in the pcStatusMessage character pointer. */ if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: GenQueue"; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: QueuePeek\r\n"; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { pcStatusMessage = "Error: BlockQueue\r\n"; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: BlockTime\r\n"; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: SemTest\r\n"; } if( xIsCreateTaskStillRunning() != pdTRUE ) { pcStatusMessage = "Error: Death\r\n"; } if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: RecMutex\r\n"; } if( xAreComTestTasksStillRunning() != pdPASS ) { pcStatusMessage = "Error: ComTest\r\n"; } if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE ) { pcStatusMessage = "Error: TimerDemo"; } if( xArePollingQueuesStillRunning() != pdTRUE ) { pcStatusMessage = "Error: PollQueue"; } if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: CountSem"; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: DynamicPriority"; } /* Toggle the check LED to give an indication of the system status. If the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then everything is ok. A faster toggle indicates an error. */ vParTestToggleLED( mainCHECK_LED ); /* Have any errors been latch in pcStatusMessage? If so, shorten the period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. This will result in an increase in the rate at which mainCHECK_LED toggles. */ if( pcStatusMessage != NULL ) { /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block. */ xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } }
void vApplicationTickHook( void ) { static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; static unsigned long ulCounter = 0; static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* Define the status message that is sent to the LCD task. By default the status is PASS. */ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; /* This is called from within the tick interrupt and performs the 'check' functionality as described in the comments at the top of this file. Is it time to perform the 'check' functionality again? */ ulCounter++; if( ulCounter >= ulCheckFrequency ) { /* See if the standard demo tasks are executing as expected, changing the message that is sent to the LCD task from PASS to an error code if any tasks set reports an error. */ if( xAreComTestTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_COM_TEST; } if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; } if( xAreGenericQueueTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; } /* Check the reg test tasks are still cycling. They will stop incrementing their loop counters if they encounter an error. */ if( usRegTest1Counter == usLastRegTest1Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } if( usRegTest2Counter == usLastRegTest2Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } usLastRegTest1Counter = usRegTest1Counter; usLastRegTest2Counter = usRegTest2Counter; /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not needed (a context switch is going to be performed anyway), but it must still be provided. */ xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken ); ulCounter = 0; } /* Just periodically toggle an LED to show that the tick interrupt is running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks that access the same port must do so from a critical section. */ if( ( ulCounter & 0xff ) == 0 ) { if( ( LED_PORT_OUT & LED_1 ) == 0 ) { LED_PORT_OUT |= LED_1; } else { LED_PORT_OUT &= ~LED_1; } } }
static void prvCheckTimerCallback( TimerHandle_t xTimer ) { static long lChangedTimerPeriodAlready = pdFALSE; static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; unsigned long ulErrorOccurred = pdFALSE; /* Avoid compiler warnings. */ ( void ) xTimer; /* Have any of the standard demo tasks detected an error in their operation? */ if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 3UL ); } else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 4UL ); } else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 5UL ); } else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 6UL ); } else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 8UL ); } else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 9UL ); } else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 10UL ); } else if( xAreQueueSetTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 11UL ); } else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 12UL ); } else if( xAreEventGroupTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 13UL ); } else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 14UL ); } else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= ( 0x01UL << 15UL ); } else if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE ) { ulErrorOccurred |= 1UL << 16UL; } else if( xAreIntQueueTasksStillRunning() != pdTRUE ) { ulErrorOccurred |= 1UL << 17UL; } /* Check that the register test 1 task is still running. */ if( ulLastRegTest1Value == ulRegTest1LoopCounter ) { ulErrorOccurred |= 1UL << 18UL; } ulLastRegTest1Value = ulRegTest1LoopCounter; /* Check that the register test 2 task is still running. */ if( ulLastRegTest2Value == ulRegTest2LoopCounter ) { ulErrorOccurred |= 1UL << 19UL; } ulLastRegTest2Value = ulRegTest2LoopCounter; if( ulErrorOccurred != pdFALSE ) { /* An error occurred. Increase the frequency at which the check timer toggles its LED to give visual feedback of the potential error condition. */ if( lChangedTimerPeriodAlready == pdFALSE ) { lChangedTimerPeriodAlready = pdTRUE; /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block as to do so could impact other software timers. */ xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } } /* Toggle the LED to give visual feedback of the system status. The rate at which the LED toggles will increase to mainERROR_CHECK_TIMER_PERIOD_MS if a suspected error has been found in any of the standard demo tasks. */ vParTestToggleLED( mainCHECK_LED ); }
static void prvCheckTask( void *pvParameters ) { TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD; TickType_t xLastExecutionTime; static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; unsigned long ulErrorFound = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() works correctly. */ xLastExecutionTime = xTaskGetTickCount(); /* Cycle for ever, delaying then checking all the other tasks are still operating without error. The onboard LED is toggled on each iteration. If an error is detected then the delay period is decreased from mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the effect of increasing the rate at which the onboard LED toggles, and in so doing gives visual feedback of the system status. */ for( ;; ) { /* Delay until it is time to execute again. */ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod ); /* Check all the demo tasks (other than the flash tasks) to ensure that they are all still running, and that none have detected an error. */ if( xAreIntQueueTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 0UL; } if( xAreMathsTaskStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 1UL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 2UL; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 3UL; } if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 4UL; } if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 5UL; } if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 6UL; } if( xIsCreateTaskStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 7UL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 8UL; } if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS ) { ulErrorFound = 1UL << 9UL; } if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound = 1UL << 10UL; } if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) { ulErrorFound = 1UL << 11UL; } if( xAreEventGroupTasksStillRunning() != pdPASS ) { ulErrorFound = 1UL << 12UL; } if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS ) { ulErrorFound = 1UL << 13UL; } if( xAreQueueSetTasksStillRunning() != pdPASS ) { ulErrorFound = 1UL << 14UL; } if( xAreTaskNotificationTasksStillRunning() != pdPASS ) { ulErrorFound = 1UL << 15UL; } /* Check that the register test 1 task is still running. */ if( ulLastRegTest1Value == ulRegTest1LoopCounter ) { ulErrorFound = 1UL << 16UL; } ulLastRegTest1Value = ulRegTest1LoopCounter; /* Check that the register test 2 task is still running. */ if( ulLastRegTest2Value == ulRegTest2LoopCounter ) { ulErrorFound = 1UL << 17UL; } ulLastRegTest2Value = ulRegTest2LoopCounter; /* Toggle the check LED to give an indication of the system status. If the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then everything is ok. A faster toggle indicates an error. */ mainTOGGLE_LED(); if( ulErrorFound != pdFALSE ) { /* An error has been detected in one of the tasks - flash the LED at a higher frequency to give visible feedback that something has gone wrong. */ xDelayPeriod = mainERROR_CHECK_TASK_PERIOD; } } }
static void prvCheckOtherTasksAreStillRunning( void ) { static short sErrorHasOccurred = pdFALSE; static unsigned long long uxLastHookCallCount = 0, uxLastQueueSendCount = 0; if( prvCheckMathTasksAreStillRunning() != pdTRUE ) { vDisplayMessage( "Maths task count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreComTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Com test count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Blocking queues count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltBlockingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Alt blocking queues count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Polling queue count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltPollingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Alt polling queue count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { vDisplayMessage( "Incorrect number of tasks running!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Semaphore take count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Dynamic priority count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreMultiEventTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in multi events tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreFlashCoRoutinesStillRunning() != pdTRUE ) { vDisplayMessage( "Error in co-routine flash tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreHookCoRoutinesStillRunning() != pdTRUE ) { vDisplayMessage( "Error in tick hook to co-routine communications!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in block time test tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltBlockTimeTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in fast block time test tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in generic queue test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltGenericQueueTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in fast generic queue test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in queue peek test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in counting semaphore demo task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in recursive mutex tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } /* The hook function associated with this task is called each time the task is switched in. We therefore expect the number of times the callback function has been executed to have increrment since the last time this function executed. */ if( uxCheckTaskHookCallCount <= uxLastHookCallCount ) { vDisplayMessage( "Error in task hook call count!\r\n" ); sErrorHasOccurred = pdTRUE; } else { uxLastHookCallCount = uxCheckTaskHookCallCount; } /* We would expect some queue sending to occur between calls of this function. */ if( uxQueueSendPassedCount <= uxLastQueueSendCount ) { vDisplayMessage( "Error in queue send hook call count!\r\n" ); sErrorHasOccurred = pdTRUE; } else { uxLastQueueSendCount = uxQueueSendPassedCount; } if( sErrorHasOccurred == pdFALSE ) { vDisplayMessage( "OK " ); } }
static short prvCheckOtherTasksAreStillRunning( void ) { static short sNoErrorFound = pdTRUE; /* The demo tasks maintain a count that increments every cycle of the task provided that the task has never encountered an error. This function checks the counts maintained by the tasks to ensure they are still being incremented. A count remaining at the same value between calls therefore indicates that an error has been detected. Only tasks that do not flash an LED are checked. */ if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreFlashCoRoutinesStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } #if INCLUDE_TraceListTasks == 0 { if( xAreComTestTasksStillRunning() != pdTRUE ) { sNoErrorFound = pdFALSE; } } #endif return sNoErrorFound; }
static void prvCheckOtherTasksAreStillRunning( void ) { static portSHORT sErrorHasOccurred = pdFALSE; if( prvCheckMathTasksAreStillRunning() != pdTRUE ) { vDisplayMessage( "Maths task count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreComTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Com test count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreBlockingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Blocking queues count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltBlockingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Alt blocking queues count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Polling queue count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltPollingQueuesStillRunning() != pdTRUE ) { vDisplayMessage( "Alt polling queue count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xIsCreateTaskStillRunning() != pdTRUE ) { vDisplayMessage( "Incorrect number of tasks running!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Semaphore take count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Dynamic priority count unchanged!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreMultiEventTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in multi events tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreFlashCoRoutinesStillRunning() != pdTRUE ) { vDisplayMessage( "Error in co-routine flash tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreHookCoRoutinesStillRunning() != pdTRUE ) { vDisplayMessage( "Error in tick hook to co-routine communications!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in block time test tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltBlockTimeTestTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in fast block time test tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in generic queue test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreAltGenericQueueTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in fast generic queue test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in queue peek test task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in counting semaphore demo task!\r\n" ); sErrorHasOccurred = pdTRUE; } if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { vDisplayMessage( "Error in recursive mutex tasks!\r\n" ); sErrorHasOccurred = pdTRUE; } if( sErrorHasOccurred == pdFALSE ) { vDisplayMessage( "OK " ); } }