2.2 PCI Initialization and Exit Function Calls

When using Universal Driver in PCI card, you must always place three specific function calls in your program. Any application using the UD API should always start with calls to dscInit and dscPCIInitBoard and end with calls dscFree. These calls are important in initializing and freeing resources used by the driver. Here is an example of the framework for an application using the driver

using DSCUD_Library;

namespace DMM16RPAT
{
    class DMM16RPATClass
    {
        static int Main(string[] args)
        {
            DSCCBP dsccbp = new DSCCBP();
            DSCUD_Class DSCUD_class = new DSCUD_Library.DSCUD_Class();

            if ((result = (DSCUD_Library.DSCUD_Class.dscInit(DSCUD_class.DSC_VERSION) )) != DSCUD_class.DE_NONE)
                return result;

            dsccbp.boardtype = DSCUD_class.DSC_DMM16RPAT_PCI;
            dsccbp.pci_slot = 0;

            if ((result = (DSCUD_Library.DSCUD_Class.dscPCIInitBoard(DSCUD_class.DSC_DMM16RPAT_PCI, ref dsccbp, ref DSCUD_class.dscb) )) != DSCUD_class.DE_NONE)
                return result;

	        /* Application code goes here */

            if ((result = (DSCUD_Library.DSCUD_Class.dscFree() )) != DSCUD_class.DE_NONE)
                return result;

	        return 0;

         }
    }
}

In the above example, DSC_VERSION, DSC_DMM16RPAT_PCI, and DE_NONE are macros defined in the C# DSCUD Library. Calls to any UD API function are always of the form, dsc[...], where [...] is a specific function (i.e., ADSample as in dscADSample). Most function calls using the driver require the initialization of a PCI UD-specific structure (i.e. DSCCBP) that is defined in C# DSCUD Library and described in the Data Type Reference.

Last updated