diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc/amiga/time.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/ppc/amiga/time.c')
-rw-r--r-- | arch/ppc/amiga/time.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/ppc/amiga/time.c b/arch/ppc/amiga/time.c new file mode 100644 index 000000000000..0073527a7036 --- /dev/null +++ b/arch/ppc/amiga/time.c | |||
@@ -0,0 +1,58 @@ | |||
1 | #include <linux/config.h> /* CONFIG_HEARTBEAT */ | ||
2 | #include <linux/errno.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/param.h> | ||
6 | #include <linux/string.h> | ||
7 | #include <linux/mm.h> | ||
8 | |||
9 | #include <asm/machdep.h> | ||
10 | #include <asm/io.h> | ||
11 | |||
12 | #include <linux/timex.h> | ||
13 | |||
14 | unsigned long m68k_get_rtc_time(void) | ||
15 | { | ||
16 | unsigned int year, mon, day, hour, min, sec; | ||
17 | |||
18 | extern void arch_gettod(int *year, int *mon, int *day, int *hour, | ||
19 | int *min, int *sec); | ||
20 | |||
21 | arch_gettod (&year, &mon, &day, &hour, &min, &sec); | ||
22 | |||
23 | if ((year += 1900) < 1970) | ||
24 | year += 100; | ||
25 | |||
26 | return mktime(year, mon, day, hour, min, sec); | ||
27 | } | ||
28 | |||
29 | int m68k_set_rtc_time(unsigned long nowtime) | ||
30 | { | ||
31 | if (mach_set_clock_mmss) | ||
32 | return mach_set_clock_mmss (nowtime); | ||
33 | return -1; | ||
34 | } | ||
35 | |||
36 | void apus_heartbeat (void) | ||
37 | { | ||
38 | #ifdef CONFIG_HEARTBEAT | ||
39 | static unsigned cnt = 0, period = 0, dist = 0; | ||
40 | |||
41 | if (cnt == 0 || cnt == dist) | ||
42 | mach_heartbeat( 1 ); | ||
43 | else if (cnt == 7 || cnt == dist+7) | ||
44 | mach_heartbeat( 0 ); | ||
45 | |||
46 | if (++cnt > period) { | ||
47 | cnt = 0; | ||
48 | /* The hyperbolic function below modifies the heartbeat period | ||
49 | * length in dependency of the current (5min) load. It goes | ||
50 | * through the points f(0)=126, f(1)=86, f(5)=51, | ||
51 | * f(inf)->30. */ | ||
52 | period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30; | ||
53 | dist = period / 4; | ||
54 | } | ||
55 | #endif | ||
56 | /* should be made smarter */ | ||
57 | ppc_md.heartbeat_count = 1; | ||
58 | } | ||