Does anyone know where the ClockCyckles() function fetches its return value
on a SH4 platform? Why is this function not concidered interrupt handler
safe (see doc)? Is it possible to get this value in a “safe way” in ISR
(what I need are timestamps)?
Thanks
Martin
Martin Nylund <mnylund@emtrion.de> wrote:
Does anyone know where the ClockCyckles() function fetches its return value
on a SH4 platform?
Take a look at /usr/include/sh/neutrino.h which implements it.
Why is this function not concidered interrupt handler
safe (see doc)? Is it possible to get this value in a “safe way” in ISR
(what I need are timestamps)?
I think it should be safe, actually.
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
David Gibbs <dagibbs@qnx.com> wrote in message
news:brvujo$4no$2@nntp.qnx.com…
Martin Nylund <> mnylund@emtrion.de> > wrote:
Does anyone know where the ClockCyckles() function fetches its return
value
on a SH4 platform?
Take a look at /usr/include/sh/neutrino.h which implements it.
Why is this function not concidered interrupt handler
safe (see doc)? Is it possible to get this value in a “safe way” in ISR
(what I need are timestamps)?
I think it should be safe, actually.
It’s marked unsafe, since some processors don’t provide a real running
counter which can easily be fetched. If emulation is required, you wouldn’t
want to take a trap inside an interrupt handler or run emulation code in an
interrupt code path. Take a look at the header, and if your processor
supports the fetch of the counter, it should be safe to call in an ISR
handler.
-Adam
“Adam Mallory” <amallory@qnx.com> schrieb im Newsbeitrag
news:bs0m8q$sci$1@nntp.qnx.com…
David Gibbs <> dagibbs@qnx.com> > wrote in message
news:brvujo$4no$> 2@nntp.qnx.com> …
Martin Nylund <> mnylund@emtrion.de> > wrote:
Does anyone know where the ClockCyckles() function fetches its return
value
on a SH4 platform?
Take a look at /usr/include/sh/neutrino.h which implements it.
Why is this function not concidered interrupt handler
safe (see doc)? Is it possible to get this value in a “safe way” in
ISR
(what I need are timestamps)?
I think it should be safe, actually.
It’s marked unsafe, since some processors don’t provide a real running
counter which can easily be fetched. If emulation is required, you
wouldn’t
want to take a trap inside an interrupt handler or run emulation code in
an
interrupt code path. Take a look at the header, and if your processor
supports the fetch of the counter, it should be safe to call in an ISR
handler.
-Adam
The value seems to come direct from the 32bit counter TCNT1 in TMU. Thanks
for your help.
-Martin
Adam Mallory <amallory@qnx.com> wrote:
David Gibbs <> dagibbs@qnx.com> > wrote in message
news:brvujo$4no$> 2@nntp.qnx.com> …
Martin Nylund <> mnylund@emtrion.de> > wrote:
Does anyone know where the ClockCyckles() function fetches its return
value
on a SH4 platform?
Take a look at /usr/include/sh/neutrino.h which implements it.
Why is this function not concidered interrupt handler
safe (see doc)? Is it possible to get this value in a “safe way” in ISR
(what I need are timestamps)?
I think it should be safe, actually.
It’s marked unsafe, since some processors don’t provide a real running
counter which can easily be fetched. If emulation is required, you wouldn’t
want to take a trap inside an interrupt handler or run emulation code in an
interrupt code path. Take a look at the header, and if your processor
supports the fetch of the counter, it should be safe to call in an ISR
handler.
Hm…perhaps the docs should include a note as to when it is/isn’t
safe to use in an interrupt handler, or some idea on how to figure
it out?
(Though, I thought that the instrumented kernel used the same
mechanism for time-stamping events, so it had to be safe to use
in-kernel for all processors, now?)
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
David Gibbs <dagibbs@qnx.com> wrote in message
news:btc2e1$1ei$3@nntp.qnx.com…
Hm…perhaps the docs should include a note as to when it is/isn’t
safe to use in an interrupt handler, or some idea on how to figure
it out?
Yes, I would say that it should be at least mentioned.
(Though, I thought that the instrumented kernel used the same
mechanism for time-stamping events, so it had to be safe to use
in-kernel for all processors, now?)
Yes, I should be a little more clear. It should be safe, but it could be
unwise to take a trap or do emulation (or both in case the emulation is
implemented via a trap) during ISR time.
-Adam