1 | /* $Id: VBoxVideoIPRT.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
38 | #define VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #if !defined(RT_OS_OS2) || !defined(__IBMC__) /* IBM VACpp 3.08 doesn't properly eliminate unused inline functions */
|
---|
44 | # include <iprt/asm.h>
|
---|
45 | # include <iprt/string.h>
|
---|
46 | #endif
|
---|
47 | #include <iprt/assert.h>
|
---|
48 | #include <iprt/cdefs.h>
|
---|
49 | #include <iprt/err.h>
|
---|
50 | #include <iprt/list.h>
|
---|
51 | #include <iprt/stdarg.h>
|
---|
52 | #include <iprt/stdint.h>
|
---|
53 | #include <iprt/types.h>
|
---|
54 |
|
---|
55 | #if !defined(VBOX_XPDM_MINIPORT) && !defined(RT_OS_OS2) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
|
---|
56 | # include <iprt/asm-amd64-x86.h>
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifdef VBOX_XPDM_MINIPORT
|
---|
60 | # include <iprt/nt/miniport.h>
|
---|
61 | # include <ntddvdeo.h> /* sdk, clean */
|
---|
62 | # include <iprt/nt/Video.h>
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | /** @name Port I/O helpers
|
---|
66 | * @{ */
|
---|
67 |
|
---|
68 | #ifdef VBOX_XPDM_MINIPORT
|
---|
69 |
|
---|
70 | /** Write an 8-bit value to an I/O port. */
|
---|
71 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
72 | VideoPortWritePortUchar((PUCHAR)Port, Value)
|
---|
73 | /** Write a 16-bit value to an I/O port. */
|
---|
74 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
75 | VideoPortWritePortUshort((PUSHORT)Port, Value)
|
---|
76 | /** Write a 32-bit value to an I/O port. */
|
---|
77 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
78 | VideoPortWritePortUlong((PULONG)Port, Value)
|
---|
79 | /** Read an 8-bit value from an I/O port. */
|
---|
80 | # define VBVO_PORT_READ_U8(Port) \
|
---|
81 | VideoPortReadPortUchar((PUCHAR)Port)
|
---|
82 | /** Read a 16-bit value from an I/O port. */
|
---|
83 | # define VBVO_PORT_READ_U16(Port) \
|
---|
84 | VideoPortReadPortUshort((PUSHORT)Port)
|
---|
85 | /** Read a 32-bit value from an I/O port. */
|
---|
86 | # define VBVO_PORT_READ_U32(Port) \
|
---|
87 | VideoPortReadPortUlong((PULONG)Port)
|
---|
88 |
|
---|
89 | #else /** @todo make these explicit */
|
---|
90 |
|
---|
91 | /** Write an 8-bit value to an I/O port. */
|
---|
92 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
93 | ASMOutU8(Port, Value)
|
---|
94 | /** Write a 16-bit value to an I/O port. */
|
---|
95 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
96 | ASMOutU16(Port, Value)
|
---|
97 | /** Write a 32-bit value to an I/O port. */
|
---|
98 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
99 | ASMOutU32(Port, Value)
|
---|
100 | /** Read an 8-bit value from an I/O port. */
|
---|
101 | # define VBVO_PORT_READ_U8(Port) \
|
---|
102 | ASMInU8(Port)
|
---|
103 | /** Read a 16-bit value from an I/O port. */
|
---|
104 | # define VBVO_PORT_READ_U16(Port) \
|
---|
105 | ASMInU16(Port)
|
---|
106 | /** Read a 32-bit value from an I/O port. */
|
---|
107 | # define VBVO_PORT_READ_U32(Port) \
|
---|
108 | ASMInU32(Port)
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | /** @} */
|
---|
112 |
|
---|
113 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h */
|
---|
114 |
|
---|