36#ifndef PROTOCORE_HOTSWAP_H
37#define PROTOCORE_HOTSWAP_H
46enum class StorageState : uint8_t
62 uint8_t fail_threshold;
63 uint32_t probe_interval_ms;
64 uint32_t last_probe_ms;
76void pc_hotswap_core_init(HotswapCore *c, uint8_t fail_threshold, uint32_t probe_interval_ms, uint32_t now);
87bool pc_hotswap_core_io(HotswapCore *c,
bool ok);
95bool pc_hotswap_core_due(
const HotswapCore *c, uint32_t now);
105bool pc_hotswap_core_probe(HotswapCore *c,
bool present,
bool mounted, uint32_t now);
112typedef bool (*pc_hotswap_mount)(
void *ctx);
114typedef void (*pc_hotswap_unmount)(
void *ctx);
116typedef bool (*pc_hotswap_present)(
void *ctx);
118typedef void (*pc_hotswap_event)(StorageState from, StorageState to,
void *ctx);
121void pc_hotswap_begin(pc_hotswap_mount mount, pc_hotswap_unmount unmount, pc_hotswap_present present,
void *ctx);
124void pc_hotswap_set_event_cb(pc_hotswap_event cb);
127void pc_hotswap_poll(
void);
128void pc_hotswap_poll_at(uint32_t now);
135bool pc_hotswap_ready(
void);
138void pc_hotswap_io(
bool ok);
141StorageState pc_hotswap_state(
void);
144const char *pc_hotswap_state_name(StorageState s);
150size_t pc_hotswap_json(
char *out,
size_t cap);
User-facing configuration for ProtoCore.