Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / .unmaintained / m68k-pp-native / battclock / battclock_init.c
blob99e7adb3bbdba82776b0ebe92264c1fa0f9f1d13
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Battery-backed up clock initialisation.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <exec/resident.h>
12 #include <utility/utility.h>
13 #include <proto/exec.h>
14 #include <proto/battclock.h>
16 #include <aros/asmcall.h>
17 #include "battclock_intern.h"
18 #include "libdefs.h"
20 #ifdef SysBase
21 #undef SysBase
22 #endif
24 static const UBYTE name[];
25 static const UBYTE version[];
26 static const void * const LIBFUNCTABLE[];
27 extern const char LIBEND;
29 struct BattClockBase *AROS_SLIB_ENTRY(init, BASENAME)();
31 extern void AROS_SLIB_ENTRY(ReadBattClock,BASENAME)();
32 extern void AROS_SLIB_ENTRY(ResetBattClock,BASENAME)();
33 extern void AROS_SLIB_ENTRY(WriteBattClock,BASENAME)();
35 int Battclock_entry(void)
37 return -1;
40 const struct Resident Battclock_resident __attribute__((section(".text"))) =
42 RTC_MATCHWORD,
43 (struct Resident *)&Battclock_resident,
44 (APTR)&LIBEND,
45 RTF_COLDSTART,
46 41,
47 NT_RESOURCE,
48 45,
49 (UBYTE *)name,
50 (UBYTE *)&version[6],
51 (ULONG *)&AROS_SLIB_ENTRY(init,BASENAME)
54 static const UBYTE name[] = NAME_STRING;
55 static const UBYTE version[] = VERSION_STRING;
57 static const void * const LIBFUNCTABLE[] =
59 &AROS_SLIB_ENTRY(ResetBattClock,BASENAME),
60 &AROS_SLIB_ENTRY(ReadBattClock,BASENAME),
61 &AROS_SLIB_ENTRY(WriteBattClock,BASENAME),
62 (void *)-1
65 AROS_UFH3(struct BattClockBase *, AROS_SLIB_ENTRY(init,BASENAME),
66 AROS_UFHA(ULONG, dummy, D0),
67 AROS_UFHA(ULONG, slist, A0),
68 AROS_UFHA(struct ExecBase *, SysBase, A6)
71 UWORD neg = AROS_ALIGN(LIB_VECTSIZE * 3);
72 struct BattClockBase * BattClockBase = NULL;
74 BattClockBase = (struct BattClockBase *)(((UBYTE *)
75 AllocMem( neg + sizeof(struct BattClockBase),
76 MEMF_CLEAR | MEMF_PUBLIC)) + neg);
78 if( BattClockBase )
80 BattClockBase->bb_SysBase = SysBase;
81 BattClockBase->bb_UtilBase = OpenLibrary("utility.library",0);
82 BattClockBase->bb_Node.ln_Pri = 0;
83 BattClockBase->bb_Node.ln_Type = NT_RESOURCE;
84 BattClockBase->bb_Node.ln_Name = (STRPTR)name;
86 MakeFunctions(BattClockBase, (APTR)LIBFUNCTABLE, NULL);
87 AddResource(BattClockBase);
89 return BattClockBase;