]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h
MdeModulePkg/EbcDxe: Fix incorrect Copyright format
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbSupport.h
CommitLineData
e8a5ac7c 1/** @file\r
748edcd5 2\r
f42f22f5 3Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
e8a5ac7c 4This program and the accompanying materials\r
748edcd5
PB
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
748edcd5 12\r
e8a5ac7c 13**/\r
748edcd5
PB
14\r
15#ifndef _EFI_EDB_SUPPORT_H_\r
16#define _EFI_EDB_SUPPORT_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#define EFI_DEBUG_PROMPT_STRING L"EDB > "\r
21#define EFI_DEBUG_PROMPT_COLUMN 5\r
22#define EFI_DEBUG_INPUS_BUFFER_SIZE 64\r
23\r
24#define EFI_DEBUGGER_LINE_NUMBER_IN_PAGE 0x10\r
25\r
26#define EFI_DEBUG_MAX_PRINT_BUFFER (80 * 4)\r
27\r
d138a2e9
DB
28/**\r
29\r
30 Convert hex string to uint.\r
31\r
32 @param Str - The string\r
33\r
34**/\r
748edcd5
PB
35UINTN\r
36EFIAPI\r
37Xtoi (\r
3e118ea8 38 CHAR16 *Str\r
748edcd5
PB
39 );\r
40\r
d138a2e9
DB
41/**\r
42\r
43 Convert hex string to uint.\r
44\r
45 @param Str - The string\r
46\r
47**/\r
748edcd5
PB
48UINT64\r
49EFIAPI\r
50LXtoi (\r
3e118ea8 51 CHAR16 *Str\r
748edcd5
PB
52 );\r
53\r
d138a2e9
DB
54/**\r
55\r
56 Convert hex string to uint.\r
57\r
58 @param Str - The string\r
59\r
60**/\r
748edcd5
PB
61UINTN\r
62EFIAPI\r
63Atoi (\r
3e118ea8 64 CHAR16 *Str\r
748edcd5
PB
65 );\r
66\r
d138a2e9
DB
67/**\r
68\r
69 Convert hex string to uint.\r
70\r
71 @param Str - The string\r
72\r
73**/\r
748edcd5
PB
74UINTN\r
75EFIAPI\r
76AsciiXtoi (\r
3e118ea8 77 CHAR8 *Str\r
748edcd5
PB
78 );\r
79\r
d138a2e9
DB
80/**\r
81\r
82 Convert hex string to uint.\r
83\r
84 @param Str - The string\r
85\r
86**/\r
748edcd5
PB
87UINTN\r
88EFIAPI\r
89AsciiAtoi (\r
3e118ea8 90 CHAR8 *Str\r
748edcd5
PB
91 );\r
92\r
d138a2e9
DB
93/**\r
94 Compare the Unicode and Ascii string pointed by String to the string pointed by String2.\r
95\r
96 @param String - Unicode String to process\r
97\r
98 @param String2 - Ascii string to process\r
99\r
100 @return Return a positive integer if String is lexicall greater than String2; Zero if\r
101 the two strings are identical; and a negative interger if String is lexically\r
102 less than String2.\r
103\r
104**/\r
748edcd5
PB
105INTN\r
106EFIAPI\r
107StrCmpUnicodeAndAscii (\r
108 IN CHAR16 *String,\r
109 IN CHAR8 *String2\r
110 );\r
111\r
d138a2e9
DB
112/**\r
113\r
114 Compare the Unicode string pointed by String to the string pointed by String2.\r
115\r
116 @param String - Unicode String to process\r
117 @param String2 - Unicode string to process\r
118\r
119 @return Return a positive integer if String is lexically greater than String2; Zero if\r
120 the two strings are identical; and a negative integer if String is lexically\r
121 less than String2.\r
122\r
123**/\r
748edcd5
PB
124INTN\r
125EFIAPI\r
126StriCmp (\r
127 IN CHAR16 *String,\r
128 IN CHAR16 *String2\r
129 );\r
130\r
d138a2e9
DB
131/**\r
132\r
133 Compare the Unicode and Ascii string pointed by String to the string pointed by String2.\r
134\r
135 @param String - Unicode String to process\r
136 @param String2 - Ascii string to process\r
137\r
138 @return Return a positive integer if String is lexically greater than String2; Zero if\r
139 the two strings are identical; and a negative integer if String is lexically\r
140 less than String2.\r
141\r
142**/\r
748edcd5
PB
143INTN\r
144EFIAPI\r
145StriCmpUnicodeAndAscii (\r
146 IN CHAR16 *String,\r
147 IN CHAR8 *String2\r
148 );\r
149\r
d138a2e9
DB
150/**\r
151\r
152 Verify if the string is end with the sub string.\r
153\r
154 @param Str - The string where to search the sub string\r
155 @param SubStr - The substring.\r
156\r
157**/\r
748edcd5
PB
158BOOLEAN\r
159EFIAPI\r
160StrEndWith (\r
161 IN CHAR16 *Str,\r
162 IN CHAR16 *SubStr\r
163 );\r
164\r
d138a2e9
DB
165/**\r
166 Duplicate a string.\r
167\r
168 @param Src The string to be duplicated.\r
169\r
170**/\r
748edcd5
PB
171CHAR16 *\r
172EFIAPI\r
173StrDuplicate (\r
174 IN CHAR16 *Src\r
175 );\r
176\r
d138a2e9
DB
177/**\r
178\r
179 Find the next token after one or more specified characters.\r
180\r
181 @param String Point to the string where to find the substring.\r
182 @param CharSet Point to the string to be found.\r
183\r
184**/\r
748edcd5
PB
185CHAR16 *\r
186EFIAPI\r
187StrGetNewTokenLine (\r
188 IN CHAR16 *String,\r
189 IN CHAR16 *CharSet\r
190 );\r
191\r
d138a2e9
DB
192/**\r
193\r
194 Find the next token after one or more specified characters.\r
195\r
196 @param CharSet Point to the string to be found.\r
197\r
198**/\r
748edcd5
PB
199CHAR16 *\r
200EFIAPI\r
201StrGetNextTokenLine (\r
202 IN CHAR16 *CharSet\r
203 );\r
204\r
d138a2e9
DB
205/**\r
206\r
207 Find the next token after one specificed characters.\r
208\r
209 @param String Point to the string where to find the substring.\r
210 @param CharSet Point to the string to be found.\r
211\r
212**/\r
748edcd5
PB
213CHAR16 *\r
214EFIAPI\r
215StrGetNewTokenField (\r
216 IN CHAR16 *String,\r
217 IN CHAR16 *CharSet\r
218 );\r
219\r
d138a2e9
DB
220/**\r
221\r
222 Find the next token after one specificed characters.\r
223\r
224 @param CharSet Point to the string to be found.\r
225\r
226**/\r
748edcd5
PB
227CHAR16 *\r
228EFIAPI\r
229StrGetNextTokenField (\r
230 IN CHAR16 *CharSet\r
231 );\r
232\r
d138a2e9
DB
233/**\r
234\r
235 Patch a character to the end of a string.\r
236\r
237 @param Buffer The string to be patched.\r
238 @param Patch The patch character.\r
239\r
240**/\r
748edcd5
PB
241VOID\r
242EFIAPI\r
243PatchForStrTokenAfter (\r
244 IN CHAR16 *Buffer,\r
245 IN CHAR16 Patch\r
246 );\r
247\r
d138a2e9
DB
248/**\r
249 Patch a character at the beginning of a string.\r
250\r
251 @param Buffer The string to be patched.\r
252 @param Patch The patch character.\r
253\r
254**/\r
748edcd5
PB
255VOID\r
256EFIAPI\r
257PatchForStrTokenBefore (\r
258 IN CHAR16 *Buffer,\r
259 IN CHAR16 Patch\r
260 );\r
261\r
d138a2e9
DB
262/**\r
263\r
264 Find the next token after one or more specified characters.\r
265\r
266 @param String Point to the string where to find the substring.\r
267 @param CharSet Point to the string to be found.\r
268\r
269**/\r
748edcd5
PB
270CHAR8 *\r
271EFIAPI\r
272AsciiStrGetNewTokenLine (\r
273 IN CHAR8 *String,\r
274 IN CHAR8 *CharSet\r
275 );\r
276\r
d138a2e9
DB
277/**\r
278\r
279 Find the next token after one or more specified characters.\r
280\r
281 @param CharSet Point to the string to be found.\r
282\r
283**/\r
748edcd5
PB
284CHAR8 *\r
285EFIAPI\r
286AsciiStrGetNextTokenLine (\r
287 IN CHAR8 *CharSet\r
288 );\r
289\r
d138a2e9
DB
290/**\r
291\r
292 Find the next token after one specificed characters.\r
293\r
294 @param String Point to the string where to find the substring.\r
295 @param CharSet Point to the string to be found.\r
296\r
297**/\r
748edcd5
PB
298CHAR8 *\r
299EFIAPI\r
300AsciiStrGetNewTokenField (\r
301 IN CHAR8 *String,\r
302 IN CHAR8 *CharSet\r
303 );\r
304\r
d138a2e9
DB
305/**\r
306\r
307 Find the next token after one specificed characters.\r
308\r
309 @param CharSet Point to the string to be found.\r
310\r
311**/\r
748edcd5
PB
312CHAR8 *\r
313EFIAPI\r
314AsciiStrGetNextTokenField (\r
315 IN CHAR8 *CharSet\r
316 );\r
317\r
d138a2e9
DB
318/**\r
319\r
320 Patch a character to the end of a string.\r
321\r
322 @param Buffer The string to be patched.\r
323 @param Patch The patch character.\r
324\r
325**/\r
748edcd5
PB
326VOID\r
327EFIAPI\r
328PatchForAsciiStrTokenAfter (\r
329 IN CHAR8 *Buffer,\r
330 IN CHAR8 Patch\r
331 );\r
332\r
d138a2e9
DB
333/**\r
334 Patch a character at the beginning of a string.\r
335\r
336 @param Buffer The string to be patched.\r
337 @param Patch The patch character.\r
338\r
339**/\r
748edcd5
PB
340VOID\r
341EFIAPI\r
342PatchForAsciiStrTokenBefore (\r
343 IN CHAR8 *Buffer,\r
344 IN CHAR8 Patch\r
345 );\r
346\r
e8a5ac7c 347/**\r
d138a2e9
DB
348\r
349 Shell Library.\r
350 Get user input.\r
351\r
352 @param Prompt The prompt string.\r
353 @param InStr Point to the input string.\r
354 @param StrLen The max length of string user can input.\r
355\r
e8a5ac7c 356**/\r
748edcd5
PB
357VOID\r
358EFIAPI\r
359Input (\r
360 IN CHAR16 *Prompt OPTIONAL,\r
361 OUT CHAR16 *InStr,\r
362 IN UINTN StrLen\r
363 );\r
364\r
d138a2e9
DB
365/**\r
366\r
367 SetPageBreak.\r
368\r
369**/\r
748edcd5
PB
370BOOLEAN\r
371EFIAPI\r
372SetPageBreak (\r
373 VOID\r
374 );\r
375\r
d138a2e9
DB
376/**\r
377 Print a Unicode string to the output device.\r
378\r
379 @param Format A Null-terminated Unicode format string.\r
380 @param ... The variable argument list that contains pointers to Null-\r
381 terminated Unicode strings to be printed\r
382\r
383**/\r
748edcd5
PB
384UINTN\r
385EFIAPI\r
386EDBPrint (\r
387 IN CONST CHAR16 *Format,\r
388 ...\r
389 );\r
390\r
d138a2e9
DB
391/**\r
392 Print a Unicode string to the output buffer.\r
393\r
394 @param Buffer A pointer to the output buffer for the produced Null-terminated\r
395 Unicode string.\r
396 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
397 @param Format A Null-terminated Unicode format string.\r
398 @param ... The variable argument list that contains pointers to Null-\r
399 terminated Unicode strings to be printed\r
400\r
401**/\r
748edcd5
PB
402UINTN\r
403EFIAPI\r
404EDBSPrint (\r
405 OUT CHAR16 *Buffer,\r
406 IN INTN BufferSize,\r
407 IN CONST CHAR16 *Format,\r
408 ...\r
409 );\r
410\r
d138a2e9
DB
411/**\r
412 Print a Unicode string to the output buffer with specified offset..\r
413\r
414 @param Buffer A pointer to the output buffer for the produced Null-terminated\r
415 Unicode string.\r
416 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
417 @param Offset The offset of the buffer.\r
418 @param Format A Null-terminated Unicode format string.\r
419 @param ... The variable argument list that contains pointers to Null-\r
420 terminated Unicode strings to be printed\r
421\r
422**/\r
748edcd5
PB
423UINTN\r
424EFIAPI\r
425EDBSPrintWithOffset (\r
426 OUT CHAR16 *Buffer,\r
427 IN INTN BufferSize,\r
428 IN UINTN Offset,\r
429 IN CONST CHAR16 *Format,\r
430 ...\r
431 );\r
432\r
d138a2e9
DB
433/**\r
434\r
435 Read a file.\r
436 If ScanFs is FLASE, it will use DebuggerPrivate->Vol as default Fs.\r
437 If ScanFs is TRUE, it will scan all FS and check the file.\r
438 If there is only one file match the name, it will be read.\r
439 If there is more than one file match the name, it will return Error.\r
440\r
441 @param DebuggerPrivate - EBC Debugger private data structure\r
442 @param FileName - The file to be read.\r
443 @param BufferSize - The file buffer size\r
444 @param Buffer - The file buffer\r
445 @param ScanFs - Need Scan all FS\r
446\r
447 @retval EFI_SUCCESS - read file successfully\r
448 @retval EFI_NOT_FOUND - file not found\r
449 @retval EFI_NO_MAPPING - there is duplicated files found\r
450\r
451**/\r
748edcd5
PB
452EFI_STATUS\r
453EFIAPI\r
454ReadFileToBuffer (\r
455 IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
456 IN CHAR16 *FileName,\r
457 OUT UINTN *BufferSize,\r
458 OUT VOID **Buffer,\r
459 IN BOOLEAN ScanFs\r
460 );\r
461\r
d138a2e9
DB
462/**\r
463\r
464 Get file name under this dir with index\r
465\r
466 @param DebuggerPrivate - EBC Debugger private data structure\r
467 @param DirName - The dir to be read.\r
468 @param FileName - The file name pattern under this dir\r
469 @param Index - The file index under this dir\r
470\r
471 @return File Name which match the pattern and index.\r
472\r
473**/\r
748edcd5
PB
474CHAR16 *\r
475EFIAPI\r
476GetFileNameUnderDir (\r
477 IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
478 IN CHAR16 *DirName,\r
479 IN CHAR16 *FileName,\r
480 IN OUT UINTN *Index\r
481 );\r
482\r
483#endif\r