VirtualBox

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

Last change on this file since 71651 was 70604, checked in by vboxsync, 7 years ago

DevVGA: cleanup in progress.

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