|
dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
|
#include <dx_usb_stream_pipe.h>
Classes | |
| struct | cache |
| struct | isoc |
Public Types | |
| typedef struct device_t::desc::stream | desc |
| typedef device<> | device_t |
| typedef device<> | device_t |
| typedef event< user > | event_t |
| enum | type |
Public Member Functions | |
| __dx_catchall (std::cerr<< dx::exception(&exception, exception.error, __PRETTY_FUNCTION__, __FILE__, __LINE__)<< std::endl;,) void conclude() noexcept | |
| pipe & | abort () try |
| stream & | attach (channel_t **[2], const std::vector< bool > &, direction::direction) try |
| the pin passes its own direction: a stream shared by two pins carries none of its own | |
| virtual void | callback () |
| void | conclude () noexcept override |
| conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy. | |
| pipe & | drain (std::chrono::milliseconds timeout=std::chrono::milliseconds(250)) noexcept |
| waits for already-submitted requests to complete on their own, without cancelling them | |
| dx_catchall_rethrow () os_result status() const noexcept | |
| dx_catchall_rethrow () virtual void free() noexcept | |
| dx_catchall_rethrow (;,"endpoint:%x interface:%d setting:%d", endpoint.address, endpoint.interface, endpoint.setting) pipe &max_frame_size(uint32_t frame_size) | |
| dx_pass (rx==tx? overflow:ok, "too manny (%d) outstanding asynchronous transactions for endpoint %x", max, address) | |
| void | exception (const class exception &exception, bool filtered=false) const noexcept override |
| void | flush () |
| if (tx==max) tx=0 | |
| virtual event & | initialize (bool signalled=false) |
| virtual event & | initialize (const std::string &, bool signalled=false) |
| void | launch () override try |
| operator const os_event () const noexcept | |
| operator dx::circular * () const noexcept | |
| operator os_event () noexcept | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::circular * | operator-> () const noexcept |
| operator::HANDLE () const noexcept | |
| pipe & | operator<< (const data_t &data) |
| synchronous USB write request | |
| pipe & | operator>> (data_t &data) |
| synchronous USB read request | |
| bool | outstanding () const noexcept |
| bool | poll (usb::isoc::result &result) noexcept |
| pulls the oldest completed isoc request's result | |
| pipe & | read (void *data, size_t size) try |
| synchronous USB read request | |
| pipe & | receive (void *data, size_t size) try |
| asynchronous USB read request | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END event & | reset (uint64_t count=0) override try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END event & | reset (uint64_t count=0) override try |
| super & | signal (uint64_t count=1) override try |
| super & | signal (uint64_t count=1) override try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END uint64_t | signalled () const |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END uint64_t | signalled () const |
| virtual bool | submit (dx::stream::encoder::index::type, unsigned int, uint8_t) |
| submit encoder stage to device return true if successfully submitted; if false is returned the encode state machine will not update the stage value (i.e. if the stage can't be submitted during streaming pause), given the chance to submit the stage at start(). | |
| pipe & | submit (const request< data_t > &request) const try |
| standard request to pipe | |
| bool | try_conclude () noexcept |
| atomically conclude()s if currently launched; returns whether this call did it | |
| bool | try_conclude () noexcept |
| atomically conclude()s if currently launched; returns whether this call did it | |
| bool | try_launch () |
| atomically launch()es if not already launched; returns whether this call did it | |
| bool | try_launch () |
| atomically launch()es if not already launched; returns whether this call did it | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END super & | wait (bool reset=false) override try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END super & | wait (bool reset=false) override try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END bool | wait (const std::chrono::duration< rep_t, period_t > &timeout, bool reset=false) try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END bool | wait (const std::chrono::duration< rep_t, period_t > &timeout, bool reset=false) try |
| pipe & | write (const void *data, size_t size) try |
| synchronous USB write request | |
Public Attributes | |
| const usb::endpoint::attributes & | attributes |
| std::deque< union audio::descriptor::endpoint > | audio |
| uint8_t | bRefresh |
| audio class endpoint: 2^bRefresh frames between two feedback values | |
| uint8_t | bSynchAddress |
| audio class endpoint: the isoc sync endpoint pacing this one, 0: none | |
| class buffer { | |
| } | buffer |
| dx::stream::channel::control * | control |
| kernel streaming: the driver's buffer switch bookkeeping, set by attach() | |
| event_t | data [direction::directions] |
| event signalising data arrival(in) or draining(out) | |
| dx::promoted< dx::stream::format > | format |
| the container this stream's ring runs: class and width its participants agreed on | |
| uint64_t ::USBD_ISO_PACKET_DESCRIPTOR * | frame |
| uint32_t | granularity |
| ::WINUSB_INTERFACE_HANDLE | handle |
| const decltype(desc::target.idx()) | id |
| interface & | interface |
| uint32_t | latency |
| std::atomic< bool > | launched |
| std::atomic< bool > | launched |
| uint32_t | linesize |
| unsigned int | micro_frames |
| dx::stream::clock::monitor * | monitor |
| decltype(device_t::samplerate) & | samplerate |
| uint64_t & | sequence |
| promoted< uint32_t > | start |
| promoted< uint32_t > | start |
| promoted< bool > | started |
| promoted< bool > | started |
| return * | this |
| bool | ticking |
| the tick's own view of this stream's session: set by the run hook once the ring stands, cleared by the halt hook before the session ends - a plain flag, the tick must never block on a promoted's transition | |
| size_t size | try |
Static Public Attributes | |
| static constexpr auto | max |
| static constexpr auto | scope |
Protected Member Functions | |
| __dx_catchall (this->started=0;std::cerr<< dx::exception(&exception, exception.error, __PRETTY_FUNCTION__, __FILE__, __LINE__)<< std::endl;,) public | |
| creates this->circular streaming backing store and frame buffers | |
| __dx_catchall (this->started=0;std::cerr<< dx::exception(&exception, exception.error, __PRETTY_FUNCTION__, __FILE__, __LINE__)<< std::endl;,) void pump_in() noexcept try | |
| data driven streaming in | |
| void | alloc (size_t=0, bool free=true) override |
| catch (...) | |
| catch (...) | |
| catch (...) | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| catch (const std::exception &__std_exception) | |
| catch (const std::exception &__std_exception) | |
| catch (const std::exception &__std_exception) | |
| void | charge () try |
| streaming session prologue: selects the alternate setting, (re-)creates the isoc buffer and frees every slot - run by the thread owning the session (group pipes: the group's thread), whose ticks then submit | |
| dx_catchall_handler (this,) ~pipe() override | |
| float | encoder (dx::stream::encoder::index::type type, unsigned int index) const override |
| bool | encoder (dx::stream::encoder::index::type type, unsigned int index, float value) override |
| void | exception (const dx::exception &exception, bool filtered=false) const noexcept override |
| notification exception handler | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END uint32_t | fill (struct tick &tick) |
| takes an out slot's data from the ring, sized as its request was submitted; returns the lines taken | |
| void | free () noexcept override |
| overrides may release further alloc()-acquired resources (request buffers, isoc pools, shared-memory attachments) alongside circular; called only from alloc()'s own self-cleanup or the destructor - never from halt()/stop(), so everything alloc() acquires stays live for the object's full lifetime | |
| void | info (std::ostream &os) noexcept override try |
| log object class information | |
| void | initialize (uint32_t packet_size, uint32_t micro_frames) |
| void | initialize (uint32_t samplerate, uint32_t line_size, uint32_t micro_frames, bool implicit_feedback) |
| void | initialize () override |
| void | isoc_buffer_create () |
| (re-)creates the buffered isoc pipe's tick-staging buffer via isoc.buffer.create(); safe to call again per start/stop cycle since cache.buffered keeps this->circular on its own, separate, construction-time allocation (super::alloc() below). | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END void | pump_out () noexcept try |
| data driven streaming out | |
| void | received (os_result status, size_t size) override try |
| async read callback | |
| void | sync_transfer (uint64_t frame) noexcept |
| the sink's own feedback endpoint: collects the rate it states and turns it into this pipe's per frame line counts | |
| uint32_t | transfer (uint64_t frame) |
| the group's tick at bus frame frame: collects this pipe's completions and resubmits each slot a round on, the free slot due a round ahead in frame order among them, then moves the data - out: fills that slot, in: takes the slot due lead frames behind, ahead of its completion; returns the lines moved | |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END void | transmitted (os_result status, size_t size) override try |
| async write callback | |
Protected Attributes | |
| struct { | |
| } | address |
| struct { | |
| volatile uint32_t completion | |
| os_result status | |
| streaming status for observer thread More... | |
| uint32_t submit | |
| } | async |
| struct dx::usb::stream::pipe::cache | cache |
| listener< dx::listen< std::function< void(const uint32_t &)> > > | cadence_listener {this->samplerate.listen, {[this](const uint32_t& samplerate){cache.cadence= samplerate/ usb::isoc::ticks_per_sec;}}} |
| the tick reads the cache, never the promoted | |
| dx::circular * | circular |
| allocated once by initialize()/alloc(); released only by free() | |
| usb::isoc::result | completed [max] |
| isoc completions in callback order, filled by the runloop, drained by poll() | |
| device<> & | device |
| device<> & | device |
| std::function< void()> | flush_hook |
| std::function< void()> | flush_hook |
| std::function< void()> | halt_hook |
| std::function< void()> | halt_hook |
| uint8_t | idx |
| struct dx::usb::stream::pipe::isoc | isoc |
| listener< dx::listen< std::function< void(const uint32_t &)> > > | lead_listener {this->device[*this].transport::safety_offset[this->target.direction].listen, {[this](const uint32_t& ticks){cache.lead= ticks;}}} |
| a lead set mid-session moves the tick's slots along | |
| ::HANDLE | process |
| std::function< void()> | run_hook |
| std::function< void()> | run_hook |
| volatile unsigned int | rx |
| struct { | |
| struct { | |
| unsigned int ticks | |
| struct { | |
| unsigned int count | |
| } transaction | |
| } cycle | |
| } | sync |
| struct dx::usb::audio::isoc::cycle::tick * | tick = nullptr |
| volatile unsigned int | tx |
| struct { | |
| ::WINUSB_INTERFACE_HANDLE handle | |
| } | winusb |
Friends | |
| class | pause |
| class | usb::stream::group< device_t > |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
stronginherited |
|
inlinenoexceptinherited |
|
inlineprotected |
creates this->circular streaming backing store and frame buffers
stream::stream's ring reset, composed with usb::platform::pipe's completion-thread launch
stream::stream's group decrement, composed with usb::platform::pipe's join-outstanding-requests wait
|
inlineprotectednoexcept |
data driven streaming in
postponed
|
inlineinherited |
|
inlineoverrideprotectedvirtual |
generates isoc cycle metrics from sample rate,
requests buffers to fit at least 3x max iosize with isoc cycle size granularity
update max frame size
Reimplemented from dx::stream::stream< device_t, dx::circular, usb::pipe< device_t > >.
|
inlineinherited |
the pin passes its own direction: a stream shared by two pins carries none of its own
The default implementation is based on event<user> which is signalled when triggered via callback() from kernel. This is to achieve compatibility with Windows events. Its probably more adequate to overwrite callback() and do the work here if feasible.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
streaming session prologue: selects the alternate setting, (re-)creates the isoc buffer and frees every slot - run by the thread owning the session (group pipes: the group's thread), whose ticks then submit
estimate upcoming timestamp
|
inlineoverridevirtualnoexceptinherited |
conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.
Reimplemented from dx::object.
|
inlinenoexceptinherited |
waits for already-submitted requests to complete on their own, without cancelling them
|
inlineoverrideprotected |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inherited |
|
inlineoverrideprotected |
|
inlineoverrideprotectedvirtual |
Reimplemented from dx::stream::stream< device_t, dx::circular, usb::pipe< device_t > >.
|
inlineoverridenoexceptinherited |
|
inlineoverrideprotectedvirtualnoexcept |
notification exception handler
Implements dx::object.
|
inlineprotected |
takes an out slot's data from the ring, sized as its request was submitted; returns the lines taken
|
inlineinherited |
|
inlineoverrideprotectedvirtualnoexcept |
overrides may release further alloc()-acquired resources (request buffers, isoc pools, shared-memory attachments) alongside circular; called only from alloc()'s own self-cleanup or the destructor - never from halt()/stop(), so everything alloc() acquires stays live for the object's full lifetime
Reimplemented from dx::stream::stream< device_t, dx::circular, usb::pipe< device_t > >.
|
pure virtualinherited |
|
inlineoverrideprotectedvirtualnoexcept |
log object class information
Reimplemented from dx::stream::stream< device_t, dx::circular, usb::pipe< device_t > >.
|
inlineinherited |
|
inlineinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
inlineoverrideprotectedvirtual |
Reimplemented from dx::stream::stream< device_t, dx::circular, usb::pipe< device_t > >.
|
inlineprotected |
(re-)creates the buffered isoc pipe's tick-staging buffer via isoc.buffer.create(); safe to call again per start/stop cycle since cache.buffered keeps this->circular on its own, separate, construction-time allocation (super::alloc() below).
|
inlineoverridevirtualinherited |
Reimplemented from dx::object.
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
synchronous USB write request
|
inlineinherited |
synchronous USB read request
|
inlinenoexceptinherited |
asynchronous requests in flight
|
inlinenoexceptinherited |
pulls the oldest completed isoc request's result
|
inlineprotectednoexcept |
data driven streaming out
|
inlineinherited |
synchronous USB read request
|
inlineinherited |
asynchronous USB read request
|
inlineoverrideprotectedvirtual |
async read callback
generates timestamp
Reimplemented from dx::usb::platform::pipe< device_t, interface >.
|
inlineoverrideinherited |
|
inlineoverrideinherited |
|
inlinevirtualinherited |
submit encoder stage to device return true if successfully submitted; if false is returned the encode state machine will not update the stage value (i.e. if the stage can't be submitted during streaming pause), given the chance to submit the stage at start().
|
inlineinherited |
standard request to pipe
|
inlineprotectednoexcept |
the sink's own feedback endpoint: collects the rate it states and turns it into this pipe's per frame line counts
|
inlineprotected |
the group's tick at bus frame frame: collects this pipe's completions and resubmits each slot a round on, the free slot due a round ahead in frame order among them, then moves the data - out: fills that slot, in: takes the slot due lead frames behind, ahead of its completion; returns the lines moved
|
inlineoverrideprotectedvirtual |
async write callback
generates timestamp
Reimplemented from dx::usb::platform::pipe< device_t, interface >.
|
inlinenoexceptinherited |
atomically conclude()s if currently launched; returns whether this call did it
|
inlinenoexceptinherited |
atomically conclude()s if currently launched; returns whether this call did it
|
inlineinherited |
atomically launch()es if not already launched; returns whether this call did it
|
inlineinherited |
atomically launch()es if not already launched; returns whether this call did it
|
inlineoverrideinherited |
|
inlineoverrideinherited |
|
inlineinherited |
wait with duration timeout returns true: signalled false: timed out
|
inlineinherited |
wait with duration timeout returns true: signalled false: timed out
|
inlineinherited |
synchronous USB write request
|
friend |
|
friend |
| struct { ... } dx::usb::platform::pipe< device<>, interface >::address |
| struct { ... } dx::usb::stream::pipe< device_t, circular_t, stream_t >::async |
|
inherited |
|
inherited |
|
inherited |
audio class endpoint: 2^bRefresh frames between two feedback values
|
inherited |
audio class endpoint: the isoc sync endpoint pacing this one, 0: none
| class { ... } ::buffer dx::usb::platform::pipe< device<>, interface >::buffer |
|
protected |
|
protected |
the tick reads the cache, never the promoted
|
protectedinherited |
allocated once by initialize()/alloc(); released only by free()
|
protectedinherited |
isoc completions in callback order, filled by the runloop, drained by poll()
| volatile uint32_t dx::usb::stream::pipe< device_t, circular_t, stream_t >::completion |
|
inherited |
kernel streaming: the driver's buffer switch bookkeeping, set by attach()
| unsigned int dx::usb::stream::pipe< device_t, circular_t, stream_t >::count |
| struct { ... } dx::usb::stream::pipe< device_t, circular_t, stream_t >::cycle |
|
inherited |
event signalising data arrival(in) or draining(out)
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
the container this stream's ring runs: class and width its participants agreed on
A bus that negotiates it installs its own server; without one the request stands. The seed is the desc's own pin format, so a stream that nobody contradicts runs what it was declared with.
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
|
inherited |
|
protectedinherited |
|
inherited |
|
protected |
|
inherited |
|
inherited |
|
inherited |
|
protected |
a lead set mid-session moves the tick's slots along
|
inherited |
|
staticconstexprinherited |
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
| os_result dx::usb::stream::pipe< device_t, circular_t, stream_t >::status |
streaming status for observer thread
| uint32_t dx::usb::stream::pipe< device_t, circular_t, stream_t >::submit |
| struct { ... } dx::usb::stream::pipe< device_t, circular_t, stream_t >::sync |
|
inherited |
|
inherited |
|
inherited |
the tick's own view of this stream's session: set by the run hook once the ring stands, cleared by the halt hook before the session ends - a plain flag, the tick must never block on a promoted's transition
| unsigned int dx::usb::stream::pipe< device_t, circular_t, stream_t >::ticks |
| struct { ... } dx::usb::stream::pipe< device_t, circular_t, stream_t >::transaction |
|
inherited |
|
protectedinherited |
| struct { ... } dx::usb::platform::pipe< device<>, interface >::winusb |
| (c) copyright 2009 dynamic acoustics e.U. | generated on |