|
1 // Copyright (c) 2007-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 "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 // |
|
15 |
|
16 #ifndef TAVSRCTIMER_H |
|
17 #define TAVSRCTIMER_H |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 class CAdaptiveHighResPeriodic; |
|
22 |
|
23 class MAdaptiveHighResPeriodicClient |
|
24 { |
|
25 public: |
|
26 virtual void TimerEvent(CAdaptiveHighResPeriodic& aTimer)=0; |
|
27 virtual void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError)=0; |
|
28 }; |
|
29 |
|
30 //adapts the callback to counter drift |
|
31 class CAdaptiveHighResPeriodic : public CTimer |
|
32 { |
|
33 public: |
|
34 static CAdaptiveHighResPeriodic* NewL(MAdaptiveHighResPeriodicClient& aClient); |
|
35 ~CAdaptiveHighResPeriodic(); |
|
36 void Start(TTimeIntervalMicroSeconds32 aPeriod); |
|
37 |
|
38 void SetInterval(TTimeIntervalMicroSeconds32 aInterval); |
|
39 |
|
40 private: |
|
41 CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient); |
|
42 void ConstructL(); |
|
43 void RunL(); |
|
44 TInt RunError(TInt aError); |
|
45 void StartTimer(TTimeIntervalMicroSeconds32 aInterval); |
|
46 |
|
47 private: |
|
48 MAdaptiveHighResPeriodicClient& iClient; |
|
49 |
|
50 // HAL stuff |
|
51 TBool iFastCounterIncreases; |
|
52 TInt iFastCounterFreq; |
|
53 TReal iFastCounterFreqUs; |
|
54 TReal iExtraCounts; |
|
55 |
|
56 // what the client asked for in musecs |
|
57 TTimeIntervalMicroSeconds32 iInterval; |
|
58 |
|
59 TUint iIntendedCountOnCallback ; // the hoped for fast counter reading on callback |
|
60 }; |
|
61 |
|
62 #endif // TAVSRCTIMER_H |