dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::stream::device< _super_device_t, _desc_t, _stream_t, _group_t > Class Template Reference

a streaming device: its desc, the settings the desc defaults, the streams of that desc grouped by dx::stream::group and the clock those groups run on. Every bus device derives from this one and supplies what its transport does differently - the settings' servers (a rate written to the hardware), the group's tick, the streams' rings. The settings themselves are promoted preferences here, so a wish survives the device and is asked of the transport once the device is there. More...

#include <dx_stream_device.h>

Inheritance diagram for dx::stream::device< _super_device_t, _desc_t, _stream_t, _group_t >:
Collaboration diagram for dx::stream::device< _super_device_t, _desc_t, _stream_t, _group_t >:

Classes

struct  [struct].hw
class  monitor
 the device's performance counters in shared memory, so a second process (the test app's clock monitor) reads what the streaming session measures; every fetch initializes an unused buffer More...
class  pause
 RAII: pauses every one of this device's groups (remembered count, force-stopped) across a streams structure mutation, restarts all on destruction. More...
struct  property
 the preference keys of this device's settings, named once - the store's layout is these words, and a host's own property names never reach the store More...

Public Types

typedef _desc_t desc_t
typedef event event_t
typedef std::conditional_t<std::is_void_v<_group_t>, dx::stream::group<device>, _group_t> group_t
 bus devices driving their groups' tick pass their own group type
typedef promoted<uint32_t>::template preference<decltype(super_device_t::preference)> source_t
typedef _stream_t stream_t
typedef _super_device_t super_device_t
 the device this streaming device sits on: its own operations of a name this class takes for itself (a USB device's configuration()) are reached through it

Public Member Functions

virtual desc_t::configuration align(const typename desc_t::configuration& value, const typename desc_t::configuration &)
 a configuration the device can run: every stream's index within its configurations, one past them the stream off - a bus device narrows it to what its bus carries, the streams value leaves as current has them standing
void attach(void** io[dx::stream::direction::directions][2], const std::vector<bool>(& channel_map)[2], const dx::stream::format(& format)[2])
 the consumer's planar channel buffers in the format each direction's buffers carry
virtual uint64_t budget(const typename desc_t::configuration &)
 the periodic bus time the configuration takes, in ns - a bus device with a periodic budget states it
void conclude() noexcept override
 ends every group's session before the device's resources go; the start counts stay with their holders
 device(decltype(super::driver)& driver, const decltype(super::id)& id, const desc_t& desc, const std::pair<std::string, std::string>& identity= {})
 device(decltype(super::driver)& driver, const decltype(super::id)& id, decltype(super::preference)&& preferencepreference, const desc_t& desc, const std::pair<std::string, std::string>& identity= {})
 device(decltype(super::driver)& driver, const decltype(super::id)& id, desc_t&& desc, const std::pair<std::string, std::string>& identity= {})
 a desc temporary moves into the desc base, and wins over control's forwarding constructor, which binds an rvalue just as well
virtual bool hw_clock() const noexcept
virtual void hw_clock(abstract::event* hw_clock, uint32_t iosize)
 registers a consumer with the device's clock: it is signalled every iosize samples of the clock's own advance. A bus whose driver owns the clock hands the registration on instead
std::shared_ptr<stream_t> open(const typename _desc_t::stream::desc& desc, bool client= false)
 the desc's stream: the registered one, else created, registered and launched - a host's client takes a data driven stream alone, its ring has one writer and one reader
const struct desc_t::stream::config& operator ()(const struct desc_t::stream& stream)
 the stream configuration the device runs the stream in: the stream is one of the desc's
group_t& operator [](const typename _desc_t::stream::desc& stream)
 the stream's group, created on first use
template<typename f_t>
void setting(dx::stream::setting settingsetting, uint32_t index, f_t&& f)
 the setting a host keeps for its clients handed to f as its promoted: the transport settings the sync reference's group's, the source the one of the stream whose target index is index
virtual std::pair<source_t &, bool> source(const struct _desc_t::stream& stream)
 the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources
void wake() override

Public Attributes

promoted<uint32_t>::preference<decltype(super::preference)> clocksource
promoted<typenamedesc_t::configuration>::template preference<decltype(super::preference)> configuration
 the device's configuration: per stream the stream configuration it runs, the richest by default - a bus device narrows it to what its bus carries (align()), and it stands while a group is started
std::map<decltype(_desc_t::stream::group), group_t> group
struct  hw
promoted<std::string>::preference<decltype(super::preference)> icon{this->preference}
promoted<uint32_t>::preference<decltype(super::preference)> iosize
dx::stream::device::monitor monitor
promoted<uint32_t>::preference<decltype(super::preference)> samplerate
std::map<decltype(_desc_t::stream::target.idx()), source_t> sources
promoted<structdesc_t::stream *>::template preference<decltype(super::preference), uint32_t> sync_reference
dx::stream::device::monitor version

Static Public Attributes

static constexpr bool hosted{}
 the transport's settings belong to another process' device: a hosted device mirrors them through its chains, it keeps no store of them

Protected Member Functions

virtual void grouped(group_t &)
 operator[](): a group just came into existence, a host wires its per-group transports here

Friends

std::ostream& operator <<(std::ostream& os, device& device)

Detailed Description

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t = void>
class dx::stream::device< _super_device_t, _desc_t, _stream_t, _group_t >

a streaming device: its desc, the settings the desc defaults, the streams of that desc grouped by dx::stream::group and the clock those groups run on. Every bus device derives from this one and supplies what its transport does differently - the settings' servers (a rate written to the hardware), the group's tick, the streams' rings. The settings themselves are promoted preferences here, so a wish survives the device and is asked of the transport once the device is there.

Member Typedef Documentation

◆ desc_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef _desc_t dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::desc_t

◆ event_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef event dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::event_t

◆ group_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef std::conditional_t<std::is_void_v<_group_t>, dx::stream::group<device>, _group_t> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::group_t

bus devices driving their groups' tick pass their own group type

◆ source_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef promoted<uint32_t>::template preference<decltype(super_device_t::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::source_t

◆ stream_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef _stream_t dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::stream_t

◆ super_device_t

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
typedef _super_device_t dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::super_device_t

the device this streaming device sits on: its own operations of a name this class takes for itself (a USB device's configuration()) are reached through it

Constructor & Destructor Documentation

◆ device() [1/3]

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::device(decltype(super::driver)& driver, const decltype(super::id)& id, const desc_t& desc, const std::pair<std::string, std::string>& identity= {})
inline
Here is the caller graph for this function:

◆ device() [2/3]

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::device(decltype(super::driver)& driver, const decltype(super::id)& id, desc_t&& desc, const std::pair<std::string, std::string>& identity= {})
inline

a desc temporary moves into the desc base, and wins over control's forwarding constructor, which binds an rvalue just as well

◆ device() [3/3]

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::device(decltype(super::driver)& driver, const decltype(super::id)& id, decltype(super::preference)&& preference, const desc_t& desc, const std::pair<std::string, std::string>& identity= {})
inline

Member Function Documentation

◆ align()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual desc_t::configuration dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::align(const typename desc_t::configuration& value, const typename desc_t::configuration&)
inlinevirtual

◆ attach()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
void dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::attach(void** io[dx::stream::direction::directions][2], const std::vector<bool>(&) channel_map[2], const dx::stream::format(&) format[2])
inline

the consumer's planar channel buffers in the format each direction's buffers carry

◆ budget()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual uint64_t dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::budget(const typename desc_t::configuration&)
inlinevirtual

◆ conclude()

◆ grouped()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual void dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::grouped(group_t&)
inlineprotectedvirtual

operator[](): a group just came into existence, a host wires its per-group transports here

◆ hw_clock() [1/2]

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual bool dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::hw_clock() const
inlinevirtualnoexcept
Here is the caller graph for this function:

◆ hw_clock() [2/2]

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual void dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::hw_clock(abstract::event* hw_clock, uint32_t iosize)
inlinevirtual

◆ open()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
std::shared_ptr<stream_t> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::open(const typename _desc_t::stream::desc& desc, bool client= false)
inline

the desc's stream: the registered one, else created, registered and launched - a host's client takes a data driven stream alone, its ring has one writer and one reader

◆ operator ()()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
const struct desc_t::stream::config& dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::operator ()(const struct desc_t::stream& stream)
inline

the stream configuration the device runs the stream in: the stream is one of the desc's

◆ operator []()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
group_t& dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::operator [](const typename _desc_t::stream::desc& stream)
inline

the stream's group, created on first use

◆ setting()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
template<typename f_t>
void dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::setting(dx::stream::setting setting, uint32_t index, f_t&& f)
inline

the setting a host keeps for its clients handed to f as its promoted: the transport settings the sync reference's group's, the source the one of the stream whose target index is index

◆ source()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
virtual std::pair<source_t &, bool> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::source(const struct _desc_t::stream& stream)
inlinevirtual

◆ wake()

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
void dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::wake()
inlineoverride

◆ operator <<

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
std::ostream& operator <<(std::ostream& os, device<_super_device_t, _desc_t, _stream_t, _group_t>& device)
friend

Member Data Documentation

◆ clocksource

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::clocksource
Initial value:
[this]() {return this->clock[0].defaults.clocksource;},
[this](uint32_t value, uint32_t) {return std::min(value, this->clock[0].settings);}}
key_value_tree< registry > preference
hierarchical preference store over the Windows registry see dx::key_value_tree (dx_key_value_tree....
Definition dx_registry.h:496
select/get stream sample rate/iosize
Definition dx_stream.h:215
static constexpr auto clocksource
Definition dx_stream_device.h:156
a group's settings per side of its ring: the side's wait strategy on the clock and its lead per direc...
Definition dx_stream_group.h:56
unsigned int uint32_t
Definition wdm/dxd_platform.h:117

◆ configuration

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<typenamedesc_t::configuration>::template preference<decltype(super::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::configuration
Initial value:
[this]() {return this->desc_t::preferred([this](const typename desc_t::configuration& value) {return align(value, value);});},
[this](const typename desc_t::configuration& value, const typename desc_t::configuration& current){
for(auto& [id, group]: this->group)
return current;
return align(value, current);}}
bool initialized
Definition dx_value.h:77
promoted< bool > started
Definition dx_stream_control.h:97
promoted< typenamedesc_t::configuration >::template preference< decltype(super::preference)> configuration
the device's configuration: per stream the stream configuration it runs, the richest by default - a b...
Definition dx_stream_device.h:196
virtual desc_t::configuration align(const typename desc_t::configuration &value, const typename desc_t::configuration &)
a configuration the device can run: every stream's index within its configurations,...
Definition dx_stream_device.h:267
streaming group: the streams of one device sharing a desc::stream::group id, streamed together by one...
Definition dx_stream_group.h:116
static constexpr auto configuration
Definition dx_stream_device.h:157

the device's configuration: per stream the stream configuration it runs, the richest by default - a bus device narrows it to what its bus carries (align()), and it stands while a group is started

◆ group

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
std::map<decltype(_desc_t::stream::group), group_t> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::group

streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first

◆ hosted

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
bool dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::hosted{}
staticconstexpr

the transport's settings belong to another process' device: a hosted device mirrors them through its chains, it keeps no store of them

◆ hw

struct dx::stream::device::[struct].hw dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::hw

◆ icon

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<std::string>::preference<decltype(super::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::icon{this->preference}

◆ iosize

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::iosize
Initial value:
{[this](uint32_t value) {hw.iosize= value;}},
[this](){
const struct desc_t::stream* sync_reference{this->sync_reference};
return this->clock[0].defaults.iosize.hw_ticks* this->clock[0].interval(samplerate,
sync_reference? sync_reference->transaction.granularity: 0);},
[this](uint32_t value, uint32_t){
const struct desc_t::stream* sync_reference{this->sync_reference};
return this->clock[0].defaults.iosize.align(value, this->clock[0].interval(samplerate,
sync_reference? sync_reference->transaction.granularity: 0));}}
realtime tick mechanism: one thread per clock - run/halt lifecycle and tick dispatch; the source_t ba...
Definition dx_clock.h:195
a streaming device: its desc, the settings the desc defaults, the streams of that desc grouped by dx:...
Definition dx_stream_device.h:60
promoted< uint32_t >::preference< decltype(super::preference)> samplerate
Definition dx_stream_device.h:185
promoted< uint32_t >::preference< decltype(super::preference)> iosize
Definition dx_stream_device.h:205
struct dx::stream::device::@244205213055121357251113217117007375116163104134 hw
promoted< structdesc_t::stream * >::template preference< decltype(super::preference), uint32_t > sync_reference
Definition dx_stream_device.h:179
static constexpr auto iosize
Definition dx_stream_device.h:158

◆ monitor

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
dx::stream::device::monitor dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::monitor

◆ samplerate

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::samplerate
Initial value:
[this]() {return this->clock[0].defaults.samplerate;},
[this](uint32_t value, uint32_t current) {return
(samplerate.transient && !(this->clock[0].settings && this->clock[0].setting[clocksource].external.locked))?
this->clock[0].align(value):
current:
this->clock[0].align(this->samplerate.value(this->samplerate.backing_store(this->samplerate.preference_value(this->samplerate.dflt()))));}}
value_t value
Definition dx_value.h:71
bool transient
\ indicate the value has been initialized
Definition dx_value.h:78
promoted< uint32_t >::preference< decltype(super::preference)> clocksource
Definition dx_stream_device.h:175
static constexpr auto samplerate
Definition dx_stream_device.h:160

◆ sources

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
std::map<decltype(_desc_t::stream::target.idx()), source_t> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::sources

source selectors by stream target: a stream with sources gets its own on first use

◆ sync_reference

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
promoted<structdesc_t::stream*>::template preference<decltype(super::preference), uint32_t> dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::sync_reference
Initial value:
[this]() {return this->desc_t::sync_reference(this->clock[0].defaults.sync.reference);},
[this](struct desc_t::stream* value, struct desc_t::stream*) {return desc_t::align(value);},
[this](struct desc_t::stream* value)->uint32_t {return desc_t::sync_reference(value);},
[this](uint32_t preference_value) {return desc_t::sync_reference(preference_value);}}
static constexpr auto reference
Definition dx_stream_device.h:166

◆ version

template<typename _super_device_t, typename _desc_t, typename _stream_t, typename _group_t= void>
dx::stream::device::monitor dx::stream::device<_super_device_t, _desc_t, _stream_t, _group_t>::version

The documentation for this class was generated from the following file: