MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / xStreamBufferSendFromISR

Function xStreamBufferSendFromISR

stream_buffer.c:649–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647/*-----------------------------------------------------------*/
648
649size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
650 const void * pvTxData,
651 size_t xDataLengthBytes,
652 BaseType_t * const pxHigherPriorityTaskWoken )
653{
654 StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
655 size_t xReturn, xSpace;
656 size_t xRequiredSpace = xDataLengthBytes;
657
658 configASSERT( pvTxData );
659 configASSERT( pxStreamBuffer );
660
661 /* This send function is used to write to both message buffers and stream
662 * buffers. If this is a message buffer then the space needed must be
663 * increased by the amount of bytes needed to store the length of the
664 * message. */
665 if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )
666 {
667 xRequiredSpace += sbBYTES_TO_STORE_MESSAGE_LENGTH;
668 }
669 else
670 {
671 mtCOVERAGE_TEST_MARKER();
672 }
673
674 xSpace = xStreamBufferSpacesAvailable( pxStreamBuffer );
675 xReturn = prvWriteMessageToBuffer( pxStreamBuffer, pvTxData, xDataLengthBytes, xSpace, xRequiredSpace );
676
677 if( xReturn > ( size_t ) 0 )
678 {
679 /* Was a task waiting for the data? */
680 if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes )
681 {
682 sbSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken );
683 }
684 else
685 {
686 mtCOVERAGE_TEST_MARKER();
687 }
688 }
689 else
690 {
691 mtCOVERAGE_TEST_MARKER();
692 }
693
694 traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn );
695
696 return xReturn;
697}
698/*-----------------------------------------------------------*/
699
700static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,

Callers

nothing calls this directly

Calls 3

prvWriteMessageToBufferFunction · 0.85
prvBytesInBufferFunction · 0.85

Tested by

no test coverage detected