Armin Steinhoff <A-Steinhoff@web_.de> wrote:
David Gibbs wrote:
Armin Steinhoff <A-Steinhoff@web_.de> wrote:
Hi all,
we have mapped a few hw registers of a PPC device using the NOCACHE
option. When the ISR sets a bit to 1 in such a mapped register and
triggers then an interrupt event for the interrupt thread … we
have to do an active wait in the interrupt thread until we see the
expected status of that bit!
What are the reasons for such an impossible behavior ??
Writing to a mapped register can’t take 20-30us …
Is the ‘sync pipeline’ instruction included in the QNX ISR ??
Is there a bug in mmap … ignoring the NOCACHE option??
If you take a quick look at the /usr/nto/include/sys/ppc/inout.h,
you will see that the in*/out* family of functions always seem to
issue an eieio() when accessing the memory mapped registers. You
might need to do so as well.
Thanks, it’s now working with the correct timing behavior >
The remaining problem is that there are no hints in the
documentation how mapped hardware registers (or IO addresses) must
be handled if you deal with a PPC.
I had thought that the in8/in16/in32 functions, combined with
mmap_device_io() was intended for access hardware registers – ones
that would be mmap()ed on a PPC or ioports on an x86.
I’m sure nobody would get the idea to use inp/outp calls for reading
and writing to memory mapped device registers. It’s also not very
intuitive to submit a “eieio” instruction after reading an IO
address … like
status = *INTMASK,
eieio();
I think that may be an oddity of the PPC. If you came from a PPC
background – the “special” oddities of the x86 memory map would
probably be non-intuitive as well. Should we document them as an
OS company? I don’t know – we do try to provide a generic abstraction
for accessing control registers on all the platforms – the in*/out*
family of functions.
The docs of the inp/outp calls refering only hw/inout.h … no hints
for the PPC and the PPC specific IO calls included in
/usr/include/ppc.
True, and if you look at hw/inout.h it does:
#if defined(X86)
#ifndef _X86_INOUT_INCLUDED
#include <x86/inout.h>
#endif
#elif defined(PPC)
#ifndef _PPC_INOUT_INCLUDED
#include <ppc/inout.h>
#endif
#elif defined(MIPS)
#ifndef _MIPS_INOUT_INCLUDED
#include <mips/inout.h>
#endif
(And, actually has no definition or prototype for any of the in*()
functions.)
That is, it pretty clearly grabs a specific to what you are compiling
against header file for those inline macros. In the docs we document
the platform independent abstraction that you include & call.
-David
QNX Training Services
dagibbs@qnx.com