SuperTinyKernel™ RTOS 1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
FrtosMessageBuffer Struct Reference
Collaboration diagram for FrtosMessageBuffer:

Classes

struct  MsgEnvelope

Public Member Functions

 FrtosMessageBuffer (size_t max_msg_size, size_t msg_count, StreamBufferCallbackFunction_t pSendCb=nullptr, StreamBufferCallbackFunction_t pRecvCb=nullptr)
 FrtosMessageBuffer (size_t max_msg_size, size_t msg_count, uint8_t *storage, size_t storage_size, StreamBufferCallbackFunction_t pSendCb=nullptr, StreamBufferCallbackFunction_t pRecvCb=nullptr)
 ~FrtosMessageBuffer ()

Public Attributes

stk::memory::BlockMemoryPool m_pool
 payload block allocator
stk::sync::MessageQueue m_eq
 envelope FIFO {len, blk}
size_t m_max_msg_size
 max payload bytes per message
bool m_eq_buf_owned
 true -> envelope buffer heap-allocated
bool m_cb_owned
 true -> struct heap-allocated
StreamBufferCallbackFunction_t m_send_cb
 optional callback fired after a successful Send
StreamBufferCallbackFunction_t m_recv_cb
 optional callback fired after a successful Receive

Static Public Attributes

static constexpr size_t ENVELOPE_SIZE = sizeof(MsgEnvelope)

Detailed Description

Definition at line 961 of file freertos_stk.cpp.

Constructor & Destructor Documentation

◆ FrtosMessageBuffer() [1/2]

FrtosMessageBuffer::FrtosMessageBuffer ( size_t max_msg_size,
size_t msg_count,
StreamBufferCallbackFunction_t pSendCb = nullptr,
StreamBufferCallbackFunction_t pRecvCb = nullptr )
inlineexplicit

Definition at line 974 of file freertos_stk.cpp.

978 : m_pool(msg_count,
981 msg_count, ENVELOPE_SIZE),
982 m_max_msg_size(max_msg_size),
983 m_eq_buf_owned(true),
984 m_cb_owned(true),
985 m_send_cb(pSendCb),
986 m_recv_cb(pRecvCb)
987 {}
static T * ObjAllocArray(size_t count)
static constexpr size_t AlignBlockSize(size_t raw_size)
Round a raw block size up to the nearest multiple of BLOCK_ALIGN.
bool m_eq_buf_owned
true -> envelope buffer heap-allocated
static constexpr size_t ENVELOPE_SIZE
stk::memory::BlockMemoryPool m_pool
payload block allocator
bool m_cb_owned
true -> struct heap-allocated
stk::sync::MessageQueue m_eq
envelope FIFO {len, blk}
StreamBufferCallbackFunction_t m_send_cb
optional callback fired after a successful Send
StreamBufferCallbackFunction_t m_recv_cb
optional callback fired after a successful Receive
size_t m_max_msg_size
max payload bytes per message

References ENVELOPE_SIZE, m_cb_owned, m_eq, m_eq_buf_owned, m_max_msg_size, m_pool, m_recv_cb, m_send_cb, and ObjAllocArray().

Here is the call graph for this function:

◆ FrtosMessageBuffer() [2/2]

FrtosMessageBuffer::FrtosMessageBuffer ( size_t max_msg_size,
size_t msg_count,
uint8_t * storage,
size_t storage_size,
StreamBufferCallbackFunction_t pSendCb = nullptr,
StreamBufferCallbackFunction_t pRecvCb = nullptr )
inlineexplicit

Definition at line 991 of file freertos_stk.cpp.

997 : m_pool(msg_count,
999 storage,
1000 msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size)),
1001 m_eq(storage + msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size),
1002 msg_count, ENVELOPE_SIZE),
1003 m_max_msg_size(max_msg_size),
1004 m_eq_buf_owned(false),
1005 m_cb_owned(false),
1006 m_send_cb(pSendCb),
1007 m_recv_cb(pRecvCb)
1008 {
1009 STK_UNUSED(storage_size);
1010 }
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
Definition stk_defs.h:610

References ENVELOPE_SIZE, m_cb_owned, m_eq, m_eq_buf_owned, m_max_msg_size, m_pool, m_recv_cb, m_send_cb, and STK_UNUSED.

◆ ~FrtosMessageBuffer()

FrtosMessageBuffer::~FrtosMessageBuffer ( )
inline

Definition at line 1012 of file freertos_stk.cpp.

1013 {
1014 if (m_eq_buf_owned)
1015 ObjFreeArray(static_cast<uint8_t *>(m_eq.GetBuffer()));
1016 }
static void ObjFreeArray(void *ptr)

References m_eq, m_eq_buf_owned, and ObjFreeArray().

Here is the call graph for this function:

Member Data Documentation

◆ ENVELOPE_SIZE

size_t FrtosMessageBuffer::ENVELOPE_SIZE = sizeof(MsgEnvelope)
staticconstexpr

◆ m_cb_owned

bool FrtosMessageBuffer::m_cb_owned

true -> struct heap-allocated

Definition at line 1023 of file freertos_stk.cpp.

Referenced by FrtosMessageBuffer(), and FrtosMessageBuffer().

◆ m_eq

◆ m_eq_buf_owned

bool FrtosMessageBuffer::m_eq_buf_owned

true -> envelope buffer heap-allocated

Definition at line 1022 of file freertos_stk.cpp.

Referenced by FrtosMessageBuffer(), FrtosMessageBuffer(), and ~FrtosMessageBuffer().

◆ m_max_msg_size

size_t FrtosMessageBuffer::m_max_msg_size

max payload bytes per message

Definition at line 1021 of file freertos_stk.cpp.

Referenced by FrtosMessageBuffer(), FrtosMessageBuffer(), xMessageBufferSend(), and xMessageBufferSendFromISR().

◆ m_pool

◆ m_recv_cb

StreamBufferCallbackFunction_t FrtosMessageBuffer::m_recv_cb

optional callback fired after a successful Receive

Definition at line 1025 of file freertos_stk.cpp.

Referenced by FrtosMessageBuffer(), FrtosMessageBuffer(), xMessageBufferReceive(), and xMessageBufferReceiveFromISR().

◆ m_send_cb

StreamBufferCallbackFunction_t FrtosMessageBuffer::m_send_cb

optional callback fired after a successful Send

Definition at line 1024 of file freertos_stk.cpp.

Referenced by FrtosMessageBuffer(), FrtosMessageBuffer(), xMessageBufferSend(), and xMessageBufferSendFromISR().


The documentation for this struct was generated from the following file: