VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmins.h@ 99396

Last change on this file since 99396 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.3 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Common Instance Macros.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_pdmins_h
37#define VBOX_INCLUDED_vmm_pdmins_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42
43/** @defgroup grp_pdm_ins Common PDM Instance Macros
44 * @ingroup grp_pdm
45 * @{
46 */
47
48/** @def PDMBOTHCBDECL
49 * Macro for declaring a callback which is static in HC and exported in GC.
50 */
51#if defined(IN_RC) || defined(IN_RING0)
52# ifdef __cplusplus
53# define PDMBOTHCBDECL(type) extern "C" DECLEXPORT(type)
54# else
55# define PDMBOTHCBDECL(type) DECLEXPORT(type)
56# endif
57#else
58# define PDMBOTHCBDECL(type) static DECLCALLBACK(type)
59#endif
60
61/** @def PDMINS_2_DATA
62 * Gets the shared instance data for a PDM device, USB device, or driver instance.
63 * @note For devices using PDMDEVINS_2_DATA is highly recommended.
64 */
65#define PDMINS_2_DATA(pIns, type) ( (type)(pIns)->CTX_SUFF(pvInstanceData) )
66
67/** @def PDMINS_2_DATA_CC
68 * Gets the current context instance data for a PDM device, USB device, or driver instance.
69 * @note For devices using PDMDEVINS_2_DATA_CC is highly recommended.
70 */
71#define PDMINS_2_DATA_CC(pIns, type) ( (type)(void *)&(pIns)->achInstanceData[0] )
72
73/* @def PDMINS_2_DATA_RC
74 * Gets the raw-mode context instance data for a PDM device instance.
75 */
76#define PDMINS_2_DATA_RC(pIns, type) ( (type)(pIns)->CTX_SUFF(pvInstanceDataForRC) )
77
78
79/** @def PDMINS_2_DATA_RCPTR
80 * Converts a PDM Device, USB Device, or Driver instance pointer to a RC pointer to the instance data.
81 * @deprecated
82 */
83#define PDMINS_2_DATA_RCPTR(pIns) ( (pIns)->pvInstanceDataRC )
84
85/** @def PDMINS_2_DATA_R3PTR
86 * Converts a PDM Device, USB Device, or Driver instance pointer to a HC pointer to the instance data.
87 * @deprecated
88 */
89#define PDMINS_2_DATA_R3PTR(pIns) ( (pIns)->pvInstanceDataR3 )
90
91/** @def PDMINS_2_DATA_R0PTR
92 * Converts a PDM Device, USB Device, or Driver instance pointer to a R0 pointer to the instance data.
93 * @deprecated
94 */
95#define PDMINS_2_DATA_R0PTR(pIns) ( (pIns)->pvInstanceDataR0 )
96
97/** @} */
98
99#endif /* !VBOX_INCLUDED_vmm_pdmins_h */
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