/*
|
/*
|
* a safe version of printf that might be useful for debugging parts that
|
* 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.
|
* are known to have problems e.g. with printf() e.t.c.
|
*
|
*
|
* $Id: kkprintf.c,v 1.2 2001-09-27 11:59:59 chris Exp $
|
* $Id: kkprintf.c,v 1.2 2001-09-27 11:59:59 chris Exp $
|
*/
|
*/
|
|
|
#include <_ansi.h>
|
#include <_ansi.h>
|
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
#include <stdarg.h>
|
#include <stdarg.h>
|
#else
|
#else
|
#include <varargs.h>
|
#include <varargs.h>
|
#endif
|
#endif
|
char kkBuf[1024];
|
char kkBuf[1024];
|
/* Routine to do "console" in fully polled mode */
|
/* Routine to do "console" in fully polled mode */
|
void static kkputs( const char *);
|
void static kkputs( const char *);
|
format_string(char * fmt, va_list ap, char * kkBuf);
|
format_string(char * fmt, va_list ap, char * kkBuf);
|
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
void
|
void
|
kkprintf (const char *fmt, ...)
|
kkprintf (const char *fmt, ...)
|
{
|
{
|
va_list ap;
|
va_list ap;
|
|
|
va_start (ap, fmt);
|
va_start (ap, fmt);
|
format_string (fmt, *ap+4, kkBuf);
|
format_string (fmt, *ap+4, kkBuf);
|
kkputs(kkBuf);
|
kkputs(kkBuf);
|
va_end (ap);
|
va_end (ap);
|
}
|
}
|
void mkvisable()
|
void mkvisable()
|
{
|
{
|
kkputs("Hello");
|
kkputs("Hello");
|
}
|
}
|
#else
|
#else
|
void
|
void
|
kkprintf(fmt, va_alist)
|
kkprintf(fmt, va_alist)
|
char * fmt;
|
char * fmt;
|
va_dcl
|
va_dcl
|
{
|
{
|
va_list ap;
|
va_list ap;
|
va_start(ap);
|
va_start(ap);
|
format_string(fmt, ap, kkBuf);
|
format_string(fmt, ap, kkBuf);
|
kkputs(kkBuf);
|
kkputs(kkBuf);
|
va_end(ap);
|
va_end(ap);
|
}
|
}
|
#endif
|
#endif
|
extern int DBGConsole_make_sync;
|
extern int DBGConsole_make_sync;
|
void
|
void
|
kkputs( const char * buf)
|
kkputs( const char * buf)
|
{
|
{
|
volatile unsigned int * consoleOP;
|
volatile unsigned int * consoleOP;
|
unsigned char c;
|
unsigned char c;
|
consoleOP = (unsigned int *) 0x1318; /* Outbound Message 0 */
|
consoleOP = (unsigned int *) 0x1318; /* Outbound Message 0 */
|
while (( c = *buf++) != 0){
|
while (( c = *buf++) != 0){
|
while( DBGConsole_make_sync && (*consoleOP != 0))
|
while( DBGConsole_make_sync && (*consoleOP != 0))
|
;
|
;
|
*consoleOP = (unsigned int)c;
|
*consoleOP = (unsigned int)c;
|
}
|
}
|
}
|
}
|
|
|
|
|
/* we have got an error during build for 'isatty()' wo/ good reason
|
/* we have got an error during build for 'isatty()' wo/ good reason
|
we temporarily use this fix....
|
we temporarily use this fix....
|
*/
|
*/
|
isatty(int fd)
|
isatty(int fd)
|
{
|
{
|
return 1;
|
return 1;
|
}
|
}
|
|
|
|
|