1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Common Instance Macros.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 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 as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * If you received this file as part of a commercial VirtualBox
|
---|
17 | * distribution, then only the terms of your commercial VirtualBox
|
---|
18 | * license agreement apply instead of the previous paragraph.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef ___VBox_pdmins_h
|
---|
22 | #define ___VBox_pdmins_h
|
---|
23 |
|
---|
24 | /** @defgroup grp_pdm_ins Common Instance Macros
|
---|
25 | * @ingroup grp_pdm
|
---|
26 | * @{
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @def PDMBOTHCBDECL
|
---|
30 | * Macro for declaring a callback which is static in HC and exported in GC.
|
---|
31 | */
|
---|
32 | #if defined(IN_GC) || defined(IN_RING0)
|
---|
33 | # define PDMBOTHCBDECL(type) DECLEXPORT(type)
|
---|
34 | #else
|
---|
35 | # define PDMBOTHCBDECL(type) static type
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /** @def PDMINS2DATA
|
---|
39 | * Converts a PDM Device, USB Device, or Driver instance pointer to a pointer to the instance data.
|
---|
40 | */
|
---|
41 | #define PDMINS2DATA(pIns, type) ( (type)(void *)&(pIns)->achInstanceData[0] )
|
---|
42 |
|
---|
43 | /** @def PDMINS2DATA_GCPTR
|
---|
44 | * Converts a PDM Device, USB Device, or Driver instance pointer to a GC pointer to the instance data.
|
---|
45 | */
|
---|
46 | #define PDMINS2DATA_GCPTR(pIns) ( (pIns)->pvInstanceDataGC )
|
---|
47 |
|
---|
48 | /** @def PDMINS2DATA_R3PTR
|
---|
49 | * Converts a PDM Device, USB Device, or Driver instance pointer to a HC pointer to the instance data.
|
---|
50 | */
|
---|
51 | #define PDMINS2DATA_R3PTR(pIns) ( (pIns)->pvInstanceDataR3 )
|
---|
52 |
|
---|
53 | /** @def PDMINS2DATA_R0PTR
|
---|
54 | * Converts a PDM Device, USB Device, or Driver instance pointer to a R0 pointer to the instance data.
|
---|
55 | */
|
---|
56 | #define PDMINS2DATA_R0PTR(pIns) ( (pIns)->pvInstanceDataR0 )
|
---|
57 |
|
---|
58 | #endif
|
---|