sl@0
|
1 |
// Copyright (c) 1999-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 the License "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 |
// e32test\realtime\d_latncy.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#if !defined(__D_LATNCY_H__)
|
sl@0
|
19 |
#define __D_LATNCY_H__
|
sl@0
|
20 |
#include <e32cmn.h>
|
sl@0
|
21 |
#ifndef __KERNEL_MODE__
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
#endif
|
sl@0
|
24 |
|
sl@0
|
25 |
#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
|
sl@0
|
26 |
#include <shared_timer.h>
|
sl@0
|
27 |
#endif
|
sl@0
|
28 |
|
sl@0
|
29 |
#if !defined(__EPOC32__) || !defined(__CPU_X86)
|
sl@0
|
30 |
#if !defined(__SMP__)
|
sl@0
|
31 |
#define __CAPTURE_EXTRAS
|
sl@0
|
32 |
#endif
|
sl@0
|
33 |
#endif
|
sl@0
|
34 |
|
sl@0
|
35 |
_LIT(KLatencyLddName,"Latency");
|
sl@0
|
36 |
|
sl@0
|
37 |
class TCapsLatencyV01
|
sl@0
|
38 |
{
|
sl@0
|
39 |
public:
|
sl@0
|
40 |
TVersion iVersion;
|
sl@0
|
41 |
};
|
sl@0
|
42 |
|
sl@0
|
43 |
struct SLatencyResults
|
sl@0
|
44 |
{
|
sl@0
|
45 |
TUint iIntRetAddr;
|
sl@0
|
46 |
TUint iIntTicks;
|
sl@0
|
47 |
TUint iKernThreadTicks;
|
sl@0
|
48 |
TUint iUserThreadTicks;
|
sl@0
|
49 |
TUint iIntSpsr;
|
sl@0
|
50 |
TUint iIntR14;
|
sl@0
|
51 |
};
|
sl@0
|
52 |
|
sl@0
|
53 |
class RLatency : public RBusLogicalChannel
|
sl@0
|
54 |
{
|
sl@0
|
55 |
public:
|
sl@0
|
56 |
enum TControl
|
sl@0
|
57 |
{
|
sl@0
|
58 |
EControlStart,
|
sl@0
|
59 |
EControlTicksPerMs,
|
sl@0
|
60 |
EControlGetResults,
|
sl@0
|
61 |
};
|
sl@0
|
62 |
public:
|
sl@0
|
63 |
inline TInt Open();
|
sl@0
|
64 |
inline void Start();
|
sl@0
|
65 |
inline TUint TicksPerMs();
|
sl@0
|
66 |
inline TInt GetResults(SLatencyResults& aResults);
|
sl@0
|
67 |
};
|
sl@0
|
68 |
|
sl@0
|
69 |
#ifndef __KERNEL_MODE__
|
sl@0
|
70 |
inline TInt RLatency::Open()
|
sl@0
|
71 |
{ return DoCreate(KLatencyLddName,TVersion(1,0,1),KNullUnit,NULL,NULL); }
|
sl@0
|
72 |
|
sl@0
|
73 |
inline void RLatency::Start()
|
sl@0
|
74 |
{ DoControl(EControlStart); }
|
sl@0
|
75 |
|
sl@0
|
76 |
inline TUint RLatency::TicksPerMs()
|
sl@0
|
77 |
{ return (TUint)DoControl(EControlTicksPerMs); }
|
sl@0
|
78 |
|
sl@0
|
79 |
inline TInt RLatency::GetResults(SLatencyResults& aResults)
|
sl@0
|
80 |
{ return DoControl(EControlGetResults,&aResults); }
|
sl@0
|
81 |
#endif
|
sl@0
|
82 |
|
sl@0
|
83 |
#ifdef __KERNEL_MODE__
|
sl@0
|
84 |
class DLatencyPowerHandler;
|
sl@0
|
85 |
class DLatency : public DLogicalChannelBase
|
sl@0
|
86 |
{
|
sl@0
|
87 |
public:
|
sl@0
|
88 |
DLatency();
|
sl@0
|
89 |
~DLatency();
|
sl@0
|
90 |
protected:
|
sl@0
|
91 |
virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
|
sl@0
|
92 |
virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
|
sl@0
|
93 |
public:
|
sl@0
|
94 |
TInt StartTimer();
|
sl@0
|
95 |
void StopTimer();
|
sl@0
|
96 |
static void MsCallBack(TAny*);
|
sl@0
|
97 |
static void MsDfc(TAny*);
|
sl@0
|
98 |
#if defined( __MISA__) || defined(__MCOT__) || defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
|
sl@0
|
99 |
inline TUint Ticks();
|
sl@0
|
100 |
#elif defined(__EPOC32__) && defined(__CPU_X86)
|
sl@0
|
101 |
static TUint Ticks();
|
sl@0
|
102 |
#else
|
sl@0
|
103 |
inline static TUint Ticks();
|
sl@0
|
104 |
#endif
|
sl@0
|
105 |
|
sl@0
|
106 |
#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
|
sl@0
|
107 |
private:
|
sl@0
|
108 |
void DisableTimer();
|
sl@0
|
109 |
TInt ConfigureTimer();
|
sl@0
|
110 |
#endif
|
sl@0
|
111 |
public:
|
sl@0
|
112 |
NTimer iMsCallBack;
|
sl@0
|
113 |
TDynamicDfcQue* iRtDfcQ;
|
sl@0
|
114 |
TDfc iMsDfc;
|
sl@0
|
115 |
SLatencyResults iResults;
|
sl@0
|
116 |
#if !defined(__SMP__)
|
sl@0
|
117 |
TUint* iIntStackTop;
|
sl@0
|
118 |
#endif
|
sl@0
|
119 |
DThread* iClient;
|
sl@0
|
120 |
DLatencyPowerHandler* iPowerHandler;
|
sl@0
|
121 |
TUint8 iOff;
|
sl@0
|
122 |
TUint8 iStarted;
|
sl@0
|
123 |
TUint8 iPad2;
|
sl@0
|
124 |
TUint8 iPad3;
|
sl@0
|
125 |
#if defined( __MISA__) || defined(__MCOT__)
|
sl@0
|
126 |
TUint iTickIncrement;
|
sl@0
|
127 |
TUint iTriggerTime;
|
sl@0
|
128 |
#endif
|
sl@0
|
129 |
#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
|
sl@0
|
130 |
TUint8 iGPTimerId;
|
sl@0
|
131 |
SOmapTimerInfo iTimerInfo;
|
sl@0
|
132 |
TUint iTimerLoadValue;
|
sl@0
|
133 |
#endif
|
sl@0
|
134 |
};
|
sl@0
|
135 |
#endif
|
sl@0
|
136 |
|
sl@0
|
137 |
#endif
|