Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
android_ioctl.h
Go to the documentation of this file.
1#ifndef HALIDE_RUNTIME_ANDROID_IOCTL_H
2#define HALIDE_RUNTIME_ANDROID_IOCTL_H
3
4#define _IOC_NRBITS 8
5#define _IOC_TYPEBITS 8
6#define _IOC_SIZEBITS 14
7#define _IOC_DIRBITS 2
8
9#define _IOC_NRMASK ((1 << _IOC_NRBITS) - 1)
10#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS) - 1)
11#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS) - 1)
12#define _IOC_DIRMASK ((1 << _IOC_DIRBITS) - 1)
13
14#define _IOC_NRSHIFT 0
15#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
16#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
17#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
18
19#define _IOC_NONE 0U
20#define _IOC_WRITE 1U
21#define _IOC_READ 2U
22
23#define _IOC(dir, type, nr, size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
24
25#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
26#define _IOR(type, nr, data) _IOC(_IOC_READ, (type), (nr), (sizeof(data)))
27#define _IOW(type, nr, data) _IOC(_IOC_WRITE, (type), (nr), (sizeof(data)))
28#define _IOWR(type, nr, data) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (sizeof(data)))
29
30#define _IOR_BAD(type, nr, data) _IOC(_IOC_READ, (type), (nr), sizeof(data))
31#define _IOW_BAD(type, nr, data) _IOC(_IOC_WRITE, (type), (nr), sizeof(data))
32#define _IOWR_BAD(type, nr, data) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), sizeof(data))
33
34#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
35#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
36#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
37#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
38
39#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
40#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
41#define IOC_INOUT ((_IOC_WRITE | _IOC_READ) << _IOC_DIRSHIFT)
42#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
43#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
44
45#endif