Removed autodocs of arch specific variants of ROM modules.
[AROS.git] / arch / m68k-amiga / battclock / readbattclock.c
blobcaadbf2811f80bcbb2304b94b6d7d7d9f8af821d
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
4 Desc: ReadBattClock() function.
5 Lang: english
6 */
7 #define DEBUG 0
9 #include <aros/debug.h>
10 #include <aros/libcall.h>
11 #include <aros/symbolsets.h>
13 #include <utility/date.h>
14 #include <proto/utility.h>
16 #include "battclock_intern.h"
18 #include <proto/battclock.h>
20 /* See rom/battclock/readbattclock.c for documentation */
22 AROS_LH0(ULONG, ReadBattClock,
23 struct BattClockBase*, BattClockBase, 2, Battclock)
25 AROS_LIBFUNC_INIT
27 volatile UBYTE *p = BattClockBase->clockptr;
28 struct UtilityBase *UtilityBase = BattClockBase->UtilityBase;
29 struct ClockData cd;
30 UBYTE reg;
31 ULONG t;
33 D(bug("ReadBattClock\n"));
34 if (!p)
35 return 0;
36 reg = 0;
37 cd.sec = getbcd(p, reg);
38 cd.min = getbcd(p, reg + 2);
39 cd.hour = getbcd(p, reg + 4);
40 if (BattClockBase->clocktype == MSM6242B)
41 reg = 6;
42 else
43 reg = 7;
44 cd.mday = getbcd(p, reg);
45 cd.month = getbcd(p, reg + 2);
46 cd.year = getbcd(p, reg + 4) + 1900;
47 if (cd.year < 1978)
48 cd.year += 100;
49 cd.wday = 0;
50 t = Date2Amiga(&cd);
51 D(bug("%02d:%02d %02d.%02d.%d = %d\n", cd.hour, cd.min, cd.mday, cd.month, cd.year, t));
52 return t;
54 AROS_LIBFUNC_EXIT
56 } /* ReadBattClock */