Finding IRQ for a device

Hey all:

This is probably a bit of a novice question, but here goes. We have a PMC
card device that we have mounted in a Zitech SBC. We have had code running
in QNX 4 to create a memory map and read and write data to it. But now the
time has come to put in ISRs. My question is, how does one tell what IRQ
has been assigned to the device? I know that CPCI systems are setup so that
the IRQ changes with the slot the card is in, so we really need to be able
to scan for it, not just hard code it. The qnx_hint_attach() and
qnx_hint_query() seem to work OK, but only if you already know the IRQ.

I’m also wondering, is QNX such that we can service (and or detect) and IRQ
that was generated on one node on another node?

Thanks!

Patrick Jennings
Red River Engineering

Hello Patrick,

Look at _CA_PCI_Find_Device() in the online doc. At the
bottom there is a nice example how to use it.

“Patrick Jennings” <jennings@red-river-[nospam]-eng.com> wrote in message
news:8qnr3q$7s$1@inn.qnx.com

Hey all:

This is probably a bit of a novice question, but here goes. We have a PMC
card device that we have mounted in a Zitech SBC. We have had code
running
in QNX 4 to create a memory map and read and write data to it. But now
the
time has come to put in ISRs. My question is, how does one tell what IRQ
has been assigned to the device? I know that CPCI systems are setup so
that
the IRQ changes with the slot the card is in, so we really need to be able
to scan for it, not just hard code it. The qnx_hint_attach() and
qnx_hint_query() seem to work OK, but only if you already know the IRQ.

I’m also wondering, is QNX such that we can service (and or detect) and
IRQ
that was generated on one node on another node?

Thanks!

Patrick Jennings
Red River Engineering

Thanks for your help on finding the IRQ. I have now written my first ISR,
(just a very simple one, it should trigger when we have data ready on our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns an
error message that “interrupt handler faulted” This happens even I comment
out the qnx_hint_attach() function. This leads me to believe that there is
something wrong in the way I am completing it.

I have attached the isr and main C file, as well as the Makefile I am using.
Any help would be appreciated.


Thanks!

/Patrick



begin 666 Makefile.dat
M(TUA:V5F:6QE(‘1O(&-R96%T92!T:&4@4$14(&AO<W0@<V5R=F5R(&9I;&4-
M"@T0T,]8V,@#0I#0T9,04=3/2U4,2 M5V%L;" M3PT1$5"54=&3$%‘4STM
M5#$@+6<R#0I04D]14-4/4E.5$5255!4#0I,24)3/2UL(“XN+VQI8B]44U)3
M0V]M;6]N3&EB+FQI8B M;” N+B]L:6(O44Y87VEO+FQI8@T
#0IA;&P@.B!I
M=’(N;R!W=VES<BYO#0H))"A#0RD@+4@+50Q("0H3$E"4RD@+6@9&5M;R!I
M=’(N;R!W=VES<BYO#0H-"F-L96%N(#H@( T*“2UR;2 J+F-”@T*:71R+F@
M.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M1&5F
M:6YE<RYH( T*"20H0T,I("U/("UC(&ET<BYC("UO(&ET<BYO#0H-"G=W:7-R
M+F@.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M
M1&5F:6YE<RYH#0H))"A#0RD@+7IU(“U78RP@+7,@+6,@=W=I<W(N8R M;R!W
0=VES<BYO#0H)( T*#0H-”@``
`
end

begin 666 Itr.c
M(VEN8VQU9&4@/’-Y<R]K97)N96PN:#X-“B-I;F-L=61E(#QS=&1I;RYH/@T*
M(VEN8VQU9&4@/’-T9&QI8BYH/@T*(VEN8VQU9&4@/’-Y<R]I<G%I;F9O+F@^
M#0HC:6YC;'5D92 <WES+VME<FYE;“YH/@T*(VEN8VQU9&4@/&-O;FEO+F@^
M#0HC:6YC;'5D92 <WES+W!R;WAY+F@^#0HC:6YC;'5D92 B+BXO;&EB+U13
M4E-#;VUM;VY,:6(N:”(-“B-I;F-L=61E(”(N+B]L:6(O<W1R=6-T<RYH(@T*
M(VEN8VQU9&4@(BXN+VQI8B]44U)34WES=&5M1&5F:6YE<RYH(@T*#0H-@T*
M<&ED7W0@9F%R(%=727-R7TAA;F1L97(H=F]I9"D"2\O4’)O='EP92!F;W(@
M25-2#0IP:61?="!75W!R;WAY7W!I9"
1"!O9B!P<F]X>2!T
M;R!B92!T<FEG9W)E9"!B>2!)4U(-“FEN=”!75T)A<V5!9&1R.PD)“2\O0F%S
M92!A9&1R97-S(&]F(%=7(&9O<B!)4U(-“FEN=”!75TER<3L)“0D)+R])4E$@
M3&EN92!O9B!T:&4@5V%V95=A;&ME<@T*:6YT(%=727-R7VED.PD)“2\O5V%V
M95=A;&ME<B!)<W(@:&%N9&QE<B!I9 T*=6YS:6=N960@;&]N9R!75TES<E-T
M871U<SL)+R](;VQD<R!T:&4@25-2(’)E9VES=&5R<R!F<F]M('1H92!75PT*
M<&ED7W0@4F5C96EV95!)1#L)“2\O5VAE;B!W92!G970@82!M97-S86=E+”!W
M:&5R92!D:60@:70@8V]M92!F<F]M#0IC:&%R(&US9V)U9F9;,3 P73L-”@T*
M=F]I9”!M86EN*'9O:60I#0I[#0H)<W1R=6-T($AO<W1?4WES=&5M7TUA<”!,
M;V-A;%]-87 [#0H):6YT(%)E=‘5R;E-T871U<SL-“B -”@EP<FEN=&8H(DE3
M4B!2;W5T:6YE(%1E<W1<;B(I.PT*#0H)+R]#<F5A=&4@4’)O>‘DL(# @3&5N
M9W1H#0H)5U=P<F]X>5]P:60@/2!Q;GA?<’)O>‘E?871T86-H*# L($Y53$PL
M(# L("TQ3L-"@EI9BA75W!R;WAY7W!I9" ]/2 M,2D-"@E[#0H)“69P<FEN
M=&8H<W1D97)R+” B0V]U;&0@;F]T(&%T=&%C:"!P<F]X>2%<;B(I.PT
"0EE
M>&ET*$58251?1D%)3%5212D[#0H)?0T*#0H)4F5T=7)N4W1A=‘5S(#T@36%P
M365M;W)Y1&5V:6-E*"9,;V-A;%]-87 L(#!X,3$W,2P@,‘AA,#4P3L-"@EI
M9B H4F5T=7)N4W1A='5S("$](# I#0H)>PT
"0EF<’)I;G1F*’-T9&5R<BPB
M17)R;W(@;6%P<&EN9R!7879E5V%L:V5R(5QN(BD[#0H)“65X:70H15A)5%]&
M04E,55)%3L)#0H)?0T#0H)5U=“87-E061D<B ]($QO8V%L7TUA<“Y!8G-7
M879E5V%L:V5R061D<CL-”@E75TER<2 ]($QO8V%L7TUA<“Y)<G$[#0H-@EP
M<FEN=&8H(E1H92!)4E$@9F]R(‘1H92!7879E5V%L:V5R(&ES(“5D7&XB+”!7
M5TER<2D[#0H)<’)I;G1F*”)4:&4@8F%S92!A9&1R97-S(&]F('1H92!75R!I
M%QN(BP@5U=“87-E061D<BD#0H)#0H-"@E7<FET95=A=F5786QK97(H
M,’@U.#0L(#!X1D9&1D9&1D8I.R O+T5N86)L92!A;&P@:6YT97)U<‘0@<F5G
M:7-T97)S#0H)4F5A9%=A=F5786QK97(H,’@U.#0L(“975TES<E-T871U<RD[
M(”\O4F5A9’,@=&AE(&5N86)L92!R96=I<W1E<@T*#0H)<’)I;G1F*")4:&4@
M:6YT97)U<‘0@96YA8FQE(’)E9VES=&5R(&ES(“5X7&XB+”!75TES<E-T871U
M<RD[#0H-"B\J#0H)+R]!='1A8V@@25-2#0H)5U=)<W)?:60@/2!Q;GA?:&EN
M=%]A='1A8V@H5U=)<G$L("975TES<E
A
M<V5!9&1R2D["0T#0H)9F]R(”@[.RD-”@E[#0H)"5)E8V5I=F50240@/2!2
M96-E:79E*# L(“9M<V=B=69F+”!S:7IE;V8H;7-G8G5F9BDI.PT*“0D-”@D)
M+R]787,@=&AE(&UE<W-A9V4@9G)O;2!T:&4@<’)O>‘D@<V5R=F5R(&]R(’-O
M;65O;F4@96QS90T*“0EI9B H4F5C96EV95!)1” ]/2!75W!R;WAY7W!I9"D-
M"@D)>PT*“0D)<’)I;G1F*”)$871A(&ES(“5X7&XB+”!75TES<E-T871U<RD[
M( T*“0E]#0H)“65L<V4-”@D)>PT*“0D)<’)I;G1F*”)3;VUE;VYE(&5L<V4@
M<V5N=”!U<R!A(&UE<W-A9V4A7&XB3L-"@D)?2 -"@E]#0HJ+PT<F5T=7)N
$.PT*?0``
`
end

begin 666 Wwisr.c
M(VEN8VQU9&4@/&-O;FEO+F@^#0HC:6YC;‘5D92 <’)O8V5S<RYH/@T*#0IE
M>'1E<FX@=F]L871I;&4@=6YS:6=N960@;&]N9R!75TES<E-T871U<SL)+R](
M;VQD<R!75R!)4U(@4W1A=‘5S(’)E9W,-“F5X=&5R;B!P:61?=”!75W!R;WAY
M7W!I9#L-"F5X=&5R;B!I;G0@5U=“87-E061D<CL-”@T*+R]4:&4@25-2(&9O
M<B!T:&4@5U<-"G!I9%]T(&9A<B!75TES<E](86YD;&5R*"D-“GL)#0H)+R]7
M5TES<E-T871U<R ](&EN<&0H5U=“87-E061D<B K(”@P>#4Y,”\T2D["0T
;"7)E='5R;BA75W!R;WAY7W!I9"D[#0I]#0H@
`
end

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:

Hey all:

This is probably a bit of a novice question, but here goes. We have a PMC
card device that we have mounted in a Zitech SBC. We have had code running
in QNX 4 to create a memory map and read and write data to it. But now the
time has come to put in ISRs. My question is, how does one tell what IRQ
has been assigned to the device? I know that CPCI systems are setup so that
the IRQ changes with the slot the card is in, so we really need to be able
to scan for it, not just hard code it. The qnx_hint_attach() and
qnx_hint_query() seem to work OK, but only if you already know the IRQ.

Look at the _CA_PCI* functions for querying the PCI BIOS. They are
documented, and there is some sample code on /usr/free – look for
the source to show_pci.

I’m also wondering, is QNX such that we can service (and or detect) and IRQ
that was generated on one node on another node?

No – irq are hardware level things. In fact, dealing with the io card that
generated the irq has to be on the same machine as well, so it is difficult
to see why you might want to do this. You can use proxy (see
qnx_proxy_rem_attach() ) to notify a process on another node that something
has happened, but you would have to do this with a Trigger() at process
time on the machine local to the irq.

-David

“Patrick Jennings” <jennings@red-river-[nospam]-eng.com> wrote in message
news:8qodbp$9o8$1@inn.qnx.com

Thanks for your help on finding the IRQ. I have now written my first ISR,
(just a very simple one, it should trigger when we have data ready on our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns
an
error message that “interrupt handler faulted” This happens even I
comment
out the qnx_hint_attach() function. This leads me to believe that there
is
something wrong in the way I am completing it.

At first glance I didn’t find anything wrong with your program, however I

couldn’t
find the source to some function like MapMemoryDevice. It’s my guess that
the “interrupt handler faulted” comes from your code. I have never this
message before.

I have attached the isr and main C file, as well as the Makefile I am
using.
Any help would be appreciated.


Thanks!

/Patrick
\

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:

Thanks for your help on finding the IRQ. I have now written my first ISR,
(just a very simple one, it should trigger when we have data ready on our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns an
error message that “interrupt handler faulted” This happens even I comment
out the qnx_hint_attach() function. This leads me to believe that there is
something wrong in the way I am completing it.

I have attached the isr and main C file, as well as the Makefile I am using.
Any help would be appreciated.



Thanks!

/Patrick

All of the following are just text files… it makes it easier for
use to read these if you just include them as plain text in your
message, rather than encoding them.

Thanks,
-David

begin 666 Makefile.dat
M(TUA:V5F:6QE(‘1O(&-R96%T92!T:&4@4$14(&AO<W0@<V5R=F5R(&9I;&4-
M"@T0T,]8V,@#0I#0T9,04=3/2U4,2 M5V%L;" M3PT1$5"54=&3$%‘4STM
M5#$@+6<R#0I04D]14-4/4E.5$5255!4#0I,24)3/2UL(“XN+VQI8B]44U)3
M0V]M;6]N3&EB+FQI8B M;” N+B]L:6(O44Y87VEO+FQI8@T
#0IA;&P@.B!I
M=’(N;R!W=VES<BYO#0H))"A#0RD@+4@+50Q("0H3$E"4RD@+6@9&5M;R!I
M=’(N;R!W=VES<BYO#0H-"F-L96%N(#H@( T*“2UR;2 J+F-”@T*:71R+F@
M.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M1&5F
M:6YE<RYH( T*"20H0T,I("U/("UC(&ET<BYC("UO(&ET<BYO#0H-"G=W:7-R
M+F@.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M
M1&5F:6YE<RYH#0H))"A#0RD@+7IU(“U78RP@+7,@+6,@=W=I<W(N8R M;R!W
0=VES<BYO#0H)( T*#0H-”@``
`
end

begin 666 Itr.c
M(VEN8VQU9&4@/’-Y<R]K97)N96PN:#X-“B-I;F-L=61E(#QS=&1I;RYH/@T*
M(VEN8VQU9&4@/’-T9&QI8BYH/@T*(VEN8VQU9&4@/’-Y<R]I<G%I;F9O+F@^
M#0HC:6YC;'5D92 <WES+VME<FYE;“YH/@T*(VEN8VQU9&4@/&-O;FEO+F@^
M#0HC:6YC;'5D92 <WES+W!R;WAY+F@^#0HC:6YC;'5D92 B+BXO;&EB+U13
M4E-#;VUM;VY,:6(N:”(-“B-I;F-L=61E(”(N+B]L:6(O<W1R=6-T<RYH(@T*
M(VEN8VQU9&4@(BXN+VQI8B]44U)34WES=&5M1&5F:6YE<RYH(@T*#0H-@T*
M<&ED7W0@9F%R(%=727-R7TAA;F1L97(H=F]I9"D"2\O4’)O='EP92!F;W(@
M25-2#0IP:61?="!75W!R;WAY7W!I9"
1"!O9B!P<F]X>2!T
M;R!B92!T<FEG9W)E9"!B>2!)4U(-“FEN=”!75T)A<V5!9&1R.PD)“2\O0F%S
M92!A9&1R97-S(&]F(%=7(&9O<B!)4U(-“FEN=”!75TER<3L)“0D)+R])4E$@
M3&EN92!O9B!T:&4@5V%V95=A;&ME<@T*:6YT(%=727-R7VED.PD)“2\O5V%V
M95=A;&ME<B!)<W(@:&%N9&QE<B!I9 T*=6YS:6=N960@;&]N9R!75TES<E-T
M871U<SL)+R](;VQD<R!T:&4@25-2(’)E9VES=&5R<R!F<F]M('1H92!75PT*
M<&ED7W0@4F5C96EV95!)1#L)“2\O5VAE;B!W92!G970@82!M97-S86=E+”!W
M:&5R92!D:60@:70@8V]M92!F<F]M#0IC:&%R(&US9V)U9F9;,3 P73L-”@T*
M=F]I9”!M86EN*'9O:60I#0I[#0H)<W1R=6-T($AO<W1?4WES=&5M7TUA<”!,
M;V-A;%]-87 [#0H):6YT(%)E=‘5R;E-T871U<SL-“B -”@EP<FEN=&8H(DE3
M4B!2;W5T:6YE(%1E<W1<;B(I.PT*#0H)+R]#<F5A=&4@4’)O>‘DL(# @3&5N
M9W1H#0H)5U=P<F]X>5]P:60@/2!Q;GA?<’)O>‘E?871T86-H*# L($Y53$PL
M(# L("TQ3L-"@EI9BA75W!R;WAY7W!I9" ]/2 M,2D-"@E[#0H)“69P<FEN
M=&8H<W1D97)R+” B0V]U;&0@;F]T(&%T=&%C:"!P<F]X>2%<;B(I.PT
"0EE
M>&ET*$58251?1D%)3%5212D[#0H)?0T*#0H)4F5T=7)N4W1A=‘5S(#T@36%P
M365M;W)Y1&5V:6-E*"9,;V-A;%]-87 L(#!X,3$W,2P@,‘AA,#4P3L-"@EI
M9B H4F5T=7)N4W1A='5S("$](# I#0H)>PT
"0EF<’)I;G1F*’-T9&5R<BPB
M17)R;W(@;6%P<&EN9R!7879E5V%L:V5R(5QN(BD[#0H)“65X:70H15A)5%]&
M04E,55)%3L)#0H)?0T#0H)5U=“87-E061D<B ]($QO8V%L7TUA<“Y!8G-7
M879E5V%L:V5R061D<CL-”@E75TER<2 ]($QO8V%L7TUA<“Y)<G$[#0H-@EP
M<FEN=&8H(E1H92!)4E$@9F]R(‘1H92!7879E5V%L:V5R(&ES(“5D7&XB+”!7
M5TER<2D[#0H)<’)I;G1F*”)4:&4@8F%S92!A9&1R97-S(&]F('1H92!75R!I
M%QN(BP@5U=“87-E061D<BD#0H)#0H-"@E7<FET95=A=F5786QK97(H
M,’@U.#0L(#!X1D9&1D9&1D8I.R O+T5N86)L92!A;&P@:6YT97)U<‘0@<F5G
M:7-T97)S#0H)4F5A9%=A=F5786QK97(H,’@U.#0L(“975TES<E-T871U<RD[
M(”\O4F5A9’,@=&AE(&5N86)L92!R96=I<W1E<@T*#0H)<’)I;G1F*")4:&4@
M:6YT97)U<‘0@96YA8FQE(’)E9VES=&5R(&ES(“5X7&XB+”!75TES<E-T871U
M<RD[#0H-"B\J#0H)+R]!='1A8V@@25-2#0H)5U=)<W)?:60@/2!Q;GA?:&EN
M=%]A='1A8V@H5U=)<G$L("975TES<E
A
M<V5!9&1R2D["0T#0H)9F]R(”@[.RD-”@E[#0H)"5)E8V5I=F50240@/2!2
M96-E:79E*# L(“9M<V=B=69F+”!S:7IE;V8H;7-G8G5F9BDI.PT*“0D-”@D)
M+R]787,@=&AE(&UE<W-A9V4@9G)O;2!T:&4@<’)O>‘D@<V5R=F5R(&]R(’-O
M;65O;F4@96QS90T*“0EI9B H4F5C96EV95!)1” ]/2!75W!R;WAY7W!I9"D-
M"@D)>PT*“0D)<’)I;G1F*”)$871A(&ES(“5X7&XB+”!75TES<E-T871U<RD[
M( T*“0E]#0H)“65L<V4-”@D)>PT*“0D)<’)I;G1F*”)3;VUE;VYE(&5L<V4@
M<V5N=”!U<R!A(&UE<W-A9V4A7&XB3L-"@D)?2 -"@E]#0HJ+PT<F5T=7)N
$.PT*?0``
`
end

begin 666 Wwisr.c
M(VEN8VQU9&4@/&-O;FEO+F@^#0HC:6YC;‘5D92 <’)O8V5S<RYH/@T*#0IE
M>'1E<FX@=F]L871I;&4@=6YS:6=N960@;&]N9R!75TES<E-T871U<SL)+R](
M;VQD<R!75R!)4U(@4W1A=‘5S(’)E9W,-“F5X=&5R;B!P:61?=”!75W!R;WAY
M7W!I9#L-"F5X=&5R;B!I;G0@5U=“87-E061D<CL-”@T*+R]4:&4@25-2(&9O
M<B!T:&4@5U<-"G!I9%]T(&9A<B!75TES<E](86YD;&5R*"D-“GL)#0H)+R]7
M5TES<E-T871U<R ](&EN<&0H5U=“87-E061D<B K(”@P>#4Y,”\T2D["0T
;"7)E='5R;BA75W!R;WAY7W!I9"D[#0I]#0H@
`
end

Ok sorry about that here are the files in plain text.

/itr.c/
#include <sys/kernel.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/irqinfo.h>
#include <sys/kernel.h>
#include <conio.h>
#include <sys/proxy.h>
#include “…/lib/TSRSCommonLib.h”
#include “…/lib/structs.h”
#include “…/lib/TSRSSystemDefines.h”



pid_t far WWIsr_Handler(void); //Protype for ISR
pid_t WWproxy_pid = -1; //PID of proxy to be triggred by ISR
int WWBaseAddr; //Base address of WW for ISR
int WWIrq; //IRQ Line of the WaveWalker
int WWIsr_id; //WaveWalker Isr handler id
unsigned long WWIsrStatus; //Holds the ISR registers from the WW
pid_t ReceivePID; //When we get a message, where did it come from
char msgbuff[100];

void main(void)
{
struct Host_System_Map Local_Map;
int ReturnStatus;

printf(“ISR Routine Test\n”);

//Create Proxy, 0 Length
WWproxy_pid = qnx_proxy_attach(0, NULL, 0, -1);
if(WWproxy_pid == -1)
{
fprintf(stderr, “Could not attach proxy!\n”);
exit(EXIT_FAILURE);
}

ReturnStatus = MapMemoryDevice(&Local_Map, 0x1171, 0xa050);
if (ReturnStatus != 0)
{
fprintf(stderr,“Error mapping WaveWalker!\n”);
exit(EXIT_FAILURE);
}

WWBaseAddr = Local_Map.AbsWaveWalkerAddr;
WWIrq = Local_Map.Irq;

printf(“The IRQ for the WaveWalker is %d\n”, WWIrq);
printf(“The base address of the WW is %x\n”, WWBaseAddr);


WriteWaveWalker(0x584, 0xFFFFFFFF); //Enable all interupt registers
ReadWaveWalker(0x584, &WWIsrStatus); //Reads the enable register

printf(“The interupt enable register is %x\n”, WWIsrStatus);

/*
//Attach ISR
WWIsr_id = qnx_hint_attach(WWIrq, &WWIsr_Handler, FP_SEG (&WWBaseAddr));

for (;:wink:
{
ReceivePID = Receive(0, &msgbuff, sizeof(msgbuff));

//Was the message from the proxy server or someone else
if (ReceivePID == WWproxy_pid)
{
printf(“Data is %x\n”, WWIsrStatus);
}
else
{
printf(“Someone else sent us a message!\n”);
}
}
*/
return;
}



/wwisr.c/
#include <conio.h>
#include <process.h>

extern volatile unsigned long WWIsrStatus; //Holds WW ISR Status regs
extern pid_t WWproxy_pid;
extern int WWBaseAddr;

//The ISR for the WW
pid_t far WWIsr_Handler()
{
//WWIsrStatus = inpd(WWBaseAddr + (0x590/4));
return(WWproxy_pid);
}


/makefile/
Makefile to create the PDT host server file

CC=cc
CCFLAGS=-T1 -Wall -O
DEBUGFLAGS=-T1 -g2
PROJECT=INTERUPT
LIBS=-l …/lib/TSRSCommonLib.lib -l …/lib/QNX_io.lib

all : itr.o wwisr.o
$(CC) -O -T1 $(LIBS) -o demo itr.o wwisr.o

clean :
-rm *.o

itr.o : …/lib/TSRSCommonLib.h …/lib/TSRSSystemDefines.h
$(CC) -O -c itr.c -o itr.o

wwisr.o : …/lib/TSRSCommonLib.h …/lib/TSRSSystemDefines.h
$(CC) -zu -Wc, -s -c wwisr.c -o wwisr.o


David Gibbs <dagibbs@qnx.com> wrote in message
news:8qthb4$57$2@nntp.qnx.com

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:
Thanks for your help on finding the IRQ. I have now written my first
ISR,
(just a very simple one, it should trigger when we have data ready on
our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns
an
error message that “interrupt handler faulted” This happens even I
comment
out the qnx_hint_attach() function. This leads me to believe that there
is
something wrong in the way I am completing it.

I have attached the isr and main C file, as well as the Makefile I am
using.
Any help would be appreciated.


Thanks!

/Patrick

All of the following are just text files… it makes it easier for
use to read these if you just include them as plain text in your
message, rather than encoding them.

Thanks,
-David

begin 666 Makefile.dat
M(TUA:V5F:6QE(‘1O(&-R96%T92!T:&4@4$14(&AO<W0@<V5R=F5R(&9I;&4-
M"@T0T,]8V,@#0I#0T9,04=3/2U4,2 M5V%L;" M3PT1$5"54=&3$%‘4STM
M5#$@+6<R#0I04D]14-4/4E.5$5255!4#0I,24)3/2UL(“XN+VQI8B]44U)3
M0V]M;6]N3&EB+FQI8B M;” N+B]L:6(O44Y87VEO+FQI8@T
#0IA;&P@.B!I
M=’(N;R!W=VES<BYO#0H))"A#0RD@+4@+50Q("0H3$E"4RD@+6@9&5M;R!I
M=’(N;R!W=VES<BYO#0H-"F-L96%N(#H@( T*“2UR;2 J+F-”@T*:71R+F@
M.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M1&5F
M:6YE<RYH( T*"20H0T,I("U/("UC(&ET<BYC("UO(&ET<BYO#0H-"G=W:7-R
M+F@.B N+B]L:6(O5%-24T-O;6UO;DQI8BYH("XN+VQI8B]44U)34WES=&5M
M1&5F:6YE<RYH#0H))"A#0RD@+7IU(“U78RP@+7,@+6,@=W=I<W(N8R M;R!W
0=VES<BYO#0H)( T*#0H-”@``
`
end

begin 666 Itr.c
M(VEN8VQU9&4@/’-Y<R]K97)N96PN:#X-“B-I;F-L=61E(#QS=&1I;RYH/@T*
M(VEN8VQU9&4@/’-T9&QI8BYH/@T*(VEN8VQU9&4@/’-Y<R]I<G%I;F9O+F@^
M#0HC:6YC;'5D92 <WES+VME<FYE;“YH/@T*(VEN8VQU9&4@/&-O;FEO+F@^
M#0HC:6YC;'5D92 <WES+W!R;WAY+F@^#0HC:6YC;'5D92 B+BXO;&EB+U13
M4E-#;VUM;VY,:6(N:”(-“B-I;F-L=61E(”(N+B]L:6(O<W1R=6-T<RYH(@T*
M(VEN8VQU9&4@(BXN+VQI8B]44U)34WES=&5M1&5F:6YE<RYH(@T*#0H-@T*
M<&ED7W0@9F%R(%=727-R7TAA;F1L97(H=F]I9"D"2\O4’)O='EP92!F;W(@
M25-2#0IP:61?="!75W!R;WAY7W!I9"
1"!O9B!P<F]X>2!T
M;R!B92!T<FEG9W)E9"!B>2!)4U(-“FEN=”!75T)A<V5!9&1R.PD)“2\O0F%S
M92!A9&1R97-S(&]F(%=7(&9O<B!)4U(-“FEN=”!75TER<3L)“0D)+R])4E$@
M3&EN92!O9B!T:&4@5V%V95=A;&ME<@T*:6YT(%=727-R7VED.PD)“2\O5V%V
M95=A;&ME<B!)<W(@:&%N9&QE<B!I9 T*=6YS:6=N960@;&]N9R!75TES<E-T
M871U<SL)+R](;VQD<R!T:&4@25-2(’)E9VES=&5R<R!F<F]M('1H92!75PT*
M<&ED7W0@4F5C96EV95!)1#L)“2\O5VAE;B!W92!G970@82!M97-S86=E+”!W
M:&5R92!D:60@:70@8V]M92!F<F]M#0IC:&%R(&US9V)U9F9;,3 P73L-”@T*
M=F]I9”!M86EN*'9O:60I#0I[#0H)<W1R=6-T($AO<W1?4WES=&5M7TUA<”!,
M;V-A;%]-87 [#0H):6YT(%)E=‘5R;E-T871U<SL-“B -”@EP<FEN=&8H(DE3
M4B!2;W5T:6YE(%1E<W1<;B(I.PT*#0H)+R]#<F5A=&4@4’)O>‘DL(# @3&5N
M9W1H#0H)5U=P<F]X>5]P:60@/2!Q;GA?<’)O>‘E?871T86-H*# L($Y53$PL
M(# L("TQ3L-"@EI9BA75W!R;WAY7W!I9" ]/2 M,2D-"@E[#0H)“69P<FEN
M=&8H<W1D97)R+” B0V]U;&0@;F]T(&%T=&%C:"!P<F]X>2%<;B(I.PT
"0EE
M>&ET*$58251?1D%)3%5212D[#0H)?0T*#0H)4F5T=7)N4W1A=‘5S(#T@36%P
M365M;W)Y1&5V:6-E*"9,;V-A;%]-87 L(#!X,3$W,2P@,‘AA,#4P3L-"@EI
M9B H4F5T=7)N4W1A='5S("$](# I#0H)>PT
"0EF<’)I;G1F*’-T9&5R<BPB
M17)R;W(@;6%P<&EN9R!7879E5V%L:V5R(5QN(BD[#0H)“65X:70H15A)5%]&
M04E,55)%3L)#0H)?0T#0H)5U=“87-E061D<B ]($QO8V%L7TUA<“Y!8G-7
M879E5V%L:V5R061D<CL-”@E75TER<2 ]($QO8V%L7TUA<“Y)<G$[#0H-@EP
M<FEN=&8H(E1H92!)4E$@9F]R(‘1H92!7879E5V%L:V5R(&ES(“5D7&XB+”!7
M5TER<2D[#0H)<’)I;G1F*”)4:&4@8F%S92!A9&1R97-S(&]F('1H92!75R!I
M%QN(BP@5U=“87-E061D<BD#0H)#0H-"@E7<FET95=A=F5786QK97(H
M,’@U.#0L(#!X1D9&1D9&1D8I.R O+T5N86)L92!A;&P@:6YT97)U<‘0@<F5G
M:7-T97)S#0H)4F5A9%=A=F5786QK97(H,’@U.#0L(“975TES<E-T871U<RD[
M(”\O4F5A9’,@=&AE(&5N86)L92!R96=I<W1E<@T*#0H)<’)I;G1F*")4:&4@
M:6YT97)U<‘0@96YA8FQE(’)E9VES=&5R(&ES(“5X7&XB+”!75TES<E-T871U
M<RD[#0H-"B\J#0H)+R]!='1A8V@@25-2#0H)5U=)<W)?:60@/2!Q;GA?:&EN
M=%]A='1A8V@H5U=)<G$L("975TES<E
A
M<V5!9&1R2D["0T#0H)9F]R(”@[.RD-”@E[#0H)"5)E8V5I=F50240@/2!2
M96-E:79E*# L(“9M<V=B=69F+”!S:7IE;V8H;7-G8G5F9BDI.PT*“0D-”@D)
M+R]787,@=&AE(&UE<W-A9V4@9G)O;2!T:&4@<’)O>‘D@<V5R=F5R(&]R(’-O
M;65O;F4@96QS90T*“0EI9B H4F5C96EV95!)1” ]/2!75W!R;WAY7W!I9"D-
M"@D)>PT*“0D)<’)I;G1F*”)$871A(&ES(“5X7&XB+”!75TES<E-T871U<RD[
M( T*“0E]#0H)“65L<V4-”@D)>PT*“0D)<’)I;G1F*”)3;VUE;VYE(&5L<V4@
M<V5N=”!U<R!A(&UE<W-A9V4A7&XB3L-"@D)?2 -"@E]#0HJ+PT<F5T=7)N
$.PT*?0``
`
end

begin 666 Wwisr.c
M(VEN8VQU9&4@/&-O;FEO+F@^#0HC:6YC;‘5D92 <’)O8V5S<RYH/@T*#0IE
M>'1E<FX@=F]L871I;&4@=6YS:6=N960@;&]N9R!75TES<E-T871U<SL)+R](
M;VQD<R!75R!)4U(@4W1A=‘5S(’)E9W,-“F5X=&5R;B!P:61?=”!75W!R;WAY
M7W!I9#L-"F5X=&5R;B!I;G0@5U=“87-E061D<CL-”@T*+R]4:&4@25-2(&9O
M<B!T:&4@5U<-"G!I9%]T(&9A<B!75TES<E](86YD;&5R*"D-“GL)#0H)+R]7
M5TES<E-T871U<R ](&EN<&0H5U=“87-E061D<B K(”@P>#4Y,”\T2D["0T
;"7)E='5R;BA75W!R;WAY7W!I9"D[#0I]#0H@
`
end

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:

Ok sorry about that here are the files in plain text.

Ok, looked at these, and they look fine – I don’t see any of
the usual errors. The handler looks safe, and you have the
proper compile options.

Back to some of your original post:

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:

Thanks for your help on finding the IRQ. I have now written my first
ISR,
(just a very simple one, it should trigger when we have data ready on
our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns
an error message that “interrupt handler faulted” This happens even I
comment out the qnx_hint_attach() function.

A couple notes – the “interrupt handler faulted” message is definitely
generated by Proc32. (“strings /boot/sys/Proc32 | grep fault” verified
that.)

Now, the fact that you get that WITHOUT calling qnx_hint_attach() is
very interesting.

What irq is this card using? Is there any other process that also
has a handler attached to that irq? (sin irq can be used to query
this.) Is this a PCI or ISA card?

-David

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:

I was wrong about the Makefile looking correct…

/makefile/
Makefile to create the PDT host server file

CC=cc
CCFLAGS=-T1 -Wall -O
DEBUGFLAGS=-T1 -g2
PROJECT=INTERUPT
LIBS=-l …/lib/TSRSCommonLib.lib -l …/lib/QNX_io.lib

all : itr.o wwisr.o
$(CC) -O -T1 $(LIBS) -o demo itr.o wwisr.o

clean :
-rm *.o

itr.o : …/lib/TSRSCommonLib.h …/lib/TSRSSystemDefines.h
$(CC) -O -c itr.c -o itr.o

wwisr.o : …/lib/TSRSCommonLib.h …/lib/TSRSSystemDefines.h
$(CC) -zu -Wc, -s -c wwisr.c -o wwisr.o
^

That space can’t be there.

Compare:

cc -Wc, -s sem_test.c
/usr/watcom/10.7/bin/wcc386 -zq -ms -3r -i=/usr/include -i=/usr/watcom/10.7/usr/

include sem_test.c

cc -Wc,-s sem_test.c
/usr/watcom/10.7/bin/wcc386 -zq -ms -s -3r -i=/usr/include -i=/usr/watcom/10.7/u

sr/include sem_test.c

Note in the second case there is the “-s” option between “-ms” and “-3r” but
that it doesn’t occur in the first case.

If you still have stack checking enabled for your irq handler, that could
definitely cause problems.

-David

The output of sin irq is:

IRQ PID PROGRAM CS:IP DS
-1 16 //2/bin/Dev32 0005:005760 000D
-1 23 //2/bin/Dev32.ser 0005:0024FC 000D
-1 24 //2/bin/Dev32.ser 0005:0024FC 000D
-1 25 //2/bin/Dev32.ansi 0005:005DC0 000D
-1 38 //2/bin/Fsys.floppy 0005:0026FC 000D
-1 42 //2/bin/Net 0015:003060 001D
0 1 /boot/sys/Proc32 00F0:005AE0 00F8
0 42 //2/bin/Net 0015:003100 001D
1 25 //2/bin/Dev32.ansi 0005:00690C 000D
3 24 //2/bin/Dev32.ser 0005:00177C 000D
4 23 //2/bin/Dev32.ser 0005:0017A4 000D
6 38 //2/bin/Fsys.floppy 0005:0026E5 000D
10 42 //2/bin/Net 0015:003680 001D
13 1 /boot/sys/Proc32 00F0:005A9C 00F8
14 5 /bin/Fsys.eide 0005:009B23 000D
15 34 //2/bin/Fsys.eide 0005:009B23 000D

Our card doesn’t seem to show up here, but when CA_Find_PCI_Device() is
called (as part of the MapMemoryDevice call) the irq it returns is 11.

/patrick

David Gibbs <dagibbs@qnx.com> wrote in message
news:8r0ggu$n9h$1@nntp.qnx.com

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:
Ok sorry about that here are the files in plain text.

Ok, looked at these, and they look fine – I don’t see any of
the usual errors. The handler looks safe, and you have the
proper compile options.

Back to some of your original post:

Patrick Jennings <jennings@red-river-[nospam]-eng.com> wrote:
Thanks for your help on finding the IRQ. I have now written my first
ISR,
(just a very simple one, it should trigger when we have data ready on
our
card and then return the firmware date.

When i run the program, it finds the device correctly, but then returns
an error message that “interrupt handler faulted” This happens even I
comment out the qnx_hint_attach() function.

A couple notes – the “interrupt handler faulted” message is definitely
generated by Proc32. (“strings /boot/sys/Proc32 | grep fault” verified
that.)

Now, the fact that you get that WITHOUT calling qnx_hint_attach() is
very interesting.

What irq is this card using? Is there any other process that also
has a handler attached to that irq? (sin irq can be used to query
this.) Is this a PCI or ISA card?

-David