ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
book_stream_internal.h
Go to the documentation of this file.
1
13#pragma once
14
15#include "book_stream.h"
16#include "ra8_attributes.h"
17
44
56
69
76
92RA8_INTERNAL static inline uint16_t internal_book_stream_le16(const uint8_t* p)
93{
94 return (uint16_t)((uint16_t)p[0] | ((uint16_t)p[1] << k_stream_bits_per_byte));
95}
96
112RA8_INTERNAL static inline uint32_t internal_book_stream_le32(const uint8_t* p)
113{
114 return (uint32_t)p[0] | ((uint32_t)p[1] << k_stream_bits_per_byte) |
115 ((uint32_t)p[2] << (2U * k_stream_bits_per_byte)) |
116 ((uint32_t)p[3] << k_stream_le_shift_3);
117}
118
128
146
164
181
201 uint64_t off,
202 uint8_t* dst,
203 uint32_t len);
204
222
238
256 const uint8_t* rec,
257 uint32_t* attr_cursor);
258
275
Strict, zero-allocation validation of a streamed RABOOK1 flat blob.
ra8_err_t(* book_stream_read_fn)(void *ctx, uint64_t offset, uint8_t *dst, uint32_t len)
Exact random-read callback over an inflated RABOOK1 flat blob.
Definition book_stream.h:38
stream_image_off_t
Wire offsets inside a 24-byte image descriptor.
@ k_stream_image_raw_size
Decoded payload-size field.
@ k_stream_image_pixfmt
Raster pixel-format offset.
@ k_stream_image_data_off
Payload-relative offset field.
@ k_stream_image_format
Image-kind byte offset.
@ k_stream_image_width
Raster-width field offset.
@ k_stream_image_reserved
Reserved-zero field offset.
@ k_stream_image_height
Raster-height field offset.
@ k_stream_image_id
Image-id string offset.
@ k_stream_image_data_size
Stored payload-size field.
static uint32_t internal_book_stream_le32(const uint8_t *p)
Decode one little-endian 32-bit field from unaligned bytes.
ra8_err_t priv_book_stream_validate_text(const stream_validate_t *ctx, const uint8_t *rec)
Validate one text node's element-only fields and string reference.
ra8_err_t priv_book_stream_validate_string_envelope(const stream_validate_t *ctx)
Validate the string pool's leading and trailing NUL sentinels.
stream_header_off_t
Wire offsets inside the fixed 100-byte RABOOK1 header.
@ k_stream_hdr_style_count
Stylesheet-table count field.
@ k_stream_hdr_chapter_count
Chapter-table count field.
@ k_stream_hdr_pool_off
Image-payload pool offset.
@ k_stream_hdr_node_count
DOM-node table count field.
@ k_stream_hdr_image_count
Image-table count field.
@ k_stream_hdr_string_size
Interned-string pool size.
@ k_stream_hdr_title
Title string-offset field.
@ k_stream_hdr_cover
Cover-image index field.
@ k_stream_hdr_attr_count
Attribute-table count field.
@ k_stream_hdr_total
Total-size field byte offset.
@ k_stream_hdr_string_off
Interned-string pool offset.
@ k_stream_hdr_version
Format-version field byte offset.
@ k_stream_hdr_identifier
Identifier string-offset field.
@ k_stream_hdr_crc
Body CRC-32 field byte offset.
@ k_stream_hdr_flags
Feature-flags field byte offset.
@ k_stream_hdr_image_off
Image-table byte offset.
@ k_stream_hdr_node_off
DOM-node table byte offset.
@ k_stream_hdr_author
Author string-offset field.
@ k_stream_hdr_style_off
Stylesheet-table byte offset.
@ k_stream_hdr_pool_size
Image-payload pool size.
@ k_stream_hdr_language
Language string-offset field.
@ k_stream_hdr_attr_off
Attribute-table byte offset.
@ k_stream_hdr_chapter_off
Chapter-table byte offset.
static uint16_t internal_book_stream_le16(const uint8_t *p)
Decode one little-endian 16-bit field from unaligned bytes.
ra8_err_t priv_book_stream_validate_element(const stream_validate_t *ctx, const uint8_t *rec, uint32_t *attr_cursor)
Validate one element node and its canonical attribute span.
stream_bit_t
Bit geometry shared by wire decoding and the node ownership map.
@ k_stream_bits_per_byte
Bits represented by one byte.
@ k_stream_le_shift_3
Shift of byte three in a uint32.
@ k_stream_mark_round
Ceiling-division numerator bias.
ra8_err_t priv_book_stream_nonempty_string_ref(const stream_validate_t *ctx, uint32_t off)
Require a string reference to name a non-empty interned string.
ra8_err_t priv_book_stream_validate_styles(const stream_validate_t *ctx)
Validate every stylesheet source and optional chapter scope.
stream_node_off_t
Wire offsets inside a 24-byte DOM node record.
@ k_stream_node_kind
Node-kind byte offset.
@ k_stream_node_reserved
Reserved-zero byte offset.
@ k_stream_node_first_child
First-child node index field.
@ k_stream_node_name
Element-name string offset.
@ k_stream_node_first_attr
First-attribute index field.
@ k_stream_node_text
Text string-offset field.
@ k_stream_node_attr_count
Attribute-count field offset.
@ k_stream_node_next_sibling
Next-sibling node index field.
ra8_err_t priv_book_stream_read_validate_header(stream_validate_t *ctx)
Read, decode, and validate the canonical stream header and layout.
ra8_err_t priv_book_stream_read(const stream_validate_t *ctx, uint64_t off, uint8_t *dst, uint32_t len)
Read one exact, bounded source span.
ra8_err_t priv_book_stream_string_ref(const stream_validate_t *ctx, uint32_t off)
Require a referenced offset to name an interned-string boundary.
ra8_err_t priv_book_stream_validate_metadata(const stream_validate_t *ctx)
Validate metadata string references and the optional cover index.
Definition book_stream.c:38
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Fixed 100-byte prologue describing every table and pool in the blob.
Definition book.h:246
Immutable validation state shared by the bounded table passes.
uint8_t * scratch
Caller transfer buffer.
uint32_t scratch_cap
Transfer-buffer capacity.
void * read_ctx
Callback context.
book_header_t hdr
Decoded host-order header.
uint64_t source_size
Exact flat-source byte size.
book_stream_read_fn read
Exact source callback.