X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=Source%2Fqueue.c;h=c2197b7c2e1188331db814ea94716cc6143d4a5c;hb=e530fc1131c00ff25bbf449035a4db01ced60437;hp=f5ce8bba151fc2fcb178041d7ee26be803687c5f;hpb=c99428a5659873d3c9451bd437dcd5c823578374;p=freertos diff --git a/Source/queue.c b/Source/queue.c index f5ce8bba1..c2197b7c2 100644 --- a/Source/queue.c +++ b/Source/queue.c @@ -1,38 +1,44 @@ /* - FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. + FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd. + + + FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by: + Atollic AB - Atollic provides professional embedded systems development + tools for C/C++ development, code analysis and test automation. + See http://www.atollic.com + *************************************************************************** - * * - * If you are: * - * * - * + New to FreeRTOS, * - * + Wanting to learn FreeRTOS or multitasking in general quickly * - * + Looking for basic training, * - * + Wanting to improve your FreeRTOS skills and productivity * - * * - * then take a look at the FreeRTOS books - available as PDF or paperback * - * * - * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * - * http://www.FreeRTOS.org/Documentation * - * * - * A pdf reference manual is also available. Both are usually delivered * - * to your inbox within 20 minutes to two hours when purchased between 8am * - * and 8pm GMT (although please allow up to 24 hours in case of * - * exceptional circumstances). Thank you for your support! * - * * + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * *************************************************************************** + This file is part of the FreeRTOS distribution. FreeRTOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (version 2) as published by the Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - ***NOTE*** The exception to the GPL is included to allow you to distribute - a combined work that includes FreeRTOS without being obliged to provide the - source code for proprietary components outside of the FreeRTOS kernel. - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License and the FreeRTOS license exception along with FreeRTOS; if not it can be viewed here: http://www.freertos.org/a00114.html and also obtained @@ -61,7 +67,10 @@ task.h is included from an application file. */ #include "FreeRTOS.h" #include "task.h" -#include "croutine.h" + +#if ( configUSE_CO_ROUTINES == 1 ) + #include "croutine.h" +#endif #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -87,9 +96,9 @@ task.h is included from an application file. */ /* Semaphores do not actually store or copy data, so have an items size of zero. */ -#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( 0 ) -#define queueDONT_BLOCK ( ( portTickType ) 0 ) -#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0 ) +#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 ) +#define queueDONT_BLOCK ( ( portTickType ) 0U ) +#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U ) /* * Definition of the queue used by the scheduler. @@ -533,7 +542,7 @@ xTimeOutType xTimeOut; /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_SEND( pxQueue ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); @@ -550,7 +559,7 @@ xTimeOutType xTimeOut; task is already in a ready list before it yields - in which case the yield will not cause a context switch unless there is also a higher priority task in the pending ready list. */ - if( !xTaskResumeAll() ) + if( xTaskResumeAll() == pdFALSE ) { portYIELD_WITHIN_API(); } @@ -633,7 +642,7 @@ xTimeOutType xTimeOut; { if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_SEND( pxQueue ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); @@ -749,7 +758,7 @@ xTimeOutType xTimeOut; { if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueEmpty( pxQueue ) ) + if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); @@ -948,7 +957,7 @@ signed char *pcOriginalReadPosition; /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueEmpty( pxQueue ) ) + if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); @@ -967,7 +976,7 @@ signed char *pcOriginalReadPosition; vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); prvUnlockQueue( pxQueue ); - if( !xTaskResumeAll() ) + if( xTaskResumeAll() == pdFALSE ) { portYIELD_WITHIN_API(); } @@ -1254,7 +1263,7 @@ signed portBASE_TYPE xReturn; between the check to see if the queue is full and blocking on the queue. */ portDISABLE_INTERRUPTS(); { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { /* The queue is full - do we want to block or just leave without posting? */ @@ -1398,7 +1407,7 @@ signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvIt /* We only want to wake one co-routine per ISR, so check that a co-routine has not already been woken. */ - if( !xCoRoutinePreviouslyWoken ) + if( xCoRoutinePreviouslyWoken == pdFALSE ) { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) { @@ -1433,7 +1442,7 @@ signed portBASE_TYPE xReturn; --( pxQueue->uxMessagesWaiting ); memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); - if( !( *pxCoRoutineWoken ) ) + if( ( *pxCoRoutineWoken ) == pdFALSE ) { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) { @@ -1464,7 +1473,7 @@ signed portBASE_TYPE xReturn; /* See if there is an empty space in the registry. A NULL name denotes a free slot. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].pcQueueName == NULL ) { @@ -1487,7 +1496,7 @@ signed portBASE_TYPE xReturn; /* See if the handle of the queue being unregistered in actually in the registry. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].xHandle == xQueue ) {