ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
main.c File Reference

On-silicon HIL: EPUB TOC navigation (NCX + nav.xhtml) from SD (#116). More...

#include <stddef.h>
#include <stdint.h>
#include "epub.h"
#include "epub_fs.h"
#include "epub_toc_fixture.h"
#include "ra8_board_ek_ra8d2.h"
#include "ra8_boot_entry.h"
#include "ra8_cgc.h"
#include "ra8_err.h"
#include "ra8_isr.h"
#include "ra8_log.h"
#include "ra8_port_constants.h"
#include "ra8_port_utils.h"
#include "ra8_sci_spi.h"
#include "ra8_sdmmc_spi.h"
#include "ra8_spi.h"
#include "ra8_time.h"
Include dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  etoc_consts_t : uint32_t {
  k_etoc_uart_baud = 115200U ,
  k_etoc_spi_chan = 0U ,
  k_etoc_crc_init = 0xFFFFFFFFU ,
  k_etoc_crc_poly = 0xEDB88320U ,
  k_etoc_crc_bits = 8U ,
  k_etoc_title_max = 256U ,
  k_etoc_no_chap = 0xFFFFU ,
  k_etoc_kind_unset = 0xFFU
}
 Console / SPI / parse knobs (no magic numbers). More...
enum  etoc_expect_t : uint32_t {
  k_etoc_ncx_kind = 1U ,
  k_etoc_ncx_count = 2U ,
  k_etoc_ncx_crc = 0xDBC4EA24U ,
  k_etoc_nav_kind = 2U ,
  k_etoc_nav_count = 3U ,
  k_etoc_nav_crc = 0x4CC9A9C1U ,
  k_etoc_bad_kind = 0U ,
  k_etoc_exp_chap = 2U ,
  k_etoc_entry0 = 0U
}
 Byte-exact expected TOC results (host-verified). More...
enum  etoc_err_t : uint32_t {
  k_etoc_err_none = 0U ,
  k_etoc_err_init = 1U ,
  k_etoc_err_card = 2U ,
  k_etoc_err_mount = 3U ,
  k_etoc_err_prov = 4U ,
  k_etoc_err_ncx = 5U ,
  k_etoc_err_nav = 6U ,
  k_etoc_err_bad = 7U
}
 Failure-stage codes stamped to g_etoc_err for SWD / --dump-sym. More...
enum  etoc_pace_t : uint32_t { k_etoc_frame_ms = 100U }
 Idle-loop pacing for the success heartbeat. More...

Functions

static void etoc_print (const uint8_t *msg, uint32_t len)
 Emit a byte run on the SCI8 console.
static void etoc_fail (uint32_t err, const uint8_t *msg, uint32_t len)
 Stamp the failure stage, print the FAIL banner, and park the CPU.
static uint32_t etoc_crc32 (const uint8_t *data, size_t len)
 CRC-32 (reflected, poly 0xEDB88320) over data.
static uint32_t etoc_title_crc (const char *title)
 CRC-32 over a null-terminated title (bounded by k_etoc_title_max).
static ra8_err_t etoc_spi_set_clock (void *ctx, uint32_t hz)
static ra8_err_t etoc_spi_cs (void *ctx, bool asserted)
 ra8_sdmmc_spi_transport_t::cs over ra8_gpio (CS active-low).
static ra8_err_t etoc_spi_xfer (void *ctx, const uint8_t *tx, uint8_t *rx, uint32_t len)
 ra8_sdmmc_spi_transport_t::xfer over ra8_sci_spi_xfer.
static ra8_err_t etoc_spi_pins_init (void)
 Route Pmod2 SPI pins and claim CS as a GPIO output (idle high).
static void etoc_setup_or_halt (uint32_t *out_pclka_hz)
 Bring up CGC + SysTick + console SCI + SPI + CS GPIO; halt on fail.
static void etoc_init_card_or_halt (uint32_t *pclka_hz)
 Init the SD card over SPI; halt with a diagnostic on failure.
static ra8_fs_mount_tetoc_mount_or_halt (void)
 Mount the card, formatting FAT32 first if it is blank/unmountable.
static void etoc_provision_one (ra8_fs_mount_t *mount, const char *path, const uint8_t *data, uint32_t len)
 Write one baked book onto the volume if path is absent.
static void etoc_provision_or_halt (ra8_fs_mount_t *mount)
 Provision all three baked TOC fixtures onto the card.
static void etoc_read_toc (ra8_fs_mount_t *mount, const char *path, uint32_t stage, const uint8_t *fmsg, uint32_t fmsglen, volatile uint32_t *kind, volatile uint32_t *count, volatile uint32_t *e0crc, volatile uint32_t *ch0)
 Open one book off SD and read its TOC kind/count + entry-0 label CRC.
static void etoc_check_ncx (ra8_fs_mount_t *mount)
 Parse + assert the NCX (EPUB2) TOC; latch the result globals.
static void etoc_check_nav (ra8_fs_mount_t *mount)
 Parse + assert the nav (EPUB3) TOC; latch the result globals.
static void etoc_check_bad (ra8_fs_mount_t *mount)
 Assert the malformed-TOC fallback: no TOC, spine still readable.
void main (void)
 App entry: SD bring-up -> provision -> TOC asserts -> heartbeat idle.

Variables

static const ra8_port_pin_t k_etoc_pin_sck = (ra8_port_pin_t)k_ra8_board_pmod2_spi_sck
 Pmod2 SPI pins (J25) – SCI0 Simple-SPI; CS held by GPIO.
static const ra8_port_pin_t k_etoc_pin_cipo = (ra8_port_pin_t)k_ra8_board_pmod2_spi_cipo
static const ra8_port_pin_t k_etoc_pin_copi = (ra8_port_pin_t)k_ra8_board_pmod2_spi_copi
static const ra8_port_pin_t k_etoc_pin_cs = (ra8_port_pin_t)k_ra8_board_pmod2_spi_cs
static const char k_etoc_path_ncx [] = "TOCNCX.EPB"
 SD paths for the three baked books (8.3 short names; ra8_fs root-only).
static const char k_etoc_path_nav [] = "TOCNAV.EPB"
static const char k_etoc_path_bad [] = "TOCBAD.EPB"
volatile uint32_t g_etoc_err = (uint32_t)k_etoc_err_none
 First failing stage (etoc_err_t), 0 on success.
volatile uint32_t g_etoc_ncx_kind = 0U
 NCX toc_kind on success.
volatile uint32_t g_etoc_ncx_n = 0U
 NCX toc_count on success.
volatile uint32_t g_etoc_ncx_e0crc = 0U
 NCX entry-0 label CRC.
volatile uint32_t g_etoc_ncx_ch0 = 0U
 NCX entry-0 -> spine index.
volatile uint32_t g_etoc_nav_kind = 0U
 nav toc_kind on success.
volatile uint32_t g_etoc_nav_n = 0U
 nav toc_count on success.
volatile uint32_t g_etoc_nav_e0crc = 0U
 nav entry-0 label CRC.
volatile uint32_t g_etoc_nav_ch0 = 0U
 nav entry-0 -> spine index.
volatile uint32_t g_etoc_bad_kind = 0U
 malformed-TOC kind (expect 0).
volatile uint32_t g_etoc_bad_chap = 0U
 malformed-TOC spine fallback.
volatile uint32_t g_etoc_heartbeat = 0U
 Idle heartbeat; advances ONLY after all asserts pass (the HIL gate).
static epub_book_t s_book
 Opened book (large – file-scope, not on the stack).
static epub_stream_fs_ctx_t s_epub_io
 Streamed-open source-file context; must outlive s_book (#230).
static ra8_fs_backend_t s_backend
 SD backend; file-scope so the mount handle may reference it.
static const uint8_t k_msg_boot [] = "epub-toc-hil: boot\r\n"
static const uint8_t k_msg_cardok [] = "epub-toc-hil: card ready\r\n"
static const uint8_t k_msg_finit [] = "toc-hil: FAIL init\r\n"
static const uint8_t k_msg_fcard [] = "toc-hil: FAIL card\r\n"
static const uint8_t k_msg_fmount [] = "toc-hil: FAIL mount\r\n"
static const uint8_t k_msg_fprov [] = "toc-hil: FAIL provision\r\n"
static const uint8_t k_msg_fncx [] = "toc-hil: FAIL ncx\r\n"
static const uint8_t k_msg_fnav [] = "toc-hil: FAIL nav\r\n"
static const uint8_t k_msg_fbad [] = "toc-hil: FAIL bad\r\n"
static const uint8_t k_msg_ok [] = "toc-hil: ncx+nav+fallback PASS\r\n"

Detailed Description

On-silicon HIL: EPUB TOC navigation (NCX + nav.xhtml) from SD (#116).

Tag
[Ring 6 / APP] {World: S}

#74 added titled-TOC parsing to epub – both the EPUB2 NCX (<navMap>) and the EPUB3 nav.xhtml (<nav epub:type="toc">) forms – but it has only ever run on the x86 host. This app, building on epub_open (#114), runs the TOC path on the M85 against real .epub files staged on a microSD card.

It self-provisions three baked books onto the card (if absent) and parses each:

  • TOCNCX.EPB: EPUB2 NCX -> assert toc_kind == ncx, toc_count == 2, the CRC-32 of entry 0's label, and that entry 0 resolves to spine index 0.
  • TOCNAV.EPB: EPUB3 nav -> assert toc_kind == nav, toc_count == 3, the entry-0 label CRC, and entry-0 -> spine index 0 (the #fragment stripped).
  • TOCBAD.EPB: no TOC document -> assert graceful degradation: toc_kind none with the spine still readable (chapter count == 2), no HardFault.

The HIL gate is memprobe (J-Link / ra8_emulator --dump-sym), not the console: an SD app drives the SCI0 Simple-SPI bus, and ra8_emulator folds every SCI channel into one console line, so the SCI8 banner is interleaved with SPI traffic there (the same reason the sibling SD HIL apps – epub_open, sd_font_render, fs_format_mount – gate on SWD globals). The success path advances g_etoc_heartbeat once per frame and only after every assertion passes; any failure stamps g_etoc_err and parks without bumping it. So a steadily advancing heartbeat with a zero g_etoc_err proves both TOC code paths plus the malformed-TOC fallback ran on real SD bytes. The console banner remains for a real-bench scope.

Required external hardware (on-bench): Digilent PMOD MicroSD (410-380) in Pmod2 (J25) with a microSD inserted. THIS APP MAY FORMAT THE CARD. Under ra8_emulator attach a blank card with --sd-new 64:fat32.

Since
0.1.0

Definition in file main.c.

Enumeration Type Documentation

◆ etoc_consts_t

enum etoc_consts_t : uint32_t

Console / SPI / parse knobs (no magic numbers).

Enumerator
k_etoc_uart_baud 

Console baud.

k_etoc_spi_chan 

Pmod2 / J25 SCI0 Simple-SPI.

k_etoc_crc_init 

CRC-32 initial value.

k_etoc_crc_poly 

CRC-32 reflected polynomial.

k_etoc_crc_bits 

Bits folded per byte.

k_etoc_title_max 

Bounded title scan (NASA Rule 2).

k_etoc_no_chap 

Sentinel: entry has no spine target.

k_etoc_kind_unset 

Sentinel: toc_kind not yet read.

Definition at line 62 of file main.c.

◆ etoc_err_t

enum etoc_err_t : uint32_t

Failure-stage codes stamped to g_etoc_err for SWD / --dump-sym.

Enumerator
k_etoc_err_none 

No failure (success path).

k_etoc_err_init 

CGC / time / console / SPI bring-up.

k_etoc_err_card 

SD card SPI init.

k_etoc_err_mount 

Mount (and format-if-blank).

k_etoc_err_prov 

Provision a .epub onto the card.

k_etoc_err_ncx 

NCX (EPUB2) TOC assertion.

k_etoc_err_nav 

nav (EPUB3) TOC assertion.

k_etoc_err_bad 

Malformed-TOC fallback assertion.

Definition at line 101 of file main.c.

◆ etoc_expect_t

enum etoc_expect_t : uint32_t

Byte-exact expected TOC results (host-verified).

Enumerator
k_etoc_ncx_kind 

k_epub_toc_ncx.

k_etoc_ncx_count 

navMap navPoints.

k_etoc_ncx_crc 

crc32("Intro").

k_etoc_nav_kind 

k_epub_toc_nav.

k_etoc_nav_count 

nav <ol> entries.

k_etoc_nav_crc 

crc32("Cover").

k_etoc_bad_kind 

k_epub_toc_none (no TOC doc).

k_etoc_exp_chap 

Spine length in every fixture.

k_etoc_entry0 

Entry-0 -> spine index 0.

Definition at line 74 of file main.c.

◆ etoc_pace_t

enum etoc_pace_t : uint32_t

Idle-loop pacing for the success heartbeat.

Enumerator
k_etoc_frame_ms 

Heartbeat period in milliseconds.

Definition at line 113 of file main.c.

Function Documentation

◆ etoc_check_bad()

void etoc_check_bad ( ra8_fs_mount_t * mount)
static

Assert the malformed-TOC fallback: no TOC, spine still readable.

Opens the no-TOC book, requires toc_kind none, then confirms the spine is still usable (epub_get_chapter_count == 2) so a renderer degrades to the spine list rather than faulting.

Definition at line 418 of file main.c.

References epub_close_streamed_fs(), epub_get_chapter_count(), epub_get_toc_kind(), epub_open_streamed_fs(), etoc_fail(), g_etoc_bad_chap, g_etoc_bad_kind, k_etoc_bad_kind, k_etoc_err_bad, k_etoc_exp_chap, k_etoc_kind_unset, k_etoc_path_bad, k_msg_fbad, k_ra8_ok, s_book, and s_epub_io.

Referenced by main().

◆ etoc_check_nav()

void etoc_check_nav ( ra8_fs_mount_t * mount)
static

Parse + assert the nav (EPUB3) TOC; latch the result globals.

Definition at line 392 of file main.c.

References etoc_fail(), etoc_read_toc(), g_etoc_nav_ch0, g_etoc_nav_e0crc, g_etoc_nav_kind, g_etoc_nav_n, k_etoc_entry0, k_etoc_err_nav, k_etoc_nav_count, k_etoc_nav_crc, k_etoc_nav_kind, k_etoc_path_nav, and k_msg_fnav.

Referenced by main().

◆ etoc_check_ncx()

void etoc_check_ncx ( ra8_fs_mount_t * mount)
static

Parse + assert the NCX (EPUB2) TOC; latch the result globals.

Definition at line 372 of file main.c.

References etoc_fail(), etoc_read_toc(), g_etoc_ncx_ch0, g_etoc_ncx_e0crc, g_etoc_ncx_kind, g_etoc_ncx_n, k_etoc_entry0, k_etoc_err_ncx, k_etoc_ncx_count, k_etoc_ncx_crc, k_etoc_ncx_kind, k_etoc_path_ncx, and k_msg_fncx.

Referenced by main().

◆ etoc_crc32()

uint32_t etoc_crc32 ( const uint8_t * data,
size_t len )
static

CRC-32 (reflected, poly 0xEDB88320) over data.

Definition at line 177 of file main.c.

References k_etoc_crc_bits, k_etoc_crc_init, and k_etoc_crc_poly.

Referenced by etoc_title_crc().

◆ etoc_fail()

void etoc_fail ( uint32_t err,
const uint8_t * msg,
uint32_t len )
static

Stamp the failure stage, print the FAIL banner, and park the CPU.

Parameters
[in]errFailure-stage code (etoc_err_t).
[in]msgConsole diagnostic bytes.
[in]lenLength of msg.

Definition at line 167 of file main.c.

References etoc_print(), and g_etoc_err.

Referenced by etoc_check_bad(), etoc_check_nav(), etoc_check_ncx(), etoc_init_card_or_halt(), etoc_mount_or_halt(), etoc_provision_one(), etoc_read_toc(), and etoc_setup_or_halt().

◆ etoc_init_card_or_halt()

void etoc_init_card_or_halt ( uint32_t * pclka_hz)
static

Init the SD card over SPI; halt with a diagnostic on failure.

Definition at line 269 of file main.c.

References etoc_fail(), etoc_print(), etoc_spi_cs(), etoc_spi_set_clock(), etoc_spi_xfer(), k_etoc_err_card, k_msg_cardok, k_msg_fcard, k_ra8_ok, and ra8_sdmmc_spi_init().

Referenced by main().

◆ etoc_mount_or_halt()

ra8_fs_mount_t * etoc_mount_or_halt ( void )
static

Mount the card, formatting FAT32 first if it is blank/unmountable.

Definition at line 282 of file main.c.

References etoc_fail(), k_etoc_err_mount, k_msg_fmount, k_ra8_fs_type_fat32, k_ra8_ok, ra8_fs_format_opts_t::label, ra8_fs_format(), ra8_fs_mount(), ra8_sdmmc_spi_bind_fs_backend(), s_backend, and ra8_fs_format_opts_t::type.

Referenced by main().

◆ etoc_print()

void etoc_print ( const uint8_t * msg,
uint32_t len )
static

Emit a byte run on the SCI8 console.

Definition at line 155 of file main.c.

References ra8_board_uart_console_write().

Referenced by etoc_fail(), etoc_init_card_or_halt(), and main().

◆ etoc_provision_one()

void etoc_provision_one ( ra8_fs_mount_t * mount,
const char * path,
const uint8_t * data,
uint32_t len )
static

Write one baked book onto the volume if path is absent.

Definition at line 302 of file main.c.

References etoc_fail(), k_etoc_err_prov, k_msg_fprov, k_ra8_fs_mode_read, k_ra8_ok, ra8_fs_close(), ra8_fs_open(), and ra8_fs_write_file().

Referenced by etoc_provision_or_halt().

◆ etoc_provision_or_halt()

void etoc_provision_or_halt ( ra8_fs_mount_t * mount)
static

Provision all three baked TOC fixtures onto the card.

Definition at line 315 of file main.c.

References etoc_provision_one(), k_etoc_bad, k_etoc_bad_len, k_etoc_nav, k_etoc_nav_len, k_etoc_ncx, k_etoc_ncx_len, k_etoc_path_bad, k_etoc_path_nav, and k_etoc_path_ncx.

Referenced by main().

◆ etoc_read_toc()

void etoc_read_toc ( ra8_fs_mount_t * mount,
const char * path,
uint32_t stage,
const uint8_t * fmsg,
uint32_t fmsglen,
volatile uint32_t * kind,
volatile uint32_t * count,
volatile uint32_t * e0crc,
volatile uint32_t * ch0 )
static

Open one book off SD and read its TOC kind/count + entry-0 label CRC.

Parameters
[in]mountMounted SD volume.
[in]pathBook path on the volume.
[in]stageFailure-stage code for this book.
[in]fmsgFAIL banner for this book.
[in]fmsglenLength of fmsg.
[out]kindReceives epub_get_toc_kind.
[out]countReceives epub_get_toc_count.
[out]e0crcReceives the CRC-32 of entry 0's label (0 if no entries).
[out]ch0Receives entry-0 -> spine index (0xFFFF if no entries).

Definition at line 335 of file main.c.

References epub_close_streamed_fs(), epub_get_toc_count(), epub_get_toc_entry(), epub_get_toc_kind(), epub_open_streamed_fs(), epub_toc_entry_to_chapter(), etoc_fail(), etoc_title_crc(), k_etoc_no_chap, k_ra8_ok, s_book, s_epub_io, and epub_toc_entry_t::title.

Referenced by etoc_check_nav(), and etoc_check_ncx().

◆ etoc_setup_or_halt()

void etoc_setup_or_halt ( uint32_t * out_pclka_hz)
static

◆ etoc_spi_cs()

ra8_err_t etoc_spi_cs ( void * ctx,
bool asserted )
static

ra8_sdmmc_spi_transport_t::cs over ra8_gpio (CS active-low).

Definition at line 210 of file main.c.

References k_etoc_pin_cs, k_ra8_level_high, k_ra8_level_low, and ra8_gpio_write().

Referenced by etoc_init_card_or_halt().

◆ etoc_spi_pins_init()

ra8_err_t etoc_spi_pins_init ( void )
staticnodiscard

Route Pmod2 SPI pins and claim CS as a GPIO output (idle high).

Definition at line 224 of file main.c.

References k_etoc_pin_cipo, k_etoc_pin_copi, k_etoc_pin_cs, k_etoc_pin_sck, k_ra8_level_high, k_ra8_ok, k_ra8_psel_sci_async, ra8_gpio_output_init(), and ra8_pfs_route_peripheral().

Referenced by etoc_setup_or_halt().

◆ etoc_spi_set_clock()

ra8_err_t etoc_spi_set_clock ( void * ctx,
uint32_t hz )
static

Definition at line 203 of file main.c.

References k_etoc_spi_chan, and ra8_sci_spi_set_clock().

Referenced by etoc_init_card_or_halt().

◆ etoc_spi_xfer()

ra8_err_t etoc_spi_xfer ( void * ctx,
const uint8_t * tx,
uint8_t * rx,
uint32_t len )
static

ra8_sdmmc_spi_transport_t::xfer over ra8_sci_spi_xfer.

Definition at line 217 of file main.c.

References k_etoc_spi_chan, and ra8_sci_spi_xfer().

Referenced by etoc_init_card_or_halt().

◆ etoc_title_crc()

uint32_t etoc_title_crc ( const char * title)
static

CRC-32 over a null-terminated title (bounded by k_etoc_title_max).

Definition at line 191 of file main.c.

References etoc_crc32(), and k_etoc_title_max.

Referenced by etoc_read_toc().

◆ main()

void main ( void )

App entry: SD bring-up -> provision -> TOC asserts -> heartbeat idle.

The application entry point Reset_Handler hands control to.

Precondition
Reset_Handler copied .data and zeroed .bss.
SystemInit set VTOR / FPU / priority grouping.
Postcondition
On success the g_etoc_* result globals hold the parsed TOC values, the banner is emitted, and g_etoc_heartbeat advances once per frame.
On any failure g_etoc_err is non-zero and the CPU parks (no heartbeat).
Since
0.1.0

Definition at line 447 of file main.c.

References etoc_check_bad(), etoc_check_nav(), etoc_check_ncx(), etoc_init_card_or_halt(), etoc_mount_or_halt(), etoc_print(), etoc_provision_or_halt(), etoc_setup_or_halt(), g_etoc_heartbeat, k_etoc_frame_ms, k_msg_boot, k_msg_ok, ra8_delay_ms(), ra8_isr_globals_enable(), and ra8_log_init().

Variable Documentation

◆ g_etoc_bad_chap

volatile uint32_t g_etoc_bad_chap = 0U

malformed-TOC spine fallback.

Definition at line 132 of file main.c.

Referenced by etoc_check_bad().

◆ g_etoc_bad_kind

volatile uint32_t g_etoc_bad_kind = 0U

malformed-TOC kind (expect 0).

Definition at line 131 of file main.c.

Referenced by etoc_check_bad().

◆ g_etoc_err

volatile uint32_t g_etoc_err = (uint32_t)k_etoc_err_none

First failing stage (etoc_err_t), 0 on success.

SWD / --dump-sym.

Note
Exported (non-static) so a memprobe gate can read it by symbol.

Definition at line 122 of file main.c.

Referenced by etoc_fail().

◆ g_etoc_heartbeat

volatile uint32_t g_etoc_heartbeat = 0U

Idle heartbeat; advances ONLY after all asserts pass (the HIL gate).

Definition at line 134 of file main.c.

Referenced by main().

◆ g_etoc_nav_ch0

volatile uint32_t g_etoc_nav_ch0 = 0U

nav entry-0 -> spine index.

Definition at line 130 of file main.c.

Referenced by etoc_check_nav().

◆ g_etoc_nav_e0crc

volatile uint32_t g_etoc_nav_e0crc = 0U

nav entry-0 label CRC.

Definition at line 129 of file main.c.

Referenced by etoc_check_nav().

◆ g_etoc_nav_kind

volatile uint32_t g_etoc_nav_kind = 0U

nav toc_kind on success.

Definition at line 127 of file main.c.

Referenced by etoc_check_nav().

◆ g_etoc_nav_n

volatile uint32_t g_etoc_nav_n = 0U

nav toc_count on success.

Definition at line 128 of file main.c.

Referenced by etoc_check_nav().

◆ g_etoc_ncx_ch0

volatile uint32_t g_etoc_ncx_ch0 = 0U

NCX entry-0 -> spine index.

Definition at line 126 of file main.c.

Referenced by etoc_check_ncx().

◆ g_etoc_ncx_e0crc

volatile uint32_t g_etoc_ncx_e0crc = 0U

NCX entry-0 label CRC.

Definition at line 125 of file main.c.

Referenced by etoc_check_ncx().

◆ g_etoc_ncx_kind

volatile uint32_t g_etoc_ncx_kind = 0U

NCX toc_kind on success.

Definition at line 123 of file main.c.

Referenced by etoc_check_ncx().

◆ g_etoc_ncx_n

volatile uint32_t g_etoc_ncx_n = 0U

NCX toc_count on success.

Definition at line 124 of file main.c.

Referenced by etoc_check_ncx().

◆ k_etoc_path_bad

const char k_etoc_path_bad[] = "TOCBAD.EPB"
static

Definition at line 95 of file main.c.

Referenced by etoc_check_bad(), and etoc_provision_or_halt().

◆ k_etoc_path_nav

const char k_etoc_path_nav[] = "TOCNAV.EPB"
static

Definition at line 94 of file main.c.

Referenced by etoc_check_nav(), and etoc_provision_or_halt().

◆ k_etoc_path_ncx

const char k_etoc_path_ncx[] = "TOCNCX.EPB"
static

SD paths for the three baked books (8.3 short names; ra8_fs root-only).

Definition at line 93 of file main.c.

Referenced by etoc_check_ncx(), and etoc_provision_or_halt().

◆ k_etoc_pin_cipo

const ra8_port_pin_t k_etoc_pin_cipo = (ra8_port_pin_t)k_ra8_board_pmod2_spi_cipo
static

Definition at line 88 of file main.c.

Referenced by etoc_spi_pins_init().

◆ k_etoc_pin_copi

const ra8_port_pin_t k_etoc_pin_copi = (ra8_port_pin_t)k_ra8_board_pmod2_spi_copi
static

Definition at line 89 of file main.c.

Referenced by etoc_spi_pins_init().

◆ k_etoc_pin_cs

Definition at line 90 of file main.c.

Referenced by etoc_spi_cs(), and etoc_spi_pins_init().

◆ k_etoc_pin_sck

Pmod2 SPI pins (J25) – SCI0 Simple-SPI; CS held by GPIO.

Definition at line 87 of file main.c.

Referenced by etoc_spi_pins_init().

◆ k_msg_boot

const uint8_t k_msg_boot[] = "epub-toc-hil: boot\r\n"
static

Definition at line 143 of file main.c.

◆ k_msg_cardok

const uint8_t k_msg_cardok[] = "epub-toc-hil: card ready\r\n"
static

Definition at line 144 of file main.c.

◆ k_msg_fbad

const uint8_t k_msg_fbad[] = "toc-hil: FAIL bad\r\n"
static

Definition at line 151 of file main.c.

Referenced by etoc_check_bad().

◆ k_msg_fcard

const uint8_t k_msg_fcard[] = "toc-hil: FAIL card\r\n"
static

Definition at line 146 of file main.c.

◆ k_msg_finit

const uint8_t k_msg_finit[] = "toc-hil: FAIL init\r\n"
static

Definition at line 145 of file main.c.

◆ k_msg_fmount

const uint8_t k_msg_fmount[] = "toc-hil: FAIL mount\r\n"
static

Definition at line 147 of file main.c.

◆ k_msg_fnav

const uint8_t k_msg_fnav[] = "toc-hil: FAIL nav\r\n"
static

Definition at line 150 of file main.c.

Referenced by etoc_check_nav().

◆ k_msg_fncx

const uint8_t k_msg_fncx[] = "toc-hil: FAIL ncx\r\n"
static

Definition at line 149 of file main.c.

Referenced by etoc_check_ncx().

◆ k_msg_fprov

const uint8_t k_msg_fprov[] = "toc-hil: FAIL provision\r\n"
static

Definition at line 148 of file main.c.

◆ k_msg_ok

const uint8_t k_msg_ok[] = "toc-hil: ncx+nav+fallback PASS\r\n"
static

Definition at line 152 of file main.c.

◆ s_backend

ra8_fs_backend_t s_backend
static

SD backend; file-scope so the mount handle may reference it.

Definition at line 141 of file main.c.

◆ s_book

epub_book_t s_book
static

Opened book (large – file-scope, not on the stack).

Definition at line 137 of file main.c.

◆ s_epub_io

epub_stream_fs_ctx_t s_epub_io
static

Streamed-open source-file context; must outlive s_book (#230).

Definition at line 139 of file main.c.