VirtualBox

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

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

remove functions from PDMIMEDIAASYNC and PCMIBLOCKASYNC. PDMIMEDIA and PDMIBLOCK are mandatory now and the async versions are optional extensions which can be implemented. Removed duplicated code

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