1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Device Drivers For Different IO Bus architectures

Discussion in 'Embedded' started by avsrk, Feb 8, 2007.

  1. avsrk

    avsrk Guest

    Hello Folks
    I am trying to find out some details about writing device drivers .
    If a device is capable of talking to different IO buses like PCI /
    ISA / PCI express etc .
    Is writing a driver to it on a unix / linux system be different If so
    in what way .

    To elaborate the question more let us say a particular device could
    have different firmware on so it can talk to to CPU over different IO
    Bus as required and if the interface to the layer2 / firm ware is kept
    as same as possible , would the driver writing be any different .

    Basically i am trying to find out if writing device drivers is
    different based on the IO bus used.
    I believe it should not be so , but i would like to here from the
    experts there .

    avsrk, Feb 8, 2007
    1. Advertisements

  2. It depends on the operating system of course, but for the two "big"
    OS's, Windows and Linux, there are two different Interfaces.

    On Unix, you can expect the open/close read/write ioctl model.

    On Windows, you can expect the CreateFile/CloseHandle ReadFile/
    WriteFile DeviceIoControl model.

    Principle is roughly the same, but of course, the code will be
    completely different, both in kernel-mode and user-mode.

    On Windows, bus drivers try to hide the specifics of buses as much as
    possible with bus drivers. For example, Microsoft made great effort
    to reduce the tedium of worrying about the specifics of the bus, I/O
    ports, interrupts, etc. Instead, with Plug-And-Play, the hardware
    interacts with kernel-mode components at boot time to create "a layer
    of fat" even between the already existing layer of fat that sits on
    top of the bus. That layer of fat presents, as best as it can, an
    interface that is uniform and more or less consistent between various
    network adapter drivers. The driver that the hardware manufacturer
    writes (this would be you) is called a Mini-Port, that "minimizes the
    difficulty of porting" the driver between various Windows platform
    like Intel IA-32 and MIPS.

    But the simple answer to your questions:

    1. Can I write a device driver on Windows and expect to be able to
    support it with some reasonable percentage? No.
    2. If I write a driver for PCI on Windows for network adapter, will
    much of the code be reusable to run onto a similar adapter from
    different manufacturer but with different bus? Often times yes. At
    least the function interfaces will have a lot in common.

    -Le Chaud Lapin-
    Le Chaud Lapin, Feb 9, 2007
    1. Advertisements

  3. Apart for interrupt requests (and previously set up DMA transfers),
    the device is passive and only reacts to actions by the CPU, running
    the device driver program.

    So you really have to look at the problem from the CPU point of view.
    First you have to gain access to the correct bus, then to the correct
    card (e.g. setting up some PCI registers). Doing the actual transfer
    to 8/16 data registers would be similar or identical in different

    Paul Keinanen, Feb 9, 2007
  4. Le Thu, 08 Feb 2007 12:44:14 -0800, avsrk a écrit :
    Of course it is different, on Linux at the very least.
    I think it can't be feasible to unify different I/O buses interfaces on
    the same Device driver API inside the kernel.
    See : http://www.xml.com/ldd/chapter/book/ch01.html
    Especially The Role of the Device Driver section, a very instructive
    discussion about "Policy and mechanism".
    And ...
    If you are a programmer see some piece of code if the kernel source
    tree, many years ago i started my Linux Driver readings with this :
    Cheers, Habib.
    habib.bouaziz-viallet, Feb 9, 2007
    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.