Skip to content

Commit f13d1fd

Browse files
author
hagai.moshe
committed
add API xMessageBufferResetFromISR
Allow reseting the stream buffer from ISR context Signed-off-by: hagai.moshe <hagaimoshe@outlook.com>
1 parent b5f7086 commit f13d1fd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

include/message_buffer.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,34 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
785785
xStreamBufferReset( xMessageBuffer )
786786

787787

788+
/**
789+
* message_buffer.h
790+
* @code{c}
791+
* BaseType_t xMessageBufferResetFromISR( MessageBufferHandle_t xMessageBuffer );
792+
* @endcode
793+
*
794+
* An interrupt safe version of the API function that reset the stream buffer.
795+
* Resets a message buffer to its initial empty state, discarding any message it
796+
* contained.
797+
*
798+
* A message buffer can only be reset if there are no tasks blocked on it.
799+
*
800+
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
801+
* xMessageBufferResetFromISR() to be available.
802+
*
803+
* @param xMessageBuffer The handle of the message buffer being reset.
804+
*
805+
* @return If the message buffer was reset then pdPASS is returned. If the
806+
* message buffer could not be reset because either there was a task blocked on
807+
* the message queue to wait for space to become available, or to wait for a
808+
* a message to be available, then pdFAIL is returned.
809+
*
810+
* \defgroup xMessageBufferResetFromISR xMessageBufferResetFromISR
811+
* \ingroup MessageBufferManagement
812+
*/
813+
#define xMessageBufferResetFromISR( xMessageBuffer ) \
814+
xStreamBufferResetFromISR( xMessageBuffer )
815+
788816
/**
789817
* message_buffer.h
790818
* @code{c}

0 commit comments

Comments
 (0)