Lazarus

Programming => Operating Systems => Linux => Topic started by: chrnobel on February 27, 2014, 02:30:29 pm

Title: EpicTimer ARM
Post by: chrnobel on February 27, 2014, 02:30:29 pm
Hi.

Does anyone know whether EpicTimer works on ARM processors, particularly Allwinner A10/20?

Or is there a replacement?

Thanks
Christian
Title: Re: EpicTimer ARM
Post by: Graeme on February 27, 2014, 02:42:09 pm
I can test tonight [at work now] on my RPi if you want.
Title: Re: EpicTimer ARM
Post by: engkin on February 27, 2014, 03:06:43 pm
I Assume you are asking about this (http://wiki.freepascal.org/EpikTimer). If so:
Quote
This component was designed for cross-platform applications...

But:
Quote
    Nanosecond resolution is supported on Intel Pentium versions with a Timestamp Counter.
    Microsecond system clock is the default timebase.
Title: Re: EpicTimer ARM
Post by: chrnobel on February 27, 2014, 03:40:40 pm
I can test tonight [at work now] on my RPi if you want.
No need Graeme, I just tried it my self on RPi, and it works.

But thank you anyway.

Christian
Title: Re: EpicTimer ARM
Post by: BigChimp on February 27, 2014, 03:43:50 pm
@ChrNobel: you might want to update the tested platforms list at
http://wiki.lazarus.freepascal.org/EpikTimer#Dependencies_.2F_System_Requirements
Title: Re: EpicTimer ARM
Post by: chrnobel on February 27, 2014, 03:43:59 pm
I Assume you are asking about this (http://wiki.freepascal.org/EpikTimer). If so:
Quote
This component was designed for cross-platform applications...
I have read the Wiki, but when it states cross-platform, it is to be understood OS.

It does not specify whether it works on other processor architectures than Intel or AMD (meaning x86), but from trying on the RPi it actually also works on ARM.
Title: Re: EpicTimer ARM
Post by: BigChimp on February 27, 2014, 03:46:43 pm
Quote
I have read the Wiki, but when it states cross-platform, it is to be understood OS.
Well, that's your opinion ;)

I understand platform as the combination of hardware and OS. Even middleware etc depending on context.
Title: Re: EpicTimer ARM
Post by: chrnobel on February 27, 2014, 03:47:04 pm
@ChrNobel: you might want to update the tested platforms list at
http://wiki.lazarus.freepascal.org/EpikTimer#Dependencies_.2F_System_Requirements
Yes, but will wait until I have done some further test to be assured that there are no hick-ups, just did at quick test with EpikTimers Test Application.

Also I will make some tests with Allwinner.
Title: Re: EpicTimer ARM
Post by: BigChimp on February 27, 2014, 03:47:52 pm
Great, thanks!
Title: Re: EpicTimer ARM
Post by: chrnobel on February 27, 2014, 03:51:05 pm
Quote
I have read the Wiki, but when it states cross-platform, it is to be understood OS.
Well, that's your opinion ;)

I understand platform as the combination of hardware and OS. Even middleware etc depending on context.
That might be a matter of words, but as there seems to be differences in the way that two relatively similar architectures (Intel and AMD x86) behaves with regards to read clockticks, I would be very precarious to use the phrase crossplatform without testing. 
Title: Re: EpicTimer ARM
Post by: BigChimp on February 27, 2014, 03:56:50 pm
I would be very precarious to use the phrase crossplatform without testing.
Of course.
Title: Re: EpicTimer ARM
Post by: engkin on February 27, 2014, 04:57:20 pm
I have read the Wiki, but when it states cross-platform, it is to be understood OS.

It does not specify whether it works on other processor architectures than Intel or AMD (meaning x86), but from trying on the RPi it actually also works on ARM.
Let me quote the source code:

Quote
// These are here for architectures that don't have a precision hardware
// timing source. They'll return zeros for overhead values. The timers
// will work but there won't be any error compensation for long
// term accuracy.
{$ELSE} // add other architectures and hardware specific tick sources here
function HasHardwareCapabilityData: Boolean; begin Result:=False end;
function HasHardwareTickCounter: Boolean; begin Result:=false end;
function HardwareTicks:TickType; begin result:=0 end;
{$ENDIF}

The source code uses fpgettimeofday and fpnanosleep which I believe should work on ARM.

And finally:
Quote
// Return microsecond normalized time source for a given platform.
// This should be sync'able to an external time standard (via NTP, for example).
function SystemTicks: TickType;
{$IFDEF Windows}
...
{$ELSE}
var t : timeval;
begin
  fpgettimeofday(@t,nil);
   // Build a 64 bit microsecond tick from the seconds and microsecond longints
  Result := (TickType(t.tv_sec) * 1000000) + t.tv_usec;
{$ENDIF}
end;
TinyPortal © 2005-2018