C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-17-2009, 05:49 AM   #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?
binaryboy is offline   Reply With Quote
Old 11-17-2009, 06:29 AM   #2
Guest
 
Sebastiani's Avatar
 
Join Date: Aug 2001
Posts: 5,035
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.
Sebastiani is offline   Reply With Quote
Old 11-17-2009, 06:38 AM   #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.
binaryboy is offline   Reply With Quote
Old 11-17-2009, 08:23 AM   #4
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,903
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
Codeplug is offline   Reply With Quote
Old 11-17-2009, 08:28 AM   #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.
binaryboy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Base Converter Part 2 encyclopedia23 C Programming 2 12-30-2006 02:42 PM
Bit Computation Program cisokay C++ Programming 6 05-13-2005 09:32 PM
How to change number data from base 256 to base 16? ooosawaddee3 C++ Programming 2 11-05-2002 12:19 AM
Virtual Base Class & Constructor :: C++ kuphryn C++ Programming 2 09-13-2002 03:14 PM
module base address cppdude Windows Programming 2 03-29-2002 06:14 PM


All times are GMT -6. The time now is 09:52 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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