|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Init-time bump arena – carves per-tier slab backing, zero-heap. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_arena_t |
| Caller-owned bump-arena state over one tier region. More... | |
Functions | |
| ra8_err_t | ra8_arena_init (ra8_arena_t *arena, void *base, uint32_t size) |
| Bind a bump arena over a caller-owned tier region. | |
| ra8_err_t | ra8_arena_carve (ra8_arena_t *arena, uint32_t bytes, uint32_t align, void **out_ptr) |
| Carve an aligned sub-block from the arena (bump; no free). | |
| ra8_err_t | ra8_arena_remaining (const ra8_arena_t *arena, uint32_t *out_remaining) |
| Report the bytes still available in the arena. | |
Init-time bump arena – carves per-tier slab backing, zero-heap.
Layer 0 of the #147 memory hierarchy, paired with ::ra8_slab. An arena owns one contiguous memory region of a single tier (DTCM, SRAM, or SDRAM) and hands out aligned sub-blocks by bumping a high-water mark. It is an init-time API: there is no free – you carve all the slab backing (and any other fixed buffers) once during bring-up, then never allocate again (NASA Power-of-10 Rule 3). The remaining-bytes query lets the bring-up code fail fast if the budget is over-subscribed.
Definition in file ra8_arena.h.
|
nodiscard |
Carve an aligned sub-block from the arena (bump; no free).
| [in] | arena | Initialised arena. |
| [in] | bytes | Block size to carve (> 0). |
| [in] | align | Required alignment in bytes (a power of two, >= 1). |
| [out] | out_ptr | Receives the aligned block pointer on success. |
| k_ra8_ok | Block carved; *out_ptr set. |
| k_ra8_err_null_ptr | arena or out_ptr was NULL. |
| k_ra8_err_invalid_size | bytes was zero. |
| k_ra8_err_invalid_arg | align was zero or not a power of two. |
| k_ra8_err_no_mem | The aligned block does not fit the remainder. |
Definition at line 69 of file ra8_arena.c.
References ra8_arena_t::base, internal_is_pow2(), k_ra8_err_invalid_arg, k_ra8_err_invalid_size, k_ra8_err_no_mem, k_ra8_ok, RA8_CHECK_NULL_PTR, s_tag, ra8_arena_t::size, and ra8_arena_t::used.
Referenced by mem_run_arena().
|
nodiscard |
Bind a bump arena over a caller-owned tier region.
| [out] | arena | Arena state to populate (zero-initialised by caller). |
| [in] | base | First byte of the region (out-lives the arena). |
| [in] | size | Region length in bytes. |
| k_ra8_ok | Arena ready (empty). |
| k_ra8_err_null_ptr | arena or base was NULL. |
| k_ra8_err_invalid_size | size was zero. |
Definition at line 56 of file ra8_arena.c.
References ra8_arena_t::base, k_ra8_err_invalid_size, k_ra8_ok, RA8_CHECK_NULL_PTR, s_tag, ra8_arena_t::size, and ra8_arena_t::used.
Referenced by mem_run_arena().
|
nodiscard |
Report the bytes still available in the arena.
| [in] | arena | Initialised arena. |
| [out] | out_remaining | Receives size - used. |
| k_ra8_ok | Remaining bytes reported. |
| k_ra8_err_null_ptr | arena or out_remaining was NULL. |
Definition at line 94 of file ra8_arena.c.
References k_ra8_ok, RA8_CHECK_NULL_PTR, s_tag, ra8_arena_t::size, and ra8_arena_t::used.
Referenced by mem_run_arena().