Unable to use PIT
Unable to use PIT
So, i've merged some tutorials from github and the osdev wiki and got all setted and working: gdt idt isr pic and irqs. now i'm trying to setup the pit but the irq handler is never called. have i Forgot to init something? on what does the pit depends?
Regards, Bonfra.
Re: Unable to use PIT
Hi,
I'm afraid more detail is going to be needed than that. Are you on an emulator or real hardware. Is a legacy PIC / PIT even present? Post either a link to your code or post minimal relevant code in code tags.
Cheers,
Adam
I'm afraid more detail is going to be needed than that. Are you on an emulator or real hardware. Is a legacy PIC / PIT even present? Post either a link to your code or post minimal relevant code in code tags.
Cheers,
Adam
Re: Unable to use PIT
AJ wrote:Hi,
I'm afraid more detail is going to be needed than that. Are you on an emulator or real hardware. Is a legacy PIC / PIT even present? Post either a link to your code or post minimal relevant code in code tags.
Cheers,
Adam
sure! I caccidentally deleted the link before posting XD
https://github.com/Bonfra04/OS-DEV
Regards, Bonfra.
Re: Unable to use PIT
my thought is that i need to set or enable something first since it does not throw any errors but i really can't get what that is... i am totally stuck
Regards, Bonfra.
Re: Unable to use PIT
I run BonsOS.img with BochsDBG and it seemed to me that in the pic.c file in the pic_set_enable (...) function, the parameter sent to the "master_set_mask (mask)" function has the value of 0xfb. If I am right this will be the reason, but you will have to confirm the value of this parameter (first bit to zero enables the timer int0, value 1 disables it. At begin all interrupt are disable master = slave = 0xff.
Re: Unable to use PIT
You have a error in line 62 from pic.h file. Delete extern "C" from there
Re: Unable to use PIT
Some remarks: Your PIC driver should ensure that IRQ 2 is never used, and never masked. IRQ2 is the chaining IRQ for the slave PIC. It must remain enabled, else IRQs 8-15 can never fire. Also, according to the Linux source code, the port I/O with the PIC is slow, so you should strive to do as little of it as possible. To that end, maybe save the interrupt mask in software. You can probably afford another sixteen bit static variable.
But your problem probably is that you hook your PIT interrupt to IRQ2. The PIT is on IRQ0.
But your problem probably is that you hook your PIT interrupt to IRQ2. The PIT is on IRQ0.
Carpe diem!
Re: Unable to use PIT
it really was just this... using IRQ 0 works fine! the funny thing is that i tried from 2 to 15 but leaved 0 alone ... i'm so dumb thank you very much.nullplan wrote:Some remarks: Your PIC driver should ensure that IRQ 2 is never used, and never masked. IRQ2 is the chaining IRQ for the slave PIC. It must remain enabled, else IRQs 8-15 can never fire. Also, according to the Linux source code, the port I/O with the PIC is slow, so you should strive to do as little of it as possible. To that end, maybe save the interrupt mask in software. You can probably afford another sixteen bit static variable.
But your problem probably is that you hook your PIT interrupt to IRQ2. The PIT is on IRQ0.
Regards, Bonfra.