revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-amiga / battclock / writebattclock.c
blobb3a519f37f297f49fb44e7ca721e08fd8cb85eaf
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
4 Desc: WriteBattClock()
5 Lang: english
6 */
7 #include "battclock_intern.h"
9 #include <utility/date.h>
10 #include <proto/utility.h>
12 #include <proto/battclock.h>
14 /* See rom/battclock/writebattclock.c for documentation */
16 AROS_LH1(void, WriteBattClock,
17 AROS_LHA(ULONG, time, D0),
18 struct BattClockBase*, BattClockBase, 3, Battclock)
20 AROS_LIBFUNC_INIT
22 volatile UBYTE *p = BattClockBase->clockptr;
23 struct UtilityBase *UtilityBase = BattClockBase->UtilityBase;
24 struct ClockData cd;
25 UBYTE reg;
27 if (!p)
28 return;
29 Amiga2Date(time, &cd);
30 stopclock(BattClockBase);
31 reg = 0;
32 putbcd(p, reg, cd.sec);
33 putbcd(p, reg + 2, cd.min);
34 putbcd(p, reg + 4, cd.hour);
35 if (BattClockBase->clocktype == MSM6242B)
36 reg = 6;
37 else
38 reg = 7;
39 putbcd(p, reg, cd.mday);
40 putbcd(p, reg + 2, cd.month);
41 putbcd(p, reg + 4, cd.year - 1900);
42 startclock(BattClockBase);
43 return;
45 AROS_LIBFUNC_EXIT
46 } /* WriteBattClock */