os/kernelhwsrv/kernel/eka/drivers/debug/common/debug_logging.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/debug/common/debug_logging.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,108 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Logging macros for use in debug subsystem
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef DEBUG_LOGGING_H
    1.22 +#define DEBUG_LOGGING_H
    1.23 +
    1.24 +/**
    1.25 + * Debug messages
    1.26 + * 
    1.27 + * Debug messages are only generated for debug builds.
    1.28 + * 
    1.29 + * For kernel mode, use __KTRACE_OPT(KDEBUGGER, Kern::Printf(), 
    1.30 + * for user mode use RDebug::Printf(). 
    1.31 + * 
    1.32 + */
    1.33 +
    1.34 +#ifdef _DEBUG
    1.35 +
    1.36 +  #ifdef __KERNEL_MODE__
    1.37 +
    1.38 +	#include <kernel/kernel.h>
    1.39 +	#include <nk_trace.h>
    1.40 +
    1.41 +	#define LOG_MSG( a )				__KTRACE_OPT(KDEBUGGER, Kern::Printf( a ))
    1.42 +	#define LOG_MSG2( a, b )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b ))
    1.43 +	#define LOG_MSG3( a, b, c )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c ))
    1.44 +	#define LOG_MSG4( a, b, c, d )		__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d ))
    1.45 +	#define LOG_MSG5( a, b, c, d, e )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d, e ))
    1.46 +
    1.47 +	#ifdef __LOG_EVENTS__
    1.48 +
    1.49 +	#define LOG_EVENT_MSG( a )				__KTRACE_OPT(KDEBUGGER, Kern::Printf( a ))
    1.50 +	#define LOG_EVENT_MSG2( a, b )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b ))
    1.51 +	#define LOG_EVENT_MSG3( a, b, c )		__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c ))
    1.52 +	#define LOG_EVENT_MSG4( a, b, c, d )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d ))
    1.53 +	#define LOG_EVENT_MSG5( a, b, c, d, e )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d, e ))
    1.54 +	
    1.55 +	#else
    1.56 +
    1.57 +	#define LOG_EVENT_MSG( a )
    1.58 +	#define LOG_EVENT_MSG2( a, b )
    1.59 +	#define LOG_EVENT_MSG3( a, b, c )
    1.60 +	#define LOG_EVENT_MSG4( a, b, c, d )
    1.61 +	#define LOG_EVENT_MSG5( a, b, c, d, e )
    1.62 +
    1.63 +	#endif
    1.64 +
    1.65 +  #else
    1.66 +
    1.67 +    #include <e32debug.h>
    1.68 +
    1.69 +	#define LOG_MSG( a )				RDebug::Printf( a )
    1.70 +	#define LOG_MSG2( a, b )			RDebug::Printf( a, b )
    1.71 +	#define LOG_MSG3( a, b, c )			RDebug::Printf( a, b, c )
    1.72 +	#define LOG_MSG4( a, b, c, d )		RDebug::Printf( a, b, c, d )
    1.73 +	#define LOG_MSG5( a, b, c, d, e )	RDebug::Printf( a, b, c, d, e )
    1.74 +
    1.75 +	#ifdef __LOG_EVENTS__
    1.76 +
    1.77 +	#define LOG_EVENT_MSG( a )					RDebug::Printf( a )
    1.78 +	#define LOG_EVENT_MSG2( a, b )				RDebug::Printf( a, b )
    1.79 +	#define LOG_EVENT_MSG3( a, b, c )			RDebug::Printf( a, b, c )
    1.80 +	#define LOG_EVENT_MSG4( a, b, c, d )		RDebug::Printf( a, b, c, d )
    1.81 +	#define LOG_EVENT_MSG5( a, b, c, d, e )		RDebug::Printf( a, b, c, d, e )
    1.82 +
    1.83 +	#else
    1.84 +
    1.85 +	#define LOG_EVENT_MSG( a )
    1.86 +	#define LOG_EVENT_MSG2( a, b )
    1.87 +	#define LOG_EVENT_MSG3( a, b, c )
    1.88 +	#define LOG_EVENT_MSG4( a, b, c, d )
    1.89 +	#define LOG_EVENT_MSG5( a, b, c, d, e )
    1.90 +
    1.91 +    #endif
    1.92 +
    1.93 +    #endif
    1.94 +#else
    1.95 +
    1.96 +	#define LOG_MSG( a )
    1.97 +	#define LOG_MSG2( a, b )
    1.98 +	#define LOG_MSG3( a, b, c )
    1.99 +	#define LOG_MSG4( a, b, c, d )
   1.100 +	#define LOG_MSG5( a, b, c, d, e )
   1.101 +
   1.102 +	#define LOG_EVENT_MSG( a )
   1.103 +	#define LOG_EVENT_MSG2( a, b )
   1.104 +	#define LOG_EVENT_MSG3( a, b, c )
   1.105 +	#define LOG_EVENT_MSG4( a, b, c, d )
   1.106 +	#define LOG_EVENT_MSG5( a, b, c, d, e )
   1.107 +
   1.108 +#endif
   1.109 +
   1.110 +#endif //DEBUG_LOGGING_H
   1.111 +