Deleted Added
full compact
usb_ioctl.h (250201) usb_ioctl.h (254243)
1/* $FreeBSD: head/sys/dev/usb/usb_ioctl.h 250201 2013-05-03 07:44:58Z hselasky $ */
1/* $FreeBSD: head/sys/dev/usb/usb_ioctl.h 254243 2013-08-12 09:17:48Z hselasky $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
5 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 16 unchanged lines hidden (view full) ---

26 * SUCH DAMAGE.
27 */
28
29#ifndef _USB_IOCTL_H_
30#define _USB_IOCTL_H_
31
32#ifndef USB_GLOBAL_INCLUDE_FILE
33#include <sys/ioccom.h>
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
5 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 16 unchanged lines hidden (view full) ---

26 * SUCH DAMAGE.
27 */
28
29#ifndef _USB_IOCTL_H_
30#define _USB_IOCTL_H_
31
32#ifndef USB_GLOBAL_INCLUDE_FILE
33#include <sys/ioccom.h>
34#include <sys/cdefs.h>
34
35/* Building "kdump" depends on these includes */
36
37#include <dev/usb/usb_endian.h>
38#include <dev/usb/usb.h>
39#endif
40
41#define USB_DEVICE_NAME "usbctl"
42#define USB_DEVICE_DIR "usb"
43#define USB_GENERIC_NAME "ugen"
44#define USB_TEMPLATE_SYSCTL "hw.usb.template" /* integer type */
45
35
36/* Building "kdump" depends on these includes */
37
38#include <dev/usb/usb_endian.h>
39#include <dev/usb/usb.h>
40#endif
41
42#define USB_DEVICE_NAME "usbctl"
43#define USB_DEVICE_DIR "usb"
44#define USB_GENERIC_NAME "ugen"
45#define USB_TEMPLATE_SYSCTL "hw.usb.template" /* integer type */
46
47/*
48 * Align IOCTL structures to hide differences when running 32-bit
49 * programs under 64-bit kernels:
50 */
51#ifdef COMPAT_32BIT
52#define USB_IOCTL_STRUCT_ALIGN(n) __aligned(n)
53#else
54#define USB_IOCTL_STRUCT_ALIGN(n)
55#endif
56
46/* Definition of valid template sysctl values */
47
48enum {
49 USB_TEMP_MSC, /* USB Mass Storage */
50 USB_TEMP_CDCE, /* USB CDC Ethernet */
51 USB_TEMP_MTP, /* Message Transfer Protocol */
52 USB_TEMP_MODEM, /* USB CDC Modem */
53 USB_TEMP_AUDIO, /* USB Audio */

--- 5 unchanged lines hidden (view full) ---

59struct usb_read_dir {
60#ifdef COMPAT_32BIT
61 uint64_t urd_data;
62#else
63 void *urd_data;
64#endif
65 uint32_t urd_startentry;
66 uint32_t urd_maxlen;
57/* Definition of valid template sysctl values */
58
59enum {
60 USB_TEMP_MSC, /* USB Mass Storage */
61 USB_TEMP_CDCE, /* USB CDC Ethernet */
62 USB_TEMP_MTP, /* Message Transfer Protocol */
63 USB_TEMP_MODEM, /* USB CDC Modem */
64 USB_TEMP_AUDIO, /* USB Audio */

--- 5 unchanged lines hidden (view full) ---

70struct usb_read_dir {
71#ifdef COMPAT_32BIT
72 uint64_t urd_data;
73#else
74 void *urd_data;
75#endif
76 uint32_t urd_startentry;
77 uint32_t urd_maxlen;
67};
78} USB_IOCTL_STRUCT_ALIGN(8);
68
69struct usb_ctl_request {
70#ifdef COMPAT_32BIT
71 uint64_t ucr_data;
72#else
73 void *ucr_data;
74#endif
75 uint16_t ucr_flags;
76 uint16_t ucr_actlen; /* actual length transferred */
77 uint8_t ucr_addr; /* zero - currently not used */
78 struct usb_device_request ucr_request;
79
80struct usb_ctl_request {
81#ifdef COMPAT_32BIT
82 uint64_t ucr_data;
83#else
84 void *ucr_data;
85#endif
86 uint16_t ucr_flags;
87 uint16_t ucr_actlen; /* actual length transferred */
88 uint8_t ucr_addr; /* zero - currently not used */
89 struct usb_device_request ucr_request;
79};
90} USB_IOCTL_STRUCT_ALIGN(8);
80
81struct usb_alt_interface {
82 uint8_t uai_interface_index;
83 uint8_t uai_alt_index;
91
92struct usb_alt_interface {
93 uint8_t uai_interface_index;
94 uint8_t uai_alt_index;
84};
95} USB_IOCTL_STRUCT_ALIGN(1);
85
86struct usb_gen_descriptor {
87#ifdef COMPAT_32BIT
88 uint64_t ugd_data;
89#else
90 void *ugd_data;
91#endif
92 uint16_t ugd_lang_id;
93 uint16_t ugd_maxlen;
94 uint16_t ugd_actlen;
95 uint16_t ugd_offset;
96 uint8_t ugd_config_index;
97 uint8_t ugd_string_index;
98 uint8_t ugd_iface_index;
99 uint8_t ugd_altif_index;
100 uint8_t ugd_endpt_index;
101 uint8_t ugd_report_type;
102 uint8_t reserved[8];
96
97struct usb_gen_descriptor {
98#ifdef COMPAT_32BIT
99 uint64_t ugd_data;
100#else
101 void *ugd_data;
102#endif
103 uint16_t ugd_lang_id;
104 uint16_t ugd_maxlen;
105 uint16_t ugd_actlen;
106 uint16_t ugd_offset;
107 uint8_t ugd_config_index;
108 uint8_t ugd_string_index;
109 uint8_t ugd_iface_index;
110 uint8_t ugd_altif_index;
111 uint8_t ugd_endpt_index;
112 uint8_t ugd_report_type;
113 uint8_t reserved[8];
103};
114} USB_IOCTL_STRUCT_ALIGN(8);
104
105struct usb_device_info {
106 uint16_t udi_productNo;
107 uint16_t udi_vendorNo;
108 uint16_t udi_releaseNo;
109 uint16_t udi_power; /* power consumption in mA, 0 if
110 * selfpowered */
111 uint8_t udi_bus;

--- 12 unchanged lines hidden (view full) ---

124 uint8_t udi_hubport; /* parent HUB port */
125 uint8_t udi_power_mode; /* see "USB_POWER_MODE_XXX" */
126 uint8_t udi_suspended; /* set if device is suspended */
127 uint8_t udi_reserved[16]; /* leave space for the future */
128 char udi_product[128];
129 char udi_vendor[128];
130 char udi_serial[64];
131 char udi_release[8];
115
116struct usb_device_info {
117 uint16_t udi_productNo;
118 uint16_t udi_vendorNo;
119 uint16_t udi_releaseNo;
120 uint16_t udi_power; /* power consumption in mA, 0 if
121 * selfpowered */
122 uint8_t udi_bus;

--- 12 unchanged lines hidden (view full) ---

135 uint8_t udi_hubport; /* parent HUB port */
136 uint8_t udi_power_mode; /* see "USB_POWER_MODE_XXX" */
137 uint8_t udi_suspended; /* set if device is suspended */
138 uint8_t udi_reserved[16]; /* leave space for the future */
139 char udi_product[128];
140 char udi_vendor[128];
141 char udi_serial[64];
142 char udi_release[8];
132};
143} USB_IOCTL_STRUCT_ALIGN(2);
133
134#define USB_DEVICE_PORT_PATH_MAX 32
135
136struct usb_device_port_path {
137 uint8_t udp_bus; /* which bus we are on */
138 uint8_t udp_index; /* which device index */
139 uint8_t udp_port_level; /* how many levels: 0, 1, 2 ... */
140 uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX];
144
145#define USB_DEVICE_PORT_PATH_MAX 32
146
147struct usb_device_port_path {
148 uint8_t udp_bus; /* which bus we are on */
149 uint8_t udp_index; /* which device index */
150 uint8_t udp_port_level; /* how many levels: 0, 1, 2 ... */
151 uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX];
141};
152} USB_IOCTL_STRUCT_ALIGN(1);
142
143struct usb_device_stats {
144 uint32_t uds_requests_ok[4]; /* Indexed by transfer type UE_XXX */
145 uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */
153
154struct usb_device_stats {
155 uint32_t uds_requests_ok[4]; /* Indexed by transfer type UE_XXX */
156 uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */
146};
157} USB_IOCTL_STRUCT_ALIGN(4);
147
148struct usb_fs_start {
149 uint8_t ep_index;
158
159struct usb_fs_start {
160 uint8_t ep_index;
150};
161} USB_IOCTL_STRUCT_ALIGN(1);
151
152struct usb_fs_stop {
153 uint8_t ep_index;
162
163struct usb_fs_stop {
164 uint8_t ep_index;
154};
165} USB_IOCTL_STRUCT_ALIGN(1);
155
156struct usb_fs_complete {
157 uint8_t ep_index;
166
167struct usb_fs_complete {
168 uint8_t ep_index;
158};
169} USB_IOCTL_STRUCT_ALIGN(1);
159
160/* This structure is used for all endpoint types */
161struct usb_fs_endpoint {
162 /*
163 * NOTE: isochronous USB transfer only use one buffer, but can have
164 * multiple frame lengths !
165 */
166#ifdef COMPAT_32BIT

--- 16 unchanged lines hidden (view full) ---

183 /* will do a clear-stall before xfer */
184#define USB_FS_FLAG_CLEAR_STALL 0x0008
185 uint16_t timeout; /* in milliseconds */
186 /* isocronous completion time in milliseconds - used for echo cancel */
187 uint16_t isoc_time_complete;
188 /* timeout value for no timeout */
189#define USB_FS_TIMEOUT_NONE 0
190 int status; /* see USB_ERR_XXX */
170
171/* This structure is used for all endpoint types */
172struct usb_fs_endpoint {
173 /*
174 * NOTE: isochronous USB transfer only use one buffer, but can have
175 * multiple frame lengths !
176 */
177#ifdef COMPAT_32BIT

--- 16 unchanged lines hidden (view full) ---

194 /* will do a clear-stall before xfer */
195#define USB_FS_FLAG_CLEAR_STALL 0x0008
196 uint16_t timeout; /* in milliseconds */
197 /* isocronous completion time in milliseconds - used for echo cancel */
198 uint16_t isoc_time_complete;
199 /* timeout value for no timeout */
200#define USB_FS_TIMEOUT_NONE 0
201 int status; /* see USB_ERR_XXX */
191};
202} USB_IOCTL_STRUCT_ALIGN(8);
192
193struct usb_fs_init {
194 /* userland pointer to endpoints structure */
195#ifdef COMPAT_32BIT
196 uint64_t pEndpoints;
197#else
198 struct usb_fs_endpoint *pEndpoints;
199#endif
200 /* maximum number of endpoints */
201 uint8_t ep_index_max;
203
204struct usb_fs_init {
205 /* userland pointer to endpoints structure */
206#ifdef COMPAT_32BIT
207 uint64_t pEndpoints;
208#else
209 struct usb_fs_endpoint *pEndpoints;
210#endif
211 /* maximum number of endpoints */
212 uint8_t ep_index_max;
202};
213} USB_IOCTL_STRUCT_ALIGN(8);
203
204struct usb_fs_uninit {
205 uint8_t dummy; /* zero */
214
215struct usb_fs_uninit {
216 uint8_t dummy; /* zero */
206};
217} USB_IOCTL_STRUCT_ALIGN(1);
207
208struct usb_fs_open {
209#define USB_FS_MAX_BUFSIZE (1 << 18)
210 uint32_t max_bufsize;
211#define USB_FS_MAX_FRAMES (1U << 12)
212#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */
213 uint32_t max_frames; /* read and write */
214 uint16_t max_packet_length; /* read only */
215 uint8_t dev_index; /* currently unused */
216 uint8_t ep_index;
217 uint8_t ep_no; /* bEndpointNumber */
218
219struct usb_fs_open {
220#define USB_FS_MAX_BUFSIZE (1 << 18)
221 uint32_t max_bufsize;
222#define USB_FS_MAX_FRAMES (1U << 12)
223#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */
224 uint32_t max_frames; /* read and write */
225 uint16_t max_packet_length; /* read only */
226 uint8_t dev_index; /* currently unused */
227 uint8_t ep_index;
228 uint8_t ep_no; /* bEndpointNumber */
218};
229} USB_IOCTL_STRUCT_ALIGN(4);
219
220struct usb_fs_open_stream {
221 struct usb_fs_open fs_open;
230
231struct usb_fs_open_stream {
232 struct usb_fs_open fs_open;
222 uint16_t stream_id;
223};
233 uint16_t stream_id; /* stream ID */
234} USB_IOCTL_STRUCT_ALIGN(4);
224
225struct usb_fs_close {
226 uint8_t ep_index;
235
236struct usb_fs_close {
237 uint8_t ep_index;
227};
238} USB_IOCTL_STRUCT_ALIGN(1);
228
229struct usb_fs_clear_stall_sync {
230 uint8_t ep_index;
239
240struct usb_fs_clear_stall_sync {
241 uint8_t ep_index;
231};
242} USB_IOCTL_STRUCT_ALIGN(1);
232
233struct usb_gen_quirk {
234 uint16_t index; /* Quirk Index */
235 uint16_t vid; /* Vendor ID */
236 uint16_t pid; /* Product ID */
237 uint16_t bcdDeviceLow; /* Low Device Revision */
238 uint16_t bcdDeviceHigh; /* High Device Revision */
239 uint16_t reserved[2];
240 /*
243
244struct usb_gen_quirk {
245 uint16_t index; /* Quirk Index */
246 uint16_t vid; /* Vendor ID */
247 uint16_t pid; /* Product ID */
248 uint16_t bcdDeviceLow; /* Low Device Revision */
249 uint16_t bcdDeviceHigh; /* High Device Revision */
250 uint16_t reserved[2];
251 /*
241 * String version of quirk including terminating zero. See UQ_XXX in
242 * "usb_quirk.h".
252 * String version of quirk including terminating zero. See
253 * UQ_XXX in "usb_quirk.h".
243 */
244 char quirkname[64 - 14];
254 */
255 char quirkname[64 - 14];
245};
256} USB_IOCTL_STRUCT_ALIGN(2);
246
247/* USB controller */
248#define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request)
249#define USB_SETDEBUG _IOW ('U', 2, int)
250#define USB_DISCOVER _IO ('U', 3)
251#define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info)
252#define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats)
253#define USB_DEVICEENUMERATE _IOW ('U', 6, int)

--- 78 unchanged lines hidden ---
257
258/* USB controller */
259#define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request)
260#define USB_SETDEBUG _IOW ('U', 2, int)
261#define USB_DISCOVER _IO ('U', 3)
262#define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info)
263#define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats)
264#define USB_DEVICEENUMERATE _IOW ('U', 6, int)

--- 78 unchanged lines hidden ---