38 void*
operator new(
size_t sz,
void* pv) {
return reinterpret_cast<Mailbox*
>(pv); }
50 void Init(
void* pvBuffer_, uint16_t u16BufferSize_, uint16_t u16ElementSize_);
64 static Mailbox*
Init(uint16_t u16BufferSize_, uint16_t u16ElementSize_);
78 bool Send(
void* pvData_);
107 bool Send(
void* pvData_, uint32_t u32TimeoutMS_);
122 bool SendTail(
void* pvData_, uint32_t u32TimeoutMS_);
155 bool Receive(
void* pvData_, uint32_t u32TimeoutMS_);
168 bool ReceiveTail(
void* pvData_, uint32_t u32TimeoutMS_);
191 return reinterpret_cast<void*
>(uAddr);
205 return reinterpret_cast<void*
>(uAddr);
216 void CopyData(
const void* src_,
void* dst_, uint16_t len_)
218 auto* u8Src =
reinterpret_cast<const uint8_t*
>(src_);
219 auto* u8Dst =
reinterpret_cast<uint8_t*
>(dst_);
220 while (len_--) { *u8Dst++ = *u8Src++; }
280 bool Send_i(
const void* pvData_,
bool bTail_, uint32_t u32TimeoutMS_);
291 bool Receive_i(
void* pvData_,
bool bTail_, uint32_t u32WaitTimeMS_);
uint16_t m_u16Count
Count of items in the mailbox.
Semaphore Blocking Object class declarations.
void * GetHeadPointer(void)
GetHeadPointer Return a pointer to the current head of the mailbox's internal circular buffer...
Basic data type primatives used throughout the OS.
void * GetTailPointer(void)
GetTailPointer Return a pointer to the current tail of the mailbox's internal circular buffer...
void MoveHeadForward(void)
MoveHeadForward Move the head index forward one element.
Thread porting interface.
void Init(void *pvBuffer_, uint16_t u16BufferSize_, uint16_t u16ElementSize_)
Init Initialize the mailbox object prior to its use. This must be called before any calls can be made...
uint16_t GetFreeSlots(void)
#define K_ADDR
Size of an address (pointer size)
void CopyData(const void *src_, void *dst_, uint16_t len_)
CopyData Perform a direct byte-copy from a source to a destination object.
the Semaphore class provides Binary & Counting semaphore objects, based on BlockingObject base class...
void MoveHeadBackward(void)
MoveHeadBackward Move the head index backward one element.
void Receive(void *pvData_)
Receive Read one envelope from the head of the mailbox. If the mailbox is currently empty...
bool Receive_i(void *pvData_, bool bTail_, uint32_t u32WaitTimeMS_)
Receive_i Internal method which implements all Read() methods in the class.
Semaphore m_clSendSem
Binary semaphore for send-blocked threads.
Mark3 Kernel Configuration This file is used to configure the kernel for your specific application in...
bool SendTail(void *pvData_)
SendTail Send an envelope to the mailbox. This safely copies the data contents of the datastructure t...
void MoveTailForward(void)
MoveTailForward Move the tail index forward one element.
uint16_t m_u16Tail
Current tail index.
volatile uint16_t m_u16Free
Current number of free slots in the mailbox.
Semaphore m_clRecvSem
Counting semaphore used to synchronize threads on the object.
uint16_t m_u16Head
Current head index.
void MoveTailBackward(void)
MoveTailBackward Move the tail index backward one element.
The CriticalGuard class. This class provides an implemention of RAII for critical sections...
The Mailbox class. This class implements an IPC mechnism based on sending/receiving envelopes contain...
bool Send_i(const void *pvData_, bool bTail_, uint32_t u32TimeoutMS_)
Send_i Internal method which implements all Send() methods in the class.
const void * m_pvBuffer
Pointer to the data-buffer managed by this mailbox.
bool Send(void *pvData_)
Send Send an envelope to the mailbox. This safely copies the data contents of the datastructure to th...
uint16_t m_u16ElementSize
Size of the objects tracked in this mailbox.
void ReceiveTail(void *pvData_)
ReceiveTail Read one envelope from the tail of the mailbox. If the mailbox is currently empty...