X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FSource%2Fqueue.c;h=43ceaca9279003fb25648d304481d61c9bb2f293;hb=0885fb373227e2e4d9a9a72820f660b9ffdc67af;hp=a94b03ed8e64f00e8cb8a286c229c9686f28d93a;hpb=abf43e0ca4466819c7c77a7bb37d72aa9175e471;p=freertos diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index a94b03ed8..43ceaca92 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -418,7 +418,7 @@ xQueueHandle xReturn = NULL; void *pxReturn; /* This function is called by xSemaphoreGetMutexHolder(), and should not - be called directly. Note: This is is a good way of determining if the + be called directly. Note: This is a good way of determining if the calling task is the mutex holder, but not a good way of determining the identity of the mutex holder, as the holder may change between the following critical section exiting and the function returning. */ @@ -570,6 +570,12 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; configASSERT( pxQueue ); configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); + #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) + { + configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); + } + #endif + /* This function relaxes the coding standard somewhat to allow return statements within the function itself. This is done in the interest @@ -903,11 +909,11 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) { - portENTER_CRITICAL(); + taskENTER_CRITICAL(); { vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder ); } - portEXIT_CRITICAL(); + taskEXIT_CRITICAL(); } } #endif @@ -943,7 +949,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion @@ -1052,7 +1058,12 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; configASSERT( pxQueue ); configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); - + #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) + { + configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); + } + #endif + /* This function relaxes the coding standard somewhat to allow return statements within the function itself. This is done in the interest of execution time efficiency. */ @@ -1164,11 +1175,11 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) { - portENTER_CRITICAL(); + taskENTER_CRITICAL(); { vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder ); } - portEXIT_CRITICAL(); + taskEXIT_CRITICAL(); } } #endif @@ -1209,7 +1220,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion @@ -1285,7 +1296,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion