ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_devcfg.h
Go to the documentation of this file.
1
64
65#pragma once
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71#include <stdint.h>
72
73#include "ra8_err.h"
74
104
117
148
168
179typedef enum : uint32_t {
184
217
233typedef struct {
235 uint32_t flags;
236 uint32_t seq;
237 uint16_t schema_version;
239
264typedef ra8_err_t (*ra8_devcfg_read_fn_t)(uint32_t offset, uint8_t* dst, uint32_t len);
265
289typedef ra8_err_t (*ra8_devcfg_write_fn_t)(uint32_t offset, const uint8_t* src, uint32_t len);
290
324
358[[nodiscard]] ra8_err_t ra8_devcfg_load(const ra8_devcfg_store_t* store);
359
391[[nodiscard]] ra8_err_t ra8_devcfg_get_vcom_mv(uint16_t* out_mv);
392
420[[nodiscard]] ra8_err_t ra8_devcfg_get_body(const ra8_devcfg_body_t** out_body);
421
443[[nodiscard]] bool ra8_devcfg_is_blank(void);
444
478[[nodiscard]] ra8_err_t ra8_devcfg_commit(const ra8_devcfg_store_t* store,
479 const ra8_devcfg_record_t* rec);
480
501void ra8_devcfg_reset(void);
502
529
530#ifdef __cplusplus
531}
532#endif
-proof
ra8_err_t(* ra8_devcfg_write_fn_t)(uint32_t offset, const uint8_t *src, uint32_t len)
Backing-store write (dependency-injection seam).
Definition ra8_devcfg.h:289
void ra8_devcfg_reset(void)
Drop the cached record so a later load re-resolves from scratch.
Definition ra8_devcfg.c:626
ra8_devcfg_layout_t
Record geometry, magic, schema version and extra-MRAM placement.
Definition ra8_devcfg.h:92
@ k_ra8_devcfg_body_bytes
Per-unit payload bytes.
Definition ra8_devcfg.h:96
@ k_ra8_devcfg_page_bytes
Extra-MRAM program page.
Definition ra8_devcfg.h:100
@ k_ra8_devcfg_slot_bytes
Reserved slot pitch per copy.
Definition ra8_devcfg.h:98
@ k_ra8_devcfg_schema_ver
Current schema version.
Definition ra8_devcfg.h:94
@ k_ra8_devcfg_magic
"RA8C" record marker.
Definition ra8_devcfg.h:93
@ k_ra8_devcfg_record_len
Active record = header + body.
Definition ra8_devcfg.h:97
@ k_ra8_devcfg_sig_headroom
slot - record: future signature.
Definition ra8_devcfg.h:99
@ k_ra8_devcfg_copy0_off
Copy 0 offset in extra-MRAM.
Definition ra8_devcfg.h:101
@ k_ra8_devcfg_copy1_off
Copy 1 offset in extra-MRAM.
Definition ra8_devcfg.h:102
@ k_ra8_devcfg_hdr_bytes
Header page (written LAST).
Definition ra8_devcfg.h:95
ra8_err_t ra8_devcfg_commit(const ra8_devcfg_store_t *store, const ra8_devcfg_record_t *rec)
Commit a new record to the stale copy slot with header-last ordering.
Definition ra8_devcfg.c:609
ra8_err_t ra8_devcfg_load(const ra8_devcfg_store_t *store)
Load and resolve the device configuration record from both copies.
Definition ra8_devcfg.c:549
ra8_devcfg_field_len_t
Fixed byte lengths of the variable-width body fields.
Definition ra8_devcfg.h:109
@ k_ra8_devcfg_panel_serial_len
Panel identity, NUL-padded.
Definition ra8_devcfg.h:111
@ k_ra8_devcfg_touch_cal_len
ra8_touch_cal_save blob.
Definition ra8_devcfg.h:113
@ k_ra8_devcfg_body_rsvd_len
Body reserved padding.
Definition ra8_devcfg.h:115
@ k_ra8_devcfg_hdr_rsvd_len
Header reserved padding.
Definition ra8_devcfg.h:114
@ k_ra8_devcfg_serial_len
Unit serial, NUL-padded.
Definition ra8_devcfg.h:110
@ k_ra8_devcfg_panel_lut_len
Panel LUT id, e.g.
Definition ra8_devcfg.h:112
ra8_devcfg_flags_t
Per-record status flags stored in the header flags word.
Definition ra8_devcfg.h:179
@ k_ra8_devcfg_flag_touch_valid
touch_cal blob is real.
Definition ra8_devcfg.h:182
@ k_ra8_devcfg_flag_provisioned
Line self-test passed.
Definition ra8_devcfg.h:180
@ k_ra8_devcfg_flag_vcom_valid
panel_vcom_mv is real.
Definition ra8_devcfg.h:181
ra8_devcfg_off_t
Byte offset of every field inside a serialised record.
Definition ra8_devcfg.h:129
@ k_ra8_devcfg_off_vcom
u16 panel VCOM magnitude (mV).
Definition ra8_devcfg.h:145
@ k_ra8_devcfg_off_fixture
u16 provisioning fixture id.
Definition ra8_devcfg.h:144
@ k_ra8_devcfg_off_hw_rev
u16 board revision.
Definition ra8_devcfg.h:143
@ k_ra8_devcfg_off_magic
u32 magic.
Definition ra8_devcfg.h:130
@ k_ra8_devcfg_off_serial
char[16] serial (body start).
Definition ra8_devcfg.h:137
@ k_ra8_devcfg_off_crc
u32 CRC-32 of the body.
Definition ra8_devcfg.h:134
@ k_ra8_devcfg_off_mfg_date
u32 packed YYYYMMDD.
Definition ra8_devcfg.h:141
@ k_ra8_devcfg_off_panel_lut
char[8] panel LUT id.
Definition ra8_devcfg.h:139
@ k_ra8_devcfg_off_seq
u32 monotonic sequence.
Definition ra8_devcfg.h:133
@ k_ra8_devcfg_off_panel_serial
char[12] panel serial.
Definition ra8_devcfg.h:138
@ k_ra8_devcfg_off_schema
u16 schema_version.
Definition ra8_devcfg.h:131
@ k_ra8_devcfg_off_flags
u32 ra8_devcfg_flags_t.
Definition ra8_devcfg.h:135
@ k_ra8_devcfg_off_key_id
u32 device-key identifier.
Definition ra8_devcfg.h:142
@ k_ra8_devcfg_off_hdr_rsvd
12 reserved header bytes.
Definition ra8_devcfg.h:136
@ k_ra8_devcfg_off_reclen
u16 record_len.
Definition ra8_devcfg.h:132
@ k_ra8_devcfg_off_body_rsvd
10 reserved body bytes.
Definition ra8_devcfg.h:146
@ k_ra8_devcfg_off_touch_cal
uint8[36] touch-cal blob.
Definition ra8_devcfg.h:140
ra8_err_t(* ra8_devcfg_read_fn_t)(uint32_t offset, uint8_t *dst, uint32_t len)
Backing-store read (dependency-injection seam).
Definition ra8_devcfg.h:264
ra8_devcfg_vcom_range_t
Plausible-range guard for the stored VCOM magnitude, millivolts.
Definition ra8_devcfg.h:164
@ k_ra8_devcfg_vcom_max_mv
Highest accepted VCOM magnitude, mV.
Definition ra8_devcfg.h:166
@ k_ra8_devcfg_vcom_min_mv
Lowest accepted VCOM magnitude, mV.
Definition ra8_devcfg.h:165
bool ra8_devcfg_is_blank(void)
Report whether neither record copy is valid (the provisioning gate).
Definition ra8_devcfg.c:604
ra8_err_t ra8_devcfg_get_vcom_mv(uint16_t *out_mv)
Fetch the validated panel VCOM magnitude in millivolts.
Definition ra8_devcfg.c:575
ra8_err_t ra8_devcfg_get_body(const ra8_devcfg_body_t **out_body)
Expose the decoded body of the loaded record.
Definition ra8_devcfg.c:594
const ra8_devcfg_store_t * ra8_devcfg_default_store(void)
Return the production extra-MRAM-backed store binding.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Decoded per-unit payload (the 96-byte record body).
Definition ra8_devcfg.h:206
uint16_t hw_rev
Board revision.
Definition ra8_devcfg.h:213
uint32_t mfg_date
Packed YYYYMMDD.
Definition ra8_devcfg.h:211
char serial[k_ra8_devcfg_serial_len]
Unit serial, NUL-padded.
Definition ra8_devcfg.h:207
uint16_t fixture_id
Provisioning-line fixture id.
Definition ra8_devcfg.h:214
uint8_t touch_cal[k_ra8_devcfg_touch_cal_len]
ra8_touch_cal_save() blob.
Definition ra8_devcfg.h:210
uint16_t panel_vcom_mv
VCOM magnitude, mV (sign -ve).
Definition ra8_devcfg.h:215
char panel_serial[k_ra8_devcfg_panel_serial_len]
Panel identity, NUL-padded.
Definition ra8_devcfg.h:208
uint32_t device_key_id
Key identifier; NEVER key data.
Definition ra8_devcfg.h:212
char panel_lut_id[k_ra8_devcfg_panel_lut_len]
Panel LUT id from GET_DEV_INFO.
Definition ra8_devcfg.h:209
Decoded record: the body plus the header discriminators.
Definition ra8_devcfg.h:233
uint32_t flags
ra8_devcfg_flags_t bit-set.
Definition ra8_devcfg.h:235
uint32_t seq
Monotonic sequence of this record.
Definition ra8_devcfg.h:236
uint16_t schema_version
Schema the record was written under.
Definition ra8_devcfg.h:237
ra8_devcfg_body_t body
Per-unit payload.
Definition ra8_devcfg.h:234
Dependency-injection vtable for the record backing store.
Definition ra8_devcfg.h:320
ra8_devcfg_read_fn_t read
Backing read; non-NULL.
Definition ra8_devcfg.h:321