Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6010 register map / vxWorks driver

I've been trying to perform simple operations on the PCI-6010 in vxWorks.  Some documentation suggests that the E series multifunction boards are similar but the PCI E Series Register-Level Programmer Manual does not seem to work.  I just want to set two analog outputs to constant values (tried following example 1 for the A0 in chapter 4) and to read 4 channels cyclically at low frequencies (10 Hz max) (tried following example 2 for AI in chapter 4).  I can read and set the values in windows but without some idea of how the registers are mapped, I cannot duplicate it in vxWorks.  I do find the two BAR value and use the I/O BAR (BAR 1) but I can't really tell if I'm doing anything.  Someone has to have this interface documented somewhere.  If the 6010 does partly match the E-series, which part and what has to be done to make it work.
0 Kudos
Message 1 of 5
(8,977 Views)
Hi Pennels,
have you already downloaded the NI Measurement Hardware DDK (Driver Development Kit) from National instruments?  In the DDK you will find some Examples for M seris boards. aiex2.cpp and aiex3.cpp should provide all you need.

The user has to provide a osiUserCode method in which the bars are set. Here is an example that was written for vxWorks

//******************************************************************************
// osiUserCode.cpp --  Generic Operating System Bus Interface
//                osiUserCode.cpp includes the correct version of osiUserCode.cpp for the OS
//
//    osiUserCode.cpp holds the two user defined functions
//    needed to port iBus to a target platform.
//
//    acquireBoard(); -- constructs and initializes the iBus
//
//    releaseBoard(); -- deletes and cleans up the iBus
//
//    There are also assorted helper functions which are also
//    platform specific.
//
//******************************************************************************


    /*
    *  osiUserCode.cpp  (framework only)
    *
    *  
    *  osiUserCode.cpp holds the two user defined functions
    *  needed to port iBus to a target platform.
    *
    *  acquireBoard(); -- constructs and initializes the iBus
    *
    *  releaseBoard(); -- deletes and cleans up the iBus
    *
    *  There are also assorted helper functions which are also
    *  platform specific.
    *
    *
    */

//    Platform independent headers
    #ifndef  ___osiBus_h___
    #include "osiBus.h"
    #endif

//    System specific headers
    #include <vxWorks.h>
    #include <stdio.h>
    #include <drv/pci/pciConfigLib.h>

    struct pciResource
    {
        unsigned int bar[6];
        unsigned int barsize[6];
        int bus;
        int device;
        int func;
        char irq;
        int errcode;
    };

    typedef struct allUnitsPciRes
    {
        char deviceName[9];
        int vendorId;
        int deviceId;
        int subVendorId;
        int subSystemId;
        int classCode;
        int subClass;
        int revisionId;
        int nBARs;
        int nMmuBARs;
        int nUnits;
        struct pciResource unitPciRes[PCI_MAX_DEV];
    } ALLUNITS_PCIRES;

    /* In this structure you should find all PCI resources of all PCI-6010 boards.
        The code installs only the first one.
        If you have another structure you can use it as well*/
    extern ALLUNITS_PCIRES allPci6010Res;


    /* Return iBus of first matching PCI/PXI card.
    */
    iBus* acquireBoard(const uint32_t devicePCI_ID)
    {
        uint32_t devBAR0,devBAR1;
        //uint32_t BAR0sz,BAR1sz;
        void *mem0,*mem1;
        iBus *bus;
       

        //Find the PCI BAR memory ranges
        switch (devicePCI_ID)
        {
            /* You have to look up the correct PCI devive Id of the PCI-6010 board using
             * pciDeviceShow(...) from your vxWorks shell*/
                case 0x0000ffff:
                        devBAR0 = allPci6010Res.unitPciRes[0].bar[0];
                        devBAR1 = allPci6010Res.unitPciRes[0].bar[1];
                        break;
                default:
            devBAR0 = (uint32_t)NULL;
            devBAR1 = (uint32_t)NULL;
                        break;
        }
        mem0 =  (void *) devBAR0;
        mem1 =  (void *) devBAR1;
       
        printf("Base address devBAR0 = %10lx, Base address DAQ_STC = %10lx\n",
                devBAR0, devBAR1);
       
        //Memory map the BARs to get access to the PCI card's memory

        //create a new iBus which uses the memory mapped addresses
        bus = new iBus(0, 0, mem0, mem1);


        bus->_physBar[0] = (uint32_t)devBAR0;
        bus->_physBar[1] = (uint32_t)devBAR1;
        bus->_physBar[2] = (uint32_t)NULL;
        bus->_physBar[3] = (uint32_t)NULL;
        bus->_physBar[4] = (uint32_t)NULL;
        bus->_physBar[5] = (uint32_t)NULL;
        return bus;
    }

    void  releaseBoard(iBus *&bus)
    {
        //unmap the memory and close whatever system resources

        //were used to create the iBus

        delete bus;
    }

0 Kudos
Message 2 of 5
(8,972 Views)
The confusion may come from the board series and which ones are close.  The "preliminary" register mapping for the NI M series does not appear to be the same as the register information in the DAQ-STC Technical Reference manual.  For example, the AI_Command_1 register is shown to be at address 0x08 (word addressing) in the DAQ-STC document but at address 0x110 (I think byte addressing) in the NI M Series Register Map (Preliminary dated Sept 2005).  Since I am using a B series board (6010), should I be using the M series mapping?  (I attempted using the DAQ-STC values and it does not work.)  On top of that, the DAQ-STC document suggests using the window registers to read and write data.   Is that necessary if the B series board is mapped similar to the M series board?

Yes, I already downloaded the NI Measurement Hardware DDK and had already found and mapped the BAR addresses for the board.  I was attempting doing something with the board and that did not appear to work. 
0 Kudos
Message 3 of 5
(8,942 Views)
Hi,
sorry I did not understand that this is a B-Series board. According to information found on the NI-Site it should be rather similar to an E-Series, not an M-Series board. I could not find a register map description on the NI pages. But I would be glad abaout any hint where to find one.
0 Kudos
Message 4 of 5
(8,939 Views)
Hi All-
 
Though the PCI-6010 is a B Series board, it is based on M Series hardware.  So, the M Series MHDDK examples and reference material will be more relevant than E Series.  From an AI standpoint, the PCI-6010 is very similar to a PCI-622x M Series device.
 
Hopefully this helps-


Message Edited by Tom W [DE] on 01-18-2008 08:47 AM
Tom W
National Instruments
0 Kudos
Message 5 of 5
(8,932 Views)