Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
ad_sigma_delta.h File Reference

Go to the source code of this file.

Data Structures

struct  ad_sd_calib_data
 
struct  ad_sigma_delta_info
 
struct  ad_sigma_delta
 

Macros

#define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, _storagebits, _shift, _extend_name, _type)
 
#define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, _storagebits, _shift)
 
#define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, _storagebits, _shift)
 
#define AD_SD_CHANNEL(_si, _channel, _address, _bits, _storagebits, _shift)
 
#define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift)
 
#define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, _shift)
 

Enumerations

enum  ad_sigma_delta_mode { AD_SD_MODE_CONTINUOUS = 0, AD_SD_MODE_SINGLE = 1, AD_SD_MODE_IDLE = 2, AD_SD_MODE_POWERDOWN = 3 }
 

Functions

void ad_sd_set_comm (struct ad_sigma_delta *sigma_delta, uint8_t comm)
 
int ad_sd_write_reg (struct ad_sigma_delta *sigma_delta, unsigned int reg, unsigned int size, unsigned int val)
 
int ad_sd_read_reg (struct ad_sigma_delta *sigma_delta, unsigned int reg, unsigned int size, unsigned int *val)
 
int ad_sigma_delta_single_conversion (struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *val)
 
int ad_sd_calibrate_all (struct ad_sigma_delta *sigma_delta, const struct ad_sd_calib_data *cd, unsigned int n)
 
int ad_sd_init (struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, struct spi_device *spi, const struct ad_sigma_delta_info *info)
 
int ad_sd_setup_buffer_and_trigger (struct iio_dev *indio_dev)
 
void ad_sd_cleanup_buffer_and_trigger (struct iio_dev *indio_dev)
 
int ad_sd_validate_trigger (struct iio_dev *indio_dev, struct iio_trigger *trig)
 

Variables

enum ad_sigma_delta_mode __attribute__
 

Macro Definition Documentation

#define __AD_SD_CHANNEL (   _si,
  _channel1,
  _channel2,
  _address,
  _bits,
  _storagebits,
  _shift,
  _extend_name,
  _type 
)
Value:
{ \
.type = (_type), \
.differential = (_channel2 == -1 ? 0 : 1), \
.indexed = 1, \
.channel = (_channel1), \
.channel2 = (_channel2), \
.address = (_address), \
.extend_name = (_extend_name), \
IIO_CHAN_INFO_SCALE_SHARED_BIT | \
IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
.scan_index = (_si), \
.scan_type = { \
.sign = 'u', \
.realbits = (_bits), \
.storagebits = (_storagebits), \
.shift = (_shift), \
.endianness = IIO_BE, \
}, \
}

Definition at line 126 of file ad_sigma_delta.h.

#define AD_SD_CHANNEL (   _si,
  _channel,
  _address,
  _bits,
  _storagebits,
  _shift 
)
Value:
__AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
_storagebits, _shift, NULL, IIO_VOLTAGE)

Definition at line 159 of file ad_sigma_delta.h.

#define AD_SD_DIFF_CHANNEL (   _si,
  _channel1,
  _channel2,
  _address,
  _bits,
  _storagebits,
  _shift 
)
Value:
__AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
_storagebits, _shift, NULL, IIO_VOLTAGE)

Definition at line 149 of file ad_sigma_delta.h.

#define AD_SD_SHORTED_CHANNEL (   _si,
  _channel,
  _address,
  _bits,
  _storagebits,
  _shift 
)
Value:
__AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \
_storagebits, _shift, "shorted", IIO_VOLTAGE)

Definition at line 154 of file ad_sigma_delta.h.

#define AD_SD_SUPPLY_CHANNEL (   _si,
  _channel,
  _address,
  _bits,
  _storagebits,
  _shift 
)
Value:
__AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
_storagebits, _shift, "supply", IIO_VOLTAGE)

Definition at line 168 of file ad_sigma_delta.h.

#define AD_SD_TEMP_CHANNEL (   _si,
  _address,
  _bits,
  _storagebits,
  _shift 
)
Value:
__AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \
_storagebits, _shift, NULL, IIO_TEMP)

Definition at line 164 of file ad_sigma_delta.h.

Enumeration Type Documentation

Enumerator:
AD_SD_MODE_CONTINUOUS 
AD_SD_MODE_SINGLE 
AD_SD_MODE_IDLE 
AD_SD_MODE_POWERDOWN 

Definition at line 12 of file ad_sigma_delta.h.

Function Documentation

int ad_sd_calibrate_all ( struct ad_sigma_delta sigma_delta,
const struct ad_sd_calib_data cb,
unsigned int  n 
)

ad_sd_calibrate_all() - Performs channel calibration : The sigma delta device : Array of channels and calibration type to perform
: Number of items in cb

Returns 0 on success, an error code otherwise.

Definition at line 223 of file ad_sigma_delta.c.

void ad_sd_cleanup_buffer_and_trigger ( struct iio_dev indio_dev)

ad_sd_cleanup_buffer_and_trigger() - : The IIO device

Definition at line 528 of file ad_sigma_delta.c.

int ad_sd_init ( struct ad_sigma_delta sigma_delta,
struct iio_dev indio_dev,
struct spi_device spi,
const struct ad_sigma_delta_info info 
)

ad_sd_init() - Initializes a ad_sigma_delta struct : The ad_sigma_delta device : The IIO device which the Sigma Delta device is used for : The SPI device for the ad_sigma_delta device : Device specific callbacks and options

This function needs to be called before any other operations are performed on the ad_sigma_delta struct.

Definition at line 545 of file ad_sigma_delta.c.

int ad_sd_read_reg ( struct ad_sigma_delta sigma_delta,
unsigned int  reg,
unsigned int  size,
unsigned int val 
)

ad_sd_read_reg() - Read a register

: The sigma delta device : Address of the register : Size of the register (1-4) : Read value

Returns 0 on success, an error code otherwise.

Definition at line 146 of file ad_sigma_delta.c.

void ad_sd_set_comm ( struct ad_sigma_delta sigma_delta,
uint8_t  comm 
)

ad_sd_set_comm() - Set communications register

: The sigma delta device : New value for the communications register

Definition at line 40 of file ad_sigma_delta.c.

int ad_sd_setup_buffer_and_trigger ( struct iio_dev indio_dev)

ad_sd_setup_buffer_and_trigger() - : The IIO device

Definition at line 505 of file ad_sigma_delta.c.

int ad_sd_validate_trigger ( struct iio_dev indio_dev,
struct iio_trigger trig 
)

ad_sd_validate_trigger() - validate_trigger callback for ad_sigma_delta devices : The IIO device : The new trigger

Returns: 0 if the 'trig' matches the trigger registered by the ad_sigma_delta device, -EINVAL otherwise.

Definition at line 431 of file ad_sigma_delta.c.

int ad_sd_write_reg ( struct ad_sigma_delta sigma_delta,
unsigned int  reg,
unsigned int  size,
unsigned int  val 
)

ad_sd_write_reg() - Write a register

: The sigma delta device : Address of the register : Size of the register (0-3) : Value to write to the register

Returns 0 on success, an error code otherwise.

Definition at line 58 of file ad_sigma_delta.c.

int ad_sigma_delta_single_conversion ( struct iio_dev indio_dev,
const struct iio_chan_spec chan,
int val 
)

ad_sigma_delta_single_conversion() - Performs a single data conversion : The IIO device : The conversion is done for this channel : Pointer to the location where to store the read value

Returns: 0 on success, an error value otherwise.

Definition at line 247 of file ad_sigma_delta.c.

Variable Documentation