Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
iio.h File Reference
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/iio/types.h>

Go to the source code of this file.

Data Structures

struct  iio_chan_spec_ext_info
 
struct  iio_enum
 
struct  iio_chan_spec
 
struct  iio_info
 
struct  iio_buffer_setup_ops
 
struct  iio_dev
 

Macros

#define IIO_CHAN_INFO_SHARED_BIT(type)   BIT(type*2)
 
#define IIO_CHAN_INFO_SEPARATE_BIT(type)   BIT(type*2 + 1)
 
#define IIO_CHAN_INFO_BITS(type)
 
#define IIO_CHAN_INFO_RAW_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
 
#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
 
#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
 
#define IIO_CHAN_INFO_SCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
 
#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
 
#define IIO_CHAN_INFO_OFFSET_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
 
#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
 
#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
 
#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
 
#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
 
#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
 
#define IIO_CHAN_INFO_PEAK_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
 
#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
 
#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
 
#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT
 
#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT
 
#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
 
#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
 
#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT
 
#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT
 
#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
 
#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
 
#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
 
#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
 
#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
 
#define IIO_CHAN_INFO_PHASE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
 
#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
 
#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
 
#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)
 
#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)
 
#define IIO_MAX_GROUPS   6
 

Enumerations

enum  iio_chan_info_enum {
  IIO_CHAN_INFO_RAW = 0, IIO_CHAN_INFO_PROCESSED, IIO_CHAN_INFO_SCALE, IIO_CHAN_INFO_OFFSET,
  IIO_CHAN_INFO_CALIBSCALE, IIO_CHAN_INFO_CALIBBIAS, IIO_CHAN_INFO_PEAK, IIO_CHAN_INFO_PEAK_SCALE,
  IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW, IIO_CHAN_INFO_AVERAGE_RAW, IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY, IIO_CHAN_INFO_SAMP_FREQ,
  IIO_CHAN_INFO_FREQUENCY, IIO_CHAN_INFO_PHASE, IIO_CHAN_INFO_HARDWAREGAIN, IIO_CHAN_INFO_HYSTERESIS
}
 
enum  iio_endian { IIO_CPU, IIO_BE, IIO_LE }
 

: Info attribute name

struct iio_chan_spec_ext_info - Extended channel info attribute

: Whether this attribute is shared between all channels. : Read callback for this info attribute, may be NULL. : Write callback for this info attribute, may be NULL. : Data private to the driver.

#define IIO_ENUM(_name, _shared, _e)
 
#define IIO_ENUM_AVAILABLE(_name, _e)
 
#define IIO_ST(si, rb, sb, sh)   { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
 
#define IIO_CHAN_SOFT_TIMESTAMP(_si)
 
#define INDIO_DIRECT_MODE   0x01
 
#define INDIO_BUFFER_TRIGGERED   0x02
 
#define INDIO_BUFFER_HARDWARE   0x08
 
#define INDIO_ALL_BUFFER_MODES   (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
 
ssize_t iio_enum_available_read (struct iio_dev *indio_dev, uintptr_t priv, const struct iio_chan_spec *chan, char *buf)
 
ssize_t iio_enum_read (struct iio_dev *indio_dev, uintptr_t priv, const struct iio_chan_spec *chan, char *buf)
 
ssize_t iio_enum_write (struct iio_dev *indio_dev, uintptr_t priv, const struct iio_chan_spec *chan, const char *buf, size_t len)
 

: [DRIVER] name of the device.

struct iio_dev - industrial I/O device : [INTERN] used to identify device internally : [DRIVER] operating modes supported by device : [DRIVER] current operating mode : [DRIVER] device structure, should be assigned a parent and owner : [INTERN] event chrdevs associated with interrupt lines : [DRIVER] any buffer present : [INTERN] num bytes captured to be fed to buffer demux : [INTERN] lock used to prevent simultaneous device state changes : [DRIVER] optional array of allowed bitmasks : [INTERN] the length of the mask established from channels : [INTERN] union of all scan masks requested by buffers : [INTERN] set if any buffers have requested timestamp :[INTERN] cache of the index to the timestamp : [INTERN] current device trigger (buffer modes) : [DRIVER] function run on trigger being received : [DRIVER] channel specification structure table : [DRIVER] number of channels specified in . : [INTERN] keep track of automatically created channel attributes : [INTERN] group for all attrs in base directory

: [DRIVER] callbacks and constant info from driver : [INTERN] lock to prevent use during removal : [DRIVER] callbacks to call before and after buffer enable/disable : [INTERN] associated character device : [INTERN] attribute groups : [INTERN] index of next attribute group : [INTERN] file ops related flags including busy flag. : [INTERN] device specific debugfs dentry. : [INTERN] cached register address for debugfs reads.

#define IIO_ALIGN   L1_CACHE_BYTES
 
#define IIO_DEGREE_TO_RAD(deg)   (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
 
#define IIO_G_TO_M_S_2(g)   ((g) * 980665ULL / 100000ULL)
 
struct bus_type iio_bus_type
 
struct iio_chan_speciio_find_channel_from_si (struct iio_dev *indio_dev, int si)
 
int iio_device_register (struct iio_dev *indio_dev)
 
void iio_device_unregister (struct iio_dev *indio_dev)
 
int iio_push_event (struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
 
struct iio_deviio_device_alloc (int sizeof_priv)
 
void iio_device_free (struct iio_dev *indio_dev)
 

Macro Definition Documentation

#define IIO_ALIGN   L1_CACHE_BYTES

Definition at line 571 of file iio.h.

#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)

Definition at line 80 of file iio.h.

#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)

Definition at line 82 of file iio.h.

#define IIO_CHAN_INFO_BITS (   type)
Value:
IIO_CHAN_INFO_SEPARATE_BIT(type))

Definition at line 43 of file iio.h.

#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)

Definition at line 62 of file iio.h.

#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)

Definition at line 64 of file iio.h.

#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)

Definition at line 58 of file iio.h.

#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)

Definition at line 60 of file iio.h.

#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)

Definition at line 94 of file iio.h.

#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)

Definition at line 96 of file iio.h.

#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)

Definition at line 102 of file iio.h.

#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)

Definition at line 104 of file iio.h.

#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)

Definition at line 106 of file iio.h.

#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)

Definition at line 108 of file iio.h.

#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT
#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT
#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)

Definition at line 54 of file iio.h.

#define IIO_CHAN_INFO_OFFSET_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)

Definition at line 56 of file iio.h.

#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)

Definition at line 66 of file iio.h.

#define IIO_CHAN_INFO_PEAK_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)

Definition at line 68 of file iio.h.

#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)

Definition at line 70 of file iio.h.

#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)

Definition at line 72 of file iio.h.

#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)

Definition at line 98 of file iio.h.

#define IIO_CHAN_INFO_PHASE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)

Definition at line 100 of file iio.h.

#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)

Definition at line 48 of file iio.h.

#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT
#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT
#define IIO_CHAN_INFO_RAW_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)

Definition at line 46 of file iio.h.

#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)

Definition at line 90 of file iio.h.

#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)

Definition at line 92 of file iio.h.

#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT   IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)

Definition at line 50 of file iio.h.

#define IIO_CHAN_INFO_SCALE_SHARED_BIT   IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)

Definition at line 52 of file iio.h.

#define IIO_CHAN_INFO_SEPARATE_BIT (   type)    BIT(type*2 + 1)

Definition at line 42 of file iio.h.

#define IIO_CHAN_INFO_SHARED_BIT (   type)    BIT(type*2)

Definition at line 41 of file iio.h.

#define IIO_CHAN_SOFT_TIMESTAMP (   _si)
Value:
{ .type = IIO_TIMESTAMP, .channel = -1, \
.scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }

Definition at line 284 of file iio.h.

#define IIO_DEGREE_TO_RAD (   deg)    (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)

IIO_DEGREE_TO_RAD() - Convert degree to rad : A value in degree

Returns the given value converted from degree to rad

Definition at line 627 of file iio.h.

#define IIO_ENUM (   _name,
  _shared,
  _e 
)
Value:
{ \
.name = (_name), \
.shared = (_shared), \
.read = iio_enum_read, \
.write = iio_enum_write, \
.private = (uintptr_t)(_e), \
}

IIO_ENUM() - Initialize enum extended channel attribute : Attribute name : Whether the attribute is shared between all channels : Pointer to an iio_enum struct

This should usually be used together with IIO_ENUM_AVAILABLE()

Definition at line 178 of file iio.h.

#define IIO_ENUM_AVAILABLE (   _name,
  _e 
)
Value:
{ \
.name = (_name "_available"), \
.shared = true, \
.private = (uintptr_t)(_e), \
}

IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute : Attribute name ("_available" will be appended to the name) : Pointer to an iio_enum struct

Creates a read only attribute which lists all the available enum items in a space separated list. This should usually be used together with IIO_ENUM()

Definition at line 195 of file iio.h.

#define IIO_G_TO_M_S_2 (   g)    ((g) * 980665ULL / 100000ULL)

IIO_G_TO_M_S_2() - Convert g to meter / second**2 : A value in g

Returns the given value converted from g to meter / second**2

Definition at line 635 of file iio.h.

#define IIO_MAX_GROUPS   6

Definition at line 472 of file iio.h.

#define IIO_ST (   si,
  rb,
  sb,
  sh 
)    { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }

Definition at line 281 of file iio.h.

#define INDIO_ALL_BUFFER_MODES   (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)

Definition at line 308 of file iio.h.

#define INDIO_BUFFER_HARDWARE   0x08

Definition at line 306 of file iio.h.

#define INDIO_BUFFER_TRIGGERED   0x02

Definition at line 305 of file iio.h.

#define INDIO_DIRECT_MODE   0x01

Definition at line 304 of file iio.h.

Enumeration Type Documentation

Enumerator:
IIO_CHAN_INFO_RAW 
IIO_CHAN_INFO_PROCESSED 
IIO_CHAN_INFO_SCALE 
IIO_CHAN_INFO_OFFSET 
IIO_CHAN_INFO_CALIBSCALE 
IIO_CHAN_INFO_CALIBBIAS 
IIO_CHAN_INFO_PEAK 
IIO_CHAN_INFO_PEAK_SCALE 
IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW 
IIO_CHAN_INFO_AVERAGE_RAW 
IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY 
IIO_CHAN_INFO_SAMP_FREQ 
IIO_CHAN_INFO_FREQUENCY 
IIO_CHAN_INFO_PHASE 
IIO_CHAN_INFO_HARDWAREGAIN 
IIO_CHAN_INFO_HYSTERESIS 

Definition at line 22 of file iio.h.

enum iio_endian
Enumerator:
IIO_CPU 
IIO_BE 
IIO_LE 

Definition at line 111 of file iio.h.

Function Documentation

struct iio_dev* iio_device_alloc ( int  sizeof_priv)
read

iio_device_alloc() - allocate an iio_dev from a driver : Space to allocate for private structure.

Definition at line 821 of file industrialio-core.c.

void iio_device_free ( struct iio_dev indio_dev)

iio_device_free() - free an iio_dev from a driver : the iio_dev associated with the device

Definition at line 860 of file industrialio-core.c.

int iio_device_register ( struct iio_dev indio_dev)

iio_device_register() - register a device with the IIO subsystem : Device structure filled by the device driver

Definition at line 924 of file industrialio-core.c.

void iio_device_unregister ( struct iio_dev indio_dev)

iio_device_unregister() - unregister a device from the IIO subsystem : Device structure representing the device.

Definition at line 979 of file industrialio-core.c.

ssize_t iio_enum_available_read ( struct iio_dev indio_dev,
uintptr_t  priv,
const struct iio_chan_spec chan,
char buf 
)

Definition at line 300 of file industrialio-core.c.

ssize_t iio_enum_read ( struct iio_dev indio_dev,
uintptr_t  priv,
const struct iio_chan_spec chan,
char buf 
)

Definition at line 320 of file industrialio-core.c.

ssize_t iio_enum_write ( struct iio_dev indio_dev,
uintptr_t  priv,
const struct iio_chan_spec chan,
const char buf,
size_t  len 
)

Definition at line 339 of file industrialio-core.c.

struct iio_chan_spec* iio_find_channel_from_si ( struct iio_dev indio_dev,
int  si 
)
read

iio_find_channel_from_si() - get channel from its scan index : device : scan index to match

Definition at line 106 of file industrialio-core.c.

int iio_push_event ( struct iio_dev indio_dev,
u64  ev_code,
s64  timestamp 
)

iio_push_event() - try to add event to the list for userspace reading : IIO device structure : What event : When the event occurred

Definition at line 45 of file industrialio-event.c.

Variable Documentation

struct bus_type iio_bus_type

Definition at line 38 of file industrialio-core.c.