Linux-2.6.12-rc2
[linux-2.6/next.git] / arch / sh / boards / sh03 / led.c
blobc851b0bec80f1244e4a415b58dede3b18334e73c
1 /*
2 * linux/arch/sh/boards/sh03/led.c
4 * Copyright (C) 2004 Saito.K Interface Corporation.
6 * This file contains Interface CTP/PCI-SH03 specific LED code.
7 */
9 #include <linux/config.h>
10 #include <linux/sched.h>
12 /* Cycle the LED's in the clasic Knightrider/Sun pattern */
13 void heartbeat_sh03(void)
15 static unsigned int cnt = 0, period = 0;
16 volatile unsigned char* p = (volatile unsigned char*)0xa0800000;
17 static unsigned bit = 0, up = 1;
19 cnt += 1;
20 if (cnt < period) {
21 return;
24 cnt = 0;
26 /* Go through the points (roughly!):
27 * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110
29 period = 110 - ( (300<<FSHIFT)/
30 ((avenrun[0]/5) + (3<<FSHIFT)) );
32 if (up) {
33 if (bit == 7) {
34 bit--;
35 up=0;
36 } else {
37 bit ++;
39 } else {
40 if (bit == 0) {
41 bit++;
42 up=1;
43 } else {
44 bit--;
47 *p = 1<<bit;