21#ifndef MMGR_PRAET_ORDO_H
22#define MMGR_PRAET_ORDO_H
58#define PRAET_RESTITUERE_ET_REDINTEGRARE 0u
67#define PRAET_RESTITUERE_ET_AD_NIHILUM_REDIGERE 1u
82 AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE = 0,
83 AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE = 1
102#if EMBED_HAS_ATTRIBUTE(deprecated)
103#define PRAET_DENUNTIATIO_ATTR(message_) __attribute__((deprecated(message_)))
105#define PRAET_DENUNTIATIO_ATTR(message_)
120 "AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE - this context measures no boundary word. A "
121 "recovery is exact to the word and no "
122 "finer") unsigned
char PraetCrcResponsum_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE;
128 "AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE - this context checksums the word a stalled "
129 "transfer was inside, one word, bit at a time, on the recovery path "
130 "only")
unsigned char PraetCrcResponsum_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE;
138#define PRAET_CRC_RESPONSUM_IN_LOCO_FIGERE(token_) PraetCrcResponsum_##token_
148#define PRAET_CRC_RESPONSUM(token_) PRAET_CRC_RESPONSUM_IN_LOCO_FIGERE(token_)
156#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE 0
161#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE 1
169#define PRAET_CRC_VALUE_IN_LOCO_FIGERE(token_) PRAET_CRC_VALUE_##token_
179#define PRAET_CRC_VALUE(token_) PRAET_CRC_VALUE_IN_LOCO_FIGERE(token_)
189#define PRAET_ORDINEM_INCIPE(crc_choice_) {.word_boundary_crc = PRAET_CRC_VALUE_##crc_choice_}
201#define PRAET_ORDINEM_INCIPE(crc_choice_) {0}
219#define PraetOrdoContext(name_, crc_choice_) \
220 typedef PRAET_CRC_RESPONSUM(crc_choice_) name_##_boundary_word_answer; \
221 EMBED_STATIC_ASSERT( \
222 PRAET_RECOVERY || (PRAET_CRC_VALUE(crc_choice_) == 0), \
223 "AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE needs PRAET_RECOVERY set to 1, since the word it " \
224 "measures is the one a recovery is deciding about"); \
225 static PraetOrdo name_ = PRAET_ORDINEM_INCIPE(crc_choice_)
280 embed_bool word_boundary_crc;
282 embed_word settle_deadline;
283 volatile embed_word praet_set_bitflag;
284 volatile embed_word praet_busy_bitflag;
285 embed_word elapsed_micros;
368#define PraetAttach(context_, channel_, pool_, region_) \
369 (PRAET_ALVEUS_SUPERARE(context_, channel_, pool_), \
370 praet_ordo_adnectere(&(context_), (channel_), mmgr_pars_storage_##pool_, (embed_word)pool_##_bytes, \
371 (embed_word)(region_)))
392#define PraetChannel(context_, channel_, pool_) \
393 EMBED_STATIC_ASSERT((channel_) < PRAET_CHANNELS, \
394 #context_ " has no channel " #channel_ ", because PRAET_CHANNELS says how many it carries"); \
395 EMBED_STATIC_ASSERT(sizeof(mmgr_pars_storage_##pool_) > 0u, \
396 #pool_ " has no bytes for " #context_ " channel " #channel_ " to move"); \
399 context_##_channel##channel_##_is_over_##pool_ = 1 \
411#define PRAET_ALVEUS_SUPERARE(context_, channel_, pool_) ((void)context_##_channel##channel_##_is_over_##pool_)
469#define PRAET_SPAN_FITS(pool_, offset_, length_) \
470 ((void)sizeof(struct { \
471 int this_span_runs_past_the_pool_the_channel_was_attached_over \
472 : (((offset_) + (length_)) <= sizeof(mmgr_pars_storage_##pool_)) \
501embed_word praet_ordo_situs(
const PraetOrdo *context, embed_word channel);
515embed_word praet_ordo_commotus_est(
const PraetOrdo *context, embed_word channel);
529uint32_t praet_ordo_boundary_crc(
const PraetOrdo *context, embed_word channel);
556#define PRAET_SPAN_FITS(pool_, offset_, length_) \
557 ((void)sizeof(struct { \
558 int this_span_runs_past_the_pool_the_channel_was_attached_over \
559 : (((offset_) + (length_)) <= sizeof(mmgr_pars_storage_##pool_)) \
597#define PraetSubmit(context_, channel_, pool_, offset_, length_) \
598 (PRAET_ALVEUS_SUPERARE(context_, channel_, pool_), PRAET_SPAN_FITS(pool_, offset_, length_), \
599 praet_ordo_relatio(&(context_), (channel_), (embed_word)(offset_), (embed_word)(length_)))
601#define PraetSubmit(context_, channel_, pool_, offset_, length_) \
602 (PRAET_ALVEUS_SUPERARE(context_, channel_, pool_), PRAET_SPAN_FITS(pool_, offset_, length_), \
603 praet_ordo_relatio(&(context_), (channel_)))
633embed_bool praet_ordo_resolve(
PraetOrdo *context, embed_word channel, embed_word recovery);
The embedded_types headers every module builds on.
Where the microseconds come from: the caller's clock, or one of ours pinned to a core they name,...
Read after every knob has reported, and the single place a configuration stops the build.
void praet_ordo_efficere(PraetOrdo *context, embed_word channel)
Feeds the watchdog for one channel.
embed_bool praet_ordo_relatio(PraetOrdo *context, embed_word channel)
Marks a channel busy and starts its keepalive window.
void praet_ordo_separare(PraetOrdo *context, embed_word channel)
Asks for a channel to be detached.
#define PRAET_DENUNTIATIO_ATTR(message_)
Marks a declaration so that every use of it reports, carrying a message.
void praet_ordo_advance_ticks(PraetOrdo *context, embed_word ticks)
Advances the clock by ticks, scaled against the declared frequency.
uint16_t praet_hw_progress(embed_word channel)
Returns how far the port says channel has got, in bytes.
PraetRecoveryWordBoundaryBitwiseCrc
The two answers a declaration may give about the boundary word check.
void praet_ordo_advance(PraetOrdo *context, embed_word micros)
Advances the clock by micros.
void praet_ordo_poll(PraetOrdo *context)
Drives the port and brings every flag word up to date. The caller's poll.
uint32_t praet_ordo_flags(const PraetOrdo *context, embed_word channel)
Returns one channel's flag word.
void praet_ordo_reset(PraetOrdo *context)
Clears a context back to every channel detached.
void praet_ordo_raise(PraetOrdo *context)
Stands in for the interrupt raising the set volatile.
embed_bool praet_ordo_adnectere(PraetOrdo *context, embed_word channel, uint8_t *bound, embed_word bytes, embed_word region)
Attaches a channel over a block of bytes, claims its vector, and starts the settle timer.
void praet_ordo_completed(PraetOrdo *context, embed_word channel, embed_bool failed)
Reports that a channel's transfer finished.
Every knob this module reads, what it takes when the caller did not set it, and the warning that says...
#define PRAET_CHANNELS
Logical channels one context carries.
Which states and transitions a run actually reached.
Every bit of the channel flag word, and the assertions that keep the map from drifting.
Everything one context schedules over.