This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Clocks on EDB7XXX


Ok, the RTC on this platform is 1Hz.  If I use cyg_clock_create () will
it always work with the resolution I pass to it?  I want to be able to
get a clock based on ms rather than seconds.  Also is there a way of
getting the uptime of the system in ms?

What I actually need is a way of getting an accurate time in ms.  I was
thinking of doing the following.

On startup do the following
Store the current clock tick value in an initial clock tick variable.
Ultimately I would like this to be in ms and not necessarily clock
ticks.
Store the RTC value in an initial RTC variable

Calculating RTC seconds + ms of time. 
Since the RTC is in seconds, I have to make sure the tick variable
before is synchronized with the RTC so 0 ms is at the right time (same
time as an RTC increment).

RTC - RTC variable = seconds since startup

Get tick count
ms = (tick count - tick variable) - seconds since startup * 1000

ms would then be the correct number of milliseconds after the last RTC
increment occurred.

Is there an easier way of doing this in eCos?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]