Hey. Check out the following code...
#include <exec/types.h>
#include <exec/ports.h>
#include <exec/io.h>
#include <devices/timer.h>
#include <stdio.h>
#include <clib/exec_protos.h>
#include <clib/timer_protos.h>
#include <clib/alib_protos.h>
int main (int argc, char **argv)
{
struct MsgPort *ECPort;
struct timerequest *ECReq = 0;
BOOL TimerDeviceOpened = FALSE;
if (!(ECPort = CreateMsgPort()))
printf ("Couldn't create ECPort!\n");
else
{ if (!(ECReq = (struct timerequest *)CreateExtIO (ECPort, sizeof (struct timerequest))))
printf ("Coldn't create IORequest!\n");
else
{ if (OpenDevice ("timer.device", UNIT_ECLOCK, (struct IORequest *)ECReq, 0))
printf ("Couldn't open timer.device\n");
else
{ TimerDeviceOpened = TRUE;
ECReq->tr_node.io_Command = TR_ADDREQUEST;
ECReq->tr_time.tv_secs = 0;
ECReq->tr_time.tv_micro = 1000;
/* DoIO ((struct IORequest *) ECReq);
*/ }
}
}
/* Clean Up */
if (TimerDeviceOpened)
{ if (!CheckIO((struct IORequest *)ECReq))
{ printf ("Aborting...\n");
AbortIO ((struct IORequest *)ECReq);
WaitIO ((struct IORequest *)ECReq);
}
CloseDevice ((struct IORequest *)ECReq);
}
if (ECReq)
DeleteExtIO ((struct IORequest *)ECReq);
if (ECPort)
DeleteMsgPort(ECPort);
}
Now if I change DeleteExtIO to DeleteIORequest (and CreateExtIO to CreateIORequest) the bloody thing works.
Is this a bug?
Note: I need to CheckIO first because this is only a scratch from my main program and in it some requests might have not been even sent, in wich case WaitIO will wait forever...
:pint: