From 52f3e224fb4d3e05202134f7747fdee00a03ed61 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Mon, 8 Sep 2014 18:36:27 +0200 Subject: started with mouse driver and double buffer --- kernel/interrupts.c | 14 ++++++++++++-- kernel/kernel.c | 8 +++++++- kernel/keyboard.c | 3 ++- kernel/mouse.c | 9 +++++++++ kernel/shell.c | 1 - kernel/vesa.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 kernel/mouse.c diff --git a/kernel/interrupts.c b/kernel/interrupts.c index 902538b..308028f 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -34,10 +34,15 @@ static struct idt_desc } idtd; -void int_default() +void int_mouse() { -// panic(FOOLOS_MODULE_NAME,"Unexpected Interrupt occured"); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mouse interrupt"); + +} + +void int_default() +{ } @@ -142,6 +147,11 @@ void int_init(uint16_t sel) // install floppy interrupt handler (irq 6 => 38) int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler); #endif + + //mouse + int_install_ir(44, 0b10001110, 0x08,&int_mouse); + + int_install(); diff --git a/kernel/kernel.c b/kernel/kernel.c index d1de73f..ae5036a 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -142,6 +142,9 @@ void kernel_main(uint32_t initial_stack, int mp) // init spinlocks init_spinlocks(); + // + //vesa_init_doublebuff(); + // // Start the other Processors (also before paging !) // @@ -165,7 +168,7 @@ void kernel_main(uint32_t initial_stack, int mp) // We are interested in the E1000 Network Adapter in particular // Its driver will be hopefully implemented one day ;) TODO // - // pci_init(); + //pci_init(); // // Initialize Floppy Disk if activated in config.h @@ -183,6 +186,8 @@ void kernel_main(uint32_t initial_stack, int mp) // shell_init(); + mouse_init(); + // // Initialize Multitasking // @@ -191,6 +196,7 @@ void kernel_main(uint32_t initial_stack, int mp) // task_init(); + // // Just hang around here, if its reached. // we do our tasks anyway. on the next clock tick. diff --git a/kernel/keyboard.c b/kernel/keyboard.c index 7b08098..c70a03f 100644 --- a/kernel/keyboard.c +++ b/kernel/keyboard.c @@ -1,9 +1,10 @@ +#define FOOLOS_MODULE_NAME "keyboard" + #include "kernel.h" #include "x86.h" #include "console.h" #include "../lib/logger/log.h" // logger facilities -#define FOOLOS_MODULE_NAME "keyboard" /// keyboard driver //// diff --git a/kernel/mouse.c b/kernel/mouse.c new file mode 100644 index 0000000..b6fd14d --- /dev/null +++ b/kernel/mouse.c @@ -0,0 +1,9 @@ +#define FOOLOS_MODULE_NAME "mouse" + +#include "lib/logger/log.h" + +void mouse_init() +{ + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_FINE,"Initializing mouse driver"); + +} diff --git a/kernel/shell.c b/kernel/shell.c index 9767a58..b377ce0 100644 --- a/kernel/shell.c +++ b/kernel/shell.c @@ -85,7 +85,6 @@ void shell_execute() else { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"command unknown"); - lock_release(0); } pos=0; diff --git a/kernel/vesa.c b/kernel/vesa.c index f3b333c..7b7b531 100644 --- a/kernel/vesa.c +++ b/kernel/vesa.c @@ -58,6 +58,9 @@ static int console_y; static int console_lines; static int console_cols; +static uint8_t* buffer; +static uint8_t* physbase; + void vesa_set_physbase(uint32_t addr) { VbeModeInfoBlock->physbase=addr; @@ -188,6 +191,32 @@ void PutConsoleNL() } } +//////////////// + +void vesa_render() +{ + +} + +void vesa_init_doublebuff() +{ + + int blocks=800*600*2/4096+1; + physbase=VbeModeInfoBlock->physbase; + buffer=pmmngr_alloc_blocks(blocks); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Init buffer of %d blocks at 0x%08X",blocks,buffer); + + VbeModeInfoBlock->physbase=buffer; + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"test"); + vesa_switch_buffers(); +} + +void vesa_switch_buffers() +{ + for(int i=0;i<800*600*2;i++)physbase[i]=buffer[i]; + +} + -- cgit v1.2.3