]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/DebugLib.h
Change _CR() to BASE_CR() to follow naming convention
[mirror_edk2.git] / MdePkg / Include / Library / DebugLib.h
index 134952c6659b2696a61c11c4e5791afd050cabde..764bccc87ca5ac9161debf65001aad08a020fa25 100644 (file)
@@ -1,14 +1,17 @@
 /** @file\r
-  Public include file for the Debug Library\r
-\r
-  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  Provides services to print debug and assert messages to a debug output device.\r
+  \r
+  The Debug library supports debug print and asserts based on a combination of macros and code.\r
+  The debug library can be turned on and off so that the debug code does not increase the size of an image.\r
+  \r
+Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -35,7 +38,7 @@
 #define DEBUG_POOL      0x00000010  // Alloc & Free's\r
 #define DEBUG_PAGE      0x00000020  // Alloc & Free's\r
 #define DEBUG_INFO      0x00000040  // Verbose\r
-#define DEBUG_DEPEX     0x00000080  // PEI or DXE Dependency Evaluation\r
+#define DEBUG_DISPATCH  0x00000080  // PEI/DXE Dispatchers\r
 #define DEBUG_VARIABLE  0x00000100  // Variable\r
 #define DEBUG_BM        0x00000400  // Boot Manager\r
 #define DEBUG_BLKIO     0x00001000  // BlkIo Driver\r
@@ -55,7 +58,7 @@
 #define EFI_D_POOL      DEBUG_POOL\r
 #define EFI_D_PAGE      DEBUG_PAGE\r
 #define EFI_D_INFO      DEBUG_INFO\r
-#define EFI_D_DEPEX     DEBUG_DEPEX\r
+#define EFI_D_DISPATCH  DEBUG_DISPATCH\r
 #define EFI_D_VARIABLE  DEBUG_VARIABLE\r
 #define EFI_D_BM        DEBUG_BM\r
 #define EFI_D_BLKIO     DEBUG_BLKIO\r
@@ -66,7 +69,6 @@
 #define EFI_D_ERROR     DEBUG_ERROR\r
 \r
 /**\r
-\r
   Prints a debug message to the debug output device if the specified error level is enabled.\r
 \r
   If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r
@@ -77,7 +79,8 @@
 \r
   @param  ErrorLevel  The error level of the debug message.\r
   @param  Format      Format string for the debug message to print.\r
-  @param  ...         The variable argument list.\r
+  @param  ...         Variable argument list whose contents are accessed \r
+                      based on the format string specified by Format.\r
 \r
 **/\r
 VOID\r
@@ -90,7 +93,6 @@ DebugPrint (
 \r
 \r
 /**\r
-\r
   Prints an assert message containing a filename, line number, and description.  \r
   This may be followed by a breakpoint or a dead loop.\r
 \r
@@ -104,7 +106,6 @@ DebugPrint (
   processing another DebugAssert(), then DebugAssert() must return immediately.\r
 \r
   If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
-\r
   If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
 \r
   @param  FileName     Pointer to the name of the source file that generated the assert condition.\r
@@ -122,14 +123,12 @@ DebugAssert (
 \r
 \r
 /**\r
-\r
   Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with the value specified by \r
   PcdDebugClearMemoryValue, and returns Buffer.\r
 \r
   If Buffer is NULL, then ASSERT().\r
-\r
   If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). \r
 \r
   @param   Buffer  Pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
@@ -147,7 +146,6 @@ DebugClearMemory (
 \r
 \r
 /**\r
-  \r
   Returns TRUE if ASSERT() macros are enabled.\r
 \r
   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of \r
@@ -164,9 +162,8 @@ DebugAssertEnabled (
   );\r
 \r
 \r
-/**\r
-  \r
-  Returns TRUE if DEBUG()macros are enabled.\r
+/**  \r
+  Returns TRUE if DEBUG() macros are enabled.\r
 \r
   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of \r
   PcdDebugProperyMask is set.  Otherwise FALSE is returned.\r
@@ -182,9 +179,8 @@ DebugPrintEnabled (
   );\r
 \r
 \r
-/**\r
-  \r
-  Returns TRUE if DEBUG_CODE()macros are enabled.\r
+/**  \r
+  Returns TRUE if DEBUG_CODE() macros are enabled.\r
 \r
   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of \r
   PcdDebugProperyMask is set.  Otherwise FALSE is returned.\r
@@ -200,9 +196,8 @@ DebugCodeEnabled (
   );\r
 \r
 \r
-/**\r
-  \r
-  Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.\r
+/**  \r
+  Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.\r
 \r
   This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of \r
   PcdDebugProperyMask is set.  Otherwise FALSE is returned.\r
@@ -218,8 +213,7 @@ DebugClearMemoryEnabled (
   );\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Internal worker macro that calls DebugAssert().\r
 \r
   This macro calls DebugAssert() passing in the filename, line number, and \r
@@ -231,8 +225,7 @@ DebugClearMemoryEnabled (
 #define _ASSERT(Expression)  DebugAssert (__FILE__, __LINE__, #Expression)\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Internal worker macro that calls DebugPrint().\r
 \r
   This macro calls DebugPrint() passing in the debug error level, a format \r
@@ -245,8 +238,7 @@ DebugClearMemoryEnabled (
 #define _DEBUG(Expression)   DebugPrint Expression\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that calls DebugAssert() if a expression evaluates to FALSE.\r
 \r
   If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -267,8 +259,7 @@ DebugClearMemoryEnabled (
   } while (FALSE)\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that calls DebugPrint().\r
 \r
   If the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -287,8 +278,7 @@ DebugClearMemoryEnabled (
   } while (FALSE)\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that calls DebugAssert() if an EFI_STATUS evaluates to an error code.\r
 \r
   If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -310,8 +300,7 @@ DebugClearMemoryEnabled (
   } while (FALSE)\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that calls DebugAssert() if a protocol is already installed in the \r
   handle database.\r
 \r
@@ -363,8 +352,7 @@ DebugClearMemoryEnabled (
 #define DEBUG_CODE_BEGIN()  do { if (DebugCodeEnabled ()) { UINT8  __DebugCodeLocal\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that marks the end of debug source code.\r
 \r
   If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -376,8 +364,7 @@ DebugClearMemoryEnabled (
 #define DEBUG_CODE_END()    __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that declares a section of debug source code.\r
 \r
   If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -391,8 +378,7 @@ DebugClearMemoryEnabled (
   DEBUG_CODE_END ()\r
 \r
 \r
-/**\r
-  \r
+/**  \r
   Macro that calls DebugClearMemory() to clear a buffer to a default value.\r
 \r
   If the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set, \r
@@ -411,7 +397,6 @@ DebugClearMemoryEnabled (
 \r
 \r
 /**\r
-\r
   Macro that calls DebugAssert() if the containing record does not have a \r
   matching signature.  If the signatures matches, then a pointer to the data \r
   structure that contains a specified field of that data structure is returned.  \r
@@ -453,9 +438,9 @@ DebugClearMemoryEnabled (
   @param  TestSignature  The 32-bit signature value to match.\r
 \r
 **/\r
-#define CR(Record, TYPE, Field, TestSignature)                                          \\r
-  (DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ?  \\r
-  (TYPE *) (_ASSERT (CR has Bad Signature), Record) :                                   \\r
-  _CR (Record, TYPE, Field)\r
+#define CR(Record, TYPE, Field, TestSignature)                                                        \\r
+  (DebugAssertEnabled () && (BASE_CR (Record, TYPE, Field)->Signature != TestSignature)) ?  \\r
+  (TYPE *) (_ASSERT (CR has Bad Signature), Record) :                                                 \\r
+  BASE_CR (Record, TYPE, Field)\r
     \r
 #endif\r