kerneltest/e32test/system/d_mstim.cpp
branchRCL_3
changeset 87 2f92ad2dc5db
parent 33 0173bcd7697c
child 256 c1f20ce4abcf
--- a/kerneltest/e32test/system/d_mstim.cpp	Mon Mar 15 12:45:50 2010 +0200
+++ b/kerneltest/e32test/system/d_mstim.cpp	Wed Mar 31 23:38:45 2010 +0300
@@ -41,6 +41,8 @@
 #include <rvemuboard.h>
 #elif defined(__NE1_TB__)
 #include <upd35001_timer.h>
+#elif defined(__MRAP__)
+#include <rap.h>
 #endif
 #include "d_mstim.h"
 #include "../misc/prbs.h"
@@ -93,6 +95,11 @@
 inline TCounter TIMER()
 	{ return NETimer::Timer(2).iTimerCount; }
 #endif
+#ifdef __MRAP__
+inline TCounter TIMER()
+	{ TRap::SetRegister32(1, KRapRegRTC001_TRIGGER);
+	return  TRap::Register32(KRapRegRTC001_LONGCOUNT); }
+#endif
 #if defined(__EPOC32__) && defined(__CPU_X86)
 TCounter TIMER();
 void SetUpTimerChannel2();
@@ -137,6 +144,10 @@
 inline TDelta TimeDelta(TCounter initial, TCounter final)
 	{ return final - initial; }
 #endif
+#if defined(__MRAP__)
+inline TDelta TimeDelta(TCounter initial, TCounter final)
+	{ return final-initial; }				// RAP RTC timer counts up
+#endif
 #ifdef __WINS__
 inline TDelta TimeDelta(TCounter initial, TCounter final)
 	{ return final-initial; }		// counts up
@@ -197,6 +208,15 @@
 	x /= TInt64(f);
 	return (TInt)x;
 #endif
+#if defined(__MRAP__)
+    // RTC runs with 32.768 kHz -> one tick is 
+    const TUint KRTCClockHz = 32768;
+    Int64 ticks(aTicks);
+    ticks*=(1000000);
+	ticks+=KRTCClockHz/2;		// 32.768 kHz tick
+	ticks/=KRTCClockHz;
+	return (TInt)ticks;
+#endif
 #if defined(__EPOC32__) && defined(__CPU_X86)
 	TInt x = aTicks;
 	TInt y = x;