| 773 | /*-----------------------------------------------------------*/ |
| 774 | |
| 775 | BaseType_t xQueueGenericSend( QueueHandle_t xQueue, |
| 776 | const void * const pvItemToQueue, |
| 777 | TickType_t xTicksToWait, |
| 778 | const BaseType_t xCopyPosition ) |
| 779 | { |
| 780 | BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired; |
| 781 | TimeOut_t xTimeOut; |
| 782 | Queue_t * const pxQueue = xQueue; |
| 783 | |
| 784 | configASSERT( pxQueue ); |
| 785 | configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); |
| 786 | configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); |
| 787 | #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) |
| 788 | { |
| 789 | configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); |
| 790 | } |
| 791 | #endif |
| 792 | |
| 793 | /*lint -save -e904 This function relaxes the coding standard somewhat to |
| 794 | * allow return statements within the function itself. This is done in the |
| 795 | * interest of execution time efficiency. */ |
| 796 | for( ; ; ) |
| 797 | { |
| 798 | taskENTER_CRITICAL(); |
| 799 | { |
| 800 | /* Is there room on the queue now? The running task must be the |
| 801 | * highest priority task wanting to access the queue. If the head item |
| 802 | * in the queue is to be overwritten then it does not matter if the |
| 803 | * queue is full. */ |
| 804 | if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) |
| 805 | { |
| 806 | traceQUEUE_SEND( pxQueue ); |
| 807 | |
| 808 | #if ( configUSE_QUEUE_SETS == 1 ) |
| 809 | { |
| 810 | const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; |
| 811 | |
| 812 | xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); |
| 813 | |
| 814 | if( pxQueue->pxQueueSetContainer != NULL ) |
| 815 | { |
| 816 | if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) ) |
| 817 | { |
| 818 | /* Do not notify the queue set as an existing item |
| 819 | * was overwritten in the queue so the number of items |
| 820 | * in the queue has not changed. */ |
| 821 | mtCOVERAGE_TEST_MARKER(); |
| 822 | } |
| 823 | else if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) |
| 824 | { |
| 825 | /* The queue is a member of a queue set, and posting |
| 826 | * to the queue set caused a higher priority task to |
| 827 | * unblock. A context switch is required. */ |
| 828 | queueYIELD_IF_USING_PREEMPTION(); |
| 829 | } |
| 830 | else |
| 831 | { |
| 832 | mtCOVERAGE_TEST_MARKER(); |
no test coverage detected