diff options
author | Your Name <you@example.com> | 2020-06-24 16:21:30 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2020-06-24 16:21:30 +0200 |
commit | 665e370d806b641b3916034d75f7325eff41ccf2 (patch) | |
tree | ae33c2ca4006d8bbdde2c8c6698df97eb367dbf3 /src | |
parent | Driver: added basic support for keybinds in the Keyboard driver (diff) | |
download | pOS-665e370d806b641b3916034d75f7325eff41ccf2.tar.gz pOS-665e370d806b641b3916034d75f7325eff41ccf2.tar.bz2 pOS-665e370d806b641b3916034d75f7325eff41ccf2.zip |
Base: improved debug printing
Previously keyboard input was not outputed to the serial port for debugging purposes. Now it is as we modified the putc() function.
Diffstat (limited to 'src')
-rw-r--r-- | src/pOS/arch/x86/libc/stdio/printf.cpp | 14 | ||||
-rw-r--r-- | src/pOS/arch/x86/libc/stdio/putc.cpp | 3 | ||||
-rw-r--r-- | src/pOS/include/libc/stdio.h | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/pOS/arch/x86/libc/stdio/printf.cpp b/src/pOS/arch/x86/libc/stdio/printf.cpp index dc880ac..c85c26e 100644 --- a/src/pOS/arch/x86/libc/stdio/printf.cpp +++ b/src/pOS/arch/x86/libc/stdio/printf.cpp @@ -1,23 +1,15 @@ #include <stdio.h> -static bool serial_debug = false; +bool serial_debug = false; void Debug::set_serial_debug(bool state) { serial_debug = state; } -static void console_out(char c) -{ - if (serial_debug) - Serial::serial_putch(c); - - putc(c); -} - static void console_putch(char*&, char c) //wrapper so that we can sprintf { - console_out(c); + putc(c); } int printf(const char* fmt, ...) @@ -32,6 +24,6 @@ int printf(const char* fmt, ...) int print(const char* str, int len) { for (int i = 0; i < len; ++i) - console_out(str[i]); + putc(str[i]); return 0; } diff --git a/src/pOS/arch/x86/libc/stdio/putc.cpp b/src/pOS/arch/x86/libc/stdio/putc.cpp index ce01839..18fe95f 100644 --- a/src/pOS/arch/x86/libc/stdio/putc.cpp +++ b/src/pOS/arch/x86/libc/stdio/putc.cpp @@ -2,5 +2,8 @@ int putc(const char c) { + if (serial_debug) + Serial::serial_putch(c); + return TTY::tty_putc(c); } diff --git a/src/pOS/include/libc/stdio.h b/src/pOS/include/libc/stdio.h index 7b5f144..fa3a35e 100644 --- a/src/pOS/include/libc/stdio.h +++ b/src/pOS/include/libc/stdio.h @@ -9,6 +9,8 @@ #define EOF (-1) +extern bool serial_debug; + int printf(const char* format, ...); int sprintf(char* buf, const char* format, ...); int print(const char* str); |