2 * This code probes Amiga hardware timings, and
3 * configures SysBase with those settings.
6 #include <aros/symbolsets.h>
7 #include <exec/execbase.h>
8 #include <proto/exec.h>
9 #include <hardware/cia.h>
11 #include <kernel_base.h>
13 static int Timer_Init(struct KernelBase
*KernelBase
)
15 volatile struct CIA
*ciaa
= (struct CIA
*)0xbfe001;
19 * Check powersupply tick rate.
20 * No Disable() here because we are running without interrupts during early init.
28 todlo
= ciaa
->ciatodlow
;
29 while (todlo
== ciaa
->ciatodlow
);
31 todlo
= ciaa
->ciatodlow
;
32 while (todlo
== ciaa
->ciatodlow
);
34 todcnt
= ~(((ciaa
->ciatahi
<< 8) | ciaa
->ciatalo
) + 1);
43 if (todcnt
> 14188 + (14318 - 14188) / 2)
44 SysBase
->PowerSupplyFrequency
= 50;
45 else if (todcnt
<= 11823 + (11932 - 11823) / 2)
46 SysBase
->PowerSupplyFrequency
= 60;
47 else if (todcnt
> 14188 - (14188 - 11932) / 2)
48 SysBase
->PowerSupplyFrequency
= 50;
50 SysBase
->PowerSupplyFrequency
= 60;
55 ADD2INITLIB(Timer_Init
, 0)