mn10300-debug.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Debugging stuff for the MN10300-based processors
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/sched.h>
  12. #include <asm/serial-regs.h>
  13. #undef MN10300_CONSOLE_ON_SERIO
  14. /*
  15. * write a string directly through one of the serial ports on-board the MN10300
  16. */
  17. #ifdef MN10300_CONSOLE_ON_SERIO
  18. void debug_to_serial_mnser(const char *p, int n)
  19. {
  20. char ch;
  21. for (; n > 0; n--) {
  22. ch = *p++;
  23. #if MN10300_CONSOLE_ON_SERIO == 0
  24. while (SC0STR & (SC01STR_TBF)) continue;
  25. SC0TXB = ch;
  26. while (SC0STR & (SC01STR_TBF)) continue;
  27. if (ch == 0x0a) {
  28. SC0TXB = 0x0d;
  29. while (SC0STR & (SC01STR_TBF)) continue;
  30. }
  31. #elif MN10300_CONSOLE_ON_SERIO == 1
  32. while (SC1STR & (SC01STR_TBF)) continue;
  33. SC1TXB = ch;
  34. while (SC1STR & (SC01STR_TBF)) continue;
  35. if (ch == 0x0a) {
  36. SC1TXB = 0x0d;
  37. while (SC1STR & (SC01STR_TBF)) continue;
  38. }
  39. #elif MN10300_CONSOLE_ON_SERIO == 2
  40. while (SC2STR & (SC2STR_TBF)) continue;
  41. SC2TXB = ch;
  42. while (SC2STR & (SC2STR_TBF)) continue;
  43. if (ch == 0x0a) {
  44. SC2TXB = 0x0d;
  45. while (SC2STR & (SC2STR_TBF)) continue;
  46. }
  47. #endif
  48. }
  49. }
  50. #endif