LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing ports on PC motherboard (inb and outb equivalents)

I have a VPX-based system with a TR 805/39x PC card in it (running Windows 7). I need to access the Filed Replaceable Unit (FRU) to extract the serial number of the PC card. I have the C code to do this but I need to get it working in LabVIEW (which runs on the Windows 7 PC card).

 

The C code (written in LINUX I think) communicates with an IPMI controller (using a standard BMC-SMIC interface) and creates buffers to retrieve strings from the controller etc.

 

The code basically boils down to a couple of low level C functions: inb() and outb(), which access ports on the motherboard of the PC.

 

I have the C code to do this (but no application to run it) and I can't figure out how to write equivalent code to access the IO ports in LabVIEW.

 

Has anyone got experience with anything like this? I've looked in to the In Port and Out Port VI's but these seem to be for the parallel port only. Below is the basic architecture of an IPMI-style system:

 

IPMI Architecture

0 Kudos
Message 1 of 5
(4,464 Views)

You can't really do that under Windows. inb and outb are privileged opcodes that can only be executed in protected ring 0. This is however strictly reserved for kernel space components. There is no easy way to make those opcodes executable from ring 3, which is where any user space application including LabVIEW executes. In old days there used to be a possibilty to enable ring 3 access to a predefined range of IO adresses through a kernel driver extension. The OpenG project PortIO made use of that. However the extension used in there is already declared obsolete by Microsoft since Windows 2000 and it seems they finally axed that extension for good in all 64 bit variants of Windows.

 

So if you are sure you only ever want to use this in 32 bit Windows, you can look into the OpenG project portIO which was never released as an installable package, but the code is accessible in the SVN repository of the OpenG project on sourceforge. If this will need to run under 64 bit Windows eventually, there is really no way around writing a kernel device driver for your card if it doesn't already exist.

 

Another option that might work, but not sure how well this is tested under 64 bit Windows, might be memory access through a VISA raw IO driver. I know that it worked for others under 32 bit Windows and it is likely that the VISA developers have ported that mechanisme to their 64 bit VISA driver, but I can't vouch that it actually works. It would seem to me a less enough exercised feature of the VISA driver that any existing troubles in the 64 bit version haven't really been adressed yet.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 5
(4,432 Views)

Thanks for the reply Rolf. Our operating system will always be 64-bit, but our version of LabVIEW will always be 32-bit (due to unsupported features in 64-bit LabVIEW). I'm stuck in a bit of a quandary here - I just want to retrieve the serial number but the amount of work required too do this may be disproportionate to the eventual result.

 

The supplier of the PC card has sent some software to us in the form of DLL's too. However, the DLL's are for either 32-bit or 64-bit systems. So I can't get LabVIEW to use a 64-bit DLL and LabVIEW crashes if I try use the 32-bit DLL.

 

I'll probably have to abandon at this point so thanks again for the detailed repsonse.

0 Kudos
Message 3 of 5
(4,412 Views)

The kernel driver portion to access hardware always has to match the bitness of the OS. So the OpenG PortIO solution never will work on a 64 bit Windows system, independant if you use LabVIEW 32 bit or LabVIEW 64 bit. And yes it would seem to me that the effort to get this working, independent if you use NI-VISA memory access or your own kernel driver will be disproportional to the intended benefit in this case, with the NI-VISA solution most likely being a bit simpler than writing your own kernel driver. Debugging kernel drivers is a VERY cumbersome experience.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 5
(4,407 Views)

A few months late; I'm just learning about using IPMI in different scenarios.

 

Could you use the ipmiutil library to access the BMC?

 

http://ipmiutil.sourceforge.net/

 

It seems that you could install the 64 bit version for your OS and call the command line functions from 32-bit LV with System Exec.vi.

 

 

0 Kudos
Message 5 of 5
(4,244 Views)