From e62771318c7b4ab0bf7b045f876799aa513ff1b7 Mon Sep 17 00:00:00 2001 From: rtel Date: Wed, 29 Jan 2020 19:52:38 +0000 Subject: [PATCH] Correct an err in queue.c introduced when previously updating behaviour when queue sets are used in combination with queue overwrites. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2810 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../CORTEX_A9_Zynq_ZC702/RTOSDemo/.project | 55 +++++++++++-------- .../RTOSDemo/src/Full_Demo/main_full.c | 20 ++++++- .../CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c | 7 +++ FreeRTOS/Source/queue.c | 27 ++++----- 4 files changed, 68 insertions(+), 41 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.project b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.project index 783ec0112..0d8df7eec 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.project +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.project @@ -219,7 +219,7 @@ - 1528755597221 + 1580324678127 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -228,7 +228,7 @@ - 1528755597236 + 1580324678132 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -237,7 +237,7 @@ - 1528755597244 + 1580324678137 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -246,7 +246,7 @@ - 1528755597250 + 1580324678144 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -255,7 +255,7 @@ - 1528755597254 + 1580324678149 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -264,7 +264,7 @@ - 1528755597258 + 1580324678155 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -273,7 +273,7 @@ - 1528755597263 + 1580324678160 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -282,7 +282,7 @@ - 1528755597267 + 1580324678165 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -291,7 +291,7 @@ - 1528755597271 + 1580324678171 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -300,7 +300,7 @@ - 1528755597278 + 1580324678176 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -309,7 +309,7 @@ - 1528755597282 + 1580324678196 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -318,7 +318,7 @@ - 1528755597288 + 1580324678207 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -327,7 +327,7 @@ - 1528755597292 + 1580324678218 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -336,7 +336,7 @@ - 1528755597302 + 1580324678227 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -345,7 +345,7 @@ - 1528755597306 + 1580324678238 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -354,7 +354,7 @@ - 1528755597310 + 1580324678249 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -363,7 +363,7 @@ - 1528755597314 + 1580324678260 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -372,7 +372,7 @@ - 1528755597318 + 1580324678271 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -381,7 +381,7 @@ - 1528755597321 + 1580324678282 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -390,7 +390,7 @@ - 1528755597325 + 1580324678293 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -399,7 +399,7 @@ - 1528755597330 + 1580324678305 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -408,7 +408,7 @@ - 1528755597334 + 1580324678315 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -417,7 +417,7 @@ - 1528755597338 + 1580324678325 src/Full_Demo/Standard-Demo-Tasks/Minimal 5 @@ -425,6 +425,15 @@ 1.0-name-matches-false-false-StreamBufferInterrupt.c + + 1580324678334 + src/Full_Demo/Standard-Demo-Tasks/Minimal + 5 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-QueueSet.c + + 1461598705091 src/lwIP_Demo/lwip-1.4.0/src/core diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c index 9c1334269..3200bf6a6 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c @@ -114,6 +114,7 @@ #include "StreamBufferDemo.h" #include "StreamBufferInterrupt.h" #include "MessageBufferAMP.h" +#include "QueueSet.h" /* Priorities for the demo application tasks. */ @@ -233,6 +234,12 @@ void main_full( void ) vStartStreamBufferInterruptDemo(); vStartMessageBufferAMPTasks( mainMESSAGE_BUFFER_STACK_SIZE ); + #if( configUSE_QUEUE_SETS == 1 ) + { + vStartQueueSetTasks(); + } + #endif + /* Start the tasks that implements the command console on the UART, as described above. */ vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY ); @@ -403,17 +410,26 @@ unsigned long ulErrorFound = pdFALSE; ulErrorFound |= 1UL << 20UL; } + #if( configUSE_QUEUE_SETS == 1 ) + { + if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + ulErrorFound |= 1UL << 21UL; + } + } + #endif + /* Check that the register test 1 task is still running. */ if( ulLastRegTest1Value == ulRegTest1LoopCounter ) { - ulErrorFound |= 1UL << 21UL; + ulErrorFound |= 1UL << 22UL; } ulLastRegTest1Value = ulRegTest1LoopCounter; /* Check that the register test 2 task is still running. */ if( ulLastRegTest2Value == ulRegTest2LoopCounter ) { - ulErrorFound |= 1UL << 22UL; + ulErrorFound |= 1UL << 23UL; } ulLastRegTest2Value = ulRegTest2LoopCounter; diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c index adf6f1d45..22950ff1a 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c @@ -78,6 +78,7 @@ #include "IntSemTest.h" #include "StreamBufferInterrupt.h" #include "StreamBufferDemo.h" +#include "QueueSet.h" /* Xilinx includes. */ #include "platform.h" @@ -303,6 +304,12 @@ void vApplicationTickHook( void ) a stream being sent from an interrupt to a task. */ vBasicStreamBufferSendFromISR(); + #if( configUSE_QUEUE_SETS == 1 ) + { + vQueueSetAccessQueueSetFromISR(); + } + #endif + /* Test flop alignment in interrupts - calling printf from an interrupt is BAD! */ #if( configASSERT_DEFINED == 1 ) diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 103718dba..eacc69c3f 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -983,24 +983,23 @@ Queue_t * const pxQueue = xQueue; if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) { const int8_t cTxLock = pxQueue->cTxLock; + const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; traceQUEUE_SEND_FROM_ISR( pxQueue ); + /* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a + semaphore or mutex. That means prvCopyDataToQueue() cannot result + in a task disinheriting a priority and prvCopyDataToQueue() can be + called here even though the disinherit function does not check if + the scheduler is suspended before accessing the ready lists. */ + ( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); + /* The event list is not altered if the queue is locked. This will be done when the queue is unlocked later. */ if( cTxLock == queueUNLOCKED ) { #if ( configUSE_QUEUE_SETS == 1 ) { - const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; - - /* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a - semaphore or mutex. That means prvCopyDataToQueue() cannot result - in a task disinheriting a priority and prvCopyDataToQueue() can be - called here even though the disinherit function does not check if - the scheduler is suspended before accessing the ready lists. */ - ( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - if( pxQueue->pxQueueSetContainer != NULL ) { if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) ) @@ -1059,13 +1058,6 @@ Queue_t * const pxQueue = xQueue; } #else /* configUSE_QUEUE_SETS */ { - /* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a - semaphore or mutex. That means prvCopyDataToQueue() cannot result - in a task disinheriting a priority and prvCopyDataToQueue() can be - called here even though the disinherit function does not check if - the scheduler is suspended before accessing the ready lists. */ - ( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) { if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) @@ -1090,6 +1082,9 @@ Queue_t * const pxQueue = xQueue; { mtCOVERAGE_TEST_MARKER(); } + + /* Not used in this path. */ + ( void ) uxPreviousMessagesWaiting; } #endif /* configUSE_QUEUE_SETS */ } -- 2.39.5