2 Copyright © 1995-2006, 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>
11 #include <libcore/base.h>
13 #include <proto/exec.h>
14 #include <proto/timer.h>
16 #include <aros/symbolsets.h>
17 #include LC_LIBDEFS_FILE
19 #include <utility/date.h>
22 /*** Variables **************************************************************/
23 struct Device
*TimerBase
;
24 struct timerequest
*TimerIO
;
26 /*** Library startup and shutdown *******************************************/
27 static int Clock_Startup(LIBBASETYPEPTR LIBBASE
)
32 TimerIO
= AllocMem(sizeof(struct timerequest
), MEMF_CLEAR
);
33 if(TimerIO
== NULL
) goto error
;
35 TimerIO
->tr_node
.io_Message
.mn_Length
= sizeof(struct timerequest
);
41 "timer.device", UNIT_VBLANK
, (struct IORequest
*) TimerIO
, 0
45 TimerBase
= (struct Device
*) TimerIO
->tr_node
.io_Device
;
55 if (TimerBase
!= NULL
) CloseDevice((struct IORequest
*) TimerIO
);
56 if (TimerIO
!= NULL
) FreeMem(TimerIO
, sizeof(struct timerequest
));
61 static int Clock_Shutdown(LIBBASETYPEPTR LIBBASE
)
63 if (TimerBase
!= NULL
) CloseDevice((struct IORequest
*) TimerIO
);
64 if (TimerIO
!= NULL
) FreeMem(TimerIO
, sizeof( struct timerequest
));
68 ADD2INITLIB(Clock_Startup
, 1);
69 ADD2EXPUNGELIB(Clock_Shutdown
, 1);