4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * a safe version of printf that might be useful for debugging parts that |
---|
3 | * are known to have problems e.g. with printf() e.t.c. |
---|
4 | * |
---|
5 | * $Id$ |
---|
6 | */ |
---|
7 | |
---|
8 | #include <_ansi.h> |
---|
9 | #ifdef _HAVE_STDC |
---|
10 | #include <stdarg.h> |
---|
11 | #else |
---|
12 | #include <varargs.h> |
---|
13 | #endif |
---|
14 | char kkBuf[1024]; |
---|
15 | /* Routine to do "console" in fully polled mode */ |
---|
16 | void static kkputs( const char *); |
---|
17 | format_string(char * fmt, va_list ap, char * kkBuf); |
---|
18 | #ifdef _HAVE_STDC |
---|
19 | void |
---|
20 | kkprintf (const char *fmt, ...) |
---|
21 | { |
---|
22 | va_list ap; |
---|
23 | |
---|
24 | va_start (ap, fmt); |
---|
25 | format_string (fmt, *ap+4, kkBuf); |
---|
26 | kkputs(kkBuf); |
---|
27 | va_end (ap); |
---|
28 | } |
---|
29 | void mkvisable() |
---|
30 | { |
---|
31 | kkputs("Hello"); |
---|
32 | } |
---|
33 | #else |
---|
34 | void |
---|
35 | kkprintf(fmt, va_alist) |
---|
36 | char * fmt; |
---|
37 | va_dcl |
---|
38 | { |
---|
39 | va_list ap; |
---|
40 | va_start(ap); |
---|
41 | format_string(fmt, ap, kkBuf); |
---|
42 | kkputs(kkBuf); |
---|
43 | va_end(ap); |
---|
44 | } |
---|
45 | #endif |
---|
46 | extern int DBGConsole_make_sync; |
---|
47 | void |
---|
48 | kkputs( const char * buf) |
---|
49 | { |
---|
50 | volatile unsigned int * consoleOP; |
---|
51 | unsigned char c; |
---|
52 | consoleOP = (unsigned int *) 0x1318; /* Outbound Message 0 */ |
---|
53 | while (( c = *buf++) != 0){ |
---|
54 | while( DBGConsole_make_sync && (*consoleOP != 0)) |
---|
55 | ; |
---|
56 | *consoleOP = (unsigned int)c; |
---|
57 | } |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.