Page 2 of 3

Re: IRQ1 never gets fired

Posted: Sat Jan 14, 2017 4:58 pm
by iansjack
Are you reading the scancode from the data port during your interrupt handler? If not you will get just the one interrupt no matter how many key presses you make.

Re: IRQ1 never gets fired

Posted: Sun Jan 15, 2017 2:01 am
by DixiumOS
iansjack wrote:Are you reading the scancode from the data port during your interrupt handler? If not you will get just the one interrupt no matter how many key presses you make.
Yes, i am.

I'll update my GitHub now.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 2:56 am
by iansjack
You send the EOI command in int irq0(), but not in any of the other irqn() routines.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 3:20 am
by DixiumOS
iansjack wrote:You send the EOI command in int irq0(), but not in any of the other irqn() routines.
I do send it in all routines.

0x21 is IRQ1, and 0x20 is an EOI code (if you want to send an EOI to IRQ0, do outb(0x20, 0x20) ).

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 3:40 am
by Octocontrabass
DixiumOS wrote:0x21 is IRQ1, and 0x20 is an EOI code
Where did you see anything like that? Neither the wiki page nor the datasheet agree with that statement.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 3:44 am
by DixiumOS
Octocontrabass wrote:
DixiumOS wrote:0x21 is IRQ1, and 0x20 is an EOI code
Where did you see anything like that? Neither the wiki page nor the datasheet agree with that statement.
So where should i send? Is it 0x28?

Glaux told me, btw.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 4:09 am
by iansjack
What does the Wiki say?

http://wiki.osdev.org/PIC

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 4:25 am
by DixiumOS
iansjack wrote:What does the Wiki say?

http://wiki.osdev.org/PIC
0x28, 0x27 or 0x21.

None of them make IRQ1 get EOI's.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 4:54 am
by iansjack
It doesn't say that at all. Read section 4.2 of the page referenced.

You must learn to read, and understand, documentation.
You must learn to read C code and create it.
You must stop expecting others to spoonfeed you with every little detail.

Otherwise, what's the point?

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 4:55 am
by Octacone
End of Interrupt
Perhaps the most common command issued to the PIC chips is the end of interrupt (EOI) command (code 0x20). This is issued to the PIC chips at the end of an IRQ-based interrupt routine. If the IRQ came from the Master PIC, it is sufficient to issue this command only to the Master PIC; however if the IRQ came from the Slave PIC, it is necessary to issue the command to both PIC chips.

Code: Select all

#define PIC_EOI		0x20		/* End-of-interrupt command code */
 
void PIC_sendEOI(unsigned char irq)
{
	if(irq >= 8)
		outb(PIC2_COMMAND,PIC_EOI);
 
	outb(PIC1_COMMAND,PIC_EOI);
}
Then at the end of your keyboard handler do:
PIC_sendEOI(1);

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 4:59 am
by DixiumOS
octacone wrote:
End of Interrupt
Perhaps the most common command issued to the PIC chips is the end of interrupt (EOI) command (code 0x20). This is issued to the PIC chips at the end of an IRQ-based interrupt routine. If the IRQ came from the Master PIC, it is sufficient to issue this command only to the Master PIC; however if the IRQ came from the Slave PIC, it is necessary to issue the command to both PIC chips.

Code: Select all

#define PIC_EOI		0x20		/* End-of-interrupt command code */
 
void PIC_sendEOI(unsigned char irq)
{
	if(irq >= 8)
		outb(PIC2_COMMAND,PIC_EOI);
 
	outb(PIC1_COMMAND,PIC_EOI);
}
Then at the end of your keyboard handler do:
PIC_sendEOI(1);
PIC_EOI and PIC1_COMMAND is 0x20, 0x20. This is sending to IRQ0 and not IRQ1.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 5:17 am
by glauxosdever
Hi,

DixiumOS wrote:
Octocontrabass wrote:
DixiumOS wrote:0x21 is IRQ1, and 0x20 is an EOI code
Where did you see anything like that? Neither the wiki page nor the datasheet agree with that statement.
So where should i send? Is it 0x28?

Glaux told me, btw.
I didn't told you that. I told you that, based on how you remapped the PIC, IRQ0 has interrupt number 0x20, IRQ1 has interrupt number 0x21, and IRQ2 has interrupt number 0x22 (and not 0x28). Nothing concerning what to send to the PIC on an EOI.


Regards,
glauxosdever

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 5:19 am
by iansjack
DixiumOS wrote:This is sending to IRQ0 and not IRQ1.
You send the EOI command to the PIC(s), not to an IRQ.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 5:25 am
by iansjack
DixiumOS wrote:Glaux told me, btw.
That rather illustrates the danger of telling you anything.

I think it would be better all round if we all ignore you completely from now on and not give you even the smallest nugget of information (which you will misquote). That way you will have to work it out for yourself by reading the documentation (if you can ever break the habit of copying what every Tom, **** - Jeez, what a swearword filter! - , and Harry has written in some crap tutorial).

Then perhaps - one day, many years from now - you may understand what you are doing.

Re: How do i get my keyboard handler to work?

Posted: Sun Jan 15, 2017 5:33 am
by DixiumOS
glauxosdever wrote:Hi,
I didn't tell you that. I told you that, based on how you remapped the PIC, IRQ0 has interrupt number 0x20, IRQ1 has interrupt number 0x21, and IRQ2 has interrupt number 0x22 (and not 0x28). Nothing concerning what to send to the PIC on an EOI.


Regards,
glauxosdever
Ahh, okay. But what port do I send an EOI to?

EDIT: 0x20. I was a bit confused. It now works. I thought it differed when the IRQ was different. Thanks!