]> git.sur5r.net Git - freertos/commitdiff
Tighten up IntQueue.c testing to have a count of the number of interrupts that post...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 21 Jan 2012 16:39:14 +0000 (16:39 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 21 Jan 2012 16:39:14 +0000 (16:39 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1669 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/Common/Minimal/IntQueue.c

index efb5cf0366b4e0715a7a0937efa6f129101e9507..ea6985cc107c0f152ddbb6c19e2c1055fb6f2b8a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
     FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.\r
-       \r
+\r
 \r
     ***************************************************************************\r
      *                                                                       *\r
@@ -217,7 +217,7 @@ void vStartInterruptQueueTasks( void )
        xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H2QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask2 );\r
        xTaskCreate( prvLowerPriorityNormallyEmptyTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );\r
        xTaskCreate( prv1stHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask1 );\r
-       xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 );\r
+       xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H2QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 );\r
        xTaskCreate( prvLowerPriorityNormallyFullTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );\r
 \r
        /* Create the queues that are accessed by multiple tasks and multiple\r
@@ -280,7 +280,7 @@ static void prvQueueAccessLogError( unsigned portBASE_TYPE uxLine )
 \r
 static void prvHigherPriorityNormallyEmptyTask( void *pvParameters )\r
 {\r
-unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorCount2 = 0;\r
+unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxInterrupts, uxErrorCount1 = 0, uxErrorCount2 = 0;\r
 \r
        /* The timer should not be started until after the scheduler has started.\r
        More than one task is running this code so we check the parameter value\r
@@ -317,6 +317,7 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorC
 \r
                                uxTask1 = 0;\r
                                uxTask2 = 0;\r
+                               uxInterrupts = 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
@@ -340,6 +341,10 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorC
                                                        /* Value was placed into the array by task 2. */\r
                                                        uxTask2++;\r
                                                }\r
+                                               else if( ucNormallyEmptyReceivedValues[ ux ] == intqSECOND_INTERRUPT )\r
+                                               {\r
+                                                       uxInterrupts++;\r
+                                               }\r
                                        }\r
                                }\r
 \r
@@ -371,6 +376,11 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxErrorCount1 = 0, uxErrorC
                                        uxErrorCount2 = 0;\r
                                }\r
 \r
+                               if( uxInterrupts == 0 )\r
+                               {\r
+                                       prvQueueAccessLogError( __LINE__ );\r
+                               }\r
+\r
                                /* Clear the array again, ready to start a new cycle. */\r
                                memset( ucNormallyEmptyReceivedValues, 0x00, sizeof( ucNormallyEmptyReceivedValues ) );\r
 \r
@@ -441,7 +451,7 @@ unsigned portBASE_TYPE uxValue, uxRxed;
 \r
 static void prv1stHigherPriorityNormallyFullTask( void *pvParameters )\r
 {\r
-unsigned portBASE_TYPE uxValueToTx, ux;\r
+unsigned portBASE_TYPE uxValueToTx, ux, uxInterrupts;\r
 \r
        /* The parameters are not being used so avoid compiler warnings. */\r
        ( void ) pvParameters;\r
@@ -499,6 +509,9 @@ unsigned portBASE_TYPE uxValueToTx, ux;
                        task recognises a time out when it is unsuspended. */\r
                        xWasSuspended = pdTRUE;\r
 \r
+                       /* Check interrupts are also sending. */\r
+                       uxInterrupts = 0U;\r
+\r
                        /* Start at 1 as we expect position 0 to be unused. */\r
                        for( ux = 1; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
                        {\r
@@ -507,6 +520,17 @@ unsigned portBASE_TYPE uxValueToTx, ux;
                                        /* A value was missing. */\r
                                        prvQueueAccessLogError( __LINE__ );\r
                                }\r
+                               else if( ucNormallyFullReceivedValues[ ux ] == intqSECOND_INTERRUPT )\r
+                               {\r
+                                       uxInterrupts++;\r
+                               }\r
+                       }\r
+\r
+                       if( uxInterrupts == 0 )\r
+                       {\r
+                               /* No writes from interrupts were found.  Are interrupts\r
+                               actually running? */\r
+                               prvQueueAccessLogError( __LINE__ );\r
                        }\r
 \r
                        /* Reset the array ready for the next cycle. */\r