[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

The device is opened by calling the opendevice() function.  in addition to
establishing the link to the device, OpenDevice() also initializes fields
in the I/O request.  OpenDevice() has this format:

    return = OpenDevice(device_name,
                        unit_number,
                        (struct IORequest *)IORequest,
                        flags)

  * device_name is one of the following NULL-terminated strings for
    system devices:

        audio.device     parallel.device  clipboard.device
        printer.device   console.device   scsi.device
        gameport.device  serial.device    input.device
        timer.device     keyboard.device  trackdisk.device
                         narrator.device

  * unit_number is refers to one of the logical units of the device.
    Devices with one unit always use unit 0.  Multiple unit devices like
    the trackdisk device and the timer device use the different units for
    specific purposes.

  * iorequest is the structure discussed above.  some of the devices have
    their own I/O requests defined in their include files and others use
    standard I/O requests, (iostdreq).  refer to the amiga rom kernel
    Reference Manual: devices for more information.

  * flags are bits set to indicate options for some of the devices. This
    field is set to zero for devices which don't accept options when they
    are opened.  The flags for each device are explained in the Amiga ROM
    Kernel Reference Manual: devices.

  * return is an indication of whether the opendevice() was successful
    with zero indicating success.  Never assume that a device will
    successfully open.  Check the return value and act accordingly.

    Zero Equals Success for opendevice().
    -------------------------------------
    Unlike most Amiga system functions, OpenDevice() returns zero for
    success and a device-specific error value for failure.