MMgr v1.0.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
memoriam_praetereo.h File Reference

DMA channels: the completion event, the port hooks, the praet dispatch table, and the schedule and descriptors under them. More...

Go to the source code of this file.

Data Structures

struct  mmgr_praet_event
 What the port layer reports when a transfer finishes. More...
struct  PraetCallbackCfg
 A completion callback and the pointer handed back to it. More...
struct  PraetCfg
 Arguments for opening a channel, and for polling one. More...
struct  PraetTransferCfg
 Arguments for submitting a transfer, and for closing a channel. More...
struct  MemoriamPraetereoNs
 Type of the praet dispatch table. More...

Typedefs

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

Functions

embed_bool mmgr_praet_open (const PraetCfg *args)
 Opens args->channel and registers args->on_complete against it.
embed_bool mmgr_praet_tx_submit (const PraetTransferCfg *args)
 Submits args->bytes of args->buf on args->channel.
void mmgr_praet_close (const PraetTransferCfg *args)
 Closes args->channel.
void mmgr_praet_poll (const PraetCfg *args)
 Drives the port layer's poll hook.
embed_bool mmgr_praet_hw_open (const PraetCfg *args)
 Opens a DMA channel on real hardware.
embed_bool mmgr_praet_hw_tx_submit (const PraetTransferCfg *args)
 Submits a transfer on real hardware.
void mmgr_praet_hw_close (const PraetTransferCfg *args)
 Closes a DMA channel on real hardware.
void mmgr_praet_hw_poll (const PraetCfg *args)
 Advances whatever polling the port layer needs.

Variables

static const MemoriamPraetereoNs praet
 Dispatch table instance named praet.

Detailed Description

DMA channels: the completion event, the port hooks, the praet dispatch table, and the schedule and descriptors under them.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29
Note
The one header a caller includes. praet_ordo.h and praet_descriptor.h come in at the end, and the knobs they read are set on the build line, before this is reached.
Warning
Everything below is declared only when MMGR_ENABLE_DMA is set.

Definition in file memoriam_praetereo.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 kept [BORROWS].

Definition at line 54 of file memoriam_praetereo.h.

Function Documentation

◆ mmgr_praet_open()

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_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()

void mmgr_praet_close ( const PraetTransferCfg * args)

Closes args->channel.

Parameters
[in]argsChannel to close [BORROWS].
Note
Only args->channel is read. 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()

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_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.
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_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()

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.
Only args->channel is forwarded. 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()

void mmgr_praet_hw_poll ( const PraetCfg * args)

Advances whatever polling 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 checking 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().

Variable Documentation

◆ praet

const MemoriamPraetereoNs praet
static

Dispatch table instance named praet.

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

Definition at line 204 of file memoriam_praetereo.h.