23#ifndef MMGR_PRAET_TABULA_VEXILLORUM_H
24#define MMGR_PRAET_TABULA_VEXILLORUM_H
33#define PRAET_SEPARATUS 0u
38#define PRAET_ADNEXUS 1u
59#define PRAET_CORE_BITS 2u
67#define PRAET_CORE_MASK ((uint32_t)((1u << PRAET_CORE_BITS) - 1u))
72#define PRAET_ID_CLAIMED 0u
77#define PRAET_ID_SETTLING 1u
82#define PRAET_ID_SEPARANS 2u
87#define PRAET_ID_ERROR 3u
92#define PRAET_ID_STALLED 4u
97#define PRAET_ID_ABANDONED 5u
102#define PRAET_ID_SCRUBBED 6u
107#define PRAET_ID_MEASURED 7u
115#define PRAET_STATUS_COUNT 8u
120#define PRAET_STATUS_SHIFT PRAET_CORE_BITS
130#define PRAET_STATUS_BIT(id_) ((uint32_t)1u << (PRAET_STATUS_SHIFT + (id_)))
135#define PRAET_STATUS_MASK ((uint32_t)(((1u << PRAET_STATUS_COUNT) - 1u) << PRAET_STATUS_SHIFT))
143#define PRAET_CLAIMED PRAET_STATUS_BIT(PRAET_ID_CLAIMED)
148#define PRAET_SETTLING PRAET_STATUS_BIT(PRAET_ID_SETTLING)
153#define PRAET_SEPARANS PRAET_STATUS_BIT(PRAET_ID_SEPARANS)
158#define PRAET_ERROR PRAET_STATUS_BIT(PRAET_ID_ERROR)
166#define PRAET_STALLED PRAET_STATUS_BIT(PRAET_ID_STALLED)
174#define PRAET_ABANDONED PRAET_STATUS_BIT(PRAET_ID_ABANDONED)
182#define PRAET_SCRUBBED PRAET_STATUS_BIT(PRAET_ID_SCRUBBED)
194#define PRAET_MEASURED PRAET_STATUS_BIT(PRAET_ID_MEASURED)
203#define PRAET_EVERY_STATUS \
204 (PRAET_CLAIMED | PRAET_SETTLING | PRAET_SEPARANS | PRAET_ERROR | PRAET_STALLED | PRAET_ABANDONED | \
205 PRAET_SCRUBBED | PRAET_MEASURED)
217#define PRAET_REGION_SHIFT 16u
222#define PRAET_REGION_BITS 8u
227#define PRAET_REGION_MAX ((uint32_t)((1u << PRAET_REGION_BITS) - 1u))
232#define PRAET_REGION_MASK (PRAET_REGION_MAX << PRAET_REGION_SHIFT)
242#define PRAET_REGION_FIELD(region_) (((uint32_t)(region_) & PRAET_REGION_MAX) << PRAET_REGION_SHIFT)
259 PRAET_REGION_INTERNAL = 0,
260 PRAET_REGION_EXTERNAL = 1
269#define PRAET_REGION_ID_HIGHEST PRAET_REGION_EXTERNAL
278#define PRAET_MAP_MASK (PRAET_CORE_MASK | PRAET_STATUS_MASK | PRAET_REGION_MASK)
284 "the four core states are not exactly the values PRAET_CORE_MASK holds");
290 "the status token ids are not dense and distinct, or PRAET_EVERY_STATUS is missing one");
297 "the region descriptor sits on top of the quaternary core");
300 "the region descriptor starts below the highest status");
303EMBED_STATIC_ASSERT((
PRAET_REGION_SHIFT % 8u) == 0u,
"the region descriptor is not on a byte boundary");
306 "the map runs off the top of the 32 bit flag word");
312 "PRAET_REGION_FIELD cannot fill the field the map gives it");
315 "PRAET_REGION_FIELD writes outside the region descriptor");
320 "the map is not exactly the core, the statuses and the region");
325 "there are more region token ids than the region descriptor field can hold");
The embedded_types headers every module builds on.
PraetRegion
The regions a channel can be attached over.
#define PRAET_STATUS_MASK
Every bit the statuses occupy, derived from how many there are.
#define PRAET_SEPARATUS
Detached: the channel holds no engine and no vector.
#define PRAET_BUSY
Busy: the engine is moving bytes on this channel.
#define PRAET_MAP_MASK
Every bit the map accounts for.
#define PRAET_OK
Ok: the last transfer finished and the channel is still attached.
#define PRAET_CORE_MASK
The two bits the quaternary core occupies.
#define PRAET_REGION_FIELD(region_)
A region descriptor placed in the field the map gives it.
#define PRAET_STATUS_COUNT
How many status token ids there are.
#define PRAET_REGION_BITS
How wide the region descriptor is.
#define PRAET_ADNEXUS
Attached: the channel holds the engine and will take a transfer.
#define PRAET_EVERY_STATUS
Every status, listed by name.
#define PRAET_REGION_MAX
The largest descriptor the region field holds.
#define PRAET_REGION_SHIFT
First bit of the region descriptor.
#define PRAET_REGION_MASK
The bits the region descriptor occupies once shifted into place.
#define PRAET_STATUS_SHIFT
First bit the statuses occupy, the bit above the core.
#define PRAET_REGION_ID_HIGHEST
The largest region token id there is.