summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--driver/console.c (renamed from video/console.c)0
-rw-r--r--driver/console.h (renamed from video/console.h)0
-rw-r--r--driver/keyboard.c (renamed from kernel/keyboard.c)21
-rw-r--r--driver/keyboard.h (renamed from kernel/keyboard.h)0
-rw-r--r--fs/file.h4
-rw-r--r--kernel/kernel.c23
-rw-r--r--terminal/vt52.c8
-rw-r--r--terminal/vt52.h35
-rw-r--r--xxx/lib/buffer/ringbuffer.c (renamed from lib/buffer/ringbuffer.c)0
-rw-r--r--xxx/lib/buffer/ringbuffer.h (renamed from lib/buffer/ringbuffer.h)0
-rw-r--r--xxx/lib/logger/log.c (renamed from lib/logger/log.c)0
-rw-r--r--xxx/lib/logger/log.h (renamed from lib/logger/log.h)0
-rw-r--r--xxx/lib/printf/printf.c (renamed from lib/printf/printf.c)0
-rw-r--r--xxx/lib/printf/printf.h (renamed from lib/printf/printf.h)0
-rw-r--r--xxx/lib/string/string.c (renamed from lib/string/string.c)0
-rw-r--r--xxx/lib/string/string.h (renamed from lib/string/string.h)0
-rw-r--r--xxx/video/vesa.c (renamed from video/vesa.c)0
-rw-r--r--xxx/video/vesa.h (renamed from video/vesa.h)0
19 files changed, 65 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index 11a8d66..92b60e2 100644
--- a/Makefile
+++ b/Makefile
@@ -66,9 +66,8 @@ ASFLAGS+=-gstabs
#kernel sources (asm and c)
SOURCES=
SOURCES+=$(wildcard ./kernel/*.c)
-SOURCES+=$(wildcard ./video/*.c)
-SOURCES+=$(wildcard ./lib/*/*.c)
SOURCES+=$(wildcard ./fs/*.c)
+SOURCES+=$(wildcard ./driver/*.c)
SOURCES+=$(wildcard ./terminal/*.c)
#derive kernel object files
diff --git a/video/console.c b/driver/console.c
index b6958c5..b6958c5 100644
--- a/video/console.c
+++ b/driver/console.c
diff --git a/video/console.h b/driver/console.h
index 819bd8d..819bd8d 100644
--- a/video/console.h
+++ b/driver/console.h
diff --git a/kernel/keyboard.c b/driver/keyboard.c
index b586d0f..4366127 100644
--- a/kernel/keyboard.c
+++ b/driver/keyboard.c
@@ -1,11 +1,10 @@
+#include <stdbool.h>
+
#define FOOLOS_MODULE_NAME "keyboard"
#include "x86.h"
-#include "lib/buffer/ringbuffer.h"
-#include "lib/logger/log.h" // logger facilities
-
-/// keyboard driver ////
+/// idiots keyboard driver ////
// http://www.computer-engineering.org/ps2keyboard/scancodes1.html
static bool ctrl_l=false;
@@ -13,6 +12,13 @@ static bool shift_l=false;
static bool shift_r=false;
static bool capslock=false;
+static void (*put)(uint8_t c);
+
+void keyboard_init(void (*func)(uint8_t c))
+{
+ put=func;
+}
+
void keyboard_handle(uint8_t in)
{
@@ -214,12 +220,7 @@ void keyboard_handle(uint8_t in)
if(match)
{
-
- if(!ringbuffer_put(ascii))
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"ringbuffer full..");
+ put(ascii);
}
}
-
-
-
diff --git a/kernel/keyboard.h b/driver/keyboard.h
index 8b13789..8b13789 100644
--- a/kernel/keyboard.h
+++ b/driver/keyboard.h
diff --git a/fs/file.h b/fs/file.h
index 481a173..e5a0664 100644
--- a/fs/file.h
+++ b/fs/file.h
@@ -5,9 +5,11 @@
typedef struct file_struct
{
-
uint32_t file_id;
+ void (*read)();
+ void (*write)();
+ void (*seek)();
}file;
diff --git a/kernel/kernel.c b/kernel/kernel.c
index de435c5..098fc64 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -40,28 +40,27 @@ fool_os *get_fool()
}
+static void put_kb(uint8_t c)
+{
+ vt52_kb(get_fool()->tty1,c);
+}
+
void kernel_main(uint32_t eax,uint32_t ebx)
{
//
- // Setup terminal output
+ // Setup terminal output / input
//
term_out screen;
screen.put_char=console_put_char;
screen.update_cursor=update_cursor;
- vt52_tty tty=vt52_init(&screen);
- get_fool()->tty1=&tty;
- //
- // Setup terminal input
- //
- /*
- term_in keyboard;
- kb.get_char=console_put_char;
- screen.update_cursor=update_cursor;
- vt52_tty tty=vt52_init(&screen);
+ term_in input;
+
+ vt52_tty tty=vt52_init(&screen,&input);
get_fool()->tty1=&tty;
- */
+
+ keyboard_init(put_kb);
diff --git a/terminal/vt52.c b/terminal/vt52.c
index 9ff1150..3fa4137 100644
--- a/terminal/vt52.c
+++ b/terminal/vt52.c
@@ -54,12 +54,13 @@ static void clear(vt52_tty *tty)
}
}
-vt52_tty vt52_init(term_out *screen)
+vt52_tty vt52_init(term_out *screen,term_in *input)
{
vt52_tty tty;
tty.data=kballoc(1);
tty.screen=screen;
+ tty.input=input;
tty.x=0;
tty.y=0;
@@ -80,6 +81,11 @@ static void set_char(vt52_tty *tty, uint32_t x, uint32_t y, uint32_t c)
static uint8_t escaping=0;
+void vt52_kb(vt52_tty *tty, uint8_t c)
+{
+ vt52_put(tty,c);
+ tty->input->put_char(c);
+}
// send one ASCII character to the terminal
void vt52_put(vt52_tty *tty, uint8_t c)
{
diff --git a/terminal/vt52.h b/terminal/vt52.h
index cdc62bd..94502d1 100644
--- a/terminal/vt52.h
+++ b/terminal/vt52.h
@@ -4,8 +4,27 @@
#include <stdint.h>
-// REQUIREMENTS
-// * kballoc // block wise in-kernel allocation
+//
+// Emulator of a vt52 terminal
+//
+// 1. pass a term_out and term_in struct to vt52_init(..).
+// 2. use the vt52_kb function for terminal/user input (eg. keyboard).
+// 3. use the vt52_put function for input from the host/programms.
+//
+//
+//
+// ________
+// vt52_put() ------> | | ----> (term_out_struct)
+// | VT52 |
+// (term_in_struct)<-- |_______| <---- vt52_kb()
+//
+//
+// OTHER REQUIREMENTS
+//
+// Your also need to provide some memory allocation
+//
+// * uint32_t kballoc(uint32_t bloks); // block wise in-kernel allocation
+//
typedef struct term_out_struct
{
@@ -15,6 +34,13 @@ typedef struct term_out_struct
}term_out;
+typedef struct term_in_struct
+{
+
+ void (*put_char)(uint8_t c);
+
+}term_in;
+
typedef struct vt52_tty_struct
{
@@ -23,11 +49,14 @@ typedef struct vt52_tty_struct
uint32_t x;
uint32_t y;
uint32_t *data; // screen data
+
term_out *screen;
+ term_in *input;
}vt52_tty;
-vt52_tty vt52_init(term_out *screen);
+vt52_tty vt52_init(term_out *screen,term_in *input);
void vt52_put(vt52_tty *tty, uint8_t c);
+void vt52_kb(vt52_tty *tty, uint8_t c);
#endif
diff --git a/lib/buffer/ringbuffer.c b/xxx/lib/buffer/ringbuffer.c
index a121df1..a121df1 100644
--- a/lib/buffer/ringbuffer.c
+++ b/xxx/lib/buffer/ringbuffer.c
diff --git a/lib/buffer/ringbuffer.h b/xxx/lib/buffer/ringbuffer.h
index 038e33a..038e33a 100644
--- a/lib/buffer/ringbuffer.h
+++ b/xxx/lib/buffer/ringbuffer.h
diff --git a/lib/logger/log.c b/xxx/lib/logger/log.c
index 430f982..430f982 100644
--- a/lib/logger/log.c
+++ b/xxx/lib/logger/log.c
diff --git a/lib/logger/log.h b/xxx/lib/logger/log.h
index da27340..da27340 100644
--- a/lib/logger/log.h
+++ b/xxx/lib/logger/log.h
diff --git a/lib/printf/printf.c b/xxx/lib/printf/printf.c
index 23d3d46..23d3d46 100644
--- a/lib/printf/printf.c
+++ b/xxx/lib/printf/printf.c
diff --git a/lib/printf/printf.h b/xxx/lib/printf/printf.h
index 0e65915..0e65915 100644
--- a/lib/printf/printf.h
+++ b/xxx/lib/printf/printf.h
diff --git a/lib/string/string.c b/xxx/lib/string/string.c
index 729c509..729c509 100644
--- a/lib/string/string.c
+++ b/xxx/lib/string/string.c
diff --git a/lib/string/string.h b/xxx/lib/string/string.h
index a804de9..a804de9 100644
--- a/lib/string/string.h
+++ b/xxx/lib/string/string.h
diff --git a/video/vesa.c b/xxx/video/vesa.c
index a5ee4e5..a5ee4e5 100644
--- a/video/vesa.c
+++ b/xxx/video/vesa.c
diff --git a/video/vesa.h b/xxx/video/vesa.h
index 371e944..371e944 100644
--- a/video/vesa.h
+++ b/xxx/video/vesa.h