I want to get base address of PCI board

This is a discussion on I want to get base address of PCI board within the Windows Programming forums, part of the Platform Specific Boards category; Hi all, I have a simple PCI DAQ card. I want to access Base Address to controll this board directly. ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Location
    Hungary
    Posts
    4

    Question I want to get base address of PCI board

    Hi all,
    I have a simple PCI DAQ card. I want to access Base Address to controll this board directly.
    Can anybody help me how to get PCI Base Address of this board under WinXP?
    I have a dll (pcitst32.dll) what supplyed it, but it works on win98 only.
    I found a VB file next to the dll and I found a FindPciDevice(PID, VID, Index, BusNum, DevAndFunc) and a ReadConfigurationDword(BusNum, DevAndFunc, PciCsBaseAddr0, lValue) functions.
    The other VB file call this bas file with Index=0.
    The ReadConfigurationDword called 5 times. Each time called with different PciCsBaseAddr value.

    I look into dll binary code and I found it call HalGetBusData function. I have seen on the MSDN sites and say it function is obsolete. It say use IRP_MN_QUERY_INTERFACE instead HalGetBusData.
    Can I (or anybody) make a dll what I can call from any application what it will supply Base Addresses of PCI board what identified VID and PID or help with instruction what must i'm do?
    I hope so you understand what I want.

    Thank you!

    Best Regards,

    Syrius

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Even if you KNOW the base address of the board, you will need some sort of driver to access the board. Technically, you could use a small driver that just allows you to map the boards memory region into the user-mode application space, and do the rest from your user-mode application, but you still some basic driver functionality to get there.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    You'll need to get comfortable and settle down to a nice long read of
    http://www.microsoft.com/whdc/DevTools/ddk/default.mspx
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    What kind of DAQ card is it?

    Usually the vender provides drivers and a programming API.

    gg

  5. #5
    Registered User
    Join Date
    Oct 2007
    Location
    Hungary
    Posts
    4

    Question

    Quote Originally Posted by Codeplug View Post
    What kind of DAQ card is it?

    Usually the vender provides drivers and a programming API.

    gg
    This board is the MCC PCI-DAS1xxx boards. For example PCI-DAS1602/16.
    I have driver set for these boards but my challenge is to write a test program in labview what never use the VB and InstaCal because it is not comfortable to access from an application and the LabVIEW test enviroment.
    The details of original manufacturing test program in Visual Basic:

    VendorId = &H1307
    DeviceId = &H1
    Index = 0
    Call FindPciDevice(DeviceId, VendorId, Index, BusNum, DeviceAndFunc)
    If DeviceAndFunc = 0 Then
    Msg = "PCI Board Not Found!"
    Style = vbExclamation + vbOKOnly
    Title = "Detect PCI Board"
    response = MsgBox(Msg, Style, Title)
    End
    End If

    ' Find the physical location of S5933 operation Registers in I/O space
    PciCsBaseAddress0 = &H10
    PciCsBaseAddress1 = &H14
    PciCsBaseAddress2 = &H18
    PciCsBaseAddress3 = &H1C
    PciCsBaseAddress4 = &H20

    ReadStat% = ReadConfigurationDword(BusNum, DeviceAndFunc, PciCsBaseAddress0, lValue&)
    OpRegBaseAddress0& = (lValue& And &HFFFFFFFC) ' Mask 2 Lower Bits
    .
    .
    .
    and it read for four time too to read the rest of base address

    I look again the PCITst32.dll and I fount a following string in binary: \\.\CBUL32
    I have the WDM driver (CBUL32.SYS). Can I connect to driver with CreateFile function with this string?

    When installed the driver for the PCI device and look in device manager what driver addigned to device, it displayed the cbulwdm.sys. I found this file in %systemroot%DrvStore\cbi95_... folder on XP. I also found the cbul32.sys next to wdm file.

    Thanks,

    Syrius
    Last edited by Syrius; 10-09-2007 at 01:58 AM.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, you should be able to access the device through a file opened with
    Code:
    \\.\CBUL32
    . But you need to also understand how the driver expects you to communicate with the driver.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Location
    Hungary
    Posts
    4

    Question

    Quote Originally Posted by matsp View Post
    Yes, you should be able to access the device through a file opened with
    Code:
    \\.\CBUL32
    . But you need to also understand how the driver expects you to communicate with the driver.

    --
    Mats
    Thanks,

    How to understand it? Have you option for this?
    When I send this cbul32.sys driver or pcitst32.dll, can you help me for solving my problem?

    Regars,

    Syrius
    Last edited by Syrius; 10-09-2007 at 04:23 AM.

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have no idea how the driver expects you to get the data out - well, I can have a guess, but not necessarily say for sure. You may also need some ioctl calls to set up the device, or write some specific information in some way.

    You can most likely READ from the filehandle that you get back from open (and you probably can't use fopen, you'll need OpenFile() or whatever it's called).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    If you want to run on XP, you'll have to use the vender's supplied programming library.

    You can download the latest InstaCal here:
    http://www.measurementcomputing.com/...CMCV6GKPU7484B

    Their support forrum is here:
    http://forums.mccdaq.com/lofiversion/index.php/

    gg

  10. #10
    Registered User
    Join Date
    Oct 2007
    Location
    Hungary
    Posts
    4

    Exclamation

    Quote Originally Posted by Codeplug View Post
    If you want to run on XP, you'll have to use the vender's supplied programming library.

    You can download the latest InstaCal here...

    gg
    I have this software but I wrote above, the target is: NEVER use the Instacal, because it not friendly for our LabView Test Enviroment.
    I want to write a dll what I can call form LabView that supplied PCI Base Address of the daq board for register level access.
    I want to programming the PCI board in register level communication but I'm very beginner in system programming. Therefore wrote onto this forum.

    Yesterday found a string in pcitst32.dll: \\.\CBUL32
    This dll supplied information what I want, but it working only on Windows98.
    I tried connect to device driver by CreateFile(). The program successfully connected to it, but I don't know yet what IOCTL commands are expect this.

    I look drivers (cbul32.sys and cbulwdm.sys) in DeviceTree tool. It reports following:
    cbul32.sys supports following IRP function codes (have a flag for dthis driver: LEGACY_DRIVER; Service: CBUL32):
    IRP_MJ_CREATE
    IRP_MJ_CLOSE
    IRP_MJ_DEVICE_CONTROL
    IRP_MJ_CLEANUP

    The cbulwdm supports following IRP function codes (Service: cbulwdm):
    IRP_MJ_CREATE
    IRP_MJ_CLOSE
    IRP_MJ_DEVICE_CONTROL
    IRP_MJ_CLEANUP
    IRP_MJ_QUERY_POWER
    IRP_MJ_SET_POWER

    Accordingly I connected by \\.\CBUL32 to cbul32.sys?

    Syrius
    Last edited by Syrius; 10-09-2007 at 11:50 PM.

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Unfortunately, that doesn't tell you what you are expected to do with the device - it just lists the IRP types that are supported, and for exampel IRP_DEVICE_CONTROL can have many different sub functions - that is what IOCTL calls eventually become in normal cases.

    As I said earlier (but perhaps not as clearly), you need to have information from the producer of the driver how you are supposed to use the driver. The company probably does provide this if you ask nicely.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    Why do you *need* register level access?
    Does the InstaCal API's not support what you're trying to do?

    >> ...but I'm very beginner in system programming
    Your two most feasable options are:
    1) Go back to Win98
    2) Write your DLL using the InstaCal library - which knows how to communicate with the driver.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux raw socket programming
    By cnb in forum Networking/Device Communication
    Replies: 17
    Last Post: 11-08-2010, 07:56 AM
  2. What does this do (Windows API)?
    By EVOEx in forum Windows Programming
    Replies: 4
    Last Post: 12-19-2008, 09:48 AM
  3. Base Converter Part 2
    By encyclopedia23 in forum C Programming
    Replies: 2
    Last Post: 12-30-2006, 01:42 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM

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