VirtualBox

source: vbox/trunk/include/VBox/Graphics/HGSMIDefs.h@ 68813

Last change on this file since 68813 was 68672, checked in by vboxsync, 7 years ago

include file build fixes (kmk -C include)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/** @file
2 * VBox Host Guest Shared Memory Interface (HGSMI) - shared part - types and defines.
3 */
4
5/*
6 * Copyright (C) 2006-2017 Oracle Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28#ifndef ___VBox_Graphics_HGSMIDefs_h
29#define ___VBox_Graphics_HGSMIDefs_h
30
31#include "VBoxVideoIPRT.h"
32
33/* HGSMI uses 32 bit offsets and sizes. */
34typedef uint32_t HGSMISIZE;
35typedef uint32_t HGSMIOFFSET;
36
37#define HGSMIOFFSET_VOID ((HGSMIOFFSET)~0)
38
39/* Describes a shared memory area buffer.
40 * Used for calculations with offsets and for buffers verification.
41 */
42typedef struct HGSMIAREA
43{
44 uint8_t *pu8Base; /* The starting address of the area. Corresponds to offset 'offBase'. */
45 HGSMIOFFSET offBase; /* The starting offset of the area. */
46 HGSMIOFFSET offLast; /* The last valid offset:
47 * offBase + cbArea - 1 - (sizeof(header) + sizeof(tail)).
48 */
49 HGSMISIZE cbArea; /* Size of the area. */
50} HGSMIAREA;
51
52
53/* The buffer description flags. */
54#define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03 /* Buffer sequence type mask. */
55#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00 /* Single buffer, not a part of a sequence. */
56#define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01 /* The first buffer in a sequence. */
57#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 /* A middle buffer in a sequence. */
58#define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03 /* The last buffer in a sequence. */
59
60
61#pragma pack(1) /** @todo not necessary. use AssertCompileSize instead. */
62/* 16 bytes buffer header. */
63typedef struct HGSMIBUFFERHEADER
64{
65 uint32_t u32DataSize; /* Size of data that follows the header. */
66
67 uint8_t u8Flags; /* The buffer description: HGSMI_BUFFER_HEADER_F_* */
68
69 uint8_t u8Channel; /* The channel the data must be routed to. */
70 uint16_t u16ChannelInfo; /* Opaque to the HGSMI, used by the channel. */
71
72 union {
73 uint8_t au8Union[8]; /* Opaque placeholder to make the union 8 bytes. */
74
75 struct
76 { /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
77 uint32_t u32Reserved1; /* A reserved field, initialize to 0. */
78 uint32_t u32Reserved2; /* A reserved field, initialize to 0. */
79 } Buffer;
80
81 struct
82 { /* HGSMI_BUFFER_HEADER_F_SEQ_START */
83 uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
84 uint32_t u32SequenceSize; /* The total size of the sequence. */
85 } SequenceStart;
86
87 struct
88 { /* HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and HGSMI_BUFFER_HEADER_F_SEQ_END */
89 uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
90 uint32_t u32SequenceOffset; /* Data offset in the entire sequence. */
91 } SequenceContinue;
92 } u;
93} HGSMIBUFFERHEADER;
94
95/* 8 bytes buffer tail. */
96typedef struct HGSMIBUFFERTAIL
97{
98 uint32_t u32Reserved; /* Reserved, must be initialized to 0. */
99 uint32_t u32Checksum; /* Verifyer for the buffer header and offset and for first 4 bytes of the tail. */
100} HGSMIBUFFERTAIL;
101#pragma pack()
102
103AssertCompileSize(HGSMIBUFFERHEADER, 16);
104AssertCompileSize(HGSMIBUFFERTAIL, 8);
105
106/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
107#define HGSMI_NUMBER_OF_CHANNELS 0x100
108
109typedef struct HGSMIENV
110{
111 /* Environment context pointer. */
112 void *pvEnv;
113
114 /* Allocate system memory. */
115 DECLCALLBACKMEMBER(void *, pfnAlloc)(void *pvEnv, HGSMISIZE cb);
116
117 /* Free system memory. */
118 DECLCALLBACKMEMBER(void, pfnFree)(void *pvEnv, void *pv);
119} HGSMIENV;
120
121#endif /* !___VBox_Graphics_HGSMIDefs_h */
122
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette