home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
cdrom
/
atapi_pnp300
/
developer_kit
/
amiga_e
/
modulessrc
/
devices
/
atapi_cd.e
Wrap
Text File
|
1977-12-31
|
15KB
|
314 lines
OPT PREPROCESS
OPT MODULE
OPT EXPORT
/*
** $VER: atapi_cd.e 2.1 (09.03.96)
**
** atapi.device include file
**
** (C) Copyright 1995-96 G. Campana M.Campinoti
** All Rights Reserved
**
** Big pieces from the original cd.device from Commodore (Escom)
**
** AmigaE translation by Federico Stango (09.03.96)
*/
MODULE 'exec/types','exec/nodes'
MODULE 'devices/scsidisk'
/**************************************************************************
* *
* ATAPI Task Alerts Errors *
* *
**************************************************************************/
CONST AATP_General = 0
/**************************************************************************
* *
* ATAPI CD Commands *
* *
**************************************************************************/
CONST CD_RESET = 1, /* Private !*/
CD_READ = 2,
CD_WRITE = 3, /* CDERR_Writeprot error ;) */
CD_UPDATE = 4, /* empty call */
CD_CLEAR = 5, /* empty call */
CD_MOTOR = 9, /* empty call */
CD_SEEK = 10,
CD_CHANGENUM = 13, /* supports Quick-IO */
CD_CHANGESTATE = 14,
CD_PROTSTATUS = 15, /* always return 1 (write protected) */
CD_ADDCHANGEINT = 20,
CD_REMCHANGEINT = 21, /* Immediate */
CD_GETGEOMETRY = 22,
CD_EJECT = 23,
CD_SCSI_DIRECT = 28, /* compatible w. HD_SCSICMD */
CD_INFO = 32,
CD_CONFIG = 33,
CD_TOCMSF = 34,
CD_TOCLSN = 35,
CD_READXL = 36,
CD_QCODEMSF = 42,
CD_QCODELSN = 43,
CD_ATTENUATE = 44,
CD_PLAYTRACK = 37,
CD_PLAYMSF = 38,
CD_PLAYLSN = 39,
CD_PAUSE = 40,
CD_ATAPI_IDENTIFY = $7fff
/****************************
* *
* Not working now *
* *
****************************/
CONST CD_SEARCH = 41
/**************************************************************************
* *
* Device Driver Error Codes *
* *
**************************************************************************/
CONST CDERR_OPENFAIL = -1, /* device/unit failed to open */
CDERR_ABORTED = -2, /* request terminated early */
CDERR_NOCMD = -3, /* command not supported by device */
CDERR_BADLENGTH = -4, /* invalid length (IO_LENGTH/IO_OFFSET) */
CDERR_BADADDRESS = -5, /* invalid address (IO_DATA misaligned) */
CDERR_UNITBUSY = -6, /* device opens ok, but unit is busy */
CDERR_NotSpecified = 20, /* general catchall */
CDERR_NoSecHdr = 21, /* couldn't even find a sector */
CDERR_BadSecPreamble = 22, /* sector looked wrong */
CDERR_BadSecID = 23, /* ditto */
CDERR_BadHdrSum = 24, /* header had incorrect checksum */
CDERR_BadSecSum = 25, /* data had incorrect checksum */
CDERR_TooFewSecs = 26, /* couldn't find enough sectors */
CDERR_BadSecHdr = 27, /* another "sector looked wrong" */
CDERR_WriteProt = 28, /* can't write to a protected disk */
CDERR_NoDisk = 29, /* no disk in the drive */
CDERR_SeekError = 30, /* couldn't find track 0 */
CDERR_NoMem = 31, /* ran out of memory */
CDERR_BadUnitNum = 32, /* asked for a unit > NUMUNITS */
CDERR_BadDriveType = 33, /* not a drive cd.device understands */
CDERR_DriveInUse = 34, /* someone else allocated the drive */
CDERR_BadDataType = 36, /* data on disk is wrong type */
CDERR_InvalidState = 37, /* invalid cmd under current conditions */
CDERR_NoBoard = 50 /* open failed for non-existant board */
/**************************************************************************
* *
* Configuration *
* *
* The drive is configured by TagList items defined as follows: *
* *
**************************************************************************/
CONST TAGCD_PLAYSPEED = 1,
TAGCD_READSPEED = 2,
TAGCD_READXLSPEED = 3,
TAGCD_SECTORSIZE = 4,
TAGCD_XLECC = 5,
TAGCD_EJECTRESET = 6
/**************************************************************************
* *
* Information *
* *
* Information/Status structure describes current speed settings *
* for read and play commands, sector size, audio attenuation *
* precision, and drive status. *
* *
**************************************************************************/
OBJECT cdinfo /* Default */
playspeed : INT /* Audio play speed (75) */
readspeed : INT /* Data-rate of CD_READ command (Max) */
readxlspeed : INT /* Data-rate of CD_READXL command (75) */
sectorsize : INT /* Number of bytes per sector (2048) */
xlecc : INT /* CDXL ECC enabled/disabled */
ejectreset : INT /* Reset on eject enabled/disabled */
reserved1[4] : ARRAY OF INT /* Reserved for future expansion */
maxspeed : INT /* Maximum speed drive can handle (75, 150) */
audioprecision : INT /* 0 = no attenuator, 1 = mute only, */
/* other = (# levels - 1) */
status : INT /* See flags below */
reserved2[4] : ARRAY OF INT /* Reserved for future expansion */
ENDOBJECT
/* Flags for Status */
CONST CDSTSB_CLOSED = 0, /* Drive door is closed */
CDSTSB_DISK = 1, /* A disk has been detected */
CDSTSB_SPIN = 2, /* Disk is spinning (motor is on) */
CDSTSB_TOC = 3, /* Table of contents read. Disk is valid. */
CDSTSB_CDROM = 4, /* Track 1 contains CD-ROM data */
CDSTSB_PLAYING = 5, /* Audio is playing */
CDSTSB_PAUSED = 6, /* Pause mode (pauses on play command) */
CDSTSB_SEARCH = 7, /* Search mode (Fast Forward/Fast Reverse) */
CDSTSB_DIRECTION = 8, /* Search direction (0 = Forward, 1 = Reverse) */
CDSTSF_CLOSED = 1,
CDSTSF_DISK = 2,
CDSTSF_SPIN = 4,
CDSTSF_TOC = 8,
CDSTSF_CDROM = $10,
CDSTSF_PLAYING = $20,
CDSTSF_PAUSED = $40,
CDSTSF_SEARCH = $80,
CDSTSF_DIRECTION = $100
/* Modes for CD_SEARCH */
CONST CDMODE_NORMAL = 0, /* Normal play at current play speed */
CDMODE_FFWD = 1, /* Fast forward play (skip-play forward)*/
CDMODE_FREV = 2 /* Fast reverse play (skip-play reverse)*/
/**************************************************************************
* *
* Position Information *
* *
* Position information can be described in two forms: MSF and LSN *
* form. MSF (Minutes, Seconds, Frames) form is a time encoding. *
* LSN (Logical Sector Number) form is frame (sector) count. *
* The desired form is selected using the io_Flags field of the *
* IOStdReq structure. The flags and the union are described *
* below. *
* *
**************************************************************************/
OBJECT rmsf
reserved : CHAR /* Reserved (always zero) */
minute : CHAR /* Minutes (0-72ish) */
second : CHAR /* Seconds (0-59) */
frame : CHAR /* Frame (0-74) */
ENDOBJECT
OBJECT lsnmsf
msf:rmsf /* Minute, Second, Frame */
ENDOBJECT /* Logical Sector Number */
/**************************************************************************
* *
* CD Transfer Lists *
* *
* A CDXL node is a double link node; however only single linkage *
* is used by the device driver. If you wish to construct a *
* transfer list manually, it is only neccessary to define the *
* mln_Succ pointer of the MinNode. You may also use the Exec *
* list functions by defining a List or MinList structure and by *
* using the AddHead/AddTail functions to create the list. This *
* will create a double-linked list. Although a double-linked *
* list is not required by the device driver, you may wish use it *
* for your own purposes. Don't forget to initialize the *
* the List/MinList before using it! *
* *
**************************************************************************/
OBJECT cdxl
node : mln /* double linkage */
buffer : PTR TO CHAR /* data destination (word aligned) */
length : LONG /* must be even # bytes */
actual : LONG /* bytes transferred */
intdata : LONG /* interrupt server data segment */
intcode : LONG /* interrupt server code entry */
ENDOBJECT
/**************************************************************************
* *
* CD Table of Contents *
* *
* The CD_TOC command returns an array of CDTOC entries. *
* Entry zero contains summary information describing how many *
* tracks the disk has and the play-time of the disk. *
* Entries 1 through N (N = Number of tracks on disk) contain *
* information about the track. *
* *
**************************************************************************/
OBJECT tocsummary
firsttrack : CHAR /* First track on disk (always 1) */
lasttrack : CHAR /* Last track on disk */
leadout : lsnmsf /* Beginning of lead-out track (end of disk) */
ENDOBJECT
OBJECT tocentry
ctladr : CHAR /* Q-Code info */
track : CHAR /* Track number */
position : lsnmsf /* Start position of this track */
ENDOBJECT
OBJECT cdtoc /* First entry (0) is summary information */
entry : tocentry /* Entries 1-N are track entries */
ENDOBJECT
/**************************************************************************
* *
* Q-Code Packets *
* *
* Q-Code packets are only returned when audio is playing. *
* Currently, only position packets are returned (ADR_POSITION) *
* The other ADR_ types are almost never encoded on the disk *
* and are of little use anyway. To avoid making the QCode *
* structure a union, these other ADR_ structures are not defined. *
* *
**************************************************************************/
OBJECT qcode
ctladr : CHAR /* Data type / QCode type */
track : CHAR /* Track number */
index : CHAR /* Track subindex number */
zero : CHAR /* The "Zero" byte of Q-Code packet */
trackposition : lsnmsf /* Position from start of track */
diskposition : lsnmsf /* Position from start of disk */
ENDOBJECT
CONST CTLADR_CTLMASK = $F0, /* Control field */
CTL_CTLMASK = $D0, /* To be ANDed with CtlAdr before compared */
CTL_2AUD = $00, /* 2 audio channels without preemphasis */
CTL_2AUDEMPH = $10, /* 2 audio channels with preemphasis */
CTL_4AUD = $80, /* 4 audio channels without preemphasis */
CTL_4AUDEMPH = $90, /* 4 audio channels with preemphasis */
CTL_DATA = $40, /* CD-ROM Data */
CTL_COPYMASK = $20, /* To be ANDed with CtlAdr before compared */
CTL_COPY = $20, /* When true, this audio/data can be copied */
CTLADR_ADRMASK = $0F, /* Address field */
ADR_POSITION = $01, /* Q-Code is position information */
ADR_UPC = $02, /* Q-Code is UPC information (not used) */
ADR_ISRC = $03, /* Q-Code is ISRC (not used) */
ADR_HYBRID = $05 /* This disk is a hybrid disk */