Well, this propably does the trick?
// Enable IO capability.
if(ThreadCtl(_NTO_TCTL_IO, NULL) == -1) {
fprintf(stderr, “Unable to obtain I/O privity. You
must be userid root.\n”);
exit(EXIT_FAILURE);
}
I suddenly found this from:
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/lib/io-char/ttc.c?rev=1.1.1.1&content-
type=text/x-cvsweb-markup
I’ll try this and tell if it worked.
-Pete
“Pete Tahvanainen” <pete.tahvanainen@basware.com> wrote in message
news:a1ugje$a80$1@inn.qnx.com…
Hi,
Actuallly no (trying to get it to run in single thrad first). I couldn’t
quite understand from the documentation how that is done (and didn’t
issue,
supprisingly code doesn’t work). Could you give an example?
Thanks,
-Pete
“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:a1kcvk$d48$> 3@nntp.qnx.com> …
Pete Tahvanainen <> pete.tahvanainen@basware.com> > wrote:
Hi,
Have you issued a ThreadCtl() call to get io privity?
You need ThreadCtl( _NTO_TCTL_IO, 0 ) in the thread that is going
to issue any in/out calls before making those calls.
-David
I tried to use in8()/out8(), but I got ‘Memory fault’. Then I wrote
the
driver in DOS to see that the hw wasn’t damaged, this was succesful. I
looked the documentation about out() (in dos.h) and noticed that out
writes
low byte to the address specified and high byte to address+1. in8()
and
out8() propably do the same thing?
However the error message I got would suggest that I have mapped the
I/O
adress incorrectly. For mapping I used mmap_device_io(), as specified
in
the
documentation. Since there is no example, I propably have done
something
funny (unfortunatelly the source is at home, so I can not include the
exact
mapping here). COuld you give me an example how to map the parallel
port
correctly?
Cheers,
-Pete
“Operating System Tech Support” <> os@qnx.com> > wrote in message
news:9u5j08$p29$> 1@nntp.qnx.com> …
“Pete Tahvanainen” <> pete.tahvanainen@basware.com> > wrote in message
news:9u4qvc$jps$> 1@inn.qnx.com> …
snip
actual commad to the hardware. The hardware supplier states that,
for
exaple, activating a digital output is done by setting a 8 bit
digit
to
port
address and then triggering it by setting STROBE to port+2.
snip
Perhaps you need to use the in8()/out8() function to put the 8 bit
value
to
an I/O port. The x86 has a separate I/O bus - this could be what
your
issue
is. Documentation for in8() is located at :
http://qdn.qnx.com/support/docs/neutrino_2.11_en/lib_ref/i/in8.html
-Adam
\
QNX Training Services
I do not answer technical questions by email.