Update some tests to report error line numbers (#747)

* To assist debugging, update a subset of demos to store the line number on which an error is detected rather than just storing a boolean as to whether an error detected or not.

* Correct return value of xAreInterruptSemaphoreTasksStillRunning() made incorrect by the prior commit.

* Uncrustify: triggered by comment.


---------

Co-authored-by: none <>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Rahul Kar <karahulx@amazon.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
RichardBarry 2024-02-18 22:37:43 -08:00 committed by GitHub
parent 259e8de761
commit 8e8dad2b09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 147 additions and 140 deletions

View file

@ -177,7 +177,7 @@
if( xTaskAbortDelay( xBlockingTask ) != pdPASS ) if( xTaskAbortDelay( xBlockingTask ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Reset the priority to the normal controlling priority. */ /* Reset the priority to the normal controlling priority. */
@ -288,7 +288,7 @@
if( xReturned != pdFALSE ) if( xReturned != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -379,7 +379,7 @@
if( ulReturn != 0 ) if( ulReturn != 0 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -393,7 +393,7 @@
if( ulReturn != 0 ) if( ulReturn != 0 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -406,7 +406,7 @@
if( ulReturn != 0 ) if( ulReturn != 0 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -442,7 +442,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -456,7 +456,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -469,7 +469,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -517,7 +517,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -531,7 +531,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -544,7 +544,7 @@
if( xReturn != 0x00 ) if( xReturn != 0x00 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -584,7 +584,7 @@
if( xReturn != pdPASS ) if( xReturn != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Note the time before the delay so the length of the delay is known. */ /* Note the time before the delay so the length of the delay is known. */
@ -595,7 +595,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -609,7 +609,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -622,7 +622,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -660,7 +660,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -674,7 +674,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -687,7 +687,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -710,7 +710,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -724,7 +724,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -737,7 +737,7 @@
if( xReturn != pdFALSE ) if( xReturn != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -755,7 +755,7 @@
/* The actual block time should not be less than the expected block time. */ /* The actual block time should not be less than the expected block time. */
if( xActualBlockTime < xExpectedBlockTime ) if( xActualBlockTime < xExpectedBlockTime )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* The actual block time can be greater than the expected block time, as it /* The actual block time can be greater than the expected block time, as it
@ -763,7 +763,7 @@
* acceptable margin. */ * acceptable margin. */
if( xActualBlockTime > ( xExpectedBlockTime + xAllowableMargin ) ) if( xActualBlockTime > ( xExpectedBlockTime + xAllowableMargin ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -785,7 +785,7 @@
xReturn = pdFAIL; xReturn = pdFAIL;
} }
if( xErrorOccurred == pdTRUE ) if( xErrorOccurred != pdFALSE )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }

View file

@ -184,13 +184,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Take the semaphore that is shared with the slave. */ /* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS ) if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* This task now has the mutex. Unsuspend the slave so it too /* This task now has the mutex. Unsuspend the slave so it too
@ -209,7 +209,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
* task. */ * task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Now wait a little longer than the time between ISR gives to also /* Now wait a little longer than the time between ISR gives to also
@ -218,7 +218,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS ) if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
xOkToGiveMutex = pdFALSE; xOkToGiveMutex = pdFALSE;
@ -227,13 +227,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
* already held. */ * already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL ) if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Should still be at the priority of the slave task. */ /* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Give back the ISR semaphore to ensure the priority is not /* Give back the ISR semaphore to ensure the priority is not
@ -241,12 +241,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* attempting to obtain) is still held. */ * attempting to obtain) is still held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS ) if( xSemaphoreGive( xISRMutex ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Finally give back the shared mutex. This time the higher priority /* Finally give back the shared mutex. This time the higher priority
@ -255,12 +255,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* suspended state again. */ * suspended state again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS ) if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
#if ( INCLUDE_eTaskGetState == 1 ) #if ( INCLUDE_eTaskGetState == 1 )
@ -286,13 +286,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Take the semaphore that is shared with the slave. */ /* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS ) if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* This task now has the mutex. Unsuspend the slave so it too /* This task now has the mutex. Unsuspend the slave so it too
@ -311,7 +311,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* task. */ * task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Now wait a little longer than the time between ISR gives to also /* Now wait a little longer than the time between ISR gives to also
@ -320,7 +320,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS ) if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
xOkToGiveMutex = pdFALSE; xOkToGiveMutex = pdFALSE;
@ -329,13 +329,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* already held. */ * already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL ) if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Should still be at the priority of the slave task. */ /* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Give back the shared semaphore to ensure the priority is not disinherited /* Give back the shared semaphore to ensure the priority is not disinherited
@ -343,7 +343,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* before this task runs again. */ * before this task runs again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS ) if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Should still be at the priority of the slave task as this task still /* Should still be at the priority of the slave task as this task still
@ -351,19 +351,19 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* mechanism. */ * mechanism. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Give back the ISR semaphore, which should result in the priority being /* Give back the ISR semaphore, which should result in the priority being
* disinherited as it was the last mutex held. */ * disinherited as it was the last mutex held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS ) if( xSemaphoreGive( xISRMutex ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY ) if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Reset the mutex ready for the next round. */ /* Reset the mutex ready for the next round. */
@ -387,12 +387,12 @@ static void vInterruptMutexSlaveTask( void * pvParameters )
* state. */ * state. */
if( xSemaphoreTake( xMasterSlaveMutex, portMAX_DELAY ) != pdPASS ) if( xSemaphoreTake( xMasterSlaveMutex, portMAX_DELAY ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS ) if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
} }
} }
@ -410,7 +410,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Expect to start with the counting semaphore empty. */ /* Expect to start with the counting semaphore empty. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 ) if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Wait until it is expected that the interrupt will have filled the /* Wait until it is expected that the interrupt will have filled the
@ -422,12 +422,12 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Now it is expected that the counting semaphore is full. */ /* Now it is expected that the counting semaphore is full. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != intsemMAX_COUNT ) if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != intsemMAX_COUNT )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
if( uxQueueSpacesAvailable( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 ) if( uxQueueSpacesAvailable( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
ulCountingSemaphoreLoops++; ulCountingSemaphoreLoops++;
@ -444,7 +444,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
if( xCount != intsemMAX_COUNT ) if( xCount != intsemMAX_COUNT )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
/* Now raise the priority of this task so it runs immediately that the /* Now raise the priority of this task so it runs immediately that the
@ -457,7 +457,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
xSemaphoreTake( xISRCountingSemaphore, portMAX_DELAY ); xSemaphoreTake( xISRCountingSemaphore, portMAX_DELAY );
xOkToGiveCountingSemaphore = pdFALSE; xOkToGiveCountingSemaphore = pdFALSE;
/* Reset the priority so as not to disturbed other tests too much. */ /* Reset the priority so as not to disturb other tests too much. */
vTaskPrioritySet( NULL, tskIDLE_PRIORITY ); vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
ulCountingSemaphoreLoops++; ulCountingSemaphoreLoops++;
@ -506,25 +506,32 @@ void vInterruptSemaphorePeriodicTest( void )
BaseType_t xAreInterruptSemaphoreTasksStillRunning( void ) BaseType_t xAreInterruptSemaphoreTasksStillRunning( void )
{ {
static uint32_t ulLastMasterLoopCounter = 0, ulLastCountingSemaphoreLoops = 0; static uint32_t ulLastMasterLoopCounter = 0, ulLastCountingSemaphoreLoops = 0;
BaseType_t xReturn;
/* If the demo tasks are running then it is expected that the loop counters /* If the demo tasks are running then it is expected that the loop counters
* will have changed since this function was last called. */ * will have changed since this function was last called. */
if( ulLastMasterLoopCounter == ulMasterLoops ) if( ulLastMasterLoopCounter == ulMasterLoops )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
ulLastMasterLoopCounter = ulMasterLoops; ulLastMasterLoopCounter = ulMasterLoops;
if( ulLastCountingSemaphoreLoops == ulCountingSemaphoreLoops ) if( ulLastCountingSemaphoreLoops == ulCountingSemaphoreLoops )
{ {
xErrorDetected = pdTRUE; xErrorDetected = __LINE__;
} }
ulLastCountingSemaphoreLoops = ulCountingSemaphoreLoops++; ulLastCountingSemaphoreLoops = ulCountingSemaphoreLoops++;
/* Errors detected in the task itself will have latched xErrorDetected if( xErrorDetected != pdFALSE )
* to true. */ {
xReturn = pdFALSE;
}
else
{
xReturn = pdTRUE;
}
return ( BaseType_t ) !xErrorDetected; return xReturn;
} }

View file

@ -362,7 +362,7 @@
* items it is possible for the queue to hold at any one time, which equals the * items it is possible for the queue to hold at any one time, which equals the
* queue length (in items, not bytes) multiplied by the size of each item. In this * queue length (in items, not bytes) multiplied by the size of each item. In this
* case the queue will hold staticQUEUE_LENGTH_IN_ITEMS 64-bit items. See * case the queue will hold staticQUEUE_LENGTH_IN_ITEMS 64-bit items. See
* https://www.FreeRTOS.org/Embedded-RTOS-Queues.html */ * http://www.freertos.org/Embedded-RTOS-Queues.html */
static uint8_t ucQueueStorageArea[ staticQUEUE_LENGTH_IN_ITEMS * sizeof( uint64_t ) ]; static uint8_t ucQueueStorageArea[ staticQUEUE_LENGTH_IN_ITEMS * sizeof( uint64_t ) ];
/* Create the queue. xQueueCreateStatic() has two more parameters than the /* Create the queue. xQueueCreateStatic() has two more parameters than the
@ -440,7 +440,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */ /* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
@ -466,7 +466,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */ /* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
@ -535,7 +535,7 @@
* function expects it to be unavailable. */ * function expects it to be unavailable. */
if( xSemaphoreTake( xSemaphore, staticDONT_BLOCK ) == pdFAIL ) if( xSemaphoreTake( xSemaphore, staticDONT_BLOCK ) == pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
prvSanityCheckCreatedSemaphore( xSemaphore, staticBINARY_SEMAPHORE_MAX_COUNT ); prvSanityCheckCreatedSemaphore( xSemaphore, staticBINARY_SEMAPHORE_MAX_COUNT );
@ -563,12 +563,12 @@
if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS ) if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS )
{ {
/* This is called from a timer callback so must not block. See /* This is called from a timer callback so must not block. See
* https://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */ * http://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK ); xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK );
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
} }
@ -615,7 +615,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS ); vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
@ -624,7 +624,7 @@
* times, and then stopped itself. */ * times, and then stopped itself. */
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS ) if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Finished with the timer, delete it. */ /* Finished with the timer, delete it. */
@ -634,7 +634,7 @@
* command will have been sent even without a block time being used. */ * command will have been sent even without a block time being used. */
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Just to show the check task that this task is still executing. */ /* Just to show the check task that this task is still executing. */
@ -658,21 +658,21 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS ); vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS ) if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xReturned = xTimerDelete( xTimer, staticDONT_BLOCK ); xReturned = xTimerDelete( xTimer, staticDONT_BLOCK );
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
#endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */ #endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
@ -757,13 +757,13 @@
/* Check the task was created correctly, then delete the task. */ /* Check the task was created correctly, then delete the task. */
if( xCreatedTask == NULL ) if( xCreatedTask == NULL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else if( eTaskGetState( xCreatedTask ) != eSuspended ) else if( eTaskGetState( xCreatedTask ) != eSuspended )
{ {
/* The created task had a higher priority so should have executed and /* The created task had a higher priority so should have executed and
* suspended itself by now. */ * suspended itself by now. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
@ -787,14 +787,14 @@
if( eTaskGetState( xCreatedTask ) != eSuspended ) if( eTaskGetState( xCreatedTask ) != eSuspended )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
configASSERT( xReturned == pdPASS ); configASSERT( xReturned == pdPASS );
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
vTaskDelete( xCreatedTask ); vTaskDelete( xCreatedTask );
@ -856,7 +856,7 @@
if( xEventBits != ( EventBits_t ) 0 ) if( xEventBits != ( EventBits_t ) 0 )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Some some bits, then read them back to check they are as expected. */ /* Some some bits, then read them back to check they are as expected. */
@ -866,7 +866,7 @@
if( xEventBits != xFirstTestBits ) if( xEventBits != xFirstTestBits )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xEventGroupSetBits( xEventGroup, xSecondTestBits ); xEventGroupSetBits( xEventGroup, xSecondTestBits );
@ -875,7 +875,7 @@
if( xEventBits != ( xFirstTestBits | xSecondTestBits ) ) if( xEventBits != ( xFirstTestBits | xSecondTestBits ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Finally try clearing some bits too and check that operation proceeds as /* Finally try clearing some bits too and check that operation proceeds as
@ -886,7 +886,7 @@
if( xEventBits != xSecondTestBits ) if( xEventBits != xSecondTestBits )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -907,12 +907,12 @@
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime ) if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
{ {
/* Did not block on the semaphore as long as expected. */ /* Did not block on the semaphore as long as expected. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xReturned != pdFAIL ) if( xReturned != pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Should be possible to 'give' the semaphore up to a maximum of uxMaxCount /* Should be possible to 'give' the semaphore up to a maximum of uxMaxCount
@ -923,7 +923,7 @@
if( xReturned == pdFAIL ) if( xReturned == pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -932,7 +932,7 @@
if( xReturned != pdFAIL ) if( xReturned != pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
configASSERT( uxSemaphoreGetCount( xSemaphore ) == uxMaxCount ); configASSERT( uxSemaphoreGetCount( xSemaphore ) == uxMaxCount );
@ -945,7 +945,7 @@
if( xReturned == pdFAIL ) if( xReturned == pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -957,12 +957,12 @@
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime ) if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
{ {
/* Did not block on the semaphore as long as expected. */ /* Did not block on the semaphore as long as expected. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xReturned != pdFAIL ) if( xReturned != pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 );
@ -983,7 +983,7 @@
if( xReturned != errQUEUE_EMPTY ) if( xReturned != errQUEUE_EMPTY )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now it should be possible to write to the queue staticQUEUE_LENGTH_IN_ITEMS /* Now it should be possible to write to the queue staticQUEUE_LENGTH_IN_ITEMS
@ -994,7 +994,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -1003,7 +1003,7 @@
if( xReturned != errQUEUE_FULL ) if( xReturned != errQUEUE_FULL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now read back from the queue to ensure the data read back matches that /* Now read back from the queue to ensure the data read back matches that
@ -1014,12 +1014,12 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( ullRead != ull ) if( ullRead != ull )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -1028,7 +1028,7 @@
if( xReturned != errQUEUE_EMPTY ) if( xReturned != errQUEUE_EMPTY )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
} }
@ -1046,7 +1046,7 @@
if( xReturned != pdFAIL ) if( xReturned != pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now it should be possible to take the mutex a number of times. */ /* Now it should be possible to take the mutex a number of times. */
@ -1056,7 +1056,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -1068,7 +1068,7 @@
if( xReturned != pdPASS ) if( xReturned != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -1077,7 +1077,7 @@
if( xReturned != pdFAIL ) if( xReturned != pdFAIL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -1089,7 +1089,7 @@
if( uxCycleCounter == uxLastCycleCounter ) if( uxCycleCounter == uxLastCycleCounter )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {

View file

@ -152,7 +152,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */ * anything on the queue. */
if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY ) if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* How long were we blocked for? */ /* How long were we blocked for? */
@ -161,7 +161,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock ) if( xBlockedTime < xTimeToBlock )
{ {
/* Should not have blocked for less than we requested. */ /* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -169,7 +169,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested, /* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were * although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */ * unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -183,7 +183,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{ {
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS ) if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
#if configUSE_PREEMPTION == 0 #if configUSE_PREEMPTION == 0
@ -203,7 +203,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */ * anything on the queue. */
if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL ) if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* How long were we blocked for? */ /* How long were we blocked for? */
@ -212,7 +212,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock ) if( xBlockedTime < xTimeToBlock )
{ {
/* Should not have blocked for less than we requested. */ /* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -220,7 +220,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested, /* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were * although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */ * unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -256,7 +256,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* but not execute as this task has higher priority. */ * but not execute as this task has higher priority. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS ) if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now fill the queue again before the other task gets a chance to /* Now fill the queue again before the other task gets a chance to
@ -264,13 +264,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* full ourselves, and the other task have set xRunIndicator. */ * full ourselves, and the other task have set xRunIndicator. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS ) if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xRunIndicator == bktRUN_INDICATOR ) if( xRunIndicator == bktRUN_INDICATOR )
{ {
/* The other task should not have executed. */ /* The other task should not have executed. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Raise the priority of the other task so it executes and blocks /* Raise the priority of the other task so it executes and blocks
@ -283,7 +283,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{ {
/* The other task should not have executed outside of the /* The other task should not have executed outside of the
* queue function. */ * queue function. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Set the priority back down. */ /* Set the priority back down. */
@ -311,7 +311,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{ {
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS ) if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
} }
@ -334,7 +334,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* wake but not execute as this task has higher priority. */ * wake but not execute as this task has higher priority. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS ) if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now empty the queue again before the other task gets a chance to /* Now empty the queue again before the other task gets a chance to
@ -342,13 +342,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* empty ourselves, and the other task would be suspended. */ * empty ourselves, and the other task would be suspended. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS ) if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
if( xRunIndicator == bktRUN_INDICATOR ) if( xRunIndicator == bktRUN_INDICATOR )
{ {
/* The other task should not have executed. */ /* The other task should not have executed. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Raise the priority of the other task so it executes and blocks /* Raise the priority of the other task so it executes and blocks
@ -361,7 +361,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{ {
/* The other task should not have executed outside of the /* The other task should not have executed outside of the
* queue function. */ * queue function. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY ); vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );
@ -411,7 +411,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL ) if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* How long were we inside the send function? */ /* How long were we inside the send function? */
@ -420,7 +420,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */ /* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK ) if( xBlockedTime < bktTIME_TO_BLOCK )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN /* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -428,7 +428,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* soon as we unblocked. */ * soon as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Suspend ready for test 3. */ /* Suspend ready for test 3. */
@ -447,7 +447,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY ) if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking; xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
@ -455,7 +455,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */ /* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK ) if( xBlockedTime < bktTIME_TO_BLOCK )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN /* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -463,7 +463,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* as we unblocked. */ * as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) ) if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xRunIndicator = bktRUN_INDICATOR; xRunIndicator = bktRUN_INDICATOR;
@ -493,7 +493,7 @@ static void prvBasicDelayTests( void )
* to the other tests in this file. */ * to the other tests in this file. */
if( ( xPostTime - xPreTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) ) if( ( xPostTime - xPreTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now crude tests to check the vTaskDelayUntil() functionality. */ /* Now crude tests to check the vTaskDelayUntil() functionality. */
@ -510,7 +510,7 @@ static void prvBasicDelayTests( void )
if( ( xTaskGetTickCount() - xExpectedUnblockTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) ) if( ( xTaskGetTickCount() - xExpectedUnblockTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xPrimaryCycles++; xPrimaryCycles++;
@ -522,7 +522,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE ) if( xDidBlock != pdTRUE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Now delay a few ticks so repeating the above block period will not block for /* Now delay a few ticks so repeating the above block period will not block for
@ -532,7 +532,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE ) if( xDidBlock != pdTRUE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* This time block for longer than xPeriod before calling xTaskDelayUntil() so /* This time block for longer than xPeriod before calling xTaskDelayUntil() so
@ -542,7 +542,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE ) if( xDidBlock != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Catch up. */ /* Catch up. */
@ -550,7 +550,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE ) if( xDidBlock != pdTRUE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Again block for slightly longer than a period so ensure the time is in the /* Again block for slightly longer than a period so ensure the time is in the
@ -560,7 +560,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE ) if( xDidBlock != pdFALSE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Reset to the original task priority ready for the other tests. */ /* Reset to the original task priority ready for the other tests. */
@ -585,7 +585,7 @@ BaseType_t xAreBlockTimeTestTasksStillRunning( void )
xReturn = pdFAIL; xReturn = pdFAIL;
} }
if( xErrorOccurred == pdTRUE ) if( xErrorOccurred != pdFALSE )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }

View file

@ -144,7 +144,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* polling task. */ * polling task. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
for( ux = 0; ux < recmuMAX_COUNT; ux++ ) for( ux = 0; ux < recmuMAX_COUNT; ux++ )
@ -161,7 +161,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* flag will be set here. */ * flag will be set here. */
if( xSemaphoreTakeRecursive( xMutex, recmu15ms_DELAY ) != pdPASS ) if( xSemaphoreTakeRecursive( xMutex, recmu15ms_DELAY ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Ensure the other task attempting to access the mutex (and the /* Ensure the other task attempting to access the mutex (and the
@ -185,7 +185,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* as it too has a lower priority than this task. */ * as it too has a lower priority than this task. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
#if ( configUSE_PREEMPTION == 0 ) #if ( configUSE_PREEMPTION == 0 )
@ -197,7 +197,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* should no longer be the mutex owner, so the next give should fail. */ * should no longer be the mutex owner, so the next give should fail. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Keep count of the number of cycles this task has performed so a /* Keep count of the number of cycles this task has performed so a
@ -232,7 +232,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{ {
/* Did not expect to execute until the controlling task was /* Did not expect to execute until the controlling task was
* suspended. */ * suspended. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
@ -240,7 +240,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
* the polling task to obtain the mutex. */ * the polling task to obtain the mutex. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
xBlockingIsSuspended = pdTRUE; xBlockingIsSuspended = pdTRUE;
@ -252,13 +252,13 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{ {
/* We should not leave the xSemaphoreTakeRecursive() function /* We should not leave the xSemaphoreTakeRecursive() function
* until the mutex was obtained. */ * until the mutex was obtained. */
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* The controlling and blocking tasks should be in lock step. */ /* The controlling and blocking tasks should be in lock step. */
if( uxControllingCycles != ( UBaseType_t ) ( uxBlockingCycles + 1 ) ) if( uxControllingCycles != ( UBaseType_t ) ( uxBlockingCycles + 1 ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
/* Keep count of the number of cycles this task has performed so a /* Keep count of the number of cycles this task has performed so a
@ -290,7 +290,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Is the blocking task suspended? */ /* Is the blocking task suspended? */
if( ( xBlockingIsSuspended != pdTRUE ) || ( xControllingIsSuspended != pdTRUE ) ) if( ( xBlockingIsSuspended != pdTRUE ) || ( xControllingIsSuspended != pdTRUE ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
@ -321,7 +321,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
* be suspended. */ * be suspended. */
if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) ) if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
#if ( INCLUDE_uxTaskPriorityGet == 1 ) #if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -341,7 +341,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Release the mutex, disinheriting the higher priority again. */ /* Release the mutex, disinheriting the higher priority again. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
#if ( INCLUDE_uxTaskPriorityGet == 1 ) #if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -371,7 +371,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the controlling task still cycling? */ /* Is the controlling task still cycling? */
if( uxLastControllingCycles == uxControllingCycles ) if( uxLastControllingCycles == uxControllingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
@ -381,7 +381,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the blocking task still cycling? */ /* Is the blocking task still cycling? */
if( uxLastBlockingCycles == uxBlockingCycles ) if( uxLastBlockingCycles == uxBlockingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
@ -391,14 +391,14 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the polling task still cycling? */ /* Is the polling task still cycling? */
if( uxLastPollingCycles == uxPollingCycles ) if( uxLastPollingCycles == uxPollingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = __LINE__;
} }
else else
{ {
uxLastPollingCycles = uxPollingCycles; uxLastPollingCycles = uxPollingCycles;
} }
if( xErrorOccurred == pdTRUE ) if( xErrorOccurred != pdFALSE )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }