VirtualBox

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

Last change on this file since 8299 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

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