LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically determine PCI device ID

Solved!
Go to solution

Hello again all you helpful forum-goers!

 

I am writing an application to supply output to and read input from an ARINC PCI card, specifically the RCEI-530 from GE Intelligent Platforms.  Now their LabVIEW drivers and documentation is pretty good, but one of the things I'm having trouble with is how to determine the Board ID.

 

The documentation for this Board ID includes the statement "For PCI devices, this board number must correspond to the Device ID assigned when the API installation and corresponding device was installed."  I'm sure that I could discover this using MAX, but what I really want is to determine if the laptop running my application has this particular ARINC card in it, and if so what its Device ID is, all programmatically without the user having to select it or install MAX, etc.

 

I'm hopeful that this is doable, but I haven't managed to find the right VIs searching through this forum and in the LabVIEW palettes.  If someone could point me in the right direction (or definitively state that it can't be done programmatically), I would be very appreciative.  🙂

 

Thanks in advance!

 

-Joe

0 Kudos
Message 1 of 7
(3,968 Views)

Generic PCI devices like that wouldn't show up in MAX. Are you saying yours does?

 

If their drivers don't provide a means of finding the PCI device ID, then you will likely need to resort to an operating system call to get this information. How you do this depends on the OS. On Windows you can also use the devcon utility (Google it).

0 Kudos
Message 2 of 7
(3,966 Views)

Thanks for the hint, smercurio_fc, but the DevCon utility appears to be non-distributable (see http://support.microsoft.com/kb/311272), which I take to mean that I would not be able to legally use it in my code which I am selling to customers.

 

I did not meant to imply that my card shows up in MAX, as unfortunately I have not received it yet!  😉  That will come later this month.  I figured I would get a head start on the code development since I was able to download the drivers ahead of time.

 

I am in fact using Windows XP and Windows 7, so any other suggestions for discovering device IDs programmatically on those platforms is welcome.

 

-Joe

0 Kudos
Message 3 of 7
(3,957 Views)

The low level approach to this is to use the Windows SetupAPI such as SetupDiGetClassDevs() to enumerate specific hardware resources. You will need to find out the manufacturer PCI ID and call several SetupAPI functions to enumerate all cards that match the specified manufacturer. The setupAPI is however not really an API that lends itself to be called directly through the Call Library Node, since it requiures some pretty extensive data structures as parameters.My approach in the past has been to write a small DLL that would call the relevent Windows API calls and provide a much more simply interface to LabVIEW.

 

A more high level approach probably exists in .Net, but I'm not familiar at all with that.

 

Whatever you choose, you won't have any success to test your approach with hardware that is not physically plugged into the computer and a driver for it is successfully installed.

Rolf Kalbermatter
My Blog
Message 4 of 7
(3,951 Views)

I know the devcon source code is available so you could download it and see how they did it, and then you could whip up your own DLL.

 

You might also be able to get this information from the registry HKLM\System\CurrentControlSet\Enum.

 

As for a .NET solution, the System.Management class would be the one to hit. Examples of using this class have been posted before.

Message 5 of 7
(3,947 Views)

Thank you to the both of you, I will probably end up putting together my own DLL using those functions.  I know it won't be testable until I get the actual card, but getting a head start is always good.  🙂

 

-Joe

0 Kudos
Message 6 of 7
(3,940 Views)
Solution
Accepted by topic author jmorris

Just in case anyone else finds this thread useful in the future, I got the following response from GE Intelligent Platforms (from whom I bought the card), which indicates there will be a relatively simple way to accomplish my goal using the provided LabVIEW drivers.  I have not tried it yet so I cannot guarantee its effectiveness, but it sounds good.  🙂

 

If the only GE Avionics board installed were the RCEI-530, there would be no issue invoking AR_Board_Init until you encounter a passing status; however, if there are other boards installed AND the CEI-x30-SW distribution is installed on that host, there is a mechanism to check board types.

 

The VI AR_Query_Device VI provided in CEI-LV Version 4.10 (latest version and most likely the one you would have received if purchased with the RCEI-530), can be used in the following sequence to cleanly check device number allocation on your system without actually opening a session and initializing the board.

 

1) Invoke AR_LoadDLL.vi with the System Type In control defined to be "CEI-x30".

2) Invoke AR_Query_Device.vi in a loop (BoardIDIn control incrementing from 0 to 15) until the Board Type indicator is returned as 26 (type for RCEI-530) AND the errorOut.code is "1".  The corresponding BoardIDOut indicator will be the Device ID for that RCEI-530.  Board types for this VI are described in the on-line and printed documentation for CEI-LV VIs.

3) If you will proceed to execute your application, you can just proceed by invoking the AR_LoadSlv VI and forgo AR_Board_Init (as AR_Board_Init is just a combination of AR_LoadDLL and AR_LoadSlv).

4) If you intend on using this to run with any other board type other than a CEI-x30 board, you should invoke AR_UnloadDll.vi to remove the CEI-x30 API library from memory.

0 Kudos
Message 7 of 7
(3,915 Views)