dbg.c 672 B

1234567891011121314151617181920212223242526272829303132333435363738
  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/init.h>
  10. #include <linux/types.h>
  11. void __weak putc(char c)
  12. {
  13. }
  14. void puts(const char *s)
  15. {
  16. char c;
  17. while ((c = *s++) != '\0') {
  18. putc(c);
  19. if (c == '\n')
  20. putc('\r');
  21. }
  22. }
  23. void puthex(unsigned long long val)
  24. {
  25. unsigned char buf[10];
  26. int i;
  27. for (i = 7; i >= 0; i--) {
  28. buf[i] = "0123456789ABCDEF"[val & 0x0F];
  29. val >>= 4;
  30. }
  31. buf[8] = '\0';
  32. puts(buf);
  33. }