1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/realtime/d_latncy.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,137 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\realtime\d_latncy.h
1.18 +//
1.19 +//
1.20 +
1.21 +#if !defined(__D_LATNCY_H__)
1.22 +#define __D_LATNCY_H__
1.23 +#include <e32cmn.h>
1.24 +#ifndef __KERNEL_MODE__
1.25 +#include <e32std.h>
1.26 +#endif
1.27 +
1.28 +#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
1.29 +#include <shared_timer.h>
1.30 +#endif
1.31 +
1.32 +#if !defined(__EPOC32__) || !defined(__CPU_X86)
1.33 +#if !defined(__SMP__)
1.34 +#define __CAPTURE_EXTRAS
1.35 +#endif
1.36 +#endif
1.37 +
1.38 +_LIT(KLatencyLddName,"Latency");
1.39 +
1.40 +class TCapsLatencyV01
1.41 + {
1.42 +public:
1.43 + TVersion iVersion;
1.44 + };
1.45 +
1.46 +struct SLatencyResults
1.47 + {
1.48 + TUint iIntRetAddr;
1.49 + TUint iIntTicks;
1.50 + TUint iKernThreadTicks;
1.51 + TUint iUserThreadTicks;
1.52 + TUint iIntSpsr;
1.53 + TUint iIntR14;
1.54 + };
1.55 +
1.56 +class RLatency : public RBusLogicalChannel
1.57 + {
1.58 +public:
1.59 + enum TControl
1.60 + {
1.61 + EControlStart,
1.62 + EControlTicksPerMs,
1.63 + EControlGetResults,
1.64 + };
1.65 +public:
1.66 + inline TInt Open();
1.67 + inline void Start();
1.68 + inline TUint TicksPerMs();
1.69 + inline TInt GetResults(SLatencyResults& aResults);
1.70 + };
1.71 +
1.72 +#ifndef __KERNEL_MODE__
1.73 +inline TInt RLatency::Open()
1.74 + { return DoCreate(KLatencyLddName,TVersion(1,0,1),KNullUnit,NULL,NULL); }
1.75 +
1.76 +inline void RLatency::Start()
1.77 + { DoControl(EControlStart); }
1.78 +
1.79 +inline TUint RLatency::TicksPerMs()
1.80 + { return (TUint)DoControl(EControlTicksPerMs); }
1.81 +
1.82 +inline TInt RLatency::GetResults(SLatencyResults& aResults)
1.83 + { return DoControl(EControlGetResults,&aResults); }
1.84 +#endif
1.85 +
1.86 +#ifdef __KERNEL_MODE__
1.87 +class DLatencyPowerHandler;
1.88 +class DLatency : public DLogicalChannelBase
1.89 + {
1.90 +public:
1.91 + DLatency();
1.92 + ~DLatency();
1.93 +protected:
1.94 + virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
1.95 + virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
1.96 +public:
1.97 + TInt StartTimer();
1.98 + void StopTimer();
1.99 + static void MsCallBack(TAny*);
1.100 + static void MsDfc(TAny*);
1.101 +#if defined( __MISA__) || defined(__MCOT__) || defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
1.102 + inline TUint Ticks();
1.103 +#elif defined(__EPOC32__) && defined(__CPU_X86)
1.104 + static TUint Ticks();
1.105 +#else
1.106 + inline static TUint Ticks();
1.107 +#endif
1.108 +
1.109 +#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
1.110 +private:
1.111 + void DisableTimer();
1.112 + TInt ConfigureTimer();
1.113 +#endif
1.114 +public:
1.115 + NTimer iMsCallBack;
1.116 + TDynamicDfcQue* iRtDfcQ;
1.117 + TDfc iMsDfc;
1.118 + SLatencyResults iResults;
1.119 +#if !defined(__SMP__)
1.120 + TUint* iIntStackTop;
1.121 +#endif
1.122 + DThread* iClient;
1.123 + DLatencyPowerHandler* iPowerHandler;
1.124 + TUint8 iOff;
1.125 + TUint8 iStarted;
1.126 + TUint8 iPad2;
1.127 + TUint8 iPad3;
1.128 +#if defined( __MISA__) || defined(__MCOT__)
1.129 + TUint iTickIncrement;
1.130 + TUint iTriggerTime;
1.131 +#endif
1.132 +#if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__)
1.133 + TUint8 iGPTimerId;
1.134 + SOmapTimerInfo iTimerInfo;
1.135 + TUint iTimerLoadValue;
1.136 +#endif
1.137 + };
1.138 +#endif
1.139 +
1.140 +#endif