IRQ0 does not fire. (Am I missing something) but IRQ1 does.
Posted: Thu Feb 20, 2014 10:25 am
Hi,
After playing a little bit with Descriptors and Interrupts I finally
decided to start with my "sleep" function, for which I am planning
to use IRQ0 which is Programmable Interval Timer.
Reading the wiki and JamesM Tutorials I do the following things:
-Set entry 32 in IDT for the timer IRQ
-Program the PIT to 100Hz
-Unmask IRQ0
-Unmask IRQ1
My IRQ0 Timer does the following:
-Increments the uptime by 1
-If the delay is 0, then returns else decrements the delay and returns.
Although code isn't really relevant here but I'll post it.
I have tested the delay function, which causes an infinite loop as the IRQ is not fired and the "delay_count" is never
zeroed. The only help that I can expect is "Am I missing something?".
As for the IDT it looks somewhat like this:
As for the interrupts I can receive both Hardware and Software Interrupts, since I my keyboard and mouse work fine.
-Bender
After playing a little bit with Descriptors and Interrupts I finally
decided to start with my "sleep" function, for which I am planning
to use IRQ0 which is Programmable Interval Timer.
Reading the wiki and JamesM Tutorials I do the following things:
-Set entry 32 in IDT for the timer IRQ
-Program the PIT to 100Hz
-Unmask IRQ0
-Unmask IRQ1
My IRQ0 Timer does the following:
-Increments the uptime by 1
-If the delay is 0, then returns else decrements the delay and returns.
Although code isn't really relevant here but I'll post it.
Code: Select all
;; PIT Timer IRQ0
pit_timer:
pushad
push ds
push es
inc dword [system_uptime]
;; How many delays we've?
cmp dword [delay_count], 0
je .done
;; Else Decrement the Delay Flag
dec dword [delay_count]
.done:
;; Tell PIC We're done.
call send_eoi
pop es
pop ds
popad
iret
;; Delay Function
;; INIT_TIMER ECX = Number of seconds
init_timer:
mov dword [delay_count], ecx
.loop:
cli
cmp [delay_flag], 0
je .done
sti
jmp .loop
.done:
sti
ret
UNMASK_PIT:
pushad
;; Unmasks the Timer IRQ
in al, PIC1+1
and al, 11111110b
out PIC1+1, al
out32 PIC1+1, 0xFD
;; Enables interrupts
sti
popad
ret
pit_init:
;; Set frequency to 100Hz.
mov al, 0x36
out32 0x43, al
mov ax, 11931
out32 0x40, al
out32 0x40, ah
ret
zeroed. The only help that I can expect is "Am I missing something?".
As for the IDT it looks somewhat like this:
Code: Select all
......
.entry_0:
.......
.......
.entry_32:
dw pit_timer
dw CODE_SEL
db 0x00
db 0x8E
dw 0
-Bender