home *** CD-ROM | disk | FTP | other *** search
- /*
- * need to crosscheck with ATimerLib Version FIXME
- */
-
- /* wait specified amount of time */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <devices/timer.h>
-
- #ifdef __GNUC
- #include "quiet-gcc.h"
- #endif
-
- #include <clib/exec_protos.h>
- #include <clib/alib_protos.h>
- #include <pragmas/exec_pragmas.h>
-
- #if 0
- #include "ATimer.h"
- #endif
-
- #ifdef ATIMER_USEASSERT
- #include <AAssert.h>
- #endif
-
- extern ULONG SysBase;
-
- void
- WaitmSecs (unsigned long millisecs)
- {
- struct MsgPort *port;
- struct timerequest *req;
- long error;
-
- if(! SysBase)
- SysBase = *((ULONG *) 4); /* FIXME !!! */
-
-
- if ((port = CreatePort (0L, 0L)) == NULL)
- {
- return;
- }
- if ((req = (struct timerequest *)
- CreateExtIO (port,
- sizeof (struct timerequest))) == NULL)
- {
- DeletePort (port);
- return;
- }
- if ((error = OpenDevice ((UBYTE *) TIMERNAME,
- UNIT_VBLANK,
- &(req->tr_node),
- 0L)) != 0L)
- {
- DeleteExtIO ((struct IORequest *) req);
- DeletePort (port);
- return;
- }
- millisecs *= 1000;
-
- req->tr_node.io_Command = TR_ADDREQUEST;
- req->tr_time.tv_secs = millisecs / 1000000;
- req->tr_time.tv_micro = millisecs % 1000000;
-
- DoIO ((struct IORequest *) req);
-
- CloseDevice ((struct IORequest *) req);
- DeleteExtIO ((struct IORequest *) req);
- DeletePort (port);
- }
-
- void sleep(unsigned int sleep)
- {
- WaitmSecs(sleep * 1000);
- }
-
-
-
-