dxd - dynax driver framework 2.1.0d73
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::circular Struct Reference

kernel/user space shared circular buffer More...

#include <dx_stream.h>

+ Inheritance diagram for dx::circular:
+ Collaboration diagram for dx::circular:

Classes

struct  channel
 copy/mix channel converters More...
 
struct  channel< dst_t, src_t, false, false, typename std::enable_if_t< std::is_floating_point_v< dst_t >==std::is_floating_point_v< src_t > > >
 
struct  channel< dst_t, src_t, false, true >
 
struct  channel< dst_t, src_t, true, false >
 
struct  channel< dst_t, src_t, up, dn, typename std::enable_if_t< std::is_floating_point_v< dst_t > &&!std::is_floating_point_v< src_t > > >
 
struct  channel< dst_t, src_t, up, dn, typename std::enable_if_t<!std::is_floating_point_v< dst_t > &&std::is_floating_point_v< src_t > > >
 
struct  format
 

Public Member Functions

uint64_t empty () const
 
uint64_t empty (uint64_t position) const
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > force_read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > force_read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
bool force_read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 multi channel interleaved bulk read from circular buffer with format conversion if applicable
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > force_read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
bool force_write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > force_write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename data_t >
bool force_write (data_t *const *const *src, uint64_t clients, uint64_t channels, uint64_t bulk)
 
template<typename circular_t , typename src_t >
bool force_write (src_t *const *const *src, uint32_t clients, uint32_t channels=1, uint64_t bulk=1)
 multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample]
 
template<typename ext_t , typename circular_t = ext_t>
bool force_write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 multi channel interleaved bulk write into circular buffer with format conversion if applicable
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > force_write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 single channel convenience access templates
 
void initialize ()
 
void initialize (uint64_t backingstore_size)
 
uint64_t loop () const
 
template<typename callback_t >
void move (callback_t &callback, uint64_t max)
 
template<typename data_t >
hide_if_ptr< data_t > operator<< (const data_t &src)
 
template<typename data_t >
hide_if_ptr< data_t > operator>> (data_t &dst)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename dst_t = uint8_t>
dst_t * simulate_read (uint64_t bulk=1)
 
template<typename dst_t = uint8_t>
dst_t * simulate_read (volatile uint64_t &position, uint64_t bulk)
 
uint8_tsimulate_write (uint64_t bulk)
 simulate write by advancing write idx and take care of wrap write optimization
 
uint64_t used () const
 
uint64_t used (uint64_t position) const
 
template<typename ext_t , typename circular_t = ext_t>
bool write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 
template<typename ext_t , typename circular_t = ext_t>
bool write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 bulk write into circular buffer with format conversion if applicable
 
template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1)
 

Public Attributes

struct { 
 
   volatile uint64_t   count 
 cycle counter More...
 
   volatile uint64_t   reference 
 sample reference of taken timestamp More...
 
   volatile uint64_t   size 
 cycle length in bytes (each cycle length bytes a new timestamp is generated) More...
 
   volatile int64_t   timestamp 
 timestamp of current timestamp cycle More...
 
cycle 
 
uint8_t data [1]
 
volatile uint64_t dropout
 dropout counter
 
volatile uint64_t rx
 single consumers current read index
 
uint64_t size
 size of buffer in bytes
 
volatile int64_t timestamp
 current rx/tx timestamp
 
volatile uint64_t tx
 producers current write index
 

Static Public Attributes

static constexpr format any = {}
 
static constexpr format audio = {.audio= true,}
 
static constexpr format float32 = {.audio= true, .real=true, .resolution= 32, .size= sizeof(float),}
 
static constexpr format float64 = {.audio= true, .real=true, .resolution= 64, .size= sizeof(double),}
 
static constexpr format invalid = {}
 
static constexpr format midi = {.midi= true,}
 
static constexpr format pcm16 = {.audio= true, .resolution= 16, .size= sizeof(int16_t),}
 
static constexpr format pcm24 = {.audio= true, .resolution= 24, .size= sizeof(dx::int24),}
 
static constexpr format pcm24in32hi = {.audio= true, .resolution= 24, .size= sizeof(int32_t),}
 
static constexpr format pcm24in32lo = {.audio= true, .resolution= 24, .size= sizeof(int32_t), .alignment= format::alignment::low,}
 
static constexpr format pcm32 = {.audio= true, .resolution= 32, .size= sizeof(int32_t),}
 

Detailed Description

kernel/user space shared circular buffer

this buffer is non-blocking for single-consumer/single-producer configurations; multiple producer write interleaved while obtaining shadow.tx; if shadow.tx== tx the producer is allowed to write into the buffer after advancing shadow.tx to the final tx position; once tx reaches shadow.tx the write is terminated and the producer can start a write cycle. multiple consumer each hold there own rx and read between rx and cycle.tx.

Member Function Documentation

◆ empty() [1/2]

uint64_t dx::circular::empty ( ) const
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty() [2/2]

uint64_t dx::circular::empty ( uint64_t position) const
inline
+ Here is the call graph for this function:

◆ force_read() [1/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::force_read ( ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ force_read() [2/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::force_read ( ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ force_read() [3/4]

template<typename ext_t , typename circular_t = ext_t>
bool dx::circular::force_read ( volatile uint64_t & position,
ext_t *const * dst,
uint64_t bulk,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

multi channel interleaved bulk read from circular buffer with format conversion if applicable

return true if enough data is available in circular space

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ force_read() [4/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::force_read ( volatile uint64_t & position,
ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ force_write() [1/6]

template<typename ext_t , typename circular_t = ext_t>
bool dx::circular::force_write ( const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ force_write() [2/6]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::force_write ( const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ force_write() [3/6]

template<typename data_t >
bool dx::circular::force_write ( data_t *const *const * src,
uint64_t clients,
uint64_t channels,
uint64_t bulk )
inline

◆ force_write() [4/6]

template<typename circular_t , typename src_t >
bool dx::circular::force_write ( src_t *const *const * src,
uint32_t clients,
uint32_t channels = 1,
uint64_t bulk = 1 )
inline

multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample]

return true if data fit into empty space

◆ force_write() [5/6]

template<typename ext_t , typename circular_t = ext_t>
bool dx::circular::force_write ( volatile uint64_t & position,
const ext_t *const * src,
uint64_t bulk,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

multi channel interleaved bulk write into circular buffer with format conversion if applicable

return true if data fit into circular space false if data fit not or older data had to be overwritten

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ force_write() [6/6]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::force_write ( volatile uint64_t & position,
const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

single channel convenience access templates

◆ initialize() [1/2]

void dx::circular::initialize ( )
inline

◆ initialize() [2/2]

void dx::circular::initialize ( uint64_t backingstore_size)
inline
+ Here is the caller graph for this function:

◆ loop()

uint64_t dx::circular::loop ( ) const
inline

◆ move()

template<typename callback_t >
void dx::circular::move ( callback_t & callback,
uint64_t max )
inline
+ Here is the call graph for this function:

◆ operator<<()

template<typename data_t >
hide_if_ptr< data_t > dx::circular::operator<< ( const data_t & src)
inline

◆ operator>>()

template<typename data_t >
hide_if_ptr< data_t > dx::circular::operator>> ( data_t & dst)
inline

◆ read() [1/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::read ( ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline
+ Here is the call graph for this function:

◆ read() [2/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::read ( ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ read() [3/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::read ( volatile uint64_t & position,
ext_t *const * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_dst = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read() [4/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::read ( volatile uint64_t & position,
ext_t * dst,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ simulate_read() [1/2]

template<typename dst_t = uint8_t>
dst_t * dx::circular::simulate_read ( uint64_t bulk = 1)
inline

◆ simulate_read() [2/2]

template<typename dst_t = uint8_t>
dst_t * dx::circular::simulate_read ( volatile uint64_t & position,
uint64_t bulk )
inline
+ Here is the call graph for this function:

◆ simulate_write()

uint8_t * dx::circular::simulate_write ( uint64_t bulk)
inline

simulate write by advancing write idx and take care of wrap write optimization

+ Here is the caller graph for this function:

◆ used() [1/2]

uint64_t dx::circular::used ( ) const
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ used() [2/2]

uint64_t dx::circular::used ( uint64_t position) const
inline
+ Here is the call graph for this function:

◆ write() [1/4]

template<typename ext_t , typename circular_t = ext_t>
bool dx::circular::write ( const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline
+ Here is the call graph for this function:

◆ write() [2/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::write ( const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

◆ write() [3/4]

template<typename ext_t , typename circular_t = ext_t>
bool dx::circular::write ( volatile uint64_t & position,
const ext_t *const * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t channels_src = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

bulk write into circular buffer with format conversion if applicable

return true if data fit into empty space

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write() [4/4]

template<typename ext_t , typename circular_t = ext_t>
hide_if_ptr< ext_t > dx::circular::write ( volatile uint64_t & position,
const ext_t * src,
uint64_t bulk = 1,
uint32_t channels_circular = 1,
uint32_t circular_offset = 0,
uint32_t interleaved = 1 )
inline

Member Data Documentation

◆ any

constexpr format dx::circular::any = {}
staticconstexpr

◆ audio

constexpr format dx::circular::audio = {.audio= true,}
staticconstexpr

◆ count

volatile uint64_t dx::circular::count

cycle counter

◆ [struct]

struct { ... } dx::circular::cycle

◆ data

uint8_t dx::circular::data[1]

◆ dropout

volatile uint64_t dx::circular::dropout

dropout counter

◆ float32

constexpr format dx::circular::float32 = {.audio= true, .real=true, .resolution= 32, .size= sizeof(float),}
staticconstexpr

◆ float64

constexpr format dx::circular::float64 = {.audio= true, .real=true, .resolution= 64, .size= sizeof(double),}
staticconstexpr

◆ invalid

constexpr format dx::circular::invalid = {}
staticconstexpr

◆ midi

constexpr format dx::circular::midi = {.midi= true,}
staticconstexpr

◆ pcm16

constexpr format dx::circular::pcm16 = {.audio= true, .resolution= 16, .size= sizeof(int16_t),}
staticconstexpr

◆ pcm24

constexpr format dx::circular::pcm24 = {.audio= true, .resolution= 24, .size= sizeof(dx::int24),}
staticconstexpr

◆ pcm24in32hi

constexpr format dx::circular::pcm24in32hi = {.audio= true, .resolution= 24, .size= sizeof(int32_t),}
staticconstexpr

◆ pcm24in32lo

constexpr format dx::circular::pcm24in32lo = {.audio= true, .resolution= 24, .size= sizeof(int32_t), .alignment= format::alignment::low,}
staticconstexpr

◆ pcm32

constexpr format dx::circular::pcm32 = {.audio= true, .resolution= 32, .size= sizeof(int32_t),}
staticconstexpr

◆ reference

volatile uint64_t dx::circular::reference

sample reference of taken timestamp

◆ rx

volatile uint64_t dx::circular::rx

single consumers current read index

◆ size [1/2]

uint64_t dx::circular::size

size of buffer in bytes

◆ size [2/2]

volatile uint64_t dx::circular::size

cycle length in bytes (each cycle length bytes a new timestamp is generated)

◆ timestamp

volatile int64_t dx::circular::timestamp

current rx/tx timestamp

timestamp of current timestamp cycle

◆ tx

volatile uint64_t dx::circular::tx

producers current write index


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

(c) copyright 2009 dynamic acoustics e.U. generated on Fri Nov 15 2024

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.