sl@0: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\realtime\d_latncy.h sl@0: // sl@0: // sl@0: sl@0: #if !defined(__D_LATNCY_H__) sl@0: #define __D_LATNCY_H__ sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: #if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__) sl@0: #include sl@0: #endif sl@0: sl@0: #if !defined(__EPOC32__) || !defined(__CPU_X86) sl@0: #if !defined(__SMP__) sl@0: #define __CAPTURE_EXTRAS sl@0: #endif sl@0: #endif sl@0: sl@0: _LIT(KLatencyLddName,"Latency"); sl@0: sl@0: class TCapsLatencyV01 sl@0: { sl@0: public: sl@0: TVersion iVersion; sl@0: }; sl@0: sl@0: struct SLatencyResults sl@0: { sl@0: TUint iIntRetAddr; sl@0: TUint iIntTicks; sl@0: TUint iKernThreadTicks; sl@0: TUint iUserThreadTicks; sl@0: TUint iIntSpsr; sl@0: TUint iIntR14; sl@0: }; sl@0: sl@0: class RLatency : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum TControl sl@0: { sl@0: EControlStart, sl@0: EControlTicksPerMs, sl@0: EControlGetResults, sl@0: }; sl@0: public: sl@0: inline TInt Open(); sl@0: inline void Start(); sl@0: inline TUint TicksPerMs(); sl@0: inline TInt GetResults(SLatencyResults& aResults); sl@0: }; sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: inline TInt RLatency::Open() sl@0: { return DoCreate(KLatencyLddName,TVersion(1,0,1),KNullUnit,NULL,NULL); } sl@0: sl@0: inline void RLatency::Start() sl@0: { DoControl(EControlStart); } sl@0: sl@0: inline TUint RLatency::TicksPerMs() sl@0: { return (TUint)DoControl(EControlTicksPerMs); } sl@0: sl@0: inline TInt RLatency::GetResults(SLatencyResults& aResults) sl@0: { return DoControl(EControlGetResults,&aResults); } sl@0: #endif sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: class DLatencyPowerHandler; sl@0: class DLatency : public DLogicalChannelBase sl@0: { sl@0: public: sl@0: DLatency(); sl@0: ~DLatency(); sl@0: protected: sl@0: virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); sl@0: virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2); sl@0: public: sl@0: TInt StartTimer(); sl@0: void StopTimer(); sl@0: static void MsCallBack(TAny*); sl@0: static void MsDfc(TAny*); sl@0: #if defined( __MISA__) || defined(__MCOT__) || defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__) sl@0: inline TUint Ticks(); sl@0: #elif defined(__EPOC32__) && defined(__CPU_X86) sl@0: static TUint Ticks(); sl@0: #else sl@0: inline static TUint Ticks(); sl@0: #endif sl@0: sl@0: #if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__) sl@0: private: sl@0: void DisableTimer(); sl@0: TInt ConfigureTimer(); sl@0: #endif sl@0: public: sl@0: NTimer iMsCallBack; sl@0: TDynamicDfcQue* iRtDfcQ; sl@0: TDfc iMsDfc; sl@0: SLatencyResults iResults; sl@0: #if !defined(__SMP__) sl@0: TUint* iIntStackTop; sl@0: #endif sl@0: DThread* iClient; sl@0: DLatencyPowerHandler* iPowerHandler; sl@0: TUint8 iOff; sl@0: TUint8 iStarted; sl@0: TUint8 iPad2; sl@0: TUint8 iPad3; sl@0: #if defined( __MISA__) || defined(__MCOT__) sl@0: TUint iTickIncrement; sl@0: TUint iTriggerTime; sl@0: #endif sl@0: #if defined(__IS_OMAP2420__) || defined(__WAKEUP_3430__) sl@0: TUint8 iGPTimerId; sl@0: SOmapTimerInfo iTimerInfo; sl@0: TUint iTimerLoadValue; sl@0: #endif sl@0: }; sl@0: #endif sl@0: sl@0: #endif