home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / devices / trackdisk.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  8KB  |  260 lines

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