home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / devices / trackdisk.i < prev   
Text File  |  1993-10-15  |  7KB  |  249 lines

  1.     IFND    DEVICES_TRACKDISK_I
  2. DEVICES_TRACKDISK_I    SET    1
  3.  
  4. **
  5. **    $VER: trackdisk.i 33.12 (28.11.90)
  6. **    Includes Release 40.15
  7. **
  8. **    trackdisk device structure and value definitions
  9. **
  10. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. **
  13.  
  14.     IFND    EXEC_IO_I
  15.     INCLUDE    "exec/io.i"
  16.     ENDC    !EXEC_IO_I
  17.  
  18.     IFND    EXEC_DEVICES_I
  19.     INCLUDE    "exec/devices.i"
  20.     ENDC    !EXEC_DEVICES_I
  21.  
  22. *--------------------------------------------------------------------
  23. *
  24. * Physical drive constants
  25. *
  26. *--------------------------------------------------------------------
  27.  
  28.  
  29. * OBSOLETE -- only valid for 3 1/4" drives.  Use the TD_GETNUMTRACKS command!
  30. *
  31. *NUMCYLS        EQU    80        ; normal # of cylinders
  32. *MAXCYLS        EQU    NUMCYLS+20    ; max # of cyls to look for
  33. *                        ;    during a calibrate
  34. *NUMHEADS    EQU    2
  35. *NUMTRACKS    EQU    NUMCYLS*NUMHEADS
  36.  
  37. NUMSECS        EQU    11
  38. NUMUNITS    EQU    4
  39.  
  40. *--------------------------------------------------------------------
  41. *
  42. * Useful constants
  43. *
  44. *--------------------------------------------------------------------
  45.  
  46.  
  47. *-- sizes before mfm encoding
  48. TD_SECTOR    EQU    512
  49. TD_SECSHIFT    EQU    9            ; log TD_SECTOR
  50. *                        ;    2
  51.  
  52.  
  53. *--------------------------------------------------------------------
  54. *
  55. * Driver Specific Commands
  56. *
  57. *--------------------------------------------------------------------
  58.  
  59. *-- TD_NAME is a generic macro to get the name of the driver.  This
  60. *-- way if the name is ever changed you will pick up the change
  61. *-- automatically.
  62. *--
  63. *-- Normal usage would be:
  64. *--
  65. *-- internalName:    TD_NAME
  66. *--
  67.  
  68. TD_NAME:    MACRO
  69.         DC.B    'trackdisk.device',0
  70.         DS.W    0
  71.         ENDM
  72.  
  73.     BITDEF    TD,EXTCOM,15
  74.  
  75.     DEVINIT
  76.     DEVCMD    TD_MOTOR        ; control the disk's motor
  77.     DEVCMD    TD_SEEK            ; explicit seek (for testing)
  78.     DEVCMD    TD_FORMAT        ; format disk
  79.     DEVCMD    TD_REMOVE        ; notify when disk changes
  80.     DEVCMD    TD_CHANGENUM        ; number of disk changes
  81.     DEVCMD    TD_CHANGESTATE        ; is there a disk in the drive?
  82.     DEVCMD    TD_PROTSTATUS        ; is the disk write protected?
  83.     DEVCMD    TD_RAWREAD        ; read raw bits from the disk
  84.     DEVCMD    TD_RAWWRITE        ; write raw bits to the disk
  85.     DEVCMD    TD_GETDRIVETYPE        ; get the type of the disk drive
  86.     DEVCMD    TD_GETNUMTRACKS        ; get the # of tracks on this disk
  87.     DEVCMD    TD_ADDCHANGEINT        ; TD_REMOVE done right
  88.     DEVCMD    TD_REMCHANGEINT        ; removes softint set by ADDCHANGEINT
  89.     DEVCMD    TD_GETGEOMETRY        ; gets the disk geometry table
  90.     DEVCMD    TD_EJECT        ; for those drives that support it
  91.     DEVCMD    TD_LASTCOMM        ; dummy placeholder for end of list
  92.  
  93.  
  94. *
  95. *
  96. * The disk driver has an "extended command" facility.  These commands
  97. * take a superset of the normal IO Request block.
  98. *
  99. ETD_WRITE    EQU    (CMD_WRITE!TDF_EXTCOM)
  100. ETD_READ    EQU    (CMD_READ!TDF_EXTCOM)
  101. ETD_MOTOR    EQU    (TD_MOTOR!TDF_EXTCOM)
  102. ETD_SEEK    EQU    (TD_SEEK!TDF_EXTCOM)
  103. ETD_FORMAT    EQU    (TD_FORMAT!TDF_EXTCOM)
  104. ETD_UPDATE    EQU    (CMD_UPDATE!TDF_EXTCOM)
  105. ETD_CLEAR    EQU    (CMD_CLEAR!TDF_EXTCOM)
  106. ETD_RAWREAD    EQU    (TD_RAWREAD!TDF_EXTCOM)
  107. ETD_RAWWRITE    EQU    (TD_RAWWRITE!TDF_EXTCOM)
  108.  
  109.  
  110. *
  111. * extended IO has a larger than normal io request block.
  112. *
  113.  
  114.  STRUCTURE IOEXTTD,IOSTD_SIZE
  115.     ULONG    IOTD_COUNT    ; removal/insertion count
  116.     ULONG    IOTD_SECLABEL    ; sector label data region
  117.     LABEL    IOTD_SIZE
  118.  
  119.  
  120. *
  121. *  This is the structure returned by TD_DRIVEGEOMETRY
  122. *  Note that the layout can be defined three ways:
  123. *
  124. *  1. TotalSectors
  125. *  2. Cylinders and CylSectors
  126. *  3. Cylinders, Heads, and TrackSectors.
  127. *
  128. *  #1 is most accurate, #2 is less so, and #3 is least accurate.  All
  129. *  are usable, though #2 and #3 may waste some portion of the available
  130. *  space on some drives. 
  131. *
  132.  
  133.  STRUCTURE DriveGeometry,0
  134.     ULONG    dg_SectorSize        ; in bytes 
  135.     ULONG    dg_TotalSectors        ; total # of sectors on drive 
  136.     ULONG    dg_Cylinders        ; number of cylinders 
  137.     ULONG    dg_CylSectors        ; number of sectors/cylinder 
  138.     ULONG    dg_Heads        ; number of surfaces 
  139.     ULONG    dg_TrackSectors        ; number of sectors/track 
  140.     ULONG    dg_BufMemType        ; preferred buffer memory type 
  141.                     ; (usually MEMF_PUBLIC)
  142.     UBYTE    dg_DeviceType        ; codes as defined in the SCSI-2 spec
  143.     UBYTE    dg_Flags        ; flags, including removable 
  144.     UWORD    dg_Reserved
  145.  LABEL dg_SIZEOF
  146.  
  147. * device types
  148. DG_DIRECT_ACCESS    EQU    0
  149. DG_SEQUENTIAL_ACCESS    EQU    1
  150. DG_PRINTER        EQU    2
  151. DG_PROCESSOR        EQU    3
  152. DG_WORM            EQU    4
  153. DG_CDROM        EQU    5
  154. DG_SCANNER        EQU    6
  155. DG_OPTICAL_DISK        EQU    7
  156. DG_MEDIUM_CHANGER    EQU    8
  157. DG_COMMUNICATION    EQU    9
  158. DG_UNKNOWN        EQU    31
  159.  
  160. * flags
  161.  BITDEF DG,REMOVABLE,0
  162.  
  163.  
  164. *
  165. * raw read and write can be synced with the index pulse.  This flag
  166. * in io request's IO_FLAGS field tells the driver that you want this.
  167. *
  168.     BITDEF    IOTD,INDEXSYNC,4
  169. *
  170. * raw read and write can be synced with a $4489 sync pattern.  This flag
  171. * in io request's IO_FLAGS field tells the driver that you want this.
  172. *
  173.     BITDEF    IOTD,WORDSYNC,5
  174.  
  175. * labels are TD_LABELSIZE bytes per sector
  176.  
  177. TD_LABELSIZE    EQU    16
  178.  
  179. *
  180. * This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  181. * the driver will allow you to open all the disks that the trackdisk
  182. * driver understands.  Otherwise only 3.5" disks will succeed.
  183. *
  184. *
  185.     BITDEF    TD,ALLOW_NON_3_5,0
  186.  
  187. *
  188. *  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  189. *  know what type of disk you really got.  These defines are for the
  190. *  TD_GETDRIVETYPE command.  In addition, you can find out how many
  191. *  tracks are supported via the TD_GETNUMTRACKS command.
  192. *
  193. DRIVE3_5    EQU    1
  194. DRIVE5_25    EQU    2
  195. DRIVE3_5_150RPM    EQU    3
  196.  
  197. *--------------------------------------------------------------------
  198. *
  199. * Driver error defines
  200. *
  201. *--------------------------------------------------------------------
  202.  
  203. TDERR_NotSpecified    EQU    20    ; general catchall
  204. TDERR_NoSecHdr        EQU    21    ; couldn't even find a sector
  205. TDERR_BadSecPreamble    EQU    22    ; sector looked wrong
  206. TDERR_BadSecID        EQU    23    ; ditto
  207. TDERR_BadHdrSum        EQU    24    ; header had incorrect checksum
  208. TDERR_BadSecSum        EQU    25    ; data had incorrect checksum
  209. TDERR_TooFewSecs    EQU    26    ; couldn't find enough sectors
  210. TDERR_BadSecHdr        EQU    27    ; another "sector looked wrong"
  211. TDERR_WriteProt        EQU    28    ; can't write to a protected disk
  212. TDERR_DiskChanged    EQU    29    ; no disk in the drive
  213. TDERR_SeekError        EQU    30    ; couldn't find track 0
  214. TDERR_NoMem        EQU    31    ; ran out of memory
  215. TDERR_BadUnitNum    EQU    32    ; asked for a unit > NUMUNITS
  216. TDERR_BadDriveType    EQU    33    ; not a drive that trackdisk groks
  217. TDERR_DriveInUse    EQU    34    ; someone else allocated the drive
  218. TDERR_PostReset        EQU    35    ; user hit reset; awaiting doom
  219.  
  220. *--------------------------------------------------------------------
  221. *
  222. * Public portion of unit structure
  223. *
  224. *--------------------------------------------------------------------
  225.  
  226.  STRUCTURE TDU_PUBLICUNIT,UNIT_SIZE
  227.     UWORD    TDU_COMP01TRACK        ; track for first precomp
  228.     UWORD    TDU_COMP10TRACK        ; track for second precomp
  229.     UWORD    TDU_COMP11TRACK        ; track for third precomp
  230.     ULONG    TDU_STEPDELAY        ; time to wait after stepping
  231.     ULONG    TDU_SETTLEDELAY        ; time to wait after seeking
  232.     UBYTE    TDU_RETRYCNT        ; # of times to retry
  233.     UBYTE    TDU_PUBFLAGS        ; public flags, see below
  234.     UWORD    TDU_CURRTRK        ; track heads are over
  235.                     ;  (ONLY ACCESS WHILE UNIT IS STOPPED!)
  236.     ULONG    TDU_CALIBRATEDELAY    ; time to wait after stepping
  237.                     ; for recalibrate
  238.     ULONG    TDU_COUNTER        ; counter for disk changes
  239.                     ;  (ONLY ACCESS WHILE UNIT IS STOPPED!)
  240.     LABEL    TDU_PUBLICUNITSIZE
  241.  
  242.  
  243. *
  244. * Flags for TDU_PUBFLAGS:
  245. *
  246.     BITDEF    TDP,NOCLICK,0        ; set to enable noclickstart
  247.  
  248.     ENDC    ; DEVICE_TRACKDISK_I
  249.