ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
book_paged.h
Go to the documentation of this file.
1
35#pragma once
36
37#include <stddef.h>
38#include <stdint.h>
39
40#include "book.h"
41#include "ra8_err.h"
42#include "ra8_vmem.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
69typedef struct {
70 const uint8_t* base;
72 uint32_t object_id;
73 uint32_t frame_bytes;
74 uint32_t size;
77
103[[nodiscard]] ra8_err_t book_src_resident(book_src_t* out, const void* base, uint32_t size);
104
135[[nodiscard]] ra8_err_t book_src_paged(book_src_t* out,
136 ra8_vmem_t* vm,
137 uint32_t object_id,
138 uint32_t frame_bytes,
139 uint32_t size);
140
171[[nodiscard]] ra8_err_t book_src_read(const book_src_t* src, uint32_t off, void* dst, uint32_t len);
172
205[[nodiscard]] ra8_err_t book_src_image(const book_src_t* src, uint32_t idx, book_image_t* out_img);
206
264[[nodiscard]] ra8_err_t book_src_image_rect(const book_src_t* src,
265 const book_image_t* img,
266 uint32_t x,
267 uint32_t y,
268 uint32_t w,
269 uint32_t h,
270 uint8_t* out,
271 uint32_t out_stride);
272
307[[nodiscard]] ra8_err_t book_chapter_text_src(const book_src_t* src,
308 uint32_t chapter_idx,
309 char* out,
310 size_t cap,
311 size_t* out_len);
312
353[[nodiscard]] ra8_err_t book_src_prefetch_chapter(const book_src_t* src, uint32_t chapter_idx);
354
355#ifdef __cplusplus
356}
357#endif
Flat, execute-in-place container for a build-time "compiled" e-book.
ra8_err_t book_src_paged(book_src_t *out, ra8_vmem_t *vm, uint32_t object_id, uint32_t frame_bytes, uint32_t size)
Bind a paged book source over an ra8_vmem cache + ra8_vsource object.
Definition book_paged.c:61
ra8_err_t book_src_image_rect(const book_src_t *src, const book_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *out, uint32_t out_stride)
Read a sub-rectangle of a raster image (4bpp or 8bpp) as gray8, row by row.
Definition book_paged.c:325
ra8_err_t book_src_prefetch_chapter(const book_src_t *src, uint32_t chapter_idx)
Warm the cache frame holding a chapter's first content bytes, without pinning it (single-threaded rea...
Definition book_paged.c:721
ra8_err_t book_src_resident(book_src_t *out, const void *base, uint32_t size)
Bind a resident (already-inflated, fully resident) book as a source.
Definition book_paged.c:45
ra8_err_t book_src_image(const book_src_t *src, uint32_t idx, book_image_t *out_img)
Read one image descriptor out of a book source (resident or paged).
Definition book_paged.c:314
ra8_err_t book_src_read(const book_src_t *src, uint32_t off, void *dst, uint32_t len)
Copy a byte range out of a book source (resident memcpy or paged fault).
Definition book_paged.c:141
ra8_err_t book_chapter_text_src(const book_src_t *src, uint32_t chapter_idx, char *out, size_t cap, size_t *out_len)
Extract one chapter's plain text from a book source (resident or paged).
Definition book_paged.c:681
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
Byte-range page cache with SLRU eviction (Layer 2, #147).
Fixed 100-byte prologue describing every table and pool in the blob.
Definition book.h:246
Descriptor for one transcoded image in the image pool.
Definition book.h:354
A book data source: resident (zero-copy) or paged (demand-fetched).
Definition book_paged.h:69
book_header_t hdr
Resident copy of the blob header.
Definition book_paged.h:75
uint32_t size
Total blob length in bytes.
Definition book_paged.h:74
const uint8_t * base
Resident blob base, or NULL in paged mode.
Definition book_paged.h:70
uint32_t frame_bytes
Paged: ra8_vmem frame size, for slice math.
Definition book_paged.h:73
ra8_vmem_t * vm
Paged page cache, or NULL in resident mode.
Definition book_paged.h:71
uint32_t object_id
Paged: the book's ra8_vsource object id.
Definition book_paged.h:72
Page-cache state (caller-owned; treat as private).
Definition ra8_vmem.h:179