OpenPIC timer usage?
nick.withers at anu.edu.au
Wed Aug 13 06:42:24 UTC 2014
On Tue, 2014-08-12 at 12:48 +1000, Nick Withers wrote:
> Hullo all,
> Has anyone used an OpenPIC timer (see
> "c/src/lib/libbsp/powerpc/shared/openpic/") in single-shot mode before?
> I seem to be having some trouble with them, in particular ensuring that
> an ISR fires only once.
> According to "c/src/lib/libbsp/powerpc/mvme3100/README", "The setup
> routine allows for specifying single-shot or periodic mode", but I can't
> seem to see how to achieve the former.
> Going off
> "c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/nested_irq_test.c" I
> should at least openpic_maptimer(..., 0) and openpic_inittimer(..., ...,
> 0) to stop the timer. I've tried that in the ISR and the
> openpic_inittimer() call can stall indefinitely in
> openpic_safe_writefield() on "while (openpic_read(addr=0xe1041120) &
Turns out the "OpenPIC" on at least the MVME3100 is actually an IBM
MPIC, which has documentation! Huzzah!
So, to follow up, neigher openpic_inittimer() and openpic_maptimer()
need to be called to halt the timer and prevent further interrupts (but
need to be done to set the timer up before first use).
An openpic_settimer(..., OPENPIC_TIMER_COUNT_INHIBIT, 0) will do it.
Also note that for the hardware to latch a new time programmed through
openpic_settimer(), the OPENPIC_TIMER_COUNT_INHIBIT bit has to
transition from a 1 to a 0.
> Any ideas? Perhaps I'm going about this the wrong way to begin with...
> What I'm after is a microsecond-precision-ish one-shot timer that'll be
> used thousands of times per second.
> Ta all!
Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)
More information about the users