1 | /** @file
|
---|
2 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and definitions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2017 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ___VBox_Graphics_VBoxVideoIPRT_h
|
---|
18 | #define ___VBox_Graphics_VBoxVideoIPRT_h
|
---|
19 |
|
---|
20 | #ifndef RT_OS_OS2
|
---|
21 | # include <iprt/asm.h>
|
---|
22 | # include <iprt/string.h>
|
---|
23 | #endif
|
---|
24 | #include <iprt/assert.h>
|
---|
25 | #include <iprt/cdefs.h>
|
---|
26 | #include <iprt/err.h>
|
---|
27 | #include <iprt/list.h>
|
---|
28 | #include <iprt/stdarg.h>
|
---|
29 | #include <iprt/stdint.h>
|
---|
30 | #include <iprt/types.h>
|
---|
31 |
|
---|
32 | #if !defined VBOX_XPDM_MINIPORT && !defined RT_OS_OS2
|
---|
33 | # include <iprt/asm-amd64-x86.h>
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #ifdef VBOX_XPDM_MINIPORT
|
---|
37 | # include <iprt/nt/miniport.h>
|
---|
38 | # include <ntddvdeo.h> /* sdk, clean */
|
---|
39 | # include <iprt/nt/Video.h>
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | /** @name Port I/O helpers
|
---|
43 | * @{ */
|
---|
44 |
|
---|
45 | #ifdef VBOX_XPDM_MINIPORT
|
---|
46 |
|
---|
47 | /** Write an 8-bit value to an I/O port. */
|
---|
48 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
49 | VideoPortWritePortUchar((PUCHAR)Port, Value)
|
---|
50 | /** Write a 16-bit value to an I/O port. */
|
---|
51 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
52 | VideoPortWritePortUshort((PUSHORT)Port, Value)
|
---|
53 | /** Write a 32-bit value to an I/O port. */
|
---|
54 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
55 | VideoPortWritePortUlong((PULONG)Port, Value)
|
---|
56 | /** Read an 8-bit value from an I/O port. */
|
---|
57 | # define VBVO_PORT_READ_U8(Port) \
|
---|
58 | VideoPortReadPortUchar((PUCHAR)Port)
|
---|
59 | /** Read a 16-bit value from an I/O port. */
|
---|
60 | # define VBVO_PORT_READ_U16(Port) \
|
---|
61 | VideoPortReadPortUshort((PUSHORT)Port)
|
---|
62 | /** Read a 32-bit value from an I/O port. */
|
---|
63 | # define VBVO_PORT_READ_U32(Port) \
|
---|
64 | VideoPortReadPortUlong((PULONG)Port)
|
---|
65 |
|
---|
66 | #else /** @todo make these explicit */
|
---|
67 |
|
---|
68 | /** Write an 8-bit value to an I/O port. */
|
---|
69 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
70 | ASMOutU8(Port, Value)
|
---|
71 | /** Write a 16-bit value to an I/O port. */
|
---|
72 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
73 | ASMOutU16(Port, Value)
|
---|
74 | /** Write a 32-bit value to an I/O port. */
|
---|
75 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
76 | ASMOutU32(Port, Value)
|
---|
77 | /** Read an 8-bit value from an I/O port. */
|
---|
78 | # define VBVO_PORT_READ_U8(Port) \
|
---|
79 | ASMInU8(Port)
|
---|
80 | /** Read a 16-bit value from an I/O port. */
|
---|
81 | # define VBVO_PORT_READ_U16(Port) \
|
---|
82 | ASMInU16(Port)
|
---|
83 | /** Read a 32-bit value from an I/O port. */
|
---|
84 | # define VBVO_PORT_READ_U32(Port) \
|
---|
85 | ASMInU32(Port)
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | /** @} */
|
---|
89 |
|
---|
90 | #endif
|
---|
91 |
|
---|