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 (;
{
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<EA
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