dbg.c 648 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * MIPS-specific debug support for pre-boot environment
  3. *
  4. * NOTE: putc() is board specific, if your board have a 16550 compatible uart,
  5. * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. othewise, you
  6. * need to implement your own putc().
  7. */
  8. #include <linux/compiler.h>
  9. #include <linux/types.h>
  10. void __weak putc(char c)
  11. {
  12. }
  13. void puts(const char *s)
  14. {
  15. char c;
  16. while ((c = *s++) != '\0') {
  17. putc(c);
  18. if (c == '\n')
  19. putc('\r');
  20. }
  21. }
  22. void puthex(unsigned long long val)
  23. {
  24. unsigned char buf[10];
  25. int i;
  26. for (i = 7; i >= 0; i--) {
  27. buf[i] = "0123456789ABCDEF"[val & 0x0F];
  28. val >>= 4;
  29. }
  30. buf[8] = '\0';
  31. puts(buf);
  32. }