Exemplo n.º 1
0
    EXPORT_C int symbian_get_cpu_time(long* sec, long* usec)
    {
        // The RThread().GetCpuTime() does not seem to work?
        // (it always returns KErrNotSupported)
        // TTimeIntervalMicroSeconds ti;
        // TInt err = me.GetCpuTime(ti);
        dTHX;
        TInt periodus; /* tick period in microseconds */
        if (HAL::Get(HALData::ESystemTickPeriod, periodus) != KErrNone)
            return -1;
        TUint  tick   = User::TickCount();
        if (PL_timesbase.tms_utime == 0) {
            PL_timesbase.tms_utime = tick;
            PL_clocktick = PERL_SYMBIAN_CLK_TCK;
        }
        tick -= PL_timesbase.tms_utime;
        TInt64 tickus = TInt64(tick) * TInt64(periodus);
        TInt64 tmps   = tickus / 1000000;
#ifdef __SERIES60_3X__
        if (sec)  *sec  = I64LOW(tmps);
        if (usec) *usec = I64LOW(tickus) - I64LOW(tmps) * 1000000;
#else
        if (sec)  *sec  = tmps.Low();
        if (usec) *usec = tickus.Low() - tmps.Low() * 1000000;
#endif //__SERIES60_3X__
        return 0;
    }
Exemplo n.º 2
0
void DMediaDriverTest::DoFormat(TInt64 &aPos,TInt aLength)
//
// Format the specified area of the media.
//
	{

    Mem::Fill(&iBuf[aPos.Low()],aLength,0xFF);
	iFormatTickLink.OneShotInMicroSeconds(KFormatAsyncTime,DMediaDriverTest::FormatCompleteCallBack,this);
	}
Exemplo n.º 3
0
void CSettingsClient::StoreSettingL(const TDesC& aCategory,const TDesC& aNameHigh,const TDesC& aNameLow,const TInt64& aValue)
{
  TInt old;
  TInt err=iSettings.Get(aCategory,aNameHigh,old);
  if(err!=KErrNotFound) User::LeaveIfError(err);
  if(err==KErrNotFound||(TUint)old!=aValue.High()) User::LeaveIfError(iSettings.Set(aCategory,aNameHigh,aValue.High()));
  err=iSettings.Get(aCategory,aNameLow,old);
  if(err!=KErrNotFound) User::LeaveIfError(err);
  if(err==KErrNotFound||(TUint)old!=aValue.Low()) User::LeaveIfError(iSettings.Set(aCategory,aNameLow,aValue.Low()));
}
Exemplo n.º 4
0
EXPORT_C void TE64Addr::SetAddr(const TInt64& aAddr)
{
#ifdef I64HIGH
	u.iAddr32[0] = I64HIGH(aAddr);
	u.iAddr32[1] = I64LOW(aAddr);
#else
	u.iAddr32[0] = aAddr.High();
	u.iAddr32[1] = aAddr.Low();
#endif
}
Exemplo n.º 5
0
void DMediaDriverTest::DoWrite(TInt64 &aPos,TInt aLength,TMediaDrvDescData &aSrc)
//
// Write to specifed area of media.
//
	{

	if (!aSrc.IsCurrentThread())
        Complete(KMediaDrvWriteReq,KErrGeneral);
	else
        {
		Mem::Copy(&iBuf[aPos.Low()],((TDesC8*)aSrc.iPtr)->Ptr()+aSrc.iOffset,aLength);
	    iWriteTickLink.OneShotInMicroSeconds(KWriteAsyncTime,DMediaDriverTest::WriteCompleteCallBack,this);
        }
	}
Exemplo n.º 6
0
CVMInt64
CVMtimeMillis(void)
{
    TTime now;
    now.HomeTime();
    TInt64 t = now.Int64();
    TInt64 millis = (t - SYMBIANjavaEpoc) / 1000;
#ifdef EKA2
    return (CVMInt64)millis;
#else
    CVMInt64 delta = millis.Low();
    delta += (CVMInt64)millis.High() << 32;
    return delta;
#endif
}
Exemplo n.º 7
0
void DMediaDriverTest::DoRead(TInt64 &aPos,TInt aLength,TMediaDrvDescData &aTrg)
//
// Read from specified area of media.
//
	{

	TInt ret=KErrNone;
	if (!aTrg.IsCurrentThread())
		ret=KErrGeneral;
	else
		{
		if ((ret=aTrg.CurrentThreadDescCheck(aLength))==KErrNone)
            {
			TDes8 &t=*((TDes8*)aTrg.iPtr);
			Mem::Copy((TAny*)(t.Ptr()+aTrg.iOffset),&iBuf[aPos.Low()],aLength);
			t.SetLength(aLength+aTrg.iOffset);
			}
		}
    Complete(KMediaDrvReadReq,ret);
	}