1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 2/* industrial I/O buffer definitions needed both in and out of kernel
 3 */
 4
 5#ifndef _IIO_BUFFER_H_
 6#define _IIO_BUFFER_H_
 7
 8#include <linux/types.h>
 9
10/* Flags for iio_dmabuf.flags */
11#define IIO_BUFFER_DMABUF_CYCLIC		(1 << 0)
12#define IIO_BUFFER_DMABUF_SUPPORTED_FLAGS	0x00000001
13
14/**
15 * struct iio_dmabuf - Descriptor for a single IIO DMABUF object
16 * @fd:		file descriptor of the DMABUF object
17 * @flags:	one or more IIO_BUFFER_DMABUF_* flags
18 * @bytes_used:	number of bytes used in this DMABUF for the data transfer.
19 *		Should generally be set to the DMABUF's size.
20 */
21struct iio_dmabuf {
22	__u32 fd;
23	__u32 flags;
24	__u64 bytes_used;
25};
26
27#define IIO_BUFFER_GET_FD_IOCTL			_IOWR('i', 0x91, int)
28#define IIO_BUFFER_DMABUF_ATTACH_IOCTL		_IOW('i', 0x92, int)
29#define IIO_BUFFER_DMABUF_DETACH_IOCTL		_IOW('i', 0x93, int)
30#define IIO_BUFFER_DMABUF_ENQUEUE_IOCTL		_IOW('i', 0x94, struct iio_dmabuf)
31
32#endif /* _IIO_BUFFER_H_ */