summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c
blob: 5ff680761094b3f216f098a6afdb78075637d244 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 *  a safe version of printf that might be useful for debugging parts that
 *  are known to have problems e.g. with printf() e.t.c.
 *
 *  $Id$
 */

#include <_ansi.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
char   kkBuf[1024];
/* Routine to do "console" in fully polled mode */
void static kkputs( const char *);
format_string(char * fmt, va_list ap, char * kkBuf);
#ifdef _HAVE_STDC
void
kkprintf (const char *fmt, ...)
{
  va_list ap;

  va_start (ap, fmt);
  format_string (fmt, *ap+4, kkBuf);
  kkputs(kkBuf);
  va_end (ap);
}
void mkvisable()
{
 kkputs("Hello");
}
#else
void
kkprintf(fmt, va_alist)
char * fmt;
va_dcl
{
	va_list ap;
	va_start(ap);
	format_string(fmt, ap, kkBuf);
	kkputs(kkBuf);
	va_end(ap);
}
#endif
extern int DBGConsole_make_sync;
void
kkputs( const char * buf)
{
	volatile unsigned int * consoleOP;
	unsigned char c;
	consoleOP = (unsigned int *) 0x1318;	/* Outbound Message 0 */
	while (( c = *buf++) != 0){
		while( DBGConsole_make_sync && (*consoleOP != 0))
			;
		*consoleOP = (unsigned int)c;
	}
}