|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
Generic ground-loadable table engine implementation. More...
Go to the source code of this file.
Data Structures | |
| struct | tbl_slot_t |
Functions | |
| static tbl_slot_t * | find_slot (tbl_id_t id) |
| void | __tbl_init (void) |
| bool | __tbl_register (const tbl_descriptor_t *desc) |
| bool | __tbl_load (tbl_id_t id, const uint8_t *data, uint16_t len, uint16_t schema_crc) |
| bool | __tbl_activate_prepare (tbl_id_t id, uint8_t *out_data, uint16_t *out_len, tbl_activate_fn *out_activate) |
| Validate a staged table and copy it into a caller-provided scratch buffer for the activate callback. | |
| bool | __tbl_activate_commit (tbl_id_t id, const uint8_t *data, uint16_t len) |
| Commit a previously prepared table into the active buffer. | |
| int16_t | __tbl_dump (tbl_id_t id, uint8_t *out, uint16_t max) |
| const tbl_descriptor_t * | __tbl_get_descriptor (tbl_id_t id) |
| uint8_t | __tbl_count (void) |
Variables | |
| static tbl_slot_t | registry [8] |
| static uint8_t | reg_count |
Generic ground-loadable table engine implementation.
Maintains a registry of up to TBL_MAX_REGISTERED table descriptors. Each registered table has a staging buffer and an active buffer (double-buffered swap):
Registry, staging, and active buffers all live in DTCM_DATA_PRIV. Public access goes through SVC gates.
tbl_activate is split across two privileged calls so the user activate callback can run in thread mode between them:
__tbl_activate_prepare() — validate + copy staging into a caller-provided scratch buffer user activate(scratch) — runs in thread mode, no SVC __tbl_activate_commit() — copy scratch into active
The engine itself is silent — no logging dependency.
Definition in file tables.c.
| bool __tbl_activate_commit | ( | tbl_id_t | id, |
| const uint8_t * | data, | ||
| uint16_t | len | ||
| ) |
Commit a previously prepared table into the active buffer.
Called only after the user activate callback has succeeded.
< Maximum bytes per table buffer
Definition at line 176 of file tables.c.
References tbl_slot_t::active, tbl_slot_t::active_len, find_slot(), and TBL_MAX_SIZE.
Referenced by SVC_Handler_C(), and tbl_activate().
| bool __tbl_activate_prepare | ( | tbl_id_t | id, |
| uint8_t * | out_data, | ||
| uint16_t * | out_len, | ||
| tbl_activate_fn * | out_activate | ||
| ) |
Validate a staged table and copy it into a caller-provided scratch buffer for the activate callback.
The active buffer is not touched yet.
| id | Table id. |
| out_data | Caller scratch buffer (must be ≥ TBL_MAX_SIZE). |
| out_len | [out] Number of bytes written to scratch. |
| out_activate | [out] Pointer to the user activate callback (or NULL). |
Definition at line 139 of file tables.c.
References tbl_descriptor_t::activate, crc16_ccitt(), tbl_slot_t::desc, find_slot(), tbl_descriptor_t::schema_crc, tbl_descriptor_t::size, tbl_slot_t::staged_data_crc, tbl_slot_t::staged_len, tbl_slot_t::staged_schema_crc, tbl_slot_t::staged_valid, and tbl_slot_t::staging.
Referenced by SVC_Handler_C(), and tbl_activate().
| uint8_t __tbl_count | ( | void | ) |
Definition at line 216 of file tables.c.
References reg_count.
Referenced by SVC_Handler_C(), and tbl_count().
| int16_t __tbl_dump | ( | tbl_id_t | id, |
| uint8_t * | out, | ||
| uint16_t | max | ||
| ) |
Definition at line 190 of file tables.c.
References tbl_slot_t::active, tbl_slot_t::active_len, and find_slot().
Referenced by SVC_Handler_C(), and tbl_dump().
| const tbl_descriptor_t * __tbl_get_descriptor | ( | tbl_id_t | id | ) |
Definition at line 211 of file tables.c.
References tbl_slot_t::desc, and find_slot().
Referenced by SVC_Handler_C(), and tbl_get_descriptor().
| void __tbl_init | ( | void | ) |
Definition at line 71 of file tables.c.
References reg_count, and registry.
Referenced by SVC_Handler_C(), and tbl_init().
| bool __tbl_load | ( | tbl_id_t | id, |
| const uint8_t * | data, | ||
| uint16_t | len, | ||
| uint16_t | schema_crc | ||
| ) |
< Maximum bytes per table buffer
Definition at line 100 of file tables.c.
References crc16_ccitt(), tbl_slot_t::desc, find_slot(), tbl_descriptor_t::size, tbl_slot_t::staged_data_crc, tbl_slot_t::staged_len, tbl_slot_t::staged_schema_crc, tbl_slot_t::staged_valid, tbl_slot_t::staging, and TBL_MAX_SIZE.
Referenced by SVC_Handler_C(), and tbl_load().
| bool __tbl_register | ( | const tbl_descriptor_t * | desc | ) |
< Maximum number of registered tables
< Maximum bytes per table buffer
< Maximum name length (incl. NUL)
Definition at line 76 of file tables.c.
References tbl_slot_t::desc, tbl_descriptor_t::id, tbl_descriptor_t::name, reg_count, registry, tbl_descriptor_t::size, TBL_MAX_REGISTERED, TBL_MAX_SIZE, and TBL_NAME_LEN.
Referenced by SVC_Handler_C(), and tbl_register().
|
static |
Definition at line 60 of file tables.c.
References reg_count, and registry.
Referenced by __tbl_activate_commit(), __tbl_activate_prepare(), __tbl_dump(), __tbl_get_descriptor(), and __tbl_load().
|
static |
Definition at line 56 of file tables.c.
Referenced by __tbl_count(), __tbl_init(), __tbl_register(), and find_slot().
|
static |
Definition at line 55 of file tables.c.
Referenced by __tbl_init(), __tbl_register(), and find_slot().