2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
7 * This code probes Amiga hardware timings, and
8 * configures SysBase with those settings.
11 #include <aros/symbolsets.h>
12 #include <exec/execbase.h>
13 #include <proto/exec.h>
14 #include <hardware/cia.h>
16 #include <kernel_base.h>
18 static int Timer_Init(struct KernelBase
*KernelBase
)
20 volatile struct CIA
*ciaa
= (struct CIA
*)0xbfe001;
24 * Check powersupply tick rate.
25 * No Disable() here because we are running without interrupts during early init.
33 todlo
= ciaa
->ciatodlow
;
34 while (todlo
== ciaa
->ciatodlow
);
36 todlo
= ciaa
->ciatodlow
;
37 while (todlo
== ciaa
->ciatodlow
);
39 todcnt
= ~(((ciaa
->ciatahi
<< 8) | ciaa
->ciatalo
) + 1);
48 if (todcnt
> 14188 + (14318 - 14188) / 2)
49 SysBase
->PowerSupplyFrequency
= 50;
50 else if (todcnt
<= 11823 + (11932 - 11823) / 2)
51 SysBase
->PowerSupplyFrequency
= 60;
52 else if (todcnt
> 14188 - (14188 - 11932) / 2)
53 SysBase
->PowerSupplyFrequency
= 50;
55 SysBase
->PowerSupplyFrequency
= 60;
60 ADD2INITLIB(Timer_Init
, 0)