2016-04-11 15:38:48 +02:00
|
|
|
#ifndef KOLIBRI_DEBUG_H
|
|
|
|
#define KOLIBRI_DEBUG_H
|
|
|
|
|
2016-04-12 22:37:56 +02:00
|
|
|
#include <_ansi.h>
|
|
|
|
#include <reent.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2016-04-12 20:50:48 +02:00
|
|
|
/* Write a printf() like function (variable argument list) for
|
2016-04-11 15:38:48 +02: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 20:50:48 +02:00
|
|
|
|
|
|
|
//added noninline because incofortabre stepping in in debugger
|
|
|
|
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
|
2016-04-11 15:38:48 +02:00
|
|
|
while(*str)
|
|
|
|
debug_board_write_byte(*str++);
|
|
|
|
}
|
|
|
|
|
2016-04-13 08:36:36 +02:00
|
|
|
void debug_board_printf(const char *format,...)
|
2016-04-12 22:37:56 +02:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
char log_board[300];
|
2016-09-27 11:47:30 +02:00
|
|
|
|
2016-04-12 22:37:56 +02:00
|
|
|
va_start (ap, format);
|
|
|
|
vsprintf(log_board, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
debug_board_write_str(log_board);
|
|
|
|
}
|
2016-04-11 15:38:48 +02:00
|
|
|
|
|
|
|
#endif /* KOLIBRI_DEBUG_H */
|