kerneltest/e32test/system/d_mstim.cpp
branchRCL_3
changeset 87 2f92ad2dc5db
parent 33 0173bcd7697c
child 256 c1f20ce4abcf
equal deleted inserted replaced
81:e7d2d738d3c2 87:2f92ad2dc5db
    39 #endif
    39 #endif
    40 #elif defined(__RVEMUBOARD__)
    40 #elif defined(__RVEMUBOARD__)
    41 #include <rvemuboard.h>
    41 #include <rvemuboard.h>
    42 #elif defined(__NE1_TB__)
    42 #elif defined(__NE1_TB__)
    43 #include <upd35001_timer.h>
    43 #include <upd35001_timer.h>
       
    44 #elif defined(__MRAP__)
       
    45 #include <rap.h>
    44 #endif
    46 #endif
    45 #include "d_mstim.h"
    47 #include "d_mstim.h"
    46 #include "../misc/prbs.h"
    48 #include "../misc/prbs.h"
    47 
    49 
    48 #if defined(__WINS__)
    50 #if defined(__WINS__)
    91 #endif
    93 #endif
    92 #ifdef __NE1_TB__
    94 #ifdef __NE1_TB__
    93 inline TCounter TIMER()
    95 inline TCounter TIMER()
    94 	{ return NETimer::Timer(2).iTimerCount; }
    96 	{ return NETimer::Timer(2).iTimerCount; }
    95 #endif
    97 #endif
       
    98 #ifdef __MRAP__
       
    99 inline TCounter TIMER()
       
   100 	{ TRap::SetRegister32(1, KRapRegRTC001_TRIGGER);
       
   101 	return  TRap::Register32(KRapRegRTC001_LONGCOUNT); }
       
   102 #endif
    96 #if defined(__EPOC32__) && defined(__CPU_X86)
   103 #if defined(__EPOC32__) && defined(__CPU_X86)
    97 TCounter TIMER();
   104 TCounter TIMER();
    98 void SetUpTimerChannel2();
   105 void SetUpTimerChannel2();
    99 #endif
   106 #endif
   100 
   107 
   134 	}
   141 	}
   135 #endif
   142 #endif
   136 #ifdef __NE1_TB__
   143 #ifdef __NE1_TB__
   137 inline TDelta TimeDelta(TCounter initial, TCounter final)
   144 inline TDelta TimeDelta(TCounter initial, TCounter final)
   138 	{ return final - initial; }
   145 	{ return final - initial; }
       
   146 #endif
       
   147 #if defined(__MRAP__)
       
   148 inline TDelta TimeDelta(TCounter initial, TCounter final)
       
   149 	{ return final-initial; }				// RAP RTC timer counts up
   139 #endif
   150 #endif
   140 #ifdef __WINS__
   151 #ifdef __WINS__
   141 inline TDelta TimeDelta(TCounter initial, TCounter final)
   152 inline TDelta TimeDelta(TCounter initial, TCounter final)
   142 	{ return final-initial; }		// counts up
   153 	{ return final-initial; }		// counts up
   143 #endif
   154 #endif
   194 	TInt64 x = I64LIT(1000000);
   205 	TInt64 x = I64LIT(1000000);
   195 	x *= TInt64(aTicks);
   206 	x *= TInt64(aTicks);
   196 	x += TInt64(f>>1);
   207 	x += TInt64(f>>1);
   197 	x /= TInt64(f);
   208 	x /= TInt64(f);
   198 	return (TInt)x;
   209 	return (TInt)x;
       
   210 #endif
       
   211 #if defined(__MRAP__)
       
   212     // RTC runs with 32.768 kHz -> one tick is 
       
   213     const TUint KRTCClockHz = 32768;
       
   214     Int64 ticks(aTicks);
       
   215     ticks*=(1000000);
       
   216 	ticks+=KRTCClockHz/2;		// 32.768 kHz tick
       
   217 	ticks/=KRTCClockHz;
       
   218 	return (TInt)ticks;
   199 #endif
   219 #endif
   200 #if defined(__EPOC32__) && defined(__CPU_X86)
   220 #if defined(__EPOC32__) && defined(__CPU_X86)
   201 	TInt x = aTicks;
   221 	TInt x = aTicks;
   202 	TInt y = x;
   222 	TInt y = x;
   203 	y -= ((3*x)>>4);	// * 0.D
   223 	y -= ((3*x)>>4);	// * 0.D