2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include "sysmon_intern.h"
8 #include <devices/timer.h>
9 #include <clib/alib_protos.h>
11 /* Timer information */
12 static struct MsgPort
* timerport
= NULL
;
13 static struct timerequest
* timermsg
= NULL
;
14 static ULONG SIG_TIMER
= 0;
17 static BOOL
InitTimer(struct SysMonData
*smdata
)
19 if((timerport
= CreatePort(0,0)) == NULL
)
22 if((timermsg
= (struct timerequest
*) CreateExtIO(timerport
, sizeof(struct timerequest
))) == NULL
)
24 DeletePort(timerport
);
29 if(OpenDevice("timer.device", UNIT_VBLANK
, ((struct IORequest
*) timermsg
), 0) != 0)
31 DeletePort(timerport
);
33 DeleteExtIO((struct IORequest
*)timermsg
);
38 SIG_TIMER
= 1 << timerport
->mp_SigBit
;
43 VOID
SignalMeAfter(ULONG msecs
)
45 timermsg
->tr_node
.io_Command
= TR_ADDREQUEST
;
46 timermsg
->tr_time
.tv_secs
= msecs
/ 1000;
47 timermsg
->tr_time
.tv_micro
= (msecs
% 1000) * 1000;
48 SendIO((struct IORequest
*)timermsg
);
51 static VOID
DeInitTimer(struct SysMonData
*smdata
)
55 AbortIO((struct IORequest
*)timermsg
);
56 WaitIO((struct IORequest
*)timermsg
);
57 CloseDevice((struct IORequest
*)timermsg
);
58 DeleteExtIO((struct IORequest
*)timermsg
);
61 if(timerport
!= NULL
) DeletePort(timerport
);
69 struct SysMonModule timermodule
=
72 .DeInit
= DeInitTimer
,