home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / devices / trackdisk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  5.7 KB  |  195 lines

  1. #ifndef DEVICES_TRACKDISK_H
  2. #define DEVICES_TRACKDISK_H
  3. /*
  4. **    $Filename: devices/trackdisk.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_IO_H
  14. #include "exec/io.h"
  15. #endif !EXEC_IO_H
  16.  
  17. #ifndef EXEC_DEVICES_H
  18. #include "exec/devices.h"
  19. #endif !EXEC_DEVICES_H
  20.  
  21. /*
  22.  *--------------------------------------------------------------------
  23.  *
  24.  * Physical drive constants
  25.  *
  26.  *--------------------------------------------------------------------
  27.  */
  28.  
  29. /* OBSOLETE -- use the TD_GETNUMTRACKS command! */
  30. /*#define    NUMCYLS 80*/        /*  normal # of cylinders */
  31. /*#define    MAXCYLS (NUMCYLS+20)*/    /* max # cyls to look for during cal */
  32. /*#define    NUMHEADS 2*/
  33. /*#define    NUMTRACKS (NUMCYLS*NUMHEADS)*/
  34.  
  35. #define NUMSECS 11
  36. #define NUMUNITS 4
  37.  
  38. /*
  39.  *--------------------------------------------------------------------
  40.  *
  41.  * Useful constants
  42.  *
  43.  *--------------------------------------------------------------------
  44.  */
  45.  
  46. /*-- sizes before mfm encoding */
  47. #define TD_SECTOR 512
  48. #define TD_SECSHIFT 9        /* log TD_SECTOR */
  49.  
  50. /*
  51.  *--------------------------------------------------------------------
  52.  *
  53.  * Driver Specific Commands
  54.  *
  55.  *--------------------------------------------------------------------
  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.  *-- char internalName[] = TD_NAME;
  66.  *--
  67.  */
  68.  
  69. #define TD_NAME "trackdisk.device"
  70.  
  71. #define TDF_EXTCOM (1<<15)        /* for internal use only! */
  72.  
  73.  
  74. #define TD_MOTOR    (CMD_NONSTD+0)    /* control the disk's motor */
  75. #define TD_SEEK        (CMD_NONSTD+1)    /* explicit seek (for testing) */
  76. #define TD_FORMAT    (CMD_NONSTD+2)    /* format disk */
  77. #define TD_REMOVE    (CMD_NONSTD+3)    /* notify when disk changes */
  78. #define TD_CHANGENUM    (CMD_NONSTD+4)    /* number of disk changes */
  79. #define TD_CHANGESTATE    (CMD_NONSTD+5)    /* is there a disk in the drive? */
  80. #define TD_PROTSTATUS    (CMD_NONSTD+6)    /* is the disk write protected? */
  81. #define TD_RAWREAD    (CMD_NONSTD+7)    /* read raw bits from the disk */
  82. #define TD_RAWWRITE    (CMD_NONSTD+8)    /* write raw bits to the disk */
  83. #define TD_GETDRIVETYPE (CMD_NONSTD+9)    /* get the type of the disk drive */
  84. #define TD_GETNUMTRACKS (CMD_NONSTD+10) /* # of tracks for this type drive */
  85. #define TD_ADDCHANGEINT (CMD_NONSTD+11) /* TD_REMOVE done right */
  86. #define TD_REMCHANGEINT (CMD_NONSTD+12) /* remove softint set by ADDCHANGEINT */
  87.  
  88. #define TD_LASTCOMM    (CMD_NONSTD+13)
  89.  
  90. /*
  91.  *
  92.  * The disk driver has an "extended command" facility.    These commands
  93.  * take a superset of the normal IO Request block.
  94.  *
  95.  */
  96.  
  97. #define ETD_WRITE    (CMD_WRITE|TDF_EXTCOM)
  98. #define ETD_READ    (CMD_READ|TDF_EXTCOM)
  99. #define ETD_MOTOR    (TD_MOTOR|TDF_EXTCOM)
  100. #define ETD_SEEK    (TD_SEEK|TDF_EXTCOM)
  101. #define ETD_FORMAT    (TD_FORMAT|TDF_EXTCOM)
  102. #define ETD_UPDATE    (CMD_UPDATE|TDF_EXTCOM)
  103. #define ETD_CLEAR    (CMD_CLEAR|TDF_EXTCOM)
  104. #define ETD_RAWREAD    (TD_RAWREAD|TDF_EXTCOM)
  105. #define ETD_RAWWRITE    (TD_RAWWRITE|TDF_EXTCOM)
  106.  
  107. /*
  108.  *
  109.  * extended IO has a larger than normal io request block.
  110.  *
  111.  */
  112.  
  113. struct IOExtTD {
  114.     struct    IOStdReq iotd_Req;
  115.     ULONG    iotd_Count;
  116.     ULONG    iotd_SecLabel;
  117. };
  118.  
  119. /*
  120. ** raw read and write can be synced with the index pulse.  This flag
  121. ** in io request's IO_FLAGS field tells the driver that you want this.
  122. */
  123.  
  124. #define IOTDB_INDEXSYNC 4
  125. #define IOTDF_INDEXSYNC (1<<4)
  126.  
  127.  
  128. /* labels are TD_LABELSIZE bytes per sector */
  129.  
  130. #define TD_LABELSIZE 16
  131.  
  132. /*
  133. ** This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  134. ** the driver will allow you to open all the disks that the trackdisk
  135. ** driver understands.    Otherwise only 3.5" disks will succeed.
  136. */
  137.  
  138. #define TDB_ALLOW_NON_3_5    0
  139. #define TDF_ALLOW_NON_3_5    (1<<0)
  140.  
  141. /*
  142. **  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
  143. **  know what type of disk you really got.  These defines are for the
  144. **  TD_GETDRIVETYPE command.  In addition, you can find out how many
  145. **  tracks are supported via the TD_GETNUMTRACKS command.
  146. */
  147.  
  148. #define DRIVE3_5    1
  149. #define DRIVE5_25    2
  150.  
  151. /*
  152.  *--------------------------------------------------------------------
  153.  *
  154.  * Driver error defines
  155.  *
  156.  *--------------------------------------------------------------------
  157.  */
  158.  
  159. #define TDERR_NotSpecified    20    /* general catchall */
  160. #define TDERR_NoSecHdr        21    /* couldn't even find a sector */
  161. #define TDERR_BadSecPreamble    22    /* sector looked wrong */
  162. #define TDERR_BadSecID        23    /* ditto */
  163. #define TDERR_BadHdrSum        24    /* header had incorrect checksum */
  164. #define TDERR_BadSecSum        25    /* data had incorrect checksum */
  165. #define TDERR_TooFewSecs    26    /* couldn't find enough sectors */
  166. #define TDERR_BadSecHdr        27    /* another "sector looked wrong" */
  167. #define TDERR_WriteProt        28    /* can't write to a protected disk */
  168. #define TDERR_DiskChanged    29    /* no disk in the drive */
  169. #define TDERR_SeekError        30    /* couldn't find track 0 */
  170. #define TDERR_NoMem        31    /* ran out of memory */
  171. #define TDERR_BadUnitNum    32    /* asked for a unit > NUMUNITS */
  172. #define TDERR_BadDriveType    33    /* not a drive that trackdisk groks */
  173. #define TDERR_DriveInUse    34    /* someone else allocated the drive */
  174. #define TDERR_PostReset        35    /* user hit reset; awaiting doom */
  175.  
  176. /*
  177.  *--------------------------------------------------------------------
  178.  *
  179.  * public portion of the unit structure
  180.  *
  181.  *--------------------------------------------------------------------
  182.  */
  183.  
  184. struct TDU_PublicUnit {
  185.     struct    Unit tdu_Unit;        /* base message port */
  186.     UWORD    tdu_Comp01Track;    /* track for first precomp */
  187.     UWORD    tdu_Comp10Track;    /* track for second precomp */
  188.     UWORD    tdu_Comp11Track;    /* track for third precomp */
  189.     ULONG    tdu_StepDelay;        /* time to wait after stepping */
  190.     ULONG    tdu_SettleDelay;    /* time to wait after seeking */
  191.     UBYTE    tdu_RetryCnt;        /* # of times to retry */
  192. };
  193.  
  194. #endif    /* DEVICES_TRACKDISK_H */
  195.