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