malta-display.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Display routines for display messages in MIPS boards ascii display.
  7. *
  8. * Copyright (C) 1999,2000,2012 MIPS Technologies, Inc.
  9. * All rights reserved.
  10. * Authors: Carsten Langgaard <carstenl@mips.com>
  11. * Steven J. Hill <sjhill@mips.com>
  12. */
  13. #include <linux/compiler.h>
  14. #include <linux/timer.h>
  15. #include <linux/io.h>
  16. #include <asm/mips-boards/generic.h>
  17. extern const char display_string[];
  18. static unsigned int display_count;
  19. static unsigned int max_display_count;
  20. void mips_display_message(const char *str)
  21. {
  22. static unsigned int __iomem *display = NULL;
  23. int i;
  24. if (unlikely(display == NULL))
  25. display = ioremap(ASCII_DISPLAY_POS_BASE, 16*sizeof(int));
  26. for (i = 0; i <= 14; i += 2) {
  27. if (*str)
  28. __raw_writel(*str++, display + i);
  29. else
  30. __raw_writel(' ', display + i);
  31. }
  32. }
  33. static void scroll_display_message(unsigned long data);
  34. static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
  35. static void scroll_display_message(unsigned long data)
  36. {
  37. mips_display_message(&display_string[display_count++]);
  38. if (display_count == max_display_count)
  39. display_count = 0;
  40. mod_timer(&mips_scroll_timer, jiffies + HZ);
  41. }
  42. void mips_scroll_message(void)
  43. {
  44. del_timer_sync(&mips_scroll_timer);
  45. max_display_count = strlen(display_string) + 1 - 8;
  46. mod_timer(&mips_scroll_timer, jiffies + 1);
  47. }