VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmusb.h@ 85121

Last change on this file since 85121 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 42.7 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, USB Devices.
3 */
4
5/*
6 * Copyright (C) 2006-2020 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_vmm_pdmusb_h
27#define VBOX_INCLUDED_vmm_pdmusb_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/vmm/pdmqueue.h>
33#include <VBox/vmm/pdmcritsect.h>
34#include <VBox/vmm/pdmthread.h>
35#include <VBox/vmm/pdmifs.h>
36#include <VBox/vmm/pdmins.h>
37#include <VBox/vmm/pdmcommon.h>
38#include <VBox/vmm/tm.h>
39#include <VBox/vmm/ssm.h>
40#include <VBox/vmm/cfgm.h>
41#include <VBox/vmm/dbgf.h>
42#include <VBox/vmm/mm.h>
43#include <VBox/vusb.h>
44#include <iprt/errcore.h>
45#include <iprt/stdarg.h>
46
47RT_C_DECLS_BEGIN
48
49/** @defgroup grp_pdm_usbdev The USB Devices API
50 * @ingroup grp_pdm
51 * @{
52 */
53
54
55/**
56 * A string entry for the USB descriptor cache.
57 */
58typedef struct PDMUSBDESCCACHESTRING
59{
60 /** The string index. */
61 uint8_t idx;
62 /** The UTF-8 representation of the string. */
63 const char *psz;
64} PDMUSBDESCCACHESTRING;
65/** Pointer to a const string entry. */
66typedef PDMUSBDESCCACHESTRING const *PCPDMUSBDESCCACHESTRING;
67
68
69/**
70 * A language entry for the USB descriptor cache.
71 */
72typedef struct PDMUSBDESCCACHELANG
73{
74 /** The language ID for the strings in this block. */
75 uint16_t idLang;
76 /** The number of strings in the array. */
77 uint16_t cStrings;
78 /** Pointer to an array of associated strings.
79 * This must be sorted in ascending order by string index as a binary lookup
80 * will be performed. */
81 PCPDMUSBDESCCACHESTRING paStrings;
82} PDMUSBDESCCACHELANG;
83/** Pointer to a const language entry. */
84typedef PDMUSBDESCCACHELANG const *PCPDMUSBDESCCACHELANG;
85
86
87/**
88 * USB descriptor cache.
89 *
90 * This structure is owned by the USB device but provided to the PDM/VUSB layer
91 * thru the PDMUSBREG::pfnGetDescriptorCache method. PDM/VUSB will use the
92 * information here to map addresses to endpoints, perform SET_CONFIGURATION
93 * requests, and optionally perform GET_DESCRIPTOR requests (see flag).
94 *
95 * Currently, only device and configuration descriptors are cached.
96 */
97typedef struct PDMUSBDESCCACHE
98{
99 /** USB device descriptor */
100 PCVUSBDESCDEVICE pDevice;
101 /** USB Descriptor arrays (pDev->bNumConfigurations) */
102 PCVUSBDESCCONFIGEX paConfigs;
103 /** Language IDs and their associated strings.
104 * This must be sorted in ascending order by language ID as a binary lookup
105 * will be used. */
106 PCPDMUSBDESCCACHELANG paLanguages;
107 /** The number of entries in the array pointed to by paLanguages. */
108 uint16_t cLanguages;
109 /** Use the cached descriptors for GET_DESCRIPTOR requests. */
110 bool fUseCachedDescriptors;
111 /** Use the cached string descriptors. */
112 bool fUseCachedStringsDescriptors;
113} PDMUSBDESCCACHE;
114/** Pointer to an USB descriptor cache. */
115typedef PDMUSBDESCCACHE *PPDMUSBDESCCACHE;
116/** Pointer to a const USB descriptor cache. */
117typedef const PDMUSBDESCCACHE *PCPDMUSBDESCCACHE;
118
119
120/** PDM Device Flags.
121 * @{ */
122/** A high-speed capable USB 2.0 device (also required to support full-speed). */
123#define PDM_USBREG_HIGHSPEED_CAPABLE RT_BIT(0)
124/** Indicates that the device implements the saved state handlers. */
125#define PDM_USBREG_SAVED_STATE_SUPPORTED RT_BIT(1)
126/** A SuperSpeed USB 3.0 device. */
127#define PDM_USBREG_SUPERSPEED_CAPABLE RT_BIT(2)
128/** @} */
129
130/** PDM USB Device Registration Structure,
131 *
132 * This structure is used when registering a device from VBoxUsbRegister() in HC Ring-3.
133 * The PDM will make use of this structure until the VM is destroyed.
134 */
135typedef struct PDMUSBREG
136{
137 /** Structure version. PDM_DEVREG_VERSION defines the current version. */
138 uint32_t u32Version;
139 /** Device name. */
140 char szName[32];
141 /** The description of the device. The UTF-8 string pointed to shall, like this structure,
142 * remain unchanged from registration till VM destruction. */
143 const char *pszDescription;
144
145 /** Flags, combination of the PDM_USBREG_FLAGS_* \#defines. */
146 RTUINT fFlags;
147 /** Maximum number of instances (per VM). */
148 RTUINT cMaxInstances;
149 /** Size of the instance data. */
150 RTUINT cbInstance;
151
152
153 /**
154 * Construct an USB device instance for a VM.
155 *
156 * @returns VBox status.
157 * @param pUsbIns The USB device instance data.
158 * If the registration structure is needed, it will be
159 * accessible thru pUsbDev->pReg.
160 * @param iInstance Instance number. Use this to figure out which registers
161 * and such to use. The instance number is also found in
162 * pUsbDev->iInstance, but since it's likely to be
163 * frequently used PDM passes it as parameter.
164 * @param pCfg Configuration node handle for the device. Use this to
165 * obtain the configuration of the device instance. It is
166 * also found in pUsbDev->pCfg, but since it is primary
167 * usage will in this function it is passed as a parameter.
168 * @param pCfgGlobal Handle to the global device configuration. Also found
169 * in pUsbDev->pCfgGlobal.
170 * @remarks This callback is required.
171 */
172 DECLR3CALLBACKMEMBER(int, pfnConstruct,(PPDMUSBINS pUsbIns, int iInstance, PCFGMNODE pCfg, PCFGMNODE pCfgGlobal));
173
174 /**
175 * Destruct an USB device instance.
176 *
177 * Most VM resources are freed by the VM. This callback is provided so that any non-VM
178 * resources can be freed correctly.
179 *
180 * This method will be called regardless of the pfnConstruct result to avoid
181 * complicated failure paths.
182 *
183 * @param pUsbIns The USB device instance data.
184 * @remarks Optional.
185 */
186 DECLR3CALLBACKMEMBER(void, pfnDestruct,(PPDMUSBINS pUsbIns));
187
188
189 /**
190 * Init complete notification.
191 *
192 * This can be done to do communication with other devices and other
193 * initialization which requires everything to be in place.
194 *
195 * @returns VBOX status code.
196 * @param pUsbIns The USB device instance data.
197 * @remarks Optional.
198 * @remarks Not called when hotplugged.
199 */
200 DECLR3CALLBACKMEMBER(int, pfnVMInitComplete,(PPDMUSBINS pUsbIns));
201
202 /**
203 * VM Power On notification.
204 *
205 * @returns VBox status.
206 * @param pUsbIns The USB device instance data.
207 * @remarks Optional.
208 */
209 DECLR3CALLBACKMEMBER(void, pfnVMPowerOn,(PPDMUSBINS pUsbIns));
210
211 /**
212 * VM Reset notification.
213 *
214 * @returns VBox status.
215 * @param pUsbIns The USB device instance data.
216 * @remarks Optional.
217 */
218 DECLR3CALLBACKMEMBER(void, pfnVMReset,(PPDMUSBINS pUsbIns));
219
220 /**
221 * VM Suspend notification.
222 *
223 * @returns VBox status.
224 * @param pUsbIns The USB device instance data.
225 * @remarks Optional.
226 */
227 DECLR3CALLBACKMEMBER(void, pfnVMSuspend,(PPDMUSBINS pUsbIns));
228
229 /**
230 * VM Resume notification.
231 *
232 * @returns VBox status.
233 * @param pUsbIns The USB device instance data.
234 * @remarks Optional.
235 */
236 DECLR3CALLBACKMEMBER(void, pfnVMResume,(PPDMUSBINS pUsbIns));
237
238 /**
239 * VM Power Off notification.
240 *
241 * This is only called when the VMR3PowerOff call is made on a running VM. This
242 * means that there is no notification if the VM was suspended before being
243 * powered of. There will also be no callback when hot plugging devices.
244 *
245 * @param pUsbIns The USB device instance data.
246 */
247 DECLR3CALLBACKMEMBER(void, pfnVMPowerOff,(PPDMUSBINS pUsbIns));
248
249 /**
250 * Called after the constructor when attaching a device at run time.
251 *
252 * This can be used to do tasks normally assigned to pfnInitComplete and/or pfnVMPowerOn.
253 *
254 * @returns VBox status.
255 * @param pUsbIns The USB device instance data.
256 * @remarks Optional.
257 */
258 DECLR3CALLBACKMEMBER(void, pfnHotPlugged,(PPDMUSBINS pUsbIns));
259
260 /**
261 * Called before the destructor when a device is unplugged at run time.
262 *
263 * This can be used to do tasks normally assigned to pfnVMSuspend and/or pfnVMPowerOff.
264 *
265 * @returns VBox status.
266 * @param pUsbIns The USB device instance data.
267 * @remarks Optional.
268 */
269 DECLR3CALLBACKMEMBER(void, pfnHotUnplugged,(PPDMUSBINS pUsbIns));
270 /**
271 * Driver Attach command.
272 *
273 * This is called to let the USB device attach to a driver for a specified LUN
274 * at runtime. This is not called during VM construction, the device constructor
275 * have to attach to all the available drivers.
276 *
277 * @returns VBox status code.
278 * @param pUsbIns The USB device instance data.
279 * @param iLUN The logical unit which is being detached.
280 * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
281 * @remarks Optional.
282 */
283 DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
284
285 /**
286 * Driver Detach notification.
287 *
288 * This is called when a driver is detaching itself from a LUN of the device.
289 * The device should adjust it's state to reflect this.
290 *
291 * @param pUsbIns The USB device instance data.
292 * @param iLUN The logical unit which is being detached.
293 * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
294 * @remarks Optional.
295 */
296 DECLR3CALLBACKMEMBER(void, pfnDriverDetach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
297
298 /**
299 * Query the base interface of a logical unit.
300 *
301 * @returns VBOX status code.
302 * @param pUsbIns The USB device instance data.
303 * @param iLUN The logicial unit to query.
304 * @param ppBase Where to store the pointer to the base interface of the LUN.
305 * @remarks Optional.
306 */
307 DECLR3CALLBACKMEMBER(int, pfnQueryInterface,(PPDMUSBINS pUsbIns, unsigned iLUN, PPDMIBASE *ppBase));
308
309 /**
310 * Requests the USB device to reset.
311 *
312 * @returns VBox status code.
313 * @param pUsbIns The USB device instance.
314 * @param fResetOnLinux A hint to the usb proxy.
315 * Don't use this unless you're the linux proxy device.
316 * @thread Any thread.
317 * @remarks Optional.
318 */
319 DECLR3CALLBACKMEMBER(int, pfnUsbReset,(PPDMUSBINS pUsbIns, bool fResetOnLinux));
320
321 /**
322 * Query device and configuration descriptors for the caching and servicing
323 * relevant GET_DESCRIPTOR requests.
324 *
325 * @returns Pointer to the descriptor cache (read-only).
326 * @param pUsbIns The USB device instance.
327 * @remarks Mandatory.
328 */
329 DECLR3CALLBACKMEMBER(PCPDMUSBDESCCACHE, pfnUsbGetDescriptorCache,(PPDMUSBINS pUsbIns));
330
331 /**
332 * SET_CONFIGURATION request.
333 *
334 * @returns VBox status code.
335 * @param pUsbIns The USB device instance.
336 * @param bConfigurationValue The bConfigurationValue of the new configuration.
337 * @param pvOldCfgDesc Internal - for the device proxy.
338 * @param pvOldIfState Internal - for the device proxy.
339 * @param pvNewCfgDesc Internal - for the device proxy.
340 * @remarks Optional.
341 */
342 DECLR3CALLBACKMEMBER(int, pfnUsbSetConfiguration,(PPDMUSBINS pUsbIns, uint8_t bConfigurationValue,
343 const void *pvOldCfgDesc, const void *pvOldIfState, const void *pvNewCfgDesc));
344
345 /**
346 * SET_INTERFACE request.
347 *
348 * @returns VBox status code.
349 * @param pUsbIns The USB device instance.
350 * @param bInterfaceNumber The interface number.
351 * @param bAlternateSetting The alternate setting.
352 * @remarks Optional.
353 */
354 DECLR3CALLBACKMEMBER(int, pfnUsbSetInterface,(PPDMUSBINS pUsbIns, uint8_t bInterfaceNumber, uint8_t bAlternateSetting));
355
356 /**
357 * Clears the halted state of an endpoint. (Optional)
358 *
359 * This called when VUSB sees a CLEAR_FEATURE(ENDPOINT_HALT) on request
360 * on the zero pipe.
361 *
362 * @returns VBox status code.
363 * @param pUsbIns The USB device instance.
364 * @param uEndpoint The endpoint to clear.
365 * @remarks Optional.
366 */
367 DECLR3CALLBACKMEMBER(int, pfnUsbClearHaltedEndpoint,(PPDMUSBINS pUsbIns, unsigned uEndpoint));
368
369 /**
370 * Allocates an URB.
371 *
372 * This can be used to make use of shared user/kernel mode buffers.
373 *
374 * @returns VBox status code.
375 * @param pUsbIns The USB device instance.
376 * @param cbData The size of the data buffer.
377 * @param cTds The number of TDs.
378 * @param enmType The type of URB.
379 * @param ppUrb Where to store the allocated URB.
380 * @remarks Optional.
381 * @remarks Not implemented yet.
382 */
383 DECLR3CALLBACKMEMBER(int, pfnUrbNew,(PPDMUSBINS pUsbIns, size_t cbData, size_t cTds, VUSBXFERTYPE enmType, PVUSBURB *ppUrb));
384
385 /**
386 * Queues an URB for processing.
387 *
388 * @returns VBox status code.
389 * @retval VINF_SUCCESS on success.
390 * @retval VERR_VUSB_DEVICE_NOT_ATTACHED if the device has been disconnected.
391 * @retval VERR_VUSB_FAILED_TO_QUEUE_URB as a general failure kind of thing.
392 * @retval TBD - document new stuff!
393 *
394 * @param pUsbIns The USB device instance.
395 * @param pUrb The URB to process.
396 * @remarks Mandatory.
397 */
398 DECLR3CALLBACKMEMBER(int, pfnUrbQueue,(PPDMUSBINS pUsbIns, PVUSBURB pUrb));
399
400 /**
401 * Cancels an URB.
402 *
403 * @returns VBox status code.
404 * @param pUsbIns The USB device instance.
405 * @param pUrb The URB to cancel.
406 * @remarks Mandatory.
407 */
408 DECLR3CALLBACKMEMBER(int, pfnUrbCancel,(PPDMUSBINS pUsbIns, PVUSBURB pUrb));
409
410 /**
411 * Reaps an URB.
412 *
413 * @returns A ripe URB, NULL if none.
414 * @param pUsbIns The USB device instance.
415 * @param cMillies How log to wait for an URB to become ripe.
416 * @remarks Mandatory.
417 */
418 DECLR3CALLBACKMEMBER(PVUSBURB, pfnUrbReap,(PPDMUSBINS pUsbIns, RTMSINTERVAL cMillies));
419
420 /**
421 * Wakes a thread waiting in pfnUrbReap.
422 *
423 * @returns VBox status code.
424 * @param pUsbIns The USB device instance.
425 */
426 DECLR3CALLBACKMEMBER(int, pfnWakeup,(PPDMUSBINS pUsbIns));
427
428 /** Just some init precaution. Must be set to PDM_USBREG_VERSION. */
429 uint32_t u32TheEnd;
430} PDMUSBREG;
431/** Pointer to a PDM USB Device Structure. */
432typedef PDMUSBREG *PPDMUSBREG;
433/** Const pointer to a PDM USB Device Structure. */
434typedef PDMUSBREG const *PCPDMUSBREG;
435
436/** Current USBREG version number. */
437#define PDM_USBREG_VERSION PDM_VERSION_MAKE(0xeeff, 1, 0)
438
439/** PDM USB Device Flags.
440 * @{ */
441/* none yet */
442/** @} */
443
444
445#ifdef IN_RING3
446
447/**
448 * PDM USB Device API.
449 */
450typedef struct PDMUSBHLP
451{
452 /** Structure version. PDM_USBHLP_VERSION defines the current version. */
453 uint32_t u32Version;
454
455 /**
456 * Attaches a driver (chain) to the USB device.
457 *
458 * The first call for a LUN this will serve as a registration of the LUN. The pBaseInterface and
459 * the pszDesc string will be registered with that LUN and kept around for PDMR3QueryUSBDeviceLun().
460 *
461 * @returns VBox status code.
462 * @param pUsbIns The USB device instance.
463 * @param iLun The logical unit to attach.
464 * @param pBaseInterface Pointer to the base interface for that LUN. (device side / down)
465 * @param ppBaseInterface Where to store the pointer to the base interface. (driver side / up)
466 * @param pszDesc Pointer to a string describing the LUN. This string must remain valid
467 * for the live of the device instance.
468 */
469 DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc));
470
471 /**
472 * Assert that the current thread is the emulation thread.
473 *
474 * @returns True if correct.
475 * @returns False if wrong.
476 * @param pUsbIns The USB device instance.
477 * @param pszFile Filename of the assertion location.
478 * @param iLine Linenumber of the assertion location.
479 * @param pszFunction Function of the assertion location.
480 */
481 DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction));
482
483 /**
484 * Assert that the current thread is NOT the emulation thread.
485 *
486 * @returns True if correct.
487 * @returns False if wrong.
488 * @param pUsbIns The USB device instance.
489 * @param pszFile Filename of the assertion location.
490 * @param iLine Linenumber of the assertion location.
491 * @param pszFunction Function of the assertion location.
492 */
493 DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction));
494
495 /**
496 * Stops the VM and enters the debugger to look at the guest state.
497 *
498 * Use the PDMUsbDBGFStop() inline function with the RT_SRC_POS macro instead of
499 * invoking this function directly.
500 *
501 * @returns VBox status code which must be passed up to the VMM.
502 * @param pUsbIns The USB device instance.
503 * @param pszFile Filename of the assertion location.
504 * @param iLine The linenumber of the assertion location.
505 * @param pszFunction Function of the assertion location.
506 * @param pszFormat Message. (optional)
507 * @param va Message parameters.
508 */
509 DECLR3CALLBACKMEMBER(int, pfnDBGFStopV,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction,
510 const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0));
511
512 /**
513 * Register a info handler with DBGF, argv style.
514 *
515 * @returns VBox status code.
516 * @param pUsbIns The USB device instance.
517 * @param pszName The identifier of the info.
518 * @param pszDesc The description of the info and any arguments the handler may take.
519 * @param pfnHandler The handler function to be called to display the info.
520 */
521 DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegisterArgv,(PPDMUSBINS pUsbIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler));
522
523 /**
524 * Allocate memory which is associated with current VM instance
525 * and automatically freed on it's destruction.
526 *
527 * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
528 * @param pUsbIns The USB device instance.
529 * @param cb Number of bytes to allocate.
530 */
531 DECLR3CALLBACKMEMBER(void *, pfnMMHeapAlloc,(PPDMUSBINS pUsbIns, size_t cb));
532
533 /**
534 * Allocate memory which is associated with current VM instance
535 * and automatically freed on it's destruction. The memory is ZEROed.
536 *
537 * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
538 * @param pUsbIns The USB device instance.
539 * @param cb Number of bytes to allocate.
540 */
541 DECLR3CALLBACKMEMBER(void *, pfnMMHeapAllocZ,(PPDMUSBINS pUsbIns, size_t cb));
542
543 /**
544 * Create a queue.
545 *
546 * @returns VBox status code.
547 * @param pUsbIns The USB device instance.
548 * @param cbItem Size a queue item.
549 * @param cItems Number of items in the queue.
550 * @param cMilliesInterval Number of milliseconds between polling the queue.
551 * If 0 then the emulation thread will be notified whenever an item arrives.
552 * @param pfnCallback The consumer function.
553 * @param pszName The queue base name. The instance number will be
554 * appended automatically.
555 * @param ppQueue Where to store the queue handle on success.
556 * @thread The emulation thread.
557 */
558 DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMUSBINS pUsbIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
559 PFNPDMQUEUEUSB pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
560
561 /**
562 * Register a save state data unit.
563 *
564 * @returns VBox status.
565 * @param pUsbIns The USB device instance.
566 * @param uVersion Data layout version number.
567 * @param cbGuess The approximate amount of data in the unit.
568 * Only for progress indicators.
569 *
570 * @param pfnLivePrep Prepare live save callback, optional.
571 * @param pfnLiveExec Execute live save callback, optional.
572 * @param pfnLiveVote Vote live save callback, optional.
573 *
574 * @param pfnSavePrep Prepare save callback, optional.
575 * @param pfnSaveExec Execute save callback, optional.
576 * @param pfnSaveDone Done save callback, optional.
577 *
578 * @param pfnLoadPrep Prepare load callback, optional.
579 * @param pfnLoadExec Execute load callback, optional.
580 * @param pfnLoadDone Done load callback, optional.
581 */
582 DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
583 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
584 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
585 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone));
586
587 /**
588 * Register a STAM sample.
589 *
590 * Use the PDMUsbHlpSTAMRegister wrapper.
591 *
592 * @returns VBox status.
593 * @param pUsbIns The USB device instance.
594 * @param pvSample Pointer to the sample.
595 * @param enmType Sample type. This indicates what pvSample is pointing at.
596 * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
597 * @param enmUnit Sample unit.
598 * @param pszDesc Sample description.
599 * @param pszName The sample name format string.
600 * @param va Arguments to the format string.
601 */
602 DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMUSBINS pUsbIns, void *pvSample, STAMTYPE enmType,
603 STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc,
604 const char *pszName, va_list va) RT_IPRT_FORMAT_ATTR(7, 0));
605
606 /**
607 * Creates a timer.
608 *
609 * @returns VBox status.
610 * @param pUsbIns The USB device instance.
611 * @param enmClock The clock to use on this timer.
612 * @param pfnCallback Callback function.
613 * @param pvUser User argument for the callback.
614 * @param fFlags Flags, see TMTIMER_FLAGS_*.
615 * @param pszDesc Pointer to description string which must stay around
616 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
617 * @param ppTimer Where to store the timer on success.
618 */
619 DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
620 uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer));
621
622 /**
623 * Set the VM error message
624 *
625 * @returns rc.
626 * @param pUsbIns The USB device instance.
627 * @param rc VBox status code.
628 * @param SRC_POS Use RT_SRC_POS.
629 * @param pszFormat Error message format string.
630 * @param va Error message arguments.
631 */
632 DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
633 const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
634
635 /**
636 * Set the VM runtime error message
637 *
638 * @returns VBox status code.
639 * @param pUsbIns The USB device instance.
640 * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
641 * @param pszErrorId Error ID string.
642 * @param pszFormat Error message format string.
643 * @param va Error message arguments.
644 */
645 DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMUSBINS pUsbIns, uint32_t fFlags, const char *pszErrorId,
646 const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
647
648 /**
649 * Gets the VM state.
650 *
651 * @returns VM state.
652 * @param pUsbIns The USB device instance.
653 * @thread Any thread (just keep in mind that it's volatile info).
654 */
655 DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMUSBINS pUsbIns));
656
657 /**
658 * Creates a PDM thread.
659 *
660 * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
661 * resuming, and destroying the thread as the VM state changes.
662 *
663 * @returns VBox status code.
664 * @param pUsbIns The USB device instance.
665 * @param ppThread Where to store the thread 'handle'.
666 * @param pvUser The user argument to the thread function.
667 * @param pfnThread The thread function.
668 * @param pfnWakeup The wakup callback. This is called on the EMT
669 * thread when a state change is pending.
670 * @param cbStack See RTThreadCreate.
671 * @param enmType See RTThreadCreate.
672 * @param pszName See RTThreadCreate.
673 */
674 DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
675 PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
676
677 /**
678 * Set up asynchronous handling of a suspend, reset or power off notification.
679 *
680 * This shall only be called when getting the notification. It must be called
681 * for each one.
682 *
683 * @returns VBox status code.
684 * @param pUsbIns The USB device instance.
685 * @param pfnAsyncNotify The callback.
686 * @thread EMT(0)
687 */
688 DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMUSBINS pUSbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify));
689
690 /**
691 * Notify EMT(0) that the device has completed the asynchronous notification
692 * handling.
693 *
694 * This can be called at any time, spurious calls will simply be ignored.
695 *
696 * @param pUsbIns The USB device instance.
697 * @thread Any
698 */
699 DECLR3CALLBACKMEMBER(void, pfnAsyncNotificationCompleted, (PPDMUSBINS pUsbIns));
700
701 /**
702 * Gets the reason for the most recent VM suspend.
703 *
704 * @returns The suspend reason. VMSUSPENDREASON_INVALID is returned if no
705 * suspend has been made or if the pUsbIns is invalid.
706 * @param pUsbIns The driver instance.
707 */
708 DECLR3CALLBACKMEMBER(VMSUSPENDREASON, pfnVMGetSuspendReason,(PPDMUSBINS pUsbIns));
709
710 /**
711 * Gets the reason for the most recent VM resume.
712 *
713 * @returns The resume reason. VMRESUMEREASON_INVALID is returned if no
714 * resume has been made or if the pUsbIns is invalid.
715 * @param pUsbIns The driver instance.
716 */
717 DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMUSBINS pUsbIns));
718
719 /** @name Space reserved for minor interface changes.
720 * @{ */
721 DECLR3CALLBACKMEMBER(void, pfnReserved0,(PPDMUSBINS pUsbIns));
722 DECLR3CALLBACKMEMBER(void, pfnReserved1,(PPDMUSBINS pUsbIns));
723 DECLR3CALLBACKMEMBER(void, pfnReserved2,(PPDMUSBINS pUsbIns));
724 DECLR3CALLBACKMEMBER(void, pfnReserved3,(PPDMUSBINS pUsbIns));
725 DECLR3CALLBACKMEMBER(void, pfnReserved4,(PPDMUSBINS pUsbIns));
726 DECLR3CALLBACKMEMBER(void, pfnReserved5,(PPDMUSBINS pUsbIns));
727 DECLR3CALLBACKMEMBER(void, pfnReserved6,(PPDMUSBINS pUsbIns));
728 DECLR3CALLBACKMEMBER(void, pfnReserved7,(PPDMUSBINS pUsbIns));
729 DECLR3CALLBACKMEMBER(void, pfnReserved8,(PPDMUSBINS pUsbIns));
730 DECLR3CALLBACKMEMBER(void, pfnReserved9,(PPDMUSBINS pUsbIns));
731 /** @} */
732
733 /** Just a safety precaution. */
734 uint32_t u32TheEnd;
735} PDMUSBHLP;
736/** Pointer PDM USB Device API. */
737typedef PDMUSBHLP *PPDMUSBHLP;
738/** Pointer const PDM USB Device API. */
739typedef const PDMUSBHLP *PCPDMUSBHLP;
740
741/** Current USBHLP version number. */
742#define PDM_USBHLP_VERSION PDM_VERSION_MAKE(0xeefe, 3, 0)
743
744#endif /* IN_RING3 */
745
746/**
747 * PDM USB Device Instance.
748 */
749typedef struct PDMUSBINS
750{
751 /** Structure version. PDM_USBINS_VERSION defines the current version. */
752 uint32_t u32Version;
753 /** USB device instance number. */
754 uint32_t iInstance;
755 /** The base interface of the device.
756 * The device constructor initializes this if it has any device level
757 * interfaces to export. To obtain this interface call PDMR3QueryUSBDevice(). */
758 PDMIBASE IBase;
759#if HC_ARCH_BITS == 32
760 uint32_t u32Alignment; /**< Alignment padding. */
761#endif
762
763 /** Internal data. */
764 union
765 {
766#ifdef PDMUSBINSINT_DECLARED
767 PDMUSBINSINT s;
768#endif
769 uint8_t padding[HC_ARCH_BITS == 32 ? 96 : 128];
770 } Internal;
771
772 /** Pointer the PDM USB Device API. */
773 R3PTRTYPE(PCPDMUSBHLP) pHlpR3;
774 /** Pointer to the USB device registration structure. */
775 R3PTRTYPE(PCPDMUSBREG) pReg;
776 /** Configuration handle. */
777 R3PTRTYPE(PCFGMNODE) pCfg;
778 /** The (device) global configuration handle. */
779 R3PTRTYPE(PCFGMNODE) pCfgGlobal;
780 /** Pointer to device instance data. */
781 R3PTRTYPE(void *) pvInstanceDataR3;
782 /** Pointer to the VUSB Device structure.
783 * Internal to VUSB, don't touch.
784 * @todo Moved this to PDMUSBINSINT. */
785 R3PTRTYPE(void *) pvVUsbDev2;
786 /** Device name for using when logging.
787 * The constructor sets this and the destructor frees it. */
788 R3PTRTYPE(char *) pszName;
789 /** Tracing indicator. */
790 uint32_t fTracing;
791 /** The tracing ID of this device. */
792 uint32_t idTracing;
793 /** The port/device speed. HCs and emulated devices need to know. */
794 VUSBSPEED enmSpeed;
795
796 /** Padding to make achInstanceData aligned at 32 byte boundary. */
797 uint32_t au32Padding[HC_ARCH_BITS == 32 ? 2 : 3];
798
799 /** Device instance data. The size of this area is defined
800 * in the PDMUSBREG::cbInstanceData field. */
801 char achInstanceData[8];
802} PDMUSBINS;
803
804/** Current USBINS version number. */
805#define PDM_USBINS_VERSION PDM_VERSION_MAKE(0xeefd, 3, 0)
806
807/**
808 * Checks the structure versions of the USB device instance and USB device
809 * helpers, returning if they are incompatible.
810 *
811 * This shall be the first statement of the constructor!
812 *
813 * @param pUsbIns The USB device instance pointer.
814 */
815#define PDMUSB_CHECK_VERSIONS_RETURN(pUsbIns) \
816 do \
817 { \
818 PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
819 AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION), \
820 ("DevIns=%#x mine=%#x\n", (pUsbIns)->u32Version, PDM_USBINS_VERSION), \
821 VERR_PDM_USBINS_VERSION_MISMATCH); \
822 AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
823 ("DevHlp=%#x mine=%#x\n", (pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
824 VERR_PDM_USBHLPR3_VERSION_MISMATCH); \
825 } while (0)
826
827/**
828 * Quietly checks the structure versions of the USB device instance and
829 * USB device helpers, returning if they are incompatible.
830 *
831 * This shall be invoked as the first statement in the destructor!
832 *
833 * @param pUsbIns The USB device instance pointer.
834 */
835#define PDMUSB_CHECK_VERSIONS_RETURN_VOID(pUsbIns) \
836 do \
837 { \
838 PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
839 if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION) )) \
840 { /* likely */ } else return; \
841 if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION) )) \
842 { /* likely */ } else return; \
843 } while (0)
844
845
846/** Converts a pointer to the PDMUSBINS::IBase to a pointer to PDMUSBINS. */
847#define PDMIBASE_2_PDMUSB(pInterface) ( (PPDMUSBINS)((char *)(pInterface) - RT_UOFFSETOF(PDMUSBINS, IBase)) )
848
849
850/** @def PDMUSB_ASSERT_EMT
851 * Assert that the current thread is the emulation thread.
852 */
853#ifdef VBOX_STRICT
854# define PDMUSB_ASSERT_EMT(pUsbIns) pUsbIns->pHlpR3->pfnAssertEMT(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
855#else
856# define PDMUSB_ASSERT_EMT(pUsbIns) do { } while (0)
857#endif
858
859/** @def PDMUSB_ASSERT_OTHER
860 * Assert that the current thread is NOT the emulation thread.
861 */
862#ifdef VBOX_STRICT
863# define PDMUSB_ASSERT_OTHER(pUsbIns) pUsbIns->pHlpR3->pfnAssertOther(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
864#else
865# define PDMUSB_ASSERT_OTHER(pUsbIns) do { } while (0)
866#endif
867
868/** @def PDMUSB_SET_ERROR
869 * Set the VM error. See PDMUsbHlpVMSetError() for printf like message
870 * formatting.
871 */
872#define PDMUSB_SET_ERROR(pUsbIns, rc, pszError) \
873 PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, "%s", pszError)
874
875/** @def PDMUSB_SET_RUNTIME_ERROR
876 * Set the VM runtime error. See PDMUsbHlpVMSetRuntimeError() for printf like
877 * message formatting.
878 */
879#define PDMUSB_SET_RUNTIME_ERROR(pUsbIns, fFlags, pszErrorId, pszError) \
880 PDMUsbHlpVMSetRuntimeError(pUsbIns, fFlags, pszErrorId, "%s", pszError)
881
882
883#ifdef IN_RING3
884
885/**
886 * @copydoc PDMUSBHLP::pfnDriverAttach
887 */
888DECLINLINE(int) PDMUsbHlpDriverAttach(PPDMUSBINS pUsbIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
889{
890 return pUsbIns->pHlpR3->pfnDriverAttach(pUsbIns, iLun, pBaseInterface, ppBaseInterface, pszDesc);
891}
892
893/**
894 * VBOX_STRICT wrapper for pHlpR3->pfnDBGFStopV.
895 *
896 * @returns VBox status code which must be passed up to the VMM.
897 * @param pUsbIns Device instance.
898 * @param SRC_POS Use RT_SRC_POS.
899 * @param pszFormat Message. (optional)
900 * @param ... Message parameters.
901 */
902DECLINLINE(int) RT_IPRT_FORMAT_ATTR(5, 6) PDMUsbDBGFStop(PPDMUSBINS pUsbIns, RT_SRC_POS_DECL, const char *pszFormat, ...)
903{
904#ifdef VBOX_STRICT
905 int rc;
906 va_list va;
907 va_start(va, pszFormat);
908 rc = pUsbIns->pHlpR3->pfnDBGFStopV(pUsbIns, RT_SRC_POS_ARGS, pszFormat, va);
909 va_end(va);
910 return rc;
911#else
912 NOREF(pUsbIns);
913 NOREF(pszFile);
914 NOREF(iLine);
915 NOREF(pszFunction);
916 NOREF(pszFormat);
917 return VINF_SUCCESS;
918#endif
919}
920
921/**
922 * @copydoc PDMUSBHLP::pfnVMState
923 */
924DECLINLINE(VMSTATE) PDMUsbHlpVMState(PPDMUSBINS pUsbIns)
925{
926 return pUsbIns->pHlpR3->pfnVMState(pUsbIns);
927}
928
929/**
930 * @copydoc PDMUSBHLP::pfnThreadCreate
931 */
932DECLINLINE(int) PDMUsbHlpThreadCreate(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
933 PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
934{
935 return pUsbIns->pHlpR3->pfnThreadCreate(pUsbIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
936}
937
938
939/**
940 * @copydoc PDMUSBHLP::pfnSetAsyncNotification
941 */
942DECLINLINE(int) PDMUsbHlpSetAsyncNotification(PPDMUSBINS pUsbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify)
943{
944 return pUsbIns->pHlpR3->pfnSetAsyncNotification(pUsbIns, pfnAsyncNotify);
945}
946
947/**
948 * @copydoc PDMUSBHLP::pfnAsyncNotificationCompleted
949 */
950DECLINLINE(void) PDMUsbHlpAsyncNotificationCompleted(PPDMUSBINS pUsbIns)
951{
952 pUsbIns->pHlpR3->pfnAsyncNotificationCompleted(pUsbIns);
953}
954
955/**
956 * Set the VM error message
957 *
958 * @returns rc.
959 * @param pUsbIns The USB device instance.
960 * @param rc VBox status code.
961 * @param SRC_POS Use RT_SRC_POS.
962 * @param pszFormat Error message format string.
963 * @param ... Error message arguments.
964 */
965DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMUsbHlpVMSetError(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
966 const char *pszFormat, ...)
967{
968 va_list va;
969 va_start(va, pszFormat);
970 rc = pUsbIns->pHlpR3->pfnVMSetErrorV(pUsbIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
971 va_end(va);
972 return rc;
973}
974
975/**
976 * @copydoc PDMUSBHLP::pfnMMHeapAlloc
977 */
978DECLINLINE(void *) PDMUsbHlpMMHeapAlloc(PPDMUSBINS pUsbIns, size_t cb)
979{
980 return pUsbIns->pHlpR3->pfnMMHeapAlloc(pUsbIns, cb);
981}
982
983/**
984 * @copydoc PDMUSBHLP::pfnMMHeapAllocZ
985 */
986DECLINLINE(void *) PDMUsbHlpMMHeapAllocZ(PPDMUSBINS pUsbIns, size_t cb)
987{
988 return pUsbIns->pHlpR3->pfnMMHeapAllocZ(pUsbIns, cb);
989}
990
991/**
992 * Frees memory allocated by PDMUsbHlpMMHeapAlloc or PDMUsbHlpMMHeapAllocZ.
993 *
994 * @param pUsbIns The USB device instance.
995 * @param pv The memory to free. NULL is fine.
996 */
997DECLINLINE(void) PDMUsbHlpMMHeapFree(PPDMUSBINS pUsbIns, void *pv)
998{
999 NOREF(pUsbIns);
1000 MMR3HeapFree(pv);
1001}
1002
1003/**
1004 * @copydoc PDMUSBHLP::pfnDBGFInfoRegisterArgv
1005 */
1006DECLINLINE(int) PDMUsbHlpDBGFInfoRegisterArgv(PPDMUSBINS pUsbIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler)
1007{
1008 return pUsbIns->pHlpR3->pfnDBGFInfoRegisterArgv(pUsbIns, pszName, pszDesc, pfnHandler);
1009}
1010
1011/**
1012 * @copydoc PDMUSBHLP::pfnTMTimerCreate
1013 */
1014DECLINLINE(int) PDMUsbHlpTMTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
1015 uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
1016{
1017 return pUsbIns->pHlpR3->pfnTMTimerCreate(pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
1018}
1019
1020/**
1021 * @copydoc PDMUSBHLP::pfnSSMRegister
1022 */
1023DECLINLINE(int) PDMUsbHlpSSMRegister(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
1024 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
1025 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
1026 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone)
1027{
1028 return pUsbIns->pHlpR3->pfnSSMRegister(pUsbIns, uVersion, cbGuess,
1029 pfnLivePrep, pfnLiveExec, pfnLiveVote,
1030 pfnSavePrep, pfnSaveExec, pfnSaveDone,
1031 pfnLoadPrep, pfnLoadExec, pfnLoadDone);
1032}
1033
1034#endif /* IN_RING3 */
1035
1036
1037
1038/** Pointer to callbacks provided to the VBoxUsbRegister() call. */
1039typedef const struct PDMUSBREGCB *PCPDMUSBREGCB;
1040
1041/**
1042 * Callbacks for VBoxUSBDeviceRegister().
1043 */
1044typedef struct PDMUSBREGCB
1045{
1046 /** Interface version.
1047 * This is set to PDM_USBREG_CB_VERSION. */
1048 uint32_t u32Version;
1049
1050 /**
1051 * Registers a device with the current VM instance.
1052 *
1053 * @returns VBox status code.
1054 * @param pCallbacks Pointer to the callback table.
1055 * @param pReg Pointer to the USB device registration record.
1056 * This data must be permanent and readonly.
1057 */
1058 DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMUSBREGCB pCallbacks, PCPDMUSBREG pReg));
1059} PDMUSBREGCB;
1060
1061/** Current version of the PDMUSBREGCB structure. */
1062#define PDM_USBREG_CB_VERSION PDM_VERSION_MAKE(0xeefc, 1, 0)
1063
1064
1065/**
1066 * The VBoxUsbRegister callback function.
1067 *
1068 * PDM will invoke this function after loading a USB device module and letting
1069 * the module decide which devices to register and how to handle conflicts.
1070 *
1071 * @returns VBox status code.
1072 * @param pCallbacks Pointer to the callback table.
1073 * @param u32Version VBox version number.
1074 */
1075typedef DECLCALLBACKTYPE(int, FNPDMVBOXUSBREGISTER,(PCPDMUSBREGCB pCallbacks, uint32_t u32Version));
1076
1077VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid,
1078 const char *pszCaptureFilename);
1079VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, const char *pszBackend, const char *pszAddress, void *pvBackend,
1080 VUSBSPEED enmSpeed, uint32_t fMaskedIfs, const char *pszCaptureFilename);
1081VMMR3DECL(int) PDMR3UsbDetachDevice(PUVM pUVM, PCRTUUID pUuid);
1082VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM);
1083VMMR3DECL(int) PDMR3UsbDriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
1084 PPPDMIBASE ppBase);
1085VMMR3DECL(int) PDMR3UsbDriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
1086 const char *pszDriver, unsigned iOccurrence, uint32_t fFlags);
1087VMMR3DECL(int) PDMR3UsbQueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase);
1088VMMR3DECL(int) PDMR3UsbQueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
1089 const char *pszDriver, PPPDMIBASE ppBase);
1090
1091/** @} */
1092
1093RT_C_DECLS_END
1094
1095#endif /* !VBOX_INCLUDED_vmm_pdmusb_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette