18 #ifndef IIOTHREADED_H_ 19 #define IIOTHREADED_H_ 31 Eigen::Array<unsigned short int, Eigen::Dynamic, Eigen::Dynamic> *
fullBuffer;
37 struct timespec lockStart, lockStop;
42 if( clock_gettime( CLOCK_REALTIME, &lockStart) == -1 ) {
43 cout<<
"clock lockStart get time error"<<endl;
59 if( clock_gettime( CLOCK_REALTIME, &lockStop) == -1 ) {
60 cout<<
"clock lockStop get time error"<<endl;
62 double duration = 1.e3*( lockStop.tv_sec - lockStart.tv_sec ) + (
double)( lockStop.tv_nsec - lockStart.tv_nsec )/1.e6;
63 cout<<
"thread duration = "<<duration<<
'\n';
69 cout<<
"IIO read thread stopped due to error"<<endl;
85 buffers.
add(
new Eigen::Array<unsigned short int, Eigen::Dynamic, Eigen::Dynamic>);
92 for (
int i=0; i<buffers.
getCount(); i++) {
95 int cols=(int)ceil((
float)ch/(float)
operator[](0).getChCnt());
96 if (cols<buffers.
current()->cols())
122 cout<<
"IIOThreaded :: there are "<<buffers.
getCount()<<
" buffers."<<endl;
123 for (
int i=0; i<buffers.
getCount(); i++)
124 cout<<
"\tbuffer "<<i<<
" has "<<buffers.
grab(i+1)->cols()<<
" channels with N="<<buffers.
grab(i+1)->rows()<<endl;
130 Eigen::Array<unsigned short int, Eigen::Dynamic, Eigen::Dynamic> *
getFullBuffer() {
146 #endif // IIOTHREADED_H_ bool bufFull
Indicates when the read has completed and a buffer is full.
Eigen::Array< unsigned short int, Eigen::Dynamic, Eigen::Dynamic > * getFullBuffer()
TYPE current(void)
return a pointer to the current lug
int setSampleCountChannelCount(uint N, uint ch)
TYPE grab(int i)
returns the i'th lug in the chain irrespective of direction
virtual int evaluateError(int errorNum)
int getReadArraySampleCount(Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
#define NO_ERROR
There is no error.
int read(uint N, const Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
The iio_channel_info structure is external.
TYPE remove(void)
remove the current lug from the LinkList The current lug is removed form the list and passed back to ...
TYPE next(void)
Return a pointer to the next lug and move on to that lug Increments according to dir (either forward ...
int getReadArray(uint N, Eigen::Array< TYPE, Eigen::Dynamic, Eigen::Dynamic > &array)
Eigen::Array< unsigned short int, Eigen::Dynamic, Eigen::Dynamic > * fullBuffer
int resizeBuffers(int N, int ch)
void add(TYPE newElement)
Adds as the current element ... Added to the next of the current lug.
#define IIODEVICE_RESIZEBUF_NEW_ERROR
One of the devices has a different buffer size to the other devices.
LinkList< Eigen::Array< unsigned short int, Eigen::Dynamic, Eigen::Dynamic > * > buffers
The load and unload buffers.