878ddf1f |
1 | /** @file\r |
2 | Base Debug Library that uses PrintLib to print messages to a memory buffer.\r |
3 | \r |
4 | Copyright (c) 2006, Intel Corporation\r |
5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
8 | http://opensource.org/licenses/bsd-license.php\r |
9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
12 | \r |
13 | **/\r |
14 | \r |
15 | //\r |
16 | // Define the maximum debug and assert message length that this library supports \r |
17 | //\r |
18 | #define MAX_DEBUG_MESSAGE_LENGTH 0x100\r |
19 | \r |
20 | /**\r |
21 | \r |
22 | Prints a debug message to the debug output device if the specified error level is enabled.\r |
23 | \r |
24 | If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r |
25 | the message specified by Format and the associated variable argument list to \r |
26 | the debug output device.\r |
27 | \r |
28 | If Format is NULL, then ASSERT().\r |
29 | \r |
30 | @param ErrorLevel The error level of the debug message.\r |
31 | @param Format Format string for the debug message to print.\r |
32 | \r |
33 | **/\r |
34 | VOID\r |
35 | EFIAPI\r |
36 | DebugPrint (\r |
37 | IN UINTN ErrorLevel,\r |
38 | IN CHAR8 *Format,\r |
39 | ...\r |
40 | )\r |
41 | {\r |
42 | CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r |
43 | VA_LIST Marker;\r |
44 | \r |
45 | //\r |
46 | // If Format is NULL, then ASSERT().\r |
47 | //\r |
48 | ASSERT (Format != NULL);\r |
49 | \r |
50 | //\r |
51 | // Print the assert message to a buffer\r |
52 | //\r |
53 | VA_START (Marker, Format);\r |
54 | AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r |
55 | VA_END (Marker);\r |
56 | }\r |
57 | \r |
58 | \r |
59 | /**\r |
60 | \r |
61 | Prints an assert message containing a filename, line number, and description. \r |
62 | This may be followed by a breakpoint or a dead loop.\r |
63 | \r |
64 |