[69015] | 1 | /* $Id: VBoxVideoIPRT.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
[66506] | 2 | /** @file
|
---|
[68672] | 3 | * VirtualBox Video driver, common code - iprt and VirtualBox macros and definitions.
|
---|
[66506] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2017-2023 Oracle and/or its affiliates.
|
---|
[66506] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[69177] | 11 | *
|
---|
[96407] | 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 | *
|
---|
[69177] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 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
|
---|
[69177] | 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.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[66506] | 35 | */
|
---|
| 36 |
|
---|
[76558] | 37 | #ifndef VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
| 38 | #define VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h
|
---|
[76507] | 39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 40 | # pragma once
|
---|
| 41 | #endif
|
---|
[66506] | 42 |
|
---|
[97886] | 43 | #if !defined(RT_OS_OS2) || !defined(__IBMC__) /* IBM VACpp 3.08 doesn't properly eliminate unused inline functions */
|
---|
[66513] | 44 | # include <iprt/asm.h>
|
---|
[97886] | 45 | # include <iprt/string.h>
|
---|
[66513] | 46 | #endif
|
---|
[66506] | 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 |
|
---|
[97879] | 55 | #if !defined(VBOX_XPDM_MINIPORT) && !defined(RT_OS_OS2) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
|
---|
[66506] | 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. */
|
---|
[66507] | 71 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
[66506] | 72 | VideoPortWritePortUchar((PUCHAR)Port, Value)
|
---|
| 73 | /** Write a 16-bit value to an I/O port. */
|
---|
[66507] | 74 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
[66506] | 75 | VideoPortWritePortUshort((PUSHORT)Port, Value)
|
---|
| 76 | /** Write a 32-bit value to an I/O port. */
|
---|
[66507] | 77 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
[66506] | 78 | VideoPortWritePortUlong((PULONG)Port, Value)
|
---|
| 79 | /** Read an 8-bit value from an I/O port. */
|
---|
[66507] | 80 | # define VBVO_PORT_READ_U8(Port) \
|
---|
[66506] | 81 | VideoPortReadPortUchar((PUCHAR)Port)
|
---|
| 82 | /** Read a 16-bit value from an I/O port. */
|
---|
[66507] | 83 | # define VBVO_PORT_READ_U16(Port) \
|
---|
[66506] | 84 | VideoPortReadPortUshort((PUSHORT)Port)
|
---|
| 85 | /** Read a 32-bit value from an I/O port. */
|
---|
[66507] | 86 | # define VBVO_PORT_READ_U32(Port) \
|
---|
[66506] | 87 | VideoPortReadPortUlong((PULONG)Port)
|
---|
[69177] | 88 |
|
---|
[66506] | 89 | #else /** @todo make these explicit */
|
---|
| 90 |
|
---|
| 91 | /** Write an 8-bit value to an I/O port. */
|
---|
[66507] | 92 | # define VBVO_PORT_WRITE_U8(Port, Value) \
|
---|
[66506] | 93 | ASMOutU8(Port, Value)
|
---|
| 94 | /** Write a 16-bit value to an I/O port. */
|
---|
[66507] | 95 | # define VBVO_PORT_WRITE_U16(Port, Value) \
|
---|
[66506] | 96 | ASMOutU16(Port, Value)
|
---|
| 97 | /** Write a 32-bit value to an I/O port. */
|
---|
[66507] | 98 | # define VBVO_PORT_WRITE_U32(Port, Value) \
|
---|
[66506] | 99 | ASMOutU32(Port, Value)
|
---|
| 100 | /** Read an 8-bit value from an I/O port. */
|
---|
[66507] | 101 | # define VBVO_PORT_READ_U8(Port) \
|
---|
[66506] | 102 | ASMInU8(Port)
|
---|
| 103 | /** Read a 16-bit value from an I/O port. */
|
---|
[66507] | 104 | # define VBVO_PORT_READ_U16(Port) \
|
---|
[66506] | 105 | ASMInU16(Port)
|
---|
| 106 | /** Read a 32-bit value from an I/O port. */
|
---|
[66507] | 107 | # define VBVO_PORT_READ_U32(Port) \
|
---|
[66506] | 108 | ASMInU32(Port)
|
---|
| 109 | #endif
|
---|
| 110 |
|
---|
| 111 | /** @} */
|
---|
| 112 |
|
---|
[76585] | 113 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideoIPRT_h */
|
---|
[68657] | 114 |
|
---|