Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. #ifndef KOLIBRI_DEBUG_H
  2. #define KOLIBRI_DEBUG_H
  3.  
  4. #include <_ansi.h>
  5. #include <reent.h>
  6. #include <stdio.h>
  7. #include <stdarg.h>
  8.  
  9. /* Write a printf() like function (variable argument list) for
  10.    writing to debug board */
  11.  
  12. inline void debug_board_write_byte(const char ch){
  13.     __asm__ __volatile__(
  14.     "int $0x40"
  15.     :
  16.     :"a"(63), "b"(1), "c"(ch));
  17. }
  18.  
  19. //added noninline because incofortabre stepping in in debugger
  20. void __attribute__ ((noinline)) debug_board_write_str(const char* str){
  21.   while(*str)
  22.     debug_board_write_byte(*str++);
  23. }
  24.  
  25. void debug_board_printf(const char *format,...)
  26. {
  27.         va_list ap;
  28.         char log_board[300];
  29.        
  30.         va_start (ap, format);
  31.         vsprintf(log_board, format, ap);
  32.         va_end(ap);
  33.         debug_board_write_str(log_board);
  34. }
  35.  
  36. #endif /* KOLIBRI_DEBUG_H */
  37.