Don't keep asking for S2EVENT_CONNECT reports if driver doen't
[AROS.git] / workbench / classes / zune / clock / clock_init.c
blobe000418602fb6deedd8e4caa78991748eb265cf7
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
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)
28 TimerIO = NULL;
29 TimerBase = NULL;
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);
38 0 == OpenDevice
40 "timer.device", UNIT_VBLANK, (struct IORequest *) TimerIO, 0
44 TimerBase = (struct Device *) TimerIO->tr_node.io_Device;
46 else
48 goto error;
51 return TRUE;
53 error:
54 if (TimerBase != NULL) CloseDevice((struct IORequest *) TimerIO);
55 if (TimerIO != NULL) FreeMem(TimerIO, sizeof(struct timerequest));
57 return FALSE;
60 static int Clock_Shutdown(LIBBASETYPEPTR LIBBASE)
62 if (TimerBase != NULL) CloseDevice((struct IORequest *) TimerIO);
63 if (TimerIO != NULL) FreeMem(TimerIO, sizeof( struct timerequest ));
64 return TRUE;
67 ADD2INITLIB(Clock_Startup, 1);
68 ADD2EXPUNGELIB(Clock_Shutdown, 1);