|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Production adapter binding the import seam to the real compiler (#151). More...
#include <stddef.h>#include <stdint.h>#include "epub.h"#include "ra8_dual_core_job.h"#include "ra8_err.h"#include "ra8_fs.h"#include "ra8_rabook_pipeline.h"#include "ra8_vmem.h"Go to the source code of this file.
Data Structures | |
| struct | rabook_import_compiler_ctx_t |
| Cookie carrying the storage rabook_import_compile_adapter needs. More... | |
| struct | rabook_import_compiler_m33_ctx_t |
| Cookie for rabook_import_compile_adapter_m33 (the M33-offload binding). More... | |
Functions | |
| ra8_err_t | rabook_import_compile_adapter (void *compile_ctx, ra8_fs_mount_t *mount, const char *epub_path, const char *out_path) |
Import-seam adapter: stream a .epub off mount and compile it. | |
| ra8_err_t | rabook_import_compile_adapter_m33 (void *compile_ctx, ra8_fs_mount_t *mount, const char *epub_path, const char *out_path) |
| Import-seam adapter that offloads the compile to the Cortex-M33 (#149). | |
Production adapter binding the import seam to the real compiler (#151).
rabook_import.h keeps the cache manager decoupled from the EPUB parser and the RABOOK1 emitter by reaching the compile step through the injected rabook_import_compile_fn seam. This adapter is the production binding of that seam: it STREAMS the source .epub off the filesystem through a bounded ra8_vmem page cache (#230 – no whole-file load buffer, so a source far larger than RAM compiles inside a fixed frame-pool budget), drives rabook_compile_from_epub, and closes the book – matching the seam's exact signature so an app passes rabook_import_compile_adapter (with a rabook_import_compiler_ctx_t cookie) straight into rabook_import_cfg_t.
Host tests bypass this adapter entirely with a lightweight compile spy, which is the whole point of the seam – they need neither the parser nor the multi-megabyte builder arenas.
[Ring 4 / EPUB Import] {World: NS}
Definition in file rabook_import_compiler.h.
|
nodiscard |
Import-seam adapter: stream a .epub off mount and compile it.
Signature matches rabook_import_compile_fn. Opens the source file, fronts it with the cookie's bounded ra8_vmem page cache, opens the book with epub_open_streamed (no whole-file residency, #230), runs rabook_compile_from_epub to out_path, and closes the book and the source file on every path.
| [in] | compile_ctx | Pointer to a rabook_import_compiler_ctx_t. |
| [in,out] | mount | Mounted volume holding the source and the output. |
| [in] | epub_path | Root-level path of the source .epub. |
| [in] | out_path | Path to write the RABOOK1 body to (the importer's temp name). |
| k_ra8_ok | Book compiled and written to out_path. |
| k_ra8_err_null_ptr | A required pointer (incl. a cookie field) is NULL. |
| k_ra8_err_* | Propagated open / cache-bind / compile error. |
compile_ctx points at a fully-populated cookie. mount, epub_path, and out_path are non-NULL. out_path holds a valid RABOOK1 blob and the book is closed. Definition at line 213 of file rabook_import_compiler.c.
References rabook_import_compiler_ctx_t::bufs, rabook_import_compiler_ctx_t::epub, epub_close(), import_stream_t::file, internal_stream_open(), k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_fs_close(), rabook_compile_from_epub(), s_tag, and rabook_import_compiler_ctx_t::scr.
Referenced by imp_make_cfg(), and internal_fallback_or_propagate().
|
nodiscard |
Import-seam adapter that offloads the compile to the Cortex-M33 (#149).
Signature matches rabook_import_compile_fn. Reads the source .epub off mount, dispatches the compile to the secondary core via the cookie's ra8_dual_core_compile_dispatch_fn, validates the returned blob with book_validate, then writes it to out_path (the manager renames it into the cache). The M85 owns the filesystem; the M33 only produces the blob in shared memory.
If the offload fails with a TIMEOUT/FAULT (k_ra8_err_hw_error) or a transport overflow (k_ra8_err_no_mem) and the cookie carries a rabook_import_compiler_ctx_t.fallback, the compile is retried IN-CORE so a transient secondary-core failure never fails the import. A clean offload result is used directly; other errors propagate.
| [in] | compile_ctx | Pointer to a rabook_import_compiler_m33_ctx_t. |
| [in,out] | mount | Mounted volume holding the source and the output. |
| [in] | epub_path | Root-level path of the source .epub. |
| [in] | out_path | Path to write the RABOOK1 body to (importer temp name). |
| k_ra8_ok | Blob produced (on the M33, or in-core on fallback), validated, and written to out_path. |
| k_ra8_err_null_ptr | A required pointer (incl. a cookie field) is NULL. |
| k_ra8_err_* | Propagated read / dispatch / validate / write error (the in-core fallback error when that path is taken). |
compile_ctx points at a fully-populated cookie with a non-NULL dispatch. mount, epub_path, and out_path are non-NULL. out_path holds a book_validate-clean RABOOK1 blob. out_path is not written.Definition at line 450 of file rabook_import_compiler.c.
References rabook_import_compiler_m33_ctx_t::dispatch, rabook_import_compiler_m33_ctx_t::epub_load_buf, rabook_import_compiler_m33_ctx_t::epub_load_cap, internal_fallback_or_propagate(), internal_offload_or_fallback(), internal_read_whole_file(), k_ra8_ok, RA8_CHECK_NULL_PTR, and s_tag.