PCI card transfer with DMA/ busmastering

Discussion in 'Windows Vista Drivers' started by googlinggoogler, Apr 17, 2006.

  1. Hiya,

    I have a custom PCI card that I intend on using as a coprocessor to
    perform large scale matrix operations on.

    As a result I wish to transfer large amounts of data to the PCI device.
    Now this is where my basic questions start.

    I've read a lot regarding DMA transfer, I assume this is the way to go.
    When I create my driver for my PCI card does the DMA stuff need to go
    here? or do I effectivly need another driver to handle DMA and
    busmastering??

    my basic goal is this -

    1)load data via CPU and "preprocess"
    2) I might have functions like this in my application
    DoMatrixMultiplication(buffer A, buffer B, buffer C), where buffer C
    returns the result and buffer A and B are the information required
    input.

    I assume that it would be best to have DoMatrixMultiplication in some
    kind of DLL, would this DLL need handle all my DMA stuff or is there a
    means of doing this without writing it myself??

    I know this is a really general question, and the reason for that is
    because I'm slightly unsure at the moment of the best way to go about
    achieving this, I do have a driver of sorts for the custom PCI card and
    this does work, its just how I go about transfering large buffers to
    and from it and where this code needs to go.

    Thanks in advance

    David
     
    googlinggoogler, Apr 17, 2006
    #1
    1. Advertisements

  2. googlinggoogler

    Mark Roddy Guest

    Your pci function driver is where your DMA operations go. You write
    one function driver for your device. Might I suggest using KMDF for a
    new PCI pnp driver rather than the old DDK interfaces?

    About your design (described below:

    1) the typical approach is to provide some sort of custom API for your
    application that handles the details of communicating with your
    driver, and specifically here with transferring the data buffer,
    describing and initiating the operations to be performed on the data
    buffer, and collecting the results when the operation completes. I
    think you more or less outline that in your description. Choosing a
    dll works as a way to package your api, as does a simple static
    library.

    2) the API is typically implemented using custom IOCTL operations that
    you define. You provide a functional call interface to your
    application, your api implementation uses your custom IOCTLs to
    implement the API.

    3) you implement the driver end of the api within your
    IRP_MJ_DEVICE_CONTROL dispatch routine - which will start the
    processing of your custom IOCTLs. As you are going to perform
    interrupt driven DMA operations, your driver end of your interface is
    going to be asynchronous.

    4) the API and its implementation are the easy part. The part where
    you are going to spend most of your efforts is creating the DMA
    infrastructure in your driver and the asynchronous completion
    mechanism for your operations.

    The data is transferred to your driver within the IOCTLs you define.
    As you are using DMA, you want to use METHOD_OUT_DIRECT data transfer
    operations that will describe your data buffer using an MDL, which MDL
    will be most useful for performing DMA.

    =====================
    Mark Roddy DDK MVP
    Windows Vista/2003/XP/2000 Consulting
    Device and Filesystem Drivers
    Hollis Technology Solutions 603-321-1032
    www.hollistech.com
     
    Mark Roddy, Apr 17, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.