author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 07 Jan 2010 13:38:45 +0200 | |
changeset 6 | 0173bcd7697c |
parent 4 | 56f325a607ea |
child 8 | 538db54a451d |
permissions | -rw-r--r-- |
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 |
// |
|
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
// MACROs for log statements in code. |
0 | 29 |
// |
30 |
||
31 |
#ifdef _DEBUG |
|
32 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
33 |
#define HCR_LOG0(_text) __KTRACE_OPT(KHCR, Kern::Printf("=== "_text)) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
#define HCR_LOG1(_text, _a1) __KTRACE_OPT(KHCR, Kern::Printf("... "_text, (_a1))) |
0 | 35 |
|
36 |
#else |
|
37 |
||
38 |
#define HCR_LOG0(_text) |
|
39 |
#define HCR_LOG1(_text, _a1) |
|
40 |
||
41 |
#endif |
|
42 |
||
43 |
||
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
// |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
// MACROs for trace statements in code. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
// |
0 | 47 |
|
48 |
#ifdef HCR_TRACE |
|
49 |
||
50 |
#define HCR_TRACE0(_text) Kern::Printf((_text)) |
|
51 |
#define HCR_TRACE1(_text, _a1) Kern::Printf((_text), (_a1)) |
|
52 |
#define HCR_TRACE2(_text, _a1, _a2) Kern::Printf((_text), (_a1), (_a2)) |
|
53 |
#define HCR_TRACE3(_text, _a1, _a2, _a3) Kern::Printf((_text), (_a1), (_a2), (_a3)) |
|
54 |
#define HCR_TRACE4(_text, _a1, _a2, _a3, _a4) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4)) |
|
55 |
#define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5)) |
|
56 |
#define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6)) |
|
57 |
#define HCR_TRACE_RETURN(_r1) return (Kern::Printf("!-- Function exit return(%d) (%s:%d)", (_r1), __FILE__, __LINE__), _r1) |
|
58 |
#define HCR_TRACEMSG_RETURN(_s1, _r1) return (Kern::Printf("!-- "_s1" (%d)", (_r1)), _r1) |
|
59 |
#define HCR_FUNC(_text) TEntryExit _entryexit(_text) |
|
60 |
||
61 |
#define HCR_HEX_DUMP_ABS(_address, _length) HexDump((_address), (_length)); //Hex dump with absolute address |
|
62 |
#define HCR_HEX_DUMP_REL(_address, _length) HexDump((_address), (_length), EFalse); //Hex dump with relative (from) address |
|
63 |
||
64 |
||
65 |
#else |
|
4
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
#define HCR_TRACE0(_text) __KTRACE_OPT(KHCR, Kern::Printf((_text))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
#define HCR_TRACE1(_text, _a1) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
#define HCR_TRACE2(_text, _a1, _a2) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
#define HCR_TRACE3(_text, _a1, _a2, _a3) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
#define HCR_TRACE4(_text, _a1, _a2, _a3, _a4) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
#define HCR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
#define HCR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6) __KTRACE_OPT(KHCR, Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
#define HCR_TRACE_RETURN(_r1) { __KTRACE_OPT(KHCR, Kern::Printf("!-- Function exit return(%d) (%s:%d)", (_r1), __FILE__, __LINE__)); return (_r1);} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#define HCR_TRACEMSG_RETURN(_s1, _r1) { __KTRACE_OPT(KHCR, Kern::Printf("!-- "_s1" (%d)", (_r1))); return (_r1);} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
#define HCR_FUNC(_text) |
0 | 77 |
|
78 |
#define HCR_HEX_DUMP_ABS(_address, _length) |
|
79 |
#define HCR_HEX_DUMP_REL(_address, _length) |
|
80 |
||
81 |
#endif |
|
82 |
||
83 |
||
84 |
class TEntryExit |
|
85 |
{ |
|
86 |
public: |
|
87 |
inline TEntryExit(const char *aFn); |
|
88 |
inline ~TEntryExit(); |
|
89 |
||
90 |
public: |
|
91 |
const char* iName; |
|
92 |
}; |
|
93 |
||
94 |
TEntryExit::TEntryExit(const char* aFn) |
|
95 |
: iName(aFn) |
|
96 |
{ |
|
97 |
HCR_TRACE1("--> %s " , iName); |
|
98 |
}; |
|
99 |
||
100 |
TEntryExit::~TEntryExit() |
|
101 |
{ |
|
102 |
HCR_TRACE1("<-- %s " , iName); |
|
103 |
}; |
|
104 |
||
105 |
||
106 |
void HexDump(TUint8* aStartAddress, TUint32 aLength, TBool aAbsolute = ETrue); |
|
107 |
||
108 |
||
109 |
#endif // HCR_DEBUG_H |
|
110 |