aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-13 22:21:37 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-13 22:21:37 -0800
commit0fa01cf03cfd6274518d82dfd0b5fc12ae6c4e48 (patch)
treee75b38a0b28d1d3ca03c98255f3de77507095bdb
parentc0cda3c772530d0b8c275fb382b2fe9d0efd5536 (diff)
downloadsyslinux-elf-0fa01cf03cfd6274518d82dfd0b5fc12ae6c4e48.tar.gz
syslinux-elf-0fa01cf03cfd6274518d82dfd0b5fc12ae6c4e48.tar.xz
syslinux-elf-0fa01cf03cfd6274518d82dfd0b5fc12ae6c4e48.zip
VESA: move debugging code to separate header file
Move the debugging function to a separate header file, so we can include it at will when convenient.
-rw-r--r--com32/lib/sys/vesa/debug.h36
-rw-r--r--com32/lib/sys/vesa/initvesa.c27
2 files changed, 38 insertions, 25 deletions
diff --git a/com32/lib/sys/vesa/debug.h b/com32/lib/sys/vesa/debug.h
new file mode 100644
index 00000000..50fed465
--- /dev/null
+++ b/com32/lib/sys/vesa/debug.h
@@ -0,0 +1,36 @@
+#ifndef LIB_SYS_VESA_DEBUG_H
+#define LIB_SYS_VESA_DEBUG_H
+
+#if 0
+
+#include <stdio.h>
+#include <unistd.h>
+
+ssize_t __serial_write(void *fp, const void *buf, size_t count);
+
+static void debug(const char *str, ...)
+{
+ va_list va;
+ char buf[65536];
+ size_t len;
+
+ va_start(va, str);
+ len = vsnprintf(buf, sizeof buf, str, va);
+ va_end(va);
+
+ if (len >= sizeof buf)
+ len = sizeof buf - 1;
+
+ __serial_write(NULL, buf, len);
+}
+
+#else
+
+static inline void debug(const char *str, ...)
+{
+ (void)str;
+}
+
+#endif
+
+#endif /* LIB_SYS_VESA_DEBUG_H */
diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c
index b5aba989..98888d32 100644
--- a/com32/lib/sys/vesa/initvesa.c
+++ b/com32/lib/sys/vesa/initvesa.c
@@ -34,14 +34,13 @@
#include <inttypes.h>
#include <com32.h>
-#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
+#include <string.h>
#include <sys/fpu.h>
#include "vesa.h"
#include "video.h"
#include "fill.h"
+#include "debug.h"
struct vesa_info __vesa_info;
@@ -54,28 +53,6 @@ uint8_t __vesacon_graphics_font[FONT_MAX_CHARS][FONT_MAX_HEIGHT];
uint32_t __vesacon_background[VIDEO_Y_SIZE][VIDEO_X_SIZE];
-ssize_t __serial_write(void *fp, const void *buf, size_t count);
-
-static inline void debug(const char *str, ...)
-{
-#if 0
- va_list va;
- char buf[65536];
- size_t len;
-
- va_start(va, str);
- len = vsnprintf(buf, sizeof buf, str, va);
- va_end(va);
-
- if (len >= sizeof buf)
- len = sizeof buf - 1;
-
- __serial_write(NULL, buf, len);
-#else
- (void)str;
-#endif
-}
-
static void unpack_font(uint8_t *dst, uint8_t *src, int height)
{
int i;