diff options
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index dd3f502..5350109 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -18,6 +18,7 @@ #include "mp.h" #include "interrupts.h" #include "multiboot.h" +#include "ringbuffer.h" #include <stddef.h> @@ -41,12 +42,16 @@ fool_os *get_fool() } // // -// // stdio init : TODO: move away! static vt52_tty tty1; +static term_out screen; +static term_in input; + +static ringbuffer stdin_buf; + static void put_kb(uint8_t c) { @@ -55,30 +60,32 @@ static void put_kb(uint8_t c) static void stdin_put_char(uint8_t c) { - vt52_kb(&tty1,c); + ringbuffer_put(&stdin_buf,c); } - static void init_stdio() { -// get_fool().std_in - // // Setup terminal output / input // - term_out screen; + screen.put_char=console_put_char; screen.update_cursor=update_cursor; - term_in input; input.put_char=stdin_put_char; tty1=vt52_init(&screen,&input); + get_fool()->std_out.data=&tty1; get_fool()->std_out.put=vt52_put; - keyboard_init(put_kb); + stdin_buf=ringbuffer_init(1); + get_fool()->std_in.data=&stdin_buf; + get_fool()->std_in.put=ringbuffer_put; + get_fool()->std_in.get=ringbuffer_get; + get_fool()->std_in.has=ringbuffer_has; + keyboard_init(put_kb); } @@ -147,8 +154,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) smp_log_procdata(&procdata); smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr - - // // Activate Virtual Memory (paging) // @@ -161,8 +166,10 @@ void kernel_main(uint32_t eax,uint32_t ebx) // Its driver will be hopefully implemented one day ;) TODO // //pci_init(); - + //empty stdin! + while(fifo_has(&get_fool()->std_in)) + fifo_get(&get_fool()->std_in); // // Initialize Multitasking |
