SuperTinyKernel™ RTOS 1.08.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 979 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 992 of file freertos_stk.cpp.

996 : m_pool(msg_count,
999 msg_count, ENVELOPE_SIZE),
1000 m_max_msg_size(max_msg_size),
1001 m_eq_buf_owned(true),
1002 m_cb_owned(true),
1003 m_send_cb(pSendCb),
1004 m_recv_cb(pRecvCb)
1005 {}
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 1009 of file freertos_stk.cpp.

1015 : m_pool(msg_count,
1017 storage,
1018 msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size)),
1019 m_eq(storage + msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size),
1020 msg_count, ENVELOPE_SIZE),
1021 m_max_msg_size(max_msg_size),
1022 m_eq_buf_owned(false),
1023 m_cb_owned(false),
1024 m_send_cb(pSendCb),
1025 m_recv_cb(pRecvCb)
1026 {
1027 STK_UNUSED(storage_size);
1028 }
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
Definition stk_defs.h:654

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 1030 of file freertos_stk.cpp.

1031 {
1032 if (m_eq_buf_owned)
1033 ObjFreeArray(static_cast<uint8_t *>(m_eq.GetBuffer()));
1034 }
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 1041 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 1040 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 1039 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 1043 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 1042 of file freertos_stk.cpp.

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


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