summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/asm_pit.s2
-rw-r--r--driver/timer.c4
-rw-r--r--driver/vesa.c2
-rw-r--r--driver/vesa.h2
-rw-r--r--kernel/apic.c3
-rw-r--r--kernel/apic.h4
-rw-r--r--kernel/interrupts.c1
-rw-r--r--kernel/kernel.c8
8 files changed, 18 insertions, 8 deletions
diff --git a/asm/asm_pit.s b/asm/asm_pit.s
index 28fd784..d9401ee 100644
--- a/asm/asm_pit.s
+++ b/asm/asm_pit.s
@@ -38,7 +38,7 @@ asm_pit_tick:
outb %al,$0x43
// LSB first
- mov \val, %dx
+ mov \val, %ax
out %al, $0x40
xchg %ah,%al
out %al, $0x40
diff --git a/driver/timer.c b/driver/timer.c
index 7e95afe..7f9859c 100644
--- a/driver/timer.c
+++ b/driver/timer.c
@@ -153,8 +153,8 @@ uint64_t timer_init()
{
uint64_t epoch_time=get_rtc_time();
task_system_clock_start=epoch_time*25; // since pit ticks 25times a second
- asm_pit_rate_40ms();
- fixme("pit rate once did not work anymore 1/25 seconds?? but now ok?" );
+ asm_pit_rate_40ms(); //tick at 25hz
+ fixme("pit rate does only seem to work occasionally.. 1/25 seconds???" );
return epoch_time;
}
diff --git a/driver/vesa.c b/driver/vesa.c
index bdf1c9a..eb99173 100644
--- a/driver/vesa.c
+++ b/driver/vesa.c
@@ -234,7 +234,7 @@ void PutString(char *str, int x,int y, int color, va_list va)
int i=x;
while((*str)!=0)
{
- //PutFont(*str, i,y, color);
+ PutFont(*str, i,y, color,0x0);
i+=9; // spacing
str++;
}
diff --git a/driver/vesa.h b/driver/vesa.h
index 7122d68..168013f 100644
--- a/driver/vesa.h
+++ b/driver/vesa.h
@@ -1,4 +1,5 @@
#include <stdint.h>
+#include "lib/printf/printf.h"
void vesa_update_cursor(uint32_t col,uint32_t row);
void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y);
@@ -50,3 +51,4 @@ void PutConsoleChar(char c, int color);
void PutConsole(char *str, int color);
void vesa_put_rect(int x, int y, int w , int h, int color);
void PutFont(char c, int x,int y, int color_fg,int color_bg);
+void PutString(char *str, int x,int y, int color, va_list va);
diff --git a/kernel/apic.c b/kernel/apic.c
index a670208..a90cbf6 100644
--- a/kernel/apic.c
+++ b/kernel/apic.c
@@ -147,6 +147,9 @@ void ioapic_config()
// PIT irq 00 -> 02 flags 0 -> 0x90
// kb irq 01 -> 01 flags ? -> 0x91
// mouse irq 12 -> 12 flags ? -> 0x92
+// ioapic_config_entry(2,0x90|0x2000,0x3<<24); // egde trigger on falling
+// ioapic_config_entry(2,0x90|0x8000,0x3<<24); // level trigger on high
+// ioapic_config_entry(2,0x90|0xa000,0x3<<24); // level trigger on low
ioapic_config_entry(2,0x90,0x0);
ioapic_config_entry(1,0x91,0x0);
ioapic_config_entry(12,0x92,0x0);
diff --git a/kernel/apic.h b/kernel/apic.h
index 2c76379..0ba2844 100644
--- a/kernel/apic.h
+++ b/kernel/apic.h
@@ -38,7 +38,7 @@ void apic_enable();
void apic_init_timer(uint32_t ticks_per_second);
/** startup other cpu
- * @dest destination apic
- * @addy entrypoint (example 0x7->0x7000 etc..)
+ * @param dest destination apic
+ * @param addy entrypoint (example 0x7->0x7000 etc..)
* */
void apic_sipi(uint32_t dest,uint32_t addy);
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 9ffd7c6..6e9d943 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -54,6 +54,7 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq)
// klog("int: %d on 0x%x",irq,apicID());
if(irq==INTERRUPT_PIT_TIMER){
asm_pit_tick();
+// asm_pit_sleep_40ms();
// return esp; // tried to skip EOI
}
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 4c7227b..ccc7446 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -29,6 +29,7 @@
#include "fs/fs.h"
#include "kmalloc.h"
#include "driver/vesa.h"
+#include "asm_pit.h"
/* F00L 0S Entry point (called directly from asm/multiboot.asm */
void kernel_main(uint32_t eax,uint32_t ebx)
@@ -132,11 +133,14 @@ void kernel_main(uint32_t eax,uint32_t ebx)
klog("Unlock application processors ... ");
asm_smp_unlock();
- PutFont('X', 100,200, 0x00ffff,0xff00ff); // TODO temporary!
+ //PutFont('X', 100,200, 0x00ffff,0xff00ff); // TODO temporary!
klog("Enable Interrupts ... ");
x86_sti(); // this will start processing hardware interrupts
// now just wait until our scheduler kicks in.
- while(1)asm("hlt");
+ while(1){
+ asm("hlt");
+ PutString("pit cnt: %d",10,10,0xff00ff,asm_pit_get_ticks()/25);
+ }
}