os/kernelhwsrv/kerneltest/e32test/smr/d_trace.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
// Bootstrap Shadow Memory Region Tests
sl@0
    15
//
sl@0
    16
sl@0
    17
#ifndef SMR_DEBUG_H
sl@0
    18
#define SMR_DEBUG_H
sl@0
    19
sl@0
    20
#include <e32err.h>
sl@0
    21
#include <e32const.h>
sl@0
    22
#include <e32def.h>
sl@0
    23
#include <e32cmn.h>
sl@0
    24
#include <e32des8.h>
sl@0
    25
#include <kernel/kernel.h>
sl@0
    26
sl@0
    27
sl@0
    28
// Make sure release builds get a warning if 
sl@0
    29
//#ifndef _DEBUG
sl@0
    30
//#if (defined SMR_TRACE)
sl@0
    31
//#warning "Use of Kern::PrintF tracing in a release build, check MMP files"
sl@0
    32
//#endif
sl@0
    33
//#endif
sl@0
    34
sl@0
    35
// Panic category string for SMR component
sl@0
    36
_LIT(KSMRPanicCategory, "T_SMR");
sl@0
    37
sl@0
    38
sl@0
    39
//
sl@0
    40
// MACROs for trace statements in client/server code.
sl@0
    41
//
sl@0
    42
sl@0
    43
#ifdef SMR_TRACE
sl@0
    44
sl@0
    45
#define SMR_LOG0(_text)		Kern::Printf((_text))
sl@0
    46
#define SMR_LOG1(_text, _a1)	Kern::Printf((_text), (_a1))
sl@0
    47
#define SMR_LOG_RETURN(_r1)	{ Kern::Printf("!-- Function exit : %d", (_r1)); \
sl@0
    48
                                return (_r1); } 
sl@0
    49
#define SMR_LOGMSG_RETURN(_s1, _r1)	{ Kern::Printf("!-- "_s1" (%d)", (_r1)); \
sl@0
    50
                                return (_r1); } 
sl@0
    51
sl@0
    52
#define SMR_TRACE0(_text)	Kern::Printf((_text))
sl@0
    53
#define SMR_TRACE1(_text, _a1)	Kern::Printf((_text), (_a1))
sl@0
    54
#define SMR_TRACE2(_text, _a1, _a2)	Kern::Printf((_text), (_a1), (_a2))
sl@0
    55
#define SMR_TRACE3(_text, _a1, _a2, _a3)	Kern::Printf((_text), (_a1), (_a2), (_a3))
sl@0
    56
#define SMR_TRACE4(_text, _a1, _a2, _a3, _a4)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))
sl@0
    57
#define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))
sl@0
    58
#define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))
sl@0
    59
sl@0
    60
#define SMR_FUNC(_text)     TEntryExit _entryexit(_text)
sl@0
    61
#define SMR_FUNCE(_text)	 Kern::Printf("--> "##_text)
sl@0
    62
#define SMR_FUNCR(_text)	 Kern::Printf("<-- "##_text) 
sl@0
    63
#define SMR_FUNCR_return(_text, _r1)	 { Kern::Printf("<-- "##_text##"\n"); \
sl@0
    64
                                            return (_r1); }
sl@0
    65
sl@0
    66
#else
sl@0
    67
sl@0
    68
#define SMR_LOG0(_text)		Kern::Printf(_L(_text))
sl@0
    69
#define SMR_LOG1(_text, _a1)	Kern::Printf(_L(_text), (_a1))
sl@0
    70
#define SMR_LOG_RETURN(_r1)	    { return (_r1); } 
sl@0
    71
#define SMR_LOGMSG_RETURN(_s1, _r1)	{ return (_r1); } 
sl@0
    72
sl@0
    73
sl@0
    74
#define SMR_TRACE0(_text)			
sl@0
    75
#define SMR_TRACE1(_text, _a1)		
sl@0
    76
#define SMR_TRACE2(_text, _a1, _a2)
sl@0
    77
#define SMR_TRACE3(_text, _a1, _a2, _a3)	
sl@0
    78
#define SMR_TRACE4(_text, _a1, _a2, _a3, _a4)
sl@0
    79
#define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)
sl@0
    80
#define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)
sl@0
    81
sl@0
    82
#define SMR_FUNC(_text)   
sl@0
    83
#define SMR_FUNCE(_text)	 
sl@0
    84
#define SMR_FUNCR(_text)
sl@0
    85
#define SMR_FUNCR_return(_text, _r1)	 { return (_r1); }
sl@0
    86
sl@0
    87
#endif
sl@0
    88
sl@0
    89
sl@0
    90
class TEntryExit
sl@0
    91
{
sl@0
    92
public:
sl@0
    93
    inline TEntryExit(const char *aFn);
sl@0
    94
    inline ~TEntryExit();
sl@0
    95
sl@0
    96
public:
sl@0
    97
    const char* iName;
sl@0
    98
};
sl@0
    99
sl@0
   100
TEntryExit::TEntryExit(const char* aFn)
sl@0
   101
 : iName(aFn)
sl@0
   102
    {
sl@0
   103
    SMR_TRACE1("--> %s " , iName);
sl@0
   104
    };
sl@0
   105
sl@0
   106
TEntryExit::~TEntryExit()
sl@0
   107
    {
sl@0
   108
    SMR_TRACE1("<-- %s " , iName);
sl@0
   109
    };
sl@0
   110
    
sl@0
   111
sl@0
   112
#endif // SMR_DEBUG_H
sl@0
   113