ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rabook_pipeline_fs.c
Go to the documentation of this file.
1
13
14#include <stdint.h>
15
16#include "ra8_check.h"
17#include "ra8_fs.h"
18#include "ra8_rabook_pipeline.h"
20
22 const ra8_rabook_buffers_t* buffers,
23 const ra8_rabook_pipeline_scratch_t* scratch,
24 ra8_fs_mount_t* mount,
25 const char* out_path)
26{
27 static const char* const tag = "ra8_rabook_pipeline";
28 ra8_err_t error = priv_rabook_pipeline_check_common(epub, buffers, scratch);
29 if (error != k_ra8_ok) {
30 return error;
31 }
32 RA8_CHECK_NULL_PTR(mount, tag, "mount");
33 RA8_CHECK_NULL_PTR(out_path, tag, "out_path");
34
35 const void* blob = nullptr;
36 uint32_t blob_len = 0U;
37 error = rabook_compile_from_epub_to_buffer(epub, buffers, scratch, &blob, &blob_len);
38 if (error != k_ra8_ok) {
39 return error;
40 }
41 return ra8_fs_write_file(mount, out_path, (const uint8_t*)blob, blob_len);
42}
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_err_t ra8_fs_write_file(ra8_fs_mount_t *handle, const char *path, const uint8_t *data, uint32_t len)
Create a whole file in one call (provisioning helper).
ra8_err_t priv_rabook_pipeline_check_common(const epub_book_t *epub, const ra8_rabook_buffers_t *bufs, const ra8_rabook_pipeline_scratch_t *scr)
Reject any NULL among the three arguments common to both compile entry points (rabook_compile_from_ep...
End-to-end EPUB -> RABOOK1 compile pipeline (#149).
ra8_err_t rabook_compile_from_epub_to_buffer(epub_book_t *epub, const ra8_rabook_buffers_t *bufs, const ra8_rabook_pipeline_scratch_t *scr, const void **out_blob, uint32_t *out_len)
Compile an open EPUB into a RABOOK1 blob left in bufs->out, with no filesystem write.
ra8_err_t rabook_compile_from_epub(epub_book_t *epub, const ra8_rabook_buffers_t *buffers, const ra8_rabook_pipeline_scratch_t *scratch, ra8_fs_mount_t *mount, const char *out_path)
Compile an open EPUB into a RABOOK1 blob written to out_path on the SD filesystem.
Private validation seam shared by RABOOK pipeline entry points.
Opened EPUB book.
Definition epub.h:286
Cached parse of one mounted FAT volume.
Caller-owned, fixed-capacity arenas the builder appends into (no heap).
Caller-owned temporary buffers the pipeline stage needs.