blob: 05f84423a2af2b1c5200ad3401c44b4af5f3077a [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef __LINUX_USB_TMC_H
8#define __LINUX_USB_TMC_H
Christopher Ferris9ce28842018-10-25 12:11:39 -07009#include <linux/types.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070010#define USBTMC_STATUS_SUCCESS 0x01
11#define USBTMC_STATUS_PENDING 0x02
Ben Cheng655a7c02013-10-16 16:09:24 -070012#define USBTMC_STATUS_FAILED 0x80
13#define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81
14#define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82
15#define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83
Ben Cheng655a7c02013-10-16 16:09:24 -070016#define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1
17#define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2
18#define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3
19#define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4
Ben Cheng655a7c02013-10-16 16:09:24 -070020#define USBTMC_REQUEST_INITIATE_CLEAR 5
21#define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6
22#define USBTMC_REQUEST_GET_CAPABILITIES 7
23#define USBTMC_REQUEST_INDICATOR_PULSE 64
Christopher Ferris106b3a82016-08-24 12:15:38 -070024#define USBTMC488_REQUEST_READ_STATUS_BYTE 128
25#define USBTMC488_REQUEST_REN_CONTROL 160
26#define USBTMC488_REQUEST_GOTO_LOCAL 161
27#define USBTMC488_REQUEST_LOCAL_LOCKOUT 162
Christopher Ferris86a48372019-01-10 14:14:59 -080028struct usbtmc_request {
29 __u8 bRequestType;
30 __u8 bRequest;
31 __u16 wValue;
32 __u16 wIndex;
33 __u16 wLength;
34} __attribute__((packed));
35struct usbtmc_ctrlrequest {
36 struct usbtmc_request req;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070037 void * data;
Christopher Ferris86a48372019-01-10 14:14:59 -080038} __attribute__((packed));
Christopher Ferris9ce28842018-10-25 12:11:39 -070039struct usbtmc_termchar {
40 __u8 term_char;
41 __u8 term_char_enabled;
42} __attribute__((packed));
Christopher Ferris86a48372019-01-10 14:14:59 -080043#define USBTMC_FLAG_ASYNC 0x0001
44#define USBTMC_FLAG_APPEND 0x0002
45#define USBTMC_FLAG_IGNORE_TRAILER 0x0004
46struct usbtmc_message {
47 __u32 transfer_size;
48 __u32 transferred;
49 __u32 flags;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070050 void * message;
Christopher Ferris86a48372019-01-10 14:14:59 -080051} __attribute__((packed));
Ben Cheng655a7c02013-10-16 16:09:24 -070052#define USBTMC_IOC_NR 91
53#define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1)
54#define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2)
55#define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3)
Ben Cheng655a7c02013-10-16 16:09:24 -070056#define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4)
57#define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6)
58#define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7)
Christopher Ferris86a48372019-01-10 14:14:59 -080059#define USBTMC_IOCTL_CTRL_REQUEST _IOWR(USBTMC_IOC_NR, 8, struct usbtmc_ctrlrequest)
Christopher Ferris9ce28842018-10-25 12:11:39 -070060#define USBTMC_IOCTL_GET_TIMEOUT _IOR(USBTMC_IOC_NR, 9, __u32)
61#define USBTMC_IOCTL_SET_TIMEOUT _IOW(USBTMC_IOC_NR, 10, __u32)
62#define USBTMC_IOCTL_EOM_ENABLE _IOW(USBTMC_IOC_NR, 11, __u8)
63#define USBTMC_IOCTL_CONFIG_TERMCHAR _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar)
Christopher Ferris86a48372019-01-10 14:14:59 -080064#define USBTMC_IOCTL_WRITE _IOWR(USBTMC_IOC_NR, 13, struct usbtmc_message)
65#define USBTMC_IOCTL_READ _IOWR(USBTMC_IOC_NR, 14, struct usbtmc_message)
66#define USBTMC_IOCTL_WRITE_RESULT _IOWR(USBTMC_IOC_NR, 15, __u32)
67#define USBTMC_IOCTL_API_VERSION _IOR(USBTMC_IOC_NR, 16, __u32)
Christopher Ferris106b3a82016-08-24 12:15:38 -070068#define USBTMC488_IOCTL_GET_CAPS _IOR(USBTMC_IOC_NR, 17, unsigned char)
Christopher Ferris106b3a82016-08-24 12:15:38 -070069#define USBTMC488_IOCTL_READ_STB _IOR(USBTMC_IOC_NR, 18, unsigned char)
70#define USBTMC488_IOCTL_REN_CONTROL _IOW(USBTMC_IOC_NR, 19, unsigned char)
71#define USBTMC488_IOCTL_GOTO_LOCAL _IO(USBTMC_IOC_NR, 20)
72#define USBTMC488_IOCTL_LOCAL_LOCKOUT _IO(USBTMC_IOC_NR, 21)
Christopher Ferris9ce28842018-10-25 12:11:39 -070073#define USBTMC488_IOCTL_TRIGGER _IO(USBTMC_IOC_NR, 22)
Christopher Ferris86a48372019-01-10 14:14:59 -080074#define USBTMC488_IOCTL_WAIT_SRQ _IOW(USBTMC_IOC_NR, 23, __u32)
75#define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8)
76#define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070077#define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8)
78#define USBTMC_IOCTL_GET_SRQ_STB _IOR(USBTMC_IOC_NR, 27, __u8)
Christopher Ferris86a48372019-01-10 14:14:59 -080079#define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35)
80#define USBTMC_IOCTL_CLEANUP_IO _IO(USBTMC_IOC_NR, 36)
Christopher Ferris106b3a82016-08-24 12:15:38 -070081#define USBTMC488_CAPABILITY_TRIGGER 1
82#define USBTMC488_CAPABILITY_SIMPLE 2
83#define USBTMC488_CAPABILITY_REN_CONTROL 2
84#define USBTMC488_CAPABILITY_GOTO_LOCAL 2
Christopher Ferris106b3a82016-08-24 12:15:38 -070085#define USBTMC488_CAPABILITY_LOCAL_LOCKOUT 2
86#define USBTMC488_CAPABILITY_488_DOT_2 4
87#define USBTMC488_CAPABILITY_DT1 16
88#define USBTMC488_CAPABILITY_RL1 32
Christopher Ferris106b3a82016-08-24 12:15:38 -070089#define USBTMC488_CAPABILITY_SR1 64
90#define USBTMC488_CAPABILITY_FULL_SCPI 128
91#endif