2 Copyright © 1995-2011, 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>
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 Calendar_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
);
37 if( OpenDevice( "timer.device", UNIT_VBLANK
, (struct IORequest
*) TimerIO
, 0) == 0 )
38 TimerBase
= (struct Device
*) TimerIO
->tr_node
.io_Device
;
45 if( TimerBase
!= NULL
) CloseDevice( (struct IORequest
*) TimerIO
);
46 if( TimerIO
!= NULL
) FreeMem( TimerIO
, sizeof( struct timerequest
) );
51 static int Calendar_Shutdown( LIBBASETYPEPTR LIBBASE
)
53 if( TimerBase
!= NULL
) CloseDevice( (struct IORequest
*) TimerIO
);
54 if( TimerIO
!= NULL
) FreeMem( TimerIO
, sizeof( struct timerequest
) );
58 ADD2INITLIB( Calendar_Startup
, 1 );
59 ADD2EXPUNGELIB( Calendar_Shutdown
, 1 );