no-OS
iio_types.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef IIO_TYPES_H_
40 #define IIO_TYPES_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include <stdbool.h>
47 #include <stdint.h>
48 #include "no_os_circular_buffer.h"
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
53 
54 
55 enum iio_val {
64 };
65 
84 };
85 
99 };
100 
105 struct iio_ch_info {
107  int16_t ch_num;
109  bool ch_out;
115  uint32_t address;
116 };
117 
118 #define END_ATTRIBUTES_ARRAY {.name = NULL}
119 
125 };
126 
133  const char *name;
135  intptr_t priv;
142  int (*show)(void *device, char *buf, uint32_t len,
143  const struct iio_ch_info *channel, intptr_t priv);
145  int (*store)(void *device, char *buf, uint32_t len,
146  const struct iio_ch_info *channel, intptr_t priv);
147 };
148 
153 struct scan_type {
155  char sign;
157  uint8_t realbits;
159  uint8_t storagebits;
161  uint8_t shift;
164 };
165 
170 struct iio_channel {
172  const char *name;
176  int channel;
180  int channel2;
182  unsigned long address;
190  bool ch_out;
193  bool modified;
196  bool indexed;
197  /* Set if the channel is differential. */
199 };
200 
204 };
205 
207  bool is_cyclic;
208  uint32_t buff_index;
209 };
210 
211 struct iio_buffer {
212  /* Mask with active channels */
213  uint32_t active_mask;
214  /* Size in bytes */
215  uint32_t size;
216  /* Number of bytes per sample * number of active channels */
217  uint32_t bytes_per_scan;
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:77
iio_device::read_dev
int32_t(* read_dev)(void *dev, void *buff, uint32_t nb_samples)
Definition: iio_types.h:265
IIO_DIRECTION_INPUT
@ IIO_DIRECTION_INPUT
Definition: iio_types.h:202
IIO_VAL_INT_PLUS_MICRO_DB
@ IIO_VAL_INT_PLUS_MICRO_DB
Definition: iio_types.h:59
IIO_ANGL_VEL
@ IIO_ANGL_VEL
Definition: iio_types.h:74
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:56
iio_channel
Struct describing the scan type.
Definition: iio_types.h:170
IIO_VAL_INT_PLUS_NANO
@ IIO_VAL_INT_PLUS_NANO
Definition: iio_types.h:58
scan_type::sign
char sign
Definition: iio_types.h:155
IIO_SHARED_BY_TYPE
@ IIO_SHARED_BY_TYPE
Definition: iio_types.h:122
IIO_SEPARATE
@ IIO_SEPARATE
Definition: iio_types.h:121
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:254
IIO_VAL_FRACTIONAL_LOG2
@ IIO_VAL_FRACTIONAL_LOG2
Definition: iio_types.h:62
iio_device_data::dev
void * dev
Definition: iio_types.h:227
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:105
IIO_VAL_INT_PLUS_MICRO
@ IIO_VAL_INT_PLUS_MICRO
Definition: iio_types.h:57
iio_buffer::bytes_per_scan
uint32_t bytes_per_scan
Definition: iio_types.h:217
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:142
IIO_MOD_PITCH
@ IIO_MOD_PITCH
Definition: iio_types.h:96
scan_type::is_big_endian
bool is_big_endian
Definition: iio_types.h:163
iio_channel::diferential
bool diferential
Definition: iio_types.h:198
IIO_MOD_Z
@ IIO_MOD_Z
Definition: iio_types.h:94
scan_type::storagebits
uint8_t storagebits
Definition: iio_types.h:159
IIO_VAL_FRACTIONAL
@ IIO_VAL_FRACTIONAL
Definition: iio_types.h:61
iio_trigger::disable
int(* disable)(void *trig)
Definition: iio_types.h:240
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:109
device
Definition: ad9361_util.h:75
IIO_RESISTANCE
@ IIO_RESISTANCE
Definition: iio_types.h:78
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:73
iio_channel::ch_type
enum iio_chan_type ch_type
Definition: iio_types.h:174
iio_device::post_disable
int32_t(* post_disable)(void *dev)
Definition: iio_types.h:276
iio_channel::channel2
int channel2
Definition: iio_types.h:180
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:135
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:190
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:124
iio_channel::channel
int channel
Definition: iio_types.h:176
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:140
scan_type::shift
uint8_t shift
Definition: iio_types.h:161
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:145
IIO_MOD_Y
@ IIO_MOD_Y
Definition: iio_types.h:93
iio_attribute::name
const char * name
Definition: iio_types.h:133
iio_ch_info::differential
bool differential
Definition: iio_types.h:113
iio_channel::name
const char * name
Definition: iio_types.h:172
iio_device::debug_attributes
struct iio_attribute * debug_attributes
Definition: iio_types.h:258
IIO_VAL_CHAR
@ IIO_VAL_CHAR
Definition: iio_types.h:63
iio_attribute_shared
iio_attribute_shared
Definition: iio_types.h:120
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:215
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:201
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:131
IIO_NO_MOD
@ IIO_NO_MOD
Definition: iio_types.h:91
iio_buffer
Definition: iio_types.h:211
iio_buffer::active_mask
uint32_t active_mask
Definition: iio_types.h:213
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:72
IIO_MOD_YAW
@ IIO_MOD_YAW
Definition: iio_types.h:97
IIO_VOLTAGE
@ IIO_VOLTAGE
Definition: iio_types.h:71
IIO_ANGL
@ IIO_ANGL
Definition: iio_types.h:82
IIO_MOD_TEMP_AMBIENT
@ IIO_MOD_TEMP_AMBIENT
Definition: iio_types.h:95
iio_device_data::buffer
struct iio_buffer * buffer
Definition: iio_types.h:228
iio_val
iio_val
Definition: iio_types.h:55
iio_cyclic_buffer_info::buff_index
uint32_t buff_index
Definition: iio_types.h:208
IIO_CAPACITANCE
@ IIO_CAPACITANCE
Definition: iio_types.h:76
IIO_DIRECTION_OUTPUT
@ IIO_DIRECTION_OUTPUT
Definition: iio_types.h:203
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:115
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:188
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:186
IIO_MOD_X
@ IIO_MOD_X
Definition: iio_types.h:92
IIO_TEMP
@ IIO_TEMP
Definition: iio_types.h:75
iio_ch_info::type
enum iio_chan_type type
Definition: iio_types.h:111
IIO_MOD_ROLL
@ IIO_MOD_ROLL
Definition: iio_types.h:98
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:193
iio_channel::scan_index
int scan_index
Definition: iio_types.h:184
IIO_MAGN
@ IIO_MAGN
Definition: iio_types.h:79
iio_modifier
IIO channel modifier.
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:107
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
IIO_INCLI
@ IIO_INCLI
Definition: iio_types.h:80
iio_cyclic_buffer_info::is_cyclic
bool is_cyclic
Definition: iio_types.h:207
no_os_circular_buffer
Circular buffer descriptor.
Definition: no_os_circular_buffer.h:73
iio_trigger::attributes
struct iio_attribute * attributes
Definition: iio_types.h:236
IIO_ROT
@ IIO_ROT
Definition: iio_types.h:83
iio_trigger::enable
int(* enable)(void *trig)
Definition: iio_types.h:238
scan_type
Definition: iio_types.h:153
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:234
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:81
no_os_irq_ctrl_desc
Definition: no_os_irq.h:119
IIO_SHARED_BY_DIR
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:123
iio_channel::address
unsigned long address
Definition: iio_types.h:182
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:256
IIO_VAL_INT_MULTIPLE
@ IIO_VAL_INT_MULTIPLE
Definition: iio_types.h:60
iio_cyclic_buffer_info
Definition: iio_types.h:206
iio_channel::indexed
bool indexed
Definition: iio_types.h:196
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:157