1 | /* $Id: VBoxVideoIPRT.h 69177 2017-10-23 18:07:55Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017 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_Graphics_VBoxVideoIPRT_h
|
---|
28 | #define ___VBox_Graphics_VBoxVideoIPRT_h
|
---|
29 |
|
---|
30 | #ifndef RT_OS_OS2
|
---|
31 | # include <iprt/asm.h>
|
---|
32 | # include <iprt/string.h>
|
---|
33 | #endif
|
---|
34 | #include <iprt/assert.h>
|
---|
35 | #include <iprt/cdefs.h>
|
---|
36 | #include <iprt/err.h>
|
---|
37 | #include <iprt/list.h>
|
---|
38 | #include <iprt/stdarg.h>
|
---|
39 | #include <iprt/stdint.h>
|
---|
40 | #include <iprt/types.h>
|
---|
41 |
|
---|
42 | #if !defined VBOX_XPDM_MINIPORT && !defined RT_OS_OS2
|
---|
43 | # include <iprt/asm-amd64-x86.h>
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifdef VBOX_XPDM_MINIPORT
|
---|
47 | # include <iprt/nt/miniport.h>
|
---|
48 | # include <ntddvdeo.h> /* sdk, clean */
|
---|
49 | # include <iprt/nt/Video.h>
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /** @name Port I/O helpers
|
---|
53 | * @{ */
|
---|
54 |
|
---|
55 | #ifdef VBOX_XPDM_MINIPORT
|
---|
56 |
|
---|
57 | /** Write an 8-bit value to an I/O port. */
|
---|
58 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
59 | VideoPortWritePortUchar((PUCHAR)Port, Value)
|
---|
60 | /** Write a 16-bit value to an I/O port. */
|
---|
61 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
62 | VideoPortWritePortUshort((PUSHORT)Port, Value)
|
---|
63 | /** Write a 32-bit value to an I/O port. */
|
---|
64 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
65 | VideoPortWritePortUlong((PULONG)Port, Value)
|
---|
66 | /** Read an 8-bit value from an I/O port. */
|
---|
67 | # define VBVO_PORT_READ_U8(Port) \
|
---|
68 | VideoPortReadPortUchar((PUCHAR)Port)
|
---|
69 | /** Read a 16-bit value from an I/O port. */
|
---|
70 | # define VBVO_PORT_READ_U16(Port) \
|
---|
71 | VideoPortReadPortUshort((PUSHORT)Port)
|
---|
72 | /** Read a 32-bit value from an I/O port. */
|
---|
73 | # define VBVO_PORT_READ_U32(Port) \
|
---|
74 | VideoPortReadPortUlong((PULONG)Port)
|
---|
75 |
|
---|
76 | #else /** @todo make these explicit */
|
---|
77 |
|
---|
78 | /** Write an 8-bit value to an I/O port. */
|
---|
79 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
80 | ASMOutU8(Port, Value)
|
---|
81 | /** Write a 16-bit value to an I/O port. */
|
---|
82 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
83 | ASMOutU16(Port, Value)
|
---|
84 | /** Write a 32-bit value to an I/O port. */
|
---|
85 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
86 | ASMOutU32(Port, Value)
|
---|
87 | /** Read an 8-bit value from an I/O port. */
|
---|
88 | # define VBVO_PORT_READ_U8(Port) \
|
---|
89 | ASMInU8(Port)
|
---|
90 | /** Read a 16-bit value from an I/O port. */
|
---|
91 | # define VBVO_PORT_READ_U16(Port) \
|
---|
92 | ASMInU16(Port)
|
---|
93 | /** Read a 32-bit value from an I/O port. */
|
---|
94 | # define VBVO_PORT_READ_U32(Port) \
|
---|
95 | ASMInU32(Port)
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | /** @} */
|
---|
99 |
|
---|
100 | #endif
|
---|
101 |
|
---|