#include <stdio.h>
-int dprintf(const char *, ...);
-int vdprintf(const char *, va_list);
+void dprintf(const char *, ...);
+void vdprintf(const char *, va_list);
#else
#define DEBUG 1
#include <dprintf.h>
-int dprintf(const char *format, ...)
+void dprintf(const char *format, ...)
{
va_list ap;
- int rv;
va_start(ap, format);
- rv = vdprintf(format, ap);
+ vdprintf(format, ap);
va_end(ap);
- return rv;
}
#include <unistd.h>
#include <inttypes.h>
#include <sys/io.h>
+#include <sys/cpu.h>
#undef DEBUG
#define DEBUG 1
#define BUFFER_SIZE 32768
-struct file_info;
-extern ssize_t __serial_write(struct file_info *, const void *, size_t);
-
static const uint16_t debug_base = 0x03f8; /* I/O base address */
-int vdprintf(const char *format, va_list ap)
+void vdprintf(const char *format, va_list ap)
{
int rv;
char buffer[BUFFER_SIZE];
rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
if (rv < 0)
- return rv;
+ return;
if (rv > BUFFER_SIZE - 1)
rv = BUFFER_SIZE - 1;
* if one is enabled or not (this means we don't have to enable the real
* serial console and therefore get conflicting output.)
*/
+ p = buffer;
while (rv--) {
while ((inb(debug_base+5) & 0x20) == 0)
- ;
+ cpu_relax();
outb(*p++, debug_base);
}
}