sl@0
|
1 |
// Copyright (c) 2007-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 "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 |
// Some common definitions for this component
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef WIN_DRIVE_COMMON_H
|
sl@0
|
23 |
#define WIN_DRIVE_COMMON_H
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <e32debug.h>
|
sl@0
|
26 |
#include <f32fsys.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
//-----------------------------------------------------------------------------
|
sl@0
|
29 |
|
sl@0
|
30 |
//-- define this macro in order to enable debug print.
|
sl@0
|
31 |
#define THIS_EXT_DEBUG_PRINT
|
sl@0
|
32 |
|
sl@0
|
33 |
#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(THIS_EXT_DEBUG_PRINT)
|
sl@0
|
34 |
#define __PRINT(t) {RDebug::Print(t);}
|
sl@0
|
35 |
#define __PRINT1(t,a) {RDebug::Print(t,a);}
|
sl@0
|
36 |
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
|
sl@0
|
37 |
#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
|
sl@0
|
38 |
#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
|
sl@0
|
39 |
#define __PRINTF(t) {RDebug::Printf(t);}
|
sl@0
|
40 |
|
sl@0
|
41 |
#else
|
sl@0
|
42 |
#define __PRINT(t)
|
sl@0
|
43 |
#define __PRINT1(t,a)
|
sl@0
|
44 |
#define __PRINT2(t,a,b)
|
sl@0
|
45 |
#define __PRINT3(t,a,b,c)
|
sl@0
|
46 |
#define __PRINTF(t)
|
sl@0
|
47 |
#define __PRINT4(t,a,b,c,d)
|
sl@0
|
48 |
#define __PRINTF(t)
|
sl@0
|
49 |
#endif
|
sl@0
|
50 |
|
sl@0
|
51 |
//-- this logging is always enabled
|
sl@0
|
52 |
#define __LOG(t) {RDebug::Print(t);}
|
sl@0
|
53 |
#define __LOG1(t,a) {RDebug::Print(t,a);}
|
sl@0
|
54 |
#define __LOG2(t,a,b) {RDebug::Print(t,a,b);}
|
sl@0
|
55 |
#define __LOG3(t,a,b,c) {RDebug::Print(t,a,b,c);}
|
sl@0
|
56 |
#define __LOG4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
|
sl@0
|
57 |
#define __LOGF(t) {RDebug::Printf(t);}
|
sl@0
|
58 |
|
sl@0
|
59 |
|
sl@0
|
60 |
//-----------------------------------------------------------------------------
|
sl@0
|
61 |
/**
|
sl@0
|
62 |
Zero-fill structure.
|
sl@0
|
63 |
@param apStruct pointer to the data structure
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
template<class T>
|
sl@0
|
66 |
inline void ZeroFillStruct(T* apStruct)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
Mem::FillZ(apStruct,sizeof(T));
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
Zero-fill structure.
|
sl@0
|
73 |
@param apStruct a reference to the data structure
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
template<class T>
|
sl@0
|
76 |
inline void ZeroFillStruct(T& aStruct)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
Mem::FillZ(&aStruct,sizeof(T));
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
Zero-fill memory. Just for consistency
|
sl@0
|
83 |
@param apStruct pointer to the memory to be filled with zeroes
|
sl@0
|
84 |
@param aBytes buffer size
|
sl@0
|
85 |
*/
|
sl@0
|
86 |
inline void ZeroFillStruct(void* aStruct, TUint aBytes)
|
sl@0
|
87 |
{
|
sl@0
|
88 |
Mem::FillZ(aStruct,aBytes);
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
//-----------------------------------------------------------------------------
|
sl@0
|
92 |
|
sl@0
|
93 |
inline TBool IsPowerOf2(TUint32 aVal)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
if (aVal==0)
|
sl@0
|
96 |
return EFalse;
|
sl@0
|
97 |
|
sl@0
|
98 |
return !(aVal & (aVal-1));
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
#endif //WIN_DRIVE_COMMON_H
|
sl@0
|
104 |
|
sl@0
|
105 |
|
sl@0
|
106 |
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
|
sl@0
|
110 |
|
sl@0
|
111 |
|
sl@0
|
112 |
|
sl@0
|
113 |
|
sl@0
|
114 |
|
sl@0
|
115 |
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
|
sl@0
|
119 |
|
sl@0
|
120 |
|
sl@0
|
121 |
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
|
sl@0
|
129 |
|
sl@0
|
130 |
|
sl@0
|
131 |
|
sl@0
|
132 |
|
sl@0
|
133 |
|
sl@0
|
134 |
|
sl@0
|
135 |
|
sl@0
|
136 |
|
sl@0
|
137 |
|
sl@0
|
138 |
|
sl@0
|
139 |
|