Device Function Group

All I/O functions must be initiated with DRV_DeviceOpen, which opens a device via Device file to return the driver handle of the device. With the driver handle, user can use the device to perform I/O operations by calling various functions. Call DRV_DeviceClose to finish the operation and free the resources allocated by DRV_DeviceOpen.

The calling flow is shown as below:
 

Device file (Type: string)

Device file specifies the device on which you want to perform the I/O operations.

For example, a device has association with a device file "/dev/advdaq0" using advdevice_bind utility. You can assign the device file "/dev/advdaq0" to the function DRV_DeviceOpen directly.

DRV_DeviceOpen and DRV_DeviceClose Functions

DRV_DeviceOpen initializes the device specified by device file. This function must be called before any other methods that perform I/O operations. DRV_DeviceClose is the counterpart function of the DRV_DeviceOpen function. Its purpose is to close the device.

Driver Handle (Type: Long, Size: 4 bytes)

Driver Handle is returned by DRV_DeviceOpen. It points to the structure that keeps the settings of a device. The subsequent functions require the use of Driver Handle, instead of device file, to represent the desired device.

Error code(Type: Unsigned Long, Size: 4 bytes) and DRV_GetErrorMessage

Each driver function returns an Error Code that indicates whether or not the function was performed successfully. If the function has failed to perform, it will return a code that is non-zero. The error code may be passed to the DRV_GetErrorMessage function to retrieve its error message.