kerneltest/e32test/system/d_mstim.cpp
changeset 133 2a0ada0a1bf8
parent 90 947f0dc9f7a8
--- a/kerneltest/e32test/system/d_mstim.cpp	Mon May 10 11:40:53 2010 +0100
+++ b/kerneltest/e32test/system/d_mstim.cpp	Wed May 12 10:34:10 2010 +0100
@@ -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(5).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;