]> git.sur5r.net Git - freertos/commitdiff
Switch from post increment to pre increment on values sent to queues. This allows...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 24 Sep 2008 13:06:39 +0000 (13:06 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 24 Sep 2008 13:06:39 +0000 (13:06 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@484 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/Common/Minimal/IntQueue.c

index 3c8993629ebd7485f9da469160686ced7270118a..00c2f515c8f39aa305b8596461eed89c6072e785 100644 (file)
@@ -116,8 +116,8 @@ from within the interrupts. */
        unsigned portBASE_TYPE uxSavedInterruptStatus;                                                                                                                                                  \\r
                uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();                                                                                                                     \\r
                {                                                                                                                                                                                                                                       \\r
-                       xQueueSendFromISR( xNormallyEmptyQueue, ( void * ) &uxValueForNormallyEmptyQueue, &xHigherPriorityTaskWoken );  \\r
                        uxValueForNormallyEmptyQueue++;                                                                                                                                                                 \\r
+                       xQueueSendFromISR( xNormallyEmptyQueue, ( void * ) &uxValueForNormallyEmptyQueue, &xHigherPriorityTaskWoken );  \\r
                }                                                                                                                                                                                                                                       \\r
                portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );                                                                                                            \\r
        }                                                                                                                                                                                                                                               \\r
@@ -130,8 +130,8 @@ from within the interrupts. */
        unsigned portBASE_TYPE uxSavedInterruptStatus;                                                                                                                                                  \\r
                uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();                                                                                                                     \\r
                {                                                                                                                                                                                                                                       \\r
-                       xQueueSendFromISR( xNormallyFullQueue, ( void * ) &uxValueForNormallyFullQueue, &xHigherPriorityTaskWoken );    \\r
                        uxValueForNormallyFullQueue++;                                                                                                                                                                  \\r
+                       xQueueSendFromISR( xNormallyFullQueue, ( void * ) &uxValueForNormallyFullQueue, &xHigherPriorityTaskWoken );    \                       \r
                }                                                                                                                                                                                                                                       \\r
                portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );                                                                                                            \\r
        }                                                                                                                                                                                                                                               \\r
@@ -313,8 +313,9 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorC
                                uxTask2 = 0;\r
 \r
                                /* Loop through the array, checking that both tasks have\r
-                               placed values into the array, and that no values are missing. */\r
-                               for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
+                               placed values into the array, and that no values are missing.\r
+                               Start at 1 as we expect position 0 to be unused. */\r
+                               for( ux = 1; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
                                {\r
                                        if( ucNormallyEmptyReceivedValues[ ux ] == 0 )\r
                                        {\r
@@ -417,8 +418,8 @@ portBASE_TYPE xQueueStatus;
 \r
                        portENTER_CRITICAL();\r
                        {\r
-                               uxValue = uxValueForNormallyEmptyQueue;\r
                                uxValueForNormallyEmptyQueue++;\r
+                               uxValue = uxValueForNormallyEmptyQueue;                         \r
                        }\r
                        portEXIT_CRITICAL();\r
 \r
@@ -447,8 +448,8 @@ portBASE_TYPE xQueueStatus;
        {\r
                portENTER_CRITICAL();\r
                {\r
-                       uxValueToTx = uxValueForNormallyFullQueue;\r
                        uxValueForNormallyFullQueue++;\r
+                       uxValueToTx = uxValueForNormallyFullQueue;                      \r
                }\r
                portEXIT_CRITICAL();\r
 \r
@@ -459,8 +460,8 @@ portBASE_TYPE xQueueStatus;
        {\r
                portENTER_CRITICAL();\r
                {\r
-                       uxValueToTx = uxValueForNormallyFullQueue;\r
                        uxValueForNormallyFullQueue++;\r
+                       uxValueToTx = uxValueForNormallyFullQueue;                      \r
                }\r
                portEXIT_CRITICAL();\r
 \r
@@ -494,7 +495,8 @@ portBASE_TYPE xQueueStatus;
                        task recognises a time out when it is unsuspended. */\r
                        xWasSuspended = pdTRUE;\r
 \r
-                       for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
+                       /* Start at 1 as we expect position 0 to be unused. */\r
+                       for( ux = 1; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
                        {\r
                                if( ucNormallyFullReceivedValues[ ux ] == 0 )\r
                                {\r
@@ -536,8 +538,8 @@ portBASE_TYPE xQueueStatus;
        {\r
                portENTER_CRITICAL();\r
                {\r
-                       uxValueToTx = uxValueForNormallyFullQueue;\r
                        uxValueForNormallyFullQueue++;\r
+                       uxValueToTx = uxValueForNormallyFullQueue;                      \r
                }\r
                portEXIT_CRITICAL();\r
 \r
@@ -548,8 +550,8 @@ portBASE_TYPE xQueueStatus;
        {\r
                portENTER_CRITICAL();\r
                {\r
-                       uxValueToTx = uxValueForNormallyFullQueue;\r
                        uxValueForNormallyFullQueue++;\r
+                       uxValueToTx = uxValueForNormallyFullQueue;                      \r
                }\r
                portEXIT_CRITICAL();\r
 \r