libiio  0.11
Library for interfacing with IIO devices
 All Data Structures Files Functions Variables Enumerations Modules
iiod-client.h
1 /*
2  * libiio - Library for interfacing industrial I/O (IIO) devices
3  *
4  * Copyright (C) 2015 Analog Devices, Inc.
5  * Author: Paul Cercueil <paul.cercueil@analog.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  */
18 
19 #ifndef _IIOD_CLIENT_H
20 #define _IIOD_CLIENT_H
21 
22 #include "iio.h"
23 
24 struct iio_mutex;
25 struct iiod_client;
26 struct iio_context_pdata;
27 
28 struct iiod_client_ops {
29  ssize_t (*write)(struct iio_context_pdata *pdata,
30  void *desc, const char *src, size_t len);
31  ssize_t (*read)(struct iio_context_pdata *pdata,
32  void *desc, char *dst, size_t len);
33  ssize_t (*read_line)(struct iio_context_pdata *pdata,
34  void *desc, char *dst, size_t len);
35 };
36 
37 struct iiod_client * iiod_client_new(struct iio_context_pdata *pdata,
38  struct iio_mutex *lock, const struct iiod_client_ops *ops);
39 void iiod_client_destroy(struct iiod_client *client);
40 
41 int iiod_client_get_version(struct iiod_client *client, void *desc,
42  unsigned int *major, unsigned int *minor, char *git_tag);
43 int iiod_client_get_trigger(struct iiod_client *client, void *desc,
44  const struct iio_device *dev,
45  const struct iio_device **trigger);
46 int iiod_client_set_trigger(struct iiod_client *client, void *desc,
47  const struct iio_device *dev, const struct iio_device *trigger);
48 int iiod_client_set_kernel_buffers_count(struct iiod_client *client,
49  void *desc, const struct iio_device *dev, unsigned int nb_blocks);
50 int iiod_client_set_timeout(struct iiod_client *client,
51  void *desc, unsigned int timeout);
52 ssize_t iiod_client_read_attr(struct iiod_client *client, void *desc,
53  const struct iio_device *dev, const struct iio_channel *chn,
54  const char *attr, char *dest, size_t len, bool is_debug);
55 ssize_t iiod_client_write_attr(struct iiod_client *client, void *desc,
56  const struct iio_device *dev, const struct iio_channel *chn,
57  const char *attr, const char *src, size_t len, bool is_debug);
58 int iiod_client_open_unlocked(struct iiod_client *client, void *desc,
59  const struct iio_device *dev, size_t samples_count,
60  bool cyclic);
61 int iiod_client_close_unlocked(struct iiod_client *client, void *desc,
62  const struct iio_device *dev);
63 ssize_t iiod_client_read_unlocked(struct iiod_client *client, void *desc,
64  const struct iio_device *dev, void *dst, size_t len,
65  uint32_t *mask, size_t words);
66 ssize_t iiod_client_write_unlocked(struct iiod_client *client, void *desc,
67  const struct iio_device *dev, const void *src, size_t len);
68 struct iio_context * iiod_client_create_context(
69  struct iiod_client *client, void *desc);
70 
71 #endif /* _IIOD_CLIENT_H */
Represents an input or output channel of a device.
Represents a device in the IIO context.
Public interface.
Contains the representation of an IIO context.