1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, USB Devices.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2022 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 |
|
---|
47 | RT_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 | */
|
---|
58 | typedef 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. */
|
---|
66 | typedef PDMUSBDESCCACHESTRING const *PCPDMUSBDESCCACHESTRING;
|
---|
67 |
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * A language entry for the USB descriptor cache.
|
---|
71 | */
|
---|
72 | typedef 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. */
|
---|
84 | typedef 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 | */
|
---|
97 | typedef 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. */
|
---|
115 | typedef PDMUSBDESCCACHE *PPDMUSBDESCCACHE;
|
---|
116 | /** Pointer to a const USB descriptor cache. */
|
---|
117 | typedef 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 | */
|
---|
135 | typedef 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. */
|
---|
432 | typedef PDMUSBREG *PPDMUSBREG;
|
---|
433 | /** Const pointer to a PDM USB Device Structure. */
|
---|
434 | typedef PDMUSBREG const *PCPDMUSBREG;
|
---|
435 |
|
---|
436 | /** Current USBREG version number. */
|
---|
437 | #define PDM_USBREG_VERSION PDM_VERSION_MAKE(0xeeff, 2, 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 | */
|
---|
450 | typedef 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 | * Free memory allocated with pfnMMHeapAlloc() and pfnMMHeapAllocZ().
|
---|
545 | *
|
---|
546 | * @param pUsbIns The USB device instance.
|
---|
547 | * @param pv Pointer to the memory to free.
|
---|
548 | */
|
---|
549 | DECLR3CALLBACKMEMBER(void, pfnMMHeapFree,(PPDMUSBINS pUsbIns, void *pv));
|
---|
550 |
|
---|
551 | /**
|
---|
552 | * Create a queue.
|
---|
553 | *
|
---|
554 | * @returns VBox status code.
|
---|
555 | * @param pUsbIns The USB device instance.
|
---|
556 | * @param cbItem Size a queue item.
|
---|
557 | * @param cItems Number of items in the queue.
|
---|
558 | * @param cMilliesInterval Number of milliseconds between polling the queue.
|
---|
559 | * If 0 then the emulation thread will be notified whenever an item arrives.
|
---|
560 | * @param pfnCallback The consumer function.
|
---|
561 | * @param pszName The queue base name. The instance number will be
|
---|
562 | * appended automatically.
|
---|
563 | * @param ppQueue Where to store the queue handle on success.
|
---|
564 | * @thread The emulation thread.
|
---|
565 | */
|
---|
566 | DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMUSBINS pUsbIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
567 | PFNPDMQUEUEUSB pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
|
---|
568 |
|
---|
569 | /**
|
---|
570 | * Register a save state data unit.
|
---|
571 | *
|
---|
572 | * @returns VBox status.
|
---|
573 | * @param pUsbIns The USB device instance.
|
---|
574 | * @param uVersion Data layout version number.
|
---|
575 | * @param cbGuess The approximate amount of data in the unit.
|
---|
576 | * Only for progress indicators.
|
---|
577 | *
|
---|
578 | * @param pfnLivePrep Prepare live save callback, optional.
|
---|
579 | * @param pfnLiveExec Execute live save callback, optional.
|
---|
580 | * @param pfnLiveVote Vote live save callback, optional.
|
---|
581 | *
|
---|
582 | * @param pfnSavePrep Prepare save callback, optional.
|
---|
583 | * @param pfnSaveExec Execute save callback, optional.
|
---|
584 | * @param pfnSaveDone Done save callback, optional.
|
---|
585 | *
|
---|
586 | * @param pfnLoadPrep Prepare load callback, optional.
|
---|
587 | * @param pfnLoadExec Execute load callback, optional.
|
---|
588 | * @param pfnLoadDone Done load callback, optional.
|
---|
589 | */
|
---|
590 | DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
|
---|
591 | PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
|
---|
592 | PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
|
---|
593 | PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone));
|
---|
594 |
|
---|
595 | /** @name Exported SSM Functions
|
---|
596 | * @{ */
|
---|
597 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStruct,(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields));
|
---|
598 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStructEx,(PSSMHANDLE pSSM, const void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser));
|
---|
599 | DECLR3CALLBACKMEMBER(int, pfnSSMPutBool,(PSSMHANDLE pSSM, bool fBool));
|
---|
600 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU8,(PSSMHANDLE pSSM, uint8_t u8));
|
---|
601 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS8,(PSSMHANDLE pSSM, int8_t i8));
|
---|
602 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU16,(PSSMHANDLE pSSM, uint16_t u16));
|
---|
603 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS16,(PSSMHANDLE pSSM, int16_t i16));
|
---|
604 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU32,(PSSMHANDLE pSSM, uint32_t u32));
|
---|
605 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS32,(PSSMHANDLE pSSM, int32_t i32));
|
---|
606 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU64,(PSSMHANDLE pSSM, uint64_t u64));
|
---|
607 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS64,(PSSMHANDLE pSSM, int64_t i64));
|
---|
608 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU128,(PSSMHANDLE pSSM, uint128_t u128));
|
---|
609 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS128,(PSSMHANDLE pSSM, int128_t i128));
|
---|
610 | DECLR3CALLBACKMEMBER(int, pfnSSMPutUInt,(PSSMHANDLE pSSM, RTUINT u));
|
---|
611 | DECLR3CALLBACKMEMBER(int, pfnSSMPutSInt,(PSSMHANDLE pSSM, RTINT i));
|
---|
612 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUInt,(PSSMHANDLE pSSM, RTGCUINT u));
|
---|
613 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUIntReg,(PSSMHANDLE pSSM, RTGCUINTREG u));
|
---|
614 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys32,(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys));
|
---|
615 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys64,(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys));
|
---|
616 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys,(PSSMHANDLE pSSM, RTGCPHYS GCPhys));
|
---|
617 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPtr,(PSSMHANDLE pSSM, RTGCPTR GCPtr));
|
---|
618 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUIntPtr,(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr));
|
---|
619 | DECLR3CALLBACKMEMBER(int, pfnSSMPutRCPtr,(PSSMHANDLE pSSM, RTRCPTR RCPtr));
|
---|
620 | DECLR3CALLBACKMEMBER(int, pfnSSMPutIOPort,(PSSMHANDLE pSSM, RTIOPORT IOPort));
|
---|
621 | DECLR3CALLBACKMEMBER(int, pfnSSMPutSel,(PSSMHANDLE pSSM, RTSEL Sel));
|
---|
622 | DECLR3CALLBACKMEMBER(int, pfnSSMPutMem,(PSSMHANDLE pSSM, const void *pv, size_t cb));
|
---|
623 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStrZ,(PSSMHANDLE pSSM, const char *psz));
|
---|
624 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStruct,(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields));
|
---|
625 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStructEx,(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser));
|
---|
626 | DECLR3CALLBACKMEMBER(int, pfnSSMGetBool,(PSSMHANDLE pSSM, bool *pfBool));
|
---|
627 | DECLR3CALLBACKMEMBER(int, pfnSSMGetBoolV,(PSSMHANDLE pSSM, bool volatile *pfBool));
|
---|
628 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU8,(PSSMHANDLE pSSM, uint8_t *pu8));
|
---|
629 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU8V,(PSSMHANDLE pSSM, uint8_t volatile *pu8));
|
---|
630 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS8,(PSSMHANDLE pSSM, int8_t *pi8));
|
---|
631 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS8V,(PSSMHANDLE pSSM, int8_t volatile *pi8));
|
---|
632 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU16,(PSSMHANDLE pSSM, uint16_t *pu16));
|
---|
633 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU16V,(PSSMHANDLE pSSM, uint16_t volatile *pu16));
|
---|
634 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS16,(PSSMHANDLE pSSM, int16_t *pi16));
|
---|
635 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS16V,(PSSMHANDLE pSSM, int16_t volatile *pi16));
|
---|
636 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU32,(PSSMHANDLE pSSM, uint32_t *pu32));
|
---|
637 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU32V,(PSSMHANDLE pSSM, uint32_t volatile *pu32));
|
---|
638 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS32,(PSSMHANDLE pSSM, int32_t *pi32));
|
---|
639 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS32V,(PSSMHANDLE pSSM, int32_t volatile *pi32));
|
---|
640 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU64,(PSSMHANDLE pSSM, uint64_t *pu64));
|
---|
641 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU64V,(PSSMHANDLE pSSM, uint64_t volatile *pu64));
|
---|
642 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS64,(PSSMHANDLE pSSM, int64_t *pi64));
|
---|
643 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS64V,(PSSMHANDLE pSSM, int64_t volatile *pi64));
|
---|
644 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU128,(PSSMHANDLE pSSM, uint128_t *pu128));
|
---|
645 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU128V,(PSSMHANDLE pSSM, uint128_t volatile *pu128));
|
---|
646 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS128,(PSSMHANDLE pSSM, int128_t *pi128));
|
---|
647 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS128V,(PSSMHANDLE pSSM, int128_t volatile *pi128));
|
---|
648 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys32,(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys));
|
---|
649 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys32V,(PSSMHANDLE pSSM, RTGCPHYS32 volatile *pGCPhys));
|
---|
650 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys64,(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys));
|
---|
651 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys64V,(PSSMHANDLE pSSM, RTGCPHYS64 volatile *pGCPhys));
|
---|
652 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys,(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys));
|
---|
653 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhysV,(PSSMHANDLE pSSM, RTGCPHYS volatile *pGCPhys));
|
---|
654 | DECLR3CALLBACKMEMBER(int, pfnSSMGetUInt,(PSSMHANDLE pSSM, PRTUINT pu));
|
---|
655 | DECLR3CALLBACKMEMBER(int, pfnSSMGetSInt,(PSSMHANDLE pSSM, PRTINT pi));
|
---|
656 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUInt,(PSSMHANDLE pSSM, PRTGCUINT pu));
|
---|
657 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUIntReg,(PSSMHANDLE pSSM, PRTGCUINTREG pu));
|
---|
658 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPtr,(PSSMHANDLE pSSM, PRTGCPTR pGCPtr));
|
---|
659 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUIntPtr,(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr));
|
---|
660 | DECLR3CALLBACKMEMBER(int, pfnSSMGetRCPtr,(PSSMHANDLE pSSM, PRTRCPTR pRCPtr));
|
---|
661 | DECLR3CALLBACKMEMBER(int, pfnSSMGetIOPort,(PSSMHANDLE pSSM, PRTIOPORT pIOPort));
|
---|
662 | DECLR3CALLBACKMEMBER(int, pfnSSMGetSel,(PSSMHANDLE pSSM, PRTSEL pSel));
|
---|
663 | DECLR3CALLBACKMEMBER(int, pfnSSMGetMem,(PSSMHANDLE pSSM, void *pv, size_t cb));
|
---|
664 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStrZ,(PSSMHANDLE pSSM, char *psz, size_t cbMax));
|
---|
665 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStrZEx,(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr));
|
---|
666 | DECLR3CALLBACKMEMBER(int, pfnSSMSkip,(PSSMHANDLE pSSM, size_t cb));
|
---|
667 | DECLR3CALLBACKMEMBER(int, pfnSSMSkipToEndOfUnit,(PSSMHANDLE pSSM));
|
---|
668 | DECLR3CALLBACKMEMBER(int, pfnSSMSetLoadError,(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
669 | DECLR3CALLBACKMEMBER(int, pfnSSMSetLoadErrorV,(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
670 | DECLR3CALLBACKMEMBER(int, pfnSSMSetCfgError,(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6));
|
---|
671 | DECLR3CALLBACKMEMBER(int, pfnSSMSetCfgErrorV,(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0));
|
---|
672 | DECLR3CALLBACKMEMBER(int, pfnSSMHandleGetStatus,(PSSMHANDLE pSSM));
|
---|
673 | DECLR3CALLBACKMEMBER(SSMAFTER, pfnSSMHandleGetAfter,(PSSMHANDLE pSSM));
|
---|
674 | DECLR3CALLBACKMEMBER(bool, pfnSSMHandleIsLiveSave,(PSSMHANDLE pSSM));
|
---|
675 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleMaxDowntime,(PSSMHANDLE pSSM));
|
---|
676 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleHostBits,(PSSMHANDLE pSSM));
|
---|
677 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleRevision,(PSSMHANDLE pSSM));
|
---|
678 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleVersion,(PSSMHANDLE pSSM));
|
---|
679 | DECLR3CALLBACKMEMBER(const char *, pfnSSMHandleHostOSAndArch,(PSSMHANDLE pSSM));
|
---|
680 | /** @} */
|
---|
681 |
|
---|
682 | /** @name Exported CFGM Functions.
|
---|
683 | * @{ */
|
---|
684 | DECLR3CALLBACKMEMBER(bool, pfnCFGMExists,( PCFGMNODE pNode, const char *pszName));
|
---|
685 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryType,( PCFGMNODE pNode, const char *pszName, PCFGMVALUETYPE penmType));
|
---|
686 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySize,( PCFGMNODE pNode, const char *pszName, size_t *pcb));
|
---|
687 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryInteger,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64));
|
---|
688 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryIntegerDef,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def));
|
---|
689 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryString,( PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString));
|
---|
690 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringDef,( PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef));
|
---|
691 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBytes,( PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData));
|
---|
692 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU64,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64));
|
---|
693 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU64Def,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def));
|
---|
694 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS64,( PCFGMNODE pNode, const char *pszName, int64_t *pi64));
|
---|
695 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS64Def,( PCFGMNODE pNode, const char *pszName, int64_t *pi64, int64_t i64Def));
|
---|
696 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU32,( PCFGMNODE pNode, const char *pszName, uint32_t *pu32));
|
---|
697 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU32Def,( PCFGMNODE pNode, const char *pszName, uint32_t *pu32, uint32_t u32Def));
|
---|
698 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS32,( PCFGMNODE pNode, const char *pszName, int32_t *pi32));
|
---|
699 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS32Def,( PCFGMNODE pNode, const char *pszName, int32_t *pi32, int32_t i32Def));
|
---|
700 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU16,( PCFGMNODE pNode, const char *pszName, uint16_t *pu16));
|
---|
701 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU16Def,( PCFGMNODE pNode, const char *pszName, uint16_t *pu16, uint16_t u16Def));
|
---|
702 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS16,( PCFGMNODE pNode, const char *pszName, int16_t *pi16));
|
---|
703 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS16Def,( PCFGMNODE pNode, const char *pszName, int16_t *pi16, int16_t i16Def));
|
---|
704 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU8,( PCFGMNODE pNode, const char *pszName, uint8_t *pu8));
|
---|
705 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU8Def,( PCFGMNODE pNode, const char *pszName, uint8_t *pu8, uint8_t u8Def));
|
---|
706 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS8,( PCFGMNODE pNode, const char *pszName, int8_t *pi8));
|
---|
707 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS8Def,( PCFGMNODE pNode, const char *pszName, int8_t *pi8, int8_t i8Def));
|
---|
708 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBool,( PCFGMNODE pNode, const char *pszName, bool *pf));
|
---|
709 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBoolDef,( PCFGMNODE pNode, const char *pszName, bool *pf, bool fDef));
|
---|
710 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryPort,( PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort));
|
---|
711 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryPortDef,( PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort, RTIOPORT PortDef));
|
---|
712 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryUInt,( PCFGMNODE pNode, const char *pszName, unsigned int *pu));
|
---|
713 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryUIntDef,( PCFGMNODE pNode, const char *pszName, unsigned int *pu, unsigned int uDef));
|
---|
714 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySInt,( PCFGMNODE pNode, const char *pszName, signed int *pi));
|
---|
715 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySIntDef,( PCFGMNODE pNode, const char *pszName, signed int *pi, signed int iDef));
|
---|
716 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtr,( PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr));
|
---|
717 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrDef,( PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr, RTGCPTR GCPtrDef));
|
---|
718 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrU,( PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr));
|
---|
719 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrUDef,( PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr, RTGCUINTPTR GCPtrDef));
|
---|
720 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrS,( PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr));
|
---|
721 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrSDef,( PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr, RTGCINTPTR GCPtrDef));
|
---|
722 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringAlloc,( PCFGMNODE pNode, const char *pszName, char **ppszString));
|
---|
723 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringAllocDef,(PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef));
|
---|
724 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetParent,(PCFGMNODE pNode));
|
---|
725 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChild,(PCFGMNODE pNode, const char *pszPath));
|
---|
726 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChildF,(PCFGMNODE pNode, const char *pszPathFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3));
|
---|
727 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChildFV,(PCFGMNODE pNode, const char *pszPathFormat, va_list Args) RT_IPRT_FORMAT_ATTR(3, 0));
|
---|
728 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetFirstChild,(PCFGMNODE pNode));
|
---|
729 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetNextChild,(PCFGMNODE pCur));
|
---|
730 | DECLR3CALLBACKMEMBER(int, pfnCFGMGetName,(PCFGMNODE pCur, char *pszName, size_t cchName));
|
---|
731 | DECLR3CALLBACKMEMBER(size_t, pfnCFGMGetNameLen,(PCFGMNODE pCur));
|
---|
732 | DECLR3CALLBACKMEMBER(bool, pfnCFGMAreChildrenValid,(PCFGMNODE pNode, const char *pszzValid));
|
---|
733 | DECLR3CALLBACKMEMBER(PCFGMLEAF, pfnCFGMGetFirstValue,(PCFGMNODE pCur));
|
---|
734 | DECLR3CALLBACKMEMBER(PCFGMLEAF, pfnCFGMGetNextValue,(PCFGMLEAF pCur));
|
---|
735 | DECLR3CALLBACKMEMBER(int, pfnCFGMGetValueName,(PCFGMLEAF pCur, char *pszName, size_t cchName));
|
---|
736 | DECLR3CALLBACKMEMBER(size_t, pfnCFGMGetValueNameLen,(PCFGMLEAF pCur));
|
---|
737 | DECLR3CALLBACKMEMBER(CFGMVALUETYPE, pfnCFGMGetValueType,(PCFGMLEAF pCur));
|
---|
738 | DECLR3CALLBACKMEMBER(bool, pfnCFGMAreValuesValid,(PCFGMNODE pNode, const char *pszzValid));
|
---|
739 | DECLR3CALLBACKMEMBER(int, pfnCFGMValidateConfig,(PCFGMNODE pNode, const char *pszNode,
|
---|
740 | const char *pszValidValues, const char *pszValidNodes,
|
---|
741 | const char *pszWho, uint32_t uInstance));
|
---|
742 | /** @} */
|
---|
743 |
|
---|
744 | /**
|
---|
745 | * Register a STAM sample.
|
---|
746 | *
|
---|
747 | * Use the PDMUsbHlpSTAMRegister wrapper.
|
---|
748 | *
|
---|
749 | * @returns VBox status.
|
---|
750 | * @param pUsbIns The USB device instance.
|
---|
751 | * @param pvSample Pointer to the sample.
|
---|
752 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
753 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
754 | * @param enmUnit Sample unit.
|
---|
755 | * @param pszDesc Sample description.
|
---|
756 | * @param pszName The sample name format string.
|
---|
757 | * @param va Arguments to the format string.
|
---|
758 | */
|
---|
759 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMUSBINS pUsbIns, void *pvSample, STAMTYPE enmType,
|
---|
760 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc,
|
---|
761 | const char *pszName, va_list va) RT_IPRT_FORMAT_ATTR(7, 0));
|
---|
762 |
|
---|
763 | /**
|
---|
764 | * Creates a timer.
|
---|
765 | *
|
---|
766 | * @returns VBox status.
|
---|
767 | * @param pUsbIns The USB device instance.
|
---|
768 | * @param enmClock The clock to use on this timer.
|
---|
769 | * @param pfnCallback Callback function.
|
---|
770 | * @param pvUser User argument for the callback.
|
---|
771 | * @param fFlags Flags, see TMTIMER_FLAGS_*.
|
---|
772 | * @param pszDesc Pointer to description string which must stay around
|
---|
773 | * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
|
---|
774 | * @param phTimer Where to store the timer handle on success.
|
---|
775 | */
|
---|
776 | DECLR3CALLBACKMEMBER(int, pfnTimerCreate,(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
|
---|
777 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer));
|
---|
778 |
|
---|
779 | /** @name Timer handle method wrappers
|
---|
780 | * @{ */
|
---|
781 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromMicro,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs));
|
---|
782 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromMilli,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs));
|
---|
783 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs));
|
---|
784 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGet,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
785 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGetFreq,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
786 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGetNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
787 | DECLR3CALLBACKMEMBER(bool, pfnTimerIsActive,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
788 | DECLR3CALLBACKMEMBER(bool, pfnTimerIsLockOwner,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
789 | DECLR3CALLBACKMEMBER(int, pfnTimerLockClock,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
790 | /** Takes the clock lock then enters the specified critical section. */
|
---|
791 | DECLR3CALLBACKMEMBER(int, pfnTimerLockClock2,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
792 | DECLR3CALLBACKMEMBER(int, pfnTimerSet,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t uExpire));
|
---|
793 | DECLR3CALLBACKMEMBER(int, pfnTimerSetFrequencyHint,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint32_t uHz));
|
---|
794 | DECLR3CALLBACKMEMBER(int, pfnTimerSetMicro,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext));
|
---|
795 | DECLR3CALLBACKMEMBER(int, pfnTimerSetMillies,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext));
|
---|
796 | DECLR3CALLBACKMEMBER(int, pfnTimerSetNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext));
|
---|
797 | DECLR3CALLBACKMEMBER(int, pfnTimerSetRelative,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now));
|
---|
798 | DECLR3CALLBACKMEMBER(int, pfnTimerStop,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
799 | DECLR3CALLBACKMEMBER(void, pfnTimerUnlockClock,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
800 | DECLR3CALLBACKMEMBER(void, pfnTimerUnlockClock2,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
801 | DECLR3CALLBACKMEMBER(int, pfnTimerSetCritSect,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
802 | DECLR3CALLBACKMEMBER(int, pfnTimerSave,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM));
|
---|
803 | DECLR3CALLBACKMEMBER(int, pfnTimerLoad,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM));
|
---|
804 | DECLR3CALLBACKMEMBER(int, pfnTimerDestroy,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
805 | /** @sa TMR3TimerSkip */
|
---|
806 | DECLR3CALLBACKMEMBER(int, pfnTimerSkipLoad,(PSSMHANDLE pSSM, bool *pfActive));
|
---|
807 | /** @} */
|
---|
808 |
|
---|
809 | /**
|
---|
810 | * Set the VM error message
|
---|
811 | *
|
---|
812 | * @returns rc.
|
---|
813 | * @param pUsbIns The USB device instance.
|
---|
814 | * @param rc VBox status code.
|
---|
815 | * @param SRC_POS Use RT_SRC_POS.
|
---|
816 | * @param pszFormat Error message format string.
|
---|
817 | * @param va Error message arguments.
|
---|
818 | */
|
---|
819 | DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
|
---|
820 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
821 |
|
---|
822 | /**
|
---|
823 | * Set the VM runtime error message
|
---|
824 | *
|
---|
825 | * @returns VBox status code.
|
---|
826 | * @param pUsbIns The USB device instance.
|
---|
827 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
828 | * @param pszErrorId Error ID string.
|
---|
829 | * @param pszFormat Error message format string.
|
---|
830 | * @param va Error message arguments.
|
---|
831 | */
|
---|
832 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMUSBINS pUsbIns, uint32_t fFlags, const char *pszErrorId,
|
---|
833 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
834 |
|
---|
835 | /**
|
---|
836 | * Gets the VM state.
|
---|
837 | *
|
---|
838 | * @returns VM state.
|
---|
839 | * @param pUsbIns The USB device instance.
|
---|
840 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
841 | */
|
---|
842 | DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMUSBINS pUsbIns));
|
---|
843 |
|
---|
844 | /**
|
---|
845 | * Creates a PDM thread.
|
---|
846 | *
|
---|
847 | * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
|
---|
848 | * resuming, and destroying the thread as the VM state changes.
|
---|
849 | *
|
---|
850 | * @returns VBox status code.
|
---|
851 | * @param pUsbIns The USB device instance.
|
---|
852 | * @param ppThread Where to store the thread 'handle'.
|
---|
853 | * @param pvUser The user argument to the thread function.
|
---|
854 | * @param pfnThread The thread function.
|
---|
855 | * @param pfnWakeup The wakup callback. This is called on the EMT
|
---|
856 | * thread when a state change is pending.
|
---|
857 | * @param cbStack See RTThreadCreate.
|
---|
858 | * @param enmType See RTThreadCreate.
|
---|
859 | * @param pszName See RTThreadCreate.
|
---|
860 | */
|
---|
861 | DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
|
---|
862 | PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
|
---|
863 |
|
---|
864 | /** @name Exported PDM Thread Functions
|
---|
865 | * @{ */
|
---|
866 | DECLR3CALLBACKMEMBER(int, pfnThreadDestroy,(PPDMTHREAD pThread, int *pRcThread));
|
---|
867 | DECLR3CALLBACKMEMBER(int, pfnThreadIAmSuspending,(PPDMTHREAD pThread));
|
---|
868 | DECLR3CALLBACKMEMBER(int, pfnThreadIAmRunning,(PPDMTHREAD pThread));
|
---|
869 | DECLR3CALLBACKMEMBER(int, pfnThreadSleep,(PPDMTHREAD pThread, RTMSINTERVAL cMillies));
|
---|
870 | DECLR3CALLBACKMEMBER(int, pfnThreadSuspend,(PPDMTHREAD pThread));
|
---|
871 | DECLR3CALLBACKMEMBER(int, pfnThreadResume,(PPDMTHREAD pThread));
|
---|
872 | /** @} */
|
---|
873 |
|
---|
874 | /**
|
---|
875 | * Set up asynchronous handling of a suspend, reset or power off notification.
|
---|
876 | *
|
---|
877 | * This shall only be called when getting the notification. It must be called
|
---|
878 | * for each one.
|
---|
879 | *
|
---|
880 | * @returns VBox status code.
|
---|
881 | * @param pUsbIns The USB device instance.
|
---|
882 | * @param pfnAsyncNotify The callback.
|
---|
883 | * @thread EMT(0)
|
---|
884 | */
|
---|
885 | DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMUSBINS pUSbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify));
|
---|
886 |
|
---|
887 | /**
|
---|
888 | * Notify EMT(0) that the device has completed the asynchronous notification
|
---|
889 | * handling.
|
---|
890 | *
|
---|
891 | * This can be called at any time, spurious calls will simply be ignored.
|
---|
892 | *
|
---|
893 | * @param pUsbIns The USB device instance.
|
---|
894 | * @thread Any
|
---|
895 | */
|
---|
896 | DECLR3CALLBACKMEMBER(void, pfnAsyncNotificationCompleted, (PPDMUSBINS pUsbIns));
|
---|
897 |
|
---|
898 | /**
|
---|
899 | * Gets the reason for the most recent VM suspend.
|
---|
900 | *
|
---|
901 | * @returns The suspend reason. VMSUSPENDREASON_INVALID is returned if no
|
---|
902 | * suspend has been made or if the pUsbIns is invalid.
|
---|
903 | * @param pUsbIns The driver instance.
|
---|
904 | */
|
---|
905 | DECLR3CALLBACKMEMBER(VMSUSPENDREASON, pfnVMGetSuspendReason,(PPDMUSBINS pUsbIns));
|
---|
906 |
|
---|
907 | /**
|
---|
908 | * Gets the reason for the most recent VM resume.
|
---|
909 | *
|
---|
910 | * @returns The resume reason. VMRESUMEREASON_INVALID is returned if no
|
---|
911 | * resume has been made or if the pUsbIns is invalid.
|
---|
912 | * @param pUsbIns The driver instance.
|
---|
913 | */
|
---|
914 | DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMUSBINS pUsbIns));
|
---|
915 |
|
---|
916 | /**
|
---|
917 | * Queries a generic object from the VMM user.
|
---|
918 | *
|
---|
919 | * @returns Pointer to the object if found, NULL if not.
|
---|
920 | * @param pUsbIns The USB device instance.
|
---|
921 | * @param pUuid The UUID of what's being queried. The UUIDs and
|
---|
922 | * the usage conventions are defined by the user.
|
---|
923 | */
|
---|
924 | DECLR3CALLBACKMEMBER(void *, pfnQueryGenericUserObject,(PPDMUSBINS pUsbIns, PCRTUUID pUuid));
|
---|
925 |
|
---|
926 | /** @name Space reserved for minor interface changes.
|
---|
927 | * @{ */
|
---|
928 | DECLR3CALLBACKMEMBER(void, pfnReserved0,(PPDMUSBINS pUsbIns));
|
---|
929 | DECLR3CALLBACKMEMBER(void, pfnReserved1,(PPDMUSBINS pUsbIns));
|
---|
930 | DECLR3CALLBACKMEMBER(void, pfnReserved2,(PPDMUSBINS pUsbIns));
|
---|
931 | DECLR3CALLBACKMEMBER(void, pfnReserved3,(PPDMUSBINS pUsbIns));
|
---|
932 | DECLR3CALLBACKMEMBER(void, pfnReserved4,(PPDMUSBINS pUsbIns));
|
---|
933 | DECLR3CALLBACKMEMBER(void, pfnReserved5,(PPDMUSBINS pUsbIns));
|
---|
934 | DECLR3CALLBACKMEMBER(void, pfnReserved6,(PPDMUSBINS pUsbIns));
|
---|
935 | DECLR3CALLBACKMEMBER(void, pfnReserved7,(PPDMUSBINS pUsbIns));
|
---|
936 | DECLR3CALLBACKMEMBER(void, pfnReserved8,(PPDMUSBINS pUsbIns));
|
---|
937 | /** @} */
|
---|
938 |
|
---|
939 | /** Just a safety precaution. */
|
---|
940 | uint32_t u32TheEnd;
|
---|
941 | } PDMUSBHLP;
|
---|
942 | /** Pointer PDM USB Device API. */
|
---|
943 | typedef PDMUSBHLP *PPDMUSBHLP;
|
---|
944 | /** Pointer const PDM USB Device API. */
|
---|
945 | typedef const PDMUSBHLP *PCPDMUSBHLP;
|
---|
946 |
|
---|
947 | /** Current USBHLP version number. */
|
---|
948 | #define PDM_USBHLP_VERSION PDM_VERSION_MAKE(0xeefe, 7, 0)
|
---|
949 |
|
---|
950 | #endif /* IN_RING3 */
|
---|
951 |
|
---|
952 | /**
|
---|
953 | * PDM USB Device Instance.
|
---|
954 | */
|
---|
955 | typedef struct PDMUSBINS
|
---|
956 | {
|
---|
957 | /** Structure version. PDM_USBINS_VERSION defines the current version. */
|
---|
958 | uint32_t u32Version;
|
---|
959 | /** USB device instance number. */
|
---|
960 | uint32_t iInstance;
|
---|
961 | /** The base interface of the device.
|
---|
962 | * The device constructor initializes this if it has any device level
|
---|
963 | * interfaces to export. To obtain this interface call PDMR3QueryUSBDevice(). */
|
---|
964 | PDMIBASE IBase;
|
---|
965 | #if HC_ARCH_BITS == 32
|
---|
966 | uint32_t u32Alignment; /**< Alignment padding. */
|
---|
967 | #endif
|
---|
968 |
|
---|
969 | /** Internal data. */
|
---|
970 | union
|
---|
971 | {
|
---|
972 | #ifdef PDMUSBINSINT_DECLARED
|
---|
973 | PDMUSBINSINT s;
|
---|
974 | #endif
|
---|
975 | uint8_t padding[HC_ARCH_BITS == 32 ? 96 : 128];
|
---|
976 | } Internal;
|
---|
977 |
|
---|
978 | /** Pointer the PDM USB Device API. */
|
---|
979 | R3PTRTYPE(PCPDMUSBHLP) pHlpR3;
|
---|
980 | /** Pointer to the USB device registration structure. */
|
---|
981 | R3PTRTYPE(PCPDMUSBREG) pReg;
|
---|
982 | /** Configuration handle. */
|
---|
983 | R3PTRTYPE(PCFGMNODE) pCfg;
|
---|
984 | /** The (device) global configuration handle. */
|
---|
985 | R3PTRTYPE(PCFGMNODE) pCfgGlobal;
|
---|
986 | /** Pointer to device instance data. */
|
---|
987 | R3PTRTYPE(void *) pvInstanceDataR3;
|
---|
988 | /** Pointer to the VUSB Device structure.
|
---|
989 | * Internal to VUSB, don't touch.
|
---|
990 | * @todo Moved this to PDMUSBINSINT. */
|
---|
991 | R3PTRTYPE(void *) pvVUsbDev2;
|
---|
992 | /** Device name for using when logging.
|
---|
993 | * The constructor sets this and the destructor frees it. */
|
---|
994 | R3PTRTYPE(char *) pszName;
|
---|
995 | /** Tracing indicator. */
|
---|
996 | uint32_t fTracing;
|
---|
997 | /** The tracing ID of this device. */
|
---|
998 | uint32_t idTracing;
|
---|
999 | /** The port/device speed. HCs and emulated devices need to know. */
|
---|
1000 | VUSBSPEED enmSpeed;
|
---|
1001 |
|
---|
1002 | /** Padding to make achInstanceData aligned at 32 byte boundary. */
|
---|
1003 | uint32_t au32Padding[HC_ARCH_BITS == 32 ? 2 : 3];
|
---|
1004 |
|
---|
1005 | /** Device instance data. The size of this area is defined
|
---|
1006 | * in the PDMUSBREG::cbInstanceData field. */
|
---|
1007 | char achInstanceData[8];
|
---|
1008 | } PDMUSBINS;
|
---|
1009 |
|
---|
1010 | /** Current USBINS version number. */
|
---|
1011 | #define PDM_USBINS_VERSION PDM_VERSION_MAKE(0xeefd, 3, 0)
|
---|
1012 |
|
---|
1013 | /**
|
---|
1014 | * Checks the structure versions of the USB device instance and USB device
|
---|
1015 | * helpers, returning if they are incompatible.
|
---|
1016 | *
|
---|
1017 | * This shall be the first statement of the constructor!
|
---|
1018 | *
|
---|
1019 | * @param pUsbIns The USB device instance pointer.
|
---|
1020 | */
|
---|
1021 | #define PDMUSB_CHECK_VERSIONS_RETURN(pUsbIns) \
|
---|
1022 | do \
|
---|
1023 | { \
|
---|
1024 | PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
|
---|
1025 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION), \
|
---|
1026 | ("DevIns=%#x mine=%#x\n", (pUsbIns)->u32Version, PDM_USBINS_VERSION), \
|
---|
1027 | VERR_PDM_USBINS_VERSION_MISMATCH); \
|
---|
1028 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
|
---|
1029 | ("DevHlp=%#x mine=%#x\n", (pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
|
---|
1030 | VERR_PDM_USBHLPR3_VERSION_MISMATCH); \
|
---|
1031 | } while (0)
|
---|
1032 |
|
---|
1033 | /**
|
---|
1034 | * Quietly checks the structure versions of the USB device instance and
|
---|
1035 | * USB device helpers, returning if they are incompatible.
|
---|
1036 | *
|
---|
1037 | * This shall be invoked as the first statement in the destructor!
|
---|
1038 | *
|
---|
1039 | * @param pUsbIns The USB device instance pointer.
|
---|
1040 | */
|
---|
1041 | #define PDMUSB_CHECK_VERSIONS_RETURN_VOID(pUsbIns) \
|
---|
1042 | do \
|
---|
1043 | { \
|
---|
1044 | PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
|
---|
1045 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION) )) \
|
---|
1046 | { /* likely */ } else return; \
|
---|
1047 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION) )) \
|
---|
1048 | { /* likely */ } else return; \
|
---|
1049 | } while (0)
|
---|
1050 |
|
---|
1051 |
|
---|
1052 | /** Converts a pointer to the PDMUSBINS::IBase to a pointer to PDMUSBINS. */
|
---|
1053 | #define PDMIBASE_2_PDMUSB(pInterface) ( (PPDMUSBINS)((char *)(pInterface) - RT_UOFFSETOF(PDMUSBINS, IBase)) )
|
---|
1054 |
|
---|
1055 |
|
---|
1056 | /** @def PDMUSB_ASSERT_EMT
|
---|
1057 | * Assert that the current thread is the emulation thread.
|
---|
1058 | */
|
---|
1059 | #ifdef VBOX_STRICT
|
---|
1060 | # define PDMUSB_ASSERT_EMT(pUsbIns) pUsbIns->pHlpR3->pfnAssertEMT(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1061 | #else
|
---|
1062 | # define PDMUSB_ASSERT_EMT(pUsbIns) do { } while (0)
|
---|
1063 | #endif
|
---|
1064 |
|
---|
1065 | /** @def PDMUSB_ASSERT_OTHER
|
---|
1066 | * Assert that the current thread is NOT the emulation thread.
|
---|
1067 | */
|
---|
1068 | #ifdef VBOX_STRICT
|
---|
1069 | # define PDMUSB_ASSERT_OTHER(pUsbIns) pUsbIns->pHlpR3->pfnAssertOther(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1070 | #else
|
---|
1071 | # define PDMUSB_ASSERT_OTHER(pUsbIns) do { } while (0)
|
---|
1072 | #endif
|
---|
1073 |
|
---|
1074 | /** @def PDMUSB_SET_ERROR
|
---|
1075 | * Set the VM error. See PDMUsbHlpVMSetError() for printf like message
|
---|
1076 | * formatting.
|
---|
1077 | */
|
---|
1078 | #define PDMUSB_SET_ERROR(pUsbIns, rc, pszError) \
|
---|
1079 | PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, "%s", pszError)
|
---|
1080 |
|
---|
1081 | /** @def PDMUSB_SET_RUNTIME_ERROR
|
---|
1082 | * Set the VM runtime error. See PDMUsbHlpVMSetRuntimeError() for printf like
|
---|
1083 | * message formatting.
|
---|
1084 | */
|
---|
1085 | #define PDMUSB_SET_RUNTIME_ERROR(pUsbIns, fFlags, pszErrorId, pszError) \
|
---|
1086 | PDMUsbHlpVMSetRuntimeError(pUsbIns, fFlags, pszErrorId, "%s", pszError)
|
---|
1087 |
|
---|
1088 |
|
---|
1089 | #ifdef IN_RING3
|
---|
1090 |
|
---|
1091 | /**
|
---|
1092 | * @copydoc PDMUSBHLP::pfnDriverAttach
|
---|
1093 | */
|
---|
1094 | DECLINLINE(int) PDMUsbHlpDriverAttach(PPDMUSBINS pUsbIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
|
---|
1095 | {
|
---|
1096 | return pUsbIns->pHlpR3->pfnDriverAttach(pUsbIns, iLun, pBaseInterface, ppBaseInterface, pszDesc);
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | /**
|
---|
1100 | * VBOX_STRICT wrapper for pHlpR3->pfnDBGFStopV.
|
---|
1101 | *
|
---|
1102 | * @returns VBox status code which must be passed up to the VMM.
|
---|
1103 | * @param pUsbIns Device instance.
|
---|
1104 | * @param SRC_POS Use RT_SRC_POS.
|
---|
1105 | * @param pszFormat Message. (optional)
|
---|
1106 | * @param ... Message parameters.
|
---|
1107 | */
|
---|
1108 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(5, 6) PDMUsbDBGFStop(PPDMUSBINS pUsbIns, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
1109 | {
|
---|
1110 | #ifdef VBOX_STRICT
|
---|
1111 | int rc;
|
---|
1112 | va_list va;
|
---|
1113 | va_start(va, pszFormat);
|
---|
1114 | rc = pUsbIns->pHlpR3->pfnDBGFStopV(pUsbIns, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1115 | va_end(va);
|
---|
1116 | return rc;
|
---|
1117 | #else
|
---|
1118 | NOREF(pUsbIns);
|
---|
1119 | NOREF(pszFile);
|
---|
1120 | NOREF(iLine);
|
---|
1121 | NOREF(pszFunction);
|
---|
1122 | NOREF(pszFormat);
|
---|
1123 | return VINF_SUCCESS;
|
---|
1124 | #endif
|
---|
1125 | }
|
---|
1126 |
|
---|
1127 | /**
|
---|
1128 | * @copydoc PDMUSBHLP::pfnVMState
|
---|
1129 | */
|
---|
1130 | DECLINLINE(VMSTATE) PDMUsbHlpVMState(PPDMUSBINS pUsbIns)
|
---|
1131 | {
|
---|
1132 | return pUsbIns->pHlpR3->pfnVMState(pUsbIns);
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 | /**
|
---|
1136 | * @copydoc PDMUSBHLP::pfnThreadCreate
|
---|
1137 | */
|
---|
1138 | DECLINLINE(int) PDMUsbHlpThreadCreate(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
|
---|
1139 | PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
1140 | {
|
---|
1141 | return pUsbIns->pHlpR3->pfnThreadCreate(pUsbIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 |
|
---|
1145 | /**
|
---|
1146 | * @copydoc PDMUSBHLP::pfnSetAsyncNotification
|
---|
1147 | */
|
---|
1148 | DECLINLINE(int) PDMUsbHlpSetAsyncNotification(PPDMUSBINS pUsbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify)
|
---|
1149 | {
|
---|
1150 | return pUsbIns->pHlpR3->pfnSetAsyncNotification(pUsbIns, pfnAsyncNotify);
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 | /**
|
---|
1154 | * @copydoc PDMUSBHLP::pfnAsyncNotificationCompleted
|
---|
1155 | */
|
---|
1156 | DECLINLINE(void) PDMUsbHlpAsyncNotificationCompleted(PPDMUSBINS pUsbIns)
|
---|
1157 | {
|
---|
1158 | pUsbIns->pHlpR3->pfnAsyncNotificationCompleted(pUsbIns);
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | /**
|
---|
1162 | * Set the VM error message
|
---|
1163 | *
|
---|
1164 | * @returns rc.
|
---|
1165 | * @param pUsbIns The USB device instance.
|
---|
1166 | * @param rc VBox status code.
|
---|
1167 | * @param SRC_POS Use RT_SRC_POS.
|
---|
1168 | * @param pszFormat Error message format string.
|
---|
1169 | * @param ... Error message arguments.
|
---|
1170 | */
|
---|
1171 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMUsbHlpVMSetError(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
|
---|
1172 | const char *pszFormat, ...)
|
---|
1173 | {
|
---|
1174 | va_list va;
|
---|
1175 | va_start(va, pszFormat);
|
---|
1176 | rc = pUsbIns->pHlpR3->pfnVMSetErrorV(pUsbIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1177 | va_end(va);
|
---|
1178 | return rc;
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | /**
|
---|
1182 | * @copydoc PDMUSBHLP::pfnMMHeapAlloc
|
---|
1183 | */
|
---|
1184 | DECLINLINE(void *) PDMUsbHlpMMHeapAlloc(PPDMUSBINS pUsbIns, size_t cb)
|
---|
1185 | {
|
---|
1186 | return pUsbIns->pHlpR3->pfnMMHeapAlloc(pUsbIns, cb);
|
---|
1187 | }
|
---|
1188 |
|
---|
1189 | /**
|
---|
1190 | * @copydoc PDMUSBHLP::pfnMMHeapAllocZ
|
---|
1191 | */
|
---|
1192 | DECLINLINE(void *) PDMUsbHlpMMHeapAllocZ(PPDMUSBINS pUsbIns, size_t cb)
|
---|
1193 | {
|
---|
1194 | return pUsbIns->pHlpR3->pfnMMHeapAllocZ(pUsbIns, cb);
|
---|
1195 | }
|
---|
1196 |
|
---|
1197 | /**
|
---|
1198 | * Frees memory allocated by PDMUsbHlpMMHeapAlloc or PDMUsbHlpMMHeapAllocZ.
|
---|
1199 | *
|
---|
1200 | * @param pUsbIns The USB device instance.
|
---|
1201 | * @param pv The memory to free. NULL is fine.
|
---|
1202 | */
|
---|
1203 | DECLINLINE(void) PDMUsbHlpMMHeapFree(PPDMUSBINS pUsbIns, void *pv)
|
---|
1204 | {
|
---|
1205 | pUsbIns->pHlpR3->pfnMMHeapFree(pUsbIns, pv);
|
---|
1206 | }
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | * @copydoc PDMUSBHLP::pfnDBGFInfoRegisterArgv
|
---|
1210 | */
|
---|
1211 | DECLINLINE(int) PDMUsbHlpDBGFInfoRegisterArgv(PPDMUSBINS pUsbIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler)
|
---|
1212 | {
|
---|
1213 | return pUsbIns->pHlpR3->pfnDBGFInfoRegisterArgv(pUsbIns, pszName, pszDesc, pfnHandler);
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 | /**
|
---|
1217 | * @copydoc PDMUSBHLP::pfnTimerCreate
|
---|
1218 | */
|
---|
1219 | DECLINLINE(int) PDMUsbHlpTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
|
---|
1220 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer)
|
---|
1221 | {
|
---|
1222 | return pUsbIns->pHlpR3->pfnTimerCreate(pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, phTimer);
|
---|
1223 | }
|
---|
1224 |
|
---|
1225 | /**
|
---|
1226 | * @copydoc PDMUSBHLP::pfnTimerFromMicro
|
---|
1227 | */
|
---|
1228 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromMicro(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs)
|
---|
1229 | {
|
---|
1230 | return pUsbIns->pHlpR3->pfnTimerFromMicro(pUsbIns, hTimer, cMicroSecs);
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | /**
|
---|
1234 | * @copydoc PDMUSBHLP::pfnTimerFromMilli
|
---|
1235 | */
|
---|
1236 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromMilli(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs)
|
---|
1237 | {
|
---|
1238 | return pUsbIns->pHlpR3->pfnTimerFromMilli(pUsbIns, hTimer, cMilliSecs);
|
---|
1239 | }
|
---|
1240 |
|
---|
1241 | /**
|
---|
1242 | * @copydoc PDMUSBHLP::pfnTimerFromNano
|
---|
1243 | */
|
---|
1244 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs)
|
---|
1245 | {
|
---|
1246 | return pUsbIns->pHlpR3->pfnTimerFromNano(pUsbIns, hTimer, cNanoSecs);
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | /**
|
---|
1250 | * @copydoc PDMUSBHLP::pfnTimerGet
|
---|
1251 | */
|
---|
1252 | DECLINLINE(uint64_t) PDMUsbHlpTimerGet(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1253 | {
|
---|
1254 | return pUsbIns->pHlpR3->pfnTimerGet(pUsbIns, hTimer);
|
---|
1255 | }
|
---|
1256 |
|
---|
1257 | /**
|
---|
1258 | * @copydoc PDMUSBHLP::pfnTimerGetFreq
|
---|
1259 | */
|
---|
1260 | DECLINLINE(uint64_t) PDMUsbHlpTimerGetFreq(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1261 | {
|
---|
1262 | return pUsbIns->pHlpR3->pfnTimerGetFreq(pUsbIns, hTimer);
|
---|
1263 | }
|
---|
1264 |
|
---|
1265 | /**
|
---|
1266 | * @copydoc PDMUSBHLP::pfnTimerGetNano
|
---|
1267 | */
|
---|
1268 | DECLINLINE(uint64_t) PDMUsbHlpTimerGetNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1269 | {
|
---|
1270 | return pUsbIns->pHlpR3->pfnTimerGetNano(pUsbIns, hTimer);
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | /**
|
---|
1274 | * @copydoc PDMUSBHLP::pfnTimerIsActive
|
---|
1275 | */
|
---|
1276 | DECLINLINE(bool) PDMUsbHlpTimerIsActive(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1277 | {
|
---|
1278 | return pUsbIns->pHlpR3->pfnTimerIsActive(pUsbIns, hTimer);
|
---|
1279 | }
|
---|
1280 |
|
---|
1281 | /**
|
---|
1282 | * @copydoc PDMUSBHLP::pfnTimerIsLockOwner
|
---|
1283 | */
|
---|
1284 | DECLINLINE(bool) PDMUsbHlpTimerIsLockOwner(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1285 | {
|
---|
1286 | return pUsbIns->pHlpR3->pfnTimerIsLockOwner(pUsbIns, hTimer);
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | /**
|
---|
1290 | * @copydoc PDMUSBHLP::pfnTimerLockClock
|
---|
1291 | */
|
---|
1292 | DECLINLINE(int) PDMUsbHlpTimerLockClock(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1293 | {
|
---|
1294 | return pUsbIns->pHlpR3->pfnTimerLockClock(pUsbIns, hTimer);
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | /**
|
---|
1298 | * @copydoc PDMUSBHLP::pfnTimerLockClock2
|
---|
1299 | */
|
---|
1300 | DECLINLINE(int) PDMUsbHlpTimerLockClock2(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1301 | {
|
---|
1302 | return pUsbIns->pHlpR3->pfnTimerLockClock2(pUsbIns, hTimer, pCritSect);
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 | /**
|
---|
1306 | * @copydoc PDMUSBHLP::pfnTimerSet
|
---|
1307 | */
|
---|
1308 | DECLINLINE(int) PDMUsbHlpTimerSet(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t uExpire)
|
---|
1309 | {
|
---|
1310 | return pUsbIns->pHlpR3->pfnTimerSet(pUsbIns, hTimer, uExpire);
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | /**
|
---|
1314 | * @copydoc PDMUSBHLP::pfnTimerSetFrequencyHint
|
---|
1315 | */
|
---|
1316 | DECLINLINE(int) PDMUsbHlpTimerSetFrequencyHint(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint32_t uHz)
|
---|
1317 | {
|
---|
1318 | return pUsbIns->pHlpR3->pfnTimerSetFrequencyHint(pUsbIns, hTimer, uHz);
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 | /**
|
---|
1322 | * @copydoc PDMUSBHLP::pfnTimerSetMicro
|
---|
1323 | */
|
---|
1324 | DECLINLINE(int) PDMUsbHlpTimerSetMicro(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext)
|
---|
1325 | {
|
---|
1326 | return pUsbIns->pHlpR3->pfnTimerSetMicro(pUsbIns, hTimer, cMicrosToNext);
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | /**
|
---|
1330 | * @copydoc PDMUSBHLP::pfnTimerSetMillies
|
---|
1331 | */
|
---|
1332 | DECLINLINE(int) PDMUsbHlpTimerSetMillies(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
|
---|
1333 | {
|
---|
1334 | return pUsbIns->pHlpR3->pfnTimerSetMillies(pUsbIns, hTimer, cMilliesToNext);
|
---|
1335 | }
|
---|
1336 |
|
---|
1337 | /**
|
---|
1338 | * @copydoc PDMUSBHLP::pfnTimerSetNano
|
---|
1339 | */
|
---|
1340 | DECLINLINE(int) PDMUsbHlpTimerSetNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext)
|
---|
1341 | {
|
---|
1342 | return pUsbIns->pHlpR3->pfnTimerSetNano(pUsbIns, hTimer, cNanosToNext);
|
---|
1343 | }
|
---|
1344 |
|
---|
1345 | /**
|
---|
1346 | * @copydoc PDMUSBHLP::pfnTimerSetRelative
|
---|
1347 | */
|
---|
1348 | DECLINLINE(int) PDMUsbHlpTimerSetRelative(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now)
|
---|
1349 | {
|
---|
1350 | return pUsbIns->pHlpR3->pfnTimerSetRelative(pUsbIns, hTimer, cTicksToNext, pu64Now);
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 | /**
|
---|
1354 | * @copydoc PDMUSBHLP::pfnTimerStop
|
---|
1355 | */
|
---|
1356 | DECLINLINE(int) PDMUsbHlpTimerStop(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1357 | {
|
---|
1358 | return pUsbIns->pHlpR3->pfnTimerStop(pUsbIns, hTimer);
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 | /**
|
---|
1362 | * @copydoc PDMUSBHLP::pfnTimerUnlockClock
|
---|
1363 | */
|
---|
1364 | DECLINLINE(void) PDMUsbHlpTimerUnlockClock(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1365 | {
|
---|
1366 | pUsbIns->pHlpR3->pfnTimerUnlockClock(pUsbIns, hTimer);
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 | /**
|
---|
1370 | * @copydoc PDMUSBHLP::pfnTimerUnlockClock2
|
---|
1371 | */
|
---|
1372 | DECLINLINE(void) PDMUsbHlpTimerUnlockClock2(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1373 | {
|
---|
1374 | pUsbIns->pHlpR3->pfnTimerUnlockClock2(pUsbIns, hTimer, pCritSect);
|
---|
1375 | }
|
---|
1376 |
|
---|
1377 | /**
|
---|
1378 | * @copydoc PDMUSBHLP::pfnTimerSetCritSect
|
---|
1379 | */
|
---|
1380 | DECLINLINE(int) PDMUsbHlpTimerSetCritSect(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1381 | {
|
---|
1382 | return pUsbIns->pHlpR3->pfnTimerSetCritSect(pUsbIns, hTimer, pCritSect);
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | /**
|
---|
1386 | * @copydoc PDMUSBHLP::pfnTimerSave
|
---|
1387 | */
|
---|
1388 | DECLINLINE(int) PDMUsbHlpTimerSave(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1389 | {
|
---|
1390 | return pUsbIns->pHlpR3->pfnTimerSave(pUsbIns, hTimer, pSSM);
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | /**
|
---|
1394 | * @copydoc PDMUSBHLP::pfnTimerLoad
|
---|
1395 | */
|
---|
1396 | DECLINLINE(int) PDMUsbHlpTimerLoad(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1397 | {
|
---|
1398 | return pUsbIns->pHlpR3->pfnTimerLoad(pUsbIns, hTimer, pSSM);
|
---|
1399 | }
|
---|
1400 |
|
---|
1401 | /**
|
---|
1402 | * @copydoc PDMUSBHLP::pfnTimerDestroy
|
---|
1403 | */
|
---|
1404 | DECLINLINE(int) PDMUsbHlpTimerDestroy(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1405 | {
|
---|
1406 | return pUsbIns->pHlpR3->pfnTimerDestroy(pUsbIns, hTimer);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | /**
|
---|
1410 | * @copydoc PDMUSBHLP::pfnSSMRegister
|
---|
1411 | */
|
---|
1412 | DECLINLINE(int) PDMUsbHlpSSMRegister(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
|
---|
1413 | PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
|
---|
1414 | PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
|
---|
1415 | PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone)
|
---|
1416 | {
|
---|
1417 | return pUsbIns->pHlpR3->pfnSSMRegister(pUsbIns, uVersion, cbGuess,
|
---|
1418 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1419 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
1420 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
1421 | }
|
---|
1422 |
|
---|
1423 | /**
|
---|
1424 | * @copydoc PDMUSBHLP::pfnQueryGenericUserObject
|
---|
1425 | */
|
---|
1426 | DECLINLINE(void *) PDMUsbHlpQueryGenericUserObject(PPDMUSBINS pUsbIns, PCRTUUID pUuid)
|
---|
1427 | {
|
---|
1428 | return pUsbIns->pHlpR3->pfnQueryGenericUserObject(pUsbIns, pUuid);
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | #endif /* IN_RING3 */
|
---|
1432 |
|
---|
1433 |
|
---|
1434 |
|
---|
1435 | /** Pointer to callbacks provided to the VBoxUsbRegister() call. */
|
---|
1436 | typedef const struct PDMUSBREGCB *PCPDMUSBREGCB;
|
---|
1437 |
|
---|
1438 | /**
|
---|
1439 | * Callbacks for VBoxUSBDeviceRegister().
|
---|
1440 | */
|
---|
1441 | typedef struct PDMUSBREGCB
|
---|
1442 | {
|
---|
1443 | /** Interface version.
|
---|
1444 | * This is set to PDM_USBREG_CB_VERSION. */
|
---|
1445 | uint32_t u32Version;
|
---|
1446 |
|
---|
1447 | /**
|
---|
1448 | * Registers a device with the current VM instance.
|
---|
1449 | *
|
---|
1450 | * @returns VBox status code.
|
---|
1451 | * @param pCallbacks Pointer to the callback table.
|
---|
1452 | * @param pReg Pointer to the USB device registration record.
|
---|
1453 | * This data must be permanent and readonly.
|
---|
1454 | */
|
---|
1455 | DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMUSBREGCB pCallbacks, PCPDMUSBREG pReg));
|
---|
1456 | } PDMUSBREGCB;
|
---|
1457 |
|
---|
1458 | /** Current version of the PDMUSBREGCB structure. */
|
---|
1459 | #define PDM_USBREG_CB_VERSION PDM_VERSION_MAKE(0xeefc, 1, 0)
|
---|
1460 |
|
---|
1461 |
|
---|
1462 | /**
|
---|
1463 | * The VBoxUsbRegister callback function.
|
---|
1464 | *
|
---|
1465 | * PDM will invoke this function after loading a USB device module and letting
|
---|
1466 | * the module decide which devices to register and how to handle conflicts.
|
---|
1467 | *
|
---|
1468 | * @returns VBox status code.
|
---|
1469 | * @param pCallbacks Pointer to the callback table.
|
---|
1470 | * @param u32Version VBox version number.
|
---|
1471 | */
|
---|
1472 | typedef DECLCALLBACKTYPE(int, FNPDMVBOXUSBREGISTER,(PCPDMUSBREGCB pCallbacks, uint32_t u32Version));
|
---|
1473 |
|
---|
1474 | VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid,
|
---|
1475 | const char *pszCaptureFilename);
|
---|
1476 | VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, const char *pszBackend, const char *pszAddress, PCFGMNODE pSubTree,
|
---|
1477 | VUSBSPEED enmSpeed, uint32_t fMaskedIfs, const char *pszCaptureFilename);
|
---|
1478 | VMMR3DECL(int) PDMR3UsbDetachDevice(PUVM pUVM, PCRTUUID pUuid);
|
---|
1479 | VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM);
|
---|
1480 | VMMR3DECL(int) PDMR3UsbDriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
|
---|
1481 | PPPDMIBASE ppBase);
|
---|
1482 | VMMR3DECL(int) PDMR3UsbDriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
|
---|
1483 | const char *pszDriver, unsigned iOccurrence, uint32_t fFlags);
|
---|
1484 | VMMR3DECL(int) PDMR3UsbQueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase);
|
---|
1485 | VMMR3DECL(int) PDMR3UsbQueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
|
---|
1486 | const char *pszDriver, PPPDMIBASE ppBase);
|
---|
1487 |
|
---|
1488 | /** @} */
|
---|
1489 |
|
---|
1490 | RT_C_DECLS_END
|
---|
1491 |
|
---|
1492 | #endif /* !VBOX_INCLUDED_vmm_pdmusb_h */
|
---|