
*************************************************************************
*                           *
*   Copyright (C) 1985, Commodore Amiga Inc.  All rights reserved.   *
*                           *
*************************************************************************


*************************************************************************
*
* trackdisk.i
*
* Source Control
* ------ -------
* 
* $Header: trackdisk.i,v 27.2 85/07/12 23:16:27 neil Exp $
*
* $Locker:  $
*
*************************************************************************

   IFND   DEVICES_TRACKDISK_I
DEVICES_TRACKDISK_I   SET   1

   IFND   EXEC_IO_I
   INCLUDE   "exec/io.i"
   ENDC

*--------------------------------------------------------------------
*
* Physical drive constants
*
*--------------------------------------------------------------------


NUMCYLS      EQU   80         ; normal # of cylinders
MAXCYLS      EQU   NUMCYLS+20      ; max # of cyls to look for
*                  ;   during a calibrate
NUMSECS      EQU   11
NUMHEADS   EQU   2
MAXRETRY   EQU   10
NUMTRACKS   EQU   NUMCYLS*NUMHEADS
NUMUNITS   EQU   4

*--------------------------------------------------------------------
*
* Useful constants
*
*--------------------------------------------------------------------


*-- sizes before mfm encoding
TD_SECTOR   EQU   512
TD_SECSHIFT   EQU   9         ; log TD_SECTOR
*                  ;    2


*--------------------------------------------------------------------
*
* Driver Specific Commands
*
*--------------------------------------------------------------------

*-- TD_NAME is a generic macro to get the name of the driver.  This
*-- way if the name is ever changed you will pick up the change
*-- automatically.
*--
*-- Normal usage would be:
*--
*-- internalName:   TD_NAME
*--

TD_NAME:   MACRO
      DC.B   'trackdisk.device',0
      DS.W   0
      ENDM

   BITDEF   TD,EXTCOM,15

   DEVINIT
   DEVCMD   TD_MOTOR      ; control the disk's motor
   DEVCMD   TD_SEEK         ; explicit seek (for testing)
   DEVCMD   TD_FORMAT      ; format disk
   DEVCMD   TD_REMOVE      ; notify when disk changes
   DEVCMD   TD_CHANGENUM      ; number of disk changes
   DEVCMD   TD_CHANGESTATE      ; is there a disk in the drive?
   DEVCMD   TD_PROTSTATUS      ; is the disk write protected?

TD_LASTCOMM   EQU   TD_PROTSTATUS

*
*
* The disk driver has an "extended command" facility.  These commands
* take a superset of the normal IO Request block.
*
ETD_WRITE   EQU   (CMD_WRITE!TDF_EXTCOM)
ETD_READ   EQU   (CMD_READ!TDF_EXTCOM)
ETD_MOTOR   EQU   (TD_MOTOR!TDF_EXTCOM)
ETD_SEEK   EQU   (TD_SEEK!TDF_EXTCOM)
ETD_FORMAT   EQU   (TD_FORMAT!TDF_EXTCOM)
ETD_UPDATE   EQU   (CMD_UPDATE!TDF_EXTCOM)
ETD_CLEAR   EQU   (CMD_CLEAR!TDF_EXTCOM)


*
* extended IO has a larger than normal io request block.
*

 STRUCTURE IOEXTTD,IOSTD_SIZE
   ULONG   IOTD_COUNT   ; removal/insertion count
   ULONG   IOTD_SECLABEL   ; sector label data region
   LABEL   IOTD_SIZE

* labels are TD_LABELSIZE bytes per sector

TD_LABELSIZE   EQU   16

*--------------------------------------------------------------------
*
* Driver error defines
*
*--------------------------------------------------------------------

TDERR_NotSpecified   EQU   20
TDERR_NoSecHdr      EQU   21
TDERR_BadSecPreamble   EQU   22
TDERR_BadSecID      EQU   23
TDERR_BadHdrSum      EQU   24
TDERR_BadSecSum      EQU   25
TDERR_TooFewSecs   EQU   26
TDERR_BadSecHdr      EQU   27
TDERR_WriteProt      EQU   28
TDERR_DiskChanged   EQU   29
TDERR_SeekError      EQU   30
TDERR_NoMem      EQU   31
TDERR_BadUnitNum   EQU   32
TDERR_BadDriveType   EQU   33
TDERR_DriveInUse   EQU   34

   ENDC
