Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
adc_observer.h File Reference

Optional caller-owned ADC publication observations. More...

#include "nexus/core/time.h"
#include "nexus/io/stream.h"

Go to the source code of this file.

Data Structures

struct  nx_adc_observation_t
 One loan's software observation, never a sample aperture. More...
struct  nx_adc_observer_t
 Optional caller-owned observer control and exact records. More...

Macros

#define NX_ADC_OBSERVATION_DISCONTINUITY   1U

Functions

nx_result_t nx_adc_observer_initialize (nx_adc_observer_t *observer, nx_adc_observation_t *records, size_t count)
 Initialize fresh unborrowed optional observation storage.
nx_result_t nx_adc_observer_bind (nx_adc_observer_t *observer, nx_stream_t *stream, const void *owner, size_t owner_size)
 Provider-only cold bind validates every metadata/payload span before the first DMA loan.
nx_result_t nx_adc_observer_record (nx_adc_observer_t *observer, const nx_stream_fill_t *fill, nx_time_us_t observed_at)
 Provider-only record before matching release-publication.
nx_result_t nx_adc_observer_read (const nx_adc_observer_t *observer, const nx_stream_block_t *block, nx_adc_observation_t *observation)
 Read only a currently acquired block's exact epoch record.
nx_result_t nx_adc_observer_unbind (nx_adc_observer_t *observer)
 Provider-only unbind after all producer/consumer loans join.

Detailed Description

Optional caller-owned ADC publication observations.

Author
Nexus Team

Definition in file adc_observer.h.

Macro Definition Documentation

◆ NX_ADC_OBSERVATION_DISCONTINUITY

#define NX_ADC_OBSERVATION_DISCONTINUITY   1U

Definition at line 15 of file adc_observer.h.

Function Documentation

◆ nx_adc_observer_bind()

nx_result_t nx_adc_observer_bind ( nx_adc_observer_t * observer,
nx_stream_t * stream,
const void * owner,
size_t owner_size )

Provider-only cold bind validates every metadata/payload span before the first DMA loan.

Parameters
[in,out]observerInitialized exclusive observation control.
[in]streamExact initialized stream, no outstanding loans.
[in]ownerProvider's stable complete private state span.
[in]owner_sizePositive exact state byte count.
Returns
Success or INVALID/BUSY, without a partial retained bind.

◆ nx_adc_observer_initialize()

nx_result_t nx_adc_observer_initialize ( nx_adc_observer_t * observer,
nx_adc_observation_t * records,
size_t count )

Initialize fresh unborrowed optional observation storage.

Parameters
[out]observerAligned fresh control, not published to readers.
[out]recordsDistinct aligned exact record array.
[in]countPositive count; must equal the selected stream count.
Returns
Success or INVALID/CONTEXT; rejected outputs stay untouched.

◆ nx_adc_observer_read()

nx_result_t nx_adc_observer_read ( const nx_adc_observer_t * observer,
const nx_stream_block_t * block,
nx_adc_observation_t * observation )

Read only a currently acquired block's exact epoch record.

Parameters
[in]observerStable bound observation control.
[in]blockSame stream's live immutable consumer loan.
[out]observationComplete copy; untouched on rejection.
Returns
Success or INVALID/STATE for a missing/stale/released loan.

◆ nx_adc_observer_record()

nx_result_t nx_adc_observer_record ( nx_adc_observer_t * observer,
const nx_stream_fill_t * fill,
nx_time_us_t observed_at )

Provider-only record before matching release-publication.

Parameters
[in,out]observerBound exact producer-owned control.
[in]fillStill FILLING, with a proved detached memory target.
[in]observed_atSoftware observation in the same clock domain.
Returns
Success or STATE/EXHAUSTED without wrapping identities.

◆ nx_adc_observer_unbind()

nx_result_t nx_adc_observer_unbind ( nx_adc_observer_t * observer)

Provider-only unbind after all producer/consumer loans join.

Parameters
[in,out]observerStable initialized control; NULL is allowed.
Returns
Success or BUSY retaining the bound stream.