25 #define IIO_BAD_DEVICE_NAME_ERROR IIO_ERROR_OFFSET-1 26 #define IIO_BAD_DEVICE_TRIGGER_ERROR IIO_ERROR_OFFSET-2 27 #define IIO_BAD_CH_ARRAY_ERROR IIO_ERROR_OFFSET-3 28 #define IIODEVICE_FILE_OPEN_ERROR IIO_ERROR_OFFSET-4 29 #define IIODEVICE_NOCHANNELS_ERROR IIO_ERROR_OFFSET-5 30 #define IIODEVICE_READANDWRITE_ERROR IIO_ERROR_OFFSET-6 31 #define IIODEVICE_WRITEABLE_ERROR IIO_ERROR_OFFSET-7 32 #define IIODEVICE_OPEN_ERROR IIO_ERROR_OFFSET-8 33 #define IIODEVICE_FRAEMSIZE_MISMATCH_ERROR IIO_ERROR_OFFSET-9 34 #define IIO_FRAEMSIZE_MISMATCH_ERROR IIO_ERROR_OFFSET-9 35 #define IIO_NODEVICES_ERROR IIO_ERROR_OFFSET-10 36 #define IIO_ARRAY_FRAME_MISMATCH_ERROR IIO_ERROR_OFFSET-11 37 #define IIO_ARRAY_SIZE_MISMATCH_ERROR IIO_ERROR_OFFSET-12 38 #define IIODEVICE_READ_ERROR IIO_ERROR_OFFSET-13 39 #define IIODEVICE_ENABLEFILE_ERROR IIO_ERROR_OFFSET-14 40 #define IIODEVICE_LENGTHFILE_ERROR IIO_ERROR_OFFSET-15 41 #define IIODEVICE_CHBUFCNT_ERROR IIO_ERROR_OFFSET-16 42 #define IIODEVICE_RESIZEBUF_NEW_ERROR IIO_ERROR_OFFSET-17 43 #define IIOMMAP_ALLOCATE_ERROR IIO_ERROR_OFFSET-18 44 #define IIOMMAP_QUERY_ERROR IIO_ERROR_OFFSET-19 45 #define IIOMMAP_MMAP_ERROR IIO_ERROR_OFFSET-20 46 #define IIOMMAP_ENQUEUE_ERROR IIO_ERROR_OFFSET-21 47 #define IIOMMAP_NOINIT_ERROR IIO_ERROR_OFFSET-22 48 #define IIOMMAP_WRONGOPEN_ERROR IIO_ERROR_OFFSET-23 49 #define IIOMMAP_BLOCK_SIZE_MISMATCH_ERROR IIO_ERROR_OFFSET-24 72 errors[
IIO_FRAEMSIZE_MISMATCH_ERROR]=std::string(
"The device's channels have different word lengths, not able to handle this functionality YET!, please expand functionality. ");
79 errors[
IIODEVICE_CHBUFCNT_ERROR]=std::string(
"Error one (or more) of the devices has a different DMA buffer size to the rest of the devices. The size is in the buffer/length file on the iio file system and should have the same size and channel count for all devices.");
82 errors[
IIOMMAP_QUERY_ERROR]=std::string(
"Error query ioctl for the allocated memory buffer. Did you allocate them using ioctl first ? ");
86 errors[
IIOMMAP_WRONGOPEN_ERROR]=std::string(
"Error when using MMAP, you must use the IIOMMap::open(int) method, noth the IIOMMap::open() method. ");
115 std::ifstream inputF((scanPath+
"/"+chName+
"_index").c_str());
123 std::stringstream typeInfo;
124 inputF.open((scanPath+
"/"+chName+
"_type").c_str());
127 typeInfo << inputF.rdbuf();
130 std::string token(10,
'\0');
131 typeInfo.getline((
char*)token.c_str(), 10,
':');
132 if (token.find(
"le")!=std::string::npos)
135 char signedChar, slash;
136 typeInfo>>signedChar>>bitCnt>>slash>>deviceBitCnt>>slash>>slash>>bitShiftCnt;
143 std::cout<<
"Name\t\t"<<chName<<std::endl;
144 std::cout<<
"Generic name\t"<<chGenericName<<std::endl;
146 std::cout<<
"Index\t\t"<<index<<std::endl;
148 std::cout<<
"signed, ";
150 std::cout<<
"unsigned, ";
152 std::cout<<
"little endian"<<std::endl;
154 std::cout<<
"big endian"<<std::endl;
155 std::cout<<
"This channel has "<<bitCnt<<
" bits, which require shifting down by "<<bitShiftCnt<<
" bits."<<std::endl;
156 std::cout<<
"This device has "<<deviceBitCnt<<
" bits in one frame of DMA data shifting."<<std::endl;
163 if (chGenericName.find(
"in")!=std::string::npos)
169 #endif // IIOCHANNEL_H_
#define IIOMMAP_ALLOCATE_ERROR
Couldn't allocate the iio memory buffers in the kernel using ioctl.
#define IIODEVICE_FILE_OPEN_ERROR
Error when trying to open an IIODevice subdirectory file.
#define IIODEVICE_OPEN_ERROR
Couldn't open the device.
#define IIOMMAP_WRONGOPEN_ERROR
The wrong open method was called.
#define IIO_FRAEMSIZE_MISMATCH_ERROR
The channel frame sizes differ between devices.
#define IIO_BAD_DEVICE_TRIGGER_ERROR
Error when the specified trigger doesn't exist.
#define IIOMMAP_NOINIT_ERROR
The MMapedBlocks system is not initialised.
bool isSigned
Indicates whether the data is signed or unsigned.
#define IIO_BAD_DEVICE_NAME_ERROR
Error when the specified device name is bad or can't be found.
bool isLittleEndian
Indicates whether the channel is little endian.
#define IIOMMAP_QUERY_ERROR
Couldn't query the iio device for allocated kernel memory.
std::string chName
The name of each of the enabled channels.
std::map< int, std::string > errors
This will contain a map between error numbers and descriptive std::strings for the errors...
#define NO_ERROR
There is no error.
#define IIODEVICE_ENABLEFILE_ERROR
There was an error when trying to open the buffer enable file.
uint bitShiftCnt
The number of bits to shift the channel word down by to get a proper reading.
#define IIODEVICE_CHBUFCNT_ERROR
One of the devices has a different buffer size to the other devices.
#define IIODEVICE_READ_ERROR
There was an error whilst reading from a device.
#define IIODEVICE_READANDWRITE_ERROR
Don't know how to hbandle read and write yet.
#define IIO_ARRAY_FRAME_MISMATCH_ERROR
The sample type of the provided array doesn't match the sample type of the devices.
uint deviceBitCnt
The number of bits in one device word - this is all the channels combined into a device frame...
std::string chGenericName
The generic name of each of the enabled channels.
unsigned int index
The index in the interleaved stream.
#define IIODEVICE_WRITEABLE_ERROR
Don't know how to write yet.
#define IIO_ARRAY_SIZE_MISMATCH_ERROR
The provided array doesn't match the number of channels and requested samples.
#define IIOMMAP_ENQUEUE_ERROR
Couldn't enqueue the mmaped block.
int scanElements(std::string scanPath, uint cIndex)
#define IIOMMAP_BLOCK_SIZE_MISMATCH_ERROR
The user and mmaped block sizes don't match.
#define IIO_NODEVICES_ERROR
There are no devices.
uint bitCnt
The number of bits in one word of data for one channel.
#define IIODEVICE_NOCHANNELS_ERROR
Error when trying to open the device, but the channels aren't initialised.
#define IIODEVICE_RESIZEBUF_NEW_ERROR
One of the devices has a different buffer size to the other devices.
#define IIO_BAD_CH_ARRAY_ERROR
Error when the channel array can't be built or populated.
#define IIOMMAP_MMAP_ERROR
Couldn't execute mmap.
unsigned int uint
The uint type definition.
#define IIODEVICE_FRAEMSIZE_MISMATCH_ERROR
The frame sizes differ between channels on one device.
#define IIODEVICE_LENGTHFILE_ERROR
There was an error when trying to open the buffer length file.