diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/config.h | 2 | ||||
| -rw-r--r-- | kernel/fifo.c | 16 | ||||
| -rw-r--r-- | kernel/fifo.h | 25 | ||||
| -rw-r--r-- | kernel/kernel.c | 8 | ||||
| -rw-r--r-- | kernel/kernel.h | 7 | ||||
| -rw-r--r-- | kernel/syscalls.c | 2 |
6 files changed, 52 insertions, 8 deletions
diff --git a/kernel/config.h b/kernel/config.h index 0a6fd3c..c4f9af1 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -8,7 +8,7 @@ #define FOOLOS_CONFIG_H #define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line -#define FOOLOS_LOG_OFF // do not log anything +//#define FOOLOS_LOG_OFF // do not log anything #define FOOLOS_CONSOLE // otherwise VESA will be used! #define FOOLSOS_SHOW_VESAMODES #define MEM_PRINT_MEMORYMAP diff --git a/kernel/fifo.c b/kernel/fifo.c new file mode 100644 index 0000000..abd6c46 --- /dev/null +++ b/kernel/fifo.c @@ -0,0 +1,16 @@ +#include "fifo.h" + +bool fifo_put(fifo* f,uint8_t c) +{ + return f->put(f->data,c); +} + +uint8_t fifo_get(fifo* f) +{ + return f->get(f->data); +} + +bool fifo_has(fifo* f) +{ + return f->has(f->data); +} diff --git a/kernel/fifo.h b/kernel/fifo.h new file mode 100644 index 0000000..bae7d57 --- /dev/null +++ b/kernel/fifo.h @@ -0,0 +1,25 @@ +// SIMPLE FIFO DRIVER + + +#ifndef FIFO_H +#define FIFO_H + +#include <stdint.h> +#include <stdbool.h> + +typedef struct fifo_struct +{ + bool (*put)(struct fifo_stuct*,uint8_t); + uint8_t (*get)(struct fifo_struct*); + bool (*has)(struct fifo_struct*); + + void *data; // opaque! can be a vt52 or a ringbuffer.. + +}fifo; + +bool fifo_put(fifo*,uint8_t); +uint8_t fifo_get(fifo*); +bool fifo_has(fifo*); + + +#endif diff --git a/kernel/kernel.c b/kernel/kernel.c index 0fb337f..dd3f502 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -11,6 +11,7 @@ #include "types.h" #include "lib/logger/log.h" +#include "fifo.h" #include "timer.h" #include "mem.h" #include "vmem.h" @@ -28,7 +29,6 @@ #include "terminal/vt52.h" #include "driver/console.h" -#include "fs/fifo.h" // // The Foolish structure of Fool OS! @@ -61,8 +61,7 @@ static void stdin_put_char(uint8_t c) static void init_stdio() { - fifo in=fifo_init(1); - fifo out=fifo_init(1); +// get_fool().std_in // // Setup terminal output / input @@ -75,8 +74,11 @@ static void init_stdio() 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); + } diff --git a/kernel/kernel.h b/kernel/kernel.h index fb4e44d..2929a28 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -3,12 +3,13 @@ #define KERNEL_VERSION "FoolOs 0.2.1" -#include "fs/fifo.h"; +#include "fifo.h" typedef struct fool_os_struct { - fifo fifo_stdin; - fifo fifo_stdout; + + fifo std_in; + fifo std_out; }fool_os; diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 9900567..cd54d7b 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -43,7 +43,7 @@ int syscall_write(int file, char *buf, int len) //stderr and stdout go to console for(int i=0;i<len;i++) { - fifo_put(&get_fool()->fifo_stdout,buf[i]); +// fifo_put(&get_fool()->fifo_stdout,buf[i]); } lock_release(2); //x86_int_enable(); |
