author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Sat, 20 Feb 2010 00:10:51 +0200 | |
branch | RCL_3 |
changeset 62 | 4a8fed1c0ef6 |
parent 15 | 4122176ea935 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-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 |
// f32\sfat32\inc\sl_cache.inl |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
/** |
|
19 |
@file |
|
20 |
@internalTechnology |
|
21 |
*/ |
|
22 |
||
15
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
23 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
24 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
25 |
//!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
26 |
//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
27 |
//!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
28 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
29 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
30 |
|
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
31 |
|
0 | 32 |
#ifndef SL_CACHE_INL |
33 |
#define SL_CACHE_INL |
|
34 |
||
35 |
||
36 |
/** |
|
37 |
@param aPos media linear position |
|
38 |
@return ETrue if the aPos belongs to this page |
|
39 |
*/ |
|
40 |
TBool CWTCachePage::PosCached(TInt64 aPos) const |
|
41 |
{ |
|
42 |
return (iValid && aPos >= iStartPos && aPos < iStartPos+PageSize()); |
|
43 |
} |
|
44 |
||
45 |
||
46 |
/** |
|
47 |
Calculate data position within cache page relatively to the page beginning. |
|
48 |
@param aPos media linear position |
|
49 |
@return data offset from the beginning of the page |
|
50 |
*/ |
|
51 |
TUint32 CWTCachePage::PosInCachePage(TInt64 aPos) const |
|
52 |
{ |
|
53 |
return ((TUint32)aPos - (TUint32)iStartPos) & (PageSize()-1); |
|
54 |
} |
|
55 |
||
56 |
/** |
|
57 |
Obtain pointer to the data in the cache page by media inear position |
|
58 |
@param aPos media linear position |
|
59 |
@return pointer to the data in page buffer |
|
60 |
*/ |
|
61 |
TUint8* CWTCachePage::PtrInCachePage(TInt64 aPos) const |
|
62 |
{ |
|
63 |
return (TUint8*)iData.Ptr() + PosInCachePage(aPos); |
|
64 |
} |
|
65 |
||
66 |
/** |
|
67 |
@return cache page size in bytes |
|
68 |
*/ |
|
69 |
TUint32 CWTCachePage::PageSize() const |
|
70 |
{ |
|
71 |
return iData.Size(); |
|
72 |
} |
|
73 |
||
74 |
//--------------------------------------------------------------------------------------------------------------------------------- |
|
75 |
||
76 |
||
77 |
/** |
|
78 |
Just helper method to calculate cache page start position by given media pos. |
|
79 |
@param aPos media linear position |
|
80 |
@return rounded-down and aligned position that is the beginning of the cache page |
|
81 |
*/ |
|
82 |
TInt64 CMediaWTCache::CalcPageStartPos(TInt64 aPos) const |
|
83 |
{ |
|
84 |
ASSERT(aPos >= iCacheBasePos); |
|
85 |
return (((aPos - iCacheBasePos) >> iPageSizeLog2) << iPageSizeLog2) + iCacheBasePos; |
|
86 |
} |
|
87 |
||
88 |
/** |
|
89 |
@return cache page size |
|
90 |
*/ |
|
91 |
TUint32 CMediaWTCache::PageSize() const |
|
92 |
{ |
|
93 |
return 1<<iPageSizeLog2; |
|
94 |
} |
|
95 |
||
96 |
||
97 |
/** |
|
98 |
Set cache base position at aBasePos |
|
99 |
@param aBasePos base position of the cache pages. Affects pages alignment. |
|
100 |
*/ |
|
101 |
void CMediaWTCache::SetCacheBasePos(TInt64 aBasePos) |
|
102 |
{ |
|
103 |
iCacheBasePos = aBasePos; |
|
104 |
} |
|
105 |
||
106 |
||
107 |
||
108 |
//--------------------------------------------------------------------------------------------------------------------------------- |
|
109 |
||
110 |
||
111 |
#endif //SL_CACHE_INL |
|
112 |
||
113 |
||
114 |
||
115 |