]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/VfrServices.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VfrCompile / VfrServices.h
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 VfrServices.h\r
15\r
16Abstract:\r
17\r
18 Prototypes and defines for routines and classes used by the\r
19 EFI VFR compiler.\r
20 \r
21--*/\r
22\r
23#ifndef _VFR_SERVICES_H_\r
24#define _VFR_SERVICES_H_\r
25\r
26class VfrOpcodeHandler\r
27{\r
28public:\r
29 VfrOpcodeHandler (\r
30 VOID\r
31 )\r
32 /*++\r
33\r
34Routine Description:\r
35 Constructor for the VFR opcode handling class.\r
36 \r
37Arguments:\r
38 None\r
39\r
40Returns:\r
41 None\r
42\r
43--*/\r
44 ;\r
45 ~VfrOpcodeHandler (\r
46 VOID\r
47 )\r
48 /*++\r
49\r
50Routine Description:\r
51 Destructor for the VFR opcode handler. Free up memory allocated\r
52 while parsing the VFR script.\r
53 \r
54Arguments:\r
55 None\r
56\r
57Returns:\r
58 None\r
59\r
60--*/\r
61 ;\r
62 void\r
63 WriteIfrBytes (\r
64 VOID\r
65 )\r
66 /*++\r
67\r
68Routine Description:\r
69 This function is invoked at the end of parsing. Its purpose\r
70 is to write out all the IFR bytes that were queued up while\r
71 parsing.\r
72 \r
73Arguments:\r
74 None\r
75\r
76Returns:\r
77 None\r
78\r
79--*/\r
80 ;\r
81 int\r
82 AddOpcodeByte (\r
83 UINT8 OpcodeByte,\r
84 UINT32 LineNum\r
85 )\r
86 /*++\r
87\r
88Routine Description:\r
89 This function is invoked by the parser when a new IFR\r
90 opcode should be emitted.\r
91 \r
92Arguments:\r
93 OpcodeByte - the IFR opcode\r
94 LineNum - the line number from the source file that resulted\r
95 in the opcode being emitted.\r
96\r
97Returns:\r
98 0 always\r
99\r
100--*/\r
101 ;\r
102 void\r
103 AddByte (\r
104 UINT8 ByteVal,\r
105 UINT8 KeyByte\r
106 )\r
107 /*++\r
108\r
109Routine Description:\r
110 This function is invoked by the parser when it determines\r
111 that more raw IFR bytes should be emitted to the output stream.\r
112 Here we just queue them up into an output buffer.\r
113 \r
114Arguments:\r
115 ByteVal - the raw byte to emit to the output IFR stream\r
116 KeyByte - a value that can be used for debug. \r
117\r
118Returns:\r
119 None\r
120\r
121--*/\r
122 ;\r
123 void\r
124 SetVarStoreId (\r
125 UINT16 VarStoreId\r
126 )\r
127 /*++\r
128\r
129Routine Description:\r
130 This function is invoked by the parser when a variable is referenced in the \r
131 VFR. Save the variable store (and set a flag) so that we can later determine \r
132 if we need to emit a varstore-select or varstore-select-pair opcode.\r
133 \r
134Arguments:\r
135 VarStoreId - ID of the variable store referenced in the VFR\r
136\r
137Returns:\r
138 None\r
139\r
140--*/\r
141 ;\r
142 void\r
143 SetSecondaryVarStoreId (\r
144 UINT16 VarStoreId\r
145 )\r
146 /*++\r
147\r
148Routine Description:\r
149 This function is invoked by the parser when a secondary variable is \r
150 referenced in the VFR. Save the variable store (and set a flag) so \r
151 that we can later determine if we need to emit a varstore-select or \r
152 varstore-pair opcode.\r
153 \r
154Arguments:\r
155 VarStoreId - ID of the variable store referenced in the VFR\r
156\r
157Returns:\r
158 None\r
159\r
160--*/\r
161 ;\r
162\r
163/* */\r
164private:\r
165 int\r
166 FlushQueue (\r
167 VOID\r
168 )\r
169 /*++\r
170\r
171Routine Description:\r
172 This function is invoked to flush the internal IFR buffer.\r
173 \r
174Arguments:\r
175 None\r
176\r
177Returns:\r
178 0 always\r
179\r
180--*/\r
181 ;\r
182 int\r
183 IAddByte (\r
184 UINT8 ByteVal,\r
185 UINT8 KeyByte,\r
186 UINT32 LineNum\r
187 )\r
188 /*++\r
189\r
190Routine Description:\r
191 This internal function is used to add actual IFR bytes to\r
192 the output stream. Most other functions queue up the bytes\r
193 in an internal buffer. Once they come here, there's no\r
194 going back.\r
195\r
196 \r
197Arguments:\r
198 ByteVal - value to write to output \r
199 KeyByte - key value tied to the byte -- useful for debug\r
200 LineNum - line number from source file the byte resulted from\r
201\r
202Returns:\r
203 0 - if successful\r
204 1 - failed due to memory allocation failure\r
205\r
206--*/\r
207 ;\r
208\r
209/* */\r
210private:\r
211 IFR_BYTE *mIfrBytes;\r
212 IFR_BYTE *mLastIfrByte;\r
213 UINT32 mQueuedByteCount;\r
214 UINT32 mBytesWritten;\r
215 UINT32 mQueuedLineNum;\r
216 UINT8 mQueuedBytes[MAX_QUEUE_COUNT];\r
217 UINT8 mQueuedKeyBytes[MAX_QUEUE_COUNT];\r
218 UINT8 mQueuedOpcodeByte;\r
219 UINT32 mQueuedOpcodeByteValid;\r
220 UINT16 mPrimaryVarStoreId;\r
221 UINT8 mPrimaryVarStoreIdSet;\r
222 UINT16 mSecondaryVarStoreId;\r
223 UINT8 mSecondaryVarStoreIdSet;\r
224 UINT16 mDefaultVarStoreId;\r
225};\r
226\r
227#endif // #ifndef _VFR_SERVICES_H_\r