home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / cbm / nduk-v40.lha / V40 / include / devices / cd.i < prev    next >
Text File  |  1993-10-15  |  12KB  |  312 lines

  1.  
  2.  
  3.     IFND    DEVICES_CD_I
  4. DEVICES_CD_I SET    1
  5. **
  6. **    $VER: cd.i 1.12 (12.8.93)
  7. **    Includes Release 40.15
  8. **
  9. **    cd.device include file
  10. **
  11. **    (C) Copyright 1992-1993 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. **
  14.  
  15.     INCLUDE "exec/types.i"
  16.     INCLUDE "exec/nodes.i"
  17.  
  18. ************************************************************************
  19. *                                       *
  20. *   CD Commands                               *
  21. *                                       *
  22. ************************************************************************
  23.  
  24. CD_RESET        equ  1
  25. CD_READ        equ  2
  26. CD_WRITE        equ  3
  27. CD_UPDATE        equ  4
  28. CD_CLEAR        equ  5
  29. CD_STOP        equ  6
  30. CD_START        equ  7
  31. CD_FLUSH        equ  8
  32. CD_MOTOR        equ  9
  33. CD_SEEK        equ 10
  34. CD_FORMAT        equ 11
  35. CD_REMOVE        equ 12
  36. CD_CHANGENUM        equ 13
  37. CD_CHANGESTATE        equ 14
  38. CD_PROTSTATUS        equ 15
  39.  
  40. CD_GETDRIVETYPE     equ 18
  41. CD_GETNUMTRACKS     equ 19
  42. CD_ADDCHANGEINT     equ 20
  43. CD_REMCHANGEINT     equ 21
  44. CD_GETGEOMETRY        equ 22
  45. CD_EJECT        equ 23
  46.  
  47.  
  48. CD_INFO        equ 32
  49. CD_CONFIG        equ 33
  50. CD_TOCMSF        equ 34
  51. CD_TOCLSN        equ 35
  52.  
  53. CD_READXL        equ 36
  54.  
  55. CD_PLAYTRACK        equ 37
  56. CD_PLAYMSF        equ 38
  57. CD_PLAYLSN        equ 39
  58. CD_PAUSE        equ 40
  59. CD_SEARCH        equ 41
  60.  
  61. CD_QCODEMSF        equ 42
  62. CD_QCODELSN        equ 43
  63. CD_ATTENUATE        equ 44
  64.  
  65. CD_ADDFRAMEINT        equ 45
  66. CD_REMFRAMEINT        equ 46
  67.  
  68. ************************************************************************
  69. *                                       *
  70. *   Device Driver Error Codes                           *
  71. *                                       *
  72. ************************************************************************
  73.  
  74. CDERR_OPENFAIL        equ -1        ; device/unit failed to open
  75. CDERR_ABORTED        equ -2        ; request terminated early
  76. CDERR_NOCMD        equ -3        ; command not supported by device
  77. CDERR_BADLENGTH    equ -4        ; invalid length (IO_LENGTH/IO_OFFSET)
  78. CDERR_BADADDRESS    equ -5        ; invalid address (IO_DATA misaligned)
  79. CDERR_UNITBUSY        equ -6        ; device opens ok, but unit is busy
  80. CDERR_SELFTEST        equ -7        ; hardware failed self-test
  81.  
  82. CDERR_NotSpecified    equ 20        ; general catchall
  83. CDERR_NoSecHdr        equ 21        ; couldn't even find a sector         
  84. CDERR_BadSecPreamble    equ 22      ; sector looked wrong                 
  85. CDERR_BadSecID          equ 23      ; ditto                               
  86. CDERR_BadHdrSum         equ 24      ; header had incorrect checksum       
  87. CDERR_BadSecSum         equ 25      ; data had incorrect checksum         
  88. CDERR_TooFewSecs        equ 26      ; couldn't find enough sectors
  89. CDERR_BadSecHdr    equ 27        ; another "sector looked wrong"
  90. CDERR_WriteProt    equ 28        ; can't write to a protected disk     
  91. CDERR_NoDisk            equ 29      ; no disk in the drive                
  92. CDERR_SeekError         equ 30      ; couldn't find track 0
  93. CDERR_NoMem        equ 31        ; ran out of memory
  94. CDERR_BadUnitNum    equ 32        ; asked for a unit > NUMUNITS
  95. CDERR_BadDriveType    equ 33        ; not a drive cd.device understands
  96. CDERR_DriveInUse    equ 34        ; someone else allocated the drive
  97. CDERR_PostReset    equ 35        ; user hit reset; awaiting doom
  98. CDERR_BadDataType    equ 36        ; data on disk is wrong type
  99. CDERR_InvalidState    equ 37        ; invalid cmd under current conditions
  100.  
  101. CDERR_Phase        equ 42        ; illegal or unexpected SCSI phase
  102. CDERR_NoBoard        equ 50        ; open failed for non-existant board
  103.  
  104.  
  105.  
  106. ************************************************************************
  107. *                                       *
  108. * Configuration                               *
  109. *                                       *
  110. *    The drive is configured by TagList items defined as follows:   *
  111. *                                       *
  112. ************************************************************************
  113.  
  114. TAGCD_PLAYSPEED    equ    $0001
  115. TAGCD_READSPEED    equ    $0002
  116. TAGCD_READXLSPEED    equ    $0003
  117. TAGCD_SECTORSIZE    equ    $0004
  118. TAGCD_XLECC        equ    $0005
  119. TAGCD_EJECTRESET    equ    $0006
  120.  
  121. ************************************************************************
  122. *                                       *
  123. * Information                                   *
  124. *                                       *
  125. *      Information/Status structure describes current speed settings   *
  126. *      for read and play commands, sector size, audio attenuation      *
  127. *      precision, and drive status.                       *
  128. *                                       *
  129. ************************************************************************
  130.  
  131.  STRUCTURE CDINFO,0
  132.                  ;                  Default
  133.     UWORD  CDINFO_PlaySpeed     ; Audio play speed          (75)
  134.     UWORD  CDINFO_ReadSpeed     ; Data-rate of CD_READ command   (Max)
  135.     UWORD  CDINFO_ReadXLSpeed     ; Data-rate of CD_READXL command (75)
  136.     UWORD  CDINFO_SectorSize     ; Number of bytes per sector      (2048)
  137.     UWORD  CDINFO_XLECC     ; CDXL ECC enabled/disabled
  138.     UWORD  CDINFO_EjectReset     ; Reset on eject enabled/disabled
  139.     STRUCT CDINFO_Reserved1,8     ; Reserved for future expansion
  140.  
  141.     UWORD  CDINFO_MaxSpeed     ; Maximum speed drive can handle (75, 150)
  142.     UWORD  CDINFO_AudioPrecision ; 0 = no attenuator, 1 = mute only,
  143.                  ; other = (# levels - 1)
  144.     UWORD  CDINFO_Status     ; See flags below
  145.     STRUCT CDINFO_Reserved2,8     ; Reserved for future expansion
  146.  
  147.     LABEL  CDINFO_SIZE
  148.  
  149.  
  150. ; Flags for Status
  151.  
  152. CDSTSB_CLOSED        equ 0     ; Drive door is closed
  153. CDSTSB_DISK        equ 1     ; A disk has been detected
  154. CDSTSB_SPIN        equ 2     ; Disk is spinning (motor is on)
  155. CDSTSB_TOC        equ 3     ; Table of contents read.  Disk is valid.
  156. CDSTSB_CDROM        equ 4     ; Track 1 contains CD-ROM data
  157. CDSTSB_PLAYING        equ 5     ; Audio is playing
  158. CDSTSB_PAUSED        equ 6     ; Pause mode (pauses on play command)
  159. CDSTSB_SEARCH        equ 7     ; Search mode (Fast Forward/Fast Reverse)
  160. CDSTSB_DIRECTION    equ 8     ; Search direction (0 = Forward, 1 = Reverse)
  161.  
  162. CDSTSF_CLOSED        equ $0001
  163. CDSTSF_DISK        equ $0002
  164. CDSTSF_SPIN        equ $0004
  165. CDSTSF_TOC        equ $0008
  166. CDSTSF_CDROM        equ $0010
  167. CDSTSF_PLAYING        equ $0020
  168. CDSTSF_PAUSED        equ $0040
  169. CDSTSF_SEARCH        equ $0080
  170. CDSTSF_DIRECTION    equ $0100
  171.  
  172. ; Modes for CD_SEARCH
  173.  
  174. CDMODE_NORMAL    equ 0        ; Normal play at current play speed
  175. CDMODE_FFWD    equ 1        ; Fast forward play (skip-play forward
  176. CDMODE_FREV    equ 2        ; Fast reverse play (skip-play reverse
  177.  
  178.  
  179. ************************************************************************
  180. *                                       *
  181. * Position Information                               *
  182. *                                       *
  183. *      Position information can be described in two forms: MSF and LSN *
  184. *      form.  MSF (Minutes, Seconds, Frames) form is a time encoding.  *
  185. *      LSN (Logical Sector Number) form is frame (sector) count.       *
  186. *      The desired form is selected using the io_Flags field of the    *
  187. *      IOStdReq structure.  The flags and the union are described      *
  188. *      below.                                   *
  189. *                                       *
  190. ************************************************************************
  191.  
  192.  STRUCTURE RMSF,0
  193.  
  194.     UBYTE   Reserved        ; Reserved (always zero)
  195.     UBYTE   Minute        ; Minutes (0-72ish)
  196.     UBYTE   Second        ; Seconds (0-59)
  197.     UBYTE   Frame        ; Frame   (0-74)
  198.     LABEL   RMSF_SIZE
  199.  
  200. ;UNION
  201.  
  202. LSNMSF_SIZE    equ RMSF_SIZE
  203.  
  204.  
  205. ************************************************************************
  206. *                                       *
  207. * CD Transfer Lists                               *
  208. *                                       *
  209. *      A CDXL node is a double link node; however only single linkage  *
  210. *      is used by the device driver.  If you wish to construct a       *
  211. *      transfer list manually, it is only neccessary to define the     *
  212. *      mln_Succ pointer of the MinNode.  You may also use the Exec     *
  213. *      list functions by defining a List or MinList structure and by   *
  214. *      using the AddHead/AddTail functions to create the list.    This   *
  215. *      will create a double-linked list.  Although a double-linked     *
  216. *      list is not required by the device driver, you may wish use it  *
  217. *      for your own purposes.  Don't forget to initialize the          *
  218. *      the List/MinList before using it!                               *
  219. *                                                                      *
  220. ************************************************************************
  221.  
  222.  STRUCTURE CDXL,0
  223.  
  224.     STRUCT  CDXL_Node,MLN_SIZE      ; double linkage      
  225.     APTR    CDXL_Buffer             ; data destination (word aligned) 
  226.     LONG    CDXL_Length             ; must be even # bytes
  227.     LONG    CDXL_Actual             ; bytes transferred   
  228.     APTR    CDXL_IntData            ; interrupt server data segment
  229.     APTR    CDXL_IntCode            ; interrupt server code entry
  230.     LABEL   CDX