dxd - dynax driver framework  3208
cross platform open source driver development framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dx::usb::stream::pin< desc_t, circular_t, device_t > Class Template Reference

#include <dx_stream_usb_device.h>

+ Inheritance diagram for dx::usb::stream::pin< desc_t, circular_t, device_t >:
+ Collaboration diagram for dx::usb::stream::pin< desc_t, circular_t, device_t >:

Public Types

enum  type : unsigned char {
  type::control =::kUSBControl, type::isoc = ::kUSBIsoc, type::bulk = ::kUSBBulk, type::irq = ::kUSBInterrupt,
  type::control =::UsbdPipeTypeControl, type::isoc = ::UsbdPipeTypeIsochronous, type::bulk = ::UsbdPipeTypeBulk, type::irq = ::UsbdPipeTypeInterrupt
}
 
enum  type : unsigned char {
  type::control =::kUSBControl, type::isoc = ::kUSBIsoc, type::bulk = ::kUSBBulk, type::irq = ::kUSBInterrupt,
  type::control =::UsbdPipeTypeControl, type::isoc = ::UsbdPipeTypeIsochronous, type::bulk = ::UsbdPipeTypeBulk, type::irq = ::UsbdPipeTypeInterrupt
}
 

Public Member Functions

pipeabort ()
 
pipeabort ()
 
 catchall_rethrow () os_result status() const noexcept
 
pipeclear ()
 
pipeclear ()
 
uint64_t frame ()
 
uint64_t frame ()
 
bool in () const noexcept
 bus initializer (isoc, bulk, pci, etc.) compatibility More...
 
bool in () const noexcept
 bus initializer (isoc, bulk, pci, etc.) compatibility More...
 
pipeinfo () noexcept
 
pipeinfo () noexcept
 
pipemax_frame_size (unsigned int frame_size)
 
pipemax_frame_size (unsigned int frame_size)
 
 operator const os_event () const noexcept
 
 operator os_event () noexcept
 
 operator::HANDLE () noexcept
 
template<typename data_t >
pipeoperator<< (const data_t &data)
 
template<typename data_t >
pipeoperator<< (const data_t &data)
 
template<typename data_t >
pipeoperator>> (data_t &data)
 
template<typename data_t >
pipeoperator>> (data_t &data)
 
piperead (void *data, size_t size)
 synchronous USB read request More...
 
piperead (void *data, size_t size)
 synchronous USB read request More...
 
pipereceive (void *data, size_t size)
 asynchronous USB read request More...
 
pipereceive (void *data, uint64_t &sequence,::USBD_ISO_PACKET_DESCRIPTOR *frame, int frames=1)
 asynchronous USB isoc read request More...
 
pipereceive (void *data, size_t size)
 asynchronous USB read request More...
 
pipereceive (void *data, uint64_t &sequence,::IOUSBIsocFrame *frame, int frames=1)
 asynchronous USB isoc read request More...
 
void reset ()
 
void signal ()
 
pipetransmit (const void *data, size_t size)
 asynchronous USB write request More...
 
pipetransmit (const void *data, uint64_t &sequence,::USBD_ISO_PACKET_DESCRIPTOR *frame, int frames=1)
 asynchronous USB isoc write request More...
 
pipetransmit (const void *data, size_t &size)
 asynchronous USB write request More...
 
pipetransmit (const void *data, uint64_t &sequence,::IOUSBIsocFrame *frame, int frames=1)
 asynchronous USB isoc write request More...
 
void wait (int64_t timeout=0)
 
pipewrite (const void *data, size_t size)
 synchronous USB write request More...
 
pipewrite (const void *data, size_t size)
 synchronous USB write request More...
 

Static Public Member Functions

static void wait (::HANDLE handle, int64_t timeout=0)
 

Public Attributes

std::deque< union audio
<>::descriptor::endpoint > 
audio
 
std::deque< union audio
<>::descriptor::endpoint > 
audio
 
dx::log log {}
 
enum dx::usb::pipe::type type
 
volatile unsigned int completion
 
unsigned int submit
 

Protected Types

typedef struct desc_t::stream::pin desc
 

Protected Member Functions

template<int channels>
pinattach (int **io[2], uint64_t channel_map[(channels+63)/64])
 
 catch (...)
 
 catchall_rethrow () void transmitted(os_result status
 
 catchall_rethrow () void received(os_result status
 
 catchall_rethrow () void transmitted(os_result status
 
virtual void exception (const dx::exception &exception) noexcept
 
virtual void exception (const dx::exception &exception) noexcept
 
pinflush () noexcept
 
 if (started &&!master) dx_pass(not_implemented)
 
 if (this->device.monitor()) this-> device.template monitor<>() ->performance[dx::stream::clock::monitor::isr][dx::stream::clock::monitor::rx]=circular->tx-circular->rx
 
 if (started) this-> receive(circular->data+((circular->tx+isoc.ahead)%circular->size), isoc.sequence,&this->tick[async.submit].frame->os_type, super::isoc.micro_frames)
 
 if (this->device.monitor()) this-> device.template monitor<>() ->performance[dx::stream::clock::monitor::isr][dx::stream::clock::monitor::tx]=circular->tx-circular->rx
 
pininitialize (unsigned int linesize, unsigned int cycles) try
 creates circular backing store and frame buffers for isoc streaming More...
 
 isoc_housekeeping (circular->tx, timestamp)
 
 operator circular_t * () const noexcept
 
circular_t * operator-> () const noexcept
 
catchall(started=0;) public pin (device_t &device, const dx::stream::open< bulk > &open, const desc &desc={})
 
 pin (device_t &device, const dx::stream::open< usb::isoc > &open, const typename desc_t::stream::pin_desc &desc={})
 
void received (os_result status, size_t size) override try
 virtual async callbacks More...
 
virtual void received (os_result, size_t, int64_t)
 
pinstart ()
 
pinstop (bool force=false)
 
void stop () noexcept
 
void thread () noexcept try
 streaming out thread More...
 
virtual void transmitted (os_result, size_t)
 
virtual void transmitted (os_result, size_t, int64_t)
 
virtual void transmitted (os_result, size_t)
 
virtual void transmitted (os_result, size_t, int64_t)
 
 ~pin () noexcept
 

Protected Attributes

device_t & device
 async write callback More...
 
interfaceinterface
 
::WINUSB_INTERFACE_HANDLE interface_handle
 
size_t size
 
size_t size override try
 
size_t int64_t timestamp override try
 

Private Member Functions

void initialize (unsigned int samplerate, unsigned line_size, unsigned int micro_frames)
 

Private Attributes

struct
dx::usb::audio::isoc::cycle::tick
tick = nullptr
 
unsigned int ticks = 0
 

Member Typedef Documentation

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
typedef struct desc_t::stream::pin dx::usb::stream::pin< desc_t, circular_t, device_t >::desc
protected

Member Enumeration Documentation

template<typename device_t = device>
enum dx::usb::pipe::type : unsigned char
stronginherited
Enumerator
control 
isoc 
bulk 
irq 
control 
isoc 
bulk 
irq 
template<typename device_t = device>
enum enum dx::usb::pipe::type pipe::type
stronginherited
Enumerator
control 
isoc 
bulk 
irq 
control 
isoc 
bulk 
irq 

Constructor & Destructor Documentation

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
catchall (started= 0;) public dx::usb::stream::pin< desc_t, circular_t, device_t >::pin ( device_t &  device,
const dx::stream::open< bulk > &  open,
const desc desc = {} 
)
inlineprotected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::pin ( device_t &  device,
const dx::stream::open< usb::isoc > &  open,
const typename desc_t::stream::pin_desc &  desc = {} 
)
inlineprotected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::~pin ( )
inlineprotectednoexcept

+ Here is the call graph for this function:

Member Function Documentation

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::abort ( )
inlineinherited
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::abort ( )
inlineinherited

+ Here is the caller graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
template<int channels>
pin& dx::usb::stream::pin< desc_t, circular_t, device_t >::attach ( int **  io[2],
uint64_t  channel_map[(channels+63)/64] 
)
inlineprotected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::catch (   ...)
inlineprotected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::catchall_rethrow ( )
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::catchall_rethrow ( )
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::catchall_rethrow ( )
protected
template<typename device_t = device>
dx::usb::pipe< device_t >::catchall_rethrow ( ) const
inlinenoexceptinherited

+ Here is the caller graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::clear ( )
inlineinherited
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::clear ( )
inlineinherited
template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::exception ( const dx::exception exception)
inlineprotectedvirtualnoexceptinherited
template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::exception ( const dx::exception exception)
inlineprotectedvirtualnoexceptinherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
pin& dx::usb::stream::pin< desc_t, circular_t, device_t >::flush ( )
inlineprotectednoexcept

+ Here is the call graph for this function:

template<typename device_t = device>
uint64_t dx::usb::pipe< device_t >::frame ( )
inlineinherited

+ Here is the call graph for this function:

template<typename device_t = device>
uint64_t dx::usb::pipe< device_t >::frame ( )
inlineinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::if ( started &&!  master)
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::if ( this->device.  monitor()) -> device.template monitor<>() ->performance[dx::stream::clock::monitor::isr][dx::stream::clock::monitor::rx]=circular->tx-circular->rx
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::if ( started  ) -> receive(circular->data+((circular->tx+isoc.ahead)%circular->size), isoc.sequence,&this->tick[async.submit].frame->os_type, super::isoc.micro_frames)
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::if ( this->device.  monitor()) -> device.template monitor<>() ->performance[dx::stream::clock::monitor::isr][dx::stream::clock::monitor::tx]=circular->tx-circular->rx
protected
template<typename device_t = device>
bool dx::usb::pipe< device_t >::in ( ) const
inlinenoexceptinherited

bus initializer (isoc, bulk, pci, etc.) compatibility

template<typename device_t = device>
bool dx::usb::pipe< device_t >::in ( ) const
inlinenoexceptinherited

bus initializer (isoc, bulk, pci, etc.) compatibility

+ Here is the caller graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::info ( )
inlinenoexceptinherited

< Bit D7 indicates a requirement for wMaxPacketSize packets.; D7: MaxPacketsOnly

< D1..0: Pitch Control; D3..2: Data Overrun Control; D5..4: Data Underrun Control; D7..6: Reserved. Must be set to 0.

< Indicates the units used for the wLockDelay field: 0: Undefined; 1: Milliseconds; 2: Decoded PCM samples; 3..255: Reserved

< Indicates the time it takes this endpoint to reliably lock its internal clock recovery circuitry. Units used depend on the value of the bLockDelayUnits field.

< Number of Embedded MIDI Jacks: n.

< ID of the n-th Embedded Jack that is associated with this endpoint.

+ Here is the call graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::info ( )
inlinenoexceptinherited

< Bit D7 indicates a requirement for wMaxPacketSize packets.; D7: MaxPacketsOnly

< D1..0: Pitch Control; D3..2: Data Overrun Control; D5..4: Data Underrun Control; D7..6: Reserved. Must be set to 0.

< Indicates the units used for the wLockDelay field: 0: Undefined; 1: Milliseconds; 2: Decoded PCM samples; 3..255: Reserved

< Indicates the time it takes this endpoint to reliably lock its internal clock recovery circuitry. Units used depend on the value of the bLockDelayUnits field.

< Number of Embedded MIDI Jacks: n.

< ID of the n-th Embedded Jack that is associated with this endpoint.

+ Here is the caller graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
pin& dx::usb::stream::pin< desc_t, circular_t, device_t >::initialize ( unsigned int  linesize,
unsigned int  cycles 
)
inlineprotected

creates circular backing store and frame buffers for isoc streaming

generates isoc cycle metrics from sample rate,

update max frame size

Todo:
reset max frame size when pipe is closed

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::isoc_housekeeping ( circular->  tx,
timestamp   
)
protected
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::max_frame_size ( unsigned int  frame_size)
inlineinherited
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::max_frame_size ( unsigned int  frame_size)
inlineinherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
dx::usb::stream::pin< desc_t, circular_t, device_t >::operator circular_t * ( ) const
inlineprotectednoexcept
dx::event< dx::kernel >::operator const os_event ( ) const
inlinenoexceptinherited
dx::event< dx::kernel >::operator os_event ( )
inlinenoexceptinherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
circular_t* dx::usb::stream::pin< desc_t, circular_t, device_t >::operator-> ( ) const
inlineprotectednoexcept
dx::event< dx::kernel >::operator::HANDLE ( )
inlinenoexceptinherited
template<typename device_t = device>
template<typename data_t >
pipe& dx::usb::pipe< device_t >::operator<< ( const data_t &  data)
inlineinherited

+ Here is the call graph for this function:

template<typename device_t = device>
template<typename data_t >
pipe& dx::usb::pipe< device_t >::operator<< ( const data_t &  data)
inlineinherited
template<typename device_t = device>
template<typename data_t >
pipe& dx::usb::pipe< device_t >::operator>> ( data_t &  data)
inlineinherited

+ Here is the call graph for this function:

template<typename device_t = device>
template<typename data_t >
pipe& dx::usb::pipe< device_t >::operator>> ( data_t &  data)
inlineinherited
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::read ( void *  data,
size_t  size 
)
inlineinherited

synchronous USB read request

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::read ( void *  data,
size_t  size 
)
inlineinherited

synchronous USB read request

+ Here is the caller graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::receive ( void *  data,
size_t  size 
)
inlineinherited

asynchronous USB read request

+ Here is the call graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::receive ( void *  data,
uint64_t sequence,
::USBD_ISO_PACKET_DESCRIPTOR *  frame,
int  frames = 1 
)
inlineinherited

asynchronous USB isoc read request

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::receive ( void *  data,
size_t  size 
)
inlineinherited

asynchronous USB read request

+ Here is the call graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::receive ( void *  data,
uint64_t sequence,
::IOUSBIsocFrame *  frame,
int  frames = 1 
)
inlineinherited

asynchronous USB isoc read request

+ Here is the call graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
void dx::usb::stream::pin< desc_t, circular_t, device_t >::received ( os_result  ,
size_t   
)
inlineoverrideprotectedvirtual

virtual async callbacks

Reimplemented from dx::usb::pipe< device_t >.

+ Here is the call graph for this function:

template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::received ( os_result  ,
size_t  ,
int64_t   
)
inlineprotectedvirtualinherited
void dx::event< dx::kernel >::reset ( )
inlineinherited
void dx::event< dx::kernel >::signal ( )
inlineinherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
pin& dx::usb::stream::pin< desc_t, circular_t, device_t >::start ( )
inlineprotected

estimate upcoming timestamp

Todo:
compute timestamp in ticks (not nsec)!

scheduling all but one isoc requests at least 1 sequence ahead; aligned to whole cycles,

+ Here is the call graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
pin& dx::usb::stream::pin< desc_t, circular_t, device_t >::stop ( bool  force = false)
inlineprotected

+ Here is the call graph for this function:

template<typename device_t = device>
void dx::usb::pipe< device_t >::stop ( )
inlineprotectednoexceptinherited

+ Here is the caller graph for this function:

template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
void dx::usb::stream::pin< desc_t, circular_t, device_t >::thread ( )
inlineprotectednoexcept

streaming out thread

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::transmit ( const void *  data,
size_t  size 
)
inlineinherited

asynchronous USB write request

+ Here is the call graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::transmit ( const void *  data,
uint64_t sequence,
::USBD_ISO_PACKET_DESCRIPTOR *  frame,
int  frames = 1 
)
inlineinherited

asynchronous USB isoc write request

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::transmit ( const void *  data,
size_t &  size 
)
inlineinherited

asynchronous USB write request

+ Here is the call graph for this function:

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::transmit ( const void *  data,
uint64_t sequence,
::IOUSBIsocFrame *  frame,
int  frames = 1 
)
inlineinherited

asynchronous USB isoc write request

+ Here is the call graph for this function:

template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::transmitted ( os_result  ,
size_t   
)
inlineprotectedvirtualinherited
template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::transmitted ( os_result  ,
size_t  ,
int64_t   
)
inlineprotectedvirtualinherited
template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::transmitted ( os_result  ,
size_t   
)
inlineprotectedvirtualinherited
template<typename device_t = device>
virtual void dx::usb::pipe< device_t >::transmitted ( os_result  ,
size_t  ,
int64_t   
)
inlineprotectedvirtualinherited
static void dx::event< dx::kernel >::wait ( ::HANDLE  handle,
int64_t  timeout = 0 
)
inlinestaticinherited

+ Here is the caller graph for this function:

void dx::event< dx::kernel >::wait ( int64_t  timeout = 0)
inlineinherited
template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::write ( const void *  data,
size_t  size 
)
inlineinherited

synchronous USB write request

template<typename device_t = device>
pipe& dx::usb::pipe< device_t >::write ( const void *  data,
size_t  size 
)
inlineinherited

synchronous USB write request

+ Here is the caller graph for this function:

Member Data Documentation

std::deque<union audio<>::descriptor::endpoint> dx::usb::_endpoint::audio
inherited
std::deque<union audio<>::descriptor::endpoint> dx::usb::__endpoint::audio
inherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
volatile unsigned int dx::usb::stream::pin< desc_t, circular_t, device_t >::completion
template<typename device_t = device>
device_t & pipe::device
protectedinherited

async write callback

template<typename device_t = device>
interface & pipe::interface
protectedinherited
template<typename device_t = device>
::WINUSB_INTERFACE_HANDLE dx::usb::pipe< device_t >::interface_handle
protectedinherited
template<typename device_t = device>
dx::log pipe::log {}
inherited
template<typename device_t = device>
unsigned int dx::usb::pipe< device_t >::micro_frames = 0
inherited
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
size_t dx::usb::stream::pin< desc_t, circular_t, device_t >::size
protected
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
unsigned int dx::usb::stream::pin< desc_t, circular_t, device_t >::submit
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
size_t int64_t timestamp override dx::usb::stream::pin< desc_t, circular_t, device_t >::try
protected
Initial value:
{
if(status || !size){
this->clear();
size= 0;
if(status)
this->exception ({status, __PRETTY_FUNCTION__, __FILE__, __LINE__});
}
async.completion= async.completion? async.completion- 1: ticks- 1
template<typename desc_t , typename circular_t = dx::circular, typename device_t = device<desc_t>>
size_t int64_t timestamp override dx::usb::stream::pin< desc_t, circular_t, device_t >::try
protected
Initial value:
{
if(started && status)
this->exception ({status, __PRETTY_FUNCTION__, __FILE__, __LINE__})
template<typename device_t = device>
enum dx::usb::pipe::type dx::usb::pipe< device_t >::type
inherited

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

(c) copyright 2009 dynamic acoustics e.U. generated on Wed Jun 17 2020

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.