IxEthDBLog_p.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /**
  2. * @file IxEthDBLog_p.h
  3. *
  4. * @brief definitions of log macros and log configuration
  5. *
  6. * @par
  7. * IXP400 SW Release version 2.0
  8. *
  9. * -- Copyright Notice --
  10. *
  11. * @par
  12. * Copyright 2001-2005, Intel Corporation.
  13. * All rights reserved.
  14. *
  15. * @par
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions
  18. * are met:
  19. * 1. Redistributions of source code must retain the above copyright
  20. * notice, this list of conditions and the following disclaimer.
  21. * 2. Redistributions in binary form must reproduce the above copyright
  22. * notice, this list of conditions and the following disclaimer in the
  23. * documentation and/or other materials provided with the distribution.
  24. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  25. * may be used to endorse or promote products derived from this software
  26. * without specific prior written permission.
  27. *
  28. * @par
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  30. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  33. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  35. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  36. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  37. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  38. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  39. * SUCH DAMAGE.
  40. *
  41. * @par
  42. * -- End of Copyright Notice --
  43. */
  44. #include <IxOsal.h>
  45. #ifdef IX_UNIT_TEST
  46. #define NULL_PRINT_ROUTINE(format, arg...) /* nothing */
  47. #else
  48. #define NULL_PRINT_ROUTINE if(0) printf
  49. #endif
  50. /***************************************************
  51. * Globals *
  52. ***************************************************/
  53. /* safe to permanently leave these on */
  54. #define HAS_ERROR_LOG
  55. #define HAS_ERROR_IRQ_LOG
  56. #define HAS_WARNING_LOG
  57. /***************************************************
  58. * Log Configuration *
  59. ***************************************************/
  60. /* debug output can be turned on unless specifically
  61. declared as a non-debug build */
  62. #ifndef NDEBUG
  63. #undef HAS_EVENTS_TRACE
  64. #undef HAS_EVENTS_VERBOSE_TRACE
  65. #undef HAS_SUPPORT_TRACE
  66. #undef HAS_SUPPORT_VERBOSE_TRACE
  67. #undef HAS_NPE_TRACE
  68. #undef HAS_NPE_VERBOSE_TRACE
  69. #undef HAS_DUMP_NPE_TREE
  70. #undef HAS_UPDATE_TRACE
  71. #undef HAS_UPDATE_VERBOSE_TRACE
  72. #endif /* NDEBUG */
  73. /***************************************************
  74. * Log Macros *
  75. ***************************************************/
  76. /************** Globals ******************/
  77. #ifdef HAS_ERROR_LOG
  78. #define ERROR_LOG printf
  79. #else
  80. #define ERROR_LOG NULL_PRINT_ROUTINE
  81. #endif
  82. #ifdef HAS_ERROR_IRQ_LOG
  83. #define ERROR_IRQ_LOG(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
  84. #else
  85. #define ERROR_IRQ_LOG(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
  86. #endif
  87. #ifdef HAS_WARNING_LOG
  88. #define WARNING_LOG printf
  89. #else
  90. #define WARNING_LOG NULL_PRINT_ROUTINE
  91. #endif
  92. /************** Events *******************/
  93. #ifdef HAS_EVENTS_TRACE
  94. #define IX_ETH_DB_EVENTS_TRACE printf
  95. #define IX_ETH_DB_IRQ_EVENTS_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
  96. #ifdef HAS_EVENTS_VERBOSE_TRACE
  97. #define IX_ETH_DB_EVENTS_VERBOSE_TRACE printf
  98. #else
  99. #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE
  100. #endif /* HAS_EVENTS_VERBOSE_TRACE */
  101. #else
  102. #define IX_ETH_DB_EVENTS_TRACE NULL_PRINT_ROUTINE
  103. #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE
  104. #define IX_ETH_DB_IRQ_EVENTS_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
  105. #endif /* HAS_EVENTS_TRACE */
  106. /************** Support *******************/
  107. #ifdef HAS_SUPPORT_TRACE
  108. #define IX_ETH_DB_SUPPORT_TRACE printf
  109. #define IX_ETH_DB_SUPPORT_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
  110. #ifdef HAS_SUPPORT_VERBOSE_TRACE
  111. #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE printf
  112. #else
  113. #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE
  114. #endif /* HAS_SUPPORT_VERBOSE_TRACE */
  115. #else
  116. #define IX_ETH_DB_SUPPORT_TRACE NULL_PRINT_ROUTINE
  117. #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE
  118. #define IX_ETH_DB_SUPPORT_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
  119. #endif /* HAS_SUPPORT_TRACE */
  120. /************** NPE Adaptor *******************/
  121. #ifdef HAS_NPE_TRACE
  122. #define IX_ETH_DB_NPE_TRACE printf
  123. #define IX_ETH_DB_NPE_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
  124. #ifdef HAS_NPE_VERBOSE_TRACE
  125. #define IX_ETH_DB_NPE_VERBOSE_TRACE printf
  126. #else
  127. #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE
  128. #endif /* HAS_NPE_VERBOSE_TRACE */
  129. #else
  130. #define IX_ETH_DB_NPE_TRACE NULL_PRINT_ROUTINE
  131. #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE
  132. #define IX_ETH_DB_NPE_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
  133. #endif /* HAS_NPE_TRACE */
  134. #ifdef HAS_DUMP_NPE_TREE
  135. #define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) ixEthELTDumpTree(eltBaseAddress, eltSize)
  136. #else
  137. #define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) /* nothing */
  138. #endif /* HAS_DUMP_NPE_TREE */
  139. /************** Port Update *******************/
  140. #ifdef HAS_UPDATE_TRACE
  141. #define IX_ETH_DB_UPDATE_TRACE printf
  142. #ifdef HAS_UPDATE_VERBOSE_TRACE
  143. #define IX_ETH_DB_UPDATE_VERBOSE_TRACE printf
  144. #else
  145. #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE
  146. #endif
  147. #else /* HAS_UPDATE_VERBOSE_TRACE */
  148. #define IX_ETH_DB_UPDATE_TRACE NULL_PRINT_ROUTINE
  149. #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE
  150. #endif /* HAS_UPDATE_TRACE */