2016-04-11 16:38:48 +03:00
|
|
|
#ifndef KOLIBRI_DEBUG_H
|
|
|
|
#define KOLIBRI_DEBUG_H
|
|
|
|
|
2016-04-12 23:37:56 +03:00
|
|
|
#include <_ansi.h>
|
|
|
|
#include <reent.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2016-04-12 21:50:48 +03:00
|
|
|
/* Write a printf() like function (variable argument list) for
|
2016-04-11 16:38:48 +03:00
|
|
|
writing to debug board */
|
|
|
|
|
|
|
|
inline void debug_board_write_byte(const char ch){
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"int $0x40"
|
|
|
|
:
|
|
|
|
:"a"(63), "b"(1), "c"(ch));
|
|
|
|
}
|
2016-04-12 21:50:48 +03:00
|
|
|
|
|
|
|
//added noninline because incofortabre stepping in in debugger
|
|
|
|
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
|
2016-04-11 16:38:48 +03:00
|
|
|
while(*str)
|
|
|
|
debug_board_write_byte(*str++);
|
|
|
|
}
|
|
|
|
|
2016-04-13 09:36:36 +03:00
|
|
|
void debug_board_printf(const char *format,...)
|
2016-04-12 23:37:56 +03:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
char log_board[300];
|
|
|
|
|
|
|
|
va_start (ap, format);
|
|
|
|
vsprintf(log_board, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
debug_board_write_str(log_board);
|
|
|
|
}
|
2016-04-11 16:38:48 +03:00
|
|
|
|
|
|
|
#endif /* KOLIBRI_DEBUG_H */
|