MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
memoriam_praetereo — DMA transfers

Data Structures

struct  mmgr_praet_event
 What the port layer reports when a transfer finishes. More...
struct  PraetCallbackCfg
 A completion callback and the pointer passed back to it. More...
struct  PraetCfg
 Arguments for a channel open, and for a poll of one. More...
struct  PraetTransferCfg
 Arguments for a transfer submit, and for a channel close. More...
struct  MemoriamPraetereoNs
 Type of the praet dispatch table. More...
struct  PraetDescriptor
 One transfer, written down. More...
struct  PraetOrdo
 Everything one context schedules over. More...

Macros

#define PRAET_MENSURA_MAXIMA
 The largest measure this module knows about.
#define PRAET_DIRECTIO_MOTUS_VERBI_FOR(from_, to_, bytes_)
 The direction of the movement of the word, for two spans of one pool.
#define PRAET_STEPS_FIT(what_, pool_, offset_, bytes_, mensura_)
 Fails the build where one end of a transfer does not sit whole steps inside its pool.
#define PRAET_DESCRIPTOR_BODY(name_, source_, source_mode_, dest_, dest_mode_, bytes_, mensura_, motus_, next_)
 Declares one memory to memory transfer, and what runs after it.
#define PraetDescriptorDeclare(name_, from_pool_, from_offset_, to_pool_, to_offset_, bytes_, mensura_, motus_, next_)
 Declares one memory to memory transfer, and what runs after it.
#define PRAET_DESCRIPTOR_ENDS_DIFFER(name_, from_pool_, to_pool_)
 Fails the build where a transfer between two pools names one pool twice.
#define PraetOneShot(name_, from_pool_, from_offset_, to_pool_, to_offset_, bytes_, mensura_)
 Declares one transfer that runs once and stops.
#define PraetDescriptorWithin(name_, pool_, from_offset_, to_offset_, bytes_, mensura_, next_)
 Declares one transfer that moves bytes inside a single pool, and works out which way.
#define PraetCircular(name_, from_pool_, from_offset_, to_pool_, to_offset_, bytes_, mensura_)
 Declares one transfer that runs itself again, forever.
#define PraetPingPong(first_, second_, from_pool_, to_pool_, first_from_, first_to_, second_from_, second_to_, bytes_, mensura_)
 Declares two transfers that hand off to each other, forever.
#define PraetPeripheralDeclare(name_, address_)
 Declares one peripheral register a transfer may reach.
#define PraetToPeripheral(name_, from_pool_, from_offset_, peripheral_, address_, at_offset_, bytes_, mensura_, next_)
 Declares one transfer that reads a pool and writes a peripheral.
#define PraetFromPeripheral(name_, peripheral_, address_, at_offset_, to_pool_, to_offset_, bytes_, mensura_, next_)
 Declares one transfer that reads a peripheral and writes a pool.
#define PRAET_DENUNTIATIO_ATTR(message_)
 Marks a declaration so that every use of it reports, with a message.
#define PRAET_CRC_RESPONSUM_IN_LOCO_FIGERE(token_)
 Pastes token_ onto the answer type prefix.
#define PRAET_CRC_RESPONSUM(token_)
 The answer type token_ names, after its expansion.
#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE
 The value the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE token is for.
#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE
 The value the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE token is for.
#define PRAET_CRC_VALUE_IN_LOCO_FIGERE(token_)
 Pastes token_ onto the value prefix.
#define PRAET_CRC_VALUE(token_)
 The value token_ is for, after its expansion.
#define PRAET_ORDINEM_INCIPE(crc_choice_)
 An empty context, for a build with no recovery machinery to configure.
#define PraetOrdoContext(name_, crc_choice_)
 Declares one schedule context and answers the boundary word question for it.
#define PraetAttach(context_, channel_, pool_, region_)
 Attaches a channel over a declared pool, by name.
#define PraetChannel(context_, channel_, pool_)
 Declares which pool a channel of a context is over.
#define PRAET_ALVEUS_SUPERARE(context_, channel_, pool_)
 Names the binding of a channel's declaration, and fails where there is none.
#define PRAET_SPAN_FITS(pool_, offset_, length_)
 Fails the build when a span runs past the pool it names.
#define PraetSubmit(context_, channel_, pool_, offset_, length_)
 Submits a span of a declared pool on a channel attached over that pool.
#define PRAET_CHANNELS
 Logical channels one context carries.
#define PRAET_UNSET_CHANNELS
#define PRAET_SETTLE_MICROS
 Microseconds the engine spends in its settle before it will take a transfer.
#define PRAET_UNSET_SETTLE_MICROS
#define PRAET_KEEPALIVE_MICROS
 Microseconds an active channel may go with no kick from the port before it reads stalled.
#define PRAET_UNSET_KEEPALIVE_MICROS
#define PRAET_RECOVERY
 Whether a stalled transfer can go back or come out scrubbed.
#define PRAET_UNSET_RECOVERY
#define PRAET_OPTIMIZE
 Whether a run records the work it did, on top of the states it reached.
#define PRAET_PROCURATOR
 Whether a run records the states and transitions it reached.
#define praet_procurator_transitus(channel_, was_, now_)
 Expands to nothing where PRAET_PROCURATOR is 0.
#define praet_procurator_report()
 Expands to nothing where PRAET_PROCURATOR is 0.
#define praet_procurator_opus(type_)
 Expands to nothing where PRAET_OPTIMIZE is 0.
#define PRAET_SEPARATUS
 Detached: the channel holds no engine and no vector.
#define PRAET_ADNEXUS
 Attached: the channel holds the engine and will take a transfer.
#define PRAET_BUSY
 Busy: the engine moves bytes on this channel.
#define PRAET_OK
 Ok: the last transfer finished and the channel is still attached.
#define PRAET_CORE_BITS
 Bits the quaternary core occupies, at the bottom of the word.
#define PRAET_CORE_MASK
 The two bits the quaternary core occupies.
#define PRAET_ID_CLAIMED
 Token id of the status set while the channel holds an interrupt vector.
#define PRAET_ID_SETTLING
 Token id of the status set while the engine settles.
#define PRAET_ID_SEPARANS
 Token id of the status set while a detach is in progress.
#define PRAET_ID_ERROR
 Token id of the status set where the last transfer ended in an error.
#define PRAET_ID_STALLED
 Token id of the status set where an active channel went unkicked for a whole window.
#define PRAET_ID_ABANDONED
 Token id of the status set where a stalled transfer went back.
#define PRAET_ID_SCRUBBED
 Token id of the status set where a stalled transfer's bytes counted as unsafe.
#define PRAET_ID_MEASURED
 Token id of the status set where a recovery measured the boundary word.
#define PRAET_STATUS_COUNT
 How many status token ids there are.
#define PRAET_STATUS_SHIFT
 First bit the statuses occupy, the bit above the core.
#define PRAET_STATUS_BIT(id_)
 The bit a status token id owns.
#define PRAET_STATUS_MASK
 Every bit the statuses occupy, derived from how many there are.
#define PRAET_CLAIMED
 Set while the channel holds an interrupt vector.
#define PRAET_SETTLING
 Set while the engine settles and will take no transfer.
#define PRAET_SEPARANS
 Set where a detach is in progress and the channel did not finish it.
#define PRAET_ERROR
 Set where the last transfer ended in an error, clear where it completed.
#define PRAET_STALLED
 Set where an active channel went a whole keepalive window with no kick.
#define PRAET_ABANDONED
 Set where a stalled transfer went back and its bytes stayed as they were.
#define PRAET_SCRUBBED
 Set where a stalled transfer resolved with its bytes counted as unsafe.
#define PRAET_MEASURED
 Set where a recovery measured the word the engine was in the middle of.
#define PRAET_EVERY_STATUS
 Every status, listed by name.
#define PRAET_REGION_SHIFT
 First bit of the region descriptor.
#define PRAET_REGION_BITS
 How wide the region descriptor is.
#define PRAET_REGION_MAX
 The largest descriptor the region field holds.
#define PRAET_REGION_MASK
 The bits the region descriptor occupies once shifted into place.
#define PRAET_REGION_FIELD(region_)
 A region descriptor placed in the field the map gives it.
#define PRAET_REGION_ID_HIGHEST
 The largest region token id there is.
#define PRAET_MAP_MASK
 Every bit the map accounts for.

Typedefs

typedef void(*) mmgr_praet_callback(const mmgr_praet_event *event, void *user)
 Reports a finished transfer to whatever registered this callback.

Enumerations

enum  PraetAddressing {
  PRAET_ADDRESS_ADVANCES ,
  PRAET_ADDRESS_FIXED
}
 How an address behaves as a transfer runs. More...
enum  EgoSumMensura {
  PRAET_MENSURA_OCTETUS ,
  PRAET_MENSURA_SEMIVERBUM ,
  PRAET_MENSURA_VERBUM
}
 Bytes the engine moves in one step, the measure of everything else. More...
enum  DirectioMotusVerbi {
  PRAET_MOTUS_NEUTRUM ,
  PRAET_MOTUS_SURSUM ,
  PRAET_MOTUS_DEORSUM
}
 Which way a transfer walks the words it moves. More...
enum  PraetDescriptorOwner {
  PRAET_OWNER_SOFTWARE ,
  PRAET_OWNER_ENGINE
}
 Who holds a descriptor. More...
enum  PraetRecoveryWordBoundaryBitwiseCrc {
  AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE ,
  AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE
}
 The two answers a declaration may give about the boundary word check. More...
enum  PraetRegion {
  PRAET_REGION_INTERNAL ,
  PRAET_REGION_EXTERNAL
}
 The regions a channel can attach over. More...

Functions

EMBED_HOST_DEVICE embed_bool mmgr_praet_open (const PraetCfg *args)
 Opens args->channel and registers args->on_complete against it.
EMBED_HOST_DEVICE embed_bool mmgr_praet_tx_submit (const PraetTransferCfg *args)
 Submits args->bytes of args->buf on args->channel.
EMBED_HOST_DEVICE void mmgr_praet_close (const PraetTransferCfg *args)
 Closes args->channel.
EMBED_HOST_DEVICE void mmgr_praet_poll (const PraetCfg *args)
 Drives the port layer's poll hook.
EMBED_HOST_DEVICE embed_bool mmgr_praet_hw_open (const PraetCfg *args)
 Opens a DMA channel on real hardware.
EMBED_HOST_DEVICE embed_bool mmgr_praet_hw_tx_submit (const PraetTransferCfg *args)
 Submits a transfer on real hardware.
EMBED_HOST_DEVICE void mmgr_praet_hw_close (const PraetTransferCfg *args)
 Closes a DMA channel on real hardware.
EMBED_HOST_DEVICE void mmgr_praet_hw_poll (const PraetCfg *args)
 Advances whatever poll work the port layer needs.
EMBED_HOST_DEVICE embed_word praet_descriptor_chain_length (const PraetDescriptor *first, embed_word limit)
 Counts the descriptors a chain reaches before it repeats or ends.
typedef PRAET_DENUNTIATIO_ATTR ("AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE - this context measures no boundary word. A " "recovery is exact to the word and no " "finer") unsigned char PraetCrcResponsum_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE
 A type that exists only for the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE token.
typedef PRAET_DENUNTIATIO_ATTR ("AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE - this context checksums the word a stalled " "transfer was inside, one word, bit at a time, on the recovery path " "only") unsigned char PraetCrcResponsum_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE
 A type that exists only for the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE token.
EMBED_HOST_DEVICE uint16_t praet_hw_progress (embed_word channel)
 Returns how far the port says channel has got, in bytes.
EMBED_HOST_DEVICE void praet_ordo_reset (PraetOrdo *context)
 Clears a context back to every channel detached.
EMBED_HOST_DEVICE 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.
EMBED_HOST_DEVICE void praet_ordo_separare (PraetOrdo *context, embed_word channel)
 Asks for the detach of a channel.
EMBED_HOST_DEVICE embed_bool praet_ordo_relatio (PraetOrdo *context, embed_word channel)
 Marks a channel busy and starts its keepalive window.
EMBED_HOST_DEVICE void praet_ordo_efficere (PraetOrdo *context, embed_word channel)
 Feeds the watchdog for one channel.
EMBED_HOST_DEVICE void praet_ordo_completed (PraetOrdo *context, embed_word channel, embed_bool failed)
 Reports that a channel's transfer finished.
EMBED_HOST_DEVICE void praet_ordo_advance (PraetOrdo *context, embed_word micros)
 Advances the clock by micros.
EMBED_HOST_DEVICE void praet_ordo_advance_ticks (PraetOrdo *context, embed_word ticks)
 Advances the clock by ticks, scaled against the declared frequency.
EMBED_HOST_DEVICE void praet_ordo_raise (PraetOrdo *context)
 Is in for the interrupt that raises the set volatile.
EMBED_HOST_DEVICE void praet_ordo_poll (PraetOrdo *context)
 Drives the port and brings every flag word up to date. The caller's poll.
EMBED_HOST_DEVICE uint32_t praet_ordo_flags (const PraetOrdo *context, embed_word channel)
 Returns one channel's flag word.

Variables

static const MemoriamPraetereoNs praet
 Dispatch table instance named praet.

Detailed Description

Macro Definition Documentation

◆ PRAET_MENSURA_MAXIMA

#define PRAET_MENSURA_MAXIMA

The largest measure this module knows about.

Note
Raise this with the addition of a wider step. The assertion on a descriptor's measure then stops a declaration of one that nothing here can carry.

Definition at line 76 of file praet_descriptor.h.

◆ PRAET_DIRECTIO_MOTUS_VERBI_FOR

#define PRAET_DIRECTIO_MOTUS_VERBI_FOR ( from_,
to_,
bytes_ )

The direction of the movement of the word, for two spans of one pool.

Parameters
from_Bytes into the pool the read starts at.
to_Bytes into the pool the write starts at.
bytes_Bytes moved.
Returns
A DirectioMotusVerbi.
Note
Integers, and so this has its answer at compile time. Both spans are offsets into one declared object, and where they came from makes them comparable at all. Two addresses passed in as pointers would have no order at compile time. The language does not define a compare of pointers into separate objects.
A write upward over a source means the high words must move first, and so the walk goes downward. A write downward is the mirror of it. Spans that start at the same place move nothing over anything and take neither.

Definition at line 111 of file praet_descriptor.h.

◆ PRAET_STEPS_FIT

#define PRAET_STEPS_FIT ( what_,
pool_,
offset_,
bytes_,
mensura_ )

Fails the build where one end of a transfer does not sit whole steps inside its pool.

Parameters
what_Text that names which end this is, for the message.
pool_Pool declared by ParsMemoriaeInternae or ParsMemoriaeExternum.
offset_Bytes into that pool the span starts at.
bytes_Bytes in the span.
mensura_Bytes the engine moves in one step.
Note
Three conditions in one assertion, because they fail for one reason and a caller at work on one wants to see the others. The span fits the pool, the offset lands on a step boundary, and the length is a whole number of steps.
Static assertions, where PraetSubmit uses the expression form. A declarator is at file scope and a bare expression cannot sit there. The name of the end in the message is what replaces the member name the expression form prints.
Warning
Reads sizeof(mmgr_pars_storage_##pool_), and so it holds for a span whose offset, length and width are at compile time. Anything computed at run time has no bound from this and no bound anywhere else.

Definition at line 181 of file praet_descriptor.h.

◆ PRAET_DESCRIPTOR_BODY

#define PRAET_DESCRIPTOR_BODY ( name_,
source_,
source_mode_,
dest_,
dest_mode_,
bytes_,
mensura_,
motus_,
next_ )

Declares one memory to memory transfer, and what runs after it.

Parameters
name_Name of the descriptor.
from_pool_Pool the bytes come from.
from_offset_Bytes into that pool the read starts at.
to_pool_Pool the bytes go to.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step, as a EgoSumMensura.
next_The descriptor that runs after this one, or NULL.
Note
Both pools have names, and so both spans have a proof of fit before anything runs. Both addresses come from a declaration, and no caller states one. That is the same check PraetAttach makes, applied to each end.
Both addresses advance, as memory to memory means. A side that stays put is a peripheral, and the name of one needs an address this has no way to take.
Emitted as initialized data with the owner in software's passes. A descriptor the engine does not hold is one the program may still write.
Two different pools are two separately declared objects, and so they cannot overlap and the direction settles as either. One pool at both ends collides on the enumerators this emits, because the two carry the same prefix and differ only by the pool. A transfer inside one pool is PraetDescriptorWithin, which has offsets it can compare.
Warning
direction_ appears here, and the two macros above this one derive it. A direct call here with the wrong answer is a transfer that reads bytes it already wrote over.

Definition at line 212 of file praet_descriptor.h.

◆ PraetDescriptorDeclare

#define PraetDescriptorDeclare ( name_,
from_pool_,
from_offset_,
to_pool_,
to_offset_,
bytes_,
mensura_,
motus_,
next_ )

Declares one memory to memory transfer, and what runs after it.

Parameters
name_Name of the descriptor.
from_pool_Pool the bytes come from.
from_offset_Bytes into that pool the read starts at.
to_pool_Pool the bytes go to.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step, as a EgoSumMensura.
motus_Which way the words walk, as a DirectioMotusVerbi.
next_The descriptor that runs after this one, or NULL.

Definition at line 241 of file praet_descriptor.h.

◆ PRAET_DESCRIPTOR_ENDS_DIFFER

#define PRAET_DESCRIPTOR_ENDS_DIFFER ( name_,
from_pool_,
to_pool_ )

Fails the build where a transfer between two pools names one pool twice.

Parameters
name_Name of the descriptor this belongs to.
from_pool_Pool the bytes come from.
to_pool_Pool the bytes go to.
Note
Two enumerators with one prefix that differ only by the pool. So one pool at both ends declares the same enumerator twice in one enum and the compiler refuses it. The same idiom MMGR_PARS_CLAIMED_ONCE uses, applied to a pair.
The compiler refuses this for a reason: the direction a transfer between two pools takes settles as either. That answer is only true because two declared pools are two objects. One pool at both ends can overlap itself, and PraetDescriptorWithin is what has the offsets to work that out.

Definition at line 261 of file praet_descriptor.h.

◆ PraetOneShot

#define PraetOneShot ( name_,
from_pool_,
from_offset_,
to_pool_,
to_offset_,
bytes_,
mensura_ )

Declares one transfer that runs once and stops.

Parameters
name_Name of the descriptor.
from_pool_Pool the bytes come from.
from_offset_Bytes into that pool the read starts at.
to_pool_Pool the bytes go to.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step.
Note
A next of NULL, the entirety of of what makes a transfer one shot.

Definition at line 280 of file praet_descriptor.h.

◆ PraetDescriptorWithin

#define PraetDescriptorWithin ( name_,
pool_,
from_offset_,
to_offset_,
bytes_,
mensura_,
next_ )

Declares one transfer that moves bytes inside a single pool, and works out which way.

Parameters
name_Name of the descriptor.
pool_Pool both ends sit in.
from_offset_Bytes into that pool the read starts at.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step, as a EgoSumMensura.
next_The descriptor that runs after this one, or NULL.
Note
Where the two spans overlap, the direction retains the transfer from reads of bytes it already wrote over. The offsets settle it here, once, and nothing asks again: a run of this descriptor has the answer in front of it.
Both spans are offsets into one declared object, and that leaves them comparable at all. The same question about two pointers would have no answer at compile time. The language does not define a compare of pointers into separate objects.

Definition at line 302 of file praet_descriptor.h.

◆ PraetCircular

#define PraetCircular ( name_,
from_pool_,
from_offset_,
to_pool_,
to_offset_,
bytes_,
mensura_ )

Declares one transfer that runs itself again, forever.

Parameters
name_Name of the descriptor.
from_pool_Pool the bytes come from.
from_offset_Bytes into that pool the read starts at.
to_pool_Pool the bytes go to.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step.
Note
A descriptor whose next is itself. This defines circular, and no part has a feature called that either.
The forward declaration ahead of it is a tentative definition, which C merges with the real one below. It lets the initializer name an address the declaration still writes.

Definition at line 321 of file praet_descriptor.h.

◆ PraetPingPong

#define PraetPingPong ( first_,
second_,
from_pool_,
to_pool_,
first_from_,
first_to_,
second_from_,
second_to_,
bytes_,
mensura_ )

Declares two transfers that hand off to each other, forever.

Parameters
first_Name of the first descriptor.
second_Name of the second descriptor.
from_pool_Pool both transfers read from.
to_pool_Pool both transfers write to.
first_from_Bytes into the source pool the first transfer reads at.
first_to_Bytes into the destination pool the first transfer writes at.
second_from_Bytes into the source pool the second transfer reads at.
second_to_Bytes into the destination pool the second transfer writes at.
bytes_Bytes each transfer moves.
mensura_Bytes moved in one step.
Note
Ping-pong, and it is two descriptors whose next point at each other. Nothing here is a mode and no part has a bit for it. The two write different halves, and that is what makes it a pair and not one transfer twice. The halves are the caller's to arrange by the offsets they pass.
Both spans have their proofs against their pools apart. A pair whose halves overlap or run off the end fails at the declaration that wrote it.

Definition at line 346 of file praet_descriptor.h.

◆ PraetPeripheralDeclare

#define PraetPeripheralDeclare ( name_,
address_ )

Declares one peripheral register a transfer may reach.

Parameters
name_Name of the peripheral.
address_Where the register is, as the vendor's own header gives it.
Note
The address is not this library's to know and it is not the caller's to invent. Every part ships a header that names its registers, the compiler read it, and what a caller writes here is that name. An ESP32 reaches one through its GDMA peripheral struct, an i.MX RT through LPUART1->DATA, and neither number appears in this tree.
Emits a pointer under a mangled name and an enumerator that carries the peripheral's. A descriptor that names a peripheral pastes onto both. Anything with no declaration here fails on a name nobody wrote. The same proof a pool gives, for a thing that has no extent.
volatile, because something other than this program reads and writes a register. A compiler that cached one would read a value the part left behind.
Warning
No extent, the point. A peripheral is one address that stays where it is. So there is nothing for a span check to measure, and the pool at its other end alone bounds a transfer's length.

Definition at line 374 of file praet_descriptor.h.

◆ PraetToPeripheral

#define PraetToPeripheral ( name_,
from_pool_,
from_offset_,
peripheral_,
address_,
at_offset_,
bytes_,
mensura_,
next_ )

Declares one transfer that reads a pool and writes a peripheral.

Parameters
name_Name of the descriptor.
from_pool_Pool the bytes come from.
from_offset_Bytes into that pool the read starts at.
peripheral_Peripheral declared by PraetPeripheralDeclare.
address_Base of that peripheral, stated again here as the vendor's own name.
at_offset_Bytes into the peripheral block the transfer writes at.
bytes_Bytes to move.
mensura_Bytes moved in one step, as a EgoSumMensura.
next_The descriptor that runs after this one, or NULL.
Note
The source advances and the destination stays where it is. This alone makes a transfer a write to a peripheral, and it is the single one fact memcpy never needs.
Neither way to walk. A pool and a register are not the same object, and a transfer between them cannot read what it wrote.
The address appears at the declaration and again here, and that is how PraetSubmit already treats a pool. The pool appears a second time so the extent comes from the declaration and not from a carried value. The enumerator below is the lock and this expression is the key.
The second statement is also what retains the initializer legal. An address constant plus an integer constant is still an address constant. The value read out of the pointer PraetPeripheralDeclare emits is not one at all, whatever a given compiler folds.
Warning
A base plus an offset, and so one declared peripheral covers every register in its block. Nothing here bounds the offset, because a peripheral has no extent to measure against.

Definition at line 407 of file praet_descriptor.h.

◆ PraetFromPeripheral

#define PraetFromPeripheral ( name_,
peripheral_,
address_,
at_offset_,
to_pool_,
to_offset_,
bytes_,
mensura_,
next_ )

Declares one transfer that reads a peripheral and writes a pool.

Parameters
name_Name of the descriptor.
peripheral_Peripheral declared by PraetPeripheralDeclare.
address_Base of that peripheral, stated again here as the vendor's own name.
at_offset_Bytes into the peripheral block the transfer reads at.
to_pool_Pool the bytes go to.
to_offset_Bytes into that pool the write starts at.
bytes_Bytes to move.
mensura_Bytes moved in one step, as a EgoSumMensura.
next_The descriptor that runs after this one, or NULL.
Note
The mirror of PraetToPeripheral. The source stays where it is and the destination advances, and that leaves a transfer a read from a peripheral.
The address appears at the declaration and again here, for the reasons written out over PraetToPeripheral.

Definition at line 434 of file praet_descriptor.h.

◆ PRAET_DENUNTIATIO_ATTR

#define PRAET_DENUNTIATIO_ATTR ( message_)

Marks a declaration so that every use of it reports, with a message.

Parameters
[in]message_Text the diagnostic reports, as a string literal.
Note
Aliased under this module's prefix and written once, as embed_compiler_directives.h asks a consumer to do with an attribute.
The deprecated attribute, where the error and warning ones fall short. Those report at a call that survives compilation, and a declaration at file scope has no call in it: both stay silent. This one reports at any use, and a typedef that names the type is a use.
Nothing marked with this is out of date. It is the only attribute that reports from a declarator, and its job here is to make a deliberate answer visible. Nothing goes away. The message says which answer, and so the line reads correctly whatever GCC prefixes it with.
Warning
Expands to nothing where EMBED_HAS_ATTRIBUTE(deprecated) is 0. The answer is then silent and only a wrong token still fails, the half nobody can miss.

Definition at line 107 of file praet_ordo.h.

Referenced by PRAET_DENUNTIATIO_ATTR(), and PRAET_DENUNTIATIO_ATTR().

◆ PRAET_CRC_RESPONSUM_IN_LOCO_FIGERE

#define PRAET_CRC_RESPONSUM_IN_LOCO_FIGERE ( token_)

Pastes token_ onto the answer type prefix.

Parameters
[in]token_One of the two AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC tokens.
Returns
The answer type for that token.

Definition at line 140 of file praet_ordo.h.

◆ PRAET_CRC_RESPONSUM

#define PRAET_CRC_RESPONSUM ( token_)

The answer type token_ names, after its expansion.

Parameters
[in]token_One of the two AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC tokens, or a macro that holds one.
Returns
That token's answer type.
Note
This is what refuses a plain 1 or TRUE in the answer's place. Those are values, and the two tokens are the only things that name a type here.

Definition at line 150 of file praet_ordo.h.

◆ PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE

#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE

The value the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE token is for.

Note
Pasted onto, and so the declarator gets the answer before the compiler proper runs and can assert on it.

Definition at line 158 of file praet_ordo.h.

◆ PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE

#define PRAET_CRC_VALUE_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE

The value the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE token is for.

Definition at line 163 of file praet_ordo.h.

◆ PRAET_CRC_VALUE_IN_LOCO_FIGERE

#define PRAET_CRC_VALUE_IN_LOCO_FIGERE ( token_)

Pastes token_ onto the value prefix.

Parameters
[in]token_One of the two AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC tokens.
Returns
The value macro for that token.

Definition at line 171 of file praet_ordo.h.

◆ PRAET_CRC_VALUE

#define PRAET_CRC_VALUE ( token_)

The value token_ is for, after its expansion.

Parameters
[in]token_One of the two AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC tokens, or a macro that holds one.
Returns
1 for the ENABLE token, 0 for the DISABLE token.
Note
Usable in an #if, as lets a caller compile one thing or another around their own answer. No second macro has to stay in step with it.

Definition at line 181 of file praet_ordo.h.

◆ PRAET_ORDINEM_INCIPE

#define PRAET_ORDINEM_INCIPE ( crc_choice_)

An empty context, for a build with no recovery machinery to configure.

Parameters
crc_choice_One of the two AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC tokens, unused here.
Returns
A zero initializer.
Note
The token is still demanded by the declarator and still reports. What changes is that there is no member to put it in, and the assertion there refuses the ENABLE arm outright.

Definition at line 203 of file praet_ordo.h.

◆ PraetOrdoContext

#define PraetOrdoContext ( name_,
crc_choice_ )

Declares one schedule context and answers the boundary word question for it.

Parameters
name_Name of the context this declares.
crc_choice_AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE or AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE.
Note
The instantiation is the declaration. This emits data with its initial value and the answer in it. So nothing runs to make a context usable, and nothing can change the answer afterwards.
Reports whichever token it received. A caller who wants a quieter build takes the message away with no context declared, the only honest way out of it.
Warning
A token that is neither of the two fails on the typedef, with the token it received in the message. A check on a build with PRAET_RECOVERY off fails the assertion below, which names what to do about it.

Definition at line 221 of file praet_ordo.h.

◆ PraetAttach

#define PraetAttach ( context_,
channel_,
pool_,
region_ )

Attaches a channel over a declared pool, by name.

Parameters
context_Context the channel belongs to.
channel_Channel to attach.
pool_Pool declared by ParsMemoriaeInternae or ParsMemoriaeExternum.
region_Region descriptor for this channel, as a byte.
Returns
What praet_ordo_adnectere answered.
Note
The attach surface on a buffer, and how a caller should reach a channel. The pool's name makes the address and the extent come from one place. mmgr_pars_storage_##pool_ and pool_##_bytes both come out of the declaration, and neither exists for anything that is not a declared pool.
Not a question of who owns the bytes. The test is whether whoever passes them over has every answer about them: the address, the extent, and which channel is over them. A caller with all three said everything this needs, and where the bytes came from is their business.
Both names have internal linkage. A translation unit that did not declare the pool cannot reach either and does not compile. That leaves the answers first hand, and a caller that gives all of them makes these bytes legal to touch. The caller said so.
Warning
The region descriptor is still stated here. Which of the two declarations wrote a pool settles which memory it sits in, and neither emits a marker this could read. So a derivation needs something added at the pool's declaration.

Definition at line 368 of file praet_ordo.h.

◆ PraetChannel

#define PraetChannel ( context_,
channel_,
pool_ )

Declares which pool a channel of a context is over.

Parameters
context_Context the channel belongs to.
channel_Channel number, as a literal, since it goes into the symbol this emits by paste.
pool_Pool declared by ParsMemoriaeInternae or ParsMemoriaeExternum.
Note
Written once per channel, at file scope, beside the context's own declaration. It emits an enumerator whose name carries the context, the channel and the pool, and that name is the binding. PraetAttach and PraetSubmit both name it. So a call to either with a pool outside the channel's declaration is an undeclared identifier, and the error prints the triple as written.
The same shape locus_carcerum uses. MMGR_CARCER_BODY pastes the site and the pool into prisonsite_##_##name_##_ctx and MMGR_CARCER_MEM makes the pool the member's name. A cellblock's entries cannot take another cellblock's bytes. Here the channel joins the paste, because a context has several and they may be over different pools.
Costs nothing. An enumerator emits no storage and settles while the unit compiles.
Warning
Channel numbers settle at compile time, as lets this paste one. A channel chosen at run time has no binding this way and reaches praet_ordo_adnectere directly, where nothing relates the address to the extent.

Definition at line 393 of file praet_ordo.h.

◆ PRAET_ALVEUS_SUPERARE

#define PRAET_ALVEUS_SUPERARE ( context_,
channel_,
pool_ )

Names the binding of a channel's declaration, and fails where there is none.

Parameters
context_Context the channel belongs to.
channel_Channel number, as a literal.
pool_Pool the caller believes the channel is over.
Note
Reads the enumerator PraetChannel emitted. Nothing computes from it, and the reference is the purpose: a triple nobody declared names an identifier that does not exist.

Definition at line 412 of file praet_ordo.h.

◆ PRAET_SPAN_FITS

#define PRAET_SPAN_FITS ( pool_,
offset_,
length_ )

Fails the build when a span runs past the pool it names.

Parameters
pool_Pool declared by ParsMemoriaeInternae or ParsMemoriaeExternum.
offset_Bytes into that pool the span starts at.
length_Bytes in the span.
Note
The same check as on the other arm, and present here for the same reason it is there. A build with no recovery records nothing about a transfer. A span that runs off the end of the pool is still a span that runs off the end of the pool.

Definition at line 558 of file praet_ordo.h.

◆ PraetSubmit

#define PraetSubmit ( context_,
channel_,
pool_,
offset_,
length_ )

Submits a span of a declared pool on a channel attached over that pool.

Parameters
context_Context the channel belongs to.
channel_Channel to run on.
pool_Pool declared by ParsMemoriaeInternae or ParsMemoriaeExternum.
offset_Bytes into that pool the transfer starts at.
length_Bytes it moves.
Returns
What praet_ordo_relatio answered.
Note
The submit surface on a buffer, and the counterpart of PraetAttach. The pool's name again gives the bound something to compare against, since the extent lives with the declaration and not with the channel.
The check of the bound is here and never inside the entry. Sizes and spans settle at compile time. A test at run time would pay for a question with an answer already.
Names the binding PraetChannel declared. So a submit of a pool this channel is not over fails. The identifier carries the context, the channel and the pool as written. That is the same guarantee locus_carcerum gets from the paste of the site and the pool into one symbol.

Definition at line 603 of file praet_ordo.h.

◆ PRAET_CHANNELS

#define PRAET_CHANNELS

Logical channels one context carries.

Note
Per part, and the caller is the single one who knows which part. There is no number here that is right for everyone.

Definition at line 53 of file praet_praefinitum.h.

◆ PRAET_UNSET_CHANNELS

#define PRAET_UNSET_CHANNELS

Definition at line 54 of file praet_praefinitum.h.

◆ PRAET_SETTLE_MICROS

#define PRAET_SETTLE_MICROS

Microseconds the engine spends in its settle before it will take a transfer.

Note
Microseconds and not milliseconds. DMA timing is tight enough that a millisecond is not a unit anything here fits in.
Warning
At EMBED_WORD_BITS=16 a microsecond count wraps at 65535, about 65 milliseconds. No engine takes that long to come up, and so this knob is safe at every width.

Definition at line 68 of file praet_praefinitum.h.

◆ PRAET_UNSET_SETTLE_MICROS

#define PRAET_UNSET_SETTLE_MICROS

Definition at line 69 of file praet_praefinitum.h.

◆ PRAET_KEEPALIVE_MICROS

#define PRAET_KEEPALIVE_MICROS

Microseconds an active channel may go with no kick from the port before it reads stalled.

Note
A watchdog window and not a transfer length. The port kicks this whenever the engine shows a sign of life. A window that goes unkicked says the channel stopped, and it never says the transfer finished. Completion arrives from the port, because how long a transfer takes is not something this library can know.
That is also why the width is not a problem. A watchdog window is short deliberately. So the 65 millisecond ceiling a 16-bit word puts on a microsecond count is far above any value worth a place here. A transfer's runtime has no bound at all.

Definition at line 86 of file praet_praefinitum.h.

◆ PRAET_UNSET_KEEPALIVE_MICROS

#define PRAET_UNSET_KEEPALIVE_MICROS

Definition at line 87 of file praet_praefinitum.h.

◆ PRAET_RECOVERY

#define PRAET_RECOVERY

Whether a stalled transfer can go back or come out scrubbed.

Note
The capability switch. Off is what a caller gets with no answer. Recovery costs three arrays per channel and a caller who never said where the bytes were cannot back anything out of them.
With it on, submit takes the start and the length, kick reports how far the engine got, and praet_ordo_resolve exists. With it off none of those members are in the context and none of those entries exist. A call site that wanted them fails to compile and does not link against a version that records nothing.

Definition at line 104 of file praet_praefinitum.h.

◆ PRAET_UNSET_RECOVERY

#define PRAET_UNSET_RECOVERY

Definition at line 105 of file praet_praefinitum.h.

◆ PRAET_OPTIMIZE

#define PRAET_OPTIMIZE

Whether a run records the work it did, on top of the states it reached.

Note
The optimization arm, and it is the examination arm with more counters. It records work. Entries called, channels walked, times the poll short circuited, times the port heard a question, and the bytes of state a context costs.
No times, and none deliberately. A count of work is the same on every run of one build, and so it is a fact a host can state. What that work costs is a property of a part. A number taken here would be a number about this machine dressed as a number about the library.
Reports and does not gate, the same as the examination arm. A count that grew is worth reading and is not a build failure, because the measure of whether it matters lives somewhere else.

Definition at line 52 of file praet_procurator.h.

◆ PRAET_PROCURATOR

#define PRAET_PROCURATOR

Whether a run records the states and transitions it reached.

Note
Turned on by PRAET_OPTIMIZE as well. The work counts read beside the states they bought, and a report with one half absent says less than either half alone.

Definition at line 69 of file praet_procurator.h.

◆ praet_procurator_transitus

#define praet_procurator_transitus ( channel_,
was_,
now_ )

Expands to nothing where PRAET_PROCURATOR is 0.

Parameters
channel_Channel whose word changed, discarded.
was_The word before, discarded.
now_The word after, discarded.
Note
Casts each argument to void, which retains a build without the instrument from a warning about the values it received.

Definition at line 120 of file praet_procurator.h.

◆ praet_procurator_report

#define praet_procurator_report ( )

Expands to nothing where PRAET_PROCURATOR is 0.

Definition at line 125 of file praet_procurator.h.

◆ praet_procurator_opus

#define praet_procurator_opus ( type_)

Expands to nothing where PRAET_OPTIMIZE is 0.

Parameters
type_The work done, dropped.

Definition at line 171 of file praet_procurator.h.

◆ PRAET_SEPARATUS

#define PRAET_SEPARATUS

Detached: the channel holds no engine and no vector.

Definition at line 35 of file praet_tabula_vexillorum.h.

◆ PRAET_ADNEXUS

#define PRAET_ADNEXUS

Attached: the channel holds the engine and will take a transfer.

Definition at line 40 of file praet_tabula_vexillorum.h.

◆ PRAET_BUSY

#define PRAET_BUSY

Busy: the engine moves bytes on this channel.

Note
The DMA busy, not the reader/setter's lock. The two are separate concerns and the lock lives in its own volatile.

Definition at line 48 of file praet_tabula_vexillorum.h.

◆ PRAET_OK

#define PRAET_OK

Ok: the last transfer finished and the channel is still attached.

Note
The transfer's result, not the channel's health. A channel that failed carries PRAET_ERROR alongside, and so the two are separate bits.

Definition at line 56 of file praet_tabula_vexillorum.h.

◆ PRAET_CORE_BITS

#define PRAET_CORE_BITS

Bits the quaternary core occupies, at the bottom of the word.

Definition at line 61 of file praet_tabula_vexillorum.h.

◆ PRAET_CORE_MASK

#define PRAET_CORE_MASK

The two bits the quaternary core occupies.

Note
The core sits at the bottom with every status above it. So a read of the state is a mask and a read of a status is a test. Nothing shifts.

Definition at line 69 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_CLAIMED

#define PRAET_ID_CLAIMED

Token id of the status set while the channel holds an interrupt vector.

Definition at line 74 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_SETTLING

#define PRAET_ID_SETTLING

Token id of the status set while the engine settles.

Definition at line 79 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_SEPARANS

#define PRAET_ID_SEPARANS

Token id of the status set while a detach is in progress.

Definition at line 84 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_ERROR

#define PRAET_ID_ERROR

Token id of the status set where the last transfer ended in an error.

Definition at line 89 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_STALLED

#define PRAET_ID_STALLED

Token id of the status set where an active channel went unkicked for a whole window.

Definition at line 94 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_ABANDONED

#define PRAET_ID_ABANDONED

Token id of the status set where a stalled transfer went back.

Definition at line 99 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_SCRUBBED

#define PRAET_ID_SCRUBBED

Token id of the status set where a stalled transfer's bytes counted as unsafe.

Definition at line 104 of file praet_tabula_vexillorum.h.

◆ PRAET_ID_MEASURED

#define PRAET_ID_MEASURED

Token id of the status set where a recovery measured the boundary word.

Definition at line 109 of file praet_tabula_vexillorum.h.

◆ PRAET_STATUS_COUNT

#define PRAET_STATUS_COUNT

How many status token ids there are.

Note
Raise this with the addition of a status, and the assertion on PRAET_EVERY_STATUS fails until the new one appears there too.

Definition at line 117 of file praet_tabula_vexillorum.h.

◆ PRAET_STATUS_SHIFT

#define PRAET_STATUS_SHIFT

First bit the statuses occupy, the bit above the core.

Definition at line 122 of file praet_tabula_vexillorum.h.

◆ PRAET_STATUS_BIT

#define PRAET_STATUS_BIT ( id_)

The bit a status token id owns.

Parameters
[in]id_Status token id, below PRAET_STATUS_COUNT.
Returns
That id's bit, placed above the core.
Note
Every status below comes through this, and so no status carries a hand-written bit that could disagree with the id beside it.

Definition at line 132 of file praet_tabula_vexillorum.h.

◆ PRAET_STATUS_MASK

#define PRAET_STATUS_MASK

Every bit the statuses occupy, derived from how many there are.

Definition at line 137 of file praet_tabula_vexillorum.h.

◆ PRAET_CLAIMED

#define PRAET_CLAIMED

Set while the channel holds an interrupt vector.

Note
Claimed at attach and released at detach. There is no reason to hold a vector for a memory mover that moves nothing, and the claim gives the context one owner.

Definition at line 145 of file praet_tabula_vexillorum.h.

◆ PRAET_SETTLING

#define PRAET_SETTLING

Set while the engine settles and will take no transfer.

Definition at line 150 of file praet_tabula_vexillorum.h.

◆ PRAET_SEPARANS

#define PRAET_SEPARANS

Set where a detach is in progress and the channel did not finish it.

Definition at line 155 of file praet_tabula_vexillorum.h.

◆ PRAET_ERROR

#define PRAET_ERROR

Set where the last transfer ended in an error, clear where it completed.

Definition at line 160 of file praet_tabula_vexillorum.h.

◆ PRAET_STALLED

#define PRAET_STALLED

Set where an active channel went a whole keepalive window with no kick.

Note
Says the engine stopped, and says nothing about whether the transfer finished. A stalled channel is still busy, because nothing told this library otherwise.

Definition at line 168 of file praet_tabula_vexillorum.h.

◆ PRAET_ABANDONED

#define PRAET_ABANDONED

Set where a stalled transfer went back and its bytes stayed as they were.

Note
Owns its bit on every build. A build with recovery off never sets it, and the bit stays reserved so a flag word means one thing everywhere.

Definition at line 176 of file praet_tabula_vexillorum.h.

◆ PRAET_SCRUBBED

#define PRAET_SCRUBBED

Set where a stalled transfer resolved with its bytes counted as unsafe.

Note
The bytes are the caller's and this context has no pointer to them, and so nothing here scrubs anything. The flag records the decision; the caller zeroes its own storage.

Definition at line 184 of file praet_tabula_vexillorum.h.

◆ PRAET_MEASURED

#define PRAET_MEASURED

Set where a recovery measured the word the engine was in the middle of.

Note
What tells a reader that the boundary checksum means anything. A checksum of zero is a legal one. A reader that took the value alone could not tell a measured word from an unmeasured context.
A context whose declaration chose the DISABLE token never sets this. Neither does a recovery whose sample already landed on a word boundary, since there is no partial word to measure.

Definition at line 196 of file praet_tabula_vexillorum.h.

◆ PRAET_EVERY_STATUS

#define PRAET_EVERY_STATUS

Every status, listed by name.

Note
Written out by hand, because this is the half of the check that has to come from somewhere other than PRAET_STATUS_COUNT. A compare of a list of names against a count neither one produced is what catches a duplicated id or a status nobody placed.

Definition at line 205 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_SHIFT

#define PRAET_REGION_SHIFT

First bit of the region descriptor.

Note
A byte on a byte boundary. The descriptor is a number derived from the address space behind the region, and so nothing here stores an address. Its place at a byte edge lets a build that wants to compress it to eight bits do so and move no status.
The third byte and not the second. Statuses grow upward from the core and the region has to start above all of them. At bit 8 it would share a bit with PRAET_SCRUBBED, which would read as a region whose low bit flips when a recovery marks a transfer scrubbed.

Definition at line 219 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_BITS

#define PRAET_REGION_BITS

How wide the region descriptor is.

Definition at line 224 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_MAX

#define PRAET_REGION_MAX

The largest descriptor the region field holds.

Definition at line 229 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_MASK

#define PRAET_REGION_MASK

The bits the region descriptor occupies once shifted into place.

Definition at line 234 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_FIELD

#define PRAET_REGION_FIELD ( region_)

A region descriptor placed in the field the map gives it.

Parameters
[in]region_Region descriptor, narrowed to what the field holds.
Returns
region_ in position, and never a bit outside PRAET_REGION_MASK.
Note
The one way to write the field. A narrow cast at the write site instead would put the field's width in two places. The copy that drifts is the single one nothing checks.

Definition at line 244 of file praet_tabula_vexillorum.h.

◆ PRAET_REGION_ID_HIGHEST

#define PRAET_REGION_ID_HIGHEST

The largest region token id there is.

Note
Raise this with the addition of a region, and the assertion below fails until the field is wide enough to hold it.

Definition at line 271 of file praet_tabula_vexillorum.h.

◆ PRAET_MAP_MASK

#define PRAET_MAP_MASK

Every bit the map accounts for.

Note
What a flag word may carry. A build whose writes stay inside this cannot produce a word with a bit nobody named. So nothing has to look at a word at run time to find that out.

Definition at line 279 of file praet_tabula_vexillorum.h.

Typedef Documentation

◆ mmgr_praet_callback

typedef void(*) mmgr_praet_callback(const mmgr_praet_event *event, void *user)

Reports a finished transfer to whatever registered this callback.

Parameters
[in]eventThe completion event [BORROWS].
[in]userThe pointer registered alongside this callback [BORROWS].
Note
Runs in whatever context the port layer finishes a transfer in. No mmgr_praet_ entry point calls it.
Warning
event and event->data belong to the port layer and last only until this returns. Copy anything retained [BORROWS].

Definition at line 57 of file memoriam_praetereo.h.

Enumeration Type Documentation

◆ PraetAddressing

How an address behaves as a transfer runs.

Note
The one fact memcpy does not need. Memory to memory advances both sides. A peripheral is an address that stays where it is, and which side stays put makes a transfer a read or a write.
Token ids, the same as the statuses and the regions. A mistyped name is an undeclared identifier that carries the name as written.
Enumerator
PRAET_ADDRESS_ADVANCES 

The address moves on by the transfer width each step.

PRAET_ADDRESS_FIXED 

The address stays where it is, as a peripheral is.

Definition at line 47 of file praet_descriptor.h.

◆ EgoSumMensura

Bytes the engine moves in one step, the measure of everything else.

Note
Named in full for what it is. A transfer's offsets, its length and the boundary a recovery rounds to all count in this. So it is the measure and not a property beside the others.
Carries the count itself, and so the assertions below divide a length by it and test an offset against it with no table in between.
octetus and verbum are the tree's own words for a byte and a word, as in octetus_introitus_exitus and verba_scribo.
Enumerator
PRAET_MENSURA_OCTETUS 

One byte a step.

PRAET_MENSURA_SEMIVERBUM 

Half a word a step.

PRAET_MENSURA_VERBUM 

A whole word a step.

Definition at line 63 of file praet_descriptor.h.

◆ DirectioMotusVerbi

Which way a transfer walks the words it moves.

Note
Named in full, because a bare direction says nothing about what moves in it. This is the direction of the movement of the word, and the word is what the engine steps by.
What memor already answers for a copy, and for the same reason. Where the two ends overlap, one direction reads words the other has already written over. Where they do not, neither direction is wrong and the engine takes whichever it likes.
Settled once and then not asked again. Here it settles before anything runs, because both ends of a descriptor come from a declaration.
Enumerator
PRAET_MOTUS_NEUTRUM 

Neither way. The ends do not overlap, and so nothing is at risk.

PRAET_MOTUS_SURSUM 

Upward, from the low word on, which is safe for a write downward.

PRAET_MOTUS_DEORSUM 

Downward, from the high word back, which is safe for a write upward.

Definition at line 89 of file praet_descriptor.h.

◆ PraetDescriptorOwner

Who holds a descriptor.

Note
Per descriptor. An ESP32 descriptor calls this owner, an eDMA carries DONE and ACTIVE in its control word, and a Zephyr block config calls it busy. They are the same fact.
Enumerator
PRAET_OWNER_SOFTWARE 

The program may read it and write it.

PRAET_OWNER_ENGINE 

The engine works from it, and it alone may touch it.

Definition at line 122 of file praet_descriptor.h.

◆ PraetRecoveryWordBoundaryBitwiseCrc

The two answers a declaration may give about the boundary word check.

Note
Written at length deliberately. This is not a knob that rides along with recovery on. It is its own deliberate yes or no, made once per context, and the name is hard to skim past in a declaration.
Real enumerators. A mistyped token is an undeclared identifier at the declaration instead of quietly reading as the off arm.

Definition at line 83 of file praet_ordo.h.

◆ PraetRegion

The regions a channel can attach over.

Note
Token ids, the same way the statuses above are token ids. A region arrives at an attach as one of these names. A mistyped one is an undeclared identifier that carries the name as written, and a caller cannot pass a byte that means nothing.
Two of them, because ParsMemoriaeInternae and ParsMemoriaeExternum are the two declarations a pool can have. A part with more address spaces than that adds ids here and the assertion below retains them inside the field.
The values are ordinals. A build that wants a descriptor it can infer an address space from replaces the numbers and changes nothing else. The field is a byte and every read of it goes through PRAET_REGION_FIELD.

Definition at line 259 of file praet_tabula_vexillorum.h.

Function Documentation

◆ mmgr_praet_open()

EMBED_HOST_DEVICE embed_bool mmgr_praet_open ( const PraetCfg * args)

Opens args->channel and registers args->on_complete against it.

Parameters
[in]argsChannel, peripheral, loopback flag and completion callback [BORROWS].
Returns
EMBED_TRUE when the port layer accepted the request.
Note
The default mmgr_praet_hw_open refuses, and so this returns EMBED_FALSE until a port replaces it.
Warning
args->channel must be below PRAET_CHANNELS, and args->on_complete must not be NULL.

References mmgr_praet_open().

Referenced by mmgr_praet_open().

◆ mmgr_praet_tx_submit()

EMBED_HOST_DEVICE embed_bool mmgr_praet_tx_submit ( const PraetTransferCfg * args)

Submits args->bytes of args->buf on args->channel.

Parameters
[in]argsChannel, buffer and byte count [BORROWS].
Returns
EMBED_TRUE when the port layer accepted the transfer.
Note
The default mmgr_praet_hw_tx_submit refuses, and so this returns EMBED_FALSE until a port replaces it.
Warning
args->buf must stay valid until the completion callback runs [BORROWS].
args->channel must be below PRAET_CHANNELS.

References mmgr_praet_tx_submit().

Referenced by mmgr_praet_tx_submit().

◆ mmgr_praet_close()

EMBED_HOST_DEVICE void mmgr_praet_close ( const PraetTransferCfg * args)

Closes args->channel.

Parameters
[in]argsChannel to close [BORROWS].
Note
It reads only args->channel. buf and bytes take no part.
Warning
args->channel must be below PRAET_CHANNELS.

References mmgr_praet_close().

Referenced by mmgr_praet_close().

◆ mmgr_praet_poll()

EMBED_HOST_DEVICE void mmgr_praet_poll ( const PraetCfg * args)

Drives the port layer's poll hook.

Parameters
[in]argsChannel to poll [BORROWS].
Note
Passes args straight to mmgr_praet_hw_poll, unlike the other three entries, which assert first.
Warning
No assertion runs here. args and args->channel reach the port layer exactly as the caller gave them.

References mmgr_praet_poll().

Referenced by mmgr_praet_poll().

◆ mmgr_praet_hw_open()

EMBED_HOST_DEVICE embed_bool mmgr_praet_hw_open ( const PraetCfg * args)

Opens a DMA channel on real hardware.

Parameters
[in]argsChannel, peripheral, loopback flag and completion callback, as mmgr_praet_open forwards them [BORROWS].
Returns
EMBED_TRUE when the hardware accepted the request.
Note
The default in memoriam_praetereo.c refuses every request. A build links without a port.
An application definition of this name replaces that default where EMBED_HAS_ATTRIBUTE(weak) is non-zero.
A program that opens a channel from a kernel defines this for the device, as EMBED_WEAK_NAME states.
Warning
Reached through mmgr_praet_open, which asserts the channel and the callback first.

References mmgr_praet_hw_open().

Referenced by mmgr_praet_hw_open().

◆ mmgr_praet_hw_tx_submit()

EMBED_HOST_DEVICE embed_bool mmgr_praet_hw_tx_submit ( const PraetTransferCfg * args)

Submits a transfer on real hardware.

Parameters
[in]argsChannel, buffer and byte count, as mmgr_praet_tx_submit forwards them [BORROWS].
Returns
EMBED_TRUE when the hardware accepted the transfer.
Note
The default in memoriam_praetereo.c refuses every transfer. A build links without a port.
An application definition of this name replaces that default where EMBED_HAS_ATTRIBUTE(weak) is non-zero.
Warning
Reached through mmgr_praet_tx_submit, which asserts the channel first.
args->buf must stay valid until this reports completion through the registered callback [BORROWS].

References mmgr_praet_hw_tx_submit().

Referenced by mmgr_praet_hw_tx_submit().

◆ mmgr_praet_hw_close()

EMBED_HOST_DEVICE void mmgr_praet_hw_close ( const PraetTransferCfg * args)

Closes a DMA channel on real hardware.

Parameters
[in]argsChannel to close, as mmgr_praet_close forwards it [BORROWS].
Note
The default in memoriam_praetereo.c does nothing. A build links without a port.
An application definition of this name replaces that default where EMBED_HAS_ATTRIBUTE(weak) is non-zero.
It forwards only args->channel. buf and bytes take no part.
Warning
Reached through mmgr_praet_close, which asserts the channel first.

References mmgr_praet_hw_close().

Referenced by mmgr_praet_hw_close().

◆ mmgr_praet_hw_poll()

EMBED_HOST_DEVICE void mmgr_praet_hw_poll ( const PraetCfg * args)

Advances whatever poll work the port layer needs.

Parameters
[in]argsChannel to poll, exactly as the caller gave it [BORROWS].
Note
The default in memoriam_praetereo.c does nothing. A build links without a port.
An application definition of this name replaces that default where EMBED_HAS_ATTRIBUTE(weak) is non-zero.
Warning
mmgr_praet_poll calls this directly, with no check call in between. args and args->channel arrive exactly as the caller wrote them, unasserted.

References mmgr_praet_hw_poll().

Referenced by mmgr_praet_hw_poll().

◆ praet_descriptor_chain_length()

EMBED_HOST_DEVICE embed_word praet_descriptor_chain_length ( const PraetDescriptor * first,
embed_word limit )

Counts the descriptors a chain reaches before it repeats or ends.

Parameters
[in]firstFirst descriptor in the chain [BORROWS].
[in]limitHow many links to follow before the walk stops.
Returns
Descriptors reached, or limit where the chain is longer than that.
Note
What tells a one shot from a cycle and does not follow a cycle forever. A chain that ends returns its length; a chain that closes returns the number of distinct descriptors in it.
Walks by pointer identity against the first descriptor alone. So it names a cycle that returns to the head and not one that closes further along. A chain that loops back to its middle reaches the limit, the honest answer for a walk that cannot see where it is.

References praet_descriptor_chain_length().

Referenced by praet_descriptor_chain_length().

◆ PRAET_DENUNTIATIO_ATTR() [1/2]

typedef PRAET_DENUNTIATIO_ATTR ( "AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE - this context measures no boundary word. A " "recovery is exact to the word and no " "finer" )

A type that exists only for the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_DISABLE token.

Note
The declarator pastes the token onto this and typedefs the result. A token that is neither of the two fails on an unknown type name that has the bad token in it. A paste onto a macro instead gives a syntax error several lines down that names nothing, on the mistyped token this exists to catch.
That same typedef makes the answer report. Both arms carry the attribute. A choice that only speaks up one way trains everyone to read its silence as the safe answer. Neither answer here is safe by default.

References PRAET_DENUNTIATIO_ATTR.

◆ PRAET_DENUNTIATIO_ATTR() [2/2]

typedef PRAET_DENUNTIATIO_ATTR ( "AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE - this context checksums the word a stalled " "transfer was inside,
one word,
bit at a time,
on the recovery path " "only"  )

A type that exists only for the AD_VERBI_CONFINIUM_RESTITUE_PAULATIM_CRC_ENABLE token.

References PRAET_DENUNTIATIO_ATTR.

◆ praet_hw_progress()

EMBED_HOST_DEVICE uint16_t praet_hw_progress ( embed_word channel)

Returns how far the port says channel has got, in bytes.

Parameters
[in]channelChannel to read.
Returns
Bytes moved so far. Zero from a port with nothing to say.
Note
The fifth port hook, and the one the four in memoriam_praetereo.h do not have. Every controller this library targets exposes a count of bytes left. The orchestrator needs it to feed a watchdog with something a caller can act on.
Reached only from praet_ordo_poll. Nothing above it sees a byte count that did not go through the flag word first. That retains how the module tracks progress out of a caller's business.
Carries a weak default that refuses, the same as the four hooks in memoriam_praetereo.c. It returns zero, and praet_ordo_take_progress treats zero as no movement. A build that supplies no port walks every channel and still marks a stalled one. An unkicked keepalive window is what marks a channel stopped.
The default sits in praet_ordo.c, the unit that calls it. GCC on PE-COFF emits a weak definition as a weak external that ld does not resolve from another unit. A weak definition beside its call resolves on every linker this library builds with.

References praet_hw_progress().

Referenced by praet_hw_progress().

◆ praet_ordo_reset()

EMBED_HOST_DEVICE void praet_ordo_reset ( PraetOrdo * context)

Clears a context back to every channel detached.

Parameters
[out]contextContext to clear [BORROWS].
Note
A declaration emits this as initialized data. The entry exists so one context can serve again.
Warning
Leaves the boundary word answer alone. That came from the declaration and is not state a reset has any business with.

References praet_ordo_reset().

Referenced by praet_ordo_reset().

◆ praet_ordo_adnectere()

EMBED_HOST_DEVICE 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.

Parameters
[in,out]contextContext the channel belongs to [BORROWS].
[in]channelChannel to attach.
[in]boundFirst byte of the memory this channel moves. The caller's [BORROWS].
[in]bytesHow many bytes are there.
[in]regionRegion descriptor for this channel, as a byte.
Returns
EMBED_TRUE where the channel went from detached to attached.
Note
Attach and detach are the only entry and exit, and configuration takes no part in either. How long the engine takes to come up is a property of the part. So it arrives as PRAET_SETTLE_MICROS at compile time and not as an argument here.
Reach this through PraetAttach, which takes the pool by name. A direct call means an address and an extent stated apart, and nothing here can tell whether the two go together.
An attach does not claim the pool. A cellblock and a ring both write their own records into the bytes they dress. So MMGR_PARS_CLAIMED_ONCE exists to retain two of those off one pool. This writes no records into the bytes. An engine that fills ring segments while a consumer drains them is the arrangement the module is for.
Warning
Fails closed. A channel in any state but detached stays exactly as it is.
Two channels may attach over one block, and nothing here reports it. Which of them runs when is the caller's plan, and this library does not have it.

References praet_ordo_adnectere().

Referenced by praet_ordo_adnectere().

◆ praet_ordo_separare()

EMBED_HOST_DEVICE void praet_ordo_separare ( PraetOrdo * context,
embed_word channel )

Asks for the detach of a channel.

Parameters
[in,out]contextContext the channel belongs to [BORROWS].
[in]channelChannel to detach.
Note
Writes the request and reports nothing. The caller reads the result out of the flag word, as gives a void teardown something to report through.
A second request against a channel already in detach changes nothing. Hardware teardown writes the disable and polls the busy bit, and so a second call is the normal path.

References praet_ordo_efficere(), praet_ordo_relatio(), and praet_ordo_separare().

Referenced by praet_ordo_separare().

◆ praet_ordo_relatio()

EMBED_HOST_DEVICE embed_bool praet_ordo_relatio ( PraetOrdo * context,
embed_word channel )

Marks a channel busy and starts its keepalive window.

Parameters
[in,out]contextContext the channel belongs to [BORROWS].
[in]channelChannel to run on.
Returns
EMBED_TRUE where the channel took it.
Note
Takes no bytes. Where PRAET_RECOVERY is off nothing records where a transfer pointed. A start and a length would land in storage and never get a read.
Warning
Refuses a channel in its settle, already busy, in detach, or not attached. Fails closed: a refused submit changes no state.

References praet_ordo_relatio().

Referenced by praet_ordo_relatio(), and praet_ordo_separare().

◆ praet_ordo_efficere()

EMBED_HOST_DEVICE void praet_ordo_efficere ( PraetOrdo * context,
embed_word channel )

Feeds the watchdog for one channel.

Parameters
[in,out]contextContext the channel belongs to [BORROWS].
[in]channelChannel that showed a sign of life.
Note
A sign of life, alone. How far the engine got is what PRAET_RECOVERY buys, and this build does not carry it.
Pushes the keepalive window out and clears a recorded stall, because a channel that moves again has no stall.

References praet_ordo_efficere().

Referenced by praet_ordo_efficere(), and praet_ordo_separare().

◆ praet_ordo_completed()

EMBED_HOST_DEVICE void praet_ordo_completed ( PraetOrdo * context,
embed_word channel,
embed_bool failed )

Reports that a channel's transfer finished.

Parameters
[in,out]contextContext the channel belongs to [BORROWS].
[in]channelChannel that finished.
[in]failedEMBED_TRUE where it ended in an error, EMBED_FALSE on a completion.
Note
Completion arrives from the port and never from a timer. A timer that decides a transfer ended would be this library's guess at hardware.

References praet_ordo_completed().

Referenced by praet_ordo_completed().

◆ praet_ordo_advance()

EMBED_HOST_DEVICE void praet_ordo_advance ( PraetOrdo * context,
embed_word micros )

Advances the clock by micros.

Parameters
[in,out]contextContext to advance [BORROWS].
[in]microsMicroseconds to add.
Note
Raises set, because the passage of time is one of the things that changes what a service call would find. A keepalive window can elapse with nothing else at all.

References praet_ordo_advance().

Referenced by praet_ordo_advance().

◆ praet_ordo_advance_ticks()

EMBED_HOST_DEVICE void praet_ordo_advance_ticks ( PraetOrdo * context,
embed_word ticks )

Advances the clock by ticks, scaled against the declared frequency.

Parameters
[in,out]contextContext to advance [BORROWS].
[in]ticksTicks read off the clock this build declared.
Note
What a port calls, because a counter reads in ticks and every deadline here is microseconds. The scale is one compile-time constant. A build whose clock runs at a whole megahertz pays a multiply and a shift for it.
Warning
Ticks short of a whole microsecond drop, and nothing carries them over. A port that feeds this one tick at a time on a fast clock never advances anything. For that reason a port reads the counter and passes the difference instead of a count of calls.

References praet_ordo_advance_ticks().

Referenced by praet_ordo_advance_ticks().

◆ praet_ordo_raise()

EMBED_HOST_DEVICE void praet_ordo_raise ( PraetOrdo * context)

Is in for the interrupt that raises the set volatile.

Parameters
[in,out]contextContext the interrupt belongs to [BORROWS].
Note
All an interrupt does. It may run any number of times and the raises collapse. There is exactly one reader and a raise of a raised flag is a no-op. Nothing counts and nothing waits in line.

References praet_ordo_raise().

Referenced by praet_ordo_raise().

◆ praet_ordo_poll()

EMBED_HOST_DEVICE void praet_ordo_poll ( PraetOrdo * context)

Drives the port and brings every flag word up to date. The caller's poll.

Parameters
[in,out]contextContext to poll [BORROWS].
Note
What a caller calls, and the only thing they have to. Everything a channel does between an attach and a completion happens here. The poll asks the port how far each active channel got and feeds the watchdog the answer. It clears a settle that elapsed, marks a channel nothing reported on as stalled, and completes a detach whose transfer ended.
Reports nothing. What a caller wants is in the flag word, which this leaves current, and one load reads it. A return value here would be a second way to learn the same thing, and the two would eventually disagree.
Also the reader/setter, and the first call on interrupt exit. It reads set, takes busy, does the above, then unsets both volatiles. With busy taken it ignores the interrupt for that span. The interrupt may retain set raised throughout and nothing gets lost, because this recomputes every channel from what it can see and consumes no event.
Does nothing where set was clear, and where busy was already up. A nested call while the lock is out is the re-entry case, and it declines and leaves the outer call's half-done state as it is.
Every state change a channel undergoes goes through here, as puts all of the access control in one function. That fell out of the lock: one reader means one place.

References praet_ordo_poll().

Referenced by praet_ordo_poll().

◆ praet_ordo_flags()

EMBED_HOST_DEVICE uint32_t praet_ordo_flags ( const PraetOrdo * context,
embed_word channel )

Returns one channel's flag word.

Parameters
[in]contextContext the channel belongs to [BORROWS].
[in]channelChannel to read.
Returns
The whole word: quaternary core at the bottom, statuses and region above.
Note
One load. To know a channel is idle needs no wait for a callback.

References praet_ordo_flags().

Referenced by praet_ordo_flags().

Variable Documentation

◆ praet

const MemoriamPraetereoNs praet
static

Dispatch table instance named praet.

Note
Each member calls the mmgr_praet_ function of the same name, one to one. No member points at another's function, which is where this differs from the memor table.

Definition at line 208 of file memoriam_praetereo.h.