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 
83 };
84 
95 };
96 
101 struct iio_ch_info {
103  int16_t ch_num;
105  bool ch_out;
111  uint32_t address;
112 };
113 
114 #define END_ATTRIBUTES_ARRAY {.name = NULL}
115 
121 };
122 
129  const char *name;
131  const char *value;
132 };
133 
140  const char *name;
142  intptr_t priv;
149  int (*show)(void *device, char *buf, uint32_t len,
150  const struct iio_ch_info *channel, intptr_t priv);
152  int (*store)(void *device, char *buf, uint32_t len,
153  const struct iio_ch_info *channel, intptr_t priv);
154 };
155 
160 struct scan_type {
162  char sign;
164  uint8_t realbits;
166  uint8_t storagebits;
168  uint8_t shift;
171 };
172 
177 struct iio_channel {
179  const char *name;
183  int channel;
187  int channel2;
189  unsigned long address;
197  bool ch_out;
200  bool modified;
203  bool indexed;
204  /* Set if the channel is differential. */
206 };
207 
211 };
212 
214  bool is_cyclic;
215  uint32_t buff_index;
216 };
217 
218 struct iio_buffer {
219  /* Mask with active channels */
220  uint32_t active_mask;
221  /* Size in bytes */
222  uint32_t size;
223  /* Number of bytes per sample * number of active channels */
224  uint32_t bytes_per_scan;
225  /* Buffer direction */
227  /* Buffer where data is stored */
229  /* Stores cyclic buffer specific information */
231 };
232 
234  void *dev;
236 };
237 
238 struct iio_trigger {
245  int (*enable)(void *trig);
247  int (*disable)(void *trig);
248 };
249 
254 struct iio_device {
259  uint16_t num_ch;
268  /* Numbers of bytes will be:
269  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
270  * DEPRECATED.
271  */
272  int32_t (*read_dev)(void *dev, void *buff, uint32_t nb_samples);
273  /* Numbers of bytes will be:
274  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
275  * DEPRECATED.
276  */
277  int32_t (*write_dev)(void *dev, void *buff, uint32_t nb_samples);
278 
279  /* Bufer callbacks */
281  int32_t (*pre_enable)(void *dev, uint32_t mask);
283  int32_t (*post_disable)(void *dev);
285  int32_t (*submit)(struct iio_device_data *dev);
287  int32_t (*trigger_handler)(struct iio_device_data *dev);
288 
289  /* Read device register */
290  int32_t (*debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval);
291  /* Write device register */
292  int32_t (*debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval);
293 
294 };
295 
296 #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:272
IIO_DIRECTION_INPUT
@ IIO_DIRECTION_INPUT
Definition: iio_types.h:209
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:177
IIO_VAL_INT_PLUS_NANO
@ IIO_VAL_INT_PLUS_NANO
Definition: iio_types.h:58
scan_type::sign
char sign
Definition: iio_types.h:162
iio_context_attribute
Structure holding the context attribute members.
Definition: iio_types.h:127
IIO_SHARED_BY_TYPE
@ IIO_SHARED_BY_TYPE
Definition: iio_types.h:118
IIO_SEPARATE
@ IIO_SEPARATE
Definition: iio_types.h:117
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:261
IIO_VAL_FRACTIONAL_LOG2
@ IIO_VAL_FRACTIONAL_LOG2
Definition: iio_types.h:62
iio_device_data::dev
void * dev
Definition: iio_types.h:234
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:101
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:224
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:149
scan_type::is_big_endian
bool is_big_endian
Definition: iio_types.h:170
iio_channel::diferential
bool diferential
Definition: iio_types.h:205
IIO_MOD_Z
@ IIO_MOD_Z
Definition: iio_types.h:93
scan_type::storagebits
uint8_t storagebits
Definition: iio_types.h:166
IIO_VAL_FRACTIONAL
@ IIO_VAL_FRACTIONAL
Definition: iio_types.h:61
iio_trigger::disable
int(* disable)(void *trig)
Definition: iio_types.h:247
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:105
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:277
IIO_ALTVOLTAGE
@ IIO_ALTVOLTAGE
Definition: iio_types.h:73
iio_channel::ch_type
enum iio_chan_type ch_type
Definition: iio_types.h:181
iio_device::post_disable
int32_t(* post_disable)(void *dev)
Definition: iio_types.h:283
iio_channel::channel2
int channel2
Definition: iio_types.h:187
iio_device::debug_reg_read
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:290
iio_chan_type
IIO channel types.
iio_attribute::priv
intptr_t priv
Definition: iio_types.h:142
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:197
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:120
iio_channel::channel
int channel
Definition: iio_types.h:183
iio_device::pre_enable
int32_t(* pre_enable)(void *dev, uint32_t mask)
Definition: iio_types.h:281
iio_attribute::shared
enum iio_attribute_shared shared
Definition: iio_types.h:147
scan_type::shift
uint8_t shift
Definition: iio_types.h:168
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:152
IIO_MOD_Y
@ IIO_MOD_Y
Definition: iio_types.h:92
iio_attribute::name
const char * name
Definition: iio_types.h:140
iio_ch_info::differential
bool differential
Definition: iio_types.h:109
iio_channel::name
const char * name
Definition: iio_types.h:179
iio_device::debug_attributes
struct iio_attribute * debug_attributes
Definition: iio_types.h:265
IIO_VAL_CHAR
@ IIO_VAL_CHAR
Definition: iio_types.h:63
iio_attribute_shared
iio_attribute_shared
Definition: iio_types.h:116
iio_device::submit
int32_t(* submit)(struct iio_device_data *dev)
Definition: iio_types.h:285
iio_buffer::size
uint32_t size
Definition: iio_types.h:222
iio_buffer::cyclic_info
struct iio_cyclic_buffer_info cyclic_info
Definition: iio_types.h:230
iio_buffer_direction
iio_buffer_direction
Definition: iio_types.h:208
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:138
iio_context_attribute::value
const char * value
Definition: iio_types.h:131
IIO_NO_MOD
@ IIO_NO_MOD
Definition: iio_types.h:90
iio_buffer
Definition: iio_types.h:218
iio_buffer::active_mask
uint32_t active_mask
Definition: iio_types.h:220
no_os_circular_buffer.h
Circular buffer library header.
iio_buffer::buf
struct no_os_circular_buffer * buf
Definition: iio_types.h:228
IIO_CURRENT
@ IIO_CURRENT
Definition: iio_types.h:72
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:94
iio_device_data::buffer
struct iio_buffer * buffer
Definition: iio_types.h:235
iio_val
iio_val
Definition: iio_types.h:55
iio_cyclic_buffer_info::buff_index
uint32_t buff_index
Definition: iio_types.h:215
IIO_CAPACITANCE
@ IIO_CAPACITANCE
Definition: iio_types.h:76
IIO_DIRECTION_OUTPUT
@ IIO_DIRECTION_OUTPUT
Definition: iio_types.h:210
iio_device::buffer_attributes
struct iio_attribute * buffer_attributes
Definition: iio_types.h:267
iio_ch_info::address
uint32_t address
Definition: iio_types.h:111
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:195
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:259
iio_channel::scan_type
struct scan_type * scan_type
Definition: iio_types.h:193
IIO_MOD_X
@ IIO_MOD_X
Definition: iio_types.h:91
iio_context_attribute::name
const char * name
Definition: iio_types.h:129
IIO_TEMP
@ IIO_TEMP
Definition: iio_types.h:75
iio_ch_info::type
enum iio_chan_type type
Definition: iio_types.h:107
iio_device::trigger_handler
int32_t(* trigger_handler)(struct iio_device_data *dev)
Definition: iio_types.h:287
iio_buffer::dir
enum iio_buffer_direction dir
Definition: iio_types.h:226
iio_device::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: iio_types.h:257
iio_trigger
Definition: iio_types.h:238
iio_channel::modified
bool modified
Definition: iio_types.h:200
iio_channel::scan_index
int scan_index
Definition: iio_types.h:191
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:103
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:254
IIO_INCLI
@ IIO_INCLI
Definition: iio_types.h:80
iio_cyclic_buffer_info::is_cyclic
bool is_cyclic
Definition: iio_types.h:214
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:243
iio_trigger::enable
int(* enable)(void *trig)
Definition: iio_types.h:245
scan_type
Definition: iio_types.h:160
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:241
iio_device_data
Definition: iio_types.h:233
iio_device::debug_reg_write
int32_t(* debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval)
Definition: iio_types.h:292
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:119
iio_channel::address
unsigned long address
Definition: iio_types.h:189
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:263
IIO_VAL_INT_MULTIPLE
@ IIO_VAL_INT_MULTIPLE
Definition: iio_types.h:60
iio_cyclic_buffer_info
Definition: iio_types.h:213
iio_channel::indexed
bool indexed
Definition: iio_types.h:203
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:164