Thanks to previous help on the forum, I managed to get basic interrupts working today, almost. I say almost, because I can get my ISR to run when I press any key on the keyboard, but then, it won't fire any more. I decided to open up the debugger for virtual-box, and get info about the PICs, to see if anything was wrong.
This is the part where I'm stuck, as the display of information about the PIC mostly makes sense, except for one field. I'll include a picture of an info dump of the pics, once before the first key-press, and once after the first key-press.
As you can see, the two dumps are almost identical, except for the LIRR register in the master PIC. It goes from 1, to 3, which means that something happened with bit 1 (for interrupt line 1, the keyboard). However, I don't know what the LIRR is. I know the IRR is for which lines are requesting interrupts, which makes sense (bit 0, or line 0, is that clock thingy that ticks 18 times a second, so I'd expect it to be on), but is this LIRR the same or different? If it is the same, does this mean there is a problem with the way I sent EOI?
I can provide my code if needed, but I'm hoping that I've already provided enough info for somebody to suggest a solution or test I could run to find the problem. If you have any solutions, or even things that you need me to test, let me know, I would greatly appreciate it.
Thanks for providing such a helpful forum,
Mikumiku747
My interrupts won't fire more than once
- Mikumiku747
- Member
- Posts: 64
- Joined: Thu Apr 16, 2015 7:37 am
Re: My interrupts won't fire more than once
If you don't get a second interrupt, generally you didn't handle the first one correctly/completely. In the case of the keyboard controller, you have to read out the buffer before a second interrupt will be generated. And don't forget the EOI, of course.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: My interrupts won't fire more than once
LIRR is documented as "Last IRR", or rather, it contains the electrical status of the IRQ lines. For legacy, an IRQ is only generated when the IRQ line goes high, not when it is high.
Hence, when IRR is clear while LIRR is not, the PIC thinks a previous interrupt was handled, but the device didn't. For this you'll actually want to read from the keyboard controller rather than merely printing a message on a keypress
Hence, when IRR is clear while LIRR is not, the PIC thinks a previous interrupt was handled, but the device didn't. For this you'll actually want to read from the keyboard controller rather than merely printing a message on a keypress
- Mikumiku747
- Member
- Posts: 64
- Joined: Thu Apr 16, 2015 7:37 am
Re: My interrupts won't fire more than once
Ok, thanks for the tip , I had assumed that the keyboard just sent an interrupt every time a key was pressed, but not so. Also, is there anything else I should take into account? Thanks for the explanation of LIRR as well.
Thanks for the help,
Mikumiku747
Thanks for the help,
Mikumiku747