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/sh/boards/sh03/led.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/sh/boards/sh03/led.c')
-rw-r--r-- | arch/sh/boards/sh03/led.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/sh/boards/sh03/led.c b/arch/sh/boards/sh03/led.c new file mode 100644 index 000000000000..c851b0bec80f --- /dev/null +++ b/arch/sh/boards/sh03/led.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/sh03/led.c | ||
3 | * | ||
4 | * Copyright (C) 2004 Saito.K Interface Corporation. | ||
5 | * | ||
6 | * This file contains Interface CTP/PCI-SH03 specific LED code. | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/sched.h> | ||
11 | |||
12 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
13 | void heartbeat_sh03(void) | ||
14 | { | ||
15 | static unsigned int cnt = 0, period = 0; | ||
16 | volatile unsigned char* p = (volatile unsigned char*)0xa0800000; | ||
17 | static unsigned bit = 0, up = 1; | ||
18 | |||
19 | cnt += 1; | ||
20 | if (cnt < period) { | ||
21 | return; | ||
22 | } | ||
23 | |||
24 | cnt = 0; | ||
25 | |||
26 | /* Go through the points (roughly!): | ||
27 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
28 | */ | ||
29 | period = 110 - ( (300<<FSHIFT)/ | ||
30 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
31 | |||
32 | if (up) { | ||
33 | if (bit == 7) { | ||
34 | bit--; | ||
35 | up=0; | ||
36 | } else { | ||
37 | bit ++; | ||
38 | } | ||
39 | } else { | ||
40 | if (bit == 0) { | ||
41 | bit++; | ||
42 | up=1; | ||
43 | } else { | ||
44 | bit--; | ||
45 | } | ||
46 | } | ||
47 | *p = 1<<bit; | ||
48 | |||
49 | } | ||