first of all, 111 does not work as 011, at least in bochs
secondly, I am trying to use 000 (interrupt on terminal count, ie outb(0x43, 0x30)), my goal is that after the counter register reaches zero, (which is0 0 0 = Mode 0 (interrupt on terminal count)
0 0 1 = Mode 1 (hardware re-triggerable one-shot)
0 1 0 = Mode 2 (rate generator)
0 1 1 = Mode 3 (square wave generator)
1 0 0 = Mode 4 (software triggered strobe)
1 0 1 = Mode 5 (hardware triggered strobe)
1 1 0 = Mode 2 (rate generator, same as 010b)
1 1 1 = Mode 3 (square wave generator, same as 011b)
when interrupt gets generated), I will just set the divisor to port 0x40, (hi lo configuration),
Code: Select all
static void timer_callback(reg_t *r){
tick++;
task_switch();
unsigned long ddivisor = 1193100/50 ; // 50 is the frequency
outb(0x40, (unsigned char) (divisor & 0xff));
outb(0x40, (unsigned char) ((divisor >>8) 0xff));
}
it worked for three context switch... but afterwards, context switch stopped working,
notice that I am on purpose trying not to use the square wave (011 mode 3)... can someone tell me why