panic.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2003 Richard Curnow, SuperH UK Limited
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/io.h>
  10. #include <cpu/registers.h>
  11. /* THIS IS A PHYSICAL ADDRESS */
  12. #define HDSP2534_ADDR (0x04002100)
  13. static void poor_mans_delay(void)
  14. {
  15. int i;
  16. for (i = 0; i < 2500000; i++)
  17. cpu_relax();
  18. }
  19. static void show_value(unsigned long x)
  20. {
  21. int i;
  22. unsigned nibble;
  23. for (i = 0; i < 8; i++) {
  24. nibble = ((x >> (i * 4)) & 0xf);
  25. __raw_writeb(nibble + ((nibble > 9) ? 55 : 48),
  26. HDSP2534_ADDR + 0xe0 + ((7 - i) << 2));
  27. }
  28. }
  29. void
  30. panic_handler(unsigned long panicPC, unsigned long panicSSR,
  31. unsigned long panicEXPEVT)
  32. {
  33. while (1) {
  34. /* This piece of code displays the PC on the LED display */
  35. show_value(panicPC);
  36. poor_mans_delay();
  37. show_value(panicSSR);
  38. poor_mans_delay();
  39. show_value(panicEXPEVT);
  40. poor_mans_delay();
  41. }
  42. }