libiio
local.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * libiio - Library for interfacing industrial I/O (IIO) devices
4  *
5  * Copyright (C) 2022 Analog Devices, Inc.
6  * Author: Paul Cercueil <paul.cercueil@analog.com>
7  */
8 #ifndef __IIO_LOCAL_H
9 #define __IIO_LOCAL_H
10 
11 #include <stdbool.h>
12 #include <stddef.h>
13 #include <stdint.h>
14 
17 struct iio_device;
18 struct timespec;
19 
21  const struct iio_device *dev;
22  struct iio_buffer_impl_pdata *pdata;
23  int fd, cancel_fd;
24  unsigned int idx;
25  bool multi_buffer;
26  bool dmabuf_supported;
27  bool mmap_supported;
28  size_t size;
29 };
30 
31 struct iio_block_pdata {
32  struct iio_buffer_pdata *buf;
33  struct iio_block_impl_pdata *pdata;
34  size_t size;
35  void *data;
36  bool dequeued;
37 };
38 
39 int ioctl_nointr(int fd, unsigned long request, void *data);
40 
41 int buffer_check_ready(struct iio_buffer_pdata *pdata, int fd,
42  short events, struct timespec *start);
43 
44 struct iio_block_pdata *
45 local_create_dmabuf(struct iio_buffer_pdata *pdata, size_t size, void **data);
46 void local_free_dmabuf(struct iio_block_pdata *pdata);
47 
48 int local_enqueue_dmabuf(struct iio_block_pdata *pdata,
49  size_t bytes_used, bool cyclic);
50 int local_dequeue_dmabuf(struct iio_block_pdata *pdata, bool nonblock);
51 
52 struct iio_block_pdata *
53 local_create_mmap_block(struct iio_buffer_pdata *pdata,
54  size_t size, void **data);
55 void local_free_mmap_block(struct iio_block_pdata *pdata);
56 
57 int local_enqueue_mmap_block(struct iio_block_pdata *pdata,
58  size_t bytes_used, bool cyclic);
59 int local_dequeue_mmap_block(struct iio_block_pdata *pdata, bool nonblock);
60 
61 struct iio_buffer_impl_pdata * local_alloc_mmap_buffer_impl(void);
62 
63 #endif /* __IIO_LOCAL_H */
Definition: local-mmap.c:63
Definition: local.h:20
Represents a device in the IIO context.
Definition: iio-private.h:130
Definition: local-mmap.c:55
Definition: iiod-client.c:58