What it does for you
Gives firmware predictable allocation and buffering behavior using storage the application provides, with diagnostics for high-water use, failed allocation attempts, and current pool or arena state.
Deterministic caller-owned memory helpers: fixed-block pools, scratch arenas, bounded ring buffers, mark/restore behavior, and allocation diagnostics without hidden heap use.
Gives firmware predictable allocation and buffering behavior using storage the application provides, with diagnostics for high-water use, failed allocation attempts, and current pool or arena state.
efl_memory.h and efl_memory.c implement fixed-block pools and scratch arenas. Ring Buffer currently lives under Utilities source, but belongs with bounded memory and buffer services.
Use it when parsers, request objects, byte streams, protocol buffers, or temporary workspaces need bounded behavior that can be validated on host and carried into embedded firmware.
Caller-owned storage tools for products that need deterministic allocation, scratch workspaces, and byte queues without hidden heap behavior.
EFL_MemoryBlockPoolInit(pool, storage, storageSize, blockSize, blockCount)Creates a fixed pool for objects like request records, packet descriptors, or command contexts.EFL_MemoryBlockPoolAcquire(pool, block)Gets one object slot without calling heap allocation or depending on RTOS memory pools.EFL_MemoryBlockPoolRelease(pool, block)Returns a completed object slot so it can be reused by the next request or packet.EFL_MemoryBlockPoolReset(pool)Clears all pool ownership during subsystem restart, test reset, or controlled fault recovery.EFL_MemoryBlockPoolGetDiagnostics(pool, diagnostics)Reports pool capacity, current use, high-water use, and allocation failures for sizing evidence.EFL_MemoryArenaInit(arena, storage, capacityBytes)Creates a scratch workspace for parsers, formatters, or temporary protocol work.EFL_MemoryArenaAllocate(arena, sizeBytes, alignmentBytes, block)Allocates aligned temporary storage for a parse tree, payload buffer, or generated response.EFL_MemoryArenaMark(arena, mark)Captures a rollback point before trying optional parsing or multi-step formatting.EFL_MemoryArenaRestore(arena, mark)Discards temporary allocations back to a known mark without walking individual objects.EFL_MemoryArenaReset(arena)Clears the whole scratch workspace after one command, file, packet, or transaction is complete.EFL_MemoryArenaGetDiagnostics(arena, diagnostics)Shows capacity, used bytes, high-water use, and allocation failures so teams can size the arena.RingBufferInit(rb, buffer, size)Creates a bounded byte queue for UART RX, socket fragments, command streams, or fixture traffic.RingBufferReset(rb)Flushes queued bytes after reconnect, protocol resync, or test setup.RingBufferLen(rb)Checks how much data is waiting before parsing a command or packet.RingBufferIsEmpty(rb)Lets a service loop skip parsing work when no bytes are available.RingBufferIsFull(rb)Detects backpressure or undersized buffers before dropping incoming traffic.RingBufferWrite(rb, data, len)Queues incoming bytes from an ISR handoff, UART driver, TCP socket, or test fixture.RingBufferRead(rb, data, len)Consumes bytes once a parser or protocol handler is ready to own them.RingBufferPeek(rb, data, len)Looks ahead for headers, delimiters, or packet lengths without removing bytes.RingBufferCmp(rb, data, len, rm)Checks whether the next bytes match an expected prompt, command, or terminator sequence.RingBufferCopy(rb, data, len, stpSeq, stpSeqLen)Copies a complete line or frame up to a stop sequence such as CR/LF or ETX.RingBufferUnitTest(void)Runs the built-in smoke test to prove wrap, read, write, compare, and copy behavior.