1 | /* $Id: VBoxUhgsmi.h 69686 2017-11-14 13:29:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Document me, pretty please.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-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_VBoxUhgsmi_h
|
---|
28 | #define ___VBox_VBoxUhgsmi_h
|
---|
29 |
|
---|
30 | #include <iprt/cdefs.h>
|
---|
31 | #include <iprt/types.h>
|
---|
32 |
|
---|
33 | typedef struct VBOXUHGSMI *PVBOXUHGSMI;
|
---|
34 |
|
---|
35 | typedef struct VBOXUHGSMI_BUFFER *PVBOXUHGSMI_BUFFER;
|
---|
36 |
|
---|
37 | typedef struct VBOXUHGSMI_BUFFER_TYPE_FLAGS
|
---|
38 | {
|
---|
39 | union
|
---|
40 | {
|
---|
41 | struct
|
---|
42 | {
|
---|
43 | uint32_t fCommand : 1;
|
---|
44 | uint32_t Reserved : 31;
|
---|
45 | } RT_STRUCT_NM(s);
|
---|
46 | uint32_t Value;
|
---|
47 | } RT_UNION_NM(u);
|
---|
48 | } VBOXUHGSMI_BUFFER_TYPE_FLAGS;
|
---|
49 |
|
---|
50 | typedef struct VBOXUHGSMI_BUFFER_LOCK_FLAGS
|
---|
51 | {
|
---|
52 | union
|
---|
53 | {
|
---|
54 | struct
|
---|
55 | {
|
---|
56 | uint32_t bReadOnly : 1;
|
---|
57 | uint32_t bWriteOnly : 1;
|
---|
58 | uint32_t bDonotWait : 1;
|
---|
59 | uint32_t bDiscard : 1;
|
---|
60 | uint32_t bLockEntire : 1;
|
---|
61 | uint32_t Reserved : 27;
|
---|
62 | } RT_STRUCT_NM(s);
|
---|
63 | uint32_t Value;
|
---|
64 | } RT_UNION_NM(u);
|
---|
65 | } VBOXUHGSMI_BUFFER_LOCK_FLAGS;
|
---|
66 |
|
---|
67 | typedef struct VBOXUHGSMI_BUFFER_SUBMIT_FLAGS
|
---|
68 | {
|
---|
69 | union
|
---|
70 | {
|
---|
71 | struct
|
---|
72 | {
|
---|
73 | uint32_t bHostReadOnly : 1;
|
---|
74 | uint32_t bHostWriteOnly : 1;
|
---|
75 | uint32_t bDoNotRetire : 1; /**< the buffer will be used in a subsequent command */
|
---|
76 | uint32_t bEntireBuffer : 1;
|
---|
77 | uint32_t Reserved : 28;
|
---|
78 | } RT_STRUCT_NM(s);
|
---|
79 | uint32_t Value;
|
---|
80 | } RT_UNION_NM(u);
|
---|
81 | } VBOXUHGSMI_BUFFER_SUBMIT_FLAGS, *PVBOXUHGSMI_BUFFER_SUBMIT_FLAGS;
|
---|
82 |
|
---|
83 | /* the caller can specify NULL as a hSynch and specify a valid enmSynchType to make UHGSMI create a proper object itself,
|
---|
84 | * */
|
---|
85 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_CREATE(PVBOXUHGSMI pHgsmi, uint32_t cbBuf, VBOXUHGSMI_BUFFER_TYPE_FLAGS fType, PVBOXUHGSMI_BUFFER* ppBuf);
|
---|
86 | typedef FNVBOXUHGSMI_BUFFER_CREATE *PFNVBOXUHGSMI_BUFFER_CREATE;
|
---|
87 |
|
---|
88 | typedef struct VBOXUHGSMI_BUFFER_SUBMIT
|
---|
89 | {
|
---|
90 | PVBOXUHGSMI_BUFFER pBuf;
|
---|
91 | uint32_t offData;
|
---|
92 | uint32_t cbData;
|
---|
93 | VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fFlags;
|
---|
94 | } VBOXUHGSMI_BUFFER_SUBMIT, *PVBOXUHGSMI_BUFFER_SUBMIT;
|
---|
95 |
|
---|
96 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_SUBMIT(PVBOXUHGSMI pHgsmi, PVBOXUHGSMI_BUFFER_SUBMIT aBuffers, uint32_t cBuffers);
|
---|
97 | typedef FNVBOXUHGSMI_BUFFER_SUBMIT *PFNVBOXUHGSMI_BUFFER_SUBMIT;
|
---|
98 |
|
---|
99 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_DESTROY(PVBOXUHGSMI_BUFFER pBuf);
|
---|
100 | typedef FNVBOXUHGSMI_BUFFER_DESTROY *PFNVBOXUHGSMI_BUFFER_DESTROY;
|
---|
101 |
|
---|
102 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_LOCK(PVBOXUHGSMI_BUFFER pBuf, uint32_t offLock, uint32_t cbLock, VBOXUHGSMI_BUFFER_LOCK_FLAGS fFlags, void**pvLock);
|
---|
103 | typedef FNVBOXUHGSMI_BUFFER_LOCK *PFNVBOXUHGSMI_BUFFER_LOCK;
|
---|
104 |
|
---|
105 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_UNLOCK(PVBOXUHGSMI_BUFFER pBuf);
|
---|
106 | typedef FNVBOXUHGSMI_BUFFER_UNLOCK *PFNVBOXUHGSMI_BUFFER_UNLOCK;
|
---|
107 |
|
---|
108 | typedef struct VBOXUHGSMI
|
---|
109 | {
|
---|
110 | PFNVBOXUHGSMI_BUFFER_CREATE pfnBufferCreate;
|
---|
111 | PFNVBOXUHGSMI_BUFFER_SUBMIT pfnBufferSubmit;
|
---|
112 | /** User custom data. */
|
---|
113 | void *pvUserData;
|
---|
114 | } VBOXUHGSMI;
|
---|
115 |
|
---|
116 | typedef struct VBOXUHGSMI_BUFFER
|
---|
117 | {
|
---|
118 | PFNVBOXUHGSMI_BUFFER_LOCK pfnLock;
|
---|
119 | PFNVBOXUHGSMI_BUFFER_UNLOCK pfnUnlock;
|
---|
120 | PFNVBOXUHGSMI_BUFFER_DESTROY pfnDestroy;
|
---|
121 |
|
---|
122 | /* r/o data added for ease of access and simplicity
|
---|
123 | * modifying it leads to unpredictable behavior */
|
---|
124 | VBOXUHGSMI_BUFFER_TYPE_FLAGS fType;
|
---|
125 | uint32_t cbBuffer;
|
---|
126 | /** User custom data. */
|
---|
127 | void *pvUserData;
|
---|
128 | } VBOXUHGSMI_BUFFER;
|
---|
129 |
|
---|
130 | #define VBoxUhgsmiBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf) ((_pUhgsmi)->pfnBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf))
|
---|
131 | #define VBoxUhgsmiBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers) ((_pUhgsmi)->pfnBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers))
|
---|
132 |
|
---|
133 | #define VBoxUhgsmiBufferLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock) ((_pBuf)->pfnLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock))
|
---|
134 | #define VBoxUhgsmiBufferUnlock(_pBuf) ((_pBuf)->pfnUnlock(_pBuf))
|
---|
135 | #define VBoxUhgsmiBufferDestroy(_pBuf) ((_pBuf)->pfnDestroy(_pBuf))
|
---|
136 |
|
---|
137 | #endif
|
---|
138 |
|
---|