home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The AGA Experience 2
/
agavol2.iso
/
software
/
utilities
/
disk_tools
/
cd32tools
/
cdmotor.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-12
|
2KB
|
81 lines
/*
CD Stopper Daemon for the CD³² Multimedia Computer
this sends a MOTOR_OFF command each <number of ticks> time interval
to the internal cd.device unit 0, the CDROM drive of the cd32.
installation:
run <>NIL: cdmotor 500 ; this is the number of ``ticks'' to wait
disinstallation, abortiation:
break C $processnumber
written by Daniel Balster, dbalster@uni-paderborn.de
*/
#include <exec/exec.h>
#include <dos/dos.h>
#include <devices/cd.h>
#include <proto/exec.h>
#include <proto/dos.h>
#define DEFAULT_DELAY 500 /* ticks */
struct {
ULONG interval;
BOOL quiet;
ULONG pads[2];
} args = {0};
int main (void)
{
struct RDArgs *rdargs;
struct MsgPort *mp;
struct IOStdReq *ior;
BOOL quit = FALSE;
if (rdargs=ReadArgs("DELAY/N,QUIET/S",(LONG*)&(args),NULL))
{
// if(!args.quiet) PutStr("*** CD Stopper *** for the Amiga CD³²® Computer\nwritten by Daniel Balster\n");
if(mp=CreateMsgPort())
{
if(ior=(struct IOStdReq*)CreateIORequest(mp,sizeof(struct IOStdReq)))
{
if(!OpenDevice("cd.device",0,ior,0))
{
while (!quit)
{
if(!args.quiet) PutStr("stopping motor!\n");
ior->io_Command = CD_MOTOR;
ior->io_Length = 0; /* motor off */
DoIO(ior);
Delay (*(ULONG*)args.interval);
if(SetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) quit=TRUE;
}
// PutStr("*** BREAK!\n");
CloseDevice((struct IORequest*)ior);
}
// else PutStr("cannot access cd.device?\n");
DeleteIORequest((struct IORequest*)ior);
}
// else PutStr("cannot create ioreq?\n");
DeleteMsgPort(mp);
}
// else PutStr("cannot create msgport?\n");
FreeArgs(rdargs);
}
// else PrintFault(IoErr(),0);
return RETURN_OK;
}