The only code I have that deals with the PICs is here:
Code: Select all
OUTPORTB(0x20, 0x11);
OUTPORTB(0xA0, 0x11);
OUTPORTB(0x21, 0x20);
OUTPORTB(0xA1, 0x28);
OUTPORTB(0x21, 0x04);
OUTPORTB(0xA1, 0x02);
OUTPORTB(0x21, 0x01);
OUTPORTB(0xA1, 0x01);
OUTPORTB(0x21, 0x0);
OUTPORTB(0xA1, 0x0);
Code: Select all
#define OUTPORTB(_port, _data) __asm__ __volatile__ ("outb %1, %0" : : "dN" ((unsigned short)_port), "a" ((unsigned char)_data))
I've tested this code on bochs, qemu, and on my desktop and laptop. None of them show any hint of working. I'm compiling with gcc 3.4.4 on Gentoo, and the kernel is always being booted by GRUB. That's all the relevant info I can think of right now...
On a side note, I'm trying to make sure I understand the code above. The first two lines tell the PICs that a reconfiguration is coming. The next two tell IRQ0-IRQ7 to map to interrupts 0x20-0x27, and IRQ8-IRQ15 to 0x28-0x2F. The next to tell the master PIC to communicate to the slave PIC on IRQ2 (bit 2 set), and the slave PIC to the master PIC on IRQ9 (bit 1 set). The next two tell the PICs how to communicate (or something, don't quite get this part), and the last two set the IRQ masks off.
Right?
Thanks for any help you can give me. I'm really interested in this, but I'm stumped and frustrated right now.
agrif