|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Checkpointed allocation-free pseudo-text source for block sweeps. More...
Go to the source code of this file.
Enumerations | |
| enum | cbs_payload_limit_t : uint32_t { k_cbs_payload_checkpoint_bytes = 16384U , k_cbs_no_word = UINT32_MAX } |
| enum | cbs_payload_phase_t : uint8_t { k_cbs_phase_word = 0U , k_cbs_phase_dot , k_cbs_phase_newline , k_cbs_phase_space } |
| enum | cbs_payload_seed_t : uint64_t { k_cbs_payload_seed = 0x9E3779B97F4A7C15ULL } |
| enum | cbs_payload_shift_t : uint8_t { k_cbs_payload_shift_a = 13U , k_cbs_payload_shift_b = 7U , k_cbs_payload_shift_c = 17U } |
Functions | |
| static RA8_INTERNAL uint64_t | internal_payload_rng (uint64_t *state) |
| Advance the deterministic payload pseudo-random generator. | |
| static RA8_INTERNAL uint8_t | internal_payload_next (cbs_payload_state_t *state) |
| Emit one byte from the deterministic pseudo-text state machine. | |
| RA8_PRIV size_t | priv_payload_workspace_required (void) |
| Return exact workspace bytes required by the pseudo-text source index. | |
| RA8_PRIV int | priv_payload_init (cbs_payload_t *payload, void *workspace, size_t capacity) |
| Build the payload source index into caller-owned storage. | |
| RA8_PRIV ra8_err_t | priv_payload_read (void *ctx, uint64_t offset, uint8_t *buffer, uint32_t length) |
| Read exact historical pseudo-text bytes at any bounded offset. | |
Variables | |
| static const char *const | s_payload_words [] |
Checkpointed allocation-free pseudo-text source for block sweeps.
Generates repeatable prose bytes from serialized checkpoints so arbitrary reads regenerate at most one bounded checkpoint span.
[Ring 7 / Tooling] {World: NS}
Definition in file sweep_block_payload.c.
| enum cbs_payload_limit_t : uint32_t |
| Enumerator | |
|---|---|
| k_cbs_payload_checkpoint_bytes | Maximum seek regeneration. |
| k_cbs_no_word | Generator needs a new word. |
Definition at line 17 of file sweep_block_payload.c.
| enum cbs_payload_phase_t : uint8_t |
| Enumerator | |
|---|---|
| k_cbs_phase_word | Emit a word byte. |
| k_cbs_phase_dot | Emit a sentence period. |
| k_cbs_phase_newline | Emit a line break. |
| k_cbs_phase_space | Emit a word separator. |
Definition at line 22 of file sweep_block_payload.c.
| enum cbs_payload_seed_t : uint64_t |
| Enumerator | |
|---|---|
| k_cbs_payload_seed | Initial generator state. |
Definition at line 29 of file sweep_block_payload.c.
| enum cbs_payload_shift_t : uint8_t |
| Enumerator | |
|---|---|
| k_cbs_payload_shift_a | First xorshift distance. |
| k_cbs_payload_shift_b | Middle xorshift distance. |
| k_cbs_payload_shift_c | Final xorshift distance. |
Definition at line 33 of file sweep_block_payload.c.
|
static |
Emit one byte from the deterministic pseudo-text state machine.
Selects words through internal_payload_rng and inserts bounded spaces, periods, and newlines according to the sentence phase.
| [in,out] | state | Generator cursor to advance by one output byte. |
| other | ASCII word or separator byte. |
state is non-NULL and initialized from the payload seed. Definition at line 86 of file sweep_block_payload.c.
References internal_payload_rng(), k_cbs_no_word, k_cbs_phase_dot, k_cbs_phase_newline, k_cbs_phase_space, k_cbs_phase_word, k_cbs_words_per_dot, cbs_payload_state_t::phase, cbs_payload_state_t::rng, s_payload_words, cbs_payload_state_t::sentence_words, cbs_payload_state_t::word_index, and cbs_payload_state_t::word_offset.
Referenced by priv_payload_init(), and priv_payload_read().
|
static |
Advance the deterministic payload pseudo-random generator.
Applies the fixed xorshift sequence and stores the new state for reproducible word selection at every checkpoint.
| [in,out] | state | Non-zero generator state. |
| other | Deterministic next value in the xorshift sequence. |
state is non-NULL and points to writable storage. state is modified. Definition at line 61 of file sweep_block_payload.c.
References k_cbs_payload_shift_a, k_cbs_payload_shift_b, and k_cbs_payload_shift_c.
Referenced by internal_payload_next().
| RA8_PRIV int priv_payload_init | ( | cbs_payload_t * | payload, |
| void * | workspace, | ||
| size_t | capacity ) |
Build the payload source index into caller-owned storage.
Serializes deterministic generator state at each bounded seek span and initializes the sequential cursor at offset zero.
| [out] | payload | Payload binding to initialize. |
| [in,out] | workspace | Aligned caller-owned checkpoint storage. |
| [in] | capacity | Supplied workspace byte count. |
| 0 | payload is ready for exact reads. |
| 1 | A binding, alignment, or capacity check failed. |
payload and workspace are non-NULL. workspace is aligned for cbs_payload_state_t. Definition at line 132 of file sweep_block_payload.c.
References internal_payload_next(), k_cbs_no_word, k_cbs_payload_checkpoint_bytes, k_cbs_payload_seed, and priv_payload_workspace_required().
Referenced by cb_sweep_block().
| RA8_PRIV ra8_err_t priv_payload_read | ( | void * | ctx, |
| uint64_t | offset, | ||
| uint8_t * | buffer, | ||
| uint32_t | length ) |
Read exact historical pseudo-text bytes at any bounded offset.
Restores the nearest checkpoint when needed, regenerates at most one checkpoint span, and caches the resulting sequential cursor.
| [in,out] | ctx | Bound cbs_payload_t. |
| [in] | offset | Logical payload offset. |
| [out] | buffer | Destination buffer. |
| [in] | length | Exact byte count. |
| k_ra8_ok | The complete range was generated. |
| k_ra8_err_null_ptr | A required binding is NULL. |
| k_ra8_err_out_of_range | The requested range exceeds the fixed payload. |
buffer is writable for length bytes. ctx was initialized by priv_payload_init. buffer contains the deterministic historical bytes. Definition at line 158 of file sweep_block_payload.c.
References cbs_payload_t::checkpoint_count, cbs_payload_t::checkpoints, cbs_payload_t::cursor_offset, cbs_payload_t::cursor_state, internal_payload_next(), k_cbs_blob_bytes, k_cbs_payload_checkpoint_bytes, k_ra8_err_null_ptr, k_ra8_err_out_of_range, and k_ra8_ok.
Referenced by internal_execute().
| RA8_PRIV size_t priv_payload_workspace_required | ( | void | ) |
Return exact workspace bytes required by the pseudo-text source index.
Sizes one serialized generator checkpoint per bounded regeneration span.
| other | Non-zero fixed payload-index requirement. |
Definition at line 125 of file sweep_block_payload.c.
References k_cbs_blob_bytes, and k_cbs_payload_checkpoint_bytes.
Referenced by cb_sweep_block(), and priv_payload_init().
|
static |
Definition at line 39 of file sweep_block_payload.c.
Referenced by internal_payload_next().