|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Central place for nice debug-type macros & functions |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef FMRADIO_DEBUG_H |
|
21 #define FMRADIO_DEBUG_H |
|
22 |
|
23 #ifdef _DEBUG |
|
24 |
|
25 #ifdef __WINS__ |
|
26 #define __CLOGGING__ |
|
27 // File logging for WIS |
|
28 //#define __FLOGGING__ |
|
29 |
|
30 #else |
|
31 |
|
32 // Logging with RDebug for target HW |
|
33 #define __CLOGGING__ |
|
34 //#define __FLOGGING__ |
|
35 |
|
36 #endif //__WINS__ |
|
37 |
|
38 #endif |
|
39 |
|
40 #if defined ( __FLOGGING__ ) |
|
41 |
|
42 _LIT(KLogFile,"FMRadioLog.txt"); |
|
43 _LIT(KLogDir,"FMRadio"); |
|
44 |
|
45 #include <f32file.h> |
|
46 #include <flogger.h> |
|
47 |
|
48 #define FLOG(a) {FPrint(a);} |
|
49 |
|
50 #define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} |
|
51 |
|
52 #define FDEBUGVAR(a) a |
|
53 #define FTRACE(a) {a;} |
|
54 |
|
55 #define FDEBUGVAR(a) a |
|
56 |
|
57 // Declare the FPrint function |
|
58 |
|
59 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
60 { |
|
61 VA_LIST list; |
|
62 VA_START(list,aFmt); |
|
63 RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); |
|
64 |
|
65 } |
|
66 |
|
67 inline void FHex(const TUint8* aPtr, TInt aLen) |
|
68 { |
|
69 RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); |
|
70 } |
|
71 |
|
72 inline void FHex(const TDesC8& aDes) |
|
73 { |
|
74 FHex(aDes.Ptr(), aDes.Length()); |
|
75 } |
|
76 |
|
77 // RDebug logging |
|
78 #elif defined(__CLOGGING__) |
|
79 |
|
80 #include <e32svr.h> |
|
81 |
|
82 #define FLOG(a) {RDebug::Print(a);} |
|
83 |
|
84 #define FLOGHEX(a) |
|
85 |
|
86 #define FDEBUGVAR(a) a |
|
87 #define FTRACE(a) {a;} |
|
88 |
|
89 #define FDEBUGVAR(a) a |
|
90 |
|
91 // Declare the FPrint function |
|
92 |
|
93 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
94 { |
|
95 VA_LIST list; |
|
96 VA_START(list,aFmt); |
|
97 TInt tmpInt = VA_ARG(list, TInt); |
|
98 TInt tmpInt2 = VA_ARG(list, TInt); |
|
99 TInt tmpInt3 = VA_ARG(list, TInt); |
|
100 VA_END(list); |
|
101 RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); |
|
102 } |
|
103 |
|
104 |
|
105 #else // No loggings --> reduced code size |
|
106 #define FLOG(a) |
|
107 #define FLOGHEX(a) |
|
108 #define FDEBUGVAR(a) |
|
109 #define FTRACE(a) |
|
110 #define FDEBUGVAR(a) |
|
111 |
|
112 #endif //_DEBUG |
|
113 |
|
114 #endif // FMRADIO_DEBUG_H |