1 /* 2 * Copyright (C) 2010 NXP Semiconductors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 /** 19 * \file phDbgTrace.h 20 * Project: NFC-FRI-1.1 / HAL4.0 21 * 22 * $Date: Tue Apr 28 11:48:33 2009 $ 23 * $Author: ing08203 $ 24 * $Revision: 1.17 $ 25 * $Aliases: NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $ 26 * 27 */ 28 29 /*@{*/ 30 #ifndef PHDBGTRACE_H 31 #define PHDBGTRACE_H 32 /*@}*/ 33 34 #include <stdio.h> 35 36 37 #ifdef PHDBG_TRACES 38 #define MAX_TRACE_BUFFER 300 39 40 #ifndef PHDBG_TRACES_LEVEL_0 41 #ifndef PHDBG_TRACES_LEVEL_1 42 #ifndef PHDBG_TRACES_LEVEL_2 43 #define PHDBG_TRACES_LEVEL_0 44 #endif 45 #endif 46 #endif 47 48 extern char phOsalNfc_DbgTraceBuffer[]; 49 50 #ifdef PHDBG_TRACES_LEVEL_0 51 52 /*indicates an error that causes a program to abort.*/ 53 #define PHDBG_FATAL_ERROR(Str) {\ 54 snprintf(phOsalNfc_DbgTraceBuffer,MAX_TRACE_BUFFER, \ 55 "FATAL ERROR in Module :%s\n",__FILE__);\ 56 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 57 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 58 "In Function:%s\n",__FUNCTION__ ); \ 59 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 60 } 61 62 #define PHDBG_CRITICAL_ERROR(Str) {\ 63 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 64 "CRITICAL ERROR in Module :%s\n",__FILE__);\ 65 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 66 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 67 "In Function:%s\n",__FUNCTION__ ); \ 68 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 69 } 70 #define PHDBG_WARNING(Str) 71 #define PHDBG_INFO(Str) 72 #endif /*End of PHDBG_TRACES_LEVEL_0 */ 73 74 #ifdef PHDBG_TRACES_LEVEL_1 75 76 /*indicates an error that causes a program to abort.*/ 77 #define PHDBG_FATAL_ERROR(Str) {\ 78 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 79 "FATAL ERROR in Module :%s\n",__FILE__);\ 80 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 81 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 82 "In Function:%s\n",__FUNCTION__ ); \ 83 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 84 } 85 86 #define PHDBG_CRITICAL_ERROR(Str) {\ 87 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 88 "CRITICAL ERROR in Module :%s\n",__FILE__);\ 89 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 90 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 91 "In Function:%s\n",__FUNCTION__ ); \ 92 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 93 } 94 /*Normally this macro shall be used indicate system state that might cause problems in future.*/ 95 #define PHDBG_WARNING(Str) {\ 96 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 97 "WARNING :%s\n",__FILE__);\ 98 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 99 phOsalNfc_DbgString (Str);\ 100 phOsalNfc_DbgString ("\n");\ 101 } 102 #define PHDBG_INFO(Str) 103 #endif /*End of PHDBG_TRACES_LEVEL_1 */ 104 105 #ifdef PHDBG_TRACES_LEVEL_2 106 107 /*indicates an error that causes a program to abort.*/ 108 #define PHDBG_FATAL_ERROR(Str) {\ 109 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 110 "FATAL ERROR in Module :%s\n",__FILE__);\ 111 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 112 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 113 "In Function:%s\n",__FUNCTION__ ); \ 114 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 115 } 116 117 #define PHDBG_CRITICAL_ERROR(Str) {\ 118 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 119 "CRITICAL ERROR in Module :%s\n",__FILE__);\ 120 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 121 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 122 "In Function:%s\n",__FUNCTION__ ); \ 123 phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\ 124 } 125 /*Normally this macro shall be used indicate system state that might cause problems in future.*/ 126 #define PHDBG_WARNING(Str) {\ 127 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 128 "WARNING :%s\n",__FILE__);\ 129 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 130 phOsalNfc_DbgString (Str);\ 131 phOsalNfc_DbgString ("\n");\ 132 } 133 134 #define PHDBG_INFO(Str) {\ 135 snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \ 136 "DBG INFO :%s\n",__FILE__);\ 137 phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\ 138 phOsalNfc_DbgString (Str);\ 139 phOsalNfc_DbgString ("\n");\ 140 } 141 142 143 144 #endif /*End of PHDBG_TRACES_LEVEL_2 */ 145 #else 146 #define PHDBG_FATAL_ERROR(Str) 147 #define PHDBG_CRITICAL_ERROR(Str) 148 #define PHDBG_WARNING(Str) 149 #define PHDBG_INFO(Str) 150 151 152 #endif /*end of DEBUG trace*/ 153 #endif /* end of PHDBGTRACE_H */ 154