os/kernelhwsrv/kernel/eka/drivers/hcr/hcr_debug.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Hardware Configuration Repository Platform Independent Layer (PIL)
    15 // Contains debugging macros used in PIL and PSL source code of HCR.
    16 //
    17 
    18 #ifndef HCR_DEBUG_H
    19 #define HCR_DEBUG_H
    20 
    21 #include <e32err.h>
    22 #include <e32const.h>
    23 #include <e32def.h>
    24 #include <e32cmn.h>
    25 #include <e32des8.h>
    26 #include <kernel/kernel.h>
    27 
    28 //
    29 // MACROs for log statements in code
    30 //
    31 
    32 #ifdef _DEBUG
    33 
    34 #define HCR_LOG0(_text)				__KTRACE_OPT(KHCR, Kern::Printf("=== "_text))
    35 #define HCR_LOG1(_text, _a1)		__KTRACE_OPT(KHCR, Kern::Printf("... "_text, (_a1)))
    36 
    37 #else
    38 
    39 #define HCR_LOG0(_text)				
    40 #define HCR_LOG1(_text, _a1)		
    41 
    42 #endif
    43 
    44 
    45 //
    46 // MACROs for trace statements in code
    47 //
    48 
    49 #ifdef HCR_TRACE
    50 
    51 #define HCR_TRACE0(_text)								Kern::Printf((_text))
    52 #define HCR_TRACE1(_text, _a1)							Kern::Printf((_text), (_a1))
    53 #define HCR_TRACE2(_text, _a1, _a2)						Kern::Printf((_text), (_a1), (_a2))
    54 #define HCR_TRACE3(_text, _a1, _a2, _a3)				Kern::Printf((_text), (_a1), (_a2), (_a3))
    55 #define HCR_TRACE4(_text, _a1, _a2, _a3, _a4)			Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))
    56 #define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)		Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))
    57 #define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))
    58 #define HCR_TRACE_RETURN(_r1)	 						return (Kern::Printf("!-- Function exit return(%d) (%s:%d)", (_r1), __FILE__, __LINE__), _r1)
    59 #define HCR_TRACEMSG_RETURN(_s1, _r1)	 				return (Kern::Printf("!-- "_s1" (%d)", (_r1)), _r1)
    60 #define HCR_FUNC(_text)     							TEntryExit _entryexit(_text)
    61 
    62 #define HCR_HEX_DUMP_ABS(_address, _length)	HexDump((_address), (_length));			//Hex dump with absolute address
    63 #define HCR_HEX_DUMP_REL(_address, _length)	HexDump((_address), (_length), EFalse); //Hex dump with relative (from) address
    64 
    65 class TEntryExit
    66 {
    67 public:
    68     inline TEntryExit(const char *aFn);
    69     inline ~TEntryExit();
    70 
    71 public:
    72     const char* iName;
    73 };
    74 
    75 TEntryExit::TEntryExit(const char* aFn)
    76  : iName(aFn)
    77     {
    78     HCR_TRACE1("--> %s " , iName);
    79     };
    80 
    81 TEntryExit::~TEntryExit()
    82     {
    83     HCR_TRACE1("<-- %s " , iName);
    84     };
    85     
    86 
    87 void HexDump(TUint8* aStartAddress, TUint32 aLength, TBool aAbsolute = ETrue);
    88 
    89 
    90 #else
    91  
    92 #define HCR_TRACE0(_text)                               __KTRACE_OPT(KHCR, Kern::Printf((_text)))
    93 #define HCR_TRACE1(_text, _a1)                          __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1)))
    94 #define HCR_TRACE2(_text, _a1, _a2)                     __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2)))
    95 #define HCR_TRACE3(_text, _a1, _a2, _a3)                __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3)))
    96 #define HCR_TRACE4(_text, _a1, _a2, _a3, _a4)           __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4)))
    97 #define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)      __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5)))
    98 #define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6)))
    99 #define HCR_TRACE_RETURN(_r1)                           { __KTRACE_OPT(KHCR, Kern::Printf("!-- Function exit return(%d) (%s:%d)", (_r1), __FILE__, __LINE__)); return (_r1);}
   100 #define HCR_TRACEMSG_RETURN(_s1, _r1)                   { __KTRACE_OPT(KHCR, Kern::Printf("!-- "_s1" (%d)", (_r1))); return (_r1);}
   101 #define HCR_FUNC(_text)
   102 
   103 #define HCR_HEX_DUMP_ABS(_address, _length)
   104 #define HCR_HEX_DUMP_REL(_address, _length)
   105 
   106 #endif
   107 
   108 
   109 #endif // HCR_DEBUG_H
   110