| 2128 | /*-----------------------------------------------------------*/ |
| 2129 | |
| 2130 | static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, |
| 2131 | const void * pvItemToQueue, |
| 2132 | const BaseType_t xPosition ) |
| 2133 | { |
| 2134 | BaseType_t xReturn = pdFALSE; |
| 2135 | UBaseType_t uxMessagesWaiting; |
| 2136 | |
| 2137 | /* This function is called from a critical section. */ |
| 2138 | |
| 2139 | uxMessagesWaiting = pxQueue->uxMessagesWaiting; |
| 2140 | |
| 2141 | if( pxQueue->uxItemSize == ( UBaseType_t ) 0 ) |
| 2142 | { |
| 2143 | #if ( configUSE_MUTEXES == 1 ) |
| 2144 | { |
| 2145 | if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) |
| 2146 | { |
| 2147 | /* The mutex is no longer being held. */ |
| 2148 | xReturn = xTaskPriorityDisinherit( pxQueue->u.xSemaphore.xMutexHolder ); |
| 2149 | pxQueue->u.xSemaphore.xMutexHolder = NULL; |
| 2150 | } |
| 2151 | else |
| 2152 | { |
| 2153 | mtCOVERAGE_TEST_MARKER(); |
| 2154 | } |
| 2155 | } |
| 2156 | #endif /* configUSE_MUTEXES */ |
| 2157 | } |
| 2158 | else if( xPosition == queueSEND_TO_BACK ) |
| 2159 | { |
| 2160 | ( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */ |
| 2161 | pxQueue->pcWriteTo += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */ |
| 2162 | |
| 2163 | if( pxQueue->pcWriteTo >= pxQueue->u.xQueue.pcTail ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ |
| 2164 | { |
| 2165 | pxQueue->pcWriteTo = pxQueue->pcHead; |
| 2166 | } |
| 2167 | else |
| 2168 | { |
| 2169 | mtCOVERAGE_TEST_MARKER(); |
| 2170 | } |
| 2171 | } |
| 2172 | else |
| 2173 | { |
| 2174 | ( void ) memcpy( ( void * ) pxQueue->u.xQueue.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e9087 !e418 MISRA exception as the casts are only redundant for some ports. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. Assert checks null pointer only used when length is 0. */ |
| 2175 | pxQueue->u.xQueue.pcReadFrom -= pxQueue->uxItemSize; |
| 2176 | |
| 2177 | if( pxQueue->u.xQueue.pcReadFrom < pxQueue->pcHead ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ |
| 2178 | { |
| 2179 | pxQueue->u.xQueue.pcReadFrom = ( pxQueue->u.xQueue.pcTail - pxQueue->uxItemSize ); |
| 2180 | } |
| 2181 | else |
| 2182 | { |
| 2183 | mtCOVERAGE_TEST_MARKER(); |
| 2184 | } |
| 2185 | |
| 2186 | if( xPosition == queueOVERWRITE ) |
| 2187 | { |
no test coverage detected