|
Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
|
Bounded caller-owned blocks with explicit producer/consumer loans. More...
#include "nexus/core/status.h"Go to the source code of this file.
Data Structures | |
| struct | nx_stream_slot_t |
| Caller-owned block metadata; initialize data and capacity only. More... | |
| struct | nx_stream_t |
| Caller-owned stream control, initialized before publication. More... | |
| struct | nx_stream_fill_t |
| Mutable producer loan; hardware must stop before abort or publish. More... | |
| struct | nx_stream_producer_t |
| Optional caller-owned preposted producer; no default cost. More... | |
| struct | nx_stream_block_t |
| Immutable consumer loan, valid until matching release succeeds. More... | |
Macros | |
| #define | NX_STREAM_BOUNDARY_IDLE 1U |
| #define | NX_STREAM_BOUNDARY_TRIGGER 2U |
| #define | NX_STREAM_BOUNDARY_LOSS 4U |
| #define | NX_STREAM_BOUNDARY_ERROR 8U |
Enumerations | |
| enum | nx_stream_slot_state_t { NX_STREAM_SLOT_FREE , NX_STREAM_SLOT_FILLING , NX_STREAM_SLOT_READY , NX_STREAM_SLOT_BORROWED } |
Functions | |
| nx_result_t | nx_stream_initialize (nx_stream_t *stream, nx_stream_slot_t *slots, size_t count) |
| Initialize an unborrowed stream and exact supplied block array. | |
| nx_result_t | nx_stream_reserve (nx_stream_t *stream, nx_stream_fill_t *fill) |
| Reserve the next free block for one serialized producer. | |
| bool | nx_stream_can_reserve (const nx_stream_t *stream) |
| Query the next physical slot without creating a loan or loss. | |
| void | nx_stream_note_loss (nx_stream_t *stream, uint32_t count) |
| Latch explicitly observed dropped producer boundaries. | |
| nx_result_t | nx_stream_publish (nx_stream_t *stream, const nx_stream_fill_t *fill, size_t length, uint32_t flags) |
| Publish a complete block after all hardware writes detached. | |
| nx_result_t | nx_stream_acquire (nx_stream_t *stream, nx_stream_block_t *block) |
| Acquire the next ready block for one serialized consumer. | |
| nx_result_t | nx_stream_release (nx_stream_t *stream, const nx_stream_block_t *block) |
| Release only the matching consumer incarnation after final use. | |
| nx_result_t | nx_stream_abort (nx_stream_t *stream, const nx_stream_fill_t *fill, bool memory_quiesced) |
| Abort a producer loan only after memory write sources detach. | |
| nx_result_t | nx_stream_stop (nx_stream_t *stream) |
| Close producer admission while retaining every outstanding loan. | |
| nx_result_t | nx_stream_post_initialize (nx_stream_producer_t *producer, nx_stream_t *stream) |
| Bind a posted producer to a quiescent initialized stream. | |
| bool | nx_stream_post_can_reserve (const nx_stream_producer_t *producer) |
| Query the next preposted slot without a loan or guessed loss. | |
| nx_result_t | nx_stream_post_reserve (nx_stream_producer_t *producer, nx_stream_fill_t *fill) |
| Reserve a future fill without making earlier blocks ready. | |
| nx_result_t | nx_stream_post_publish (nx_stream_producer_t *producer, const nx_stream_fill_t *fill, size_t length, uint32_t flags) |
| Publish only the oldest pending detached producer loan. | |
| nx_result_t | nx_stream_post_abort (nx_stream_producer_t *producer, const nx_stream_fill_t *fill, bool memory_quiesced) |
| Cancel the newest pending fill after proof of memory drain. | |
Bounded caller-owned blocks with explicit producer/consumer loans.
Definition in file stream.h.
| nx_result_t nx_stream_abort | ( | nx_stream_t * | stream, |
| const nx_stream_fill_t * | fill, | ||
| bool | memory_quiesced ) |
Abort a producer loan only after memory write sources detach.
| [in,out] | stream | Same producer owner as reserve. |
| [in] | fill | Current exact loan. |
| [in] | memory_quiesced | True only after provider proves DMA/IRQ stopped. |
| nx_result_t nx_stream_acquire | ( | nx_stream_t * | stream, |
| nx_stream_block_t * | block ) |
Acquire the next ready block for one serialized consumer.
| [in,out] | stream | Live stream; consumer may drain during stop. |
| [out] | block | Immutable consumer loan with exact incarnation token. |
| bool nx_stream_can_reserve | ( | const nx_stream_t * | stream | ) |
Query the next physical slot without creating a loan or loss.
| [in] | stream | Live initialized stream with one serialized producer. |
| nx_result_t nx_stream_initialize | ( | nx_stream_t * | stream, |
| nx_stream_slot_t * | slots, | ||
| size_t | count ) |
Initialize an unborrowed stream and exact supplied block array.
| [out] | stream | Fresh storage, not visible to any producer/consumer. |
| [in,out] | slots | Buffers distinct from all control and slot metadata. |
| [in] | count | Positive exact block count, not a maximum pool size. |
| void nx_stream_note_loss | ( | nx_stream_t * | stream, |
| uint32_t | count ) |
Latch explicitly observed dropped producer boundaries.
| [in,out] | stream | Live stream controlled by the serialized producer. |
| [in] | count | Positive lost block/boundary count, never guessed bytes. |
| nx_result_t nx_stream_post_abort | ( | nx_stream_producer_t * | producer, |
| const nx_stream_fill_t * | fill, | ||
| bool | memory_quiesced ) |
Cancel the newest pending fill after proof of memory drain.
| [in,out] | producer | Same producer; rollback is strictly LIFO |
| [in] | fill | Exact newest pending token |
| [in] | memory_quiesced | Source detached, no remaining writes |
| bool nx_stream_post_can_reserve | ( | const nx_stream_producer_t * | producer | ) |
Query the next preposted slot without a loan or guessed loss.
| [in] | producer | Same exclusive serialized producer |
| nx_result_t nx_stream_post_initialize | ( | nx_stream_producer_t * | producer, |
| nx_stream_t * | stream ) |
Bind a posted producer to a quiescent initialized stream.
| [out] | producer | Separate caller control, not aliased with buffers |
| [in,out] | stream | Admission open, no outstanding producer/consumer loans |
| nx_result_t nx_stream_post_publish | ( | nx_stream_producer_t * | producer, |
| const nx_stream_fill_t * | fill, | ||
| size_t | length, | ||
| uint32_t | flags ) |
Publish only the oldest pending detached producer loan.
| [in,out] | producer | Same exclusive producer as reserve |
| [in] | fill | Exact oldest token, absent from every hardware target |
| [in] | length | Positive valid bytes at most the block capacity |
| [in] | flags | Observed IDLE/TRIGGER/ERROR boundary facts |
| nx_result_t nx_stream_post_reserve | ( | nx_stream_producer_t * | producer, |
| nx_stream_fill_t * | fill ) |
Reserve a future fill without making earlier blocks ready.
| [in,out] | producer | Live posted producer |
| [out] | fill | Exact pending loan until FIFO publish or LIFO abort |
| nx_result_t nx_stream_publish | ( | nx_stream_t * | stream, |
| const nx_stream_fill_t * | fill, | ||
| size_t | length, | ||
| uint32_t | flags ) |
Publish a complete block after all hardware writes detached.
| [in,out] | stream | Same serialized producer as reserve. |
| [in] | fill | Current producer loan, not retained after publication. |
| [in] | length | Positive produced bytes within the reserved capacity. |
| [in] | flags | IDLE/TRIGGER boundaries observed by the provider. |
| nx_result_t nx_stream_release | ( | nx_stream_t * | stream, |
| const nx_stream_block_t * | block ) |
Release only the matching consumer incarnation after final use.
| [in,out] | stream | Same consumer owner; no remaining observers of block. |
| [in] | block | Exact acquired token, never a reconstructed pointer. |
| nx_result_t nx_stream_reserve | ( | nx_stream_t * | stream, |
| nx_stream_fill_t * | fill ) |
Reserve the next free block for one serialized producer.
| [in,out] | stream | Live initialized stream with one producer. |
| [out] | fill | Producer loan valid until publish or proved abort. |
| nx_result_t nx_stream_stop | ( | nx_stream_t * | stream | ) |
Close producer admission while retaining every outstanding loan.
| [in,out] | stream | Live control kept alive until final successful stop. |