cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / linux / usb / tmc.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
4  * Copyright (C) 2008 Novell, Inc.
5  * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
6  * Copyright (C) 2015 Dave Penkler <dpenkler@gmail.com>
7  *
8  * This file holds USB constants defined by the USB Device Class
9  * and USB488 Subclass Definitions for Test and Measurement devices
10  * published by the USB-IF.
11  *
12  * It also has the ioctl and capability definitions for the
13  * usbtmc kernel driver that userspace needs to know about.
14  */
15
16 #ifndef __LINUX_USB_TMC_H
17 #define __LINUX_USB_TMC_H
18
19 #include <linux/types.h>   /* __u8 etc */
20
21 /* USB TMC status values */
22 #define USBTMC_STATUS_SUCCESS                           0x01
23 #define USBTMC_STATUS_PENDING                           0x02
24 #define USBTMC_STATUS_FAILED                            0x80
25 #define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS          0x81
26 #define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS             0x82
27 #define USBTMC_STATUS_SPLIT_IN_PROGRESS                 0x83
28
29 /* USB TMC requests values */
30 #define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT          1
31 #define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS      2
32 #define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN           3
33 #define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS       4
34 #define USBTMC_REQUEST_INITIATE_CLEAR                   5
35 #define USBTMC_REQUEST_CHECK_CLEAR_STATUS               6
36 #define USBTMC_REQUEST_GET_CAPABILITIES                 7
37 #define USBTMC_REQUEST_INDICATOR_PULSE                  64
38 #define USBTMC488_REQUEST_READ_STATUS_BYTE              128
39 #define USBTMC488_REQUEST_REN_CONTROL                   160
40 #define USBTMC488_REQUEST_GOTO_LOCAL                    161
41 #define USBTMC488_REQUEST_LOCAL_LOCKOUT                 162
42
43 struct usbtmc_termchar {
44         __u8 term_char;
45         __u8 term_char_enabled;
46 } __attribute__ ((packed));
47
48 /* Request values for USBTMC driver's ioctl entry point */
49 #define USBTMC_IOC_NR                   91
50 #define USBTMC_IOCTL_INDICATOR_PULSE    _IO(USBTMC_IOC_NR, 1)
51 #define USBTMC_IOCTL_CLEAR              _IO(USBTMC_IOC_NR, 2)
52 #define USBTMC_IOCTL_ABORT_BULK_OUT     _IO(USBTMC_IOC_NR, 3)
53 #define USBTMC_IOCTL_ABORT_BULK_IN      _IO(USBTMC_IOC_NR, 4)
54 #define USBTMC_IOCTL_CLEAR_OUT_HALT     _IO(USBTMC_IOC_NR, 6)
55 #define USBTMC_IOCTL_CLEAR_IN_HALT      _IO(USBTMC_IOC_NR, 7)
56 #define USBTMC_IOCTL_GET_TIMEOUT        _IOR(USBTMC_IOC_NR, 9, __u32)
57 #define USBTMC_IOCTL_SET_TIMEOUT        _IOW(USBTMC_IOC_NR, 10, __u32)
58 #define USBTMC_IOCTL_EOM_ENABLE         _IOW(USBTMC_IOC_NR, 11, __u8)
59 #define USBTMC_IOCTL_CONFIG_TERMCHAR    _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar)
60
61 #define USBTMC488_IOCTL_GET_CAPS        _IOR(USBTMC_IOC_NR, 17, unsigned char)
62 #define USBTMC488_IOCTL_READ_STB        _IOR(USBTMC_IOC_NR, 18, unsigned char)
63 #define USBTMC488_IOCTL_REN_CONTROL     _IOW(USBTMC_IOC_NR, 19, unsigned char)
64 #define USBTMC488_IOCTL_GOTO_LOCAL      _IO(USBTMC_IOC_NR, 20)
65 #define USBTMC488_IOCTL_LOCAL_LOCKOUT   _IO(USBTMC_IOC_NR, 21)
66 #define USBTMC488_IOCTL_TRIGGER         _IO(USBTMC_IOC_NR, 22)
67
68 /* Driver encoded usb488 capabilities */
69 #define USBTMC488_CAPABILITY_TRIGGER         1
70 #define USBTMC488_CAPABILITY_SIMPLE          2
71 #define USBTMC488_CAPABILITY_REN_CONTROL     2
72 #define USBTMC488_CAPABILITY_GOTO_LOCAL      2
73 #define USBTMC488_CAPABILITY_LOCAL_LOCKOUT   2
74 #define USBTMC488_CAPABILITY_488_DOT_2       4
75 #define USBTMC488_CAPABILITY_DT1             16
76 #define USBTMC488_CAPABILITY_RL1             32
77 #define USBTMC488_CAPABILITY_SR1             64
78 #define USBTMC488_CAPABILITY_FULL_SCPI       128
79
80 #endif