libiio: local.h Source File

libiio 1.0 Library for interfacing with IIO devices

Loading...
Searching...
No Matches
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
15struct iio_buffer_impl_pdata;
16struct iio_block_impl_pdata;
17struct iio_device;
18struct timespec;
19
20struct iio_buffer_pdata {
21 const struct iio_device *dev;
22 struct iio_buffer_impl_pdata *pdata;
23 int fd, cancel_fd;
24 unsigned int idx;
25 bool dmabuf_supported;
26 bool mmap_supported;
27 size_t size;
28};
29
30struct iio_block_pdata {
31 struct iio_buffer_pdata *buf;
32 struct iio_block_impl_pdata *pdata;
33 size_t size;
34 void *data;
35 bool dequeued;
36 bool cpu_access_disabled;
37};
38
39int ioctl_nointr(int fd, unsigned long request, void *data);
40
41int buffer_check_ready(struct iio_buffer_pdata *pdata, int fd,
42 short events, struct timespec *start);
43
44struct iio_block_pdata *
45local_create_dmabuf(struct iio_buffer_pdata *pdata, size_t size, void **data);
46void local_free_dmabuf(struct iio_block_pdata *pdata);
47
48int local_enqueue_dmabuf(struct iio_block_pdata *pdata,
49 size_t bytes_used, bool cyclic);
50int local_dequeue_dmabuf(struct iio_block_pdata *pdata, bool nonblock);
51
52int local_dmabuf_get_fd(struct iio_block_pdata *pdata);
53int local_dmabuf_disable_cpu_access(struct iio_block_pdata *pdata, bool disable);
54
55struct iio_block_pdata *
56local_create_mmap_block(struct iio_buffer_pdata *pdata,
57 size_t size, void **data);
58void local_free_mmap_block(struct iio_block_pdata *pdata);
59
60int local_enqueue_mmap_block(struct iio_block_pdata *pdata,
61 size_t bytes_used, bool cyclic);
62int local_dequeue_mmap_block(struct iio_block_pdata *pdata, bool nonblock);
63
64struct iio_buffer_impl_pdata * local_alloc_mmap_buffer_impl(void);
65
66#endif /* __IIO_LOCAL_H */
iio_device
Represents a device in the IIO context.