1 | /* $Id: VBoxVideoIPRT.h 87261 2021-01-15 11:13:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
28 | #define VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #ifndef RT_OS_OS2
|
---|
34 | # include <iprt/asm.h>
|
---|
35 | # include <iprt/string.h>
|
---|
36 | #endif
|
---|
37 | #include <iprt/assert.h>
|
---|
38 | #include <iprt/cdefs.h>
|
---|
39 | #include <iprt/err.h>
|
---|
40 | #include <iprt/list.h>
|
---|
41 | #include <iprt/stdarg.h>
|
---|
42 | #include <iprt/stdint.h>
|
---|
43 | #include <iprt/types.h>
|
---|
44 |
|
---|
45 | #if !defined VBOX_XPDM_MINIPORT && !defined RT_OS_OS2 && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
|
---|
46 | # include <iprt/asm-amd64-x86.h>
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | #ifdef VBOX_XPDM_MINIPORT
|
---|
50 | # include <iprt/nt/miniport.h>
|
---|
51 | # include <ntddvdeo.h> /* sdk, clean */
|
---|
52 | # include <iprt/nt/Video.h>
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | /** @name Port I/O helpers
|
---|
56 | * @{ */
|
---|
57 |
|
---|
58 | #ifdef VBOX_XPDM_MINIPORT
|
---|
59 |
|
---|
60 | /** Write an 8-bit value to an I/O port. */
|
---|
61 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
62 | VideoPortWritePortUchar((PUCHAR)Port, Value)
|
---|
63 | /** Write a 16-bit value to an I/O port. */
|
---|
64 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
65 | VideoPortWritePortUshort((PUSHORT)Port, Value)
|
---|
66 | /** Write a 32-bit value to an I/O port. */
|
---|
67 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
68 | VideoPortWritePortUlong((PULONG)Port, Value)
|
---|
69 | /** Read an 8-bit value from an I/O port. */
|
---|
70 | # define VBVO_PORT_READ_U8(Port) \
|
---|
71 | VideoPortReadPortUchar((PUCHAR)Port)
|
---|
72 | /** Read a 16-bit value from an I/O port. */
|
---|
73 | # define VBVO_PORT_READ_U16(Port) \
|
---|
74 | VideoPortReadPortUshort((PUSHORT)Port)
|
---|
75 | /** Read a 32-bit value from an I/O port. */
|
---|
76 | # define VBVO_PORT_READ_U32(Port) \
|
---|
77 | VideoPortReadPortUlong((PULONG)Port)
|
---|
78 |
|
---|
79 | #else /** @todo make these explicit */
|
---|
80 |
|
---|
81 | /** Write an 8-bit value to an I/O port. */
|
---|
82 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
83 | ASMOutU8(Port, Value)
|
---|
84 | /** Write a 16-bit value to an I/O port. */
|
---|
85 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
86 | ASMOutU16(Port, Value)
|
---|
87 | /** Write a 32-bit value to an I/O port. */
|
---|
88 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
89 | ASMOutU32(Port, Value)
|
---|
90 | /** Read an 8-bit value from an I/O port. */
|
---|
91 | # define VBVO_PORT_READ_U8(Port) \
|
---|
92 | ASMInU8(Port)
|
---|
93 | /** Read a 16-bit value from an I/O port. */
|
---|
94 | # define VBVO_PORT_READ_U16(Port) \
|
---|
95 | ASMInU16(Port)
|
---|
96 | /** Read a 32-bit value from an I/O port. */
|
---|
97 | # define VBVO_PORT_READ_U32(Port) \
|
---|
98 | ASMInU32(Port)
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | /** @} */
|
---|
102 |
|
---|
103 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h */
|
---|
104 |
|
---|