Rev 6535 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6535 | Rev 6612 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | #include |
7 | #include |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | /* Write a printf() like function (variable argument list) for |
9 | /* Write a printf() like function (variable argument list) for |
Line 10... | Line 10... | ||
10 | writing to debug board */ |
10 | writing to debug board */ |
11 | 11 | ||
12 | inline void debug_board_write_byte(const char ch){ |
12 | static inline void debug_board_write_byte(const char ch){ |
13 | __asm__ __volatile__( |
13 | __asm__ __volatile__( |
14 | "int $0x40" |
14 | "int $0x40" |
15 | : |
15 | : |
Line 20... | Line 20... | ||
20 | void __attribute__ ((noinline)) debug_board_write_str(const char* str){ |
20 | void __attribute__ ((noinline)) debug_board_write_str(const char* str){ |
21 | while(*str) |
21 | while(*str) |
22 | debug_board_write_byte(*str++); |
22 | debug_board_write_byte(*str++); |
23 | } |
23 | } |
Line 24... | Line 24... | ||
24 | 24 | ||
25 | void debug_board_printf(const char *format,...) |
25 | static inline void debug_board_printf(const char *format,...) |
26 | { |
26 | { |
27 | va_list ap; |
27 | va_list ap; |
Line 28... | Line 28... | ||
28 | char log_board[300]; |
28 | char log_board[300]; |
29 | 29 | ||
30 | va_start (ap, format); |
30 | va_start (ap, format); |
31 | vsprintf(log_board, format, ap); |
31 | vsprintf(log_board, format, ap); |
32 | va_end(ap); |
32 | va_end(ap); |
Line -... | Line 33... | ||
- | 33 | debug_board_write_str(log_board); |
|
- | 34 | } |
|
- | 35 | ||
- | 36 | __attribute__ ((noinline)) void trap(int n) |
|
- | 37 | { |
|
- | 38 | // nothing todo, just see n in debugger. use "bp trap" command |
|
- | 39 | __asm__ __volatile__( |
|
- | 40 | "nop" |
|
- | 41 | : |
|
33 | debug_board_write_str(log_board); |
42 | :"a"(n)); |