Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "Disk Resource"
Steven Solie (talk | contribs) (Created page with "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 ...") |
m (Categorizing) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{NeedUpdate}} |
||
The Disk resource obtains exclusive access to the floppy disk hardware There are four disk/MFM units available, units 0–3. |
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. |
Six functions are available for dealing with the floppy disk hardware. |
||
− | + | '''Disk Resource Functions''' |
|
− | AllocUnit() & Allocate one of the units of the disk resource.<br /> |
||
− | FreeUnit() & Deallocate an allocated disk unit.<br /> |
||
− | GetUnit() & Allocate the disk for a driver.<br /> |
||
− | GetUnitID() & Return the drive ID of a specified drive unit.<br /> |
||
− | GiveUnit() & Free the disk.<br /> |
||
− | ReadUnitID() & Reread and return the drive ID of a specified unit.<br /> |
||
+ | {| class="wikitable" |
||
+ | | 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 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. |
||
Line 24: | Line 32: | ||
<p>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.</p></li></ol> |
<p>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.</p></li></ol> |
||
+ | 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(). |
||
− | 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. |
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. |
||
Line 32: | Line 38: | ||
Additional programming information on the disk resource can be found in the include files and the Autodocs for the disk resource. |
Additional programming information on the disk resource can be found in the include files and the Autodocs for the disk resource. |
||
+ | {| class="wikitable" |
||
− | |ll| |
||
+ | !colspan="2"|Disk Resource Information |
||
− | |||
+ | |- |
||
− | 2c'''Disk Resource Information'''<br /> |
||
− | Includes |
+ | |rowspan="2"|Includes||resources/disk.h |
+ | |- |
||
− | & resources/disk.i<br /> |
||
+ | |resources/disk.i |
||
− | AutoDocs & disk.doc<br /> |
||
+ | |- |
||
+ | |AutoDocs||[[disk.doc]] |
||
+ | |} |
Latest revision as of 23:05, 12 July 2012
This page is not yet fully updated to AmigaOS 4.x some of the information contained here may not be applicable in part or totally. |
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
force its removal before giving it up, or
return it to the original track (with no changes to the track), or
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.
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 |