ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_mdl_storage_ram.h File Reference

Caller-buffer transaction adapter for verified C6 media sources. More...

#include <stddef.h>
#include <stdint.h>
#include "ra8_c6link_mdl_transfer.h"
#include "ra8_err.h"
Include dependency graph for ra8_mdl_storage_ram.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_mdl_storage_ram_t
 Mutable transaction over one caller-owned destination span. More...

Functions

ra8_err_t ra8_mdl_storage_ram_init (ra8_mdl_storage_ram_t *storage, ra8_mdl_storage_iface_t *output, uint8_t *data, size_t capacity)
 Bind a caller buffer as one transactional media destination.
ra8_err_t ra8_mdl_storage_ram_view (const ra8_mdl_storage_ram_t *storage, const uint8_t **data, size_t *length)
 Expose the complete committed source as an immutable byte view.

Detailed Description

Caller-buffer transaction adapter for verified C6 media sources.

Tag
[Ring 4 / PAL] {World: NS}

Binds ra8_mdl_storage_iface_t to one caller-owned byte span. Downloaded source bytes stay private until commit, then become available through a read-only view. Abort discards the logical extent. This adapter is intended for bounded source material that the RA8 will transform before publishing; it owns no heap, filesystem, transport, or static workspace.

Since
0.1.0

Definition in file ra8_mdl_storage_ram.h.

Function Documentation

◆ ra8_mdl_storage_ram_init()

ra8_err_t ra8_mdl_storage_ram_init ( ra8_mdl_storage_ram_t * storage,
ra8_mdl_storage_iface_t * output,
uint8_t * data,
size_t capacity )
nodiscard

Bind a caller buffer as one transactional media destination.

Parameters
[out]storageCaller-owned adapter state.
[out]outputBound coordinator interface.
[in,out]dataWritable source-buffer backing.
[in]capacityBacking capacity in bytes.
Returns
Initialization status.
Return values
k_ra8_okThe idle adapter and complete interface are ready.
k_ra8_err_null_ptrA required pointer is NULL.
k_ra8_err_invalid_sizecapacity is zero.
Precondition
data spans capacity writable bytes.
No transfer is using storage or data.
Postcondition
Success leaves zero committed bytes and every interface callback bound.
Failure leaves output unchanged.
Note
Not thread-safe; one context serves one transfer at a time.
Since
0.1.0

Definition at line 164 of file ra8_mdl_storage_ram.c.

References internal_ram_abort(), internal_ram_begin(), internal_ram_commit(), internal_ram_write(), k_ra8_err_invalid_size, k_ra8_err_null_ptr, and k_ra8_ok.

Referenced by priv_media_download_image_run().

◆ ra8_mdl_storage_ram_view()

ra8_err_t ra8_mdl_storage_ram_view ( const ra8_mdl_storage_ram_t * storage,
const uint8_t ** data,
size_t * length )
nodiscard

Expose the complete committed source as an immutable byte view.

Parameters
[in]storageInitialized adapter state.
[out]dataReceives the first committed byte.
[out]lengthReceives the exact committed byte count.
Returns
View status.
Return values
k_ra8_okA nonempty committed view was returned.
k_ra8_err_null_ptrA required pointer is NULL.
k_ra8_err_invalid_stateNo completed transaction is committed.
Precondition
storage is not concurrently mutated by a transfer.
Output pointers are writable.
Postcondition
Success returns a view wholly inside the initialized backing span.
Failure leaves both outputs unchanged.
Note
The view remains valid until the next successful begin or reinitialize.
Since
0.1.0

Definition at line 188 of file ra8_mdl_storage_ram.c.

References ra8_mdl_storage_ram_t::active, ra8_mdl_storage_ram_t::committed, ra8_mdl_storage_ram_t::data, k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, and ra8_mdl_storage_ram_t::length.

Referenced by internal_format().