ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
rabook_import.h
Go to the documentation of this file.
1
48#pragma once
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#include <stdint.h>
55
56#include "ra8_err.h"
57#include "ra8_fs.h"
58
75
84typedef enum : uint32_t {
87
97
113typedef struct {
114 uint32_t magic;
115 uint32_t format_version;
117 uint32_t source_size;
118 uint32_t source_crc32;
120
121static_assert(sizeof(rabook_import_stamp_t) == (uint32_t)k_rabook_import_stamp_bytes,
122 "import stamp layout pinned");
123
143typedef ra8_err_t (*rabook_import_compile_fn)(void* compile_ctx,
144 ra8_fs_mount_t* mount,
145 const char* epub_path,
146 const char* out_path);
147
171
219[[nodiscard]] ra8_err_t rabook_import_open(const rabook_import_cfg_t* cfg,
220 const char* epub_path,
221 char* out_cache_path,
222 uint32_t cache_path_cap,
223 rabook_import_outcome_t* out_outcome);
224
225#ifdef __cplusplus
226}
227#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
rabook_import_size_t
Fixed sizing constants for the cache-name layout.
@ k_rabook_import_name_cap
Cache/temp/marker name buffer bytes incl.
@ k_rabook_import_stamp_bytes
Pinned size of the freshness stamp.
rabook_import_outcome_t
How rabook_import_open satisfied the request.
@ k_rabook_import_hit
Fresh cache reused; the compiler was NOT invoked.
@ k_rabook_import_compiled
Miss/stale; the book was compiled and cached.
ra8_err_t(* rabook_import_compile_fn)(void *compile_ctx, ra8_fs_mount_t *mount, const char *epub_path, const char *out_path)
Dependency-injection seam: compile one EPUB into a .rabook blob.
rabook_import_magic_t
Sentinel stamped into the freshness marker so a stray file is rejected.
@ k_rabook_import_stamp_magic
Importer marker tag "RBK1".
ra8_err_t rabook_import_open(const rabook_import_cfg_t *cfg, const char *epub_path, char *out_cache_path, uint32_t cache_path_cap, rabook_import_outcome_t *out_outcome)
Resolve a source .epub to a fresh cached .rabook, compiling once.
Cached parse of one mounted FAT volume.
Injected dependencies + versioning for rabook_import_open.
uint32_t scratch_cap
Capacity of scratch in bytes.
ra8_fs_mount_t * mount
Mounted FAT volume (cache + source).
void * compile_ctx
Cookie forwarded to compile.
rabook_import_compile_fn compile
Compile-on-miss seam (non-NULL).
uint32_t format_version
.rabook format version stamp.
uint8_t * scratch
Streaming buffer for the source CRC.
uint32_t importer_version
Importer/compiler version stamp.
Body of the sidecar freshness marker (<name>.rabook.mrk).
uint32_t format_version
.rabook (RABOOK1) on-disk layout revision.
uint32_t importer_version
Compiler/importer stamp; bump to invalidate.
uint32_t source_size
Byte length of the source .epub.
uint32_t magic
k_rabook_import_stamp_magic.
uint32_t source_crc32
CRC-32/ISO-HDLC of the source .epub bytes.