Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions erpc_c/setup/erpc_setup_mbf_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

using namespace erpc;

#define ERPC_BUFFER_SIZE_UINT8 ((ERPC_DEFAULT_BUFFER_SIZE + sizeof(uint64_t) - 1))
#define ERPC_BUFFER_SIZE_UINT64 (ERPC_BUFFER_SIZE_UINT8 / sizeof(uint64_t))
#define ERPC_BUFFER_SIZE_UINT64 \
((ERPC_DEFAULT_BUFFER_SIZE + sizeof(uint64_t) - 1) / sizeof(uint64_t))

////////////////////////////////////////////////////////////////////////////////
// Classes
Expand All @@ -43,8 +43,8 @@ class StaticMessageBufferFactory : public MessageBufferFactory
: m_semaphore(1)
#endif
{
(void)memset(m_freeBufferBitmap, 0xff, ERPC_DEFAULT_BUFFERS_COUNT >> 3);
(void)memset(m_buffers, 0, ERPC_DEFAULT_BUFFERS_COUNT * ERPC_BUFFER_SIZE_UINT8);
(void)memset(m_freeBufferBitmap, 0xff, sizeof(m_freeBufferBitmap));
(void)memset(m_buffers, 0, sizeof(m_buffers));
}

/*!
Expand Down Expand Up @@ -112,8 +112,12 @@ class StaticMessageBufferFactory : public MessageBufferFactory
}

protected:
uint8_t m_freeBufferBitmap[(ERPC_DEFAULT_BUFFERS_COUNT >> 3U) + 1U]; /*!< Bitmat of used/not used buffers. */
uint64_t m_buffers[ERPC_DEFAULT_BUFFERS_COUNT][ERPC_BUFFER_SIZE_UINT64]; /*!< Static buffers. */
//! Bitmap representing which buffers are in use. A bit value of 1 means free and 0 means in
//! use.
uint8_t m_freeBufferBitmap[(ERPC_DEFAULT_BUFFERS_COUNT >> 3U) +
(ERPC_DEFAULT_BUFFERS_COUNT % 8 ? 1U : 0U)];
//! Static buffers
uint64_t m_buffers[ERPC_DEFAULT_BUFFERS_COUNT][ERPC_BUFFER_SIZE_UINT64];
#if !ERPC_THREADS_IS(NONE)
Semaphore m_semaphore; /*!< Semaphore.*/
#endif
Expand Down