Copyright clean-up (part 1):
[AROS.git] / arch / all-pc / battclock / battclock_init.c
blob0206358e7801991dcf139c019d6dd72be9bf2493
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <aros/symbolsets.h>
8 #include <proto/acpica.h>
9 #include <proto/exec.h>
11 #include "battclock_intern.h"
12 #include "cmos.h"
14 /* acpica.library is optional */
15 struct Library *ACPICABase = NULL;
17 /* auto init */
18 static int BattClock_Init(struct BattClockBase *BattClockBase)
20 InitSemaphore(&BattClockBase->sem);
21 BattClockBase->century = CENTURY; /* Default offset */
23 if ((ACPICABase = OpenLibrary("acpica.library",0)))
25 ACPI_TABLE_FADT *fadt;
26 ACPI_STATUS err;
28 err = AcpiGetTable("FACP", 1, (ACPI_TABLE_HEADER **)&fadt);
29 if (err == AE_OK) {
30 if ((fadt->Header.Length >= offsetof(ACPI_TABLE_FADT, Century)) &&
31 fadt->Century)
33 D(bug("[BattClock] Got RTC century offset 0x%02X from ACPI\n", fadt->Century));
34 BattClockBase->century = fadt->Century;
37 CloseLibrary(ACPICABase);
38 ACPICABase = NULL;
41 return 1;
44 ADD2INITLIB(BattClock_Init, 0)