home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: AssemPro For Development Amiga Driver / Lowe_AssemProForDevelopmentAmigaDriver.adf / Includes / devices / trackdisk.i < prev   
Encoding:
Text File  |  1978-06-06  |  6.9 KB  |  202 lines

  1.  
  2. ;************************************************************************
  3. ;                                                                       ;
  4. ;       Copyright (C) 1985, Commodore Amiga Inc.  All rights reserved.  ;
  5. ;                                                                       ;
  6. ;************************************************************************
  7.  
  8.  
  9. ;************************************************************************
  10. ;
  11. ; trackdisk.i
  12. ;
  13. ; Source Control
  14. ; ------ -------
  15. ; $Header: trackdisk.i,v 33.3 86/04/10 00:57:43 neil Exp $
  16. ;
  17. ; $Locker:  $
  18. ;
  19. ;************************************************************************
  20.  
  21.         IFND    DEVICES_TRACKDISK_I@
  22. DEVICES_TRACKDISK_I@     =     1
  23.  
  24.         IFND    EXEC_IO_I@
  25.         INCLUDE "exec/io.i"
  26.         ENDIF
  27.  
  28.         IFND    EXEC_DEVICES_I@
  29.         INCLUDE "exec/devices.i"
  30.         ENDIF
  31.  
  32. ;--------------------------------------------------------------------
  33. ;
  34. ; Physical drive constants
  35. ;
  36. ;--------------------------------------------------------------------
  37.  
  38.  
  39. ; OBSOLETE -- only valid for 3 1/4" drives.  Use the TD_GETNUMTRACKS command|
  40. ;
  41. ;NUMCYLS                EQU     80              ; normal # of cylinders
  42. ;MAXCYLS                EQU     NUMCYLS+20      ; max # of cyls to look for
  43. ;                                               ;       during a calibrate
  44. ;NUMHEADS       EQU     2
  45. ;NUMTRACKS      EQU     NUMCYLS*NUMHEADS
  46.  
  47. NUMSECS         EQU     11
  48. NUMUNITS        EQU     4
  49.  
  50. ;--------------------------------------------------------------------
  51. ;
  52. ; Useful constants
  53. ;
  54. ;--------------------------------------------------------------------
  55.  
  56.  
  57. ;-- sizes before mfm encoding
  58. TD_SECTOR       EQU     512
  59. TD_SECSHIFT     EQU     9                       ; log TD_SECTOR
  60. ;                                               ;    2
  61.  
  62.  
  63. ;--------------------------------------------------------------------
  64. ;
  65. ; Driver Specific Commands
  66. ;
  67. ;--------------------------------------------------------------------
  68.  
  69. ;-- TD_NAME is a generic macro to get the name of the driver.  This
  70. ;-- way if the name is ever changed you will pick up the change
  71. ;-- automatically.
  72. ;--
  73. ;-- Normal usage would be:
  74. ;--
  75. ;-- internalName:       TD_NAME
  76. ;--
  77.  
  78. TD_NAME:        MACRO
  79.                 DC.B    'trackdisk.device',0
  80.                 DS.W    0
  81.                 ENDM
  82.  
  83. ;        BITDEF  TD,EXTCOM,15
  84. TDB_EXTCOM = 15
  85. TDF_EXTCOM = 1<<15
  86.  
  87.         DEVINIT
  88.         DEVCMD  TD_MOTOR                ; control the disk's motor
  89.         DEVCMD  TD_SEEK                 ; explicit seek (for testing)
  90.         DEVCMD  TD_FORMAT               ; format disk
  91.         DEVCMD  TD_REMOVE               ; notify when disk changes
  92.         DEVCMD  TD_CHANGENUM            ; number of disk changes
  93.         DEVCMD  TD_CHANGESTATE          ; is there a disk in the drive?
  94.         DEVCMD  TD_PROTSTATUS           ; is the disk write protected?
  95.         DEVCMD  TD_RAWREAD              ; read raw bits from the disk
  96.         DEVCMD  TD_RAWWRITE             ; write raw bits to the disk
  97.         DEVCMD  TD_GETDRIVETYPE         ; get the type of the disk drive
  98.         DEVCMD  TD_GETNUMTRACKS         ; get the # of tracks on this disk
  99.         DEVCMD  TD_ADDCHANGEINT         ; TD_REMOVE done right
  100.         DEVCMD  TD_REMCHANGEINT         ; removes softint set by ADDCHANGEINT
  101.         DEVCMD  TD_LASTCOMM             ; dummy placeholder for end of list
  102.  
  103.  
  104. ;
  105. ;
  106. ; The disk driver has an "extended command" facility.  These commands
  107. ; take a superset of the normal IO Request block.
  108. ;
  109. ETD_WRITE       EQU     (CMD_WRITE|TDF_EXTCOM)
  110. ETD_READ        EQU     (CMD_READ|TDF_EXTCOM)
  111. ETD_MOTOR       EQU     (TD_MOTOR|TDF_EXTCOM)
  112. ETD_SEEK        EQU     (TD_SEEK|TDF_EXTCOM)
  113. ETD_FORMAT      EQU     (TD_FORMAT|TDF_EXTCOM)
  114. ETD_UPDATE      EQU     (CMD_UPDATE|TDF_EXTCOM)
  115. ETD_CLEAR       EQU     (CMD_CLEAR|TDF_EXTCOM)
  116. ETD_RAWREAD     EQU     (TD_RAWREAD|TDF_EXTCOM)
  117. ETD_RAWWRITE    EQU     (TD_RAWWRITE|TDF_EXTCOM)
  118.  
  119.  
  120. ;
  121. ; extended IO has a larger than normal io request block.
  122. ;
  123.  
  124.  STRUCTURE IOEXTTD,IOSTD_SIZE
  125.         ULONG   IOTD_COUNT      ; removal/insertion count
  126.         ULONG   IOTD_SECLABEL   ; sector label data region
  127.         LABEL   IOTD_SIZE
  128.  
  129. ;
  130. ; raw read and write can be synced with the index pulse.  This flag
  131. ; in io request's IO_FLAGS field tells the driver that you want this.
  132. ;
  133. ;        BITDEF  IOTD,INDEXSYNC,4
  134. IOTDB_INDEXSYNC = 4
  135. IOTDF_INDEXSYNC = 1<<4
  136.  
  137. ; labels are TD_LABELSIZE bytes per sector
  138.  
  139. TD_LABELSIZE    EQU     16
  140.  
  141. ;
  142. ; This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  143. ; the driver will allow you to open all the disks that the trackdisk
  144. ; driver understands.  Otherwise only 3.5" disks will succeed.
  145. ;
  146. ;
  147. ;        BITDEF  TD,ALLOW_NON_3_5,0
  148. TDB_ALLOW_NON_3_5 = 0
  149. TDF_ALLOW_NON_3_5 = 1<<0
  150.  
  151. ;
  152. ;  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  153. ;  know what type of disk you really got.  These defines are for the
  154. ;  TD_GETDRIVETYPE command.  In addition, you can find out how many
  155. ;  tracks are supported via the TD_GETNUMTRACKS command.
  156. ;
  157. DRIVE3_5        EQU     1
  158. DRIVE5_25       EQU     2
  159.  
  160. ;--------------------------------------------------------------------
  161. ;
  162. ; Driver error defines
  163. ;
  164. ;--------------------------------------------------------------------
  165.  
  166. TDERR_NotSpecified      EQU     20      ; general catchall
  167. TDERR_NoSecHdr          EQU     21      ; couldn't even find a sector
  168. TDERR_BadSecPreamble    EQU     22      ; sector looked wrong
  169. TDERR_BadSecID          EQU     23      ; ditto
  170. TDERR_BadHdrSum         EQU     24      ; header had incorrect checksum
  171. TDERR_BadSecSum         EQU     25      ; data had incorrect checksum
  172. TDERR_TooFewSecs        EQU     26      ; couldn't find enough sectors
  173. TDERR_BadSecHdr         EQU     27      ; another "sector looked wrong"
  174. TDERR_WriteProt         EQU     28      ; can't write to a protected disk
  175. TDERR_DiskChanged       EQU     29      ; no disk in the drive
  176. TDERR_SeekError         EQU     30      ; couldn't find track 0
  177. TDERR_NoMem             EQU     31      ; ran out of memory
  178. TDERR_BadUnitNum        EQU     32      ; asked for a unit > NUMUNITS
  179. TDERR_BadDriveType      EQU     33      ; not a drive that trackdisk groks
  180. TDERR_DriveInUse        EQU     34      ; someone else allocated the drive
  181. TDERR_PostReset         EQU     35      ; user hit reset; awaiting doom
  182.  
  183. ;--------------------------------------------------------------------
  184. ;
  185. ; Public portion of unit structure
  186. ;
  187. ;--------------------------------------------------------------------
  188.  
  189.  STRUCTURE TDU_PUBLICUNIT,UNIT_SIZE
  190.         UWORD   TDU_COMP01TRACK         ; track for first precomp
  191.         UWORD   TDU_COMP10TRACK         ; track for second precomp
  192.         UWORD   TDU_COMP11TRACK         ; track for third precomp
  193.         ULONG   TDU_STEPDELAY           ; time to wait after stepping
  194.         ULONG   TDU_SETTLEDELAY         ; time to wait after seeking
  195.         UBYTE   TDU_RETRYCNT            ; # of times to retry
  196.         LABEL   TDU_PUBLICUNITSIZE
  197.  
  198.         ENDIF    DEVICE_TRACKDISK_I
  199.         END
  200.