summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c73
1 files changed, 10 insertions, 63 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 7d845c5..3c7b578 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -3,47 +3,10 @@
// TODO: cleanup . how can i compile it without the includes!??
-
-/// PIT /// Timer stuff
-
-/*
- http://www.brokenthorn.com/Resources/OSDevPit.html
-
- vcc/gnd - voltage/ground
-
- D0-D7 - data lines (data bus)
- wr/rd - writing / reading (system control bus)
- cs - ignore wr/rd or not (address bus)
- a0-a1 (address bus)
-
- // the three 16bit down counters/timers/channels
- clk 0-2 (in)
- gate 0-2 (in)
- out 0-2 (out)
-
-
-
-
- //typical
- out1 -> pic interrupt on every tick (system timer)
- out2 - was used for genearting dram memory refresh (Do not use)
- out3 -> pc speaker
-
- gate pins : depend on mode of operation
- we do have modes 0-5.
-
-
- */
-
-
-
-
-
-
-
///////
void int_kb_handler();
+void int_clock_handler();
////////// KERNEL MAIN///// /////
//
@@ -52,7 +15,7 @@ void int_test_handler()
{
__asm__("pusha");
- scr_put_string_nl("inside software interrupt handler 88");
+ scr_put_string("inside software interrupt handler 88");
__asm__("popa");
@@ -61,27 +24,6 @@ void int_test_handler()
}
-// clock handler
-void int_clock_handler()
-{
- __asm__("pusha");
-
- scr_put_string_nl(".");
-
-
- // todo also the other pic!// TODO
- __asm__("mov $0x20, %al");
- __asm__("out %al, $0x20");
- //
-
- __asm__("popa");
- __asm__("leave");
- __asm__("iret");
- __asm__("popa");
- __asm__("leave");
- __asm__("iret");
-
-}
void kernel_main()
{
@@ -91,11 +33,16 @@ void kernel_main()
// hello message
scr_put_string_nl(KERNEL_HELLO_MESSAGE);
- // init interrupt decriptor table
- // install and enable!
+ //pit config
+ timer_init();
+ scr_put_string_nl("Configured PIT Channel 0 : Mode 2 : 1/25 s.");
+
+
+ // init and interrupt decriptor table
int_init(0x08);
int_install();
+ // setup custom interrupts
// remember that we shifted all interrupts with the pic by 32
// so clock = 32 (irq 0)
// keyboard = 22 (irq 1)
@@ -112,12 +59,12 @@ void kernel_main()
// now we can enable interrupts back again
int_enable();
-
scr_put_string_nl("Interrupts are up and running");
// kernel main loop
while(1)
{
+
}