|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Checked split-region planning for reader_vmem cache RAM. More...
Go to the source code of this file.
Functions | |
| static RA8_INTERNAL bool | internal_size_mul (size_t left, size_t right, size_t *result) |
| Multiply two sizes without wrapping. | |
| static RA8_INTERNAL bool | internal_region (size_t cursor, size_t bytes, size_t *offset, size_t *next) |
| Place one maximally aligned region after a prior high-water. | |
| bool | priv_rv_workspace_require (uint32_t budget, rv_workspace_need_t *need) |
| Query exact split-region requirements for one frame budget. | |
| static RA8_INTERNAL bool | internal_region_valid (size_t offset, size_t bytes, size_t total) |
| Check one region lies wholly inside a workspace high-water. | |
| bool | priv_rv_workspace_bind (void *backing, size_t backing_bytes, const rv_workspace_need_t *need, rv_workspace_t *workspace) |
| Bind typed cache views into an aligned caller-owned backing. | |
Checked split-region planning for reader_vmem cache RAM.
The planner has no storage ownership and no process-global state. Distinct callers may bind distinct backings concurrently; the standalone CLI chooses one explicit composition-root BSS backing for its single cache instance.
Definition in file reader_vmem_workspace.c.
|
static |
Place one maximally aligned region after a prior high-water.
Computes bounded padding, aligned start, and next high-water without overflow.
| [in] | cursor | Previous one-past high-water offset. |
| [in] | bytes | Region byte count. |
| [out] | offset | Receives aligned region start. |
| [out] | next | Receives one-past region end. |
| true | Outputs describe a complete aligned region. |
| false | Padding or end arithmetic would overflow. |
offset and next are non-null and writable. Definition at line 62 of file reader_vmem_workspace.c.
References RA8_INTERNAL.
Referenced by priv_rv_workspace_require().
|
static |
Check one region lies wholly inside a workspace high-water.
Uses subtractive bounds checks and enforces maximum alignment.
| [in] | offset | Region start relative to backing. |
| [in] | bytes | Region byte count. |
| [in] | total | Workspace high-water byte count. |
| true | Region fits within [0,total) or is a valid empty endpoint. |
| false | Offset, length, or alignment is invalid. |
Definition at line 115 of file reader_vmem_workspace.c.
References RA8_INTERNAL.
Referenced by priv_rv_workspace_bind().
|
static |
Multiply two sizes without wrapping.
Performs the division guard before the only multiplication.
| [in] | left | First factor. |
| [in] | right | Second factor. |
| [out] | result | Receives the exact product on success. |
| true | Exact product was stored. |
| false | Product would overflow. |
result is non-null and writable. result exactly once. result unchanged. Definition at line 36 of file reader_vmem_workspace.c.
References RA8_INTERNAL.
Referenced by priv_rv_workspace_require().
|
nodiscard |
Bind typed cache views into an aligned caller-owned backing.
Definition at line 121 of file reader_vmem_workspace.c.
References rv_workspace_need_t::bucket_bytes, rv_workspace_need_t::bucket_offset, rv_workspace_need_t::frame_bytes, rv_workspace_need_t::frame_offset, internal_region_valid(), rv_workspace_need_t::key_bytes, rv_workspace_need_t::key_offset, rv_workspace_need_t::meta_bytes, rv_workspace_need_t::meta_offset, and rv_workspace_need_t::total_bytes.
Referenced by internal_prepare().
|
nodiscard |
Query exact split-region requirements for one frame budget.
Definition at line 75 of file reader_vmem_workspace.c.
References rv_workspace_need_t::bucket_bytes, rv_workspace_need_t::bucket_offset, rv_workspace_need_t::frame_bytes, rv_workspace_need_t::frame_offset, internal_region(), internal_size_mul(), k_rv_bucket_count, k_rv_frame_bytes, rv_workspace_need_t::key_bytes, rv_workspace_need_t::key_offset, rv_workspace_need_t::meta_bytes, rv_workspace_need_t::meta_offset, and rv_workspace_need_t::total_bytes.
Referenced by internal_prepare().