22#ifndef MMGR_PRAET_TABULA_VEXILLORUM_H
23#define MMGR_PRAET_TABULA_VEXILLORUM_H
35#define PRAET_SEPARATUS 0u
40#define PRAET_ADNEXUS 1u
61#define PRAET_CORE_BITS 2u
69#define PRAET_CORE_MASK ((uint32_t)((1u << PRAET_CORE_BITS) - 1u))
74#define PRAET_ID_CLAIMED 0u
79#define PRAET_ID_SETTLING 1u
84#define PRAET_ID_SEPARANS 2u
89#define PRAET_ID_ERROR 3u
94#define PRAET_ID_STALLED 4u
99#define PRAET_ID_ABANDONED 5u
104#define PRAET_ID_SCRUBBED 6u
109#define PRAET_ID_MEASURED 7u
117#define PRAET_STATUS_COUNT 8u
122#define PRAET_STATUS_SHIFT PRAET_CORE_BITS
132#define PRAET_STATUS_BIT(id_) ((uint32_t)1u << (PRAET_STATUS_SHIFT + (id_)))
137#define PRAET_STATUS_MASK ((uint32_t)(((1u << PRAET_STATUS_COUNT) - 1u) << PRAET_STATUS_SHIFT))
145#define PRAET_CLAIMED PRAET_STATUS_BIT(PRAET_ID_CLAIMED)
150#define PRAET_SETTLING PRAET_STATUS_BIT(PRAET_ID_SETTLING)
155#define PRAET_SEPARANS PRAET_STATUS_BIT(PRAET_ID_SEPARANS)
160#define PRAET_ERROR PRAET_STATUS_BIT(PRAET_ID_ERROR)
168#define PRAET_STALLED PRAET_STATUS_BIT(PRAET_ID_STALLED)
176#define PRAET_ABANDONED PRAET_STATUS_BIT(PRAET_ID_ABANDONED)
184#define PRAET_SCRUBBED PRAET_STATUS_BIT(PRAET_ID_SCRUBBED)
196#define PRAET_MEASURED PRAET_STATUS_BIT(PRAET_ID_MEASURED)
205#define PRAET_EVERY_STATUS \
206 (PRAET_CLAIMED | PRAET_SETTLING | PRAET_SEPARANS | PRAET_ERROR | PRAET_STALLED | PRAET_ABANDONED | \
207 PRAET_SCRUBBED | PRAET_MEASURED)
219#define PRAET_REGION_SHIFT 16u
224#define PRAET_REGION_BITS 8u
229#define PRAET_REGION_MAX ((uint32_t)((1u << PRAET_REGION_BITS) - 1u))
234#define PRAET_REGION_MASK (PRAET_REGION_MAX << PRAET_REGION_SHIFT)
244#define PRAET_REGION_FIELD(region_) (((uint32_t)(region_) & PRAET_REGION_MAX) << PRAET_REGION_SHIFT)
261 PRAET_REGION_INTERNAL = 0,
262 PRAET_REGION_EXTERNAL = 1
271#define PRAET_REGION_ID_HIGHEST PRAET_REGION_EXTERNAL
279#define PRAET_MAP_MASK (PRAET_CORE_MASK | PRAET_STATUS_MASK | PRAET_REGION_MASK)
285 "the four core states are not exactly the values PRAET_CORE_MASK holds");
291 "the status token ids are not dense and distinct, or PRAET_EVERY_STATUS is missing one");
298 "the region descriptor sits on top of the quaternary core");
301 "the region descriptor starts below the highest status");
304EMBED_STATIC_ASSERT((
PRAET_REGION_SHIFT % 8u) == 0u,
"the region descriptor is not on a byte boundary");
307 "the map runs off the top of the 32 bit flag word");
313 "PRAET_REGION_FIELD cannot fill the field the map gives it");
316 "PRAET_REGION_FIELD writes outside the region descriptor");
321 "the map is not exactly the core, the statuses and the region");
326 "there are more region token ids than the region descriptor field can hold");
PraetRegion
The regions a channel can attach 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 moves 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.
The embedded_types headers every module builds on.