Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / classes / zune / calendar / calendar_init.c
blob1d6f898ef945ec117edcc7c0c41a518fbd9b3794
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
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 )
30 TimerIO = NULL;
31 TimerBase = NULL;
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;
40 else
41 goto error;
43 return TRUE;
45 error:
46 if( TimerBase != NULL ) CloseDevice( (struct IORequest *) TimerIO );
47 if( TimerIO != NULL ) FreeMem( TimerIO, sizeof( struct timerequest ) );
49 return FALSE;
52 static int Calendar_Shutdown( LIBBASETYPEPTR LIBBASE )
54 if( TimerBase != NULL ) CloseDevice( (struct IORequest *) TimerIO );
55 if( TimerIO != NULL ) FreeMem( TimerIO, sizeof( struct timerequest ) );
56 return TRUE;
59 ADD2INITLIB( Calendar_Startup, 1 );
60 ADD2EXPUNGELIB( Calendar_Shutdown, 1 );