arc_con.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Wrap-around code for a console using the
  3.  * ARC io-routines.
  4.  *
  5.  * Copyright (c) 1998 Harald Koerfgen
  6.  * Copyright (c) 2001 Ralf Baechle
  7.  * Copyright (c) 2002 Thiemo Seufer
  8.  */
  9. #include <linux/tty.h>
  10. #include <linux/major.h>
  11. #include <linux/ptrace.h>
  12. #include <linux/init.h>
  13. #include <linux/console.h>
  14. #include <linux/fs.h>
  15. #include <asm/sgialib.h>
  16. static void prom_console_write(struct console *co, const char *s,
  17.        unsigned count)
  18. {
  19. /* Do each character */
  20. while (count--) {
  21. if (*s == 'n')
  22. prom_putchar('r');
  23. prom_putchar(*s++);
  24. }
  25. }
  26. static kdev_t prom_console_device(struct console *co)
  27. {
  28. return MKDEV(TTY_MAJOR, 64 + co->index);
  29. }
  30. static int __init prom_console_setup(struct console *co, char *options)
  31. {
  32. if (prom_flags & PROM_FLAG_USE_AS_CONSOLE)
  33. return 0;
  34. else
  35. return 1;
  36. }
  37. static struct console arc_cons = {
  38. name: "ttyS",
  39. write: prom_console_write,
  40. device: prom_console_device,
  41. setup: prom_console_setup,
  42. flags: CON_PRINTBUFFER,
  43. index: -1,
  44. };
  45. /*
  46.  *    Register console.
  47.  */
  48. void __init arc_console_init(void)
  49. {
  50. register_console(&arc_cons);
  51. }