Commit Graph

4 Commits

Author SHA1 Message Date
Simon Glass
d387a08ee2 test: Add a way to printf() into a membuf
Add a membuf_printf() function which supports writing a formatted string
into a membuf.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 02:24:06 +01:00
Simon Glass
05990c1bb8 membuf: Add a function to set up a static membuf
Add a way to set up a membuf with some pre-loaded data, so it is
possible to read it out using membuf_readline(), etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-14 14:23:29 -06:00
Simon Glass
b5b151cfb5 membuf: Support a flag for being full
At present the membuf implementation wastes a slot in the fifo so it can
detect the difference between a full and an empty buffer.

Add the option of supporting a boolean flag, if desired. For now it is
off.

The code-size penalty is non-zero, but the space penalty is small and
could be reduced on 64-bit machines by using a u32 offset for head and
tail.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-25 16:39:57 -07:00
Simon Glass
1b920199d0 membuf: Add some tests
Add tests for the membuf implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-25 16:39:57 -07:00