[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RTEMS: Counting time, again... (help)
- Date: Fri, 26 Mar 2004 07:58:26 -0500 (EST)
- From: gregory.menke at gsfc.nasa.gov (gregory.menke at gsfc.nasa.gov)
- Subject: RTEMS: Counting time, again... (help)
> I know that will be some users that will say to me that this doubt
> is already explain in the mailling list, but before sent this mail
> I search in the mailling list and I saw nothings...
> Weel, I need to measure time in microseconds (or nanoseconds, this
> will be great). Using the posix calls the maximum resolution I get
> is 20 milliseconds. That doesnt feet my needs... :-(
> So, I thinking to use an osciloscope or some device like that to
> measure those times. Another idea is to access the hardware ticks.
> Which is the best way to measure those times? External counter
> device or access hardware ticker?
> Is there any free source code to access the hardware ticks?
> Thanks in advance...
> BSP: i686
Look at the datasheets for your processor. Most in in the PowerPC and
Pentium/Athlon range will have some sort of wide counter you can get
at. The PowerPC 603 and above (at least) have a 64 bit counter
register that runs up near the cpu clock. Presumably your processor
will have something like that- maybe divided down a bit from the
system clock, but you'll get at least 1us resolution. To get at
registers like this, its straightforward to set up a routine that does
the requisite inline assembly to get the register values into
variables you can do something with.
If you have some output pins you can toggle from software, you can
certainly put a scope on them to measure things, but its not a very
efficient approach if you want to measure some number of different