|
1 // Copyright (c) 2007-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 "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 // |
|
15 |
|
16 #ifndef __D_SHAREDCHUNK_H__ |
|
17 #define __D_SHAREDCHUNK_H__ |
|
18 |
|
19 #include <e32cmn.h> |
|
20 #ifndef __KERNEL_MODE__ |
|
21 #include <e32std.h> |
|
22 #endif |
|
23 |
|
24 _LIT(KSharedChunkLddName,"D_SHAREDCHUNK"); |
|
25 |
|
26 enum TCreateFlags |
|
27 { |
|
28 ESingle = 0x00, |
|
29 EMultiple = 0x01, |
|
30 EOwnsMemory = 0x02, |
|
31 EBadType = 0x80, |
|
32 ECreateFlagsMask = 0xff |
|
33 }; |
|
34 |
|
35 enum TCacheAttribute |
|
36 { |
|
37 /** CPU cached */ |
|
38 ECached = 0, |
|
39 /** Non CPU cached */ |
|
40 ENotCached = 1 |
|
41 }; |
|
42 |
|
43 enum TCommitType |
|
44 { |
|
45 ENonContiguous = 0x00, |
|
46 EContiguous = 0x01, |
|
47 ECommitTypeMask = 0x0f |
|
48 }; |
|
49 |
|
50 class RSharedChunkLdd : public RBusLogicalChannel |
|
51 { |
|
52 public: |
|
53 enum TControl |
|
54 { |
|
55 ECreateChunk, |
|
56 EGetChunkHandle, |
|
57 ECommitMemory, |
|
58 ECloseChunk, |
|
59 ECacheAttribute, |
|
60 EContiguousAttribute, |
|
61 ECloseChunkHandle |
|
62 }; |
|
63 |
|
64 |
|
65 #ifndef __KERNEL_MODE__ |
|
66 public: |
|
67 inline TInt Open() |
|
68 { return DoCreate(KSharedChunkLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue); } |
|
69 inline TInt CreateChunk(TInt aSize, TAny** aKernelAddress=0) |
|
70 { return DoControl(ECreateChunk,(TAny*)aSize,aKernelAddress); } |
|
71 inline TInt GetChunkHandle(RChunk& aChunk) |
|
72 { return aChunk.SetReturnedHandle(DoControl(EGetChunkHandle)); } |
|
73 inline TInt CommitMemory(TInt aOffset, TInt aSize) |
|
74 { return DoControl(ECommitMemory,(TAny*)aOffset,(TAny*)aSize); } |
|
75 inline TInt CloseChunk() |
|
76 { return DoControl(ECloseChunk); } |
|
77 inline TInt GetCacheAttribute() |
|
78 {return DoControl(ECacheAttribute);} |
|
79 inline TBool GetContiguousAttribute() |
|
80 {return DoControl(EContiguousAttribute);} |
|
81 inline TInt CloseChunkHandle(RChunk aChunk) |
|
82 { return DoControl(ECloseChunkHandle,(TAny*)aChunk.Handle()); } |
|
83 #endif |
|
84 }; |
|
85 |
|
86 |
|
87 #endif |