ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
reflow_cache.h
Go to the documentation of this file.
1
60
61#pragma once
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67#include <stddef.h>
68#include <stdint.h>
69
70#include "ra8_err.h"
71#include "reflow.h"
72
73/* ===========================================================================
74 * Format identity
75 * ===========================================================================
76 */
77
88typedef enum : uint32_t {
89 k_reflow_cache_magic = 0x52464331U,
92
110
111/* ===========================================================================
112 * Public API
113 * ===========================================================================
114 */
115
141[[nodiscard]] ra8_err_t reflow_cache_size(const reflow_t* engine, size_t* out_bytes);
142
180[[nodiscard]] ra8_err_t reflow_cache_serialize(const reflow_t* engine,
181 const uint8_t* content,
182 size_t content_len,
183 uint8_t* out_buf,
184 size_t out_cap,
185 size_t* out_len);
186
231[[nodiscard]] ra8_err_t reflow_cache_load(reflow_t* engine,
232 const uint8_t* content,
233 size_t content_len,
234 const uint8_t* buf,
235 size_t len);
236
237#ifdef __cplusplus
238}
239#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
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_err_t reflow_cache_size(const reflow_t *engine, size_t *out_bytes)
Report the exact serialised size of an engine's current layout.
reflow_cache_layout_t
Byte sizes of the serialised header and per-record payloads.
@ k_reflow_cache_page_bytes
Serialised bytes per page.
@ k_reflow_cache_glyph_bytes
Serialised bytes per glyph.
@ k_reflow_cache_header_bytes
Fixed header size, bytes.
ra8_err_t reflow_cache_serialize(const reflow_t *engine, const uint8_t *content, size_t content_len, uint8_t *out_buf, size_t out_cap, size_t *out_len)
Serialise the laid-out pages of engine into a keyed byte blob.
ra8_err_t reflow_cache_load(reflow_t *engine, const uint8_t *content, size_t content_len, const uint8_t *buf, size_t len)
Validate a cache blob and, if it matches, restore the layout.
reflow_cache_id_t
On-wire format identity for a serialised pagination cache.
@ k_reflow_cache_magic
Blob magic ('R''F''C''1').
@ k_reflow_cache_version
Serialised format version.
Reflow / pagination engine state.