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

1058 : m_pool(msg_count,
1061 msg_count, ENVELOPE_SIZE),
1062 m_max_msg_size(max_msg_size),
1063 m_eq_buf_owned(true),
1064 m_cb_owned(true),
1065 m_send_cb(pSendCb),
1066 m_recv_cb(pRecvCb)
1067 {}
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 1071 of file freertos_stk.cpp.

1077 : m_pool(msg_count,
1079 storage,
1080 msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size)),
1081 m_eq(storage + msg_count * stk::memory::BlockMemoryPool::AlignBlockSize(max_msg_size),
1082 msg_count, ENVELOPE_SIZE),
1083 m_max_msg_size(max_msg_size),
1084 m_eq_buf_owned(false),
1085 m_cb_owned(false),
1086 m_send_cb(pSendCb),
1087 m_recv_cb(pRecvCb)
1088 {
1089 STK_UNUSED(storage_size);
1090 }
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
Definition stk_defs.h:715

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

1093 {
1094 if (m_eq_buf_owned)
1095 ObjFreeArray(static_cast<uint8_t *>(m_eq.GetBuffer()));
1096 }
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 1103 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 1102 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 1101 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 1105 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 1104 of file freertos_stk.cpp.

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


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