From: richardbarry Date: Fri, 8 Feb 2013 17:05:42 +0000 (+0000) Subject: Fix a few compiler warnings when compiling the QueueSet.c test code with GCC. X-Git-Tag: V7.4.0~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3025e82164200d476b1c3fbfc6ac81fceda32849;p=freertos Fix a few compiler warnings when compiling the QueueSet.c test code with GCC. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1820 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c index 80b0400bc..f1c8cfec3 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c @@ -86,9 +86,9 @@ #include "FreeRTOS.h" #include "task.h" -/* Standard demo includes - just needed for the LED (ParTest) initialisation -function. */ +/* Standard demo includes. */ #include "partest.h" +#include "QueueSet.h" /* Atmel library includes. */ #include @@ -200,3 +200,20 @@ void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName } /*-----------------------------------------------------------*/ +void vApplicationTickHook( void ) +{ + /* This function will be called by each tick interrupt if + configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + added here, but the tick hook is called from an interrupt context, so + code must not attempt to block, and only the interrupt safe FreeRTOS API + functions can be used (those that end in FromISR()). */ + + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + /* In this case the tick hook is used as part of the queue set test. */ + vQueueSetWriteToQueueFromISR(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ +} +/*-----------------------------------------------------------*/ + diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c index 1ea633724..e165eb493 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c @@ -240,13 +240,3 @@ unsigned long ulReceivedValue; } /*-----------------------------------------------------------*/ -void vApplicationTickHook( void ) -{ - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ -} -/*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c index 84cae55e6..d49469b7b 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c @@ -314,15 +314,3 @@ unsigned long ulErrorFound = pdFALSE; } /*-----------------------------------------------------------*/ -void vApplicationTickHook( void ) -{ - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). In this case the tick - hook is used as part of the queue set test. */ - vQueueSetWriteToQueueFromISR(); -} -/*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/Common/Minimal/QueueSet.c b/FreeRTOS/Demo/Common/Minimal/QueueSet.c index 15a1e6b36..809aff1ed 100644 --- a/FreeRTOS/Demo/Common/Minimal/QueueSet.c +++ b/FreeRTOS/Demo/Common/Minimal/QueueSet.c @@ -79,8 +79,11 @@ * queuesetINITIAL_ISR_TX_VALUE to 0xffffffffUL; */ +/* Standard includes. */ +#include + /* Kernel includes. */ -#include +#include "FreeRTOS.h" #include "task.h" #include "queue.h" @@ -245,7 +248,7 @@ static unsigned long ulCallCount = 0; if( xQueues[ x ] != NULL ) { /* xQueues[ x ] can be written to. Send the next value. */ - if( xQueueSendFromISR( xQueues[ x ], &ulISRTxValue, NULL ) == pdPASS ) + if( xQueueSendFromISR( xQueues[ x ], ( void * ) &ulISRTxValue, NULL ) == pdPASS ) { ulISRTxValue++; diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 5d6b5aec2..2cc676cf7 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -1385,6 +1385,18 @@ static void prvUnlockQueue( xQueueHandle pxQueue ) { #if ( configUSE_QUEUE_SETS == 1 ) { + /* It is highly unlikely that this code will ever run, + for the following reason: + + A task will only lock a queue that is part of a + queue set when it is blocking on a write to the + queue. + + An interrupt can only add something to a queue + while the queue is locked (resulting in the + following code executing when the queue is unlocked) + if the queue is not full, meaning a task will never + have blocked on a write in the first place. + The code could execute if an interrupt is also removing + items from a queue. */ if( pxQueue->pxQueueSetContainer != NULL ) { if( prvNotifyQueueSetContainer( pxQueue, queueSEND_TO_BACK ) == pdTRUE )