|
1 // Copyright (c) 2005-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 // e32test\debug\d_codemodifier.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __D_CODEMODIFIER_H__ |
|
19 #define __D_CODEMODIFIER_H__ |
|
20 |
|
21 #include <e32cmn.h> |
|
22 #ifndef __KERNEL_MODE__ |
|
23 #include <e32std.h> |
|
24 #endif |
|
25 |
|
26 _LIT(KCodeModifierName,"d_codemodifier"); |
|
27 |
|
28 /** |
|
29 The user side class for controlling trace handler hook. |
|
30 */ |
|
31 class RCodeModifierDevice : public RBusLogicalChannel |
|
32 { |
|
33 public: |
|
34 enum TControl |
|
35 { |
|
36 EControlThreadId, |
|
37 |
|
38 EInitialiseCodeModifier, |
|
39 ECloseCodeModifier, |
|
40 |
|
41 EControlWriteCode, |
|
42 EControlRestoreCode, |
|
43 |
|
44 EControlReadWord, |
|
45 EControlWriteWord, |
|
46 |
|
47 EControlAllocShadowPage, |
|
48 EControlFreeShadowPage |
|
49 }; |
|
50 |
|
51 //Used by all device calls |
|
52 struct TData |
|
53 { |
|
54 TData(){}; |
|
55 TData(TInt aServer, TInt aThreadId, TUint aAddress, TInt aSize): |
|
56 iServer(aServer),iThreadId(aThreadId),iAddress(aAddress),iSize(aSize){}; |
|
57 |
|
58 TInt iServer; //0-XIP server, otherwise - NONXIP server |
|
59 TInt iThreadId; //threadID |
|
60 TUint iAddress; |
|
61 TInt iSize; |
|
62 }; |
|
63 public: |
|
64 #ifndef __KERNEL_MODE__ |
|
65 TInt Open() |
|
66 {return DoCreate(KCodeModifierName,TVersion(1,0,0),KNullUnit,NULL,NULL);} |
|
67 |
|
68 TInt InitialiseCodeModifier(TInt aSize) |
|
69 {TData data(0,0,0,aSize);return DoControl(EInitialiseCodeModifier, reinterpret_cast<TAny*>(&data));} |
|
70 TInt CloseCodeModifier() |
|
71 {TData data(0,0,0,0);return DoControl(ECloseCodeModifier, reinterpret_cast<TAny*>(&data));} |
|
72 |
|
73 TInt ThreadId(TInt aServer, TInt aThreadId) |
|
74 {TData data(aServer,aThreadId,0,0); return DoControl(EControlThreadId, reinterpret_cast<TAny*>(&data));} |
|
75 |
|
76 TInt ReadWord(TInt aServer, TInt aAddress, TInt* aValue) |
|
77 {TData data(aServer,0,aAddress,0); return DoControl(EControlReadWord, reinterpret_cast<TAny*>(&data), reinterpret_cast<TAny*>(aValue));} |
|
78 TInt WriteWord(TInt aServer, TInt aAddress, TInt aValue) |
|
79 {TData data(aServer,0,aAddress,0); return DoControl(EControlWriteWord, reinterpret_cast<TAny*>(&data), reinterpret_cast<TAny*>(aValue));} |
|
80 |
|
81 TInt WriteCode(TInt aServer, TUint aAddress, TInt aValue, TInt aSize) |
|
82 {TData data(aServer,0,aAddress,aSize);return DoControl(EControlWriteCode, reinterpret_cast<TAny*>(&data), reinterpret_cast<TAny*>(aValue));} |
|
83 TInt RestoreCode(TInt aServer, TUint aAddress) |
|
84 {TData data(aServer,0,aAddress,0); return DoControl(EControlRestoreCode, reinterpret_cast<TAny*>(&data));} |
|
85 |
|
86 |
|
87 TInt AllocShadowPage(TInt aAddress) |
|
88 {TData data(0,0,aAddress,0);return DoControl(EControlAllocShadowPage, reinterpret_cast<TAny*>(&data));} |
|
89 TInt FreeShadowPage(TInt aAddress) |
|
90 {TData data(0,0,aAddress,0);return DoControl(EControlFreeShadowPage, reinterpret_cast<TAny*>(&data));} |
|
91 |
|
92 #endif //__KERNEL_MODE__ |
|
93 }; |
|
94 |
|
95 #endif //__D_LOGTOFILE_H__ |