1 | /** @file
|
---|
2 | * Document me, pretty please.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2010 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 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_VBoxUhgsmi_h
|
---|
27 | #define ___VBox_VBoxUhgsmi_h
|
---|
28 |
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 | #include <iprt/types.h>
|
---|
31 |
|
---|
32 | typedef struct VBOXUHGSMI *PVBOXUHGSMI;
|
---|
33 |
|
---|
34 | typedef struct VBOXUHGSMI_BUFFER *PVBOXUHGSMI_BUFFER;
|
---|
35 | typedef void* HVBOXUHGSMI_SYNCHOBJECT;
|
---|
36 |
|
---|
37 | typedef enum
|
---|
38 | {
|
---|
39 | VBOXUHGSMI_SYNCHOBJECT_TYPE_NONE = 0,
|
---|
40 | VBOXUHGSMI_SYNCHOBJECT_TYPE_EVENT,
|
---|
41 | VBOXUHGSMI_SYNCHOBJECT_TYPE_SEMAPHORE
|
---|
42 | } VBOXUHGSMI_SYNCHOBJECT_TYPE;
|
---|
43 |
|
---|
44 | typedef struct VBOXUHGSMI_BUFFER_LOCK_FLAGS
|
---|
45 | {
|
---|
46 | union
|
---|
47 | {
|
---|
48 | struct
|
---|
49 | {
|
---|
50 | uint32_t bReadOnly : 1;
|
---|
51 | uint32_t bWriteOnly : 1;
|
---|
52 | uint32_t bDonotWait : 1;
|
---|
53 | uint32_t bDiscard : 1;
|
---|
54 | uint32_t bLockEntire : 1;
|
---|
55 | uint32_t Reserved : 27;
|
---|
56 | };
|
---|
57 | uint32_t Value;
|
---|
58 | };
|
---|
59 | } VBOXUHGSMI_BUFFER_LOCK_FLAGS;
|
---|
60 |
|
---|
61 | typedef struct VBOXUHGSMI_BUFFER_SUBMIT_FLAGS
|
---|
62 | {
|
---|
63 | union
|
---|
64 | {
|
---|
65 | struct
|
---|
66 | {
|
---|
67 | uint32_t bHostReadOnly : 1;
|
---|
68 | uint32_t bHostWriteOnly : 1;
|
---|
69 | uint32_t bDoNotRetire : 1; /**< the buffer will be uset in a subsequent command */
|
---|
70 | uint32_t bDoNotSignalCompletion : 1; /**< do not signal notification object on completion for this alloc */
|
---|
71 | uint32_t bEntireBuffer : 1;
|
---|
72 | uint32_t Reserved : 27;
|
---|
73 | };
|
---|
74 | uint32_t Value;
|
---|
75 | };
|
---|
76 | } VBOXUHGSMI_BUFFER_SUBMIT_FLAGS, *PVBOXUHGSMI_BUFFER_SUBMIT_FLAGS;
|
---|
77 |
|
---|
78 | /* the caller can specify NULL as a hSynch and specify a valid enmSynchType to make UHGSMI create a proper object itself,
|
---|
79 | * */
|
---|
80 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_CREATE(PVBOXUHGSMI pHgsmi, uint32_t cbBuf,
|
---|
81 | VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType, HVBOXUHGSMI_SYNCHOBJECT hSynch,
|
---|
82 | PVBOXUHGSMI_BUFFER* ppBuf);
|
---|
83 | typedef FNVBOXUHGSMI_BUFFER_CREATE *PFNVBOXUHGSMI_BUFFER_CREATE;
|
---|
84 |
|
---|
85 | typedef struct VBOXUHGSMI_BUFFER_SUBMIT
|
---|
86 | {
|
---|
87 | PVBOXUHGSMI_BUFFER pBuf;
|
---|
88 | uint32_t offData;
|
---|
89 | uint32_t cbData;
|
---|
90 | VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fFlags;
|
---|
91 | } VBOXUHGSMI_BUFFER_SUBMIT, *PVBOXUHGSMI_BUFFER_SUBMIT;
|
---|
92 |
|
---|
93 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_SUBMIT_ASYNCH(PVBOXUHGSMI pHgsmi, PVBOXUHGSMI_BUFFER_SUBMIT aBuffers, uint32_t cBuffers);
|
---|
94 | typedef FNVBOXUHGSMI_BUFFER_SUBMIT_ASYNCH *PFNVBOXUHGSMI_BUFFER_SUBMIT_ASYNCH;
|
---|
95 |
|
---|
96 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_DESTROY(PVBOXUHGSMI_BUFFER pBuf);
|
---|
97 | typedef FNVBOXUHGSMI_BUFFER_DESTROY *PFNVBOXUHGSMI_BUFFER_DESTROY;
|
---|
98 |
|
---|
99 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_LOCK(PVBOXUHGSMI_BUFFER pBuf, uint32_t offLock, uint32_t cbLock, VBOXUHGSMI_BUFFER_LOCK_FLAGS fFlags, void**pvLock);
|
---|
100 | typedef FNVBOXUHGSMI_BUFFER_LOCK *PFNVBOXUHGSMI_BUFFER_LOCK;
|
---|
101 |
|
---|
102 | typedef DECLCALLBACK(int) FNVBOXUHGSMI_BUFFER_UNLOCK(PVBOXUHGSMI_BUFFER pBuf);
|
---|
103 | typedef FNVBOXUHGSMI_BUFFER_UNLOCK *PFNVBOXUHGSMI_BUFFER_UNLOCK;
|
---|
104 |
|
---|
105 | typedef struct VBOXUHGSMI
|
---|
106 | {
|
---|
107 | PFNVBOXUHGSMI_BUFFER_CREATE pfnBufferCreate;
|
---|
108 | PFNVBOXUHGSMI_BUFFER_SUBMIT_ASYNCH pfnBufferSubmitAsynch;
|
---|
109 | /** User custom data. */
|
---|
110 | void *pvUserData;
|
---|
111 | } VBOXUHGSMI;
|
---|
112 |
|
---|
113 | typedef struct VBOXUHGSMI_BUFFER
|
---|
114 | {
|
---|
115 | PFNVBOXUHGSMI_BUFFER_LOCK pfnLock;
|
---|
116 | PFNVBOXUHGSMI_BUFFER_UNLOCK pfnUnlock;
|
---|
117 | PFNVBOXUHGSMI_BUFFER_DESTROY pfnDestroy;
|
---|
118 |
|
---|
119 | /* r/o data added for ease of access and simplicity
|
---|
120 | * modifying it leads to unpredictable behavior */
|
---|
121 | HVBOXUHGSMI_SYNCHOBJECT hSynch;
|
---|
122 | VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType;
|
---|
123 | uint32_t cbBuffer;
|
---|
124 | bool bSynchCreated;
|
---|
125 | /** User custom data. */
|
---|
126 | void *pvUserData;
|
---|
127 | } VBOXUHGSMI_BUFFER;
|
---|
128 |
|
---|
129 | #endif
|
---|
130 |
|
---|