2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Battery-backed up clock initialisation.
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"
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)
40 const struct Resident Battclock_resident
__attribute__((section(".text"))) =
43 (struct Resident
*)&Battclock_resident
,
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
),
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
);
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
);