Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
void _irq_handler(struct registers_state* registers){
/* This is a blank function pointer */
void (*handler)(struct registers_state *registers);
/* Find out if we have a custom handler to run for this
* IRQ, and then finally, run it */
char ino_str[3];
pocha_vga_draws(itoa(registers->int_no - 32, ino_str), pocha_vga_color(VGA_COLOR_Yellow, VGA_COLOR_LightRed), 0, 0);
handler = irq_routines[registers->int_no - 32];
if(handler){
handler(registers);
}
else blank_handler(registers);
/* If the IDT entry that was invoked was greater than 40
* (meaning IRQ8 - 15), then we need to send an EOI to
* the slave controller */
if (registers->int_no >= 40){
port_byte_out(0xA0, 0x20);
}
/* In either case, we need to send an EOI to the master
* interrupt controller too */
port_byte_out(0x20, 0x20);
}
It's the shape of the clock output (duty cycle). Mode 3 for square waves fit for a baud rate generator, mode 2 for pulses for a real-time clock interrupt.
I googled "8254 datasheet" and the PDF of the Intel datasheet was the first result. Go look at page 10 of that document for more info.
[Edit: after looking at Shaun's answer below I see I assumed you only had a problem with the mode. Don't ask me why! Anyway, check out the whole document. It's always good to go to the source.]
Last edited by bwat on Thu May 08, 2014 3:17 am, edited 1 time in total.
Every universe of discourse has its logical structure --- S. K. Langer.
Yes I misunderstood. I thought its either all left to right or all right to left. But I see now its right to left but individual values are from left to right.