Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 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 | |
| 45 | #include <IxOsal.h> |
| 46 | |
| 47 | #ifdef IX_UNIT_TEST |
| 48 | #define NULL_PRINT_ROUTINE(format, arg...) /* nothing */ |
| 49 | #else |
| 50 | #define NULL_PRINT_ROUTINE if(0) printf |
| 51 | #endif |
| 52 | |
| 53 | /*************************************************** |
| 54 | * Globals * |
| 55 | ***************************************************/ |
| 56 | /* safe to permanently leave these on */ |
| 57 | #define HAS_ERROR_LOG |
| 58 | #define HAS_ERROR_IRQ_LOG |
| 59 | #define HAS_WARNING_LOG |
| 60 | |
| 61 | /*************************************************** |
| 62 | * Log Configuration * |
| 63 | ***************************************************/ |
| 64 | |
| 65 | /* debug output can be turned on unless specifically |
| 66 | declared as a non-debug build */ |
| 67 | #ifndef NDEBUG |
| 68 | |
| 69 | #undef HAS_EVENTS_TRACE |
| 70 | #undef HAS_EVENTS_VERBOSE_TRACE |
| 71 | |
| 72 | #undef HAS_SUPPORT_TRACE |
| 73 | #undef HAS_SUPPORT_VERBOSE_TRACE |
| 74 | |
| 75 | #undef HAS_NPE_TRACE |
| 76 | #undef HAS_NPE_VERBOSE_TRACE |
| 77 | #undef HAS_DUMP_NPE_TREE |
| 78 | |
| 79 | #undef HAS_UPDATE_TRACE |
| 80 | #undef HAS_UPDATE_VERBOSE_TRACE |
| 81 | |
| 82 | #endif /* NDEBUG */ |
| 83 | |
| 84 | |
| 85 | /*************************************************** |
| 86 | * Log Macros * |
| 87 | ***************************************************/ |
| 88 | |
| 89 | /************** Globals ******************/ |
| 90 | |
| 91 | #ifdef HAS_ERROR_LOG |
| 92 | |
| 93 | #define ERROR_LOG printf |
| 94 | |
| 95 | #else |
| 96 | |
| 97 | #define ERROR_LOG NULL_PRINT_ROUTINE |
| 98 | |
| 99 | #endif |
| 100 | |
| 101 | #ifdef HAS_ERROR_IRQ_LOG |
| 102 | |
| 103 | #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) |
| 104 | |
| 105 | #else |
| 106 | |
| 107 | #define ERROR_IRQ_LOG(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */ |
| 108 | |
| 109 | #endif |
| 110 | |
| 111 | #ifdef HAS_WARNING_LOG |
| 112 | |
| 113 | #define WARNING_LOG printf |
| 114 | |
| 115 | #else |
| 116 | |
| 117 | #define WARNING_LOG NULL_PRINT_ROUTINE |
| 118 | |
| 119 | #endif |
| 120 | |
| 121 | /************** Events *******************/ |
| 122 | |
| 123 | #ifdef HAS_EVENTS_TRACE |
| 124 | |
| 125 | #define IX_ETH_DB_EVENTS_TRACE printf |
| 126 | #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) |
| 127 | |
| 128 | #ifdef HAS_EVENTS_VERBOSE_TRACE |
| 129 | |
| 130 | #define IX_ETH_DB_EVENTS_VERBOSE_TRACE printf |
| 131 | |
| 132 | #else |
| 133 | |
| 134 | #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 135 | |
| 136 | #endif /* HAS_EVENTS_VERBOSE_TRACE */ |
| 137 | |
| 138 | #else |
| 139 | |
| 140 | #define IX_ETH_DB_EVENTS_TRACE NULL_PRINT_ROUTINE |
| 141 | #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 142 | #define IX_ETH_DB_IRQ_EVENTS_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */ |
| 143 | |
| 144 | #endif /* HAS_EVENTS_TRACE */ |
| 145 | |
| 146 | /************** Support *******************/ |
| 147 | |
| 148 | #ifdef HAS_SUPPORT_TRACE |
| 149 | |
| 150 | #define IX_ETH_DB_SUPPORT_TRACE printf |
| 151 | #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) |
| 152 | |
| 153 | #ifdef HAS_SUPPORT_VERBOSE_TRACE |
| 154 | |
| 155 | #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE printf |
| 156 | |
| 157 | #else |
| 158 | |
| 159 | #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 160 | |
| 161 | #endif /* HAS_SUPPORT_VERBOSE_TRACE */ |
| 162 | |
| 163 | #else |
| 164 | |
| 165 | #define IX_ETH_DB_SUPPORT_TRACE NULL_PRINT_ROUTINE |
| 166 | #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 167 | #define IX_ETH_DB_SUPPORT_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */ |
| 168 | |
| 169 | #endif /* HAS_SUPPORT_TRACE */ |
| 170 | |
| 171 | /************** NPE Adaptor *******************/ |
| 172 | |
| 173 | #ifdef HAS_NPE_TRACE |
| 174 | |
| 175 | #define IX_ETH_DB_NPE_TRACE printf |
| 176 | #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) |
| 177 | |
| 178 | #ifdef HAS_NPE_VERBOSE_TRACE |
| 179 | |
| 180 | #define IX_ETH_DB_NPE_VERBOSE_TRACE printf |
| 181 | |
| 182 | #else |
| 183 | |
| 184 | #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 185 | |
| 186 | #endif /* HAS_NPE_VERBOSE_TRACE */ |
| 187 | |
| 188 | #else |
| 189 | |
| 190 | #define IX_ETH_DB_NPE_TRACE NULL_PRINT_ROUTINE |
| 191 | #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 192 | #define IX_ETH_DB_NPE_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */ |
| 193 | |
| 194 | #endif /* HAS_NPE_TRACE */ |
| 195 | |
| 196 | #ifdef HAS_DUMP_NPE_TREE |
| 197 | |
| 198 | #define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) ixEthELTDumpTree(eltBaseAddress, eltSize) |
| 199 | |
| 200 | #else |
| 201 | |
| 202 | #define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) /* nothing */ |
| 203 | |
| 204 | #endif /* HAS_DUMP_NPE_TREE */ |
| 205 | |
| 206 | /************** Port Update *******************/ |
| 207 | |
| 208 | #ifdef HAS_UPDATE_TRACE |
| 209 | |
| 210 | #define IX_ETH_DB_UPDATE_TRACE printf |
| 211 | |
| 212 | #ifdef HAS_UPDATE_VERBOSE_TRACE |
| 213 | |
| 214 | #define IX_ETH_DB_UPDATE_VERBOSE_TRACE printf |
| 215 | |
| 216 | #else |
| 217 | |
| 218 | #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 219 | |
| 220 | #endif |
| 221 | |
| 222 | #else /* HAS_UPDATE_VERBOSE_TRACE */ |
| 223 | |
| 224 | #define IX_ETH_DB_UPDATE_TRACE NULL_PRINT_ROUTINE |
| 225 | #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE |
| 226 | |
| 227 | #endif /* HAS_UPDATE_TRACE */ |