linux-old/arch/arm/mach-sa1100/leds-adsbitsy.c
<<
>>
Prefs
   1/*
   2 *  linux/arch/arm/mach-sa1100/leds-adsbitsy.c
   3 *
   4 * ADS Bitsy LED
   5 * 7/25/01 Woojung Huh
   6 */
   7#include <linux/config.h>
   8#include <linux/init.h>
   9
  10#include <asm/hardware.h>
  11#include <asm/leds.h>
  12#include <asm/system.h>
  13
  14#include "leds.h"
  15
  16
  17#define LED_STATE_ENABLED       1
  18#define LED_STATE_CLAIMED       2
  19
  20static unsigned int led_state;
  21static unsigned int hw_led_state;
  22
  23#define LED_TIMER       GPIO_GPIO20  /* green heartbeat */
  24
  25#define LED_MASK                (LED_TIMER)
  26
  27void adsbitsy_leds_event(led_event_t evt)
  28{
  29        unsigned long flags;
  30
  31        local_irq_save(flags);
  32
  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;
  38
  39        case led_stop:
  40                led_state &= ~LED_STATE_ENABLED;
  41                break;
  42
  43        case led_claim:
  44                led_state |= LED_STATE_CLAIMED;
  45                hw_led_state = LED_MASK;
  46                break;
  47
  48        case led_release:
  49                led_state &= ~LED_STATE_CLAIMED;
  50                hw_led_state = LED_MASK;
  51                break;
  52
  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
  59
  60#ifdef CONFIG_LEDS_CPU
  61        case led_idle_start:
  62                break;
  63
  64        case led_idle_end:
  65                break;
  66#endif
  67
  68        case led_green_on:
  69                break;
  70
  71        case led_green_off:
  72                break;
  73
  74        case led_amber_on:
  75                break;
  76
  77        case led_amber_off:
  78                break;
  79
  80        case led_red_on:
  81                break;
  82
  83        case led_red_off:
  84                break;
  85
  86        default:
  87                break;
  88        }
  89
  90        if  (led_state & LED_STATE_ENABLED) {
  91                GPSR = hw_led_state;
  92                GPCR = hw_led_state ^ LED_MASK;
  93        }
  94
  95        local_irq_restore(flags);
  96}
  97
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.