Add callback overrides for stream buffer and message buffers (#437)

* Let each stream/message can use its own sbSEND_COMPLETED

In FreeRTOS.h, set the default value of configUSE_SB_COMPLETED_CALLBACK
to zero, and add additional space for the function pointer when
the buffer created statically.

In stream_buffer.c, modify the macro of sbSEND_COMPLETED which let
the stream buffer to use its own implementation, and then add an
pointer to the stream buffer's structure, and modify the
implementation of the buffer creating and initializing

Co-authored-by: eddie9712 <qw1562435@gmail.com>
This commit is contained in:
Ravishankar Bhagavandas 2022-06-20 17:48:34 -07:00 committed by GitHub
parent 49cb8e8b28
commit 0b46492740
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 306 additions and 48 deletions

View file

@ -890,6 +890,12 @@
#define configUSE_POSIX_ERRNO 0
#endif
#ifndef configUSE_SB_COMPLETED_CALLBACK
/* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
#define configUSE_SB_COMPLETED_CALLBACK 0
#endif
#ifndef portTICK_TYPE_IS_ATOMIC
#define portTICK_TYPE_IS_ATOMIC 0
#endif
@ -1356,6 +1362,9 @@ typedef struct xSTATIC_STREAM_BUFFER
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxDummy4;
#endif
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
void * pvDummy5[ 2 ];
#endif
} StaticStreamBuffer_t;
/* Message buffers are built on stream buffers. */