summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c')
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c b/c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c
new file mode 100644
index 0000000000..f2193ad606
--- /dev/null
+++ b/c/src/lib/libbsp/i960/rxgen960/startup/kkprintf.c
@@ -0,0 +1,65 @@
+/*
+ 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.
+*/
+#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;
+ }
+}
+
+
+/* we have got an error during build for 'isatty()' wo/ good reason
+ we temporarily use this fix....
+*/
+isatty(int fd)
+{
+ return 1;
+}
+