|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Callback-driven, caller-workspace JOF inspection and reporting. More...
Go to the source code of this file.
Enumerations | |
| enum | fmt_text_const_t : uint32_t { k_fmt_text_dec_digits = 20U , k_fmt_text_hex_digits = 16U , k_fmt_text_hex_row = 16U , k_fmt_text_dec_radix = 10U , k_fmt_text_nibble = 4U , k_fmt_text_nibble_mask = 15U , k_fmt_text_max_rows = 4096U , k_fmt_text_col_width = 10U , k_fmt_text_ascii_low = 32U , k_fmt_text_ascii_high = 126U } |
| Text formatting constants. More... | |
Functions | |
| static ra8_err_t | internal_put (const ra8_fmt_sink_t *report, const uint8_t *bytes, size_t len) |
| Append a byte span to the report sink. | |
| static ra8_err_t | internal_text (const ra8_fmt_sink_t *report, const char *text) |
| Append a NUL-terminated literal to the report sink. | |
| static ra8_err_t | internal_char (const ra8_fmt_sink_t *report, char value) |
| Append one character. | |
| static ra8_err_t | internal_u64 (const ra8_fmt_sink_t *report, uint64_t value, uint32_t width) |
| Append an unsigned decimal with optional left padding. | |
| static ra8_err_t | internal_hex (const ra8_fmt_sink_t *report, uint64_t value, uint32_t width) |
| Append an uppercase hexadecimal value with zero padding. | |
| static ra8_err_t | internal_value_line (const ra8_fmt_sink_t *report, const char *label, uint64_t value, const char *suffix) |
| Emit one label/value decimal line. | |
| static ra8_err_t | internal_read_exact (const ra8_fmt_source_t *source, uint64_t offset, uint8_t *bytes, size_t len) |
| Read an exact source window. | |
| static ra8_err_t | internal_hex_dump_header (const ra8_fmt_sink_t *report, const char *label, uint64_t offset, size_t len) |
| Emit the label/length/offset header line for a hex/ASCII dump. | |
| static ra8_err_t | internal_hex_dump_row (const ra8_fmt_sink_t *report, uint64_t offset, const uint8_t *row, size_t count) |
| Render one already-loaded hex/ASCII row: offset, hex bytes, ASCII. | |
| static ra8_err_t | internal_hex_dump (const ra8_fmt_source_t *source, const ra8_fmt_sink_t *report, const char *label, uint64_t offset, size_t len) |
| Emit one labelled hex/ASCII source window. | |
| static ra8_err_t | internal_dimensions (const jof_info_t *info, const ra8_fmt_sink_t *report) |
| Emit image, tile, and grid dimensions in the legacy CLI layout. | |
| static ra8_err_t | internal_geometry (const ra8_fmt_source_t *source, const jof_info_t *info, const ra8_fmt_sink_t *report) |
| Emit parsed JOF geometry in the legacy CLI layout. | |
| static ra8_err_t | internal_table_row (const ra8_fmt_sink_t *report, uint32_t index, const jof_audit_record_t *record) |
| Render one audit-record row of the verbose per-tile table. | |
| static ra8_err_t | internal_table (const jof_audit_record_t *records, uint32_t count, const ra8_fmt_sink_t *report) |
| Emit the verbose per-tile table. | |
| ra8_err_t | ra8_fmt_jof_inspect_stream (const ra8_fmt_source_t *source, bool verbose, const ra8_fmt_jof_inspect_workspace_t *workspace, const ra8_fmt_sink_t *report) |
| Inspect one JOF source through callbacks and caller storage. | |
Callback-driven, caller-workspace JOF inspection and reporting.
Audits injected positioned-read sources with caller-owned records, tile, and scratch spans, then emits bounded deterministic report sections.
Definition in file ra8_fmt_stream_inspect.c.
| enum fmt_text_const_t : uint32_t |
Text formatting constants.
Definition at line 24 of file ra8_fmt_stream_inspect.c.
|
static |
Append one character.
Converts the character to one byte and delegates an exact one-byte span.
| [in] | report | Report sink. |
| [in] | value | Character byte. |
| k_ra8_ok | Sink accepted the character byte. |
| other | Injected sink rejected the byte. |
report and its callback are non-null. value is treated as one byte without locale conversion. Definition at line 100 of file ra8_fmt_stream_inspect.c.
References internal_put().
Referenced by internal_hex_dump_row(), internal_table_row(), and internal_u64().
|
static |
Emit image, tile, and grid dimensions in the legacy CLI layout.
Formats parsed dimensions in the exact established multi-line order.
| [in] | info | Parsed geometry. |
| [in] | report | Report sink. |
| k_ra8_ok | Every field was emitted. |
| other | First injected sink failure. |
info and report are non-null. Definition at line 394 of file ra8_fmt_stream_inspect.c.
References jof_info_t::height, internal_text(), internal_u64(), k_ra8_ok, jof_info_t::tile_cols, jof_info_t::tile_h, jof_info_t::tile_rows, jof_info_t::tile_w, and jof_info_t::width.
Referenced by internal_geometry().
|
static |
Emit parsed JOF geometry in the legacy CLI layout.
Reports source size, dimensions, codec, layout offsets, and long-strip evidence.
| [in] | source | Source object. |
| [in] | info | Parsed geometry. |
| [in] | report | Report sink. |
| k_ra8_ok | Every geometry field was emitted. |
| other | First injected sink failure. |
Definition at line 453 of file ra8_fmt_stream_inspect.c.
References jof_info_t::bpp, jof_info_t::codec, jof_info_t::index_off, internal_dimensions(), internal_text(), internal_u64(), internal_value_line(), k_jof_codec_deflate, k_ra8_ok, ra8_fmt_source_t::size, jof_info_t::tile_count, jof_info_t::tile_w, jof_info_t::total_size, and jof_info_t::width.
Referenced by ra8_fmt_jof_inspect_stream().
|
static |
Append an uppercase hexadecimal value with zero padding.
Extracts nibbles into a fixed buffer independent of host endianness.
| [in] | report | Report sink. |
| [in] | value | Value to format. |
| [in] | width | Exact digit width (up to 16). |
| k_ra8_ok | Exactly width digits were accepted. |
| k_ra8_err_invalid_size | Width exceeds 16 hexadecimal digits. |
| other | Injected sink rejected the byte span. |
report and its callback are non-null. width may be zero through any uint32_t value. Definition at line 159 of file ra8_fmt_stream_inspect.c.
References internal_put(), k_fmt_text_hex_digits, k_fmt_text_nibble, k_fmt_text_nibble_mask, and k_ra8_err_invalid_size.
Referenced by internal_hex_dump_row(), and internal_table_row().
|
static |
Emit one labelled hex/ASCII source window.
Reads through a fixed 16-byte row and renders stable offsets, hex, and ASCII.
| [in] | source | Source object. |
| [in] | report | Report sink. |
| [in] | label | Section label. |
| [in] | offset | Absolute source offset. |
| [in] | len | Byte count. |
| k_ra8_ok | Complete labelled dump was emitted. |
| other | First exact-read or sink error. |
len source bytes. Definition at line 355 of file ra8_fmt_stream_inspect.c.
References internal_hex_dump_header(), internal_hex_dump_row(), internal_read_exact(), k_fmt_text_hex_row, and k_ra8_ok.
Referenced by ra8_fmt_jof_inspect_stream().
|
static |
Emit the label/length/offset header line for a hex/ASCII dump.
Sequences the label, the decimal byte count, and the decimal source offset into one line, stopping at the first sink failure.
| [in] | report | Report sink. |
| [in] | label | Section label. |
| [in] | offset | Absolute source offset. |
| [in] | len | Byte count. |
| k_ra8_ok | The complete header line was emitted. |
| other | First injected sink failure. |
report and label are non-null. label is NUL-terminated. Definition at line 255 of file ra8_fmt_stream_inspect.c.
References internal_text(), internal_u64(), and k_ra8_ok.
Referenced by internal_hex_dump().
|
static |
Render one already-loaded hex/ASCII row: offset, hex bytes, ASCII.
Emits the zero-padded offset, then k_fmt_text_hex_row hex columns in which every column past count is blanked, then the ASCII gutter where a byte outside the printable range renders as a period.
| [in] | report | Report sink. |
| [in] | offset | Absolute source offset of row[0]. |
| [in] | row | Loaded row bytes, exactly k_fmt_text_hex_row long. |
| [in] | count | Valid leading bytes of row (the rest pad with spaces). |
| k_ra8_ok | The complete row was emitted. |
| other | First injected sink failure. |
report and row are non-null; count is at most k_fmt_text_hex_row. row holds the count bytes already read from offset. Definition at line 300 of file ra8_fmt_stream_inspect.c.
References internal_char(), internal_hex(), internal_text(), k_fmt_text_ascii_high, k_fmt_text_ascii_low, k_fmt_text_hex_row, and k_ra8_ok.
Referenced by internal_hex_dump().
|
static |
Append a byte span to the report sink.
Delegates exactly once to the injected sink without retaining bytes.
| [in] | report | Report sink. |
| [in] | bytes | Bytes to append. |
| [in] | len | Byte count. |
| k_ra8_ok | Sink accepted the complete span. |
| other | Injected sink rejected the span. |
report and its write callback are non-null. bytes spans len readable bytes. Definition at line 54 of file ra8_fmt_stream_inspect.c.
Referenced by internal_char(), internal_hex(), and internal_text().
|
static |
Read an exact source window.
Converts a short successful callback result into validation failure.
| [in] | source | Source object. |
| [in] | offset | Absolute offset. |
| [out] | bytes | Destination. |
| [in] | len | Exact length. |
| k_ra8_ok | Exactly len bytes were read. |
| k_ra8_err_validation_failed | Callback returned a short success. |
| other | Injected source read failed. |
source and its callback are non-null. bytes spans len writable bytes. Definition at line 226 of file ra8_fmt_stream_inspect.c.
References ra8_fmt_source_t::ctx, k_ra8_err_validation_failed, k_ra8_ok, and ra8_fmt_source_t::read_at.
Referenced by internal_hex_dump().
|
static |
Emit the verbose per-tile table.
Bounds output to the configured row ceiling and reports any elided count.
| [in] | records | Completed audit records. |
| [in] | count | Record count. |
| [in] | report | Report sink. |
| k_ra8_ok | Header, bounded records, and elision notice were emitted. |
| other | First injected sink failure. |
records spans count completed audit records. report and its callback are non-null. Definition at line 561 of file ra8_fmt_stream_inspect.c.
References internal_table_row(), internal_text(), internal_u64(), k_fmt_text_max_rows, and k_ra8_ok.
Referenced by ra8_fmt_jof_inspect_stream().
|
static |
Render one audit-record row of the verbose per-tile table.
Emits the row index and the record's offset, length, payload, width, and height as fixed-width decimal columns, then the content hash in hex.
| [in] | report | Report sink. |
| [in] | index | Zero-based row index, printed in the tile column. |
| [in] | record | Completed audit record for this row. |
| k_ra8_ok | The complete row was emitted. |
| other | First injected sink failure. |
report and record are non-null. record was completed by the JOF audit pass. Definition at line 513 of file ra8_fmt_stream_inspect.c.
References jof_audit_record_t::content_hash, jof_audit_record_t::height, internal_char(), internal_hex(), internal_text(), internal_u64(), k_fmt_text_col_width, k_ra8_ok, jof_audit_record_t::length, jof_audit_record_t::offset, jof_audit_record_t::payload, and jof_audit_record_t::width.
Referenced by internal_table().
|
static |
Append a NUL-terminated literal to the report sink.
Measures the literal explicitly, then delegates one exact byte span.
| [in] | report | Report sink. |
| [in] | text | NUL-terminated text. |
| k_ra8_ok | Sink accepted the complete literal. |
| other | Injected sink rejected the literal. |
report and text are non-null. text is NUL-terminated. Definition at line 75 of file ra8_fmt_stream_inspect.c.
References internal_put().
Referenced by internal_dimensions(), internal_geometry(), internal_hex_dump_header(), internal_hex_dump_row(), internal_table(), internal_table_row(), internal_value_line(), and ra8_fmt_jof_inspect_stream().
|
static |
Append an unsigned decimal with optional left padding.
Converts in a fixed reverse buffer and emits padding and digits incrementally.
| [in] | report | Report sink. |
| [in] | value | Value to format. |
| [in] | width | Minimum field width. |
| k_ra8_ok | Every padding and digit byte was accepted. |
| other | First injected sink failure. |
report and its callback are non-null. width characters were emitted. Definition at line 123 of file ra8_fmt_stream_inspect.c.
References internal_char(), k_fmt_text_dec_digits, k_fmt_text_dec_radix, and k_ra8_ok.
Referenced by internal_dimensions(), internal_geometry(), internal_hex_dump_header(), internal_table(), internal_table_row(), and internal_value_line().
|
static |
Emit one label/value decimal line.
Sequences prefix, unpadded integer, and suffix with fail-fast sink handling.
| [in] | report | Report sink. |
| [in] | label | Prefix including spacing and colon. |
| [in] | value | Decimal value. |
| [in] | suffix | Text following the value, including newline. |
| k_ra8_ok | Every component was accepted. |
| other | First injected sink failure. |
report, label, and suffix are non-null. Definition at line 191 of file ra8_fmt_stream_inspect.c.
References internal_text(), internal_u64(), and k_ra8_ok.
Referenced by internal_geometry(), and ra8_fmt_jof_inspect_stream().
|
nodiscard |
Inspect one JOF source through callbacks and caller storage.
| [in] | source | Immutable JOF input. |
| [in] | verbose | Emit header/footer hex and the full tile table. |
| [in,out] | workspace | Exact-or-larger audit buffers. |
| [in,out] | report | Human-readable text sink. |
Definition at line 584 of file ra8_fmt_stream_inspect.c.
References ra8_fmt_source_t::ctx, jof_audit_result_t::duplicate_candidates, jof_audit_result_t::info, internal_geometry(), internal_hex_dump(), internal_table(), internal_text(), internal_value_line(), jof_audit(), k_jof_footer_bytes, k_jof_hdr_bytes, k_ra8_err_null_ptr, k_ra8_err_validation_failed, k_ra8_ok, ra8_fmt_source_t::read_at, ra8_fmt_jof_inspect_workspace_t::record_cap, ra8_fmt_jof_inspect_workspace_t::records, ra8_fmt_jof_inspect_workspace_t::scratch, ra8_fmt_jof_inspect_workspace_t::scratch_cap, ra8_fmt_source_t::size, ra8_fmt_jof_inspect_workspace_t::tile, ra8_fmt_jof_inspect_workspace_t::tile_cap, and jof_info_t::tile_count.
Referenced by internal_run_jof().