2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
7 #include <exec/libraries.h>
8 #include <dos/dosextens.h>
9 #include <aros/libcall.h>
10 #include <aros/debug.h>
12 #include <proto/exec.h>
13 #include <proto/timer.h>
15 #include <aros/symbolsets.h>
16 #include LC_LIBDEFS_FILE
18 #include <utility/date.h>
21 /*** Variables **************************************************************/
22 struct Device
*TimerBase
;
23 struct timerequest
*TimerIO
;
25 /*** Library startup and shutdown *******************************************/
26 static int Clock_Startup(LIBBASETYPEPTR LIBBASE
)
31 TimerIO
= AllocMem(sizeof(struct timerequest
), MEMF_CLEAR
);
32 if(TimerIO
== NULL
) goto error
;
34 TimerIO
->tr_node
.io_Message
.mn_Length
= sizeof(struct timerequest
);
40 "timer.device", UNIT_VBLANK
, (struct IORequest
*) TimerIO
, 0
44 TimerBase
= (struct Device
*) TimerIO
->tr_node
.io_Device
;
54 if (TimerBase
!= NULL
) CloseDevice((struct IORequest
*) TimerIO
);
55 if (TimerIO
!= NULL
) FreeMem(TimerIO
, sizeof(struct timerequest
));
60 static int Clock_Shutdown(LIBBASETYPEPTR LIBBASE
)
62 if (TimerBase
!= NULL
) CloseDevice((struct IORequest
*) TimerIO
);
63 if (TimerIO
!= NULL
) FreeMem(TimerIO
, sizeof( struct timerequest
));
67 ADD2INITLIB(Clock_Startup
, 1);
68 ADD2EXPUNGELIB(Clock_Shutdown
, 1);