MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-omap / leds-h2p2-debug.c
blob8ff27af0b7c1ba05f3c4a9c122650b68aad56e77
1 /*
2 * linux/arch/arm/mach-omap/leds-h2p2-debug.c
4 * Copyright 2003 by Texas Instruments Incorporated
6 */
7 #include <linux/config.h>
8 #include <linux/init.h>
9 #include <linux/kernel_stat.h>
10 #include <linux/sched.h>
11 #include <linux/version.h>
13 #include <asm/io.h>
14 #include <asm/hardware.h>
15 #include <asm/leds.h>
16 #include <asm/system.h>
18 #include <asm/arch/fpga.h>
20 #include "leds.h"
22 void h2p2_dbg_leds_event(led_event_t evt)
24 unsigned long flags;
25 static unsigned long hw_led_state = 0;
27 local_irq_save(flags);
29 switch (evt) {
30 case led_start:
31 hw_led_state |= H2P2_DBG_FPGA_LED_STARTSTOP;
32 break;
34 case led_stop:
35 hw_led_state &= ~H2P2_DBG_FPGA_LED_STARTSTOP;
36 break;
38 case led_claim:
39 hw_led_state |= H2P2_DBG_FPGA_LED_CLAIMRELEASE;
40 break;
42 case led_release:
43 hw_led_state &= ~H2P2_DBG_FPGA_LED_CLAIMRELEASE;
44 break;
46 #ifdef CONFIG_LEDS_TIMER
47 case led_timer:
49 * Toggle Timer LED
51 if (hw_led_state & H2P2_DBG_FPGA_LED_TIMER)
52 hw_led_state &= ~H2P2_DBG_FPGA_LED_TIMER;
53 else
54 hw_led_state |= H2P2_DBG_FPGA_LED_TIMER;
55 break;
56 #endif
58 #ifdef CONFIG_LEDS_CPU
59 case led_idle_start:
60 hw_led_state |= H2P2_DBG_FPGA_LED_IDLE;
61 break;
63 case led_idle_end:
64 hw_led_state &= ~H2P2_DBG_FPGA_LED_IDLE;
65 break;
66 #endif
68 case led_halted:
69 if (hw_led_state & H2P2_DBG_FPGA_LED_HALTED)
70 hw_led_state &= ~H2P2_DBG_FPGA_LED_HALTED;
71 else
72 hw_led_state |= H2P2_DBG_FPGA_LED_HALTED;
73 break;
75 case led_green_on:
76 break;
78 case led_green_off:
79 break;
81 case led_amber_on:
82 break;
84 case led_amber_off:
85 break;
87 case led_red_on:
88 break;
90 case led_red_off:
91 break;
93 default:
94 break;
99 * Actually burn the LEDs
101 __raw_writew(~hw_led_state & 0xffff, H2P2_DBG_FPGA_LEDS);
103 local_irq_restore(flags);