linux/arch/mips/emma2rh/markeins/led.c
<<
>>
Prefs
   1/*
   2 *  arch/mips/emma2rh/markeins/led.c
   3 *      This file defines the led display for Mark-eins.
   4 *
   5 *  Copyright (C) NEC Electronics Corporation 2004-2006
   6 *
   7 *  This program is free software; you can redistribute it and/or modify
   8 *  it under the terms of the GNU General Public License as published by
   9 *  the Free Software Foundation; either version 2 of the License, or
  10 *  (at your option) any later version.
  11 *
  12 *  This program is distributed in the hope that it will be useful,
  13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15 *  GNU General Public License for more details.
  16 *
  17 *  You should have received a copy of the GNU General Public License
  18 *  along with this program; if not, write to the Free Software
  19 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20 */
  21#include <linux/kernel.h>
  22#include <linux/types.h>
  23#include <linux/string.h>
  24#include <asm/emma2rh/emma2rh.h>
  25
  26const unsigned long clear = 0x20202020;
  27
  28#define LED_BASE 0xb1400038
  29
  30void markeins_led_clear(void)
  31{
  32        emma2rh_out32(LED_BASE, clear);
  33        emma2rh_out32(LED_BASE + 4, clear);
  34}
  35
  36void markeins_led(const char *str)
  37{
  38        int i;
  39        int len = strlen(str);
  40
  41        markeins_led_clear();
  42        if (len > 8)
  43                len = 8;
  44
  45        if (emma2rh_in32(0xb0000800) & (0x1 << 18))
  46                for (i = 0; i < len; i++)
  47                        emma2rh_out8(LED_BASE + i, str[i]);
  48        else
  49                for (i = 0; i < len; i++)
  50                        emma2rh_out8(LED_BASE + (i & 4) + (3 - (i & 3)),
  51                                     str[i]);
  52}
  53
  54void markeins_led_hex(u32 val)
  55{
  56        char str[10];
  57
  58        sprintf(str, "%08x", val);
  59        markeins_led(str);
  60}
  61
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.