no-OS
iio_types.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef IIO_TYPES_H_
34 #define IIO_TYPES_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 
40 #include <stdbool.h>
41 #include <stdint.h>
42 #include "no_os_circular_buffer.h"
43 
44 /******************************************************************************/
45 /*************************** Types Declarations *******************************/
46 /******************************************************************************/
47 
48 
49 enum iio_val {
58 };
59 
82 };
83 
97 };
98 
103 struct iio_ch_info {
105  int16_t ch_num;
107  bool ch_out;
113  uint32_t address;
114 };
115 
116 #define END_ATTRIBUTES_ARRAY {.name = NULL}
117 
123 };
124 
131  const char *name;
133  intptr_t priv;
140  int (*show)(void *device, char *buf, uint32_t len,
141  const struct iio_ch_info *channel, intptr_t priv);
143  int (*store)(void *device, char *buf, uint32_t len,
144  const struct iio_ch_info *channel, intptr_t priv);
145 };
146 
151 struct scan_type {
153  char sign;
155  uint8_t realbits;
157  uint8_t storagebits;
159  uint8_t shift;
162 };
163 
168 struct iio_channel {
170  const char *name;
174  int channel;
178  int channel2;
180  unsigned long address;
188  bool ch_out;
191  bool modified;
194  bool indexed;
195  /* Set if the channel is differential. */
197 };
198 
202 };
203 
205  bool is_cyclic;
206  uint32_t buff_index;
207 };
208 
209 struct iio_buffer {
210  /* Mask with active channels */
211  uint32_t active_mask;
212  /* Size in bytes */
213  uint32_t size;
214  /* Number of bytes per sample * number of active channels */
215  uint32_t bytes_per_scan;
216  /* Number of requested samples */
217  uint32_t samples;
218  /* Buffer direction */
220  /* Buffer where data is stored */
222  /* Stores cyclic buffer specific information */
224 };
225 
227  void *dev;
229 };
230 
231 struct iio_trigger {
238  int (*enable)(void *trig);
240  int (*disable)(void *trig);
241 };
242 
247 struct iio_device {
252  uint16_t num_ch;
261  /* Numbers of bytes will be:
262  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
263  * DEPRECATED.
264  */
265  int32_t (*read_dev)(void *dev, void *buff, uint32_t nb_samples);
266  /* Numbers of bytes will be:
267  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
268  * DEPRECATED.
269  */
270  int32_t (*write_dev)(void *dev, void *buff, uint32_t nb_samples);
271 
272  /* Bufer callbacks */
274  int32_t (*pre_enable)(void *dev, uint32_t mask);
276  int32_t (*post_disable)(void *dev);
278  int32_t (*submit)(struct iio_device_data *dev);
280  int32_t (*trigger_handler)(struct iio_device_data *dev);
281 
282  /* Read device register */
283  int32_t (*debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval);
284  /* Write device register */
285  int32_t (*debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval);
286 
287 };
288 
289 #endif /* IIO_TYPES_H_ */
IIO_ACCEL
@ IIO_ACCEL
Definition: iio_types.h:71
iio_device::read_dev
int32_t(* read_dev)(void *dev, void *buff, uint32_t nb_samples)
Definition: iio_types.h:265
IIO_COUNT
@ IIO_COUNT
Definition: iio_types.h:78
IIO_DIRECTION_INPUT
@ IIO_DIRECTION_INPUT
Definition: iio_types.h:200
iio_buffer::samples
uint32_t samples
Definition: iio_types.h:217
IIO_VAL_INT_PLUS_MICRO_DB
@ IIO_VAL_INT_PLUS_MICRO_DB
Definition: iio_types.h:53
IIO_ANGL_VEL
@ IIO_ANGL_VEL
Definition: iio_types.h:68
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:50
iio_channel
Struct describing the scan type.
Definition: iio_types.h:168
IIO_VAL_INT_PLUS_NANO
@ IIO_VAL_INT_PLUS_NANO
Definition: iio_types.h:52
scan_type::sign
char sign
Definition: iio_types.h:153
IIO_SHARED_BY_TYPE
@ IIO_SHARED_BY_TYPE
Definition: iio_types.h:120
IIO_SEPARATE
@ IIO_SEPARATE
Definition: iio_types.h:119
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:254
IIO_VAL_FRACTIONAL_LOG2
@ IIO_VAL_FRACTIONAL_LOG2
Definition: iio_types.h:56
iio_device_data::dev
void * dev
Definition: iio_types.h:227
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
IIO_VAL_INT_PLUS_MICRO
@ IIO_VAL_INT_PLUS_MICRO
Definition: iio_types.h:51
iio_buffer::bytes_per_scan
uint32_t bytes_per_scan
Definition: iio_types.h:215
iio_attribute::show
int(* show)(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Definition: iio_types.h:140
IIO_MOD_PITCH
@ IIO_MOD_PITCH
Definition: iio_types.h:94
scan_type::is_big_endian
bool is_big_endian
Definition: iio_types.h:161
iio_channel::diferential
bool diferential
Definition: iio_types.h:196
IIO_MOD_Z
@ IIO_MOD_Z
Definition: iio_types.h:92
scan_type::storagebits
uint8_t storagebits
Definition: iio_types.h:157
IIO_VAL_FRACTIONAL
@ IIO_VAL_FRACTIONAL
Definition: iio_types.h:55
iio_trigger::disable
int(* disable)(void *trig)
Definition: iio_types.h:240
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:107
device
Definition: ad9361_util.h:69
IIO_RESISTANCE
@ IIO_RESISTANCE
Definition: iio_types.h:72
iio_device::write_dev
int32_t(* write_dev)(void *dev, void *buff, uint32_t nb_samples)
Definition: iio_types.h:270
IIO_ALTVOLTAGE
@ IIO_ALTVOLTAGE
Definition: iio_types.h:67
iio_channel::ch_type
enum iio_chan_type ch_type
Definition: iio_types.h:172
iio_device::post_disable
int32_t(* post_disable)(void *dev)
Definition: iio_types.h:276
iio_channel::channel2
int channel2
Definition: iio_types.h:178
iio_device::debug_reg_read
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:283
iio_chan_type
IIO channel types.
iio_attribute::priv
intptr_t priv
Definition: iio_types.h:133
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:188
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:122
iio_channel::channel
int channel
Definition: iio_types.h:174
iio_device::pre_enable
int32_t(* pre_enable)(void *dev, uint32_t mask)
Definition: iio_types.h:274
iio_attribute::shared
enum iio_attribute_shared shared
Definition: iio_types.h:138
scan_type::shift
uint8_t shift
Definition: iio_types.h:159
iio_attribute::store
int(* store)(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Definition: iio_types.h:143
IIO_MOD_Y
@ IIO_MOD_Y
Definition: iio_types.h:91
iio_attribute::name
const char * name
Definition: iio_types.h:131
iio_ch_info::differential
bool differential
Definition: iio_types.h:111
iio_channel::name
const char * name
Definition: iio_types.h:170
iio_device::debug_attributes
struct iio_attribute * debug_attributes
Definition: iio_types.h:258
IIO_VAL_CHAR
@ IIO_VAL_CHAR
Definition: iio_types.h:57
iio_attribute_shared
iio_attribute_shared
Definition: iio_types.h:118
iio_device::submit
int32_t(* submit)(struct iio_device_data *dev)
Definition: iio_types.h:278
iio_buffer::size
uint32_t size
Definition: iio_types.h:213
iio_buffer::cyclic_info
struct iio_cyclic_buffer_info cyclic_info
Definition: iio_types.h:223
iio_buffer_direction
iio_buffer_direction
Definition: iio_types.h:199
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
IIO_NO_MOD
@ IIO_NO_MOD
Definition: iio_types.h:89
iio_buffer
Definition: iio_types.h:209
iio_buffer::active_mask
uint32_t active_mask
Definition: iio_types.h:211
no_os_circular_buffer.h
Circular buffer library header.
iio_buffer::buf
struct no_os_circular_buffer * buf
Definition: iio_types.h:221
IIO_CURRENT
@ IIO_CURRENT
Definition: iio_types.h:66
IIO_WEIGHT
@ IIO_WEIGHT
Definition: iio_types.h:81
IIO_MOD_YAW
@ IIO_MOD_YAW
Definition: iio_types.h:95
IIO_VOLTAGE
@ IIO_VOLTAGE
Definition: iio_types.h:65
IIO_ANGL
@ IIO_ANGL
Definition: iio_types.h:76
IIO_MOD_TEMP_AMBIENT
@ IIO_MOD_TEMP_AMBIENT
Definition: iio_types.h:93
iio_device_data::buffer
struct iio_buffer * buffer
Definition: iio_types.h:228
iio_val
iio_val
Definition: iio_types.h:49
iio_cyclic_buffer_info::buff_index
uint32_t buff_index
Definition: iio_types.h:206
IIO_CAPACITANCE
@ IIO_CAPACITANCE
Definition: iio_types.h:70
IIO_DIRECTION_OUTPUT
@ IIO_DIRECTION_OUTPUT
Definition: iio_types.h:201
iio_device::buffer_attributes
struct iio_attribute * buffer_attributes
Definition: iio_types.h:260
iio_ch_info::address
uint32_t address
Definition: iio_types.h:113
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:186
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:252
iio_channel::scan_type
struct scan_type * scan_type
Definition: iio_types.h:184
IIO_MOD_X
@ IIO_MOD_X
Definition: iio_types.h:90
IIO_TEMP
@ IIO_TEMP
Definition: iio_types.h:69
iio_ch_info::type
enum iio_chan_type type
Definition: iio_types.h:109
IIO_MOD_ROLL
@ IIO_MOD_ROLL
Definition: iio_types.h:96
iio_device::trigger_handler
int32_t(* trigger_handler)(struct iio_device_data *dev)
Definition: iio_types.h:280
iio_buffer::dir
enum iio_buffer_direction dir
Definition: iio_types.h:219
iio_device::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: iio_types.h:250
iio_trigger
Definition: iio_types.h:231
iio_channel::modified
bool modified
Definition: iio_types.h:191
iio_channel::scan_index
int scan_index
Definition: iio_types.h:182
IIO_MAGN
@ IIO_MAGN
Definition: iio_types.h:73
iio_modifier
IIO channel modifier.
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:105
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
IIO_INCLI
@ IIO_INCLI
Definition: iio_types.h:74
iio_cyclic_buffer_info::is_cyclic
bool is_cyclic
Definition: iio_types.h:205
no_os_circular_buffer
Circular buffer descriptor.
Definition: no_os_circular_buffer.h:67
iio_trigger::attributes
struct iio_attribute * attributes
Definition: iio_types.h:236
IIO_ROT
@ IIO_ROT
Definition: iio_types.h:77
iio_trigger::enable
int(* enable)(void *trig)
Definition: iio_types.h:238
scan_type
Definition: iio_types.h:151
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:234
IIO_DELTA_ANGL
@ IIO_DELTA_ANGL
Definition: iio_types.h:79
iio_device_data
Definition: iio_types.h:226
iio_device::debug_reg_write
int32_t(* debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval)
Definition: iio_types.h:285
IIO_VELOCITY
@ IIO_VELOCITY
Definition: iio_types.h:75
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
IIO_SHARED_BY_DIR
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:121
iio_channel::address
unsigned long address
Definition: iio_types.h:180
IIO_DELTA_VELOCITY
@ IIO_DELTA_VELOCITY
Definition: iio_types.h:80
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:256
IIO_VAL_INT_MULTIPLE
@ IIO_VAL_INT_MULTIPLE
Definition: iio_types.h:54
iio_cyclic_buffer_info
Definition: iio_types.h:204
iio_channel::indexed
bool indexed
Definition: iio_types.h:194
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:155