systemswstubs/examplecommonisc/IscDriver/inc/IscTrace.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Trace macros for example common isc.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ISCTRACE_H
       
    20 #define ISCTRACE_H
       
    21 
       
    22 // INCLUDES
       
    23 // CONSTANTS
       
    24 
       
    25 // MACROS
       
    26 
       
    27 #ifdef TRACE_MODE_KERNEL
       
    28 
       
    29 	// INCLUDES
       
    30     #include <kernel.h>
       
    31 
       
    32 	#define _T(a) a
       
    33 #else 
       
    34 
       
    35 	// INCLUDES
       
    36 	#include <e32svr.h>	// RDebug
       
    37     #include <e32std.h>
       
    38 
       
    39 	#define _T(a) _L(a)
       
    40 
       
    41 #endif // TRACE_MODE_KERNEL
       
    42 
       
    43 #ifdef _DEBUG
       
    44 
       
    45     #ifdef TRACE_MODE_KERNEL
       
    46     	#define __TRACE_PRINTF(a) Kern::Printf a
       
    47     #else
       
    48 	    #define __TRACE_PRINTF(a) RDebug::Print a
       
    49     #endif
       
    50 
       
    51 #else
       
    52     #define __TRACE_PRINTF(a)
       
    53 #endif // _DEBUG
       
    54 
       
    55 
       
    56 #ifdef _DEBUG
       
    57 
       
    58     void BuildTraceFunc( const TDesC& aPrefix );
       
    59     void DataDumpTraceFunc( const TDesC& aPrefix, const TDesC8& aData );
       
    60 
       
    61     #define BUILD_TRACE( a ) BuildTraceFunc( a )
       
    62 	#define DATA_DUMP_TRACE( a, b ) DataDumpTraceFunc( a, b )
       
    63 
       
    64     #ifdef TRACE_MODE_KERNEL
       
    65 
       
    66 		// define assertions
       
    67         #define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled=" __DATE__" "__TIME__, __LINE__ ))
       
    68         
       
    69     #else 
       
    70 
       
    71 		// define assertions
       
    72         #ifdef __WINS__
       
    73             #define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__ "),__LINE__))
       
    74         #else
       
    75             #define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__ __TIME__""),__LINE__ ))
       
    76         #endif  //__WINS__
       
    77 
       
    78     #endif // TRACE_MODE_KERNEL
       
    79 
       
    80 
       
    81     #if defined COMPONENT_TRACE_FLAG
       
    82         #define C_TRACE(a) __TRACE_PRINTF(a)
       
    83     #else
       
    84         #define C_TRACE(a) 
       
    85     #endif // COMPONENT_TRACE_FLAG
       
    86 
       
    87     #if defined API_TRACE_FLAG
       
    88         #define A_TRACE(a) __TRACE_PRINTF(a)
       
    89     #else
       
    90         #define A_TRACE(a)
       
    91     #endif // API_TRACE_FLAG
       
    92 
       
    93     #if defined EXTENDED_TRACE_FLAG
       
    94         #define E_TRACE(a) __TRACE_PRINTF(a)
       
    95 	#else
       
    96 		#define E_TRACE(a)
       
    97     #endif // EXTENDED_TRACE_FLAG
       
    98 
       
    99 #else
       
   100     #define TRACE_ASSERT(a)
       
   101     #define C_TRACE(a)
       
   102     #define A_TRACE(a)
       
   103     #define E_TRACE(a)
       
   104 	#define BUILD_TRACE(a)
       
   105     #define DATA_DUMP_TRACE(a, b)
       
   106 #endif // _DEBUG
       
   107 
       
   108 
       
   109 // Resets are made both in UDEB and UREL (traces only in udeb)
       
   110 #ifdef TRACE_MODE_KERNEL
       
   111     #define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__)); Kern::Fault(b,c); }
       
   112 	#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( ("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__) )
       
   113 #else
       
   114     #ifdef __WINS__
       
   115 		#define ASSERT_RESET_ALWAYS(a,b,c) error 
       
   116         #define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( (_L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__ "),__LINE__) )
       
   117     #else
       
   118 		#define ASSERT_RESET_ALWAYS(a,b,c) error 
       
   119         #define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( (_L("Assertion failed: file=%s, line=%d, compiled=%s %s "),__FILE__, __LINE__, __DATE__, __TIME__) )
       
   120     #endif
       
   121 #endif // kernel
       
   122 
       
   123 
       
   124 // DATA TYPES
       
   125 
       
   126 // FUNCTION PROTOTYPES
       
   127 
       
   128 // FORWARD DECLARATIONS
       
   129 
       
   130 #endif // ISCTRACE_H
       
   131 
       
   132 //  End of File