How to use PCI DMA

Hi all,

I’ll have xilinx vertex –2 FPGA as my PCI target board. My task is to
write windows driver for above. I’ve learned how to read/write
configuration and map memory to kernel space.

Once I map memory of card to kernel space, then any write to card ‘d be
just writing to that memory (Tx fifo part of mapped memory of card). Same
for the case ‘read from card’, after getting interrupt I’ll check whether
interrupt is from this particular card and then read the memory (Rx fifo
part of mapped memory of card). Correct me if I’m wrong.

In above approach DMA doesn’t seem to come in picture and transactions ‘ll
require PC’s CPU intervention. How can I make use of DMA capabilities of
PC? Please note that my card ‘d be target only device without having any
functionality of master.

TIA,
Sanjeev

At 07:28 PM 11/7/2003 -0500, Sanjeev Manral wrote:

Hi all,

I=92ll have xilinx vertex =AD2 FPGA as my PCI target board. My task is to
write windows driver for above. I=92ve learned how to read/write
configuration and map memory to kernel space.

Once I map memory of card to kernel space, then any write to card =91d be
just writing to that memory (Tx fifo part of mapped memory of card). Same
for the case =91read from card=92, after getting interrupt I=92ll check=
whether
interrupt is from this particular card and then read the memory (Rx fifo
part of mapped memory of card). Correct me if I=92m wrong.

In above approach DMA doesn=92t seem to come in picture and transactions=
=91ll
require PC=92s CPU intervention. How can I make use of DMA capabilities of
PC? Please note that my card =91d be target only device without having any
functionality of master.

Hi Sanjeev,

Slave DMA is an ISA bus thing. There is no slave DMA for PCI cards. If you=
=20
need to do DMA then you have to build DMA bus master capability on your PCI=
=20
card.

Russ Poffenberger
NPTest, Inc.
xxxxx@NPTest.com

Thanks Russ,

I studied Bus master DMA, I’ve to use ioGetDmaAdaptor. There are two types
of Bus Master DMA. Packet based and common buffer. Is the choice between
packet based and common buffer, hardware dependent? Or driver programmer
can choose any.

What ‘d be the transfer sequence for bus Master DMA? ‘d it be the same-
Once I map memory of card to kernel space, then any write to card ‘d be
just writing to that memory (Tx fifo part of mapped memory of card). Same
for the case ‘read from card’, after getting interrupt I’ll check whether
interrupt is from this particular card and then read the memory (Rx fifo
part of mapped memory of card).

TIA,
Sanjeev

At 07:28 PM 11/7/2003 -0500, Sanjeev Manral wrote:
>Hi all,
>
>I=92ll have xilinx vertex =AD2 FPGA as my PCI target board. My task is to
>write windows driver for above. I=92ve learned how to read/write
>configuration and map memory to kernel space.
>
>Once I map memory of card to kernel space, then any write to card =91d be
>just writing to that memory (Tx fifo part of mapped memory of card). Same
>for the case =91read from card=92, after getting interrupt I=92ll check=
whether
>interrupt is from this particular card and then read the memory (Rx fifo
>part of mapped memory of card). Correct me if I=92m wrong.
>
>In above approach DMA doesn=92t seem to come in picture and transactions=
=91ll
>require PC=92s CPU intervention. How can I make use of DMA capabilities of
>PC? Please note that my card =91d be target only device without having any
>functionality of master.

Hi Sanjeev,

Slave DMA is an ISA bus thing. There is no slave DMA for PCI cards. If you=
=20
need to do DMA then you have to build DMA bus master capability on your PCI=
=20
card.

Russ Poffenberger
NPTest, Inc.
xxxxx@NPTest.com

Packet or common buffer is usually hardware dependent. Common buffers are
guaranteed to be logically contiguous, so hardware requiring contiguous
memory for DMA will require a common buffer in your driver.

As far as packet based DMA goes, if you have any control over the hardware
design, it is often advantageous to ensure your hardware is scatter/gather
DMA capable. Scatter/gather DMA is the fastest DMA method available for PCI
cards on Windows platforms, and with the DDK scatter/gather specific
functions (GetScatterGather et.al.), it is also fairly straightforward.
Sometimes scatter/gather hardware requires the scatter/gather list itself to
be in logically contiguous memory, and thus your driver may need a common
buffer for the list.


Bill McKenzie
Compuware Corporation
Watch your IRPs/IRBs/URBs/SRBs/NDIS pkts with our free WDMSniffer tool:
http://frontline.compuware.com/nashua/patches/utility.htm

“Sanjeev Manral” wrote in message
news:xxxxx@ntdev…
>
> Thanks Russ,
>
> I studied Bus master DMA, I’ve to use ioGetDmaAdaptor. There are two types
> of Bus Master DMA. Packet based and common buffer. Is the choice between
> packet based and common buffer, hardware dependent? Or driver programmer
> can choose any.
>
> What 'd be the transfer sequence for bus Master DMA? 'd it be the same-
> Once I map memory of card to kernel space, then any write to card 'd be
> just writing to that memory (Tx fifo part of mapped memory of card). Same
> for the case ‘read from card’, after getting interrupt I’ll check whether
> interrupt is from this particular card and then read the memory (Rx fifo
> part of mapped memory of card).
>
> TIA,
> Sanjeev
>
>
> > At 07:28 PM 11/7/2003 -0500, Sanjeev Manral wrote:
> > >Hi all,
> > >
> > >I=92ll have xilinx vertex =AD2 FPGA as my PCI target board. My task is
to
> > >write windows driver for above. I=92ve learned how to read/write
> > >configuration and map memory to kernel space.
> > >
> > >Once I map memory of card to kernel space, then any write to card =91d
be
> > >just writing to that memory (Tx fifo part of mapped memory of card).
Same
> > >for the case =91read from card=92, after getting interrupt I=92ll
check=
> > whether
> > >interrupt is from this particular card and then read the memory (Rx
fifo
> > >part of mapped memory of card). Correct me if I=92m wrong.
> > >
> > >In above approach DMA doesn=92t seem to come in picture and
transactions=
> > =91ll
> > >require PC=92s CPU intervention. How can I make use of DMA capabilities
of
> > >PC? Please note that my card =91d be target only device without having
any
> > >functionality of master.
> >
> > Hi Sanjeev,
> >
> > Slave DMA is an ISA bus thing. There is no slave DMA for PCI cards. If
you=
> > =20
> > need to do DMA then you have to build DMA bus master capability on your
PCI=
> > =20
> > card.
> >
> >
> > Russ Poffenberger
> > NPTest, Inc.
> > xxxxx@NPTest.com
>
>