Parallel port access

Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the QNX
docs there is a wave.c example, i get loads of errors in the header files
when trying to compile it. Any help would be great.

_uintptr Port;

int main()
{
uint8 t = 0x53;
uint8 b;
ThreadCtl(_NTO_TCTL_IO, 0);
Port = mmap_device_io(1, 0x378);
out8(Port, t);

b = in8(Port);

printf("%s\n", b);
return 0;
}

On Sun, 15 Jul 2001 01:23:36 +0100, “Caz” <turok2@currantbun.com>
wrote:

The -T1 is required for QNX4. Print short trace messages to
stderr (unbuffered) before each instruction and verify return codes
and the errno value. You will get SIGSEGV from out8() if ThreadCtl()
fails to acquire the privities. You will probably get the same if “%s”
in printf() is not a typo (should be %c/d/x).

Do you compile wave.c with -l asound? What is your version of
QRTP? For the moment I could only verify it compiles under 6.0.

ako

Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the QNX
docs there is a wave.c example, i get loads of errors in the header files
when trying to compile it. Any help would be great.

_uintptr Port;

int main()
{
uint8 t = 0x53;
uint8 b;
ThreadCtl(_NTO_TCTL_IO, 0);
Port = mmap_device_io(1, 0x378);
out8(Port, t);

b = in8(Port);

printf("%s\n", b);
return 0;
}

Hi,

Thanks for the reply, i ran the app with gdb, and it’s ThreadCtl
which is giving me a SIGSEGV, can someone post an example or test my code to
see if it works for them, as to the wave.c file i was having problems
compiling, i rebooted and afterwards the wave.c file compiled, something
must have happened to gcc, strange but their you go.

Caz

“Andrzej Kocon” <ako@box43.gnet.pl> wrote in message
news:3b516231.50907@inn.qnx.com

On Sun, 15 Jul 2001 01:23:36 +0100, “Caz” <> turok2@currantbun.com
wrote:

The -T1 is required for QNX4. Print short trace messages to
stderr (unbuffered) before each instruction and verify return codes
and the errno value. You will get SIGSEGV from out8() if ThreadCtl()
fails to acquire the privities. You will probably get the same if “%s”
in printf() is not a typo (should be %c/d/x).

Do you compile wave.c with -l asound? What is your version of
QRTP? For the moment I could only verify it compiles under 6.0.

ako

Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to
compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the QNX
docs there is a wave.c example, i get loads of errors in the header files
when trying to compile it. Any help would be great.

_uintptr Port;

int main()
{
uint8 t = 0x53;
uint8 b;
ThreadCtl(_NTO_TCTL_IO, 0);
Port = mmap_device_io(1, 0x378);
out8(Port, t);

b = in8(Port);

printf("%s\n", b);
return 0;
}

“Caz” <turok2@currantbun.com> wrote in message
news:9iqnho$1p7$1@inn.qnx.com

Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to
compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the QNX
docs there is a wave.c example, i get loads of errors in the header files
when trying to compile it. Any help would be great.

_uintptr Port;

int main()
{
uint8 t = 0x53;
uint8 b;
ThreadCtl(_NTO_TCTL_IO, 0);
Port = mmap_device_io(1, 0x378);
out8(Port, t);

b = in8(Port);

printf("%s\n", b);

The printf will surely crash. %s is a pointer to a string and you are
passing a char!!!

Also mare sure you run it as root.

-T1 does not apply it’s a QNX4 thing, so is wave.c I beleive.

return 0;
}

Thanks for your help, i have things sorted now, you are correct with the
printf statement, it is wrong, the app now runs correctly, i had another
ThreadCtl, lower down in my code and it was that which was causing the
crash.

Caz

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9is8p3$s46$1@inn.qnx.com

“Caz” <> turok2@currantbun.com> > wrote in message
news:9iqnho$1p7$> 1@inn.qnx.com> …
Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of
coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to
compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the
QNX
docs there is a wave.c example, i get loads of errors in the header
files
when trying to compile it. Any help would be great.

_uintptr Port;

int main()
{
uint8 t = 0x53;
uint8 b;
ThreadCtl(_NTO_TCTL_IO, 0);
Port = mmap_device_io(1, 0x378);
out8(Port, t);

b = in8(Port);

printf("%s\n", b);

The printf will surely crash. %s is a pointer to a string and you are
passing a char!!!

Also mare sure you run it as root.

-T1 does not apply it’s a QNX4 thing, so is wave.c I beleive.

return 0;
}
\

On Sun, 15 Jul 2001 01:23:36 +0100, “Caz” <turok2@currantbun.com>
wrote:

One more thing: it is recommended to use gcc via qcc (or cc)
wrappers.

ako

Hi all,

I’ve just been using QNX RTP and thought i’d try a bit of coding,
and i tried this bit of code, everyrtime i run the app, it says Error:
memory core dumped, i’m running the app as root, i saw somewhere to compile
the program with gcc -T1 -o app app.c, the linker says it cannot find a
script or something for the -T1. I have one more question too, in the QNX
docs there is a wave.c example, i get loads of errors in the header files
when trying to compile it. Any help would be great.

(…)