|
1 // Copyright (c) 2010-2010 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\power\d_frqchg.h |
|
15 // |
|
16 // |
|
17 |
|
18 #if !defined(__D_FRQCHG_H__) |
|
19 #define __D_FRQCHG_H__ |
|
20 |
|
21 #include <e32cmn.h> |
|
22 |
|
23 struct SRatio; |
|
24 struct SRatioInv; |
|
25 |
|
26 #ifndef __KERNEL_MODE__ |
|
27 #include <e32std.h> |
|
28 |
|
29 struct SRatio |
|
30 { |
|
31 TUint32 iM; // mantissa, normalised so bit 31=1 |
|
32 TInt16 iX; // -exponent. |
|
33 TUint8 iSpare1; |
|
34 TUint8 iSpare2; |
|
35 }; |
|
36 |
|
37 struct SRatioInv |
|
38 { |
|
39 SRatio iR; |
|
40 SRatio iI; |
|
41 }; |
|
42 #endif |
|
43 |
|
44 _LIT(KLddName,"D_FRQCHG.LDD"); |
|
45 |
|
46 class RFrqChg : public RBusLogicalChannel |
|
47 { |
|
48 public: |
|
49 enum TControl |
|
50 { |
|
51 EControl_RatioSet, |
|
52 EControl_RatioReciprocal, |
|
53 EControl_RatioMult, |
|
54 EControl_RatioInvSet, |
|
55 EControl_FrqChgTestPresent, |
|
56 EControl_SetCurrentThreadPriority, |
|
57 EControl_SetCurrentThreadCpu, |
|
58 EControl_SetCurrentThreadTimeslice, |
|
59 EControl_SetLocalTimerPrescaler, |
|
60 EControl_ReadGlobalTimerAndTimestamp, |
|
61 EControl_SetGlobalTimerPrescaler, |
|
62 ENumControls |
|
63 }; |
|
64 |
|
65 public: |
|
66 inline TInt Open(); |
|
67 inline TInt RatioSet(SRatio& aRatio, TUint32 aInt, TInt aDivisorExp=0); |
|
68 inline TInt RatioReciprocal(SRatio& aRatio); |
|
69 inline TInt RatioMult(SRatio& aRatio, TUint32& aInt32); |
|
70 inline TInt RatioInvSet(SRatioInv& aRI, const SRatio* aR); |
|
71 inline TInt FrqChgTestPresent(); |
|
72 inline TInt SetCurrentThreadPriority(TInt aPri); |
|
73 inline TInt SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity = NULL); |
|
74 inline TInt SetCurrentThreadTimeslice(TInt aSlice); |
|
75 inline TInt SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale); |
|
76 inline TInt ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp); |
|
77 inline TInt SetGlobalTimerPrescaler(TInt aPrescale); |
|
78 }; |
|
79 |
|
80 #ifndef __KERNEL_MODE__ |
|
81 inline TInt RFrqChg::Open() |
|
82 { return DoCreate(KLddName,TVersion(0,1,1),KNullUnit,NULL,NULL); } |
|
83 inline TInt RFrqChg::RatioSet(SRatio& aR, TUint32 aInt, TInt aDivisorExp) |
|
84 { aR.iM=aInt; return DoControl(EControl_RatioSet, (TAny*)&aR, (TAny*)aDivisorExp); } |
|
85 inline TInt RFrqChg::RatioReciprocal(SRatio& aR) |
|
86 { return DoControl(EControl_RatioReciprocal, (TAny*)&aR); } |
|
87 inline TInt RFrqChg::RatioMult(SRatio& aR, TUint32& aInt32) |
|
88 { return DoControl(EControl_RatioMult, (TAny*)&aR, (TAny*)&aInt32); } |
|
89 inline TInt RFrqChg::RatioInvSet(SRatioInv& aRI, const SRatio* aR) |
|
90 { return DoControl(EControl_RatioInvSet, (TAny*)&aRI, (TAny*)aR); } |
|
91 inline TInt RFrqChg::FrqChgTestPresent() |
|
92 { return DoControl(EControl_FrqChgTestPresent); } |
|
93 inline TInt RFrqChg::SetCurrentThreadPriority(TInt aPri) |
|
94 { return DoControl(EControl_SetCurrentThreadPriority, (TAny*)aPri); } |
|
95 inline TInt RFrqChg::SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity) |
|
96 { return DoControl(EControl_SetCurrentThreadCpu, (TAny*)aCpu, (TAny*) aOldAffinity); } |
|
97 inline TInt RFrqChg::SetCurrentThreadTimeslice(TInt aSlice) |
|
98 { return DoControl(EControl_SetCurrentThreadTimeslice, (TAny*)aSlice); } |
|
99 inline TInt RFrqChg::SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale) |
|
100 { return DoControl(EControl_SetLocalTimerPrescaler, (TAny*)aCpus, (TAny*)aPrescale); } |
|
101 inline TInt RFrqChg::ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp) |
|
102 { return DoControl(EControl_ReadGlobalTimerAndTimestamp, (TAny*)&aTimerValue, (TAny*) &aTimestamp); } |
|
103 inline TInt RFrqChg::SetGlobalTimerPrescaler(TInt aPrescale) |
|
104 { return DoControl(EControl_SetGlobalTimerPrescaler, (TAny*)aPrescale); } |
|
105 #endif |
|
106 |
|
107 #endif //__D_FRQCHG_H__ |