2 * linux/arch/sh/boards/superh/microdev/led.c
4 * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
5 * Copyright (C) 2003 Richard Curnow (Richard.Curnow@superh.com)
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
14 #define LED_REGISTER 0xa6104d20
16 static void mach_led_d9(int value
)
19 reg
= ctrl_inl(LED_REGISTER
);
22 ctrl_outl(reg
, LED_REGISTER
);
26 static void mach_led_d10(int value
)
29 reg
= ctrl_inl(LED_REGISTER
);
31 reg
|= ((value
& 1) << 1);
32 ctrl_outl(reg
, LED_REGISTER
);
37 #ifdef CONFIG_HEARTBEAT
38 #include <linux/sched.h>
40 static unsigned char banner_table
[] = {
41 0x11, 0x01, 0x11, 0x01, 0x11, 0x03,
42 0x11, 0x01, 0x11, 0x01, 0x13, 0x03,
43 0x11, 0x01, 0x13, 0x01, 0x13, 0x01, 0x11, 0x03,
45 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
46 0x11, 0x01, 0x11, 0x01, 0x11, 0x01, 0x11, 0x07,
47 0x13, 0x01, 0x13, 0x03,
48 0x11, 0x01, 0x11, 0x03,
49 0x13, 0x01, 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
50 0x11, 0x01, 0x13, 0x01, 0x11, 0x03,
51 0x13, 0x01, 0x13, 0x01, 0x13, 0x03,
52 0x13, 0x01, 0x11, 0x01, 0x11, 0x03,
54 0x11, 0x01, 0x11, 0x01, 0x11, 0x01, 0x13, 0x07,
58 static void banner(void)
66 int val
= banner_table
[pos
];
69 val
= banner_table
[pos
];
72 mach_led_d10((val
>> 4) & 1);
73 count
= 10 * (val
& 0xf);
77 /* From heartbeat_harp in the stboards directory */
78 /* acts like an actual heart beat -- ie thump-thump-pause... */
79 void microdev_heartbeat(void)
81 static unsigned cnt
= 0, period
= 0, dist
= 0;
83 if (cnt
== 0 || cnt
== dist
)
85 else if (cnt
== 7 || cnt
== dist
+7)
90 /* The hyperbolic function below modifies the heartbeat period
91 * length in dependency of the current (5min) load. It goes
92 * through the points f(0)=126, f(1)=86, f(5)=51,
94 period
= ((672<<FSHIFT
)/(5*avenrun
[0]+(7<<FSHIFT
))) + 30;