MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-sa1100 / leds-adsbitsy.c
blob5b8ca7119a9089c98b813aab28409747a40e21bd
1 /*
2 * linux/arch/arm/mach-sa1100/leds-adsbitsy.c
4 * ADS Bitsy LED
5 * 7/25/01 Woojung Huh
6 */
7 #include <linux/config.h>
8 #include <linux/init.h>
10 #include <asm/hardware.h>
11 #include <asm/leds.h>
12 #include <asm/system.h>
14 #include "leds.h"
17 #define LED_STATE_ENABLED 1
18 #define LED_STATE_CLAIMED 2
20 static unsigned int led_state;
21 static unsigned int hw_led_state;
23 #define LED_TIMER GPIO_GPIO20 /* green heartbeat */
25 #define LED_MASK (LED_TIMER)
27 void adsbitsy_leds_event(led_event_t evt)
29 unsigned long flags;
31 local_irq_save(flags);
33 switch (evt) {
34 case led_start:
35 hw_led_state = 0; /* gc leds are positive logic */
36 led_state = LED_STATE_ENABLED;
37 break;
39 case led_stop:
40 led_state &= ~LED_STATE_ENABLED;
41 break;
43 case led_claim:
44 led_state |= LED_STATE_CLAIMED;
45 hw_led_state = LED_MASK;
46 break;
48 case led_release:
49 led_state &= ~LED_STATE_CLAIMED;
50 hw_led_state = LED_MASK;
51 break;
53 #ifdef CONFIG_LEDS_TIMER
54 case led_timer:
55 if (!(led_state & LED_STATE_CLAIMED))
56 hw_led_state ^= LED_TIMER;
57 break;
58 #endif
60 #ifdef CONFIG_LEDS_CPU
61 case led_idle_start:
62 break;
64 case led_idle_end:
65 break;
66 #endif
68 case led_green_on:
69 break;
71 case led_green_off:
72 break;
74 case led_amber_on:
75 break;
77 case led_amber_off:
78 break;
80 case led_red_on:
81 break;
83 case led_red_off:
84 break;
86 default:
87 break;
90 if (led_state & LED_STATE_ENABLED) {
91 GPSR = hw_led_state;
92 GPCR = hw_led_state ^ LED_MASK;
95 local_irq_restore(flags);