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

ra8_io pluggable filesystem-format registry demo (Phase 4, #159). More...

#include <stdint.h>
#include <string.h>
#include "ra8_attributes.h"
#include "ra8_boot_entry.h"
#include "ra8_cgc.h"
#include "ra8_check.h"
#include "ra8_err.h"
#include "ra8_fs.h"
#include "ra8_io.h"
#include "ra8_io_fsfmt.h"
#include "ra8_log.h"
#include "ra8_port_constants.h"
#include "ra8_port_utils.h"
#include "ra8_sci.h"
#include "ra8_time.h"
Include dependency graph for main.c:

Go to the source code of this file.

Data Structures

struct  demo_stub_mount_t
 Single caller-independent mount context for the demo format. More...
struct  demo_stub_file_t
 Single bounded stream context for the foreign demo file. More...

Enumerations

enum  demo_const_t : uint32_t {
  k_demo_uart_chan = 8U ,
  k_demo_uart_baud = 115200U ,
  k_demo_disk_blocks = 512U ,
  k_demo_stub_blocks = 8U ,
  k_demo_pin_shift = 8U ,
  k_demo_stub_maxname = 16U ,
  k_demo_stub_magic = 0x5AU
}
 Console + volume knobs (no magic numbers). More...

Functions

static void internal_demo_print (const char *msg)
 Print a NUL-terminated string on the UART stream.
static bool internal_stub_probe (const ra8_fs_backend_t *be)
 Test whether block zero carries the foreign-format stub signature.
static ra8_err_t internal_stub_mount (const ra8_fs_backend_t *backend, void **out_mount)
 Mount the bounded foreign demo format.
static ra8_err_t internal_stub_unmount (void *mount_ctx)
 Release the mounted foreign demo context.
static ra8_err_t internal_stub_open (void *mount_ctx, const char *path, ra8_fs_mode_t mode, void **out_file)
 Open the immutable foreign demo file.
static ra8_err_t internal_stub_close (void *file_ctx)
 Close the immutable foreign demo file.
static ra8_err_t internal_stub_read (void *file_ctx, void *buf, uint32_t bytes, uint32_t *out_read)
 Read a bounded prefix from the immutable foreign payload.
static ra8_err_t internal_stub_seek (void *file_ctx, uint64_t offset_bytes)
 Seek within the immutable foreign demo file.
static ra8_err_t internal_stub_tell (const void *file_ctx, uint64_t *out_offset)
 Report the current foreign stream offset.
static ra8_err_t internal_stub_size (const void *file_ctx, uint64_t *out_bytes)
 Report the immutable foreign payload size.
static ra8_err_t internal_stub_stat (void *mount_ctx, const char *path, ra8_fs_stat_t *out)
 Report metadata for the foreign root or immutable file.
static ra8_err_t internal_stub_listdir (void *mount_ctx, const char *path, ra8_fs_listdir_cb_t cb, void *cb_ctx)
 Enumerate the foreign root's immutable file.
static void internal_demo_setup_or_halt (void)
 Bring up CGC, SysTick, and the SCI8 console; halt on failure.
static ra8_err_t internal_demo_probe_fat (const ra8_io_fsfmt_t **out_fmt)
 Format a FAT12 RAM volume and require the fat format probe result.
static ra8_err_t internal_demo_probe_foreign (void)
 Register the foreign stub format, craft a volume, and require it wins.
void main (void)
 Firmware entry point.

Variables

static const ra8_port_pin_t s_demo_txd
 SCI8 console TXD = PD02.
static const ra8_port_pin_t s_demo_rxd
 SCI8 console RXD = PD03.
static uint8_t s_disk [(size_t) k_demo_disk_blocks *(size_t) k_ra8_io_block_size_bytes]
 256 KiB RAM-disk backing buffer for the FAT volume (in SRAM .bss).
static uint8_t s_stub_disk [(size_t) k_demo_stub_blocks *(size_t) k_ra8_io_block_size_bytes]
 4 KiB RAM-disk backing buffer for the stub-signature volume.
static ra8_io_blockdev_t s_bd
 Block-device handle + its RAM backend state (FAT volume).
static ra8_io_blockdev_ram_state_t s_bstate
static ra8_fs_backend_t s_be
 ra8_fs backend bridged onto the FAT block device.
static ra8_io_stream_t s_uart
 UART output stream + its sink state.
static ra8_io_stream_uart_state_t s_ust
static const char *const s_tag = "ra8_io_fsfmt_demo"
 Module log tag.
static const uint8_t s_demo_stub_payload [] = "registered-format-data"
 Immutable contents served by the foreign demo format.
static demo_stub_mount_t s_demo_stub_mount
 Caller-independent foreign-format mount state.
static demo_stub_file_t s_demo_stub_file
 Caller-independent foreign-format stream state.
static const ra8_io_fsfmt_ops_t s_demo_stub_ops
 Complete read-side operations for the bounded foreign descriptor.
static const ra8_io_fsfmt_t s_demo_stub
 Foreign stub format descriptor (read-only, case-sensitive).

Detailed Description

ra8_io pluggable filesystem-format registry demo (Phase 4, #159).

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

Exercises the format registry that lets the fabric recognise the on-disk filesystem without the upper layers hard-coding a switch over FAT vs exFAT:

  1. Build a RAM block device, bridge it to ra8_fs, and format a FAT12 volume on it (Phase 1/3, #156/#158).
  2. Register the built-in formats (ra8_io_fsfmt_init) and probe the FAT volume: it must resolve to the "fat" format and report FAT capabilities (writable, streaming-write, 8.3 name length).
  3. Demonstrate the foreign-format seam: register a bounded read-only format whose probe claims a magic byte in block 0 and whose namespace exposes one immutable file. A second tiny RAM device must resolve to "stub" with its case-sensitive capabilities, proving a new format plugs in with no change to the registry's built-ins.
  4. Report progress on the SCI8 console through a ra8_io UART stream sink.

The ra8_emulator captures the SCI8 console, so the PASS line is observable headlessly: a successful run prints ra8_io_fsfmt_demo: probed fat maxname=741 + foreign stub seam PASS.

Definition in file main.c.

Enumeration Type Documentation

◆ demo_const_t

enum demo_const_t : uint32_t

Console + volume knobs (no magic numbers).

Enumerator
k_demo_uart_chan 

SCI8 J-Link OB console.

k_demo_uart_baud 

Console baud.

k_demo_disk_blocks 

256 KiB RAM-disk (FAT12).

k_demo_stub_blocks 

4 KiB tiny disk for the stub vol.

k_demo_pin_shift 

Port byte position in ra8_port_pin_t.

k_demo_stub_maxname 

Stub format max name length.

k_demo_stub_magic 

Stub block-0 signature byte.

Definition at line 49 of file main.c.

Function Documentation

◆ internal_demo_print()

void internal_demo_print ( const char * msg)
static

Print a NUL-terminated string on the UART stream.

Delegates string emission to the initialized stream and intentionally ignores diagnostic-output errors in this terminal demo.

Parameters
[in]msgNUL-terminated message to emit.
Precondition
msg is non-NULL and readable through its terminator.
s_uart has been initialized with its caller-owned UART state.
Postcondition
The stream has accepted the message or reported an ignored sink error.
Filesystem-format registry and block-device state remain unchanged.
Note
This single-threaded diagnostic helper performs no retry.
Since
0.1.0

Definition at line 115 of file main.c.

References RA8_INTERNAL, ra8_io_stream_puts(), and s_uart.

◆ internal_demo_probe_fat()

ra8_err_t internal_demo_probe_fat ( const ra8_io_fsfmt_t ** out_fmt)
static

Format a FAT12 RAM volume and require the fat format probe result.

Initializes the RAM backend, formats FAT12, initializes the registry, probes the volume, and validates the reported FAT capabilities.

Parameters
[out]out_fmtReceives the detected FAT descriptor on success.
Returns
Error from initialization/probing or an explicit capability mismatch.
Return values
k_ra8_okFAT was detected with the expected writable capabilities.
k_ra8_err_not_foundA different format name was reported.
k_ra8_err_not_supportedRequired write capability was absent.
k_ra8_err_invalid_sizeThe advertised maximum name length differed.
Precondition
out_fmt addresses writable descriptor-pointer storage.
The static RAM disk retains its complete declared capacity.
Postcondition
On success, out_fmt points at the registered FAT descriptor.
The formatted FAT12 volume remains available through s_be.
Note
The probe validates registry metadata as well as on-disk recognition.
Since
0.1.0

Definition at line 548 of file main.c.

References k_demo_disk_blocks, k_ra8_err_invalid_size, k_ra8_err_not_found, k_ra8_err_not_supported, k_ra8_fs_type_fat12, k_ra8_io_fsfmt_fat_max_name_utf8, k_ra8_ok, ra8_fs_format_opts_t::label, RA8_CHECK_NULL_PTR, ra8_fs_format(), RA8_INTERNAL, ra8_io_blockdev_as_fs_backend(), ra8_io_blockdev_ram_init(), ra8_io_fsfmt_init(), ra8_io_fsfmt_probe(), RA8_RETURN_ON_ERROR, s_bd, s_be, s_bstate, s_disk, s_tag, strcmp(), and ra8_fs_format_opts_t::type.

Referenced by main().

◆ internal_demo_probe_foreign()

ra8_err_t internal_demo_probe_foreign ( void )
static

Register the foreign stub format, craft a volume, and require it wins.

Registers the file-local descriptor, initializes a tiny RAM backend, writes its signature block, probes it, and verifies advertised capabilities.

Returns
Error from registration/storage/probing or a capability mismatch.
Return values
k_ra8_okThe stub format was detected with the expected capabilities.
k_ra8_err_not_foundThe registry selected a different format.
k_ra8_err_not_supportedRequired stub capabilities were absent.
Precondition
The format registry has been initialized by the FAT probe stage.
The static stub disk retains at least one writable block.
Postcondition
On success, the stub descriptor remains registered for future probes.
The first stub-disk byte contains the configured signature value.
Note
Caller-owned local backend state is sufficient for the synchronous probe.
Since
0.1.0

Definition at line 592 of file main.c.

References k_demo_stub_blocks, k_demo_stub_magic, k_ra8_err_not_found, k_ra8_err_not_supported, k_ra8_io_block_size_bytes, k_ra8_ok, RA8_INTERNAL, ra8_io_blockdev_as_fs_backend(), ra8_io_blockdev_ram_init(), ra8_io_blockdev_write(), ra8_io_fsfmt_probe(), ra8_io_fsfmt_register(), RA8_RETURN_ON_ERROR, s_demo_stub, s_stub_disk, s_tag, and strcmp().

Referenced by main().

◆ internal_demo_setup_or_halt()

void internal_demo_setup_or_halt ( void )
static

Bring up CGC, SysTick, and the SCI8 console; halt on failure.

Resolves CPUCLK0 and PCLKA, initializes the time base, routes both console pins, and configures SCI8 in dependency order.

Precondition
Reset startup has initialized data and BSS storage.
Peripheral register mappings for clocks, pins, and SCI8 are accessible.
Postcondition
On return, SCI8 is configured for the requested diagnostic baud.
Any required setup failure parks the application before returning.
Note
This helper is intended for the single-threaded startup path only.
Since
0.1.0

Definition at line 505 of file main.c.

References k_demo_uart_baud, k_demo_uart_chan, k_ra8_clock_id_cpuclk0, k_ra8_clock_id_pclka, k_ra8_ok, k_ra8_psel_sci_async, k_ra8_sci_data_8, k_ra8_sci_parity_none, k_ra8_sci_stop_1, ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, ra8_pfs_route_peripheral(), ra8_sci_init(), ra8_time_init(), s_demo_rxd, and s_demo_txd.

◆ internal_stub_close()

ra8_err_t internal_stub_close ( void * file_ctx)
static

Close the immutable foreign demo file.

Validates the singleton identity and consumes its open lifecycle.

Parameters
[in,out]file_ctxContext returned by internal_stub_open.
Returns
Close validation status.
Return values
k_ra8_okThe live file context was closed.
Precondition
file_ctx is the single format-owned stream context.
The stream is currently open.
Postcondition
Success clears the open lifecycle bit.
Payload and mount state remain unchanged.
Note
No flush is necessary because the payload is immutable.
Since
0.1.0

Definition at line 261 of file main.c.

References k_ra8_err_invalid_state, k_ra8_ok, RA8_INTERNAL, and s_demo_stub_file.

◆ internal_stub_listdir()

ra8_err_t internal_stub_listdir ( void * mount_ctx,
const char * path,
ra8_fs_listdir_cb_t cb,
void * cb_ctx )
static

Enumerate the foreign root's immutable file.

Accepts only / and invokes the supplied callback exactly once.

Parameters
[in]mount_ctxActive foreign mount context.
[in]pathNormalized directory path.
[in]cbCaller callback receiving the one entry.
[in,out]cb_ctxCaller context forwarded unchanged.
Returns
Path and lifecycle status.
Return values
k_ra8_okThe root entry was reported once.
Precondition
Required pointers follow the registered filesystem callback contract.
mount_ctx identifies the active demo mount.
Postcondition
Success reports README.TXT with read-only metadata.
Namespace and stream state remain unchanged.
Note
Callback execution is synchronous.
Since
0.1.0

Definition at line 438 of file main.c.

References k_ra8_err_invalid_state, k_ra8_err_not_found, k_ra8_err_null_ptr, k_ra8_fs_attr_read_only, k_ra8_ok, s_demo_stub_mount, s_demo_stub_payload, and strcmp().

◆ internal_stub_mount()

ra8_err_t internal_stub_mount ( const ra8_fs_backend_t * backend,
void ** out_mount )
static

Mount the bounded foreign demo format.

Revalidates the volume marker and publishes the one statically allocated mount context when it is not already active.

Parameters
[in]backendBackend selected by the registry.
[out]out_mountReceives the mounted foreign context.
Returns
Mount validation and lifecycle status.
Return values
k_ra8_okThe foreign context was mounted and published.
Precondition
backend identifies the backend that matched the signature probe.
out_mount, when non-NULL, is owned by the caller.
Postcondition
Success marks the singleton context mounted and publishes its address.
Failure leaves the mount state and output destination unchanged.
Note
The example has one mount slot and performs no allocation.
Since
0.1.0

Definition at line 169 of file main.c.

References internal_stub_probe(), k_ra8_err_busy, k_ra8_err_not_found, k_ra8_err_null_ptr, k_ra8_ok, RA8_INTERNAL, and s_demo_stub_mount.

◆ internal_stub_open()

ra8_err_t internal_stub_open ( void * mount_ctx,
const char * path,
ra8_fs_mode_t mode,
void ** out_file )
static

Open the immutable foreign demo file.

Accepts only read mode and the exact /README.TXT path, then resets the single bounded cursor.

Parameters
[in]mount_ctxActive foreign mount context.
[in]pathNormalized volume-relative path.
[in]modeRequested open mode.
[out]out_fileReceives the singleton file context.
Returns
Path, mode, and lifecycle status.
Return values
k_ra8_okThe immutable file was opened at offset zero.
Precondition
Required pointers follow the registered filesystem callback contract.
mount_ctx identifies the active demo mount.
Postcondition
Success publishes the open file context at offset zero.
Failure does not alter the output destination.
Note
The format deliberately supports one concurrent read stream.
Since
0.1.0

Definition at line 225 of file main.c.

References k_ra8_err_busy, k_ra8_err_invalid_state, k_ra8_err_not_found, k_ra8_err_not_supported, k_ra8_err_null_ptr, k_ra8_fs_mode_read, k_ra8_ok, s_demo_stub_file, s_demo_stub_mount, and strcmp().

◆ internal_stub_probe()

bool internal_stub_probe ( const ra8_fs_backend_t * be)
static

Test whether block zero carries the foreign-format stub signature.

Validates the backend seam, reads exactly one block into bounded stack storage, and compares its first byte with the demo magic value.

Parameters
[in]beBackend whose block zero is probed.
Returns
Whether the backend contains the stub signature.
Return values
trueThe block read succeeded and the signature byte matched.
falseThe backend was invalid, the read failed, or the byte differed.
Precondition
A non-NULL backend provides a context compatible with read_block.
The backend exposes at least one standard-size block when readable.
Postcondition
The backend contents and registry remain unchanged.
Temporary block storage leaves scope on return.
Note
Probe failures collapse to false so the registry can try another format.
Since
0.1.0

Definition at line 137 of file main.c.

References ra8_fs_backend_t::ctx, k_demo_stub_magic, k_ra8_io_block_size_bytes, k_ra8_ok, RA8_INTERNAL, and ra8_fs_backend_t::read_block.

Referenced by internal_stub_mount().

◆ internal_stub_read()

ra8_err_t internal_stub_read ( void * file_ctx,
void * buf,
uint32_t bytes,
uint32_t * out_read )
static

Read a bounded prefix from the immutable foreign payload.

Copies at most the remaining payload bytes and advances only by the count reported through out_read.

Parameters
[in,out]file_ctxActive foreign file context.
[out]bufCaller-owned read destination.
[in]bytesRequested byte count.
[out]out_readReceives the copied byte count.
Returns
Stream validation status.
Return values
k_ra8_okZero or more bytes were copied without exceeding bytes.
Precondition
buf addresses bytes writable bytes when bytes is nonzero.
out_read addresses writable count storage.
Postcondition
Success advances the cursor by exactly *out_read.
Payload and mount state remain unchanged.
Note
End of file is reported as success with a zero count.
Since
0.1.0

Definition at line 288 of file main.c.

References k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, memcpy(), s_demo_stub_file, and s_demo_stub_payload.

◆ internal_stub_seek()

ra8_err_t internal_stub_seek ( void * file_ctx,
uint64_t offset_bytes )
static

Seek within the immutable foreign demo file.

Clamps the requested absolute offset to the payload extent.

Parameters
[in,out]file_ctxActive foreign file context.
[in]offset_bytesRequested absolute stream offset.
Returns
Seek validation status.
Return values
k_ra8_okThe bounded stream offset was updated.
Precondition
file_ctx identifies the open singleton stream.
offset_bytes may span the public 64-bit interface range.
Postcondition
Success sets the offset to min(offset_bytes, payload_size).
Payload and mount state remain unchanged.
Note
Seeking beyond EOF selects EOF rather than creating sparse content.
Since
0.1.0

Definition at line 321 of file main.c.

References k_ra8_err_invalid_state, k_ra8_ok, RA8_INTERNAL, s_demo_stub_file, and s_demo_stub_payload.

◆ internal_stub_size()

ra8_err_t internal_stub_size ( const void * file_ctx,
uint64_t * out_bytes )
static

Report the immutable foreign payload size.

Publishes the compile-time payload extent without changing the cursor.

Parameters
[in]file_ctxActive foreign file context.
[out]out_bytesReceives the payload byte count.
Returns
Query validation status.
Return values
k_ra8_okThe immutable payload size was published.
Precondition
file_ctx identifies the open singleton stream.
out_bytes addresses writable storage.
Postcondition
Success publishes sizeof(payload) - 1.
Stream state and payload remain unchanged.
Note
The trailing C-string terminator is not part of the file.
Since
0.1.0

Definition at line 371 of file main.c.

References k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, RA8_INTERNAL, s_demo_stub_file, and s_demo_stub_payload.

◆ internal_stub_stat()

ra8_err_t internal_stub_stat ( void * mount_ctx,
const char * path,
ra8_fs_stat_t * out )
static

Report metadata for the foreign root or immutable file.

Recognizes only / and /README.TXT and publishes bounded metadata.

Parameters
[in]mount_ctxActive foreign mount context.
[in]pathNormalized volume-relative path.
[out]outReceives metadata for the recognized path.
Returns
Path and lifecycle status.
Return values
k_ra8_okMetadata for a recognized path was published.
Precondition
Required pointers follow the registered filesystem callback contract.
mount_ctx identifies the active demo mount.
Postcondition
Success fully initializes out.
Failure leaves the namespace and stream state unchanged.
Note
The format publishes no timestamps.
Since
0.1.0

Definition at line 399 of file main.c.

References ra8_fs_stat_t::attr, ra8_fs_stat_t::is_directory, k_ra8_err_invalid_state, k_ra8_err_not_found, k_ra8_err_null_ptr, k_ra8_fs_attr_directory, k_ra8_fs_attr_read_only, k_ra8_ok, s_demo_stub_mount, s_demo_stub_payload, ra8_fs_stat_t::size_bytes, and strcmp().

◆ internal_stub_tell()

ra8_err_t internal_stub_tell ( const void * file_ctx,
uint64_t * out_offset )
static

Report the current foreign stream offset.

Copies the bounded singleton cursor into caller storage.

Parameters
[in]file_ctxActive foreign file context.
[out]out_offsetReceives the current byte offset.
Returns
Query validation status.
Return values
k_ra8_okThe current stream offset was published.
Precondition
file_ctx identifies the open singleton stream.
out_offset addresses writable storage.
Postcondition
Success publishes an offset no greater than the payload size.
Stream state and payload remain unchanged.
Note
Pure with respect to format-owned state.
Since
0.1.0

Definition at line 345 of file main.c.

References k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, RA8_INTERNAL, and s_demo_stub_file.

◆ internal_stub_unmount()

ra8_err_t internal_stub_unmount ( void * mount_ctx)
static

Release the mounted foreign demo context.

Validates the singleton identity before clearing its lifecycle bit.

Parameters
[in,out]mount_ctxContext previously returned by internal_stub_mount.
Returns
Unmount validation status.
Return values
k_ra8_okThe live foreign context was released.
Precondition
mount_ctx is the only context this format can publish.
No foreign stream remains open.
Postcondition
Success leaves the singleton context available for a later mount.
Failure leaves the context state unchanged.
Note
No resource release callback or allocator is required.
Since
0.1.0

Definition at line 198 of file main.c.

References k_ra8_err_invalid_state, k_ra8_ok, RA8_INTERNAL, s_demo_stub_file, and s_demo_stub_mount.

◆ main()

void main ( void )

Firmware entry point.

The application entry point Reset_Handler hands control to.

Precondition
SystemInit set VTOR / FPU / priority grouping.

Definition at line 624 of file main.c.

References internal_demo_print(), internal_demo_probe_fat(), internal_demo_probe_foreign(), internal_demo_setup_or_halt(), k_demo_uart_chan, k_ra8_ok, ra8_io_log_attach(), ra8_io_stream_put_u32(), ra8_io_stream_uart_init(), ra8_log_init(), ra8_sci_flush(), s_uart, and s_ust.

Variable Documentation

◆ s_bd

ra8_io_blockdev_t s_bd
static

Block-device handle + its RAM backend state (FAT volume).

Definition at line 71 of file main.c.

◆ s_be

ra8_fs_backend_t s_be
static

ra8_fs backend bridged onto the FAT block device.

Definition at line 74 of file main.c.

◆ s_bstate

ra8_io_blockdev_ram_state_t s_bstate
static

Definition at line 72 of file main.c.

◆ s_demo_rxd

const ra8_port_pin_t s_demo_rxd
static
Initial value:
=
(ra8_port_pin_t)(((uint16_t)k_ra8_port_13 << (uint16_t)k_demo_pin_shift) | (uint16_t)k_ra8_pin_3)
@ k_demo_pin_shift
Port byte position in ra8_port_pin_t.
Definition main.c:62
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
@ k_ra8_port_13
RA8 port 13.
@ k_ra8_pin_3
RA8 pin 3.

SCI8 console RXD = PD03.

Definition at line 63 of file main.c.

◆ s_demo_stub

const ra8_io_fsfmt_t s_demo_stub
static
Initial value:
= {
.name = "stub",
.caps =
{
.max_name_len = (uint16_t)k_demo_stub_maxname,
.read_only = true,
.supports_mkdir = false,
.supports_streaming_write = false,
.case_sensitive = true,
},
.ops = &s_demo_stub_ops,
}
@ k_demo_stub_maxname
Stub format max name length.
Definition main.c:55
static const ra8_io_fsfmt_ops_t s_demo_stub_ops
Complete read-side operations for the bounded foreign descriptor.
Definition main.c:457

Foreign stub format descriptor (read-only, case-sensitive).

Definition at line 479 of file main.c.

Referenced by internal_demo_probe_foreign().

◆ s_demo_stub_file

demo_stub_file_t s_demo_stub_file
static

Caller-independent foreign-format stream state.

Definition at line 99 of file main.c.

Referenced by internal_stub_close(), internal_stub_open(), internal_stub_read(), internal_stub_seek(), internal_stub_size(), internal_stub_tell(), and internal_stub_unmount().

◆ s_demo_stub_mount

demo_stub_mount_t s_demo_stub_mount
static

Caller-independent foreign-format mount state.

Definition at line 97 of file main.c.

Referenced by internal_stub_listdir(), internal_stub_mount(), internal_stub_open(), internal_stub_stat(), and internal_stub_unmount().

◆ s_demo_stub_ops

const ra8_io_fsfmt_ops_t s_demo_stub_ops
static
Initial value:
= {
.write = nullptr,
.sync = nullptr,
.unlink = nullptr,
.rename = nullptr,
.mkdir = nullptr,
.rmdir = nullptr,
.free_space = nullptr,
}
static ra8_err_t internal_stub_tell(const void *file_ctx, uint64_t *out_offset)
Report the current foreign stream offset.
Definition main.c:345
static ra8_err_t internal_stub_size(const void *file_ctx, uint64_t *out_bytes)
Report the immutable foreign payload size.
Definition main.c:371
static ra8_err_t internal_stub_read(void *file_ctx, void *buf, uint32_t bytes, uint32_t *out_read)
Read a bounded prefix from the immutable foreign payload.
Definition main.c:288
static ra8_err_t internal_stub_listdir(void *mount_ctx, const char *path, ra8_fs_listdir_cb_t cb, void *cb_ctx)
Enumerate the foreign root's immutable file.
Definition main.c:438
static bool internal_stub_probe(const ra8_fs_backend_t *be)
Test whether block zero carries the foreign-format stub signature.
Definition main.c:137
static ra8_err_t internal_stub_open(void *mount_ctx, const char *path, ra8_fs_mode_t mode, void **out_file)
Open the immutable foreign demo file.
Definition main.c:225
static ra8_err_t internal_stub_mount(const ra8_fs_backend_t *backend, void **out_mount)
Mount the bounded foreign demo format.
Definition main.c:169
static ra8_err_t internal_stub_unmount(void *mount_ctx)
Release the mounted foreign demo context.
Definition main.c:198
static ra8_err_t internal_stub_close(void *file_ctx)
Close the immutable foreign demo file.
Definition main.c:261
static ra8_err_t internal_stub_seek(void *file_ctx, uint64_t offset_bytes)
Seek within the immutable foreign demo file.
Definition main.c:321
static ra8_err_t internal_stub_stat(void *mount_ctx, const char *path, ra8_fs_stat_t *out)
Report metadata for the foreign root or immutable file.
Definition main.c:399

Complete read-side operations for the bounded foreign descriptor.

Definition at line 457 of file main.c.

◆ s_demo_stub_payload

const uint8_t s_demo_stub_payload[] = "registered-format-data"
static

Immutable contents served by the foreign demo format.

Definition at line 83 of file main.c.

Referenced by internal_stub_listdir(), internal_stub_read(), internal_stub_seek(), internal_stub_size(), and internal_stub_stat().

◆ s_demo_txd

const ra8_port_pin_t s_demo_txd
static
Initial value:
=
(ra8_port_pin_t)(((uint16_t)k_ra8_port_13 << (uint16_t)k_demo_pin_shift) | (uint16_t)k_ra8_pin_2)
@ k_ra8_pin_2
RA8 pin 2.

SCI8 console TXD = PD02.

Definition at line 60 of file main.c.

◆ s_disk

uint8_t s_disk[(size_t) k_demo_disk_blocks *(size_t) k_ra8_io_block_size_bytes]
static

256 KiB RAM-disk backing buffer for the FAT volume (in SRAM .bss).

Definition at line 67 of file main.c.

◆ s_stub_disk

uint8_t s_stub_disk[(size_t) k_demo_stub_blocks *(size_t) k_ra8_io_block_size_bytes]
static

4 KiB RAM-disk backing buffer for the stub-signature volume.

Definition at line 69 of file main.c.

Referenced by internal_demo_probe_foreign().

◆ s_tag

const char* const s_tag = "ra8_io_fsfmt_demo"
static

Module log tag.

Definition at line 80 of file main.c.

◆ s_uart

ra8_io_stream_t s_uart
static

UART output stream + its sink state.

Definition at line 76 of file main.c.

◆ s_ust

Definition at line 77 of file main.c.