Config is now loaded at runtime via WebSocket (ConfigCtrlMessage) instead of from hardcoded TOML files. The emulator starts with no devices and waits for clients to send configuration. - Define FlatBuffers schemas: EmulationConfig, ComposeDeviceConfig, BaseDeviceConfig with recursive DeviceConfig union - Rename MemSegment.start → addr (flatcc builder/reader name collision) - Add ConfigCtrlMessage handler: validates STILL state, walks the device tree depth-first, assigns numeric IDs, responds with DeviceIdMappingNotif or ConfigLoadError - Add fb_build_config_device_id_mapping() and fb_build_config_error() FlatBuffer builders - Remove hardcoded device loading from main.c; iterate dynamically loaded devices in the exec loop - Fix double-free: freeConf() already frees the struct itself, remove redundant free() calls in config.c and base_device.c - Fix heap-buffer-overflow in device parseSpecsFromConfig: malloc for segment name was missing +1 for the null terminator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
namespace hmmmm.ctrl.config_notif;
|
|
|
|
// Notification subtype 0001 — a device's configuration was updated.
|
|
// Carries the path of the affected device; client should re-request full config.
|
|
table DeviceConfigUpdateNotif {
|
|
device_path: [string]; // hierarchical path, e.g. ["core"] or ["gpio_a"]
|
|
}
|
|
|
|
// Numeric ID assigned to one named segment within a device.
|
|
table SegIdEntry {
|
|
name: string;
|
|
id: uint32;
|
|
}
|
|
|
|
// Maps a hierarchical device path to a compact numeric device_id + segment IDs.
|
|
// Clients use these IDs in stream and mem packets instead of string paths.
|
|
table DeviceIdEntry {
|
|
path: [string]; // hierarchical device id, e.g. ["sys", "core"]
|
|
device_id: uint32;
|
|
seg_ids: [SegIdEntry];
|
|
}
|
|
|
|
// Notification subtype 0010 — full device-id / segment-id mapping table.
|
|
// Sent after auth and after any config change that affects the device tree.
|
|
table DeviceIdMappingNotif {
|
|
entries: [DeviceIdEntry];
|
|
}
|
|
|
|
// Sent when a config load request fails.
|
|
table ConfigLoadError {
|
|
message: string;
|
|
}
|
|
|
|
union ConfigNotifPayload {
|
|
DeviceConfigUpdateNotif,
|
|
DeviceIdMappingNotif,
|
|
ConfigLoadError,
|
|
}
|
|
|
|
table ConfigNotifMessage {
|
|
tclk: uint64;
|
|
payload: ConfigNotifPayload;
|
|
}
|