2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
7 #include <exec/libraries.h>
8 #include <exec/memory.h>
9 #include <dos/dosextens.h>
10 #include <aros/libcall.h>
11 #include <aros/debug.h>
12 #include <libcore/base.h>
14 #include <proto/exec.h>
15 #include <proto/timer.h>
17 #include <aros/symbolsets.h>
18 #include LC_LIBDEFS_FILE
20 #include <utility/date.h>
23 /*** Variables **************************************************************/
24 struct Device
*TimerBase
;
25 struct timerequest
*TimerIO
;
27 /*** Library startup and shutdown *******************************************/
28 static int Calendar_Startup(LIBBASETYPEPTR LIBBASE
)
33 TimerIO
= AllocMem( sizeof( struct timerequest
), MEMF_CLEAR
);
34 if( TimerIO
== NULL
) goto error
;
36 TimerIO
->tr_node
.io_Message
.mn_Length
= sizeof( struct timerequest
);
38 if( OpenDevice( "timer.device", UNIT_VBLANK
, (struct IORequest
*) TimerIO
, 0) == 0 )
39 TimerBase
= (struct Device
*) TimerIO
->tr_node
.io_Device
;
46 if( TimerBase
!= NULL
) CloseDevice( (struct IORequest
*) TimerIO
);
47 if( TimerIO
!= NULL
) FreeMem( TimerIO
, sizeof( struct timerequest
) );
52 static int Calendar_Shutdown( LIBBASETYPEPTR LIBBASE
)
54 if( TimerBase
!= NULL
) CloseDevice( (struct IORequest
*) TimerIO
);
55 if( TimerIO
!= NULL
) FreeMem( TimerIO
, sizeof( struct timerequest
) );
59 ADD2INITLIB( Calendar_Startup
, 1 );
60 ADD2EXPUNGELIB( Calendar_Shutdown
, 1 );