]>
Commit | Line | Data |
---|---|---|
e8a5ac7c | 1 | /** @file\r |
748edcd5 | 2 | \r |
f42f22f5 | 3 | Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 4 | SPDX-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 | |
1436aea4 | 20 | #define EFI_DEBUG_MAX_PRINT_BUFFER (80 * 4)\r |
748edcd5 | 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 |
29 | UINTN\r |
30 | EFIAPI\r | |
31 | Xtoi (\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 |
42 | UINT64\r |
43 | EFIAPI\r | |
44 | LXtoi (\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 |
55 | UINTN\r |
56 | EFIAPI\r | |
57 | Atoi (\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 |
68 | UINTN\r |
69 | EFIAPI\r | |
70 | AsciiXtoi (\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 |
81 | UINTN\r |
82 | EFIAPI\r | |
83 | AsciiAtoi (\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 |
99 | INTN\r |
100 | EFIAPI\r | |
101 | StrCmpUnicodeAndAscii (\r | |
1436aea4 MK |
102 | IN CHAR16 *String,\r |
103 | IN CHAR8 *String2\r | |
748edcd5 PB |
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 |
118 | INTN\r |
119 | EFIAPI\r | |
120 | StriCmp (\r | |
1436aea4 MK |
121 | IN CHAR16 *String,\r |
122 | IN CHAR16 *String2\r | |
748edcd5 PB |
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 |
137 | INTN\r |
138 | EFIAPI\r | |
139 | StriCmpUnicodeAndAscii (\r | |
1436aea4 MK |
140 | IN CHAR16 *String,\r |
141 | IN CHAR8 *String2\r | |
748edcd5 PB |
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 |
152 | BOOLEAN\r |
153 | EFIAPI\r | |
154 | StrEndWith (\r | |
1436aea4 MK |
155 | IN CHAR16 *Str,\r |
156 | IN CHAR16 *SubStr\r | |
748edcd5 PB |
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 |
165 | CHAR16 *\r |
166 | EFIAPI\r | |
167 | StrDuplicate (\r | |
1436aea4 | 168 | IN CHAR16 *Src\r |
748edcd5 PB |
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 |
179 | CHAR16 *\r |
180 | EFIAPI\r | |
181 | StrGetNewTokenLine (\r | |
1436aea4 MK |
182 | IN CHAR16 *String,\r |
183 | IN CHAR16 *CharSet\r | |
748edcd5 PB |
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 |
193 | CHAR16 *\r |
194 | EFIAPI\r | |
195 | StrGetNextTokenLine (\r | |
1436aea4 | 196 | IN CHAR16 *CharSet\r |
748edcd5 PB |
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 |
207 | CHAR16 *\r |
208 | EFIAPI\r | |
209 | StrGetNewTokenField (\r | |
1436aea4 MK |
210 | IN CHAR16 *String,\r |
211 | IN CHAR16 *CharSet\r | |
748edcd5 PB |
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 |
221 | CHAR16 *\r |
222 | EFIAPI\r | |
223 | StrGetNextTokenField (\r | |
1436aea4 | 224 | IN CHAR16 *CharSet\r |
748edcd5 PB |
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 |
235 | VOID\r |
236 | EFIAPI\r | |
237 | PatchForStrTokenAfter (\r | |
1436aea4 MK |
238 | IN CHAR16 *Buffer,\r |
239 | IN CHAR16 Patch\r | |
748edcd5 PB |
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 |
249 | VOID\r |
250 | EFIAPI\r | |
251 | PatchForStrTokenBefore (\r | |
1436aea4 MK |
252 | IN CHAR16 *Buffer,\r |
253 | IN CHAR16 Patch\r | |
748edcd5 PB |
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 |
264 | CHAR8 *\r |
265 | EFIAPI\r | |
266 | AsciiStrGetNewTokenLine (\r | |
1436aea4 MK |
267 | IN CHAR8 *String,\r |
268 | IN CHAR8 *CharSet\r | |
748edcd5 PB |
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 |
278 | CHAR8 *\r |
279 | EFIAPI\r | |
280 | AsciiStrGetNextTokenLine (\r | |
1436aea4 | 281 | IN CHAR8 *CharSet\r |
748edcd5 PB |
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 |
292 | CHAR8 *\r |
293 | EFIAPI\r | |
294 | AsciiStrGetNewTokenField (\r | |
1436aea4 MK |
295 | IN CHAR8 *String,\r |
296 | IN CHAR8 *CharSet\r | |
748edcd5 PB |
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 |
306 | CHAR8 *\r |
307 | EFIAPI\r | |
308 | AsciiStrGetNextTokenField (\r | |
1436aea4 | 309 | IN CHAR8 *CharSet\r |
748edcd5 PB |
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 |
320 | VOID\r |
321 | EFIAPI\r | |
322 | PatchForAsciiStrTokenAfter (\r | |
1436aea4 MK |
323 | IN CHAR8 *Buffer,\r |
324 | IN CHAR8 Patch\r | |
748edcd5 PB |
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 |
334 | VOID\r |
335 | EFIAPI\r | |
336 | PatchForAsciiStrTokenBefore (\r | |
1436aea4 MK |
337 | IN CHAR8 *Buffer,\r |
338 | IN CHAR8 Patch\r | |
748edcd5 PB |
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 |
351 | VOID\r |
352 | EFIAPI\r | |
353 | Input (\r | |
1436aea4 MK |
354 | IN CHAR16 *Prompt OPTIONAL,\r |
355 | OUT CHAR16 *InStr,\r | |
356 | IN UINTN StrLen\r | |
748edcd5 PB |
357 | );\r |
358 | \r | |
d138a2e9 DB |
359 | /**\r |
360 | \r | |
361 | SetPageBreak.\r | |
362 | \r | |
363 | **/\r | |
748edcd5 PB |
364 | BOOLEAN\r |
365 | EFIAPI\r | |
366 | SetPageBreak (\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 |
378 | UINTN\r |
379 | EFIAPI\r | |
380 | EDBPrint (\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 |
396 | UINTN\r |
397 | EFIAPI\r | |
398 | EDBSPrint (\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 |
417 | UINTN\r |
418 | EFIAPI\r | |
419 | EDBSPrintWithOffset (\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 |
446 | EFI_STATUS\r |
447 | EFIAPI\r | |
448 | ReadFileToBuffer (\r | |
1436aea4 MK |
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 | |
748edcd5 PB |
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 |
468 | CHAR16 *\r |
469 | EFIAPI\r | |
470 | GetFileNameUnderDir (\r | |
1436aea4 MK |
471 | IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r |
472 | IN CHAR16 *DirName,\r | |
473 | IN CHAR16 *FileName,\r | |
474 | IN OUT UINTN *Index\r | |
748edcd5 PB |
475 | );\r |
476 | \r | |
477 | #endif\r |