io-net and other network settings...

Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and 6.2).
When I start the framegrabber after some seconds and sometime minutes, the
network connection to/from QNX craches (actually everything that has to do
with TCPIP) but everything else on the computer works fine. I have checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to change
the stack size, protocol size, or anything on the network card or driver,
that can solve this kind of problem?

I am open to any suggestions.

Thanks,
Antoine.

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cf7sre$ib4$1@inn.qnx.com

Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and 6.2).
When I start the framegrabber after some seconds and sometime minutes, the
network connection to/from QNX craches (actually everything that has to do
with TCPIP) but everything else on the computer works fine. I have checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or driver,
that can solve this kind of problem?

It’s possible something is wrong with setup of DMA and you are overwritting
some memory own by io-net. On each startup io-net is probably loaded in the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.

Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA setup, but
i can’t find what. I will try to use a different transfer address and check
if that helps.

Thanks,
Antoine.

“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cf7url$jmb$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and
6.2).
When I start the framegrabber after some seconds and sometime minutes,
the
network connection to/from QNX craches (actually everything that has to
do
with TCPIP) but everything else on the computer works fine. I have
checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably loaded in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.
\

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cf9t6v$4al$1@inn.qnx.com

Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA setup,
but
i can’t find what. I will try to use a different transfer address and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?

Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and
6.2).
When I start the framegrabber after some seconds and sometime minutes,
the
network connection to/from QNX craches (actually everything that has to
do
with TCPIP) but everything else on the computer works fine. I have
checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably loaded in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.


\

Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.

Thanks,
Antoine.

“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cfa9t3$da0$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA setup,
but
i can’t find what. I will try to use a different transfer address and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything that has
to
do
with TCPIP) but everything else on the computer works fine. I have
checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably loaded
in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.





\

begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y<
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!<
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end

In article <cfail6$j53$1@inn.qnx.com>, anthad@foi.se says…

Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.

Most important code is a function which you called
setupReadDMA(), it could do something really hazardous :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA setup,
but
i can’t find what. I will try to use a different transfer address and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything that has
to
do
with TCPIP) but everything else on the computer works fine. I have
checked
that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably loaded
in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end

Hello Eduard,

Thanks for the reply.

setupReadDMA() only writes two values to the framegrabber hardware (start
address of DMA and length) and a register command to start transfering.

The only reason i write (offset_t *) &mMemOffset is actually because
mMemOffset is declared as: volatile offset_t mMemOffset so i just want to
avoid compile warnings.

About the mCurrentDmaOffset the answer is yes it can only be 0 or 1, and yes
the DMA increments the address during transaction…

You are completely right about the event initialization in the interrupt
service routine, i have changed it :slight_smile:

I have also tried to allocate 8 times the buffers needed and let
mCurrentDmaOffset start at 4 and varies between 4 and 6 (just for testing),
incase i am wrong about the DMA address incrementation (that is if the DMA
actually decrement the address), but that doesn’t work either.

Do you know why it is always the network (i think io-net) that crashes and
nothing else?

I have observed that the network only crashes if i start the framegrabber
process when the network card is recieving or sending something (a red or
blue indication in photon). Otherwise the framegrabbing and the network
works fine. If i unplugg the network cable during the framegrabbing and the
plugg it in again when finished, the network and everything else would still
work fine.

I want to point out that the data rate from the framegrabber is about 4MB a
second. The images i get back are also ok, the data is not corrupted, no
lost frames or anything like that.

I am beginning to suspect a problem with the network driver on QNX. Whenever
i try to copy a file through the network or trying to access the computer
through the network, during the framegrabbing process, the network (io-net
or something else) dies. The only thing i can do is reboot.

Regards,
Antoine.


“ed1k” <ed1k@fake.address> wrote in message
news:MPG.1b83507b50a19dfa98969b@inn.qnx.com

In article <cfail6$j53$> 1@inn.qnx.com> >, > anthad@foi.se > says…
Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.


Most important code is a function which you called
setupReadDMA(), it could do something really hazardous > :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA
setup,
but
i can’t find what. I will try to use a different transfer address
and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver
for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1
and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything that
has
to
do
with TCPIP) but everything else on the computer works fine. I
have
checked
that the network card and the framegrabber does not share the
same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example
to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably
loaded
in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cfcjng$5qf$1@inn.qnx.com

Hello Eduard,

Thanks for the reply.

setupReadDMA() only writes two values to the framegrabber hardware (start
address of DMA and length) and a register command to start transfering.

The only reason i write (offset_t *) &mMemOffset is actually because
mMemOffset is declared as: volatile offset_t mMemOffset so i just want to
avoid compile warnings.

Doesn’t have to be volatile, the value never changes after being
initialized.

Do you know why it is always the network (i think io-net) that crashes and
nothing else?

What happen if you stop networking (kill io-net), start your application,
start networking and then start DMA.

I have observed that the network only crashes if i start the framegrabber
process when the network card is recieving or sending something (a red or
blue indication in photon). Otherwise the framegrabbing and the network
works fine. If i unplugg the network cable during the framegrabbing and
the
plugg it in again when finished, the network and everything else would
still
work fine.

That mean problem happens when there is two concurrent DMA operation.

I want to point out that the data rate from the framegrabber is about 4MB
a
second.

Huh? What kind of grabber is that or what type of image are you capturing,
at what frame rate (just curious).

The images i get back are also ok, the data is not corrupted, no
lost frames or anything like that.

I am beginning to suspect a problem with the network driver on QNX.
Whenever
i try to copy a file through the network or trying to access the computer
through the network, during the framegrabbing process, the network (io-net
or something else) dies. The only thing i can do is reboot.

Possible but I doubt it. Try a different model of network card (which
implies a different drivers). If the problem is still there, I would start
thinking maybe the grabber has a broken design. Have you tried different
slot and a different motherboard.

Regards,
Antoine.


“ed1k” <> ed1k@fake.address> > wrote in message
news:> MPG.1b83507b50a19dfa98969b@inn.qnx.com> …
In article <cfail6$j53$> 1@inn.qnx.com> >, > anthad@foi.se > says…
Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.


Most important code is a function which you called
setupReadDMA(), it could do something really hazardous > :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA
setup,
but
i can’t find what. I will try to use a different transfer address
and
check
if that helps.

Can you post the code you use to create the share memory and setup
the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in
message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver
for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1
and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything that
has
to
do
with TCPIP) but everything else on the computer works fine. I
have
checked
that the network card and the framegrabber does not share the
same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for
example
to
change
the stack size, protocol size, or anything on the network card
or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably
loaded
in
the
same memory area, which explains why it’s io-net that gets
trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end
\

In article <cfcjng$5qf$1@inn.qnx.com>, anthad@foi.se says…

setupReadDMA() only writes two values to the framegrabber hardware (start
address of DMA and length) and a register command to start transfering.

The only reason i write (offset_t *) &mMemOffset is actually because
mMemOffset is declared as: volatile offset_t mMemOffset so i just want to
avoid compile warnings.

Huh? What is sizeof(offset_t)? Does your hardware really work with 64-
bit addresses. Might be you need some address aligment? You can try to
add MAP_NOX64K and MAP_BELOW16M flags to mmap(). But it worth only to
try, actually they don’t need to be for PCI master device.

About the mCurrentDmaOffset the answer is yes it can only be 0 or 1, and yes
the DMA increments the address during transaction…

It looks like mCurrentDmaOffset in ISR is the same variable as
mCurrentReadOffset in interrupt thread. A bit confusing :slight_smile:
What is the magic offset 0xA0000 in calculation of mImage pointer?

Do you know why it is always the network (i think io-net) that crashes and
nothing else?

I have observed that the network only crashes if i start the framegrabber
process when the network card is recieving or sending something (a red or
blue indication in photon). Otherwise the framegrabbing and the network
works fine. If i unplugg the network cable during the framegrabbing and the
plugg it in again when finished, the network and everything else would still
work fine.

Might be, the framegrabber, as a master PCI device, just grabs the PCI
bus for very long time? That could be cause for all kinds of problem
with NIC. Some of them (every that I saw), if got overrun, needs to be
completely reinitialized.

I want to point out that the data rate from the framegrabber is about 4MB a
second. The images i get back are also ok, the data is not corrupted, no
lost frames or anything like that.

I am beginning to suspect a problem with the network driver on QNX. Whenever
i try to copy a file through the network or trying to access the computer
through the network, during the framegrabbing process, the network (io-net
or something else) dies. The only thing i can do is reboot.

Well, it sounds definetely wrong. It shouldn’t hang up the system, even
if framegrabber takes over the bus for prolong time. But I leave it to
comment for someone from QSS. I’d advise you to read the documentation
on framegrabber or contact the manufacturer of that hardware. Ought to
be different DMA options or something like.

Regards,
Eduard.

Regards,
Antoine.


“ed1k” <> ed1k@fake.address> > wrote in message
news:> MPG.1b83507b50a19dfa98969b@inn.qnx.com> …
In article <cfail6$j53$> 1@inn.qnx.com> >, > anthad@foi.se > says…
Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.


Most important code is a function which you called
setupReadDMA(), it could do something really hazardous > :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA
setup,
but
i can’t find what. I will try to use a different transfer address
and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver
for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1
and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything that
has
to
do
with TCPIP) but everything else on the computer works fine. I
have
checked
that the network card and the framegrabber does not share the
same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example
to
change
the stack size, protocol size, or anything on the network card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably
loaded
in
the
same memory area, which explains why it’s io-net that gets trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end

\

Hello Mario,

If i stop networking, start the application, start networking and then start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Thanks for all the replies.

Regards,
Antoine.


“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cfd069$eds$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfcjng$5qf$> 1@inn.qnx.com> …
Hello Eduard,

Thanks for the reply.

setupReadDMA() only writes two values to the framegrabber hardware
(start
address of DMA and length) and a register command to start transfering.

The only reason i write (offset_t *) &mMemOffset is actually because
mMemOffset is declared as: volatile offset_t mMemOffset so i just want
to
avoid compile warnings.

Doesn’t have to be volatile, the value never changes after being
initialized.


Do you know why it is always the network (i think io-net) that crashes
and
nothing else?

What happen if you stop networking (kill io-net), start your application,
start networking and then start DMA.


I have observed that the network only crashes if i start the
framegrabber
process when the network card is recieving or sending something (a red
or
blue indication in photon). Otherwise the framegrabbing and the network
works fine. If i unplugg the network cable during the framegrabbing and
the
plugg it in again when finished, the network and everything else would
still
work fine.

That mean problem happens when there is two concurrent DMA operation.


I want to point out that the data rate from the framegrabber is about
4MB
a
second.

Huh? What kind of grabber is that or what type of image are you
capturing,
at what frame rate (just curious).

The images i get back are also ok, the data is not corrupted, no
lost frames or anything like that.

I am beginning to suspect a problem with the network driver on QNX.
Whenever
i try to copy a file through the network or trying to access the
computer
through the network, during the framegrabbing process, the network
(io-net
or something else) dies. The only thing i can do is reboot.

Possible but I doubt it. Try a different model of network card (which
implies a different drivers). If the problem is still there, I would
start
thinking maybe the grabber has a broken design. Have you tried different
slot and a different motherboard.


Regards,
Antoine.


“ed1k” <> ed1k@fake.address> > wrote in message
news:> MPG.1b83507b50a19dfa98969b@inn.qnx.com> …
In article <cfail6$j53$> 1@inn.qnx.com> >, > anthad@foi.se > says…
Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.


Most important code is a function which you called
setupReadDMA(), it could do something really hazardous > :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it
can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA
setup,
but
i can’t find what. I will try to use a different transfer address
and
check
if that helps.

Can you post the code you use to create the share memory and setup
the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in
message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a driver
for a
framegrabber that uses DMA for data transfer (i am using QNX
6.1
and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything
that
has
to
do
with TCPIP) but everything else on the computer works fine. I
have
checked
that the network card and the framegrabber does not share the
same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for
example
to
change
the stack size, protocol size, or anything on the network card
or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably
loaded
in
the
same memory area, which explains why it’s io-net that gets
trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end


\

Hello Eduard,

The variables mCurrentDmaOffset and mCurrentReadOffset are the same at the
beginning, but the first one is used to tell the DMA where the transfer
should be and the second one is used in the interrupt thread to read the
last transfered data. That is incase it takes a litle bit more time to work
with the data in the interrupt thread (a new frame can arrive and i can set
the DMA transfer address to a new location at the same time that i am workin
with the old data, but ofcourse it must take less than two frames time
slice).

Actually yes, i think the framegrabber grabs the pci bus to much, but i also
think it shouldn’t create this kind of problem, oh well… I will try to
talk to the manufacturer next week (they are on vacation this week) to see
what they have to say about it.

Thanks for all the replies,

Regards,
Antoine.


“ed1k” <ed1k@fake.address> wrote in message
news:MPG.1b84b0596928553d98969c@inn.qnx.com

In article <cfcjng$5qf$> 1@inn.qnx.com> >, > anthad@foi.se > says…
setupReadDMA() only writes two values to the framegrabber hardware
(start
address of DMA and length) and a register command to start transfering.

The only reason i write (offset_t *) &mMemOffset is actually because
mMemOffset is declared as: volatile offset_t mMemOffset so i just want
to
avoid compile warnings.

Huh? What is sizeof(offset_t)? Does your hardware really work with 64-
bit addresses. Might be you need some address aligment? You can try to
add MAP_NOX64K and MAP_BELOW16M flags to mmap(). But it worth only to
try, actually they don’t need to be for PCI master device.


About the mCurrentDmaOffset the answer is yes it can only be 0 or 1, and
yes
the DMA increments the address during transaction…

It looks like mCurrentDmaOffset in ISR is the same variable as
mCurrentReadOffset in interrupt thread. A bit confusing > :slight_smile:
What is the magic offset 0xA0000 in calculation of mImage pointer?


Do you know why it is always the network (i think io-net) that crashes
and
nothing else?

I have observed that the network only crashes if i start the
framegrabber
process when the network card is recieving or sending something (a red
or
blue indication in photon). Otherwise the framegrabbing and the network
works fine. If i unplugg the network cable during the framegrabbing and
the
plugg it in again when finished, the network and everything else would
still
work fine.

Might be, the framegrabber, as a master PCI device, just grabs the PCI
bus for very long time? That could be cause for all kinds of problem
with NIC. Some of them (every that I saw), if got overrun, needs to be
completely reinitialized.


I want to point out that the data rate from the framegrabber is about
4MB a
second. The images i get back are also ok, the data is not corrupted, no
lost frames or anything like that.

I am beginning to suspect a problem with the network driver on QNX.
Whenever
i try to copy a file through the network or trying to access the
computer
through the network, during the framegrabbing process, the network
(io-net
or something else) dies. The only thing i can do is reboot.

Well, it sounds definetely wrong. It shouldn’t hang up the system, even
if framegrabber takes over the bus for prolong time. But I leave it to
comment for someone from QSS. I’d advise you to read the documentation
on framegrabber or contact the manufacturer of that hardware. Ought to
be different DMA options or something like.

Regards,
Eduard.

Regards,
Antoine.


“ed1k” <> ed1k@fake.address> > wrote in message
news:> MPG.1b83507b50a19dfa98969b@inn.qnx.com> …
In article <cfail6$j53$> 1@inn.qnx.com> >, > anthad@foi.se > says…
Hello Mario,

Here is the most important code regarding the DMA setup and
handling.

Please if there is anything you see is wrong, let me know.


Most important code is a function which you called
setupReadDMA(), it could do something really hazardous > :slight_smile:

Currently, what I see from your snippet

cedip->setupReadDma((unsigned long)(cedip->mMemOffset)
+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_LENGTH,
FG9800_DMA_CUMMON_BUFFER_LENGTH);

It is unclear which values can get mCurrentDmaOffset variable. If it
can
be only 0 and 1 (I assume you programmed DMA hardware to increment
address during transactions), it’s OK as you got place for two
buffers.

Big concern is also type of mMemOffset variable. It’s completely
unclear, and you use kinda odd casting

if(mem_offset64(mMem, NOFD, 1, (off64_t *)&mMemOffset, 0) == -1)

It should be like:

off64_t mMemOffset;

if(mem_offset64(mMem, NOFD, 1, &mMemOffset, 0) == -1)


And last, I don’t think you have to initialize event in interrupt
service routine. You should init it once, before InterruptAttach().

Regards,
Eduard.


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …
Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA
setup,
but
i can’t find what. I will try to use a different transfer
address
and
check
if that helps.

Can you post the code you use to create the share memory and setup
the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in
message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …
Hi,

I have a litle problem with the network. I am writing a
driver
for a
framegrabber that uses DMA for data transfer (i am using QNX
6.1
and
6.2).
When I start the framegrabber after some seconds and sometime
minutes,
the
network connection to/from QNX craches (actually everything
that
has
to
do
with TCPIP) but everything else on the computer works fine. I
have
checked
that the network card and the framegrabber does not share the
same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for
example
to
change
the stack size, protocol size, or anything on the network
card or
driver,
that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are
overwritting
some memory own by io-net. On each startup io-net is probably
loaded
in
the
same memory area, which explains why it’s io-net that gets
trashed.





I am open to any suggestions.

Thanks,
Antoine.










begin 666 question.cpp
M+R@06QL(‘1H92!V87)I86)L97,@=7-E9"!B971W965N(‘1H92!I;G1E<G)U
M<‘0@&%N9"!)4U(I(&9U;F-T:6]N<R!A;F0@8VQA<W-E<R!A<F4@9&5C;&%R
M960@87,@=F]L871I;&4A#0H-"G9O:60@<V]M97!L86-E(&EN(&UA:6XH
0T*
M>PT*(" @;4UE;2 ](“AU;G-I9VYE9”!C:&%R(“HI;6UA<”@@,“P@$9’.3@P
M,%]$34%?0U5-34].7T)51D9%4E],14Y’5$@I
C(L(%!23U1?4D5!1’Q04D]4
M7U=2251%?%!23U1?3D]#04-(12P@34%07U!(65-\34%07T%.3TXL($Y/1D0L
M(# I.PH@(”!I9B H;4UE;2 ]/2!-05!?1D%)3$5$2 (" @>PH@(" @("!F
M<’)I;G1F
’-T9&5R<BP@(FU-96T@9F%I;&5D(#H@)7-<;B(L(’-T<F5R<F]R
M
&5R<FYO2D[“B @(” @(&5X:70H,2D["B @('T"B @(&UE;7-E=“AM365M
M+” P+" H1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"DJ,BD["@H@
M("!I9BAM96U?;V9F<V5T-C0H;4UE;2P@3D]&1"P@,2P@&]F9C8T7W0@BDF
M;4UE;4]F9G-E="P@,"D@/3T@+3$I"B @('L
(" @(" @8V]U=" /" B7&Y
M;D5R<F]R(&EN(&=E='1I;F<@=&AE(&]F9G-E="$B(#P(&5N9&P[“B @(” @
M(&5X:70H,2D["B @('T-“GT-”@T
#0H-“B\J(0T*(“H@(” @(” @(" @5&AI
M<R!I<R!T:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860N($ET
M(&ES(‘5S960@=&@8VQE87(@=&AE(&EN=&5R<G5P="!G96YE<F%T960@8GD@
M=&AE( T*(“H@(” @(" @(" @9G)A;65G<F%B8F5R(&%N9"!S=&%R="!T:&4@
M1$U!(‘1R86YS9F5R+@T*("H-"B J#0H@B!<<’)E(" @("!.;VYE+@T(“H-
M"B J(%QP;W-T(” @($YO;F4N#0H@@T("H@7’!A<F%M(" @87)E82 @:7,@
M82!U<V5R(&1E9FEN960@<&]I;G1E<BP@:6X@=&AI<R!C87-E(&$@<&]I;G1E
M<B!T;R!T:&4@0T5$25!&1T-A<F0@;V)J96-T+@T*("H@7’!A<F%M(" @:60@
M(" @3F]T(‘5S960A#0H@@T("H@7’)E=‘5R;B @06X@979E;G0@:68@=&AE
M(&EN=&5R<G5P="!W87,@9V5N97)A=&5D(&)Y(‘1H92!F<F%M96=R86)B97(@
M;W(@3E5,3"!O=&AE<G=I<V4N#0H@B*8V]N<W0@<VEG979E;G0J(&EN=&5R
M<G5P=%-E<G9I8V52;W5T:6YE
’9O:60@F%R96$L(&EN="!I9"D>PH)<W1A
M=&EC(’-I9V5V96YT(&5V96YT.PH*(" @0T5$25!&1T-A<F0@F-E9&EP(#T@
M
$-%1$E01D=#87)D(“HI87)E83L*(” @:68H(6-E9&EP0H@(" @("!R971U
M<FX@3E5,3#L
"B @(‘5N<VEG;F5D(&-H87(@=&UP(#T@8V5D:7 M/FEN<$(H
M1D<Y.# P7T–1"D[“B @( H):68H(2AT;7 @)B P>$4P2D@+R@27,@:70@
M;W5R(&EN=&5R<G5P=#*"0ER971U<FX@3E5,3#L
"0H)4TE’159?24Y44E])
M3DE4*” F979E;G0@3L"6-E9&EP+3YM26YT5F%L=64@/2!T;7 [“B @( H)
M+R@1&%T82!&<F%M93H@0VQE87(@=&AE(&EN=&5R<G5P=”!A;F0@<W1A<G0@
M=’)A;G-F97)I;F<@=&AE(&EM86=E(&9R;VT@=&AE(&-A;65R82!T;R!T:&4@
M9G)A;65G<F%B8F5R(&-A<F0N"@EI9B@H=&UP("8@,’@X,2D@/3T@,’@X,2D*
M"7L*“2 @(&-E9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@
M?” P># R3L(" @(" @8V5D:7 M/FU);G1E<B ](#$[“B @(” @(’)E=‘5R
M;B F979E;G0["@E]"@H)+R@16YD($%C<75I<VET:6]N.B!);6%G92!T<F%N
M<V9E<F5D+"!S=&%R="!T:&4@1$U!(‘1R86YS9F5R(&)E=’=E96X@=&AE(&9R
M86UE9W)A8F)E<B!C87)D(&%N9"!T:&4@4$,N"@EI9B@H=&UP("8@,’@R-“D]
M/2 P>#(T0H)>PH)"6-E9&EP+3YS971U<%)E861$;6$H’5N<VEG;F5D(&QO
M;F<I*&-E9&EP+3YM365M3V9F<V5T2MC961I<"T^;4-U<G)E;G1$;6%/9F9S
M970J1D<Y.# P7T1-05]#54U-3TY?0E5&1D527TQ%3D=42"P@1D<Y.# P7T1-
M05]#54U-3TY?0E5&1D527TQ%3D=42"D[“B @(” @( H)“6-E9&EP+3YO=71P
M0BA&1SDX,#!?0TU$+” H=&UP(“8@,’@P-2D@?” P># X
3L*(” @(" @8V5D
M:7 M/FU);G1E<B ](#([“B @(” @(’)E='5R;B F979E;G0["@E]"@D*“2\O
M($5N9”!$34$Z(%1H92!F<F%M92!H87,@8F5E;B!T<F%N<V9E<F5D+B!!<FT@
M=&AE(&9R86UE9W)A8F)E<B!C87)D(&9O<B!S96YD:6YG(&$@;F5W(&EN=&5R
M<G5P="!W:&5N('1H92!N97AT(&9R86UE(&%R<FEV97,N"@EI9B@@'1M<" F
M(#!X-# I("8F("AC961I<"T^:6YP0BA&1SDX,#!?1$U!7T–1"D@)B P># X
M
2 I"B @('L*“0EC961I<“T^;W5T<$(H1D<Y.# P7T1-05]#340L(#!X,3 I
M.PH@(” @(” (" @(" @8V5D:7 M/FU)<U)E861Y5&]296%D1&%T82 ]('1R
M=64[“B @(” @(&-E9&EP+3YM26YT97(@/2 P.PH@(" @(" "0ER971U<FX@
M)F5V96YT.PD
"7T)"@D
"7)E=‘5R;B!.54Q,.PI]"@HOB$-“B J(” @(" @
M(" @(%1H:7,@:7,@=&AE(&EN=&5R<G5P="!T:’)E860N($ET(’-T87)T<R!T
M:&4@:6YT97)R=7!T(’-E<G9I8V4@<F]U=&EN92!T:’)E860@86YD(’=A:70@
M9F]R(&ET(‘1O(’-I9VYA;" -“B J(” @(" @(" @(’=H96X@:6YT97)R=7!T
M<R!F<F]M('1H92!F<F%M96=R86)B97(@;V-C=7)S+B!)="!T:&5N(&-L96%R
M<R!D:69F97)E;G0@<F5G:7-T97)S(&]N('1H92!00TDM8V%R9"!A;F0@8V]L
M;&5C=" -“B J(” @(" @(" @('1H92!D871A(‘1R86YS9F5R960@8GD@=&AE
M($1-02X@5VAE;B!A(&9R86UE("AI;6%G92D@:7,@<F5A9’DL(&ET(’!O<W1S
M(&$@<V5M87!H;W)E('1O(&5N86)L92!T:&4@9V5T26UA9V4@#0H@B @(" @
M(" @("!M971H;V0@=&@8V]P>2!T:&4@;&%S="!C;VQL96-T960@9G)A;64@
M
&EM86=E
2X-"B J#0H@@T("H@7’!R92 @(" @3F]N92X-“B J#0H@B!
M<&]S=" @("!.;VYE+@T
(“H-“B J(%QP87)A;2 @(‘1Y<&4@(&ES(&$@=7-E
M<B!D969I;F5D(’!O:6YT97(L(&EN(‘1H:7,@8V%S92!A(’!O:6YT97(@=&@
M=&AE($-%1$E01D=#87)D(&]B:F5C=“X-“B J#0H@B!<<F5T=7)N("!.54Q,
M+@T
(“HO"G9O:60J(&EN=&5R<G5P=%1H<F5A9"AV;VED(“IT>7!E0I["@E4
M:’)E861#=&PH7TY43U]40U1,7TE/+"!.54Q,3L"B @($-%1$E01D=#87)D
M(“IC961I<” ](“A#141)4$9’0V%R9” J
71Y<&4[“B @(&EF*”%C961I<“D*
M(” @>PH@(” @(”!C;W5T(#P(”)<;D524D]2(2!#86X@;F]T(&-O;G9E<G0@
M='EP92!T;R!#141)4$9’0V%R9”$@17AI=&EN9R!I;G1E<G)U<'0@=&AR96%D
M(2!.;R!I;G1E<G)U<'0@871T86-H960A(B /”!E;F1L.PH@(” @(”!R971U
M<FX@3E5,3#L*(" @?0H*(" @8V5D:7 M/FU);G1E<G)U<'1(86YD;&4@/2!)
M;G1E<G)U<'1!='1A8V@H8V5D:7 M/FU)4E$L(“9I;G1E<G)U<'1397)V:6-E
M4F]U=&EN92P@='EP92P@<VEZ96]F*'1Y<&4I+” P3L(" @:68H8V5D:7 M
M/FU);G1E<G)U<'1(86YD;&4@/3T@+3$I"@E["@D)<W=I=&-H*&5R<FYO0H)
M"7L
"0D)8V%S92!%04=!24XZ(&-O=70@/#P@(EQN15)23U(A($5!1T%)3B(@
M/#P@96YD;#L@8G)E86L["@D)“6-A<V4@149!54Q4.B!C;W5T(#P(”)<;D52
M4D]2(2!%1D%53%0B(#P(&5N9&P[(&)R96%K.PH)“0EC87-E($5)3E9!3#H@
M8V]U=” /" B7&Y%4E)/4B$@14E.5D%,(B /"!E;F1L.R!B<F5A:SL*“0D)
M8V%S92!%4$5233H@8V]U=” /" B7&Y%4E)/4B$@15!%4DTB(#P(&5N9&P[
M(&)R96%K.PH*“0D)9&5F875L=#H@8V]U=” /" B7&Y%4E)/4B$@1$].)U0@
M2TY/5R$A(2(@/#P@96YD;#L@8G)E86L["@D)?0H)“0H)“7)E='5R;B!.54Q,
M.PH)?0H)”@EC961I<“T^;4EN=&5R(#T@,#L*(” @”@EW:&EL92AT<G5E0H)
M>PH)“4EN=&5R<G5P=%=A:70H3E5,3"P@3E5,3"D[”@D)"@D):68H8V5D:7 M
M/FU);G1E<B ]/2 Q
2 O+R!.97<@1&%T82!F<F%M92!I;G1E<G)U<'0*(" @
M(" @>PH)“0EI;G0@:6YD97@[”@D)“69O<BAI;F1E>” ](# [(&EN9&5X(#P@
M-3 [(&EN9&5XRLI"@D)"7L"0D)“6EF*” H8V5D:7 M/FEN<$(H1D<Y.# P
M7T–1"D@)B P>#@P2 ]/2 P("D"0D)“0EB<F5A:SL*“0D)“0D*“0D)“6-E
M9&EP+3YO=71P0BA&1SDX,#!?0TU$+” H8V5D:7 M/FU);G1686QU92 F(#!X
M,#4I(‘P@,’@P,BD[”@D)“7T*“0E]”@D)96QS92!I9BAC961I<“T^;4EN=&5R
M(#T](#(I(”\O($5N9”!A8W%U:7-I=&EO;B!I;G1E<G)U<'0*(” @(” @>PD)
M(” @( H)“0EF;W(H:6YT(&EN9&5X(#T@,#L@:6YD97@@/” U,#L@:6YD97@K
MRD"0D)>PH)“0D):68H(“AC961I<“T^:6YP0BA&1SDX,#!?0TU$2 F(#!X
M,C I(#T](# I"@D)“0D)8G)E86L[”@D)“0D)”@D)"0EC961I<"T^;W5T<$(H
M1D<Y.# P7T–1"P@
&-E9&EP+3YM26YT5F%L=64@)B P># U2!(#!X,#@I
M.PH)“0E]”@D)?0H)"65L<V4@:68H8V5D:7 M/FU)<U)E861Y5&]296%D1&%T
M82D@+R@16YD($1-02!I;G1E<G)U<'0
(” @(” @>PH@(” @(" @("!C961I
M<“T^;4ES4F5A9’E4;U)E861$871A(#T@9F%L<V4[“B @(” @(” @( H@(" @
M(" @("!C961I<“T^;4EM86=E(#T@‘5N<VEG;F5D(’-H;W)T("HI&-E9&EP
M+3YM365MR@P>$$P,# P2IC961I<“T^;4-U<G)E;G1296%D3V9F<V5T3L
M(” @(” @(" @<V5M7W!O<W0H)BAC961I<“T^;5-E;6%P:&]R92DI.PH*(” @
M(" @(" @8V5D:7 M/FU#=7)R96YT4F5A9$]F9G-E=“LK.PH@(” @(" @("!I
M9BAC961I<“T^;4-U<G)E;G1296%D3V9F<V5T(#X](#(I"B @(” @(" @(" @
M(&-E9&EP+3YM0W5R<F5N=%)E861/9F9S970@/2 P.PH@(" @("!]“B @(” @
M(&5L<V4*(" @(" @>PH@(" @(" )(" O+R!$;R!N;W1H:6YG(0H@(" @("!]
7"B @('T*"0H)<F5T=7)N($Y53$P["GT
end

\

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cfevgs$s3e$1@inn.qnx.com

Hello Mario,

If i stop networking, start the application, start networking and then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.

Hello Mario,

Actually they do, for Windows. I have tried the framegrabber on Windows with
their driver and it works just fine.

I haven’t tried playing with the PCI latency, do you have any suggestions?
The Max latency for the frame grabber is set now to 0 nS and for the network
card 10 nS, according to pci -vvv

I will try to change it and see what happen…

“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cffma8$fpd$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfevgs$s3e$> 1@inn.qnx.com> …
Hello Mario,

If i stop networking, start the application, start networking and then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it
doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.

How do you change the latency settings by the way?


“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cffma8$fpd$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfevgs$s3e$> 1@inn.qnx.com> …
Hello Mario,

If i stop networking, start the application, start networking and then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it
doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cffo5t$grp$1@inn.qnx.com

Hello Mario,

Actually they do, for Windows. I have tried the framegrabber on Windows
with
their driver and it works just fine.

On the same hardware, with the same network card, while copying a file over
the network?

I haven’t tried playing with the PCI latency, do you have any suggestions?
The Max latency for the frame grabber is set now to 0 nS and for the
network
card 10 nS, according to pci -vvv

I will try to change it and see what happen…

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cffma8$fpd$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfevgs$s3e$> 1@inn.qnx.com> …
Hello Mario,

If i stop networking, start the application, start networking and then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it
doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.
\

“Antoine Haddad” <anthad@foi.se> wrote in message
news:cffon1$h6d$1@inn.qnx.com

How do you change the latency settings by the way?

In the BIOS.

Under QNX4 I remember a utility to allow you to do that, I don’t know if
it’s available under QNX6

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cffma8$fpd$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfevgs$s3e$> 1@inn.qnx.com> …
Hello Mario,

If i stop networking, start the application, start networking and then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different frame
rates, for now only 25 frame / sec. But i have tried even less, it
doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.
\

In article <cfftje$kng$1@inn.qnx.com>, nowheretobefound@8thdimension.com
says…

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cffon1$h6d$> 1@inn.qnx.com> …
How do you change the latency settings by the way?

In the BIOS.

Under QNX4 I remember a utility to allow you to do that, I don’t know if
it’s available under QNX6

You can write a small program and use pci_write_config8() function to

write needed byte at offset 0x0D. You need call pci_attach() before. If
it really can change thing you will be able to put that code in
initialization section of your driver.

Something like this:

#include <hw/pci.h>
#include <stdio.h>
#include <stdlib.h>

#define DID	0xEEEE	//device ID of framegrabber
#define VID	0xAAAA	//vendor ID of framegrabber
#define LATENCY	0x10

int main(void){
 int phndl;
 unsigned bus, devfn;
 uint8_t latency=LATENCY;

 if((phndl=pci_attach(0))==-1){
  fprintf(stderr, "\nCan't connect to the PCI server.");
  return EXIT_FAILURE;
 }
 if(pci_find_device(DID, VID, 0, &bus, &devfn)!=PCI_SUCCESS){
  fprintf(stderr, "\nCan't find framegrabber.");
  return EXIT_FAILURE;
 }

 if(pci_write_config8(bus, devfn, 0x0d, 1, &latency)!=PCI_SUCCESS){
  fprintf(stderr, "\nError writing latency register.");
  return EXIT_FAILURE;
}
 return EXIT_SUCCESS;
}

No actually, a completely different computer with a different network card.
I will try to change the network cards and see what happens.

“Mario Charest” <nowheretobefound@8thdimension.com> wrote in message
news:cffti8$kna$1@inn.qnx.com

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cffo5t$grp$> 1@inn.qnx.com> …
Hello Mario,

Actually they do, for Windows. I have tried the framegrabber on Windows
with
their driver and it works just fine.

On the same hardware, with the same network card, while copying a file
over
the network?


I haven’t tried playing with the PCI latency, do you have any
suggestions?
The Max latency for the frame grabber is set now to 0 nS and for the
network
card 10 nS, according to pci -vvv

I will try to change it and see what happen…

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cffma8$fpd$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cfevgs$s3e$> 1@inn.qnx.com> …
Hello Mario,

If i stop networking, start the application, start networking and
then
start
the DMA, the same thing happens.

The framegrabber is designed for IR-images. I an trying different
frame
rates, for now only 25 frame / sec. But i have tried even less, it
doesn’t
seem to make a differens.

I will try to talk to the manufacturer next week, and see what they
say
about all this.

Do they have a Windows driver or Linux driver. If they do you can try
your hardware with a different OS.

Have you try playing with the PCI Latency setting.


\

Ok, thanks, i will try.


“ed1k” <ed1k@fake.address> wrote in message
news:MPG.1b85e01ae7648e7b98969d@inn.qnx.com

In article <cfftje$kng$> 1@inn.qnx.com> >, > nowheretobefound@8thdimension.com
says…

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cffon1$h6d$> 1@inn.qnx.com> …
How do you change the latency settings by the way?

In the BIOS.

Under QNX4 I remember a utility to allow you to do that, I don’t know if
it’s available under QNX6

You can write a small program and use pci_write_config8() function to
write needed byte at offset 0x0D. You need call pci_attach() before. If
it really can change thing you will be able to put that code in
initialization section of your driver.

Something like this:

#include <hw/pci.h
#include <stdio.h
#include <stdlib.h

#define DID 0xEEEE //device ID of framegrabber
#define VID 0xAAAA //vendor ID of framegrabber
#define LATENCY 0x10

int main(void){
int phndl;
unsigned bus, devfn;
uint8_t latency=LATENCY;

if((phndl=pci_attach(0))==-1){
fprintf(stderr, “\nCan’t connect to the PCI server.”);
return EXIT_FAILURE;
}
if(pci_find_device(DID, VID, 0, &bus, &devfn)!=PCI_SUCCESS){
fprintf(stderr, “\nCan’t find framegrabber.”);
return EXIT_FAILURE;
}

if(pci_write_config8(bus, devfn, 0x0d, 1, &latency)!=PCI_SUCCESS){
fprintf(stderr, “\nError writing latency register.”);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

>

Hello Armin,

Yes, you are right about the SIGEV_INTR_INIT, i have changed it.

cedip->mIntValue is actually volatile.

The interrupt confirmance is not done at all, it is there only for safty
(and testing). But i have checked and that part of the code is never
executed. It is enough with whats happening int the interrupt service
routine. The reason i do it later is because i want the service routine to
be as fast (as litle time consuming) as possible, at first i had the
interrupt confirmance part in the interrupt service routine, but the result
was the same.

The interrupt thread has high priority: 55

But i don’t think this is and interrupt problem, since the framegrabber
don’t share interrupt with the network card. Interrupt problems are often
easy to find (the system would normally hang or something…)

Regards,
Antoine.

“Armin Steinhoff” <a-steinhoff@web.de> wrote in message
news:cfhp2k$2jn$1@inn.qnx.com

Antoine Haddad wrote:
Hello Mario,

Here is the most important code regarding the DMA setup and handling.

Please if there is anything you see is wrong, let me know.


SIGEV_INTR_INIT( &event ); —> not wrong, but could be done
once on a global var
cedip->mIntValue = tmp; —> volatile??
could be overwritten, so it
should be a queue to store the
reasons of interrupts

Why are you doing a lot of interrupt confirmance action in the interrupt
thread and not in the interrupt handler?? Is this timing OK??

What is the priority of the interrupt thread?? Is it too low?

Regards

Armin Steinhoff




Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cfa9t3$da0$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf9t6v$4al$> 1@inn.qnx.com> …

Hello Mario,

Yes, i am pretty sure there must be something wrong with the DMA setup,
but
i can’t find what. I will try to use a different transfer address and
check
if that helps.

Can you post the code you use to create the share memory and setup the
hardware?


Thanks,
Antoine.

“Mario Charest” <> nowheretobefound@8thdimension.com> > wrote in message
news:cf7url$jmb$> 1@inn.qnx.com> …

“Antoine Haddad” <> anthad@foi.se> > wrote in message
news:cf7sre$ib4$> 1@inn.qnx.com> …

Hi,

I have a litle problem with the network. I am writing a driver for a
framegrabber that uses DMA for data transfer (i am using QNX 6.1 and

6.2).

When I start the framegrabber after some seconds and sometime

minutes,

the

network connection to/from QNX craches (actually everything that has

to

do

with TCPIP) but everything else on the computer works fine. I have

checked

that the network card and the framegrabber does not share the same
interrupts.

Does anyone know what is causing this kind of problem?

Are there any settings that can be changed on io-net, for example to
change
the stack size, protocol size, or anything on the network card or

driver,

that can solve this kind of problem?


It’s possible something is wrong with setup of DMA and you are

overwritting

some memory own by io-net. On each startup io-net is probably loaded

in

the

same memory area, which explains why it’s io-net that gets trashed.






I am open to any suggestions.

Thanks,
Antoine.








// All the variables used between the interrupt (and ISR) functions and
classes are declared as volatile!

void someplace in main()
{
mMem = (unsigned char *)mmap( 0, (FG9800_DMA_CUMMON_BUFFER_LENGTH)*2,
PROT_READ|PROT_WRITE|PROT_NOCACHE, MAP_PHYS|MAP_ANON, NOFD, 0);
if (mMem == MAP_FAILED)
{
fprintf(stderr, “mMem failed : %s\n”, strerror(errno));
exit(1);
}

memset(mMem, 0, (FG9800_DMA_CUMMON_BUFFER_LENGTH)*2);

if(mem_offset64(mMem, NOFD, 1, (off64_t )&mMemOffset, 0) == -1)
{
cout << “\n\nError in getting the offset!” << endl;
exit(1);
}
}



/
!

  •      This is the interrupt service routine thread. It is used to
    

clear the interrupt generated by the

  •      framegrabber and start the DMA transfer.
    
  • \pre None.
  • \post None.
  • \param area is a user defined pointer, in this case a pointer to
    the CEDIPFGCard object.
  • \param id Not used!
  • \return An event if the interrupt was generated by the framegrabber
    or NULL otherwise.
    /
    const sigevent
    interruptServiceRoutine(void *area, int id)
    {
    static sigevent event;

CEDIPFGCard *cedip = (CEDIPFGCard *)area;
if(!cedip)
return NULL;

unsigned char tmp = cedip->inpB(FG9800_CMD);

if(!(tmp & 0xE0)) // Is it our interrupt?
return NULL;

SIGEV_INTR_INIT( &event );
cedip->mIntValue = tmp;

// Data Frame: Clear the interrupt and start transfering the image from
the camera to the framegrabber card.
if((tmp & 0x81) == 0x81)
{
cedip->outpB(FG9800_CMD, (tmp & 0x05) | 0x02);
cedip->mInter = 1;
return &event;
}

// End Acquisition: Image transfered, start the DMA transfer between the
framegrabber card and the PC.
if((tmp & 0x24)== 0x24)
{
cedip->setupReadDma((unsigned
long)(cedip->mMemOffset)+cedip->mCurrentDmaOffset*FG9800_DMA_CUMMON_BUFFER_L

ENGTH, FG9800_DMA_CUMMON_BUFFER_LENGTH);

cedip->outpB(FG9800_CMD, (tmp & 0x05) | 0x08);
cedip->mInter = 2;
return &event;
}

// End DMA: The frame has been transfered. Arm the framegrabber card for
sending a new interrupt when the next frame arrives.
if( (tmp & 0x40) && (cedip->inpB(FG9800_DMA_CMD) & 0x08) )
{
cedip->outpB(FG9800_DMA_CMD, 0x10);

cedip->mIsReadyToReadData = true;
cedip->mInter = 0;

return &event;
}

return NULL;
}

/*!

  •      This is the interrupt thread. It starts the interrupt
    

service routine thread and wait for it to signal

  •      when interrupts from the framegrabber occurs. It then clears
    

different registers on the PCI-card and collect

  •      the data transfered by the DMA. When a frame (image) is
    

ready, it posts a semaphore to enable the getImage

  •      method to copy the last collected frame (image).
    
  • \pre None.
  • \post None.
  • \param type is a user defined pointer, in this case a pointer to
    the CEDIPFGCard object.
  • \return NULL.
    /
    void
    interruptThread(void *type)
    {
    ThreadCtl(_NTO_TCTL_IO, NULL);

CEDIPFGCard *cedip = (CEDIPFGCard *)type;
if(!cedip)
{
cout << “\nERROR! Can not convert type to CEDIPFGCard! Exiting
interrupt thread! No interrupt attached!” << endl;
return NULL;
}

cedip->mInterruptHandle = InterruptAttach(cedip->mIRQ,
&interruptServiceRoutine, type, sizeof(type), 0);
if(cedip->mInterruptHandle == -1)
{
switch(errno)
{
case EAGAIN: cout << “\nERROR! EAGAIN” << endl; break;
case EFAULT: cout << “\nERROR! EFAULT” << endl; break;
case EINVAL: cout << “\nERROR! EINVAL” << endl; break;
case EPERM: cout << “\nERROR! EPERM” << endl; break;

default: cout << “\nERROR! DON’T KNOW!!!” << endl; break;
}

return NULL;
}

cedip->mInter = 0;

while(true)
{
InterruptWait(NULL, NULL);

if(cedip->mInter == 1) // New Data frame interrupt
{
int index;
for(index = 0; index < 50; index++)
{
if( (cedip->inpB(FG9800_CMD) & 0x80) == 0 )
break;

cedip->outpB(FG9800_CMD, (cedip->mIntValue & 0x05) | 0x02);
}
}
else if(cedip->mInter == 2) // End acquisition interrupt
{
for(int index = 0; index < 50; index++)
{
if( (cedip->inpB(FG9800_CMD) & 0x20) == 0)
break;

cedip->outpB(FG9800_CMD, (cedip->mIntValue & 0x05) | 0x08);
}
}
else if(cedip->mIsReadyToReadData) // End DMA interrupt
{
cedip->mIsReadyToReadData = false;

cedip->mImage = (unsigned short
*)(cedip->mMem+(0xA0000)*cedip->mCurrentReadOffset);
sem_post(&(cedip->mSemaphore));

cedip->mCurrentReadOffset++;
if(cedip->mCurrentReadOffset >= 2)
cedip->mCurrentReadOffset = 0;
}
else
{
// Do nothing!
}
}

return NULL;
}