no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
iio.h
Go to the documentation of this file.
1/***************************************************************************/
34
35#ifndef IIO_H_
36#define IIO_H_
37
38#include "iio_types.h"
39#include "no_os_uart.h"
40#if defined(NO_OS_NETWORKING) || defined(NO_OS_LWIP_NETWORKING)
41#include "tcp_socket.h"
42#endif
43
49
50struct iio_desc;
51
53 char *name;
54 void *dev;
56 /*
57 * IIO buffer implementation can use a user provided buffer in raw_buf.
58 * If raw_buf is NULL and iio_device has buffer callback function set,
59 * it will allocate memory for it when needed.
60 */
61 int8_t *raw_buf;
62 /* Length of raw_buf */
63 uint32_t raw_buf_len;
64 /* If set, trigger will be linked to this device */
66};
67
69 char *name;
70 void *trig;
72};
73
80 const char *name;
82 const char *value;
83};
84
90 int(*local_backend_event_read)(void *conn, uint8_t *buf, uint32_t len);
91 int(*local_backend_event_write)(void *conn, uint8_t *buf, uint32_t len);
94};
95
98 union {
100#if defined(NO_OS_NETWORKING) || defined(NO_OS_LWIP_NETWORKING)
101 struct tcp_socket_init_param *tcp_socket_init_param;
102#endif
103 };
106 uint32_t nb_ctx_attr;
108 uint32_t nb_devs;
110 uint32_t nb_trigs;
111};
112
113/* Set communication ops and read/write ops. */
114int iio_init(struct iio_desc **desc, struct iio_init_param *init_param);
115/* Free the resources allocated by iio_init(). */
116int iio_remove(struct iio_desc *desc);
117/* Execut an iio step. */
118int iio_step(struct iio_desc *desc);
119/* Signal iio that a trigger has been triggered.
120 * This will be called in interrupt context. An application callback will be
121 called in interrupt context if trigger is synchronous with the interrupt
122 (is_synchronous = true) or will be called from iio_step if trigger is
123 asynchronous (is_synchronous = false) */
124int iio_process_trigger_type(struct iio_desc *desc, char *trigger_name);
125
126int32_t iio_parse_value(char *buf, enum iio_val fmt,
127 int32_t *val, int32_t *val2);
128int iio_format_value(char *buf, uint32_t len, enum iio_val fmt,
129 int32_t size, int32_t *vals);
130
131/* DMA buffer functions. */
132/* Get buffer addr where to write iio_buffer.size bytes */
133int iio_buffer_get_block(struct iio_buffer *buffer, void **addr);
134/* To be called to mark last iio_buffer_read as done */
135int iio_buffer_block_done(struct iio_buffer *buffer);
136
137/* Trigger buffer functions. */
138/* Write to buffer iio_buffer.bytes_per_scan bytes from data */
139int iio_buffer_push_scan(struct iio_buffer *buffer, void *data);
140/* Read from buffer iio_buffer.bytes_per_scan bytes into data */
141int iio_buffer_pop_scan(struct iio_buffer *buffer, void *data);
142
143#endif /* IIO_H_ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int iio_buffer_pop_scan(struct iio_buffer *buffer, void *data)
Definition iio.c:1427
int iio_init(struct iio_desc **desc, struct iio_init_param *init_param)
Set communication ops and read/write ops.
Definition iio.c:1874
int iio_buffer_block_done(struct iio_buffer *buffer)
Definition iio.c:1406
int iio_format_value(char *buf, uint32_t len, enum iio_val fmt, int32_t size, int32_t *vals)
Definition iio.c:670
int32_t iio_parse_value(char *buf, enum iio_val fmt, int32_t *val, int32_t *val2)
Definition iio.c:614
int iio_buffer_get_block(struct iio_buffer *buffer, void **addr)
Definition iio.c:1393
int iio_step(struct iio_desc *desc)
Execute an iio step.
Definition iio.c:1494
int iio_remove(struct iio_desc *desc)
Free the resources allocated by "iio_init()".
Definition iio.c:2013
int iio_buffer_push_scan(struct iio_buffer *buffer, void *data)
Definition iio.c:1418
int iio_process_trigger_type(struct iio_desc *desc, char *trigger_name)
Searches for trigger name and processes the trigger based on its type (sync or async with the interru...
Definition iio.c:1075
physical_link_type
Definition iio.h:44
@ USE_LOCAL_BACKEND
Definition iio.h:46
@ USE_UART
Definition iio.h:45
@ USE_NETWORK
Definition iio.h:47
Header file for iio_types.
iio_val
Definition iio_types.h:40
Header file of UART interface.
Definition iio_types.h:200
Structure holding the context attribute members.
Definition iio.h:78
const char * name
Definition iio.h:80
const char * value
Definition iio.h:82
Definition iio.c:192
Definition iio.h:52
uint32_t raw_buf_len
Definition iio.h:63
int8_t * raw_buf
Definition iio.h:61
void * dev
Definition iio.h:54
struct iio_device * dev_descriptor
Definition iio.h:55
char * trigger_id
Definition iio.h:65
char * name
Definition iio.h:53
Structure holding channels and attributes of a device.
Definition iio_types.h:238
Definition iio.h:96
enum physical_link_type phy_type
Definition iio.h:97
struct iio_device_init * devs
Definition iio.h:107
struct iio_trigger_init * trigs
Definition iio.h:109
struct iio_ctx_attr * ctx_attrs
Definition iio.h:105
uint32_t nb_devs
Definition iio.h:108
uint32_t nb_ctx_attr
Definition iio.h:106
struct no_os_uart_desc * uart_desc
Definition iio.h:99
struct iio_local_backend * local_backend
Definition iio.h:104
uint32_t nb_trigs
Definition iio.h:110
Structure holding the local backend init parameters.
Definition iio.h:89
int(* local_backend_event_write)(void *conn, uint8_t *buf, uint32_t len)
Definition iio.h:91
char * local_backend_buff
Definition iio.h:92
uint32_t local_backend_buff_len
Definition iio.h:93
int(* local_backend_event_read)(void *conn, uint8_t *buf, uint32_t len)
Definition iio.h:90
Definition iio.h:68
char * name
Definition iio.h:69
struct iio_trigger * descriptor
Definition iio.h:71
void * trig
Definition iio.h:70
Definition iio_types.h:222
Stucture holding the UART descriptor.
Definition no_os_uart.h:122