PIT doesn't work in Bochs
Posted: Mon Oct 22, 2012 12:53 pm
I am trying that PIT of Bochs works, but I am tired of try it
I have already programmed the driver which handles it, but it doesn't work in Bochs, but it works in Virtual Box.
This is my tiny-driver:
If someone could help me, I would be thankful.
PD: I don't know, but I think my English is bad, if someone didn't understand something, ask me, please.
PD: As you can see, in the code I disable the IRQ0, but later I re-enable it.
I have already programmed the driver which handles it, but it doesn't work in Bochs, but it works in Virtual Box.
This is my tiny-driver:
Code: Select all
u32 ticks;
void PIT_SendCommand(u8 com){
outb(com, PIT_COMMAND);
}
void PIT_Init(){
DEBUG(true, "\nInitializing PIT... ");
u16 count=(u16)(1193182L / 100); // Frequency = 100
PIT_SendCommand(PIT_16BITS | PIT_MODE3 | PIT_2BYTES | PIT_CHAN_0); // 0x36
outb((u8) count & 0xFF, PIT_CHAN_0);
outb((u8) (count >> 8) & 0xFF, PIT_CHAN_0);
IRQ_Disable(0x00);
DEBUG(true, "[OK]\n");
}
void PIT_IRQ(){
ticks++;
DEBUG(true, "\n[IRQ0: Ticks = %d]\n", ticks);
UpdateTimers();
outb(0x20, 0x20);
}
PD: I don't know, but I think my English is bad, if someone didn't understand something, ask me, please.
PD: As you can see, in the code I disable the IRQ0, but later I re-enable it.