[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

The Disk resource obtains exclusive access to the floppy disk hardware
There are four disk/MFM units available, units 0-3.

Six functions are available for dealing with the floppy disk hardware.

                      Disk Resource Functions
                      -----------------------
     allocunit()      allocate one of the units of the disk
                      resource.

     freeunit()       deallocate an allocated disk unit.

     getunit()        allocate the disk for a driver.

     getunitid()      return the drive id of a specified drive
                      unit.

     giveunit()       free the disk.

     readunitid()     reread and return the drive id of a
                      specified unit.

The disk resource provides both a gross and a fine unit allocation scheme.
allocunit() and freeunit() are used to claim a unit for long term use, and
getunit() and giveunit() are used to claim a unit and the disk hardware
for shorter periods.

The trackdisk device uses and abides by both allocation schemes.  Because
a trackdisk unit is never closed for Amiga 3.5" drives (the file system
keeps them open) the associated resource units will always be allocated
for these drives.  getunit() and giveunit() can still be used, however, by
other applications that have not succeeded with allocunit().

You must not change the state of of a disk that the trackdisk device is
using unless you either

   a) force its removal before giving it up, or

   b) return it to the original track (with no changes to the track), or

   c) CMD_STOP the unit before getunit(), update the current track number
      and CMD_START it after giveunit().  this option is only available
      under V36 and higher versions of the operating system.

readunitid() is provided to handle drives which use the unit number in a
dynamic manner.  Subsequent getunit() calls will return the value obtained
by ReadUnitID().

It is therefore possible to prevent the trackdisk device from using units
that have not yet been mounted by successfully performing an allocunit()
for that unit.  It is also possible to starve trackdisk usage by
performing a getunit(). the appropriate companion routine (freeunit() or
giveunit()) should be called to restore the resource at the end of its use.

     get_disk_unit_id.c 

Additional programming information on the disk resource can be found in
the include files and the Autodocs for the disk resource.

                       Disk Resource Information
                    --------------------------------
                    INCLUDES        resources/disk.h
                                    resources/disk.i

                    AUTODOCS        disk.doc