home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / oberon / system / amigamfm.mod (.txt) < prev    next >
Oberon Text  |  1977-12-31  |  8KB  |  166 lines

  1. Syntax10.Scn.Fnt
  2. Syntax10i.Scn.Fnt
  3. Syntax10b.Scn.Fnt
  4. MODULE AmigaMFM;    (* Marc Pilloud, 19. Apr 94 *) 
  5. IMPORT SYSTEM,  e  := AmigaExec;
  6.  *--------------------------------------------------------------------
  7.  * Physical drive constants
  8.  *--------------------------------------------------------------------
  9. (* OBSOLETE -- use the TD_GETNUMTRACKS command! *)
  10. (*#define       NUMCYLS 80*)            (*  normal # of cylinders *)
  11. (*#define       MAXCYLS (NUMCYLS+20)*)  (* max # cyls to look for during cal *)
  12. (*#define       NUMHEADS 2*)
  13. (*#define       NUMTRACKS (NUMCYLS*NUMHEADS)*)
  14. CONST
  15.   numSecs * = 9;                             (* PI: 11 -> 9 *)
  16.   numUnits * = 4;
  17.  *--------------------------------------------------------------------
  18.  * Useful constants
  19.  *--------------------------------------------------------------------
  20. (*-- sizes before mfm encoding *)
  21.   sector * = 512;
  22.   secShift * = 9;    (* log TD_SECTOR *)
  23.  *--------------------------------------------------------------------
  24.  * Driver Specific Commands
  25.  *--------------------------------------------------------------------
  26.  *-- TD_NAME is a generic macro to get the name of the driver.  This
  27.  *-- way if the name is ever changed you will pick up the change
  28.  *-- automatically.
  29.  *-- Normal usage would be:
  30.  *-- char internalName[] = TD_NAME;
  31.   name * = "mfm.device";     (* PI : trackdisk.device -> mfm.device *)
  32.   extCom * = MIN(INTEGER);          (* 8000U for internal use only! *)
  33.   motor        * = e.nonstd+0;  (* control the disk's motor *)
  34.   seek         * = e.nonstd+1;  (* explicit seek (for testing) *)
  35.   format       * = e.nonstd+2;  (* format disk *)
  36.   remove       * = e.nonstd+3;  (* notify when disk changes *)
  37.   changeNum    * = e.nonstd+4;  (* number of disk changes *)
  38.   changeState  * = e.nonstd+5;  (* is there a disk in the drive? *)
  39.   protStatus   * = e.nonstd+6;  (* is the disk write protected? *)
  40.   rawRead      * = e.nonstd+7;  (* read raw bits from the disk *)
  41.   rawWrite     * = e.nonstd+8;  (* write raw bits to the disk *)
  42.   getDriveType * = e.nonstd+9;  (* get the type of the disk drive *)
  43.   getNumTracks * = e.nonstd+10; (* # of tracks for this type drive *)
  44.   addChangeInt * = e.nonstd+11; (* TD_REMOVE done right *)
  45.   remChangeInt * = e.nonstd+12; (* remove softint set by ADDCHANGEINT *)
  46.   getGeometry  * = e.nonstd+13; (* gets the disk geometry table *)
  47.   eject        * = e.nonstd+14; (* for those drives that support it *)
  48.   lastcomm     * = e.nonstd+15;
  49.  * The disk driver has an "extended command" facility.  These commands
  50.  * take a superset of the normal IO Request block.
  51.   extWrite       * = extCom+e.write;
  52.   extRead        * = extCom+e.read;
  53.   extMotor       * = extCom+motor;
  54.   extSeek        * = extCom+seek;
  55.   extFormat      * = extCom+format;
  56.   extUpdate      * = extCom+e.update;
  57.   extClear       * = extCom+e.clear;
  58.   extRawRead     * = extCom+rawRead;
  59.   extRawWrite    * = extCom+rawWrite;
  60.  * extended IO has a larger than normal io request block.
  61.   IOExtMFMPtr * = LONGINT;      (* PI: TD -> MFM *)
  62.   IOExtMFM * = RECORD
  63.     req * : e.IOStdReq;
  64.     count * : LONGINT;
  65.     secLabel * : LONGINT;
  66.   END;
  67.  *  This is the structure returned by TD_DRIVEGEOMETRY
  68.  *  Note that the layout can be defined three ways:
  69.  *  1. TotalSectors
  70.  *  2. Cylinders and CylSectors
  71.  *  3. Cylinders, Heads, and TrackSectors.
  72.  *  #1 is most accurate, #2 is less so, and #3 is least accurate.  All
  73.  *  are usable, though #2 and #3 may waste some portion of the available
  74.  *  space on some drives.
  75.   DriveGeometryPtr * = LONGINT;
  76.   DriveGeometry * = RECORD
  77.     sectorSize * : LONGINT;          (* in bytes *)
  78.     totalSectors * : LONGINT;        (* total # of sectors on drive *)
  79.     cylinders * : LONGINT;           (* number of cylinders *)
  80.     cylSectors * : LONGINT;          (* number of sectors/cylinder *)
  81.     heads * : LONGINT;               (* number of surfaces *)
  82.     trackSectors * : LONGINT;        (* number of sectors/track *)
  83.     bufMemType * : LONGINT;          (* preferred buffer memory type *)
  84.                             (* (usually MEMF_PUBLIC) *)
  85.     deviceType * : SHORTINT;          (* codes as defined in the SCSI-2 spec*)
  86.     flags * : SHORTINT;               (* flags, including removable *)
  87.     reserved * : INTEGER;
  88.   END;
  89. CONST
  90. (* device types *)
  91.   directAccess     * = 0;
  92.   sequentialAccess * = 1;
  93.   printer          * = 2;
  94.   processor        * = 3;
  95.   worm             * = 4;
  96.   cdRom            * = 5;
  97.   scanner          * = 6;
  98.   opticalDisk      * = 7;
  99.   mediumChanger    * = 8;
  100.   communication    * = 9;
  101.   unknown          * = 31;
  102. (* flags *)
  103.   removable        * = 0;
  104. ** raw read and write can be synced with the index pulse.  This flag
  105. ** in io request's IO_FLAGS field tells the driver that you want this.
  106.   indexSync        * = 4;
  107. ** raw read and write can be synced with a 04489H sync pattern.  This flag
  108. ** in io request's IO_FLAGS field tells the driver that you want this.
  109.   wordSync         * = 5;
  110. (* labels are TD_LABELSIZE bytes per sector *)
  111.   labelSize        * = 16;
  112. ** This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  113. ** the driver will allow you to open all the disks that the trackdisk
  114. ** driver understands.  Otherwise only 3.5" disks will succeed.
  115.   allowNon35       * = 0;
  116. **  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  117. **  know what type of disk you really got.  These defines are for the
  118. **  TD_GETDRIVETYPE command.  In addition, you can find out how many
  119. **  tracks are supported via the TD_GETNUMTRACKS command.
  120.   drive35          * = 1;
  121.   drive525         * = 2;
  122.   drvie35150rpm    * = 3;
  123.  *--------------------------------------------------------------------
  124.  * Driver error defines
  125.  *--------------------------------------------------------------------
  126.   notSpecified      * = 20;      (* general catchall *)
  127.   noSecHdr          * = 21;      (* couldn't even find a sector *)
  128.   badSecPreamble    * = 22;      (* sector looked wrong *)
  129.   badSecID          * = 23;      (* ditto *)
  130.   badHdrSum         * = 24;      (* header had incorrect checksum *)
  131.   badSecSum         * = 25;      (* data had incorrect checksum *)
  132.   tooFewSecs        * = 26;      (* couldn't find enough sectors *)
  133.   badSecHdr         * = 27;      (* another "sector looked wrong" *)
  134.   writeProt         * = 28;      (* can't write to a protected disk *)
  135.   diskChanged       * = 29;      (* no disk in the drive *)
  136.   seekError         * = 30;      (* couldn't find track 0 *)
  137.   noMem             * = 31;      (* ran out of memory *)
  138.   badUnitNum        * = 32;      (* asked for a unit > NUMUNITS *)
  139.   badDriveType      * = 33;      (* not a drive that trackdisk groks *)
  140.   driveInUse        * = 34;      (* someone else allocated the drive *)
  141.   postReset         * = 35;      (* user hit reset; awaiting doom *)
  142.  *--------------------------------------------------------------------
  143.  * public portion of the unit structure
  144.  *--------------------------------------------------------------------
  145.   PublicUnitPtr * = LONGINT;
  146.   PublicUnit * = RECORD
  147.     unit * : e.Unit;   (* base message port *)
  148.     comp01Track * : INTEGER;        (* track for first precomp *)
  149.     comp10Track * : INTEGER;        (* track for second precomp *)
  150.     comp11Track * : INTEGER;        (* track for third precomp *)
  151.     stepDelay * : LONGINT;          (* time to wait after stepping *)
  152.     settleDelay * : LONGINT;        (* time to wait after seeking *)
  153.     retryCnt * : SHORTINT;          (* # of times to retry *)
  154.     pubFlags * : SHORTINT;          (* public flags, see below *)
  155.     currTrk * : INTEGER;            (* track the heads are over... *)
  156.                                     (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  157.     calibrateDelay * : LONGINT;     (* time to wait after stepping *)
  158.                                     (* during a recalibrate *)
  159.     counter * : LONGINT;            (* counter for disk changes... *)
  160.                                     (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  161.   END;
  162. CONST
  163. (* flags for tdu_PubFlags *)
  164.   noClick          * = 0;
  165. END AmigaMFM.
  166.