xref: /OK3568_Linux_fs/kernel/include/uapi/linux/userio.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * userio: virtual serio device support
4*4882a593Smuzhiyun  * Copyright (C) 2015 Red Hat
5*4882a593Smuzhiyun  * Copyright (C) 2015 Lyude (Stephen Chandler Paul) <cpaul@redhat.com>
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify it
8*4882a593Smuzhiyun  * under the terms of the GNU Lesser General Public License as published by the
9*4882a593Smuzhiyun  * Free Software Foundation; either version 2 of the License, or (at your
10*4882a593Smuzhiyun  * option) any later version.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful, but WITHOUT
13*4882a593Smuzhiyun  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14*4882a593Smuzhiyun  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15*4882a593Smuzhiyun  * details.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * This is the public header used for user-space communication with the userio
18*4882a593Smuzhiyun  * driver. __attribute__((__packed__)) is used for all structs to keep ABI
19*4882a593Smuzhiyun  * compatibility between all architectures.
20*4882a593Smuzhiyun  */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #ifndef _USERIO_H
23*4882a593Smuzhiyun #define _USERIO_H
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #include <linux/types.h>
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun enum userio_cmd_type {
28*4882a593Smuzhiyun 	USERIO_CMD_REGISTER = 0,
29*4882a593Smuzhiyun 	USERIO_CMD_SET_PORT_TYPE = 1,
30*4882a593Smuzhiyun 	USERIO_CMD_SEND_INTERRUPT = 2
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun /*
34*4882a593Smuzhiyun  * userio Commands
35*4882a593Smuzhiyun  * All commands sent to /dev/userio are encoded using this structure. The type
36*4882a593Smuzhiyun  * field should contain a USERIO_CMD* value that indicates what kind of command
37*4882a593Smuzhiyun  * is being sent to userio. The data field should contain the accompanying
38*4882a593Smuzhiyun  * argument for the command, if there is one.
39*4882a593Smuzhiyun  */
40*4882a593Smuzhiyun struct userio_cmd {
41*4882a593Smuzhiyun 	__u8 type;
42*4882a593Smuzhiyun 	__u8 data;
43*4882a593Smuzhiyun } __attribute__((__packed__));
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif /* !_USERIO_H */
46