diff options
author | Your Name <you@example.com> | 2020-06-24 16:06:22 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2020-06-24 16:06:22 +0200 |
commit | b54f79b2325e54e4b6c8a1bd8dba8227ba962260 (patch) | |
tree | fc580dd81d78d4acaa490f01a801fdecdaf75275 | |
parent | stdlib: add memcmp() and strncmp() (diff) | |
download | pOS-b54f79b2325e54e4b6c8a1bd8dba8227ba962260.tar.gz pOS-b54f79b2325e54e4b6c8a1bd8dba8227ba962260.tar.bz2 pOS-b54f79b2325e54e4b6c8a1bd8dba8227ba962260.zip |
stdlib: add getc()
-rw-r--r-- | src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp | 3 | ||||
-rw-r--r-- | src/pOS/arch/x86/libc/stdio/getc.cpp | 9 | ||||
-rw-r--r-- | src/pOS/include/libc/stdio.h | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp b/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp index c32cbdb..c8088e3 100644 --- a/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp +++ b/src/pOS/arch/x86/kernel/drivers/keyboard/keyboard.cpp @@ -9,6 +9,5 @@ void keyboard_handler(struct regs *r) //dbgprintf("Sc: %d\n", scancode); - if(!KB_BUF::scan(scancode)) - putc(KB_BUF::keyboard_dequeue()); + KB_BUF::scan(scancode); } diff --git a/src/pOS/arch/x86/libc/stdio/getc.cpp b/src/pOS/arch/x86/libc/stdio/getc.cpp new file mode 100644 index 0000000..e0d1b09 --- /dev/null +++ b/src/pOS/arch/x86/libc/stdio/getc.cpp @@ -0,0 +1,9 @@ +#include <stdio.h> +#include "../../kernel/drivers/keyboard/include/kbbuf.h" + +char getc(void) +{ + char result; + while((result = KB_BUF::keyboard_dequeue()) == 0); //Sleep + return result; +} diff --git a/src/pOS/include/libc/stdio.h b/src/pOS/include/libc/stdio.h index 844c817..7b5f144 100644 --- a/src/pOS/include/libc/stdio.h +++ b/src/pOS/include/libc/stdio.h @@ -14,6 +14,8 @@ int sprintf(char* buf, const char* format, ...); int print(const char* str); int putc(const char c); +char getc(void); //for now void + class Debug { public: |