Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
iio_utils.h File Reference
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <stdint.h>
#include <dirent.h>
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  iio_channel_info
 

Macros

#define IIO_MAX_NAME_LENGTH   30
 
#define FORMAT_SCAN_ELEMENTS_DIR   "%s/scan_elements"
 
#define FORMAT_TYPE_FILE   "%s_type"
 

Functions

int iioutils_break_up_name (const char *full_name, char **generic_name)
 
: the channel name

iioutils_get_type() - find and process _type attribute data : output whether channel is signed : output how many bytes the channel storage occupies : output a bit mask for the raw data : big endian : the iio device directory

: the channel type name

int iioutils_get_type (unsigned *is_signed, unsigned *bytes, unsigned *bits_used, unsigned *shift, uint64_t *mask, unsigned *be, const char *device_dir, const char *name, const char *generic_name)
 
int iioutils_get_param_float (float *output, const char *param_name, const char *device_dir, const char *name, const char *generic_name)
 
void bsort_channel_array_by_index (struct iio_channel_info **ci_array, int cnt)
 
int build_channel_array (const char *device_dir, struct iio_channel_info **ci_array, int *counter)
 
: top level type instance name

find_type_by_name() - function to match top level types by name

: the type of top level instance being sort

Typical types this is used for are device and trigger.

int find_type_by_name (const char *name, const char *type)
 
int _write_sysfs_int (char *filename, char *basedir, int val, int verify)
 
int write_sysfs_int (char *filename, char *basedir, int val)
 
int write_sysfs_int_and_verify (char *filename, char *basedir, int val)
 
int _write_sysfs_string (char *filename, char *basedir, char *val, int verify)
 
int write_sysfs_string_and_verify (char *filename, char *basedir, char *val)
 
int write_sysfs_string (char *filename, char *basedir, char *val)
 
int read_sysfs_posint (char *filename, char *basedir)
 
int read_sysfs_float (char *filename, char *basedir, float *val)
 

Variables

const chariio_dir = "/sys/bus/iio/devices/"
 

Macro Definition Documentation

#define FORMAT_SCAN_ELEMENTS_DIR   "%s/scan_elements"

Definition at line 21 of file iio_utils.h.

#define FORMAT_TYPE_FILE   "%s_type"

Definition at line 22 of file iio_utils.h.

#define IIO_MAX_NAME_LENGTH   30

Definition at line 19 of file iio_utils.h.

Function Documentation

int _write_sysfs_int ( char filename,
char basedir,
int  val,
int  verify 
)
inline

Definition at line 503 of file iio_utils.h.

int _write_sysfs_string ( char filename,
char basedir,
char val,
int  verify 
)

Definition at line 552 of file iio_utils.h.

void bsort_channel_array_by_index ( struct iio_channel_info **  ci_array,
int  cnt 
)
inline

bsort_channel_array_by_index() - reorder so that the array is in index order

Definition at line 262 of file iio_utils.h.

int build_channel_array ( const char device_dir,
struct iio_channel_info **  ci_array,
int counter 
)
inline

build_channel_array() - function to figure out what channels are present : the IIO device directory in sysfs @

Definition at line 283 of file iio_utils.h.

int find_type_by_name ( const char name,
const char type 
)
inline

Definition at line 444 of file iio_utils.h.

int iioutils_break_up_name ( const char full_name,
char **  generic_name 
)
inline

iioutils_break_up_name() - extract generic name from full channel name : the full channel name : the output generic channel name

Definition at line 31 of file iio_utils.h.

int iioutils_get_param_float ( float *  output,
const char param_name,
const char device_dir,
const char name,
const char generic_name 
)
inline

Definition at line 198 of file iio_utils.h.

int iioutils_get_type ( unsigned *  is_signed,
unsigned *  bytes,
unsigned *  bits_used,
unsigned *  shift,
uint64_t mask,
unsigned *  be,
const char device_dir,
const char name,
const char generic_name 
)
inline

Definition at line 94 of file iio_utils.h.

int read_sysfs_float ( char filename,
char basedir,
float *  val 
)

Definition at line 634 of file iio_utils.h.

int read_sysfs_posint ( char filename,
char basedir 
)

Definition at line 612 of file iio_utils.h.

int write_sysfs_int ( char filename,
char basedir,
int  val 
)

Definition at line 542 of file iio_utils.h.

int write_sysfs_int_and_verify ( char filename,
char basedir,
int  val 
)

Definition at line 547 of file iio_utils.h.

int write_sysfs_string ( char filename,
char basedir,
char val 
)

Definition at line 607 of file iio_utils.h.

int write_sysfs_string_and_verify ( char filename,
char basedir,
char val 
)

write_sysfs_string_and_verify() - string write, readback and verify : name of file to write to : the sysfs directory in which the file is to be found : the string to write

Definition at line 602 of file iio_utils.h.

Variable Documentation

const char* iio_dir = "/sys/bus/iio/devices/"

Definition at line 24 of file iio_utils.h.