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