root / hw / usb.h @ 9f107513
History | View | Annotate | Download (9.4 kB)
1 | bb36d470 | bellard | /*
|
---|---|---|---|
2 | bb36d470 | bellard | * QEMU USB API
|
3 | 5fafdf24 | ths | *
|
4 | bb36d470 | bellard | * Copyright (c) 2005 Fabrice Bellard
|
5 | 5fafdf24 | ths | *
|
6 | bb36d470 | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | bb36d470 | bellard | * of this software and associated documentation files (the "Software"), to deal
|
8 | bb36d470 | bellard | * in the Software without restriction, including without limitation the rights
|
9 | bb36d470 | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | bb36d470 | bellard | * copies of the Software, and to permit persons to whom the Software is
|
11 | bb36d470 | bellard | * furnished to do so, subject to the following conditions:
|
12 | bb36d470 | bellard | *
|
13 | bb36d470 | bellard | * The above copyright notice and this permission notice shall be included in
|
14 | bb36d470 | bellard | * all copies or substantial portions of the Software.
|
15 | bb36d470 | bellard | *
|
16 | bb36d470 | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | bb36d470 | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | bb36d470 | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | bb36d470 | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | bb36d470 | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | bb36d470 | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | bb36d470 | bellard | * THE SOFTWARE.
|
23 | bb36d470 | bellard | */
|
24 | c0f4ce77 | aliguori | |
25 | c0f4ce77 | aliguori | #include "block.h" |
26 | 806b6024 | Gerd Hoffmann | #include "qdev.h" |
27 | 72cf2d4f | Blue Swirl | #include "qemu-queue.h" |
28 | c0f4ce77 | aliguori | |
29 | bb36d470 | bellard | #define USB_TOKEN_SETUP 0x2d |
30 | bb36d470 | bellard | #define USB_TOKEN_IN 0x69 /* device -> host */ |
31 | bb36d470 | bellard | #define USB_TOKEN_OUT 0xe1 /* host -> device */ |
32 | bb36d470 | bellard | |
33 | bb36d470 | bellard | /* specific usb messages, also sent in the 'pid' parameter */
|
34 | bb36d470 | bellard | #define USB_MSG_ATTACH 0x100 |
35 | bb36d470 | bellard | #define USB_MSG_DETACH 0x101 |
36 | bb36d470 | bellard | #define USB_MSG_RESET 0x102 |
37 | bb36d470 | bellard | |
38 | 5fafdf24 | ths | #define USB_RET_NODEV (-1) |
39 | bb36d470 | bellard | #define USB_RET_NAK (-2) |
40 | bb36d470 | bellard | #define USB_RET_STALL (-3) |
41 | bb36d470 | bellard | #define USB_RET_BABBLE (-4) |
42 | 4d611c9a | pbrook | #define USB_RET_ASYNC (-5) |
43 | bb36d470 | bellard | |
44 | bb36d470 | bellard | #define USB_SPEED_LOW 0 |
45 | bb36d470 | bellard | #define USB_SPEED_FULL 1 |
46 | bb36d470 | bellard | #define USB_SPEED_HIGH 2 |
47 | bb36d470 | bellard | |
48 | bb36d470 | bellard | #define USB_STATE_NOTATTACHED 0 |
49 | bb36d470 | bellard | #define USB_STATE_ATTACHED 1 |
50 | bb36d470 | bellard | //#define USB_STATE_POWERED 2
|
51 | bb36d470 | bellard | #define USB_STATE_DEFAULT 3 |
52 | bb36d470 | bellard | //#define USB_STATE_ADDRESS 4
|
53 | bb36d470 | bellard | //#define USB_STATE_CONFIGURED 5
|
54 | bb36d470 | bellard | #define USB_STATE_SUSPENDED 6 |
55 | bb36d470 | bellard | |
56 | a594cfbf | bellard | #define USB_CLASS_AUDIO 1 |
57 | a594cfbf | bellard | #define USB_CLASS_COMM 2 |
58 | a594cfbf | bellard | #define USB_CLASS_HID 3 |
59 | a594cfbf | bellard | #define USB_CLASS_PHYSICAL 5 |
60 | a594cfbf | bellard | #define USB_CLASS_STILL_IMAGE 6 |
61 | a594cfbf | bellard | #define USB_CLASS_PRINTER 7 |
62 | a594cfbf | bellard | #define USB_CLASS_MASS_STORAGE 8 |
63 | a594cfbf | bellard | #define USB_CLASS_HUB 9 |
64 | a594cfbf | bellard | #define USB_CLASS_CDC_DATA 0x0a |
65 | a594cfbf | bellard | #define USB_CLASS_CSCID 0x0b |
66 | a594cfbf | bellard | #define USB_CLASS_CONTENT_SEC 0x0d |
67 | a594cfbf | bellard | #define USB_CLASS_APP_SPEC 0xfe |
68 | a594cfbf | bellard | #define USB_CLASS_VENDOR_SPEC 0xff |
69 | a594cfbf | bellard | |
70 | bb36d470 | bellard | #define USB_DIR_OUT 0 |
71 | bb36d470 | bellard | #define USB_DIR_IN 0x80 |
72 | bb36d470 | bellard | |
73 | bb36d470 | bellard | #define USB_TYPE_MASK (0x03 << 5) |
74 | bb36d470 | bellard | #define USB_TYPE_STANDARD (0x00 << 5) |
75 | bb36d470 | bellard | #define USB_TYPE_CLASS (0x01 << 5) |
76 | bb36d470 | bellard | #define USB_TYPE_VENDOR (0x02 << 5) |
77 | bb36d470 | bellard | #define USB_TYPE_RESERVED (0x03 << 5) |
78 | bb36d470 | bellard | |
79 | bb36d470 | bellard | #define USB_RECIP_MASK 0x1f |
80 | bb36d470 | bellard | #define USB_RECIP_DEVICE 0x00 |
81 | bb36d470 | bellard | #define USB_RECIP_INTERFACE 0x01 |
82 | bb36d470 | bellard | #define USB_RECIP_ENDPOINT 0x02 |
83 | bb36d470 | bellard | #define USB_RECIP_OTHER 0x03 |
84 | bb36d470 | bellard | |
85 | bb36d470 | bellard | #define DeviceRequest ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8) |
86 | bb36d470 | bellard | #define DeviceOutRequest ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8) |
87 | 59ae540c | bellard | #define InterfaceRequest \
|
88 | 59ae540c | bellard | ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
|
89 | 59ae540c | bellard | #define InterfaceOutRequest \
|
90 | 59ae540c | bellard | ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
|
91 | 59ae540c | bellard | #define EndpointRequest ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8) |
92 | 59ae540c | bellard | #define EndpointOutRequest \
|
93 | 59ae540c | bellard | ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8)
|
94 | f3571b1a | Max Reitz | #define ClassInterfaceRequest \
|
95 | f3571b1a | Max Reitz | ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
|
96 | f3571b1a | Max Reitz | #define ClassInterfaceOutRequest \
|
97 | f3571b1a | Max Reitz | ((USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
|
98 | bb36d470 | bellard | |
99 | bb36d470 | bellard | #define USB_REQ_GET_STATUS 0x00 |
100 | bb36d470 | bellard | #define USB_REQ_CLEAR_FEATURE 0x01 |
101 | bb36d470 | bellard | #define USB_REQ_SET_FEATURE 0x03 |
102 | bb36d470 | bellard | #define USB_REQ_SET_ADDRESS 0x05 |
103 | bb36d470 | bellard | #define USB_REQ_GET_DESCRIPTOR 0x06 |
104 | bb36d470 | bellard | #define USB_REQ_SET_DESCRIPTOR 0x07 |
105 | bb36d470 | bellard | #define USB_REQ_GET_CONFIGURATION 0x08 |
106 | bb36d470 | bellard | #define USB_REQ_SET_CONFIGURATION 0x09 |
107 | bb36d470 | bellard | #define USB_REQ_GET_INTERFACE 0x0A |
108 | bb36d470 | bellard | #define USB_REQ_SET_INTERFACE 0x0B |
109 | bb36d470 | bellard | #define USB_REQ_SYNCH_FRAME 0x0C |
110 | bb36d470 | bellard | |
111 | bb36d470 | bellard | #define USB_DEVICE_SELF_POWERED 0 |
112 | bb36d470 | bellard | #define USB_DEVICE_REMOTE_WAKEUP 1 |
113 | bb36d470 | bellard | |
114 | bb36d470 | bellard | #define USB_DT_DEVICE 0x01 |
115 | bb36d470 | bellard | #define USB_DT_CONFIG 0x02 |
116 | bb36d470 | bellard | #define USB_DT_STRING 0x03 |
117 | bb36d470 | bellard | #define USB_DT_INTERFACE 0x04 |
118 | bb36d470 | bellard | #define USB_DT_ENDPOINT 0x05 |
119 | bb36d470 | bellard | |
120 | 942ac052 | balrog | #define USB_ENDPOINT_XFER_CONTROL 0 |
121 | 942ac052 | balrog | #define USB_ENDPOINT_XFER_ISOC 1 |
122 | 942ac052 | balrog | #define USB_ENDPOINT_XFER_BULK 2 |
123 | 942ac052 | balrog | #define USB_ENDPOINT_XFER_INT 3 |
124 | 942ac052 | balrog | |
125 | 806b6024 | Gerd Hoffmann | typedef struct USBBus USBBus; |
126 | bb36d470 | bellard | typedef struct USBPort USBPort; |
127 | bb36d470 | bellard | typedef struct USBDevice USBDevice; |
128 | 806b6024 | Gerd Hoffmann | typedef struct USBDeviceInfo USBDeviceInfo; |
129 | 4d611c9a | pbrook | typedef struct USBPacket USBPacket; |
130 | bb36d470 | bellard | |
131 | bb36d470 | bellard | /* definition of a USB device */
|
132 | bb36d470 | bellard | struct USBDevice {
|
133 | 806b6024 | Gerd Hoffmann | DeviceState qdev; |
134 | 806b6024 | Gerd Hoffmann | USBDeviceInfo *info; |
135 | bb36d470 | bellard | void *opaque;
|
136 | 89b9b79f | aliguori | |
137 | 806b6024 | Gerd Hoffmann | int speed;
|
138 | 806b6024 | Gerd Hoffmann | uint8_t addr; |
139 | 0fe6d12e | Markus Armbruster | char product_desc[32]; |
140 | 61e094c0 | Gerd Hoffmann | int auto_attach;
|
141 | a5d2f727 | Gerd Hoffmann | int attached;
|
142 | 806b6024 | Gerd Hoffmann | |
143 | 806b6024 | Gerd Hoffmann | int state;
|
144 | 806b6024 | Gerd Hoffmann | uint8_t setup_buf[8];
|
145 | 806b6024 | Gerd Hoffmann | uint8_t data_buf[1024];
|
146 | 806b6024 | Gerd Hoffmann | int remote_wakeup;
|
147 | 806b6024 | Gerd Hoffmann | int setup_state;
|
148 | 806b6024 | Gerd Hoffmann | int setup_len;
|
149 | 806b6024 | Gerd Hoffmann | int setup_index;
|
150 | 806b6024 | Gerd Hoffmann | }; |
151 | 806b6024 | Gerd Hoffmann | |
152 | 806b6024 | Gerd Hoffmann | struct USBDeviceInfo {
|
153 | 806b6024 | Gerd Hoffmann | DeviceInfo qdev; |
154 | 806b6024 | Gerd Hoffmann | int (*init)(USBDevice *dev);
|
155 | 806b6024 | Gerd Hoffmann | |
156 | 806b6024 | Gerd Hoffmann | /*
|
157 | 806b6024 | Gerd Hoffmann | * Process USB packet.
|
158 | 89b9b79f | aliguori | * Called by the HC (Host Controller).
|
159 | 89b9b79f | aliguori | *
|
160 | 806b6024 | Gerd Hoffmann | * Returns length of the transaction
|
161 | 89b9b79f | aliguori | * or one of the USB_RET_XXX codes.
|
162 | 806b6024 | Gerd Hoffmann | */
|
163 | 4d611c9a | pbrook | int (*handle_packet)(USBDevice *dev, USBPacket *p);
|
164 | 89b9b79f | aliguori | |
165 | 806b6024 | Gerd Hoffmann | /*
|
166 | 89b9b79f | aliguori | * Called when device is destroyed.
|
167 | 89b9b79f | aliguori | */
|
168 | 059809e4 | bellard | void (*handle_destroy)(USBDevice *dev);
|
169 | 059809e4 | bellard | |
170 | 89b9b79f | aliguori | /*
|
171 | 89b9b79f | aliguori | * Reset the device
|
172 | 806b6024 | Gerd Hoffmann | */
|
173 | 059809e4 | bellard | void (*handle_reset)(USBDevice *dev);
|
174 | 89b9b79f | aliguori | |
175 | 89b9b79f | aliguori | /*
|
176 | 89b9b79f | aliguori | * Process control request.
|
177 | 89b9b79f | aliguori | * Called from handle_packet().
|
178 | 89b9b79f | aliguori | *
|
179 | 89b9b79f | aliguori | * Returns length or one of the USB_RET_ codes.
|
180 | 89b9b79f | aliguori | */
|
181 | bb36d470 | bellard | int (*handle_control)(USBDevice *dev, int request, int value, |
182 | bb36d470 | bellard | int index, int length, uint8_t *data); |
183 | 89b9b79f | aliguori | |
184 | 89b9b79f | aliguori | /*
|
185 | 89b9b79f | aliguori | * Process data transfers (both BULK and ISOC).
|
186 | 89b9b79f | aliguori | * Called from handle_packet().
|
187 | 89b9b79f | aliguori | *
|
188 | 89b9b79f | aliguori | * Returns length or one of the USB_RET_ codes.
|
189 | 89b9b79f | aliguori | */
|
190 | 4d611c9a | pbrook | int (*handle_data)(USBDevice *dev, USBPacket *p);
|
191 | 0958b4cc | Gerd Hoffmann | |
192 | 06384698 | Markus Armbruster | const char *product_desc; |
193 | 06384698 | Markus Armbruster | |
194 | 0958b4cc | Gerd Hoffmann | /* handle legacy -usbdevice command line options */
|
195 | 0958b4cc | Gerd Hoffmann | const char *usbdevice_name; |
196 | 0958b4cc | Gerd Hoffmann | USBDevice *(*usbdevice_init)(const char *params); |
197 | bb36d470 | bellard | }; |
198 | bb36d470 | bellard | |
199 | 0d92ed30 | pbrook | typedef void (*usb_attachfn)(USBPort *port, USBDevice *dev); |
200 | 0d92ed30 | pbrook | |
201 | bb36d470 | bellard | /* USB port on which a device can be connected */
|
202 | bb36d470 | bellard | struct USBPort {
|
203 | a594cfbf | bellard | USBDevice *dev; |
204 | 0d92ed30 | pbrook | usb_attachfn attach; |
205 | bb36d470 | bellard | void *opaque;
|
206 | bb36d470 | bellard | int index; /* internal port index, may be used with the opaque */ |
207 | 72cf2d4f | Blue Swirl | QTAILQ_ENTRY(USBPort) next; |
208 | bb36d470 | bellard | }; |
209 | bb36d470 | bellard | |
210 | 4d611c9a | pbrook | typedef void USBCallback(USBPacket * packet, void *opaque); |
211 | 4d611c9a | pbrook | |
212 | 4d611c9a | pbrook | /* Structure used to hold information about an active USB packet. */
|
213 | 4d611c9a | pbrook | struct USBPacket {
|
214 | 4d611c9a | pbrook | /* Data fields for use by the driver. */
|
215 | 4d611c9a | pbrook | int pid;
|
216 | 4d611c9a | pbrook | uint8_t devaddr; |
217 | 4d611c9a | pbrook | uint8_t devep; |
218 | 4d611c9a | pbrook | uint8_t *data; |
219 | 4d611c9a | pbrook | int len;
|
220 | 4d611c9a | pbrook | /* Internal use by the USB layer. */
|
221 | 4d611c9a | pbrook | USBCallback *complete_cb; |
222 | 4d611c9a | pbrook | void *complete_opaque;
|
223 | 4d611c9a | pbrook | USBCallback *cancel_cb; |
224 | b63891a0 | ths | void *cancel_opaque;
|
225 | 4d611c9a | pbrook | }; |
226 | 4d611c9a | pbrook | |
227 | 4d611c9a | pbrook | /* Defer completion of a USB packet. The hadle_packet routine should then
|
228 | 4d611c9a | pbrook | return USB_RET_ASYNC. Packets that complete immediately (before
|
229 | 4d611c9a | pbrook | handle_packet returns) should not call this method. */
|
230 | 4d611c9a | pbrook | static inline void usb_defer_packet(USBPacket *p, USBCallback *cancel, |
231 | 4d611c9a | pbrook | void * opaque)
|
232 | 4d611c9a | pbrook | { |
233 | 4d611c9a | pbrook | p->cancel_cb = cancel; |
234 | 4d611c9a | pbrook | p->cancel_opaque = opaque; |
235 | 4d611c9a | pbrook | } |
236 | 4d611c9a | pbrook | |
237 | 4d611c9a | pbrook | /* Notify the controller that an async packet is complete. This should only
|
238 | 4d611c9a | pbrook | be called for packets previously deferred with usb_defer_packet, and
|
239 | 4d611c9a | pbrook | should never be called from within handle_packet. */
|
240 | 4d611c9a | pbrook | static inline void usb_packet_complete(USBPacket *p) |
241 | 4d611c9a | pbrook | { |
242 | 4d611c9a | pbrook | p->complete_cb(p, p->complete_opaque); |
243 | 4d611c9a | pbrook | } |
244 | 4d611c9a | pbrook | |
245 | 4d611c9a | pbrook | /* Cancel an active packet. The packed must have been deferred with
|
246 | 4d611c9a | pbrook | usb_defer_packet, and not yet completed. */
|
247 | 4d611c9a | pbrook | static inline void usb_cancel_packet(USBPacket * p) |
248 | 4d611c9a | pbrook | { |
249 | 4d611c9a | pbrook | p->cancel_cb(p, p->cancel_opaque); |
250 | 4d611c9a | pbrook | } |
251 | 4d611c9a | pbrook | |
252 | bb36d470 | bellard | void usb_attach(USBPort *port, USBDevice *dev);
|
253 | 4d611c9a | pbrook | int usb_generic_handle_packet(USBDevice *s, USBPacket *p);
|
254 | bb36d470 | bellard | int set_usb_string(uint8_t *buf, const char *str); |
255 | 4d611c9a | pbrook | void usb_send_msg(USBDevice *dev, int msg); |
256 | 4d611c9a | pbrook | |
257 | bb36d470 | bellard | /* usb-linux.c */
|
258 | a594cfbf | bellard | USBDevice *usb_host_device_open(const char *devname); |
259 | 5d0c5750 | aliguori | int usb_host_device_close(const char *devname); |
260 | 376253ec | aliguori | void usb_host_info(Monitor *mon);
|
261 | 59ae540c | bellard | |
262 | 59ae540c | bellard | /* usb-hid.c */
|
263 | 47e699dc | balrog | void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *)); |
264 | 2e5d83bb | pbrook | |
265 | e6a6d5ab | balrog | /* usb-bt.c */
|
266 | e6a6d5ab | balrog | USBDevice *usb_bt_init(HCIInfo *hci); |
267 | e6a6d5ab | balrog | |
268 | 87ecb68b | pbrook | /* usb ports of the VM */
|
269 | 87ecb68b | pbrook | |
270 | 87ecb68b | pbrook | #define VM_USB_HUB_SIZE 8 |
271 | 87ecb68b | pbrook | |
272 | 942ac052 | balrog | /* usb-musb.c */
|
273 | 942ac052 | balrog | enum musb_irq_source_e {
|
274 | 942ac052 | balrog | musb_irq_suspend = 0,
|
275 | 942ac052 | balrog | musb_irq_resume, |
276 | 942ac052 | balrog | musb_irq_rst_babble, |
277 | 942ac052 | balrog | musb_irq_sof, |
278 | 942ac052 | balrog | musb_irq_connect, |
279 | 942ac052 | balrog | musb_irq_disconnect, |
280 | 942ac052 | balrog | musb_irq_vbus_request, |
281 | 942ac052 | balrog | musb_irq_vbus_error, |
282 | 942ac052 | balrog | musb_irq_rx, |
283 | 942ac052 | balrog | musb_irq_tx, |
284 | 942ac052 | balrog | musb_set_vbus, |
285 | 942ac052 | balrog | musb_set_session, |
286 | 942ac052 | balrog | __musb_irq_max, |
287 | 942ac052 | balrog | }; |
288 | 942ac052 | balrog | |
289 | bc24a225 | Paul Brook | typedef struct MUSBState MUSBState; |
290 | bc24a225 | Paul Brook | MUSBState *musb_init(qemu_irq *irqs); |
291 | bc24a225 | Paul Brook | uint32_t musb_core_intr_get(MUSBState *s); |
292 | bc24a225 | Paul Brook | void musb_core_intr_clear(MUSBState *s, uint32_t mask);
|
293 | bc24a225 | Paul Brook | void musb_set_size(MUSBState *s, int epnum, int size, int is_tx); |
294 | 806b6024 | Gerd Hoffmann | |
295 | 806b6024 | Gerd Hoffmann | /* usb-bus.c */
|
296 | 806b6024 | Gerd Hoffmann | |
297 | 806b6024 | Gerd Hoffmann | struct USBBus {
|
298 | 806b6024 | Gerd Hoffmann | BusState qbus; |
299 | 806b6024 | Gerd Hoffmann | int busnr;
|
300 | 806b6024 | Gerd Hoffmann | int nfree;
|
301 | 806b6024 | Gerd Hoffmann | int nused;
|
302 | 72cf2d4f | Blue Swirl | QTAILQ_HEAD(, USBPort) free; |
303 | 72cf2d4f | Blue Swirl | QTAILQ_HEAD(, USBPort) used; |
304 | 72cf2d4f | Blue Swirl | QTAILQ_ENTRY(USBBus) next; |
305 | 806b6024 | Gerd Hoffmann | }; |
306 | 806b6024 | Gerd Hoffmann | |
307 | b2317837 | Gerd Hoffmann | void usb_bus_new(USBBus *bus, DeviceState *host);
|
308 | 806b6024 | Gerd Hoffmann | USBBus *usb_bus_find(int busnr);
|
309 | 806b6024 | Gerd Hoffmann | void usb_qdev_register(USBDeviceInfo *info);
|
310 | 806b6024 | Gerd Hoffmann | void usb_qdev_register_many(USBDeviceInfo *info);
|
311 | a5d2f727 | Gerd Hoffmann | USBDevice *usb_create(USBBus *bus, const char *name); |
312 | 806b6024 | Gerd Hoffmann | USBDevice *usb_create_simple(USBBus *bus, const char *name); |
313 | 0958b4cc | Gerd Hoffmann | USBDevice *usbdevice_create(const char *cmdline); |
314 | a5d2f727 | Gerd Hoffmann | void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, |
315 | a5d2f727 | Gerd Hoffmann | usb_attachfn attach); |
316 | a8e662b5 | Gerd Hoffmann | void usb_unregister_port(USBBus *bus, USBPort *port);
|
317 | a5d2f727 | Gerd Hoffmann | int usb_device_attach(USBDevice *dev);
|
318 | a8e662b5 | Gerd Hoffmann | int usb_device_detach(USBDevice *dev);
|
319 | a5d2f727 | Gerd Hoffmann | int usb_device_delete_addr(int busnr, int addr); |
320 | a5d2f727 | Gerd Hoffmann | |
321 | a5d2f727 | Gerd Hoffmann | static inline USBBus *usb_bus_from_device(USBDevice *d) |
322 | a5d2f727 | Gerd Hoffmann | { |
323 | a5d2f727 | Gerd Hoffmann | return DO_UPCAST(USBBus, qbus, d->qdev.parent_bus);
|
324 | a5d2f727 | Gerd Hoffmann | } |