(Page 32 of 80 in this chapter)


adiOpenDriver

Description

Opens an instance of the AG driver.

Prototype

DWORD adiOpenDriver (unsigned *drvid,
MUX_HANDLE *muxhandle )

drvid Driver ID that is returned to the application (the drvid is then used when opening contexts or retrieving events).

muxhandle An operating system handle returned to the application. The MUX_HANDLE type definition (typedef) is operating-system-specific as listed below (refer to the nmstypes.h include file):

UNIX: muxhandle is the file descriptor and is used when invoking poll.

OS/2: muxhandle is an event semaphore handle and used when invoking DosWaitEventSem.

NT: muxhandle is an unnamed event-object handle and is used for any Win32 wait function.

Return Values

Events

None.

Details

This function opens the AG driver which is used to communicate with the AG boards. The application must supply the drvid when opening contexts (see adiOpenPort) or when processing AG events (see adiFetchAndProcess). The relationship of drivers to ports, contexts and events is discussed in detail in the Application Development section of the AG Access Developer's Manual.

The drvid is also required to access functions pertaining to board configuration.

See Also

adiCloseDriver, adiFetchAndProcess, adiOpenPort, adiGetBoardSlots, adiGetBoardInfo, adiGetEEPromData

Example


extern unsigned   drvid;     /* driver id */
extern MUX_HANDLE muxhandle; /* muxable handle for event queue */

/* A skeleton ADI application. */
void main( void )
{
    adiOpenDriver( &drvid, &muxhandle );

    /*
     * ...
     *
     * (Open and close contexts and so forth, processing events using
     * adiFetchAndProcess.)
     */

    /* When the work is done, close the driver, rendering drvid invalid. */
    adiCloseDriver( drvid );
}




(Page 32 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.