console_64.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* console.c: Routines that deal with sending and receiving IO
  2. * to/from the current console device using the PROM.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
  5. * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6. */
  7. #include <linux/types.h>
  8. #include <linux/kernel.h>
  9. #include <linux/sched.h>
  10. #include <asm/openprom.h>
  11. #include <asm/oplib.h>
  12. #include <asm/system.h>
  13. #include <linux/string.h>
  14. extern int prom_stdin, prom_stdout;
  15. /* Non blocking put character to console device, returns -1 if
  16. * unsuccessful.
  17. */
  18. static int prom_nbputchar(const char *buf)
  19. {
  20. unsigned long args[7];
  21. args[0] = (unsigned long) "write";
  22. args[1] = 3;
  23. args[2] = 1;
  24. args[3] = (unsigned int) prom_stdout;
  25. args[4] = (unsigned long) buf;
  26. args[5] = 1;
  27. args[6] = (unsigned long) -1;
  28. p1275_cmd_direct(args);
  29. if (args[6] == 1)
  30. return 0;
  31. else
  32. return -1;
  33. }
  34. /* Blocking version of put character routine above. */
  35. void prom_putchar(const char *buf)
  36. {
  37. while (1) {
  38. int err = prom_nbputchar(buf);
  39. if (!err)
  40. break;
  41. }
  42. }