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 
78 };
79 
90 };
91 
96 struct iio_ch_info {
98  int16_t ch_num;
100  bool ch_out;
106  uint32_t address;
107 };
108 
109 #define END_ATTRIBUTES_ARRAY {.name = NULL}
110 
116 };
117 
124  const char *name;
126  const char *value;
127 };
128 
135  const char *name;
137  intptr_t priv;
144  int (*show)(void *device, char *buf, uint32_t len,
145  const struct iio_ch_info *channel, intptr_t priv);
147  int (*store)(void *device, char *buf, uint32_t len,
148  const struct iio_ch_info *channel, intptr_t priv);
149 };
150 
155 struct scan_type {
157  char sign;
159  uint8_t realbits;
161  uint8_t storagebits;
163  uint8_t shift;
166 };
167 
172 struct iio_channel {
174  const char *name;
178  int channel;
182  int channel2;
184  unsigned long address;
192  bool ch_out;
195  bool modified;
198  bool indexed;
199  /* Set if the channel is differential. */
201 };
202 
206 };
207 
208 struct iio_buffer {
209  /* Mask with active channels */
210  uint32_t active_mask;
211  /* Size in bytes */
212  uint32_t size;
213  /* Number of bytes per sample * number of active channels */
214  uint32_t bytes_per_scan;
215  /* Buffer direction */
217  /* Buffer where data is stored */
219 };
220 
222  void *dev;
224 };
225 
226 struct iio_trigger {
233  int (*enable)(void *trig);
235  int (*disable)(void *trig);
236 };
237 
242 struct iio_device {
247  uint16_t num_ch;
250  /* Array of attributes. Last one should have its name set to NULL */
258  /* Numbers of bytes will be:
259  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
260  * DEPRECATED.
261  */
262  int32_t (*read_dev)(void *dev, void *buff, uint32_t nb_samples);
263  /* Numbers of bytes will be:
264  * samples * (storage_size_of_first_active_ch / 8) * nb_active_channels
265  * DEPRECATED.
266  */
267  int32_t (*write_dev)(void *dev, void *buff, uint32_t nb_samples);
268 
269  /* Bufer callbacks */
271  int32_t (*pre_enable)(void *dev, uint32_t mask);
273  int32_t (*post_disable)(void *dev);
275  int32_t (*submit)(struct iio_device_data *dev);
277  int32_t (*trigger_handler)(struct iio_device_data *dev);
278 
279  /* Read device register */
280  int32_t (*debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval);
281  /* Write device register */
282  int32_t (*debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval);
283 
284 };
285 
286 #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:262
IIO_DIRECTION_INPUT
@ IIO_DIRECTION_INPUT
Definition: iio_types.h:204
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:172
IIO_VAL_INT_PLUS_NANO
@ IIO_VAL_INT_PLUS_NANO
Definition: iio_types.h:58
scan_type::sign
char sign
Definition: iio_types.h:157
iio_context_attribute
Structure holding the context attribute members.
Definition: iio_types.h:122
IIO_SHARED_BY_TYPE
@ IIO_SHARED_BY_TYPE
Definition: iio_types.h:113
IIO_SEPARATE
@ IIO_SEPARATE
Definition: iio_types.h:112
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:249
IIO_VAL_FRACTIONAL_LOG2
@ IIO_VAL_FRACTIONAL_LOG2
Definition: iio_types.h:62
iio_device_data::dev
void * dev
Definition: iio_types.h:222
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:96
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:214
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:144
scan_type::is_big_endian
bool is_big_endian
Definition: iio_types.h:165
iio_channel::diferential
bool diferential
Definition: iio_types.h:200
IIO_MOD_Z
@ IIO_MOD_Z
Definition: iio_types.h:88
scan_type::storagebits
uint8_t storagebits
Definition: iio_types.h:161
IIO_VAL_FRACTIONAL
@ IIO_VAL_FRACTIONAL
Definition: iio_types.h:61
iio_trigger::disable
int(* disable)(void *trig)
Definition: iio_types.h:235
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:100
device
Definition: ad9361_util.h:75
iio_device::write_dev
int32_t(* write_dev)(void *dev, void *buff, uint32_t nb_samples)
Definition: iio_types.h:267
IIO_ALTVOLTAGE
@ IIO_ALTVOLTAGE
Definition: iio_types.h:73
iio_channel::ch_type
enum iio_chan_type ch_type
Definition: iio_types.h:176
iio_device::post_disable
int32_t(* post_disable)(void *dev)
Definition: iio_types.h:273
iio_channel::channel2
int channel2
Definition: iio_types.h:182
iio_device::debug_reg_read
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:280
iio_chan_type
IIO channel types.
iio_attribute::priv
intptr_t priv
Definition: iio_types.h:137
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:192
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:115
iio_channel::channel
int channel
Definition: iio_types.h:178
iio_device::pre_enable
int32_t(* pre_enable)(void *dev, uint32_t mask)
Definition: iio_types.h:271
iio_attribute::shared
enum iio_attribute_shared shared
Definition: iio_types.h:142
scan_type::shift
uint8_t shift
Definition: iio_types.h:163
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:147
IIO_MOD_Y
@ IIO_MOD_Y
Definition: iio_types.h:87
iio_attribute::name
const char * name
Definition: iio_types.h:135
iio_ch_info::differential
bool differential
Definition: iio_types.h:104
iio_channel::name
const char * name
Definition: iio_types.h:174
iio_device::debug_attributes
struct iio_attribute * debug_attributes
Definition: iio_types.h:255
IIO_VAL_CHAR
@ IIO_VAL_CHAR
Definition: iio_types.h:63
iio_attribute_shared
iio_attribute_shared
Definition: iio_types.h:111
iio_device::submit
int32_t(* submit)(struct iio_device_data *dev)
Definition: iio_types.h:275
iio_buffer::size
uint32_t size
Definition: iio_types.h:212
iio_buffer_direction
iio_buffer_direction
Definition: iio_types.h:203
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:133
iio_context_attribute::value
const char * value
Definition: iio_types.h:126
IIO_NO_MOD
@ IIO_NO_MOD
Definition: iio_types.h:85
iio_buffer
Definition: iio_types.h:208
iio_buffer::active_mask
uint32_t active_mask
Definition: iio_types.h:210
no_os_circular_buffer.h
Circular buffer library header.
iio_buffer::buf
struct no_os_circular_buffer * buf
Definition: iio_types.h:218
IIO_CURRENT
@ IIO_CURRENT
Definition: iio_types.h:72
IIO_VOLTAGE
@ IIO_VOLTAGE
Definition: iio_types.h:71
IIO_MOD_TEMP_AMBIENT
@ IIO_MOD_TEMP_AMBIENT
Definition: iio_types.h:89
iio_device_data::buffer
struct iio_buffer * buffer
Definition: iio_types.h:223
iio_val
iio_val
Definition: iio_types.h:55
IIO_CAPACITANCE
@ IIO_CAPACITANCE
Definition: iio_types.h:76
IIO_DIRECTION_OUTPUT
@ IIO_DIRECTION_OUTPUT
Definition: iio_types.h:205
iio_device::buffer_attributes
struct iio_attribute * buffer_attributes
Definition: iio_types.h:257
iio_ch_info::address
uint32_t address
Definition: iio_types.h:106
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:190
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:247
iio_channel::scan_type
struct scan_type * scan_type
Definition: iio_types.h:188
IIO_MOD_X
@ IIO_MOD_X
Definition: iio_types.h:86
iio_context_attribute::name
const char * name
Definition: iio_types.h:124
IIO_TEMP
@ IIO_TEMP
Definition: iio_types.h:75
iio_ch_info::type
enum iio_chan_type type
Definition: iio_types.h:102
iio_device::trigger_handler
int32_t(* trigger_handler)(struct iio_device_data *dev)
Definition: iio_types.h:277
iio_buffer::dir
enum iio_buffer_direction dir
Definition: iio_types.h:216
iio_device::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: iio_types.h:245
iio_trigger
Definition: iio_types.h:226
iio_channel::modified
bool modified
Definition: iio_types.h:195
iio_channel::scan_index
int scan_index
Definition: iio_types.h:186
iio_modifier
IIO channel modifier.
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:98
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:242
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:231
iio_trigger::enable
int(* enable)(void *trig)
Definition: iio_types.h:233
scan_type
Definition: iio_types.h:155
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:229
iio_device_data
Definition: iio_types.h:221
iio_device::debug_reg_write
int32_t(* debug_reg_write)(void *dev, uint32_t reg, uint32_t writeval)
Definition: iio_types.h:282
no_os_irq_ctrl_desc
Definition: no_os_irq.h:117
IIO_SHARED_BY_DIR
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:114
iio_channel::address
unsigned long address
Definition: iio_types.h:184
iio_device::context_attributes
struct iio_context_attribute * context_attributes
Definition: iio_types.h:251
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:253
IIO_VAL_INT_MULTIPLE
@ IIO_VAL_INT_MULTIPLE
Definition: iio_types.h:60
iio_channel::indexed
bool indexed
Definition: iio_types.h:198
scan_type::realbits
uint8_t realbits
Definition: iio_types.h:159