VirtualBox

source: vbox/trunk/include/VBox/pdmifs.h@ 7581

Last change on this file since 7581 was 6852, checked in by vboxsync, 17 years ago

FE/SDL: use feedback from the guest to decide if we need to switch off the VM hardly or not

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 93.4 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2008 innotek GmbH
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_pdmifs_h
27#define ___VBox_pdmifs_h
28
29#include <VBox/types.h>
30#include <VBox/hgcmsvc.h>
31
32__BEGIN_DECLS
33
34/** @defgroup grp_pdm_interfaces Interfaces
35 * @ingroup grp_pdm
36 * @{
37 */
38
39/**
40 * Driver interface identficators.
41 *
42 * @remark All interfaces have to be declared here. There is no such thing as
43 * private interface identifiers since they must be unique.
44 *
45 * That said, interface structures and other stuff can be put elsewhere,
46 * actually, it is best if this file is not flooded with structures that
47 * could be put closer to home.
48 */
49typedef enum PDMINTERFACE
50{
51 /** PDMIBASE - The interface everyone supports. */
52 PDMINTERFACE_BASE = 1,
53 /** PDMIMOUSEPORT - The mouse port interface. (Down) Coupled with PDMINTERFACE_MOUSE_CONNECTOR. */
54 PDMINTERFACE_MOUSE_PORT,
55 /** PDMIMOUSECONNECTOR - The mouse connector interface. (Up) Coupled with PDMINTERFACE_MOUSE_PORT. */
56 PDMINTERFACE_MOUSE_CONNECTOR,
57 /** PDMIKEYBOARDPORT - The keyboard port interface. (Down) Coupled with PDMINTERFACE_KEYBOARD_CONNECTOR. */
58 PDMINTERFACE_KEYBOARD_PORT,
59 /** PDMIKEYBOARDCONNECTOR - The keyboard connector interface. (Up) Coupled with PDMINTERFACE_KEYBOARD_PORT. */
60 PDMINTERFACE_KEYBOARD_CONNECTOR,
61 /** PDMIDISPLAYPORT - The display port interface. (Down) Coupled with PDMINTERFACE_DISPLAY_CONNECTOR. */
62 PDMINTERFACE_DISPLAY_PORT,
63 /** PDMIDISPLAYCONNECTOR - The display connector interface. (Up) Coupled with PDMINTERFACE_DISPLAY_PORT. */
64 PDMINTERFACE_DISPLAY_CONNECTOR,
65 /** PDMICHARPORT - The char notify interface. (Down) Coupled with PDMINTERFACE_CHAR. */
66 PDMINTERFACE_CHAR_PORT,
67 /** PDMICHAR - The char driver interface. (Up) Coupled with PDMINTERFACE_CHAR_PORT. */
68 PDMINTERFACE_CHAR,
69 /** PDMISTREAM - The stream driver interface (Up) No coupling.
70 * Used by a char driver to implement PDMINTERFACE_CHAR. */
71 PDMINTERFACE_STREAM,
72 /** PDMIBLOCKPORT - The block notify interface (Down) Coupled with PDMINTERFACE_BLOCK. */
73 PDMINTERFACE_BLOCK_PORT,
74 /** PDMIBLOCK - The block driver interface (Up) Coupled with PDMINTERFACE_BLOCK_PORT. */
75 PDMINTERFACE_BLOCK,
76 /** PDMIBLOCKBIOS - The block bios interface. (External) */
77 PDMINTERFACE_BLOCK_BIOS,
78 /** PDMIMOUNTNOTIFY - The mountable notification interface. (Down) Coupled with PDMINTERFACE_MOUNT. */
79 PDMINTERFACE_MOUNT_NOTIFY,
80 /** PDMIMOUNT - The mountable interface. (Up) Coupled with PDMINTERFACE_MOUNT_NOTIFY. */
81 PDMINTERFACE_MOUNT,
82 /** PDMIMEDIA - The media interface. (Up) No coupling.
83 * Used by a block unit driver to implement PDMINTERFACE_BLOCK and PDMINTERFACE_BLOCK_BIOS. */
84 PDMINTERFACE_MEDIA,
85 /** PDMIISCSITRANSPORT - The iSCSI transport interface (Up) No coupling.
86 * used by the iSCSI media driver. */
87 PDMINTERFACE_ISCSITRANSPORT,
88 /** PDMIMEDIAASYNC - Async version of the media interface (Down) Coupled with PDMINTERFACE_MEDIA_ASYNC_PORT. */
89 PDMINTERFACE_MEDIA_ASYNC,
90 /** PDMIMEDIAASYNCPORT - Async version of the media interface (Up) Coupled with PDMINTERFACE_MEDIA_ASYNC. */
91 PDMINTERFACE_MEDIA_ASYNC_PORT,
92 /** PDMIBLOCKASYNC - Async version of the block interface (Down) Coupled with PDMINTERFACE_BLOCK_ASYNC_PORT. */
93 PDMINTERFACE_BLOCK_ASYNC,
94 /** PDMIBLOCKASYNCPORT - Async version of the block interface (Up) Coupled with PDMINTERFACE_BLOCK_ASYNC. */
95 PDMINTERFACE_BLOCK_ASYNC_PORT,
96 /** PDMITRANSPORTASYNC - Transport data async to their target (Down) Coupled with PDMINTERFACE_TRANSPORT_ASYNC_PORT. */
97 PDMINTERFACE_TRANSPORT_ASYNC,
98 /** PDMITRANSPORTASYNCPORT - Transport data async to their target (Up) Coupled with PDMINTERFACE_TRANSPORT_ASYNC. */
99 PDMINTERFACE_TRANSPORT_ASYNC_PORT,
100
101
102 /** PDMINETWORKPORT - The network port interface. (Down) Coupled with PDMINTERFACE_NETWORK_CONNECTOR. */
103 PDMINTERFACE_NETWORK_PORT,
104 /** PDMINETWORKPORT - The network connector interface. (Up) Coupled with PDMINTERFACE_NETWORK_PORT. */
105 PDMINTERFACE_NETWORK_CONNECTOR,
106 /** PDMINETWORKCONFIG - The network configuartion interface. (Main) Used by the managment api. */
107 PDMINTERFACE_NETWORK_CONFIG,
108
109 /** PDMIAUDIOCONNECTOR - The audio driver interface. (Up) No coupling. */
110 PDMINTERFACE_AUDIO_CONNECTOR,
111
112 /** PDMIAUDIOSNIFFERPORT - The Audio Sniffer Device port interface. */
113 PDMINTERFACE_AUDIO_SNIFFER_PORT,
114 /** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
115 PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR,
116
117 /** PDMIVMMDEVPORT - The VMM Device port interface. */
118 PDMINTERFACE_VMMDEV_PORT,
119 /** PDMIVMMDEVCONNECTOR - The VMM Device connector interface. */
120 PDMINTERFACE_VMMDEV_CONNECTOR,
121
122 /** PDMILEDPORTS - The generic LED port interface. (Down) Coupled with PDMINTERFACE_LED_CONNECTORS. */
123 PDMINTERFACE_LED_PORTS,
124 /** PDMILEDCONNECTORS - The generic LED connector interface. (Up) Coupled with PDMINTERFACE_LED_PORTS. */
125 PDMINTERFACE_LED_CONNECTORS,
126
127 /** PDMIACPIPORT - ACPI port interface. (Down) Coupled with PDMINTERFACE_ACPI_CONNECTOR. */
128 PDMINTERFACE_ACPI_PORT,
129 /** PDMIACPICONNECTOR - ACPI connector interface. (Up) Coupled with PDMINTERFACE_ACPI_PORT. */
130 PDMINTERFACE_ACPI_CONNECTOR,
131
132 /** PDMIHGCMPORT - The Host-Guest communication manager port interface. Normally implemented by VMMDev. */
133 PDMINTERFACE_HGCM_PORT,
134 /** PDMIHGCMCONNECTOR - The Host-Guest communication manager connector interface. Normally implemented by Main::VMMDevInterface. */
135 PDMINTERFACE_HGCM_CONNECTOR,
136
137 /** VUSBIROOTHUBPORT - VUSB RootHub port interface. (Down) Coupled with PDMINTERFACE_USB_RH_CONNECTOR. */
138 PDMINTERFACE_VUSB_RH_PORT,
139 /** VUSBIROOTHUBCONNECTOR - VUSB RootHub connector interface. (Up) Coupled with PDMINTERFACE_USB_RH_PORT. */
140 PDMINTERFACE_VUSB_RH_CONNECTOR,
141 /** VUSBIRHCONFIG - VUSB RootHub configuration interface. (Main) Used by the managment api. */
142 PDMINTERFACE_VUSB_RH_CONFIG,
143
144 /** VUSBROOTHUBCONNECTOR - VUSB Device interface. (Up) No coupling. */
145 PDMINTERFACE_VUSB_DEVICE,
146
147 /** PDMIHOSTPARALLELPORT - The Host Parallel port interface. (Down) Coupled with PDMINTERFACE_HOST_PARALLEL_CONNECTOR. */
148 PDMINTERFACE_HOST_PARALLEL_PORT,
149 /** PDMIHOSTPARALLELCONNECTOR - The Host Parallel connector interface (Up) Coupled with PDMINTERFACE_HOST_PARALLEL_PORT. */
150 PDMINTERFACE_HOST_PARALLEL_CONNECTOR,
151
152 /** Maximum interface number. */
153 PDMINTERFACE_MAX
154} PDMINTERFACE;
155
156
157/**
158 * PDM Driver Base Interface.
159 */
160typedef struct PDMIBASE
161{
162 /**
163 * Queries an interface to the driver.
164 *
165 * @returns Pointer to interface.
166 * @returns NULL if the interface was not supported by the driver.
167 * @param pInterface Pointer to this interface structure.
168 * @param enmInterface The requested interface identification.
169 * @thread Any thread.
170 */
171 DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface));
172} PDMIBASE;
173
174
175/**
176 * Dummy interface.
177 *
178 * This is used to typedef other dummy interfaces. The purpose of a dummy
179 * interface is to validate the logical function of a driver/device and
180 * full a natural interface pair.
181 */
182typedef struct PDMIDUMMY
183{
184 RTHCPTR pvDummy;
185} PDMIDUMMY;
186
187
188/** Pointer to a mouse port interface. */
189typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
190/**
191 * Mouse port interface.
192 * Pair with PDMIMOUSECONNECTOR.
193 */
194typedef struct PDMIMOUSEPORT
195{
196 /**
197 * Puts a mouse event.
198 * This is called by the source of mouse events. The event will be passed up until the
199 * topmost driver, which then calls the registered event handler.
200 *
201 * @returns VBox status code.
202 * @param pInterface Pointer to this interface structure.
203 * @param i32DeltaX The X delta.
204 * @param i32DeltaY The Y delta.
205 * @param i32DeltaZ The Z delta.
206 * @param fButtonStates The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
207 * @thread The emulation thread.
208 */
209 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, uint32_t fButtonStates));
210} PDMIMOUSEPORT;
211
212/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
213 * @{ */
214#define PDMIMOUSEPORT_BUTTON_LEFT RT_BIT(0)
215#define PDMIMOUSEPORT_BUTTON_RIGHT RT_BIT(1)
216#define PDMIMOUSEPORT_BUTTON_MIDDLE RT_BIT(2)
217/** @} */
218
219
220/**
221 * Mouse connector interface.
222 * Pair with PDMIMOUSEPORT.
223 */
224typedef PDMIDUMMY PDMIMOUSECONNECTOR;
225 /** Pointer to a mouse connector interface. */
226typedef PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
227
228
229/** Pointer to a keyboard port interface. */
230typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
231/**
232 * Keyboard port interface.
233 * Pair with PDMIKEYBOARDCONNECTOR.
234 */
235typedef struct PDMIKEYBOARDPORT
236{
237 /**
238 * Puts a keyboard event.
239 * This is called by the source of keyboard events. The event will be passed up until the
240 * topmost driver, which then calls the registered event handler.
241 *
242 * @returns VBox status code.
243 * @param pInterface Pointer to this interface structure.
244 * @param u8KeyCode The keycode to queue.
245 * @thread The emulation thread.
246 */
247 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
248} PDMIKEYBOARDPORT;
249
250/**
251 * Keyboard LEDs.
252 */
253typedef enum PDMKEYBLEDS
254{
255 /** No leds. */
256 PDMKEYBLEDS_NONE = 0x0000,
257 /** Num Lock */
258 PDMKEYBLEDS_NUMLOCK = 0x0001,
259 /** Caps Lock */
260 PDMKEYBLEDS_CAPSLOCK = 0x0002,
261 /** Scroll Lock */
262 PDMKEYBLEDS_SCROLLLOCK = 0x0004
263} PDMKEYBLEDS;
264
265/** Pointer to keyboard connector interface. */
266typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
267
268
269/**
270 * Keyboard connector interface.
271 * Pair with PDMIKEYBOARDPORT
272 */
273typedef struct PDMIKEYBOARDCONNECTOR
274{
275 /**
276 * Notifies the the downstream driver about an LED change initiated by the guest.
277 *
278 * @param pInterface Pointer to the this interface.
279 * @param enmLeds The new led mask.
280 */
281 DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
282
283} PDMIKEYBOARDCONNECTOR;
284
285
286
287/** Pointer to a display port interface. */
288typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
289/**
290 * Display port interface.
291 * Pair with PDMIDISPLAYCONNECTOR.
292 */
293typedef struct PDMIDISPLAYPORT
294{
295 /**
296 * Update the display with any changed regions.
297 *
298 * Flushes any display changes to the memory pointed to by the
299 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
300 * while doing so.
301 *
302 * @returns VBox status code.
303 * @param pInterface Pointer to this interface.
304 * @thread The emulation thread.
305 */
306 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
307
308 /**
309 * Update the entire display.
310 *
311 * Flushes the entire display content to the memory pointed to by the
312 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
313 *
314 * @returns VBox status code.
315 * @param pInterface Pointer to this interface.
316 * @thread The emulation thread.
317 */
318 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface));
319
320 /**
321 * Return the current guest color depth in bits per pixel (bpp).
322 *
323 * As the graphics card is able to provide display updates with the bpp
324 * requested by the host, this method can be used to query the actual
325 * guest color depth.
326 *
327 * @returns VBox status code.
328 * @param pInterface Pointer to this interface.
329 * @param pcBits Where to store the current guest color depth.
330 * @thread Any thread.
331 */
332 DECLR3CALLBACKMEMBER(int, pfnQueryColorDepth,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits));
333
334 /**
335 * Sets the refresh rate and restart the timer.
336 * The rate is defined as the minimum interval between the return of
337 * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
338 *
339 * The interval timer will be restarted by this call. So at VM startup
340 * this function must be called to start the refresh cycle. The refresh
341 * rate is not saved, but have to be when resuming a loaded VM state.
342 *
343 * @returns VBox status code.
344 * @param pInterface Pointer to this interface.
345 * @param cMilliesInterval Number of millies between two refreshes.
346 * @thread Any thread.
347 */
348 DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
349
350 /**
351 * Create a 32-bbp snapshot of the display.
352 *
353 * This will create a 32-bbp bitmap with dword aligned scanline length. Because
354 * of a wish for no locks in the graphics device, this must be called from the
355 * emulation thread.
356 *
357 * @param pInterface Pointer to this interface.
358 * @param pvData Pointer the buffer to copy the bits to.
359 * @param cbData Size of the buffer.
360 * @param pcx Where to store the width of the bitmap. (optional)
361 * @param pcy Where to store the height of the bitmap. (optional)
362 * @param pcbData Where to store the actual size of the bitmap. (optional)
363 * @thread The emulation thread.
364 */
365 DECLR3CALLBACKMEMBER(int, pfnSnapshot,(PPDMIDISPLAYPORT pInterface, void *pvData, size_t cbData, uint32_t *pcx, uint32_t *pcy, size_t *pcbData));
366
367 /**
368 * Copy bitmap to the display.
369 *
370 * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
371 * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
372 *
373 * @param pInterface Pointer to this interface.
374 * @param pvData Pointer to the bitmap bits.
375 * @param x The upper left corner x coordinate of the destination rectangle.
376 * @param y The upper left corner y coordinate of the destination rectangle.
377 * @param cx The width of the source and destination rectangles.
378 * @param cy The height of the source and destination rectangles.
379 * @thread The emulation thread.
380 * @remark This is just a convenience for using the bitmap conversions of the
381 * graphics device.
382 */
383 DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
384
385 /**
386 * Render a rectangle from guest VRAM to Framebuffer.
387 *
388 * @param pInterface Pointer to this interface.
389 * @param x The upper left corner x coordinate of the rectangle to be updated.
390 * @param y The upper left corner y coordinate of the rectangle to be updated.
391 * @param cx The width of the rectangle to be updated.
392 * @param cy The height of the rectangle to be updated.
393 * @thread The emulation thread.
394 */
395 DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
396
397 /**
398 * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
399 * to render the VRAM to the framebuffer memory.
400 *
401 * @param pInterface Pointer to this interface.
402 * @param fRender Whether the VRAM content must be rendered to the framebuffer.
403 * @thread The emulation thread.
404 */
405 DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
406
407} PDMIDISPLAYPORT;
408
409
410/** Pointer to a display connector interface. */
411typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
412/**
413 * Display connector interface.
414 * Pair with PDMIDISPLAYPORT.
415 */
416typedef struct PDMIDISPLAYCONNECTOR
417{
418 /**
419 * Resize the display.
420 * This is called when the resolution changes. This usually happens on
421 * request from the guest os, but may also happen as the result of a reset.
422 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
423 * must not access the connector and return.
424 *
425 * @returns VINF_SUCCESS if the framebuffer resize was completed,
426 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
427 * @param pInterface Pointer to this interface.
428 * @param cBits Color depth (bits per pixel) of the new video mode.
429 * @param pvVRAM Address of the guest VRAM.
430 * @param cbLine Size in bytes of a single scan line.
431 * @param cx New display width.
432 * @param cy New display height.
433 * @thread The emulation thread.
434 */
435 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy));
436
437 /**
438 * Update a rectangle of the display.
439 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
440 *
441 * @param pInterface Pointer to this interface.
442 * @param x The upper left corner x coordinate of the rectangle.
443 * @param y The upper left corner y coordinate of the rectangle.
444 * @param cx The width of the rectangle.
445 * @param cy The height of the rectangle.
446 * @thread The emulation thread.
447 */
448 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
449
450 /**
451 * Refresh the display.
452 *
453 * The interval between these calls is set by
454 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
455 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
456 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
457 * the changed rectangles.
458 *
459 * @param pInterface Pointer to this interface.
460 * @thread The emulation thread.
461 */
462 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
463
464 /**
465 * Reset the display.
466 *
467 * Notification message when the graphics card has been reset.
468 *
469 * @param pInterface Pointer to this interface.
470 * @thread The emulation thread.
471 */
472 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
473
474 /**
475 * LFB video mode enter/exit.
476 *
477 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
478 *
479 * @param pInterface Pointer to this interface.
480 * @param fEnabled false - LFB mode was disabled,
481 * true - an LFB mode was disabled
482 * @thread The emulation thread.
483 */
484 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange, (PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
485
486 /**
487 * Process the guest graphics adapter information.
488 *
489 * Direct notification from guest to the display connector.
490 *
491 * @param pInterface Pointer to this interface.
492 * @param pvVRAM Address of the guest VRAM.
493 * @param u32VRAMSize Size of the guest VRAM.
494 * @thread The emulation thread.
495 */
496 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
497
498 /**
499 * Process the guest display information.
500 *
501 * Direct notification from guest to the display connector.
502 *
503 * @param pInterface Pointer to this interface.
504 * @param pvVRAM Address of the guest VRAM.
505 * @param uScreenId The index of the guest display to be processed.
506 * @thread The emulation thread.
507 */
508 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
509
510
511 /** Read-only attributes.
512 * For preformance reasons some readonly attributes are kept in the interface.
513 * We trust the interface users to respect the readonlyness of these.
514 * @{
515 */
516 /** Pointer to the display data buffer. */
517 uint8_t *pu8Data;
518 /** Size of a scanline in the data buffer. */
519 uint32_t cbScanline;
520 /** The color depth (in bits) the graphics card is supposed to provide. */
521 uint32_t cBits;
522 /** The display width. */
523 uint32_t cx;
524 /** The display height. */
525 uint32_t cy;
526 /** @} */
527} PDMIDISPLAYCONNECTOR;
528
529
530
531/**
532 * Block drive type.
533 */
534typedef enum PDMBLOCKTYPE
535{
536 /** Error (for the query function). */
537 PDMBLOCKTYPE_ERROR = 1,
538 /** 360KB 5 1/4" floppy drive. */
539 PDMBLOCKTYPE_FLOPPY_360,
540 /** 720KB 3 1/2" floppy drive. */
541 PDMBLOCKTYPE_FLOPPY_720,
542 /** 1.2MB 5 1/4" floppy drive. */
543 PDMBLOCKTYPE_FLOPPY_1_20,
544 /** 1.44MB 3 1/2" floppy drive. */
545 PDMBLOCKTYPE_FLOPPY_1_44,
546 /** 2.88MB 3 1/2" floppy drive. */
547 PDMBLOCKTYPE_FLOPPY_2_88,
548 /** CDROM drive. */
549 PDMBLOCKTYPE_CDROM,
550 /** DVD drive. */
551 PDMBLOCKTYPE_DVD,
552 /** Hard disk drive. */
553 PDMBLOCKTYPE_HARD_DISK
554} PDMBLOCKTYPE;
555
556
557/**
558 * Block raw command data transfer direction.
559 */
560typedef enum PDMBLOCKTXDIR
561{
562 PDMBLOCKTXDIR_NONE = 0,
563 PDMBLOCKTXDIR_FROM_DEVICE,
564 PDMBLOCKTXDIR_TO_DEVICE
565} PDMBLOCKTXDIR;
566
567/**
568 * Block notify interface.
569 * Pair with PDMIBLOCK.
570 */
571typedef PDMIDUMMY PDMIBLOCKPORT;
572/** Pointer to a block notify interface (dummy). */
573typedef PDMIBLOCKPORT *PPDMIBLOCKPORT;
574
575/** Pointer to a block interface. */
576typedef struct PDMIBLOCK *PPDMIBLOCK;
577/**
578 * Block interface.
579 * Pair with PDMIBLOCKPORT.
580 */
581typedef struct PDMIBLOCK
582{
583 /**
584 * Read bits.
585 *
586 * @returns VBox status code.
587 * @param pInterface Pointer to the interface structure containing the called function pointer.
588 * @param off Offset to start reading from.
589 * @param pvBuf Where to store the read bits.
590 * @param cbRead Number of bytes to read.
591 * @thread Any thread.
592 */
593 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
594
595 /**
596 * Write bits.
597 *
598 * @returns VBox status code.
599 * @param pInterface Pointer to the interface structure containing the called function pointer.
600 * @param off Offset to start writing at.
601 * @param pvBuf Where to store the write bits.
602 * @param cbWrite Number of bytes to write.
603 * @thread Any thread.
604 */
605 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
606
607 /**
608 * Make sure that the bits written are actually on the storage medium.
609 *
610 * @returns VBox status code.
611 * @param pInterface Pointer to the interface structure containing the called function pointer.
612 * @thread Any thread.
613 */
614 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCK pInterface));
615
616 /**
617 * Send a raw command to the underlying device (CDROM).
618 * This method is optional (i.e. the function pointer may be NULL).
619 *
620 * @returns VBox status code.
621 * @param pInterface Pointer to the interface structure containing the called function pointer.
622 * @param pbCmd Offset to start reading from.
623 * @param enmTxDir Direction of transfer.
624 * @param pvBuf Pointer tp the transfer buffer.
625 * @param cbBuf Size of the transfer buffer.
626 * @param pbSenseKey Status of the command (when return value is VERR_DEV_IO_ERROR).
627 * @param cTimeoutMillies Command timeout in milliseconds.
628 * @thread Any thread.
629 */
630 DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIBLOCK pInterface, const uint8_t *pbCmd, PDMBLOCKTXDIR enmTxDir, void *pvBuf, size_t *pcbBuf, uint8_t *pbSenseKey, uint32_t cTimeoutMillies));
631
632 /**
633 * Check if the media is readonly or not.
634 *
635 * @returns true if readonly.
636 * @returns false if read/write.
637 * @param pInterface Pointer to the interface structure containing the called function pointer.
638 * @thread Any thread.
639 */
640 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCK pInterface));
641
642 /**
643 * Gets the media size in bytes.
644 *
645 * @returns Media size in bytes.
646 * @param pInterface Pointer to the interface structure containing the called function pointer.
647 * @thread Any thread.
648 */
649 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCK pInterface));
650
651 /**
652 * Gets the block drive type.
653 *
654 * @returns block drive type.
655 * @param pInterface Pointer to the interface structure containing the called function pointer.
656 * @thread Any thread.
657 */
658 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCK pInterface));
659
660 /**
661 * Gets the UUID of the block drive.
662 * Don't return the media UUID if it's removable.
663 *
664 * @returns VBox status code.
665 * @param pInterface Pointer to the interface structure containing the called function pointer.
666 * @param pUuid Where to store the UUID on success.
667 * @thread Any thread.
668 */
669 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCK pInterface, PRTUUID pUuid));
670} PDMIBLOCK;
671
672
673/** Pointer to a mount interface. */
674typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
675/**
676 * Block interface.
677 * Pair with PDMIMOUNT.
678 */
679typedef struct PDMIMOUNTNOTIFY
680{
681 /**
682 * Called when a media is mounted.
683 *
684 * @param pInterface Pointer to the interface structure containing the called function pointer.
685 * @thread The emulation thread.
686 */
687 DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
688
689 /**
690 * Called when a media is unmounted
691 * @param pInterface Pointer to the interface structure containing the called function pointer.
692 * @thread The emulation thread.
693 */
694 DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
695} PDMIMOUNTNOTIFY;
696
697
698/* Pointer to mount interface. */
699typedef struct PDMIMOUNT *PPDMIMOUNT;
700/**
701 * Mount interface.
702 * Pair with PDMIMOUNTNOTIFY.
703 */
704typedef struct PDMIMOUNT
705{
706 /**
707 * Mount a media.
708 *
709 * This will not unmount any currently mounted media!
710 *
711 * @returns VBox status code.
712 * @param pInterface Pointer to the interface structure containing the called function pointer.
713 * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
714 * constructed a configuration which can be attached to the bottom driver.
715 * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
716 * @thread The emulation thread.
717 */
718 DECLR3CALLBACKMEMBER(int, pfnMount,(PPDMIMOUNT pInterface, const char *pszFilename, const char *pszCoreDriver));
719
720 /**
721 * Unmount the media.
722 *
723 * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
724 *
725 * @returns VBox status code.
726 * @param pInterface Pointer to the interface structure containing the called function pointer.
727 * @thread The emulation thread.
728 * @param fForce Force the unmount, even for locked media.
729 * @thread The emulation thread.
730 */
731 DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce));
732
733 /**
734 * Checks if a media is mounted.
735 *
736 * @returns true if mounted.
737 * @returns false if not mounted.
738 * @param pInterface Pointer to the interface structure containing the called function pointer.
739 * @thread Any thread.
740 */
741 DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
742
743 /**
744 * Locks the media, preventing any unmounting of it.
745 *
746 * @returns VBox status code.
747 * @param pInterface Pointer to the interface structure containing the called function pointer.
748 * @thread The emulation thread.
749 */
750 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
751
752 /**
753 * Unlocks the media, canceling previous calls to pfnLock().
754 *
755 * @returns VBox status code.
756 * @param pInterface Pointer to the interface structure containing the called function pointer.
757 * @thread The emulation thread.
758 */
759 DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
760
761 /**
762 * Checks if a media is locked.
763 *
764 * @returns true if locked.
765 * @returns false if not locked.
766 * @param pInterface Pointer to the interface structure containing the called function pointer.
767 * @thread Any thread.
768 */
769 DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
770} PDMIBLOCKMOUNT;
771
772/**
773 * Media geometry structure.
774 */
775typedef struct PDMMEDIAGEOMETRY
776{
777 /** Number of cylinders. */
778 uint32_t cCylinders;
779 /** Number of heads. */
780 uint32_t cHeads;
781 /** Number of sectors. */
782 uint32_t cSectors;
783} PDMMEDIAGEOMETRY;
784
785/** Pointer to media geometry structure. */
786typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
787/** Pointer to constant media geometry structure. */
788typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
789
790/** Pointer to a media interface. */
791typedef struct PDMIMEDIA *PPDMIMEDIA;
792/**
793 * Media interface.
794 * Makes up the foundation for PDMIBLOCK and PDMIBLOCKBIOS.
795 */
796typedef struct PDMIMEDIA
797{
798 /**
799 * Read bits.
800 *
801 * @returns VBox status code.
802 * @param pInterface Pointer to the interface structure containing the called function pointer.
803 * @param off Offset to start reading from.
804 * @param pvBuf Where to store the read bits.
805 * @param cbRead Number of bytes to read.
806 * @thread Any thread.
807 */
808 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
809
810 /**
811 * Write bits.
812 *
813 * @returns VBox status code.
814 * @param pInterface Pointer to the interface structure containing the called function pointer.
815 * @param off Offset to start writing at.
816 * @param pvBuf Where to store the write bits.
817 * @param cbWrite Number of bytes to write.
818 * @thread Any thread.
819 */
820 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
821
822 /**
823 * Make sure that the bits written are actually on the storage medium.
824 *
825 * @returns VBox status code.
826 * @param pInterface Pointer to the interface structure containing the called function pointer.
827 * @thread Any thread.
828 */
829 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
830
831 /**
832 * Get the media size in bytes.
833 *
834 * @returns Media size in bytes.
835 * @param pInterface Pointer to the interface structure containing the called function pointer.
836 * @thread Any thread.
837 */
838 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
839
840 /**
841 * Check if the media is readonly or not.
842 *
843 * @returns true if readonly.
844 * @returns false if read/write.
845 * @param pInterface Pointer to the interface structure containing the called function pointer.
846 * @thread Any thread.
847 */
848 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
849
850 /**
851 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
852 * This is an optional feature of a media.
853 *
854 * @returns VBox status code.
855 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
856 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
857 * @param pInterface Pointer to the interface structure containing the called function pointer.
858 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
859 * @remark This has no influence on the read/write operations.
860 * @thread Any thread.
861 */
862 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
863
864 /**
865 * Store the media geometry (physical CHS, PCHS) - BIOS property.
866 * This is an optional feature of a media.
867 *
868 * @returns VBox status code.
869 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
870 * @param pInterface Pointer to the interface structure containing the called function pointer.
871 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
872 * @remark This has no influence on the read/write operations.
873 * @thread The emulation thread.
874 */
875 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
876
877 /**
878 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
879 * This is an optional feature of a media.
880 *
881 * @returns VBox status code.
882 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
883 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
884 * @param pInterface Pointer to the interface structure containing the called function pointer.
885 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
886 * @remark This has no influence on the read/write operations.
887 * @thread Any thread.
888 */
889 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
890
891 /**
892 * Store the media geometry (logical CHS, LCHS) - BIOS property.
893 * This is an optional feature of a media.
894 *
895 * @returns VBox status code.
896 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
897 * @param pInterface Pointer to the interface structure containing the called function pointer.
898 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
899 * @remark This has no influence on the read/write operations.
900 * @thread The emulation thread.
901 */
902 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
903
904 /**
905 * Gets the UUID of the media drive.
906 *
907 * @returns VBox status code.
908 * @param pInterface Pointer to the interface structure containing the called function pointer.
909 * @param pUuid Where to store the UUID on success.
910 * @thread Any thread.
911 */
912 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
913
914} PDMIMEDIA;
915
916
917/** Pointer to a block BIOS interface. */
918typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
919/**
920 * Media BIOS interface.
921 * The interface the getting and setting properties which the BIOS/CMOS care about.
922 */
923typedef struct PDMIBLOCKBIOS
924{
925 /**
926 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
927 * This is an optional feature of a media.
928 *
929 * @returns VBox status code.
930 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
931 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetPCHSGeometry() yet.
932 * @param pInterface Pointer to the interface structure containing the called function pointer.
933 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
934 * @remark This has no influence on the read/write operations.
935 * @thread Any thread.
936 */
937 DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
938
939 /**
940 * Store the media geometry (physical CHS, PCHS) - BIOS property.
941 * This is an optional feature of a media.
942 *
943 * @returns VBox status code.
944 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
945 * @param pInterface Pointer to the interface structure containing the called function pointer.
946 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
947 * @remark This has no influence on the read/write operations.
948 * @thread The emulation thread.
949 */
950 DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
951
952 /**
953 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
954 * This is an optional feature of a media.
955 *
956 * @returns VBox status code.
957 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
958 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetLCHSGeometry() yet.
959 * @param pInterface Pointer to the interface structure containing the called function pointer.
960 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
961 * @remark This has no influence on the read/write operations.
962 * @thread Any thread.
963 */
964 DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
965
966 /**
967 * Store the media geometry (logical CHS, LCHS) - BIOS property.
968 * This is an optional feature of a media.
969 *
970 * @returns VBox status code.
971 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
972 * @param pInterface Pointer to the interface structure containing the called function pointer.
973 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
974 * @remark This has no influence on the read/write operations.
975 * @thread The emulation thread.
976 */
977 DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
978
979 /**
980 * Checks if the device should be visible to the BIOS or not.
981 *
982 * @returns true if the device is visible to the BIOS.
983 * @returns false if the device is not visible to the BIOS.
984 * @param pInterface Pointer to the interface structure containing the called function pointer.
985 * @thread Any thread.
986 */
987 DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
988
989 /**
990 * Gets the block drive type.
991 *
992 * @returns block drive type.
993 * @param pInterface Pointer to the interface structure containing the called function pointer.
994 * @thread Any thread.
995 */
996 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
997
998} PDMIBLOCKBIOS;
999
1000
1001/** Pointer to a static block core driver interface. */
1002typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
1003/**
1004 * Static block core driver interface.
1005 */
1006typedef struct PDMIMEDIASTATIC
1007{
1008 /**
1009 * Check if the specified file is a format which the core driver can handle.
1010 *
1011 * @returns true / false accordingly.
1012 * @param pInterface Pointer to the interface structure containing the called function pointer.
1013 * @param pszFilename Name of the file to probe.
1014 */
1015 DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
1016} PDMIMEDIASTATIC;
1017
1018
1019/** Pointer to an iSCSI Request PDU buffer. */
1020typedef struct ISCSIREQ *PISCSIREQ;
1021/**
1022 * iSCSI Request PDU buffer (gather).
1023 */
1024typedef struct ISCSIREQ
1025{
1026 /** Length of PDU segment in bytes. */
1027 size_t cbSeg;
1028 /** Pointer to PDU segment. */
1029 const void *pcvSeg;
1030} ISCSIREQ;
1031
1032/** Pointer to an iSCSI Response PDU buffer. */
1033typedef struct ISCSIRES *PISCSIRES;
1034/**
1035 * iSCSI Response PDU buffer (scatter).
1036 */
1037typedef struct ISCSIRES
1038{
1039 /** Length of PDU segment. */
1040 size_t cbSeg;
1041 /** Pointer to PDU segment. */
1042 void *pvSeg;
1043} ISCSIRES;
1044
1045/** Pointer to an iSCSI transport driver interface. */
1046typedef struct PDMIISCSITRANSPORT *PPDMIISCSITRANSPORT;
1047/**
1048 * iSCSI transport driver interface.
1049 */
1050typedef struct PDMIISCSITRANSPORT
1051{
1052 /**
1053 * Read bytes from an iSCSI transport stream. If the connection fails, it is automatically
1054 * reopened on the next call after the error is signalled. Error recovery in this case is
1055 * the duty of the caller.
1056 *
1057 * @returns VBox status code.
1058 * @param pTransport Pointer to the interface structure containing the called function pointer.
1059 * @param pvBuf Where to store the read bits.
1060 * @param cbBuf Number of bytes to read.
1061 * @param pcbRead Actual number of bytes read.
1062 * @thread Any thread.
1063 * @todo Correct the docs.
1064 */
1065 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIISCSITRANSPORT pTransport, PISCSIRES prgResponse, unsigned int cnResponse));
1066
1067 /**
1068 * Write bytes to an iSCSI transport stream. Padding is performed when necessary. If the connection
1069 * fails, it is automatically reopened on the next call after the error is signalled. Error recovery
1070 * in this case is the duty of the caller.
1071 *
1072 * @returns VBox status code.
1073 * @param pTransport Pointer to the interface structure containing the called function pointer.
1074 * @param pvBuf Where the write bits are stored.
1075 * @param cbWrite Number of bytes to write.
1076 * @thread Any thread.
1077 * @todo Correct the docs.
1078 */
1079 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIISCSITRANSPORT pTransport, PISCSIREQ prgRequest, unsigned int cnRequest));
1080
1081 /**
1082 * Open the iSCSI transport stream.
1083 *
1084 * @returns VBox status code.
1085 * @param pTransport Pointer to the interface structure containing the called function pointer.
1086 * @param pszTargetAddress Pointer to string of the format address:port.
1087 * @thread Any thread.
1088 */
1089 DECLR3CALLBACKMEMBER(int, pfnOpen,(PPDMIISCSITRANSPORT pTransport, const char *pszTargetAddress));
1090
1091 /**
1092 * Close the iSCSI transport stream.
1093 *
1094 * @returns VBox status code.
1095 * @param pTransport Pointer to the interface structure containing the called function pointer.
1096 * @thread Any thread.
1097 */
1098 DECLR3CALLBACKMEMBER(int, pfnClose,(PPDMIISCSITRANSPORT pTransport));
1099} PDMIISCSITRANSPORT;
1100
1101
1102/** Pointer to a asynchronous block notify interface. */
1103typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1104/**
1105 * Asynchronous block notify interface.
1106 * Pair with PDMIBLOCKASYNC.
1107 */
1108typedef struct PDMIBLOCKASYNCPORT
1109{
1110 /**
1111 * Notify completion of a read task.
1112 *
1113 * @returns VBox status code.
1114 * @param pInterface Pointer to the interface structure containing the called function pointer.
1115 * @param off Offset the task read from.
1116 * @param pvBuf The buffer containig the read data.
1117 * @param cbRead Number of bytes read.
1118 * @param pvUser The user argument given in pfnStartRead.
1119 * @thread Any thread.
1120 */
1121 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1122
1123 /**
1124 * Notify completion of a write task.
1125 *
1126 * @returns VBox status code.
1127 * @param pInterface Pointer to the interface structure containing the called function pointer.
1128 * @param off Offset the task has written to.
1129 * @param pvBuf The buffer containig the written data.
1130 * @param cbWrite Number of bytes actually written.
1131 * @param pvUser The user argument given in pfnStartWrite.
1132 * @thread Any thread.
1133 */
1134 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbWrite, void *pvUser));
1135} PDMIBLOCKASYNCPORT;
1136
1137
1138/** Pointer to a asynchronous block interface. */
1139typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1140/**
1141 * Asynchronous block interface.
1142 * Pair with PDMIBLOCKASYNCPORT.
1143 */
1144typedef struct PDMIBLOCKASYNC
1145{
1146 /**
1147 * Start reading task.
1148 *
1149 * @returns VBox status code.
1150 * @param pInterface Pointer to the interface structure containing the called function pointer.
1151 * @param off Offset to start reading from.
1152 * @param pvBuf Where to store the read bits.
1153 * @param cbRead Number of bytes to read.
1154 * @param pvUser User argument which is returned in completion callback.
1155 * @thread Any thread.
1156 */
1157 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1158
1159 /**
1160 * Write bits.
1161 *
1162 * @returns VBox status code.
1163 * @param pInterface Pointer to the interface structure containing the called function pointer.
1164 * @param off Offset to start writing at.
1165 * @param pvBuf Where to store the write bits.
1166 * @param cbWrite Number of bytes to write.
1167 * @param pvUser User argument which is returned in completion callback.
1168 * @thread Any thread.
1169 */
1170 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
1171
1172} PDMIBLOCKASYNC;
1173
1174
1175/** Pointer to a asynchronous notification interface. */
1176typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1177/**
1178 * Asynchronous media interface.
1179 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1180 */
1181typedef struct PDMIMEDIAASYNCPORT
1182{
1183 /**
1184 * Notify completion of a read task.
1185 *
1186 * @returns VBox status code.
1187 * @param pInterface Pointer to the interface structure containing the called function pointer.
1188 * @param off Offset the task read from.
1189 * @param pvBuf The buffer containig the read data.
1190 * @param cbRead Number of bytes read.
1191 * @param pvUser The user argument given in pfnStartRead.
1192 * @thread Any thread.
1193 */
1194 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1195
1196 /**
1197 * Notify completion of a write task.
1198 *
1199 * @returns VBox status code.
1200 * @param pInterface Pointer to the interface structure containing the called function pointer.
1201 * @param off Offset the task has written to.
1202 * @param pvBuf The buffer containig the written data.
1203 * @param cbWritten Number of bytes actually written.
1204 * @param pvUser The user argument given in pfnStartWrite.
1205 * @thread Any thread.
1206 */
1207 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbWritten, void *pvUser));
1208} PDMIMEDIAASYNCPORT;
1209
1210
1211/** Pointer to a asynchronous media interface. */
1212typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1213/**
1214 * Asynchronous media interface.
1215 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1216 */
1217typedef struct PDMIMEDIAASYNC
1218{
1219 /**
1220 * Start reading task.
1221 *
1222 * @returns VBox status code.
1223 * @param pInterface Pointer to the interface structure containing the called function pointer.
1224 * @param off Offset to start reading from.
1225 * @param pvBuf Where to store the read bits.
1226 * @param cbRead Number of bytes to read.
1227 * @param pvUser User data.
1228 * @thread Any thread.
1229 */
1230 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1231
1232 /**
1233 * Start writing task.
1234 *
1235 * @returns VBox status code.
1236 * @param pInterface Pointer to the interface structure containing the called function pointer.
1237 * @param off Offset to start writing at.
1238 * @param pvBuf Where to store the write bits.
1239 * @param cbWrite Number of bytes to write.
1240 * @param pvUser User data.
1241 * @thread Any thread.
1242 */
1243 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
1244
1245} PDMIMEDIAASYNC;
1246
1247
1248/** Pointer to a async media notify interface. */
1249typedef struct PDMITRANSPORTASYNCPORT *PPDMITRANSPORTASYNCPORT;
1250/**
1251 * Notification interface for completed I/O tasks.
1252 * Pair with PDMITRANSPORTASYNC.
1253 */
1254typedef struct PDMITRANSPORTASYNCPORT
1255{
1256 /**
1257 * Notify completion of a read task.
1258 *
1259 * @returns VBox status code.
1260 * @param pInterface Pointer to the interface structure containing the called function pointer.
1261 * @param off Offset the task read from.
1262 * @param pvBuf The buffer containig the read data.
1263 * @param cbRead Number of bytes read.
1264 * @param pvUser The user argument given in pfnStartRead.
1265 * @thread Any thread.
1266 */
1267 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1268
1269 /**
1270 * Notify completion of a write task.
1271 *
1272 * @returns VBox status code.
1273 * @param pInterface Pointer to the interface structure containing the called function pointer.
1274 * @param off Offset the task has written to.
1275 * @param pvBuf The buffer containig the written data.
1276 * @param cbWritten Number of bytes actually written.
1277 * @param pvUser The user argument given in pfnStartWrite.
1278 * @thread Any thread.
1279 */
1280 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, void *pvBuf, size_t cbWritten, void *pvUser));
1281} PDMITRANSPORTASYNCPORT;
1282
1283
1284/** Pointer to a async media interface. */
1285typedef struct PDMITRANSPORTASYNC *PPDMITRANSPORTASYNC;
1286/**
1287 * Asynchronous transport interface.
1288 * Makes up the fundation for PDMIMEDIAASYNC.
1289 */
1290typedef struct PDMITRANSPORTASYNC
1291{
1292 /**
1293 * Read bits synchronous.
1294 * Blocks until finished.
1295 *
1296 * @returns VBox status code.
1297 * @param pInterface Pointer to the interface structure containint the called function pointer.
1298 * @param off Offset to start reading from.
1299 * @param pvBuf here to store the read bits.
1300 * @param cbRead Number of bytes to read.
1301 * @param pcbRead Where to store the number of bytes actually read.
1302 * @thread Any thread.
1303 */
1304 DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead));
1305
1306 /**
1307 * Write bits synchronous.
1308 * Blocks until finished.
1309 *
1310 * @returns VBox status code.
1311 * @param pInterface Pointer to the interface structure containint the called function pointer.
1312 * @param off Offset to start reading from.
1313 * @param pvBuf here to store the read bits.
1314 * @param cbWrite Number of bytes to read.
1315 * @param pcbWritten Where to store the number of bytes actually read.
1316 * @thread Any thread.
1317 */
1318 DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbWrite, size_t *pcbWritten));
1319
1320 /**
1321 * Start asynchronous read.
1322 *
1323 * @returns VBox status code.
1324 * @param pInterface Pointer to the interface structure containing the called function pointer.
1325 * @param off Offset to start reading from.
1326 * @param pvBuf Where to store the read bits.
1327 * @param cbRead Number of bytes to read.
1328 * @param pvUser User argument returned in completion callback.
1329 * @thread Any thread.
1330 */
1331 DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, void *pvUser));
1332
1333 /**
1334 * Start asynchronous write.
1335 *
1336 * @returns VBox status code.
1337 * @param pInterface Pointer to the interface structure containing the called function pointer.
1338 * @param off Offset to start writing at.
1339 * @param pvBuf Where to store the write bits.
1340 * @param cbWrite Number of bytes to write.
1341 * @param pvUser User argument returned in completion callback.
1342 * @thread Any thread.
1343 */
1344 DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, const void *pvBuf, size_t cbWrite, void *pvUser));
1345
1346 /**
1347 * Make sure that the bits written are actually on the storage medium.
1348 * This is a synchronous task
1349 *
1350 * @returns VBox status code.
1351 * @param pInterface Pointer to the interface structure containing the called function pointer.
1352 * @thread Any thread.
1353 */
1354 DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMITRANSPORTASYNC pInterface));
1355
1356 /**
1357 * Get the media size in bytes.
1358 *
1359 * @returns Media size in bytes.
1360 * @param pInterface Pointer to the interface structure containing the called function pointer.
1361 * @thread Any thread.
1362 */
1363 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMITRANSPORTASYNC pInterface));
1364
1365 /**
1366 * Check if the media is readonly or not.
1367 *
1368 * @returns true if readonly.
1369 * @returns false if read/write.
1370 * @param pInterface Pointer to the interface structure containing the called function pointer.
1371 * @thread Any thread.
1372 */
1373 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMITRANSPORTASYNC pInterface));
1374
1375 /**
1376 * Opens the data source.
1377 *
1378 * @returns VBox status code.
1379 * @param pInterface Pointer to the interface structure containing the called function pointer.
1380 * @param pszPath The path to open.
1381 * @param fReadonly If the target shoudl opened readonly.
1382 * @thread Any thread.
1383 */
1384 DECLR3CALLBACKMEMBER(int, pfnOpen, (PPDMITRANSPORTASYNC pInterface, const char *pszTargetPath, bool fReadonly));
1385
1386 /**
1387 * Close the data source.
1388 *
1389 * @returns VBox status code.
1390 * @param pInterface Pointer to the interface structure containing the called function pointer.
1391 * @thread Any thread.
1392 */
1393 DECLR3CALLBACKMEMBER(int, pfnClose, (PPDMITRANSPORTASYNC pInterface));
1394
1395} PDMITRANSPORTASYNC;
1396
1397
1398/** @name Bit mask definitions for status line type
1399 * @{ */
1400#define PDM_ICHAR_STATUS_LINES_DCD RT_BIT(0)
1401#define PDM_ICHAR_STATUS_LINES_RI RT_BIT(1)
1402#define PDM_ICHAR_STATUS_LINES_DSR RT_BIT(2)
1403#define PDM_ICHAR_STATUS_LINES_CTS RT_BIT(3)
1404/** @} */
1405
1406/** Pointer to a char port interface. */
1407typedef struct PDMICHARPORT *PPDMICHARPORT;
1408/**
1409 * Char port interface.
1410 * Pair with PDMICHAR.
1411 */
1412typedef struct PDMICHARPORT
1413{
1414 /**
1415 * Deliver data read to the device/driver.
1416 *
1417 * @returns VBox status code.
1418 * @param pInterface Pointer to the interface structure containing the called function pointer.
1419 * @param pvBuf Where the read bits are stored.
1420 * @param pcbRead Number of bytes available for reading/having been read.
1421 * @thread Any thread.
1422 */
1423 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
1424
1425 /**
1426 * Notify the device/driver when the status lines changed.
1427 *
1428 * @returns VBox status code.
1429 * @param pInterface Pointer to the interface structure containing the called function pointer.
1430 * @param fNewStatusLine New state of the status line pins.
1431 * @thread Any thread.
1432 */
1433 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
1434} PDMICHARPORT;
1435
1436
1437/** Pointer to a char interface. */
1438typedef struct PDMICHAR *PPDMICHAR;
1439/**
1440 * Char interface.
1441 * Pair with PDMICHARPORT.
1442 */
1443typedef struct PDMICHAR
1444{
1445 /**
1446 * Write bits.
1447 *
1448 * @returns VBox status code.
1449 * @param pInterface Pointer to the interface structure containing the called function pointer.
1450 * @param pvBuf Where to store the write bits.
1451 * @param cbWrite Number of bytes to write.
1452 * @thread Any thread.
1453 */
1454 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
1455
1456 /**
1457 * Set device parameters.
1458 *
1459 * @returns VBox status code.
1460 * @param pInterface Pointer to the interface structure containing the called function pointer.
1461 * @param Bps Speed of the serial connection. (bits per second)
1462 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1463 * @param cDataBits Number of data bits.
1464 * @param cStopBits Number of stop bits.
1465 * @thread Any thread.
1466 */
1467 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1468
1469 /**
1470 * Set the state of the modem lines.
1471 *
1472 * @returns VBox status code.
1473 * @param pInterface Pointer to the interface structure containing the called function pointer.
1474 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1475 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1476 * @thread Any thread.
1477 */
1478 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHAR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1479
1480} PDMICHAR;
1481
1482
1483/** Pointer to a stream interface. */
1484typedef struct PDMISTREAM *PPDMISTREAM;
1485/**
1486 * Stream interface.
1487 * Makes up the foundation for PDMICHAR.
1488 */
1489typedef struct PDMISTREAM
1490{
1491 /**
1492 * Read bits.
1493 *
1494 * @returns VBox status code.
1495 * @param pInterface Pointer to the interface structure containing the called function pointer.
1496 * @param pvBuf Where to store the read bits.
1497 * @param cbRead Number of bytes to read/bytes actually read.
1498 * @thread Any thread.
1499 */
1500 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
1501
1502 /**
1503 * Write bits.
1504 *
1505 * @returns VBox status code.
1506 * @param pInterface Pointer to the interface structure containing the called function pointer.
1507 * @param pvBuf Where to store the write bits.
1508 * @param cbWrite Number of bytes to write/bytes actually written.
1509 * @thread Any thread.
1510 */
1511 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
1512} PDMISTREAM;
1513
1514
1515/** Mode of the parallel port */
1516typedef enum PDMPARALLELPORTMODE
1517{
1518 PDM_PARALLEL_PORT_MODE_COMPAT,
1519 PDM_PARALLEL_PORT_MODE_EPP,
1520 PDM_PARALLEL_PORT_MODE_ECP
1521} PDMPARALLELPORTMODE;
1522
1523/** Pointer to a host parallel port interface. */
1524typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1525/**
1526 * Host parallel port interface.
1527 * Pair with PDMIHOSTPARALLELCONNECTOR.
1528 */
1529typedef struct PDMIHOSTPARALLELPORT
1530{
1531 /**
1532 * Deliver data read to the device/driver.
1533 *
1534 * @returns VBox status code.
1535 * @param pInterface Pointer to the interface structure containing the called function pointer.
1536 * @param pvBuf Where the read bits are stored.
1537 * @param pcbRead Number of bytes available for reading/having been read.
1538 * @thread Any thread.
1539 */
1540 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMIHOSTPARALLELPORT pInterface, const void *pvBuf, size_t *pcbRead));
1541
1542 /**
1543 * Notify device/driver that an interrupt has occured.
1544 *
1545 * @returns VBox status code.
1546 * @param pInterface Pointer to the interface structure containing the called function pointer.
1547 * @thread Any thread.
1548 */
1549 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1550} PDMIHOSTPARALLELPORT;
1551
1552
1553
1554/** Pointer to a Host Parallel connector interface. */
1555typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1556/**
1557 * Host parallel connector interface
1558 * Pair with PDMIHOSTPARALLELPORT.
1559 */
1560typedef struct PDMIHOSTPARALLELCONNECTOR
1561{
1562 /**
1563 * Write bits.
1564 *
1565 * @returns VBox status code.
1566 * @param pInterface Pointer to the interface structure containing the called function pointer.
1567 * @param pvBuf Where to store the write bits.
1568 * @param pcbWrite Number of bytes to write/bytes actually written.
1569 * @thread Any thread.
1570 */
1571 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *pcbWrite));
1572
1573 /**
1574 * Read bits.
1575 *
1576 * @returns VBox status code.
1577 * @param pInterface Pointer to the interface structure containing the called function pointer.
1578 * @param pvBuf Where to store the read bits.
1579 * @param pcbRead Number of bytes to read/bytes actually read.
1580 * @thread Any thread.
1581 */
1582 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *pcbRead));
1583
1584 /**
1585 * Write control register bits.
1586 *
1587 * @returns VBox status code.
1588 * @param pInterface Pointer to the interface structure containing the called function pointer.
1589 * @param fReg The new control register value.
1590 * @thread Any thread.
1591 */
1592 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1593
1594 /**
1595 * Read control register bits.
1596 *
1597 * @returns VBox status code.
1598 * @param pInterface Pointer to the interface structure containing the called function pointer.
1599 * @param pfReg Where to store the control register bits.
1600 * @thread Any thread.
1601 */
1602 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1603
1604 /**
1605 * Read status register bits.
1606 *
1607 * @returns VBox status code.
1608 * @param pInterface Pointer to the interface structure containing the called function pointer.
1609 * @param pfReg Where to store the status register bits.
1610 * @thread Any thread.
1611 */
1612 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1613
1614 /**
1615 * Set mode of the host parallel port.
1616 *
1617 * @returns VBox status code.
1618 * @param pInterface Pointer to the interface structure containing the called function pointer.
1619 * @param enmMode The mode of the host parallel port.
1620 * @thread Any thread.
1621 */
1622 DECLR3CALLBACKMEMBER(int, pfnSetMode,(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode));
1623} PDMIHOSTPARALLELCONNECTOR;
1624
1625
1626/** ACPI power source identifier */
1627typedef enum PDMACPIPOWERSOURCE
1628{
1629 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1630 PDM_ACPI_POWER_SOURCE_OUTLET,
1631 PDM_ACPI_POWER_SOURCE_BATTERY
1632} PDMACPIPOWERSOURCE;
1633/** Pointer to ACPI battery state. */
1634typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1635
1636/** ACPI battey capacity */
1637typedef enum PDMACPIBATCAPACITY
1638{
1639 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1640 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1641 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1642} PDMACPIBATCAPACITY;
1643/** Pointer to ACPI battery capacity. */
1644typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1645
1646/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1647typedef enum PDMACPIBATSTATE
1648{
1649 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1650 PDM_ACPI_BAT_STATE_CHARGING = 0x01,
1651 PDM_ACPI_BAT_STATE_DISCHARGING = 0x02,
1652 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1653} PDMACPIBATSTATE;
1654/** Pointer to ACPI battery state. */
1655typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1656
1657/** Pointer to an ACPI port interface. */
1658typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1659/**
1660 * ACPI port interface.
1661 */
1662typedef struct PDMIACPIPORT
1663{
1664 /**
1665 * Send an ACPI power off event.
1666 *
1667 * @returns VBox status code
1668 * @param pInterface Pointer to the interface structure containing the called function pointer.
1669 */
1670 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1671
1672 /**
1673 * Send an ACPI sleep button event.
1674 *
1675 * @returns VBox status code
1676 * @param pInterface Pointer to the interface structure containing the called function pointer.
1677 */
1678 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1679
1680 /**
1681 * Check if the last power button event was handled by the guest.
1682 *
1683 * @returns VBox status code
1684 * @param pInterface Pointer to the interface structure containing the called function pointer.
1685 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1686 */
1687 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1688} PDMIACPIPORT;
1689
1690/** Pointer to an ACPI connector interface. */
1691typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1692/**
1693 * ACPI connector interface.
1694 */
1695typedef struct PDMIACPICONNECTOR
1696{
1697 /**
1698 * Get the current power source of the host system.
1699 *
1700 * @returns VBox status code
1701 * @param pInterface Pointer to the interface structure containing the called function pointer.
1702 * @param penmPowerSource Pointer to the power source result variable.
1703 */
1704 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1705
1706 /**
1707 * Query the current battery status of the host system.
1708 *
1709 * @returns VBox status code?
1710 * @param pInterface Pointer to the interface structure containing the called function pointer.
1711 * @param pfPresent Is set to true if battery is present, false otherwise.
1712 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1713 * @param penmBatteryState Pointer to the battery status.
1714 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1715 */
1716 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1717 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1718} PDMIACPICONNECTOR;
1719
1720
1721/** Pointer to a VMMDevice port interface. */
1722typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1723/**
1724 * VMMDevice port interface.
1725 */
1726typedef struct PDMIVMMDEVPORT
1727{
1728 /**
1729 * Return the current absolute mouse position in pixels
1730 *
1731 * @returns VBox status code
1732 * @param pAbsX Pointer of result value, can be NULL
1733 * @param pAbsY Pointer of result value, can be NULL
1734 */
1735 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
1736
1737 /**
1738 * Set the new absolute mouse position in pixels
1739 *
1740 * @returns VBox status code
1741 * @param absX New absolute X position
1742 * @param absY New absolute Y position
1743 */
1744 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
1745
1746 /**
1747 * Return the current mouse capability flags
1748 *
1749 * @returns VBox status code
1750 * @param pCapabilities Pointer of result value
1751 */
1752 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
1753
1754 /**
1755 * Set the current mouse capability flag (host side)
1756 *
1757 * @returns VBox status code
1758 * @param capabilities Capability mask
1759 */
1760 DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
1761
1762 /**
1763 * Issue a display resolution change request.
1764 *
1765 * Note that there can only one request in the queue and that in case the guest does
1766 * not process it, issuing another request will overwrite the previous.
1767 *
1768 * @returns VBox status code
1769 * @param cx Horizontal pixel resolution (0 = do not change).
1770 * @param cy Vertical pixel resolution (0 = do not change).
1771 * @param cBits Bits per pixel (0 = do not change).
1772 * @param display The display index.
1773 */
1774 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
1775
1776 /**
1777 * Pass credentials to guest.
1778 *
1779 * Note that there can only be one set of credentials and the guest may or may not
1780 * query them and may do whatever it wants with them.
1781 *
1782 * @returns VBox status code
1783 * @param pszUsername User name, may be empty (UTF-8)
1784 * @param pszPassword Password, may be empty (UTF-8)
1785 * @param pszDomain Domain name, may be empty (UTF-8)
1786 * @param fFlags Bitflags
1787 */
1788 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1789 const char *pszPassword, const char *pszDomain,
1790 uint32_t fFlags));
1791
1792 /**
1793 * Notify the driver about a VBVA status change.
1794 *
1795 * @returns Nothing. Because it is informational callback.
1796 * @param fEnabled Current VBVA status.
1797 */
1798 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1799
1800 /**
1801 * Issue a seamless mode change request.
1802 *
1803 * Note that there can only one request in the queue and that in case the guest does
1804 * not process it, issuing another request will overwrite the previous.
1805 *
1806 * @returns VBox status code
1807 * @param fEnabled Seamless mode enabled or not
1808 */
1809 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1810
1811 /**
1812 * Issue a memory balloon change request.
1813 *
1814 * Note that there can only one request in the queue and that in case the guest does
1815 * not process it, issuing another request will overwrite the previous.
1816 *
1817 * @returns VBox status code
1818 * @param ulBalloonSize Balloon size in megabytes
1819 */
1820 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize));
1821
1822 /**
1823 * Issue a statistcs interval change request.
1824 *
1825 * Note that there can only one request in the queue and that in case the guest does
1826 * not process it, issuing another request will overwrite the previous.
1827 *
1828 * @returns VBox status code
1829 * @param ulStatInterval Statistics query interval in seconds (0=disable)
1830 */
1831 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval));
1832
1833 /**
1834 * Notify the guest about a VRDP status change.
1835 *
1836 * @returns VBox status code
1837 * @param fVRDPEnabled Current VRDP status.
1838 * @param u32VRDPExperienceLevel Which visual effects to be disabled in the guest.
1839 */
1840 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel));
1841
1842} PDMIVMMDEVPORT;
1843
1844/** Forward declaration of the video accelerator command memory. */
1845struct _VBVAMEMORY;
1846/** Forward declaration of the guest information structure. */
1847struct VBoxGuestInfo;
1848/** Forward declaration of the guest statistics structure */
1849struct VBoxGuestStatistics;
1850/** Pointer to video accelerator command memory. */
1851typedef struct _VBVAMEMORY *PVBVAMEMORY;
1852
1853/** Pointer to a VMMDev connector interface. */
1854typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1855/**
1856 * VMMDev connector interface.
1857 * Pair with PDMIVMMDEVPORT.
1858 */
1859typedef struct PDMIVMMDEVCONNECTOR
1860{
1861 /**
1862 * Report guest OS version.
1863 * Called whenever the Additions issue a guest version report request.
1864 *
1865 * @param pInterface Pointer to this interface.
1866 * @param pGuestInfo Pointer to guest information structure
1867 * @thread The emulation thread.
1868 */
1869 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
1870
1871 /**
1872 * Update the guest additions capabilities.
1873 * This is called when the guest additions capabilities change. The new capabilities
1874 * are given and the connector should update its internal state.
1875 *
1876 * @param pInterface Pointer to this interface.
1877 * @param newCapabilities New capabilities.
1878 * @thread The emulation thread.
1879 */
1880 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1881
1882 /**
1883 * Update the mouse capabilities.
1884 * This is called when the mouse capabilities change. The new capabilities
1885 * are given and the connector should update its internal state.
1886 *
1887 * @param pInterface Pointer to this interface.
1888 * @param newCapabilities New capabilities.
1889 * @thread The emulation thread.
1890 */
1891 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1892
1893 /**
1894 * Update the pointer shape.
1895 * This is called when the mouse pointer shape changes. The new shape
1896 * is passed as a caller allocated buffer that will be freed after returning
1897 *
1898 * @param pInterface Pointer to this interface.
1899 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1900 * @param fAlpha Flag whether alpha channel is being passed.
1901 * @param xHot Pointer hot spot x coordinate.
1902 * @param yHot Pointer hot spot y coordinate.
1903 * @param x Pointer new x coordinate on screen.
1904 * @param y Pointer new y coordinate on screen.
1905 * @param cx Pointer width in pixels.
1906 * @param cy Pointer height in pixels.
1907 * @param cbScanline Size of one scanline in bytes.
1908 * @param pvShape New shape buffer.
1909 * @thread The emulation thread.
1910 */
1911 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1912 uint32_t xHot, uint32_t yHot,
1913 uint32_t cx, uint32_t cy,
1914 void *pvShape));
1915
1916 /**
1917 * Enable or disable video acceleration on behalf of guest.
1918 *
1919 * @param pInterface Pointer to this interface.
1920 * @param fEnable Whether to enable acceleration.
1921 * @param pVbvaMemory Video accelerator memory.
1922
1923 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1924 * @thread The emulation thread.
1925 */
1926 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
1927
1928 /**
1929 * Force video queue processing.
1930 *
1931 * @param pInterface Pointer to this interface.
1932 * @thread The emulation thread.
1933 */
1934 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
1935
1936 /**
1937 * Return whether the given video mode is supported/wanted by the host.
1938 *
1939 * @returns VBox status code
1940 * @param pInterface Pointer to this interface.
1941 * @param cy Video mode horizontal resolution in pixels.
1942 * @param cx Video mode vertical resolution in pixels.
1943 * @param cBits Video mode bits per pixel.
1944 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
1945 * @thread The emulation thread.
1946 */
1947 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
1948
1949 /**
1950 * Queries by how many pixels the height should be reduced when calculating video modes
1951 *
1952 * @returns VBox status code
1953 * @param pInterface Pointer to this interface.
1954 * @param pcyReduction Pointer to the result value.
1955 * @thread The emulation thread.
1956 */
1957 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
1958
1959 /**
1960 * Informs about a credentials judgement result from the guest.
1961 *
1962 * @returns VBox status code
1963 * @param pInterface Pointer to this interface.
1964 * @param fFlags Judgement result flags.
1965 * @thread The emulation thread.
1966 */
1967 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
1968
1969 /**
1970 * Set the visible region of the display
1971 *
1972 * @returns VBox status code.
1973 * @param pInterface Pointer to this interface.
1974 * @param cRect Number of rectangles in pRect
1975 * @param pRect Rectangle array
1976 * @thread The emulation thread.
1977 */
1978 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
1979
1980 /**
1981 * Query the visible region of the display
1982 *
1983 * @returns VBox status code.
1984 * @param pInterface Pointer to this interface.
1985 * @param pcRect Number of rectangles in pRect
1986 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
1987 * @thread The emulation thread.
1988 */
1989 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
1990
1991 /**
1992 * Request the statistics interval
1993 *
1994 * @returns VBox status code.
1995 * @param pInterface Pointer to this interface.
1996 * @param pulInterval Pointer to interval in seconds
1997 * @thread The emulation thread.
1998 */
1999 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2000
2001 /**
2002 * Report new guest statistics
2003 *
2004 * @returns VBox status code.
2005 * @param pInterface Pointer to this interface.
2006 * @param pGuestStats Guest statistics
2007 * @thread The emulation thread.
2008 */
2009 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2010
2011 /**
2012 * Inflate or deflate the memory balloon
2013 *
2014 * @returns VBox status code.
2015 * @param pInterface Pointer to this interface.
2016 * @param fInflate Inflate or deflate
2017 * @param cPages Number of physical pages (must be 256 as we allocate in 1 MB chunks)
2018 * @param aPhysPage Array of physical page addresses
2019 * @thread The emulation thread.
2020 */
2021 DECLR3CALLBACKMEMBER(int, pfnChangeMemoryBalloon, (PPDMIVMMDEVCONNECTOR pInterface, bool fInflate, uint32_t cPages, RTGCPHYS *aPhysPage));
2022
2023} PDMIVMMDEVCONNECTOR;
2024
2025
2026/**
2027 * MAC address.
2028 * (The first 24 bits are the 'company id', where the first bit seems to have a special meaning if set.)
2029 */
2030typedef union PDMMAC
2031{
2032 /** 8-bit view. */
2033 uint8_t au8[6];
2034 /** 16-bit view. */
2035 uint16_t au16[3];
2036} PDMMAC;
2037/** Pointer to a MAC address. */
2038typedef PDMMAC *PPDMMAC;
2039/** Pointer to a const MAC address. */
2040typedef const PDMMAC *PCPDMMAC;
2041
2042
2043/** Pointer to a network port interface */
2044typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
2045/**
2046 * Network port interface.
2047 */
2048typedef struct PDMINETWORKPORT
2049{
2050 /**
2051 * Check how much data the device/driver can receive data now.
2052 * This must be called before the pfnRecieve() method is called.
2053 *
2054 * @returns Number of bytes the device can receive now.
2055 * @param pInterface Pointer to the interface structure containing the called function pointer.
2056 * @thread EMT
2057 */
2058 DECLR3CALLBACKMEMBER(size_t, pfnCanReceive,(PPDMINETWORKPORT pInterface));
2059
2060 /**
2061 * Receive data from the network.
2062 *
2063 * @returns VBox status code.
2064 * @param pInterface Pointer to the interface structure containing the called function pointer.
2065 * @param pvBuf The available data.
2066 * @param cb Number of bytes available in the buffer.
2067 * @thread EMT
2068 */
2069 DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
2070
2071} PDMINETWORKPORT;
2072
2073
2074/**
2075 * Network link state.
2076 */
2077typedef enum PDMNETWORKLINKSTATE
2078{
2079 /** Invalid state. */
2080 PDMNETWORKLINKSTATE_INVALID = 0,
2081 /** The link is up. */
2082 PDMNETWORKLINKSTATE_UP,
2083 /** The link is down. */
2084 PDMNETWORKLINKSTATE_DOWN,
2085 /** The link is temporarily down while resuming. */
2086 PDMNETWORKLINKSTATE_DOWN_RESUME
2087} PDMNETWORKLINKSTATE;
2088
2089
2090/** Pointer to a network connector interface */
2091typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
2092/**
2093 * Network connector interface.
2094 */
2095typedef struct PDMINETWORKCONNECTOR
2096{
2097 /**
2098 * Send data to the network.
2099 *
2100 * @returns VBox status code.
2101 * @param pInterface Pointer to the interface structure containing the called function pointer.
2102 * @param pvBuf Data to send.
2103 * @param cb Number of bytes to send.
2104 * @thread EMT
2105 */
2106 DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
2107
2108 /**
2109 * Set promiscuous mode.
2110 *
2111 * This is called when the promiscuous mode is set. This means that there doesn't have
2112 * to be a mode change when it's called.
2113 *
2114 * @param pInterface Pointer to the interface structure containing the called function pointer.
2115 * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
2116 * @thread EMT
2117 */
2118 DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
2119
2120 /**
2121 * Notification on link status changes.
2122 *
2123 * @param pInterface Pointer to the interface structure containing the called function pointer.
2124 * @param enmLinkState The new link state.
2125 * @thread EMT
2126 */
2127 DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
2128
2129 /**
2130 * More receive buffer has become available.
2131 *
2132 * This is called when the NIC frees up receive buffers.
2133 *
2134 * @param pInterface Pointer to the interface structure containing the called function pointer.
2135 * @thread EMT
2136 */
2137 DECLR3CALLBACKMEMBER(void, pfnNotifyCanReceive,(PPDMINETWORKCONNECTOR pInterface));
2138
2139} PDMINETWORKCONNECTOR;
2140
2141
2142/** Pointer to a network config port interface */
2143typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
2144/**
2145 * Network config port interface.
2146 */
2147typedef struct PDMINETWORKCONFIG
2148{
2149 /**
2150 * Gets the current Media Access Control (MAC) address.
2151 *
2152 * @returns VBox status code.
2153 * @param pInterface Pointer to the interface structure containing the called function pointer.
2154 * @param pMac Where to store the MAC address.
2155 * @thread EMT
2156 */
2157 DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PPDMMAC *pMac));
2158
2159 /**
2160 * Gets the new link state.
2161 *
2162 * @returns The current link state.
2163 * @param pInterface Pointer to the interface structure containing the called function pointer.
2164 * @thread EMT
2165 */
2166 DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
2167
2168 /**
2169 * Sets the new link state.
2170 *
2171 * @returns VBox status code.
2172 * @param pInterface Pointer to the interface structure containing the called function pointer.
2173 * @param enmState The new link state
2174 * @thread EMT
2175 */
2176 DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
2177
2178} PDMINETWORKCONFIG;
2179
2180
2181/** Pointer to a network connector interface */
2182typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2183/**
2184 * Audio connector interface.
2185 */
2186typedef struct PDMIAUDIOCONNECTOR
2187{
2188 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2189
2190/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2191
2192} PDMIAUDIOCONNECTOR;
2193
2194
2195/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2196 * interface. This should be addressed rather than making more temporary hacks. */
2197
2198/** Pointer to a Audio Sniffer Device port interface. */
2199typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2200
2201/**
2202 * Audio Sniffer port interface.
2203 */
2204typedef struct PDMIAUDIOSNIFFERPORT
2205{
2206 /**
2207 * Enables or disables sniffing. If sniffing is being enabled also sets a flag
2208 * whether the audio must be also left on the host.
2209 *
2210 * @returns VBox status code
2211 * @param pInterface Pointer to this interface.
2212 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2213 * @param fKeepHostAudio Indicates whether host audio should also present
2214 * 'true' means that sound should not be played
2215 * by the audio device.
2216 */
2217 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2218
2219} PDMIAUDIOSNIFFERPORT;
2220
2221/** Pointer to a Audio Sniffer connector interface. */
2222typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2223
2224/**
2225 * Audio Sniffer connector interface.
2226 * Pair with PDMIAUDIOSNIFFERPORT.
2227 */
2228typedef struct PDMIAUDIOSNIFFERCONNECTOR
2229{
2230 /**
2231 * AudioSniffer device calls this method when audio samples
2232 * are about to be played and sniffing is enabled.
2233 *
2234 * @param pInterface Pointer to this interface.
2235 * @param pvSamples Audio samples buffer.
2236 * @param cSamples How many complete samples are in the buffer.
2237 * @param iSampleHz The sample frequency in Hz.
2238 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2239 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2240 * @param fUnsigned Whether samples are unsigned values.
2241 * @thread The emulation thread.
2242 */
2243 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2244 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2245
2246 /**
2247 * AudioSniffer device calls this method when output volume is changed.
2248 *
2249 * @param pInterface Pointer to this interface.
2250 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2251 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2252 * @thread The emulation thread.
2253 */
2254 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2255
2256} PDMIAUDIOSNIFFERCONNECTOR;
2257
2258
2259/**
2260 * Generic status LED core.
2261 * Note that a unit doesn't have to support all the indicators.
2262 */
2263typedef union PDMLEDCORE
2264{
2265 /** 32-bit view. */
2266 uint32_t volatile u32;
2267 /** Bit view. */
2268 struct
2269 {
2270 /** Reading/Receiving indicator. */
2271 uint32_t fReading : 1;
2272 /** Writing/Sending indicator. */
2273 uint32_t fWriting : 1;
2274 /** Busy indicator. */
2275 uint32_t fBusy : 1;
2276 /** Error indicator. */
2277 uint32_t fError : 1;
2278 } s;
2279} PDMLEDCORE;
2280
2281/** LED bit masks for the u32 view.
2282 * @{ */
2283/** Reading/Receiving indicator. */
2284#define PDMLED_READING RT_BIT(0)
2285/** Writing/Sending indicator. */
2286#define PDMLED_WRITING RT_BIT(1)
2287/** Busy indicator. */
2288#define PDMLED_BUSY RT_BIT(2)
2289/** Error indicator. */
2290#define PDMLED_ERROR RT_BIT(3)
2291/** @} */
2292
2293
2294/**
2295 * Generic status LED.
2296 * Note that a unit doesn't have to support all the indicators.
2297 */
2298typedef struct PDMLED
2299{
2300 /** Just a magic for sanity checking. */
2301 uint32_t u32Magic;
2302 uint32_t u32Alignment; /**< structure size alignment. */
2303 /** The actual LED status.
2304 * Only the device is allowed to change this. */
2305 PDMLEDCORE Actual;
2306 /** The asserted LED status which is cleared by the reader.
2307 * The device will assert the bits but never clear them.
2308 * The driver clears them as it sees fit. */
2309 PDMLEDCORE Asserted;
2310} PDMLED;
2311
2312/** Pointer to an LED. */
2313typedef PDMLED *PPDMLED;
2314/** Pointer to a const LED. */
2315typedef const PDMLED *PCPDMLED;
2316
2317#define PDMLED_MAGIC ( 0x11335577 )
2318
2319/** Pointer to an LED ports interface. */
2320typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2321/**
2322 * Interface for exporting LEDs.
2323 */
2324typedef struct PDMILEDPORTS
2325{
2326 /**
2327 * Gets the pointer to the status LED of a unit.
2328 *
2329 * @returns VBox status code.
2330 * @param pInterface Pointer to the interface structure containing the called function pointer.
2331 * @param iLUN The unit which status LED we desire.
2332 * @param ppLed Where to store the LED pointer.
2333 */
2334 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2335
2336} PDMILEDPORTS;
2337
2338
2339/** Pointer to an LED connectors interface. */
2340typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2341/**
2342 * Interface for reading LEDs.
2343 */
2344typedef struct PDMILEDCONNECTORS
2345{
2346 /**
2347 * Notification about a unit which have been changed.
2348 *
2349 * The driver must discard any pointers to data owned by
2350 * the unit and requery it.
2351 *
2352 * @param pInterface Pointer to the interface structure containing the called function pointer.
2353 * @param iLUN The unit number.
2354 */
2355 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2356} PDMILEDCONNECTORS;
2357
2358
2359/** The special status unit number */
2360#define PDM_STATUS_LUN 999
2361
2362
2363#ifdef VBOX_HGCM
2364
2365/** Abstract HGCM command structure. Used only to define a typed pointer. */
2366struct VBOXHGCMCMD;
2367
2368/** Pointer to HGCM command structure. This pointer is unique and identifies
2369 * the command being processed. The pointer is passed to HGCM connector methods,
2370 * and must be passed back to HGCM port when command is completed.
2371 */
2372typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2373
2374/** Pointer to a HGCM port interface. */
2375typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2376
2377/**
2378 * HGCM port interface. Normally implemented by VMMDev.
2379 */
2380typedef struct PDMIHGCMPORT
2381{
2382 /**
2383 * Notify the guest on a command completion.
2384 *
2385 * @param pInterface Pointer to this interface.
2386 * @param rc The return code (VBox error code).
2387 * @param pCmd A pointer that identifies the completed command.
2388 *
2389 * @returns VBox status code
2390 */
2391 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2392
2393} PDMIHGCMPORT;
2394
2395
2396/** Pointer to a HGCM connector interface. */
2397typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2398
2399/** Pointer to a HGCM service location structure. */
2400typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2401
2402/**
2403 * HGCM connector interface.
2404 * Pair with PDMIHGCMPORT.
2405 */
2406typedef struct PDMIHGCMCONNECTOR
2407{
2408 /**
2409 * Locate a service and inform it about a client connection.
2410 *
2411 * @param pInterface Pointer to this interface.
2412 * @param pCmd A pointer that identifies the command.
2413 * @param pServiceLocation Pointer to the service location structure.
2414 * @param pu32ClientID Where to store the client id for the connection.
2415 * @return VBox status code.
2416 * @thread The emulation thread.
2417 */
2418 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2419
2420 /**
2421 * Disconnect from service.
2422 *
2423 * @param pInterface Pointer to this interface.
2424 * @param pCmd A pointer that identifies the command.
2425 * @param u32ClientID The client id returned by the pfnConnect call.
2426 * @return VBox status code.
2427 * @thread The emulation thread.
2428 */
2429 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2430
2431 /**
2432 * Process a guest issued command.
2433 *
2434 * @param pInterface Pointer to this interface.
2435 * @param pCmd A pointer that identifies the command.
2436 * @param u32ClientID The client id returned by the pfnConnect call.
2437 * @param u32Function Function to be performed by the service.
2438 * @param cParms Number of parameters in the array pointed to by paParams.
2439 * @param paParms Pointer to an array of parameters.
2440 * @return VBox status code.
2441 * @thread The emulation thread.
2442 */
2443 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2444 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2445
2446} PDMIHGCMCONNECTOR;
2447
2448#endif
2449
2450/** @} */
2451
2452__END_DECLS
2453
2454#endif
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