Read from PCI

I’m trying to read the data from a PCI card (PLX 9030 I/O Accelerator). The
manufacturer says “that all the addresses are just offset, you need add base
address and all DATA are 8 bits long”.

My program use the following function calls

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
real_mem = mmap_device_memory( 0, len, PROT_READ, 0,
inf.PciBaseAddress[0]);
ThreadCtl(_NTO_TCTL_IO,0);
io_adds = mmap_device_io(128,real_mem);
in8s(buff,128,io_adds);
pci_detach_device( hdl );
pci_detach( phdl );

with this, I can only read 0xffffffff for all the registers
Another option I’ve tried is

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
config = pci_read_config(hdl,offset,count,sizeof(char),buff);
pci_detach_device( hdl );
pci_detach( phdl );

With this, buff contains only static data instead of the dynamic data that
the card is generating.

Is there something wrong with these code blocks?

Thanks

You have to place the Vendor and Devices IDs of the device you want to
attach to in the info structure, before you call pci_attach_device(). You
also have to check the return code from the attach to see whether it was
successful or not.

“Antonio Diaz Couder” <antonio.diazcouder@indap.com.mx> wrote in message
news:c97vbr$ij5$1@inn.qnx.com

I’m trying to read the data from a PCI card (PLX 9030 I/O Accelerator).
The
manufacturer says “that all the addresses are just offset, you need add
base
address and all DATA are 8 bits long”.

My program use the following function calls

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
real_mem = mmap_device_memory( 0, len, PROT_READ, 0,
inf.PciBaseAddress[0]);
ThreadCtl(_NTO_TCTL_IO,0);
io_adds = mmap_device_io(128,real_mem);
in8s(buff,128,io_adds);
pci_detach_device( hdl );
pci_detach( phdl );

with this, I can only read 0xffffffff for all the registers
Another option I’ve tried is

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
config = pci_read_config(hdl,offset,count,sizeof(char),buff);
pci_detach_device( hdl );
pci_detach( phdl );

With this, buff contains only static data instead of the dynamic data that
the card is generating.

Is there something wrong with these code blocks?

Thanks

Thanks for your response.

Yes, I do that, the whole code is attached. It is supposed that on the first
8 registers (1byte = 1 regsiter) is time data,
I mean it changes every second, I can seee only static data that do not
represent the time data.
My doubt is, whether I’m doing the correct procedure to get the data from
the card or I’m reading other memory region.



“Hugh Brown” <hsbrown@qnx.com> escribió en el mensaje
news:c9f4df$4p$1@inn.qnx.com

You have to place the Vendor and Devices IDs of the device you want to
attach to in the info structure, before you call pci_attach_device(). You
also have to check the return code from the attach to see whether it was
successful or not.

“Antonio Diaz Couder” <> antonio.diazcouder@indap.com.mx> > wrote in message
news:c97vbr$ij5$> 1@inn.qnx.com> …
I’m trying to read the data from a PCI card (PLX 9030 I/O Accelerator).
The
manufacturer says “that all the addresses are just offset, you need add
base
address and all DATA are 8 bits long”.

My program use the following function calls

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
real_mem = mmap_device_memory( 0, len, PROT_READ, 0,
inf.PciBaseAddress[0]);
ThreadCtl(_NTO_TCTL_IO,0);
io_adds = mmap_device_io(128,real_mem);
in8s(buff,128,io_adds);
pci_detach_device( hdl );
pci_detach( phdl );

with this, I can only read 0xffffffff for all the registers
Another option I’ve tried is

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
config = pci_read_config(hdl,offset,count,sizeof(char),buff);
pci_detach_device( hdl );
pci_detach( phdl );

With this, buff contains only static data instead of the dynamic data
that
the card is generating.

Is there something wrong with these code blocks?

Thanks

\

begin 666 read pci code.txt
M(VEN8VQU9&4@/&AW+W!C:2YH/@T*(VEN8VQU9&4@/&AW+W!C:5]D979I8V5S
M+F@^#0HC:6YC;‘5D92 <W1D:6\N:#X-“B-I;F-L=61E(#QS=&1L:6(N:#X-
M"B-I;F-L=61E(#QS>7,O;6UA;BYH/@T*(VEN8VQU9&4@/&AW+VEN;W5T+F@^
M#0HC:6YC;'5D92 <WES+VYE=71R:6YO+F@^#0HC:6YC;‘5D92 :’<O:6YO
M=70N:#X-@T*(V1E9FEN92!00TE?5D5.1$]27TE$(#!X,3!B-0T*(V1E9FEN
M92!00TE?1$5624-%7TE$(#!X.3 S, T*#0II;G0@;6%I;B@@=F]I9" I#0I[
M#0H@(" @:6YT(’!I9’@[#0H@(" @=F]I9"H@:&1L.PT*(" @(&EN="!P:&1L
M+"!C;VYF:6<L(&QE;CL-“B @(”!S=’)U8W0@<&-I7V1E=E]I;F9O(&EN9CL-
M"@EU;G-I9VYE9"!O9F9S970[#0H)=6YS:6=N960@8V]U;G0],3(X.PT*“6-H
M87(@8G5F9ELQ,CA=+”!I+’@[#0H-"@E4:’)E861#=&PH7TY43U]40U1,7TE/
M+# I.PT*(" @#0H)+RH@0V]N;F5C="!T;R!T:&4@4$-)(’-E<G9E<B J+PT*
M(" @(’!H9&P@/2!P8VE?871T86-H*" P(“D#0H@(" @:68H(’!H9&P@/3T@
M+3$@2![#0H@(" @(" @(&9P<FEN=&8H(’-T9&5R<BP@(E5N86)L92!T;R!I
M;FET:6%L:7IE(%!#25QN(B I.PT
#0H@(" @(" @(’)E=‘5R;B!%6$E47T9!
M24Q54D4[#0H@(" @?0T*#0H@(" @+RH@26YI=&EA;&EZ92!T:&4@<&-I7V1E
M=E]I;F9O(’-T<G5C=‘5R92 J+PT*(" @(&UE;7-E="@@)FEN9BP@,“P@<VEZ
M96]F*”!I;F8@2 I.PT(" @(’!I9’@@/2 P.PT*(" @(&EN9BY696YD;W))
M9"
?240[#0H@(” @:6YF+D1E=FEC94ED(#T@4$-)7T1%
M5DE#15])1#L-"@T*(" @(&AD;" ](’!C:5]A=‘1A8VA?9&5V:6-E*"!.54Q,
M+"!00TE?24Y)5%]!3$PL(’!I9’@L(“9I;F8@3L-“B @(”!I9B@@:&1L(#T]
M($Y53$P@2![#0H@(" @(" @(&9P<FEN=&8H(’-T9&5R<BP@(E5N86)L92!T
M;R!L;V-A=&4@861A<'1E<EQN(B I.PT
(" @(‘T@96QS92![#0H@(" @(" @
M("\J($1O(’-O;65T:&EN9R!T;R!T:&4@861A<'1E<B J+PT
"0EP<FEN=&8H
M(D1E=FEC94E$(#T@)61<;B(L(&EN9BY$979I8V5)9"D[#0H)“7!R:6YT9B@B
M5F5N9&]R240@/2 E9%QN(BP@:6YF+E9E;F1O<DED3L-"@D)<’)I;G1F”)3
M=6)S>7-T96U)1” ](“5D7&XB+”!I;F8N4W5B<WES=&5M260I.PT*“0EP<FEN
M=&8H(E-U8G-Y<W1E;2!696YD;W))1” ](“5D7&XB+”!I;F8N4W5B<WES=&5M
M5F5N9&]R260I.PT*“0EP<FEN=&8H(D)U<R!N=6UB97(@/2 E9%QN(BP@:6YF
M+D)U<TYU;6)E<BD[#0H)“7!R:6YT9B@B1&5V:6-E($9U;F-T:6]N(#T@)61<
M;B(L(&EN9BY$979&=6YC3L-"@D)<’)I;G1F”)2979I<VEO;B ](“5D7&XB
M+”!I;F8N4F5V:7-I;VXI.PT*“0EP<FEN=&8H(D-L87-S(#T@)61<;B(L(&EN
M9BY#;&%S<RD[#0H)“7!R:6YT9B@B25)1(#T@)61<;B(L(&EN9BY)<G$I.PT*
M"0EP<FEN=&8H(E!#22!)+T@5’)A;G-L871I;VXQ(#T@)7A<;B(L(%!#25]-
M14U?041$4BAI;F8N4&-I0F%S94%D9’)E<W-;,%TI3L-"@D)<’)I;G1F”)0
M0TD@22]/(%1R86YS;&%T:6]N,B ](“5X7&XB+”!00TE?345-7T%$1%(H:6YF
M+E!C:4)A<V5!9&1R97-S6S%=2D[#0H)"7!R:6YT9B@B4$-)($DO3R!4<F%N
M<VQA=&EO;C,@/2 E>%QN(BP@4$-)7TU%35]!1$12
&EN9BY08VE"87-E061D
M<F5S<ULR72DI.PT*“0EP<FEN=&8H(E!#22!)+T@5’)A;G-L871I;VXT(#T@
M)7A<;B(L(%!#25]-14U?041$4BAI;F8N4&-I0F%S94%D9’)E<W-;,UTI3L-
M"@D)<’)I;G1F
”)00TD@22]/(%1R86YS;&%T:6]N-2 ](“5X7&XB+”!00TE?
M345-7T%$1%(H:6YF+E!C:4)A<V5!9&1R97-S6S1=2D[#0H)"7!R:6YT9B@B
M4$-)($DO3R!4<F%N<VQA=&EO;C8@/2 E>%QN(BP@4$-)7TU%35]!1$12
&EN
M9BY08VE"87-E061D<F5S<ULU72DI.PT*“0EP<FEN=&8H(D-052!)+T@5’)A
M;G-L871I;VXQ(#T@)7A<;B(L(%!#25]-14U?041$4BAI;F8N0W!U0F%S94%D
M9’)E<W-;,%TI3L-"@D)<’)I;G1F”)#4%4@22]/(%1R86YS;&%T:6]N,B ]
M(“5X7&XB+”!00TE?345-7T%$1%(H:6YF+D-P=4)A<V5!9&1R97-S6S%=2D[
M#0H)"7!R:6YT9B@B0U!5($DO3R!4<F%N<VQA=&EO;C,@/2 E>%QN(BP@4$-)
M7TU%35]!1$12
&EN9BY#<‘5"87-E061D<F5S<ULR72DI.PT*"0EP<FEN=&8H
M(D-052!)+T@5’)A;G-L871I;VXT(#T@)7A<;B(L(%!#25]-14U?041$4BAI
M;F8N0W!U0F%S94%D9’)E<W-;,UTI3L-"@D)<’)I;G1F”)#4%4@22]/(%1R
M86YS;&%T:6]N-2 ](“5X7&XB+”!00TE?345-7T%$1%(H:6YF+D-P=4)A<V5!
M9&1R97-S6S1=2D[#0H)"7!R:6YT9B@B0U!5($DO3R!4<F%N<VQA=&EO;C8@
M/2 E>%QN(BP@4$-)7TU%35]!1$12
&EN9BY#<‘5"87-E061D<F5S<ULU72DI
M.PT*"0EP<FEN=&8H(D)A<V4@861D<F5S<R!S:7IE,2 ](“5X7&XB+”!00TE?
M345-7T%$1%(H:6YF+D)A<V5!9&1R97-S4VEZ95LP72DI.PT*"0EP<FEN=&8H
M(D)A<V4@861D<F5S<R!S:7IE,B ](“5X7&XB+”!00TE?345-7T%$1%(H:6YF
M+D)A<V5!9&1R97-S4VEZ95LQ72DI.PT*"0EP<FEN=&8H(D)A<V4@861D<F5S
M<R!S:7IE,R ](“5X7&XB+”!00TE?345-7T%$1%(H:6YF+D)A<V5!9&1R97-S
M4VEZ95LR72DI.PT*“0EP<FEN=&8H(D)A<V4@861D<F5S<R!S:7IE-” ](“5X
M7&XB+”!00TE?345-7T%$1%(H:6YF+D)A<V5!9&1R97-S4VEZ95LS72DI.PT*
M"0EP<FEN=&8H(D)A<V4@861D<F5S<R!S:7IE-2 ](“5X7&XB+”!00TE?345-
M7T%$1%(H:6YF+D)A<V5!9&1R97-S4VEZ95LT72DI.PT*"0EP<FEN=&8H(D)A
M<V4@861D<F5S<R!S:7IE-B ](“5X7&XB+”!00TE?345-7T%$1%(H:6YF+D)A
M<V5!9&1R97-S4VEZ95LU72DI.PT*"0EP<FEN=&8H(D-052!-96T@5’)A;G-L
M871I;VX@/2 E9%QN(BP@:6YF+D-P=4UE;51R86YS;&%T:6]N3L-"@D)<’)I
M;G1F
”)#4%4@25-!(%1R86YS;&%T:6]N(#T@)61<;B(L(&EN9BY#<‘5)<V%4
M<F%N<VQA=&EO;BD[#0H)"7!R:6YT9B@B0U!5(&)U<R!M87-T97(@=’)A;G-L
M871I;VX@/2 E9%QN(BP@:6YF+D-P=4)M<W1R5’)A;G-L871I;VXI.PT*“0EP
M<FEN=&8H(E!#22!23TT@/2 E9%QN(BP@:6YF+E!C:5)O;2D#0H)"7!R:6YT
M9B@B0U!5(%)/32
<’)I;G1F*”)2
M3TT@<VEZ92 ](“5D7&XB+”!I;F8N4F]M4VEZ92D[#0H-"@D);V9F<V5T(#T@
M:6YF+E!C:4)A<V5!9&1R97-S6S!=.PT*“0EC;VYF:6<@/2!P8VE?<F5A9%]C
M;VYF:6<H:&1L+&]F9G-E=“QC;W5N=“QS:7IE;V8H8VAA<BDL8G5F9BD[#0H)
M"6EF*&-O;F9I9R ]/2!00TE?4U5#0T534RE[#0H)“0EF;W(H:3TP.VD,S([
M:2LK7L-"@D)“0EX/6DJ-#L-@D)“0EP<FEN=&8H(F)U9F8@,&@@/2 E>” E
M>" E>" E>%QN(BQB=69F6WA=+&)U9F9;>"LQ72QB=69F6W@K,ETL8G5F9EMX
M
S-=3L-"@D)“7T-”@D)?0T"0EE;’-E>PT*“0D)<’)I;G1F*”)C;VYF:6<@
M/2 E9”(L8V]N9FEG3L-"@D)?0T#0H@(” @(” @(’!C:5]D971A8VA?9&5V
M:6-E*”!H9&P@3L-“B @(”!]#0H@#0H@(" @+RH@1&ES8V]N;F5C="!F<F]M
M('1H92!00TD@<V5R=F5R(“HO#0H@(” @<&-I7V1E=&%C:"@@<&AD;" I.PT

A(" @( T*(" @(’)E='5R;B!%6$E47U-50T-%4U,[#0I]
`
end

You have to take the information in inf.PciBaseAddress[0] and do an mmap on
it depending whether it is a memory or an I/O address. If it is an I/O
address, then you do an in* instruction, else if it is a memory address,
then you will use pointers to access the memory contents.

“Antonio Diaz Couder” <antonio.diazcouder@indap.com.mx> wrote in message
news:c9fbum$5fu$1@inn.qnx.com

Thanks for your response.

Yes, I do that, the whole code is attached. It is supposed that on the
first
8 registers (1byte = 1 regsiter) is time data,
I mean it changes every second, I can seee only static data that do not
represent the time data.
My doubt is, whether I’m doing the correct procedure to get the data from
the card or I’m reading other memory region.



“Hugh Brown” <> hsbrown@qnx.com> > escribió en el mensaje
news:c9f4df$4p$> 1@inn.qnx.com> …
You have to place the Vendor and Devices IDs of the device you want to
attach to in the info structure, before you call pci_attach_device().
You
also have to check the return code from the attach to see whether it was
successful or not.

“Antonio Diaz Couder” <> antonio.diazcouder@indap.com.mx> > wrote in message
news:c97vbr$ij5$> 1@inn.qnx.com> …
I’m trying to read the data from a PCI card (PLX 9030 I/O
Accelerator).
The
manufacturer says “that all the addresses are just offset, you need
add
base
address and all DATA are 8 bits long”.

My program use the following function calls

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
real_mem = mmap_device_memory( 0, len, PROT_READ, 0,
inf.PciBaseAddress[0]);
ThreadCtl(_NTO_TCTL_IO,0);
io_adds = mmap_device_io(128,real_mem);
in8s(buff,128,io_adds);
pci_detach_device( hdl );
pci_detach( phdl );

with this, I can only read 0xffffffff for all the registers
Another option I’ve tried is

phdl = pci_attach( 0 );
memset( &inf, 0, sizeof( inf ) );
hdl = pci_attach_device( NULL, PCI_INIT_ALL, pidx, &inf );
config = pci_read_config(hdl,offset,count,sizeof(char),buff);
pci_detach_device( hdl );
pci_detach( phdl );

With this, buff contains only static data instead of the dynamic data
that
the card is generating.

Is there something wrong with these code blocks?

Thanks



\