[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.