2.1 ISA Initialization and Exit Function Calls

When using Universal Driver, you must always place four specific function calls in your program. Any application using the UD API should always start with calls to dscInit and dscInitBoard and end with calls to dscFreeBoard and 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:

#include "dscud.h"

DSCB dscb;
DSCCB dsccb;

int main()
{
    if ((result = dscInit(DSC_VERSION)) != DE_NONE)
        return result;
        
    dsccb.base_address = 0x300;
    dsccb.int_level = 5;
    
    if ((result = dscInitBoard(DSC_DMM32DX, &dsccb, &dscb)) != DE_NONE)
        return result;
        
    /* Application code goes here */
    if ((result = dscFreeBoard(dscb)) != DE_NONE)
        return result;
        
    if ((result = dscFree()) != DE_NONE)
        return result;
        
    return 0;
}

In the above example, DSC_VERSION, DSC_DMM32, and DE_NONE are macros defined in the included header file, dscud.h. 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 UD-specific structure (i.e. DSCCB, or DSCAIOINT) that is defined in dscud.h and described in the Data Type Reference.

Each board must be initialized separately, and each board must also have its own unique base address and I/O address range that is different from all other boards in the system and does not overlap with any other board or system resource (such as COM port or parallel port).

Universal Driver can control up to 10 boards simultaneously. Each board has its own unique handle generated by dscInitBoard. Most PC/104 systems will not support 10 boards simultaneously, so this limit should be satisfactory for all applications.

Last updated