1 #ifndef DEVICES_TRACKDISK_H
    2 #define DEVICES_TRACKDISK_H
    3 
    4 /*
    5 	trackdisk.device include
    6 
    7 	Copyright © 2002 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #ifndef EXEC_IO_H
   11 # include <exec/io.h>
   12 #endif
   13 
   14 #ifndef EXEC_DEVICES_H
   15 # include <exec/devices.h>
   16 #endif
   17 
   18 #pragma pack(2)
   19 
   20 
   21 #define NUMSECS   11
   22 #define NUMUNITS  4
   23 
   24 #define TD_SECTOR    512
   25 #define TD_SECSHIFT  9
   26 
   27 
   28 #define TD_NAME  "trackdisk.device"
   29 
   30 #define TDF_EXTCOM  (1<<15)
   31 
   32 
   33 #define TD_MOTOR         (CMD_NONSTD + 0)
   34 #define TD_SEEK          (CMD_NONSTD + 1)
   35 #define TD_FORMAT        (CMD_NONSTD + 2)
   36 #define TD_REMOVE        (CMD_NONSTD + 3)
   37 #define TD_CHANGENUM     (CMD_NONSTD + 4)
   38 #define TD_CHANGESTATE   (CMD_NONSTD + 5)
   39 #define TD_PROTSTATUS    (CMD_NONSTD + 6)
   40 #define TD_RAWREAD       (CMD_NONSTD + 7)
   41 #define TD_RAWWRITE      (CMD_NONSTD + 8)
   42 #define TD_GETDRIVETYPE  (CMD_NONSTD + 9)
   43 #define TD_GETNUMTRACKS  (CMD_NONSTD + 10)
   44 #define TD_ADDCHANGEINT  (CMD_NONSTD + 11)
   45 #define TD_REMCHANGEINT  (CMD_NONSTD + 12)
   46 #define TD_GETGEOMETRY   (CMD_NONSTD + 13)
   47 #define TD_EJECT         (CMD_NONSTD + 14)
   48 #define TD_LASTCOMM      (CMD_NONSTD + 15)
   49 
   50 /* TD64 */
   51 #define TD_READ64        (CMD_NONSTD + 15)
   52 #define TD_WRITE64       (CMD_NONSTD + 16)
   53 #define TD_SEEK64        (CMD_NONSTD + 17)
   54 #define TD_FORMAT64      (CMD_NONSTD + 18)
   55 
   56 /* TDGETGEOMETRY64 */
   57 /* (CMD_NONSTD+19 reserved for SCSIDirect cmd */
   58 /* (CMD_NONSTD+20 reserved for IDEDirect cmd */
   59 #define TD_GETGEOMETRY64 (CMD_NONSTD + 21)
   60 
   61 #define ETD_WRITE        (CMD_WRITE|TDF_EXTCOM)
   62 #define ETD_READ         (CMD_READ|TDF_EXTCOM)
   63 #define ETD_MOTOR        (TD_MOTOR|TDF_EXTCOM)
   64 #define ETD_SEEK         (TD_SEEK|TDF_EXTCOM)
   65 #define ETD_FORMAT       (TD_FORMAT|TDF_EXTCOM)
   66 #define ETD_UPDATE       (CMD_UPDATE|TDF_EXTCOM)
   67 #define ETD_CLEAR        (CMD_CLEAR|TDF_EXTCOM)
   68 #define ETD_RAWREAD      (TD_RAWREAD|TDF_EXTCOM)
   69 #define ETD_RAWWRITE     (TD_RAWWRITE|TDF_EXTCOM)
   70 
   71 #define io_HighOffset io_Actual /* TD64 */
   72 #define io_LowOffset io_Offset  /* TD64 */
   73 
   74 struct IOExtTD
   75 {
   76 	struct IOStdReq iotd_Req;
   77 	ULONG           iotd_Count;
   78 	ULONG           iotd_SecLabel;
   79 };
   80 
   81 struct DriveGeometry
   82 {
   83 	ULONG dg_SectorSize;
   84 	/*
   85 	 * Only valid up to 2TB, if the medium has more
   86 	 * it should return INT_MAX
   87 	 */
   88 	ULONG dg_TotalSectors;
   89 	/*
   90 	 * As modern storage media aren't layouted
   91 	 * in Cylinder/Heads/Sectors, the value is
   92 	 * *usually* calculated from the dg_TotalSectors
   93 	 * value.
   94 	 * Only valid up to 2TB, the usage is deprecated.
   95 	 */
   96 	ULONG dg_Cylinders;
   97 	/*
   98 	 * As modern storage media aren't layouted
   99 	 * in Cylinder/Heads/Sectors, the value is
  100 	 * *usually* calculated from the dg_TotalSectors
  101 	 * value.
  102 	 * Only valid up to 2TB, the usage is deprecated.
  103 	 */
  104 	ULONG dg_CylSectors;
  105 	/*
  106 	 * As modern storage media aren't layouted
  107 	 * in Cylinder/Heads/Sectors, the value is
  108 	 * *usually* calculated from the dg_TotalSectors
  109 	 * value.
  110 	 * Only valid up to 2TB, the usage is deprecated.
  111 	 */
  112 	ULONG dg_Heads;
  113 	/*
  114 	 * As modern storage media aren't layouted
  115 	 * in Cylinder/Heads/Sectors, the value is
  116 	 * *usually* calculated from the dg_TotalSectors
  117 	 * value.
  118 	 * Only valid up to 2TB, the usage is deprecated.
  119 	 */
  120 	ULONG dg_TrackSectors;
  121 	ULONG dg_BufMemType;
  122 	UBYTE dg_DeviceType;
  123 	UBYTE dg_Flags;
  124 	UWORD dg_Reserved;
  125 };
  126 
  127 struct DriveGeometry64
  128 {
  129 	/*
  130 	 * Placeholder for old-style DriveGeometry entry.
  131 	 * Only valid up to 2TB, the direct usage is deprecated, please
  132 	 * use dg64_* defines.
  133 	 */
  134 	struct DriveGeometry dg64_Geometry;
  135 	/*
  136 	 * As modern storage media aren't layouted
  137 	 * in Cylinder/Heads/Sectors, the drive size value is
  138 	 * calculated from the dg_TotalSectors64 value.
  139 	 * Valid also for drives which size is over 2TB.
  140 	 */
  141 	UQUAD dg64_TotalSectors64;
  142 };
  143 
  144 #define dg64_SectorSize     dg64_Geometry.dg_SectorSize
  145 #define dg64_TotalSectors   dg64_Geometry.dg_TotalSectors
  146 #define dg64_Cylinders      dg64_Geometry.dg_Cylinders
  147 #define dg64_CylSectors     dg64_Geometry.dg_CylSectors
  148 #define dg64_Heads          dg64_Geometry.dg_Heads
  149 #define dg64_TrackSectors   dg64_Geometry.dg_TrackSectors
  150 #define dg64_BufMemType     dg64_Geometry.dg_BufMemType
  151 #define dg64_DeviceType     dg64_Geometry.dg_DeviceType
  152 #define dg64_Flags          dg64_Geometry.dg_Flags
  153 #define dg64_Reserved       dg64_Geometry.dg_Reserved
  154 
  155 #define DG_DIRECT_ACCESS      0
  156 #define DG_SEQUENTIAL_ACCESS  1
  157 #define DG_PRINTER            2
  158 #define DG_PROCESSOR          3
  159 #define DG_WORM               4
  160 #define DG_CDROM              5
  161 #define DG_SCANNER            6
  162 #define DG_OPTICAL_DISK       7
  163 #define DG_MEDIUM_CHANGER     8
  164 #define DG_COMMUNICATION      9
  165 #define DG_GRAPHICS           10
  166 #define DG_RAM_DISK           20
  167 #define DG_UNKNOWN            31
  168 
  169 #define DGB_REMOVABLE  0
  170 #define DGF_REMOVABLE  (1<<DGB_REMOVABLE)
  171 
  172 
  173 #define IOTDB_INDEXSYNC  4
  174 #define IOTDF_INDEXSYNC  (1<<IOTDB_INDEXSYNC)
  175 #define IOTDB_WORDSYNC   5
  176 #define IOTDF_WORDSYNC   (1<<IOTDB_WORDSYNC)
  177 
  178 
  179 #define TD_LABELSIZE  16
  180 
  181 
  182 #define TDB_ALLOW_NON_3_5  0
  183 #define TDF_ALLOW_NON_3_5  (1<<TDB_ALLOW_NON_3_5)
  184 
  185 #define DRIVE3_5         1
  186 #define DRIVE5_25        2
  187 #define DRIVE3_5_150RPM  3
  188 
  189 
  190 #define TDERR_NotSpecified    20
  191 #define TDERR_NoSecHdr        21
  192 #define TDERR_BadSecPreamble  22
  193 #define TDERR_BadSecID        23
  194 #define TDERR_BadHdrSum       24
  195 #define TDERR_BadSecSum       25
  196 #define TDERR_TooFewSecs      26
  197 #define TDERR_BadSecHdr       27
  198 #define TDERR_WriteProt       28
  199 #define TDERR_DiskChanged     29
  200 #define TDERR_SeekError       30
  201 #define TDERR_NoMem           31
  202 #define TDERR_BadUnitNum      32
  203 #define TDERR_BadDriveType    33
  204 #define TDERR_DriveInUse      34
  205 #define TDERR_PostReset       35
  206 
  207 
  208 struct TDU_PublicUnit
  209 {
  210 	struct Unit tdu_Unit;
  211 	UWORD       tdu_Comp01Track;
  212 	UWORD       tdu_Comp10Track;
  213 	UWORD       tdu_Comp11Track;
  214 	ULONG       tdu_StepDelay;
  215 	ULONG       tdu_SettleDelay;
  216 	UBYTE       tdu_RetryCnt;
  217 	UBYTE       tdu_PubFlags;
  218 	UWORD       tdu_CurrTrk;
  219 	ULONG       tdu_CalibrateDelay;
  220 	ULONG       tdu_Counter;
  221 };
  222 
  223 #define TDPB_NOCLICK  0
  224 #define TDPF_NOCLICK  (1<<TDPB_NOCLICK)
  225 
  226 
  227 #pragma pack()
  228 
  229 #endif /* DEVICES_TRACKDISK_H */