I would like to have access to a high resolution clock in order to do some throughput tests on existing code. I have a mv2604 board and am already using auxClk and timestamp.
I don't need (nor want) to be fiddling with interrupts, etc. I just want a clock running at a high rate (at least 10KHz, preferrably 1MHz) from which I can read a count. When its counter rolls over,
it should just restart, not generate an interrupt.
I looked at using the Z8536 that is on the board, but it looks like its counters are all in use (sysClk, auxClk, and timestamp). I'm guessing there are other chips available on the board that have unused
counters but I don't know this for a fact.
Has anyone else addressed a similar need? How did you solve this?
Ron Wagner
VxWorks Tornado
#define HR_GET(_hrtick) \
__asm__("mftb %0" : "=r" (_hrtick) :); /* move from timebase */
An example of usage would be as follows:
unsigned int hrt1,hrt2;
HR_GET(hrt1);
/* do something... */
HR_GET(hrt2);
--Bruce Wilson
>Submitted-by vxwexplo-errs Tue Oct 12 10:53:12 1999
>Submitted-by: r...@DynRes.com
>**********
Bruce A. Wilson
U.C. Lawrence Livermore National Lab
P.O. Box 808 (L-451)
Livermore, CA 94550
voice: (925) 422-4145
fax: (925) 423-9889
> Hello VxWorks 'rs,
>
> I would like to have access to a high resolution clock in order to do some throughput tests on existing code. I have a mv2604 board and am already using auxClk and timestamp.
>
> I don't need (nor want) to be fiddling with interrupts, etc. I just want a clock running at a high rate (at least 10KHz, preferrably 1MHz) from which I can read a count. When its counter rolls over,
> it should just restart, not generate an interrupt.
>
> I looked at using the Z8536 that is on the board, but it looks like its counters are all in use (sysClk, auxClk, and timestamp). I'm guessing there are other chips available on the board that have unused
> counters but I don't know this for a fact.
>
> Has anyone else addressed a similar need? How did you solve this?
I haven't tried this but the PPC has a timebase register that has
a resolution of 1/4 the clock, I believe. For a 200MHz CPU this means
20nsec. The following might be something to try. It does get
through "gcc -S", though I haven't actually tried to run it.
long long
gettime()
{
int r0, r1, r2;
union { long long ll; unsigned int i[2]; } v;
do {
asm volatile("mftbl r0; mov r0,%0": "=g" (r0));
asm volatile("mftbu r1; mov r1,%0": "=g" (r1));
asm volatile("mftbl r2; mov r2,%0": "=g" (r2));
} while (r0 != r2);
v.i[0] = r0;
v.i[1] = r1;
return v.ll;
}
Matt
--
Matthew.R.Wette at jpl.nasa.gov -- I speak for myself, not for JPL.
vxTimeBaseGet()
I've used the timebase registers for various timing tasks, it
works fine.
Be sure to check the tech specs for the processor on the timebase
rate. On the MPC860 the rate is either OSCCLK/4, OSCCLK/16,
or GCLK2/16 depending on the PLL multiplier and SCCR[TBS].
In article <7koge3e...@jpl.nasa.gov>,
Matt Wette <Matthew...@jpl.nasa.gov> wrote:
> I haven't tried this but the PPC has a timebase register that has
> a resolution of 1/4 the clock, I believe. For a 200MHz CPU this means
> 20nsec. The following might be something to try. It does get
> through "gcc -S", though I haven't actually tried to run it.
>
> long long
> gettime()
> {
<snip>
> }
--
Regards,
Pete Kockritz
The views expressed are my own and not necessarily that of my employer's
Sent via Deja.com http://www.deja.com/
Before you buy.
I use this all the time and it works great. I put a simple wrapper
around it to make it even more convenient, which I posted on Sept 9:
http://x36.deja.com/getdoc.xp?AN=525969052&CONTEXT=939840550.225050788&hitnum=0
Curt McDowell
Broadcom Corp.
vxTimeBaseGet - Solved all my problems.
Where would I find documentation on this and other possibly useful routine
that don't appear in the vx PRM?
Thanks
Jas
I am using my timers within the onboard Z8536 circuit the way that you
want to.
I am using a MVME2603 board, which would have the same hardware and an
almost identical BSP as you have. I am running Tornado 1.0.1 so far, will
switch to T2 during this year.
In my BSP the timers in Z8536 is NOT used for the timestamp, only Timer 2
is used to run the Aux clock. The system clock and also the timestamp
clock is taken directly from the decrement counter of the PowerPC.
We are running the Timer 1 of the Z8536 as a interrupt generator to
acheive an interrupt signal to trigger an internal task to run every 2
ms. We also use the Timer 3 as a freerunning clock to measure time based
on the 2.5 MHz clock available to the Z8536.
Unfortunately I do not remeber where to check if the BSP is using the
Timer 1 and 3 of the Z8536 in your case but I have checked 2 years ago
and it works for me. With the current configuration I have used WindView
which in turns uses the timestamp driver without any problem.
I hope that this can direct you to some solution.
Best regars
Lars Antbaeck
Pullmax
Sweden
a...@pullmax.se
Hello VxWorks 'rs,
I would like to have access to a high resolution clock in order to do
some
throughput tests on existing code. I have a mv2604 board and am already
using
auxClk and timestamp.
I don't need (nor want) to be fiddling with interrupts, etc. I just want
a
clock running at a high rate (at least 10KHz, preferrably 1MHz) from
which I
can read a count. When its counter rolls over,
it should just restart, not generate an interrupt.
I looked at using the Z8536 that is on the board, but it looks like its
counters are all in use (sysClk, auxClk, and timestamp). I'm guessing
there
are other chips available on the board that have unused
counters but I don't know this for a fact.
Has anyone else addressed a similar need? How did you solve this?
Ron Wagner
VxWorks Tornado