From: richardbarry Date: Wed, 24 Sep 2008 13:06:39 +0000 (+0000) Subject: Switch from post increment to pre increment on values sent to queues. This allows... X-Git-Tag: V5.1.2~212 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7066e91050ffcdb8208d3f1e58103cc334b194f2;p=freertos Switch from post increment to pre increment on values sent to queues. This allows the test to execute on systems where interrupt level critical sections cannot nest. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@484 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/Common/Minimal/IntQueue.c b/Demo/Common/Minimal/IntQueue.c index 3c8993629..00c2f515c 100644 --- a/Demo/Common/Minimal/IntQueue.c +++ b/Demo/Common/Minimal/IntQueue.c @@ -116,8 +116,8 @@ from within the interrupts. */ unsigned portBASE_TYPE uxSavedInterruptStatus; \ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \ { \ - xQueueSendFromISR( xNormallyEmptyQueue, ( void * ) &uxValueForNormallyEmptyQueue, &xHigherPriorityTaskWoken ); \ uxValueForNormallyEmptyQueue++; \ + xQueueSendFromISR( xNormallyEmptyQueue, ( void * ) &uxValueForNormallyEmptyQueue, &xHigherPriorityTaskWoken ); \ } \ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \ } \ @@ -130,8 +130,8 @@ from within the interrupts. */ unsigned portBASE_TYPE uxSavedInterruptStatus; \ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \ { \ - xQueueSendFromISR( xNormallyFullQueue, ( void * ) &uxValueForNormallyFullQueue, &xHigherPriorityTaskWoken ); \ uxValueForNormallyFullQueue++; \ + xQueueSendFromISR( xNormallyFullQueue, ( void * ) &uxValueForNormallyFullQueue, &xHigherPriorityTaskWoken ); \ } \ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \ } \ @@ -313,8 +313,9 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorC uxTask2 = 0; /* Loop through the array, checking that both tasks have - placed values into the array, and that no values are missing. */ - for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ ) + placed values into the array, and that no values are missing. + Start at 1 as we expect position 0 to be unused. */ + for( ux = 1; ux < intqNUM_VALUES_TO_LOG; ux++ ) { if( ucNormallyEmptyReceivedValues[ ux ] == 0 ) { @@ -417,8 +418,8 @@ portBASE_TYPE xQueueStatus; portENTER_CRITICAL(); { - uxValue = uxValueForNormallyEmptyQueue; uxValueForNormallyEmptyQueue++; + uxValue = uxValueForNormallyEmptyQueue; } portEXIT_CRITICAL(); @@ -447,8 +448,8 @@ portBASE_TYPE xQueueStatus; { portENTER_CRITICAL(); { - uxValueToTx = uxValueForNormallyFullQueue; uxValueForNormallyFullQueue++; + uxValueToTx = uxValueForNormallyFullQueue; } portEXIT_CRITICAL(); @@ -459,8 +460,8 @@ portBASE_TYPE xQueueStatus; { portENTER_CRITICAL(); { - uxValueToTx = uxValueForNormallyFullQueue; uxValueForNormallyFullQueue++; + uxValueToTx = uxValueForNormallyFullQueue; } portEXIT_CRITICAL(); @@ -494,7 +495,8 @@ portBASE_TYPE xQueueStatus; task recognises a time out when it is unsuspended. */ xWasSuspended = pdTRUE; - for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ ) + /* Start at 1 as we expect position 0 to be unused. */ + for( ux = 1; ux < intqNUM_VALUES_TO_LOG; ux++ ) { if( ucNormallyFullReceivedValues[ ux ] == 0 ) { @@ -536,8 +538,8 @@ portBASE_TYPE xQueueStatus; { portENTER_CRITICAL(); { - uxValueToTx = uxValueForNormallyFullQueue; uxValueForNormallyFullQueue++; + uxValueToTx = uxValueForNormallyFullQueue; } portEXIT_CRITICAL(); @@ -548,8 +550,8 @@ portBASE_TYPE xQueueStatus; { portENTER_CRITICAL(); { - uxValueToTx = uxValueForNormallyFullQueue; uxValueForNormallyFullQueue++; + uxValueToTx = uxValueForNormallyFullQueue; } portEXIT_CRITICAL();