0
|
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 |
//
|
|
16 |
|
|
17 |
#ifndef HCR_DEBUG_H
|
|
18 |
#define HCR_DEBUG_H
|
|
19 |
|
|
20 |
#include <e32err.h>
|
|
21 |
#include <e32const.h>
|
|
22 |
#include <e32def.h>
|
|
23 |
#include <e32cmn.h>
|
|
24 |
#include <e32des8.h>
|
|
25 |
#include <kernel/kernel.h>
|
|
26 |
|
|
27 |
|
|
28 |
// Make sure release builds get a warning if
|
|
29 |
//#ifndef _DEBUG
|
|
30 |
//#if (defined HCR_TRACE)
|
|
31 |
//#warning "Use of Kern::PrintF tracing in a release build, check MMP files"
|
|
32 |
//#endif
|
|
33 |
//#endif
|
|
34 |
|
|
35 |
|
|
36 |
//
|
|
37 |
// MACROs for trace statements in client/server code.
|
|
38 |
//
|
|
39 |
|
|
40 |
#ifdef _DEBUG
|
|
41 |
|
|
42 |
#define HCR_LOG0(_text) Kern::Printf("=== "_text)
|
|
43 |
#define HCR_LOG1(_text, _a1) Kern::Printf("... "_text, (_a1))
|
|
44 |
#define HCR_LOG_RETURN(_r1) return (Kern::Printf("!-- HCR Function exit, error=%d (%s:%d)", (_r1), __FILE__, __LINE__), _r1)
|
|
45 |
#define HCR_LOGMSG_RETURN(_s1, _r1) return (Kern::Printf("!-- HCR: "_s1" (%d)", (_r1)), _r1)
|
|
46 |
|
|
47 |
#else
|
|
48 |
|
|
49 |
#define HCR_LOG0(_text)
|
|
50 |
#define HCR_LOG1(_text, _a1)
|
|
51 |
#define HCR_LOG_RETURN(_r1) return (_r1)
|
|
52 |
#define HCR_LOGMSG_RETURN(_s1, _r1) return (_r1)
|
|
53 |
|
|
54 |
#endif
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
#ifdef HCR_TRACE
|
|
59 |
|
|
60 |
#define HCR_TRACE0(_text) Kern::Printf((_text))
|
|
61 |
#define HCR_TRACE1(_text, _a1) Kern::Printf((_text), (_a1))
|
|
62 |
#define HCR_TRACE2(_text, _a1, _a2) Kern::Printf((_text), (_a1), (_a2))
|
|
63 |
#define HCR_TRACE3(_text, _a1, _a2, _a3) Kern::Printf((_text), (_a1), (_a2), (_a3))
|
|
64 |
#define HCR_TRACE4(_text, _a1, _a2, _a3, _a4) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))
|
|
65 |
#define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))
|
|
66 |
#define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))
|
|
67 |
#define HCR_TRACE_RETURN(_r1) return (Kern::Printf("!-- Function exit return(%d) (%s:%d)", (_r1), __FILE__, __LINE__), _r1)
|
|
68 |
#define HCR_TRACEMSG_RETURN(_s1, _r1) return (Kern::Printf("!-- "_s1" (%d)", (_r1)), _r1)
|
|
69 |
#define HCR_FUNC(_text) TEntryExit _entryexit(_text)
|
|
70 |
|
|
71 |
#define HCR_HEX_DUMP_ABS(_address, _length) HexDump((_address), (_length)); //Hex dump with absolute address
|
|
72 |
#define HCR_HEX_DUMP_REL(_address, _length) HexDump((_address), (_length), EFalse); //Hex dump with relative (from) address
|
|
73 |
|
|
74 |
|
|
75 |
#else
|
|
76 |
|
|
77 |
#define HCR_TRACE0(_text)
|
|
78 |
#define HCR_TRACE1(_text, _a1)
|
|
79 |
#define HCR_TRACE2(_text, _a1, _a2)
|
|
80 |
#define HCR_TRACE3(_text, _a1, _a2, _a3)
|
|
81 |
#define HCR_TRACE4(_text, _a1, _a2, _a3, _a4)
|
|
82 |
#define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)
|
|
83 |
#define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)
|
|
84 |
#define HCR_TRACE_RETURN(_r1) return (_r1)
|
|
85 |
#define HCR_TRACEMSG_RETURN(_r1) return (_r1)
|
|
86 |
#define HCR_FUNC(_text)
|
|
87 |
#define HCR_HEX_DUMP_ABS(_address, _length)
|
|
88 |
#define HCR_HEX_DUMP_REL(_address, _length)
|
|
89 |
|
|
90 |
#endif
|
|
91 |
|
|
92 |
|
|
93 |
class TEntryExit
|
|
94 |
{
|
|
95 |
public:
|
|
96 |
inline TEntryExit(const char *aFn);
|
|
97 |
inline ~TEntryExit();
|
|
98 |
|
|
99 |
public:
|
|
100 |
const char* iName;
|
|
101 |
};
|
|
102 |
|
|
103 |
TEntryExit::TEntryExit(const char* aFn)
|
|
104 |
: iName(aFn)
|
|
105 |
{
|
|
106 |
HCR_TRACE1("--> %s " , iName);
|
|
107 |
};
|
|
108 |
|
|
109 |
TEntryExit::~TEntryExit()
|
|
110 |
{
|
|
111 |
HCR_TRACE1("<-- %s " , iName);
|
|
112 |
};
|
|
113 |
|
|
114 |
|
|
115 |
void HexDump(TUint8* aStartAddress, TUint32 aLength, TBool aAbsolute = ETrue);
|
|
116 |
|
|
117 |
|
|
118 |
#endif // HCR_DEBUG_H
|
|
119 |
|