home *** CD-ROM | disk | FTP | other *** search
- /*
- NEC-CDR-210 Play Audio
-
- by dbalster@uni-paderborn.de
- */
-
- #include <exec/exec.h>
- #include <dos/dos.h>
- #include <devices/scsidisk.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
-
- #include <string.h>
-
- UBYTE version[] = "$VER: playaudio 0.9 for the NEC CDR-210 drive";
-
- ULONG sense [5];
- UBYTE buffer [10];
- UBYTE cmd_play[] = { 0xD9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0 };
- UBYTE cmd_index[] = { 0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80 };
-
-
- #define TEMPLATE "DEVICE/A,UNIT/N/A,TRACK/N"
-
- #define bcd(x) (((x/10)<<4)|(x%10))
-
- struct {
- STRPTR device;
- ULONG unit, track, pad;
- } args;
-
- ULONG main (VOID)
- {
- struct MsgPort *mp;
- struct SCSICmd scsi;
- struct RDArgs *rdargs;
- struct IOStdReq *ior;
- UBYTE trk = 1;
-
- if (rdargs = ReadArgs(TEMPLATE,(LONG*)&args,NULL))
- {
- if (args.track) trk = *(ULONG*)args.track;
-
- if ((trk<1)||trk>99) trk=1; // only 1..99 allowed
-
- if(mp=CreateMsgPort())
- {
- if(ior=(struct IOStdReq*)CreateIORequest(mp,sizeof(struct IOStdReq)))
- {
- if(!OpenDevice(args.device,*(ULONG*)args.unit,ior,0))
- {
- ior->io_Command = HD_SCSICMD;
- ior->io_Data = (APTR) &scsi;
- ior->io_Length = sizeof(struct SCSICmd);
-
- scsi.scsi_Data = (UWORD*) buffer;
- scsi.scsi_Length = 0;
- scsi.scsi_CmdLength = 10;
- scsi.scsi_Flags = SCSIF_AUTOSENSE|SCSIF_WRITE;
- scsi.scsi_SenseData = (UBYTE*) sense;
- scsi.scsi_SenseLength = 20;
- scsi.scsi_Command = cmd_index;
- cmd_index [2] = bcd(trk);
- DoIO(ior);
- scsi.scsi_Command = cmd_play;
- DoIO(ior);
-
- CloseDevice((struct IORequest*)ior);
- }
- DeleteIORequest((struct IORequest*)ior);
- }
- DeleteMsgPort(mp);
- }
- FreeArgs(rdargs);
- }
- else PrintFault(IoErr(),0);
-
- return RETURN_OK;
- }
-