A way to automatically detect the base address of a PCI card

This is a discussion on A way to automatically detect the base address of a PCI card within the Windows Programming forums, part of the Platform Specific Boards category; Hi guys, I have a program that interfaces with a PCI card and it works fine, except that the needed ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    A way to automatically detect the base address of a PCI card

    Hi guys,

    I have a program that interfaces with a PCI card and it works fine, except that the needed PCI base address either has to be hard-coded or entered by the user. Ideally I would prefer for the app to automatically detect the base address of the PCI card.

    Is there a way to do this?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well, first of all, if you plan to use the address directly, don't bother - Windows won't let you directly access it, and even so, it can remap those kinds of things dynamically, anyway, so a physical address is practically useless. That said, Windows does have a standard interface for accessing hardware via IOCTL commands, though I have no idea what exactly would be needed to get access to the PCI card and it's statistics. Good luck.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by Sebastiani View Post
    Well, first of all, if you plan to use the address directly, don't bother - Windows won't let you directly access it, and even so, it can remap those kinds of things dynamically, anyway, so a physical address is practically useless.
    I'm not accessing it 'directly' as such, the drivers/code supplied do the hard work and all that is needed is for the user (or so far just me hard-coding) to supply the base address (by going to the Device Manager, clicking on the desired PCI card and getting the values under the Resources tab).

    I know that the base address is prone to change. I'm sure that this value must be held somewhere and accessible so that upon start-up, the program would retrieve the address.

    Thanks anyway.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    You can either use WMI or the SetupAPI. Both are equally fun. However, there are more examples using SetupAPI on the net - http://www.codeproject.com/KB/system/SimpleSetup.aspx

    gg

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Thanks, will definitely take a look.

    Also for anyone interested, or in the same boat, I'm currently checking out devcon.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Base Converter Part 2
    By encyclopedia23 in forum C Programming
    Replies: 2
    Last Post: 12-30-2006, 01:42 PM
  2. Bit Computation Program
    By cisokay in forum C++ Programming
    Replies: 6
    Last Post: 05-13-2005, 09:32 PM
  3. How to change number data from base 256 to base 16?
    By ooosawaddee3 in forum C++ Programming
    Replies: 2
    Last Post: 11-04-2002, 11:19 PM
  4. Virtual Base Class & Constructor :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 09-13-2002, 03:14 PM
  5. module base address
    By cppdude in forum Windows Programming
    Replies: 2
    Last Post: 03-29-2002, 05:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21