[RESOLVED] ps/2 mouse initalization / keyboard interrupt
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
[RESOLVED] ps/2 mouse initalization / keyboard interrupt
If I initialize the mouse with SANiK's code and enable IRQ12 IRQ1 for keyboard input won't fire anymore. What could I have done wrong?
Last edited by megatron23 on Wed Oct 26, 2011 6:24 am, edited 2 times in total.
Re: ps/2 mouse initalization / keyboard interrupt
Show your ISR code for IRQ12.
If you have seen bad English in my words, tell me what's wrong, please.
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
Code: Select all
void mouse_handler() {
uint8 mouse_stat = inportb(0x64);
if ( !(mouse_stat & 0x01) || !(mouse_stat & 0x20) ) {
return;
}
switch(mouse_cycle) {
case 0:
mouse_byte[0]=inportb(0x60);
mouse_cycle++;
break;
case 1:
mouse_byte[1]=inportb(0x60);
mouse_cycle++;
break;
case 2:
mouse_byte[2]=inportb(0x60);
mouse_x=mouse_byte[1];
mouse_y=mouse_byte[2];
mouse_cycle=0;
break;
}
}
Re: ps/2 mouse initalization / keyboard interrupt
Well But where's EOI command?
If you have seen bad English in my words, tell me what's wrong, please.
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
That is in my ISR. I replied before you edited your reply from "Post your mouse handler".egos wrote:Well But where's EOI command?
The ISR calls the mouse_handler and EOI afterwards.
Other IRQs like 0 or 8 do fire, exept IRQ 1.
Re: ps/2 mouse initalization / keyboard interrupt
What PIC mask did you set?
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
The pic mask set for IRQ12 is 0xEF on PIC2. Bit nr. 12 in word thus bit nr. 4 in byte for the dataport of pic 2.
- 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: ps/2 mouse initalization / keyboard interrupt
That's only the second half of the answer
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
It seems I missed the plot a little. Then what would be the first half?
Re: ps/2 mouse initalization / keyboard interrupt
I think he means PIC1 mask.
If you have seen bad English in my words, tell me what's wrong, please.
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
I dont send a mask to PIC1 if I want to enable IRQ12.
The IRQ1 for keyboard is enabled elsewhere. It works without problems if I don't initialize the mouse.
The IRQ1 for keyboard is enabled elsewhere. It works without problems if I don't initialize the mouse.
Re: ps/2 mouse initalization / keyboard interrupt
Does mouse work fine? Check program step by step to localise the fragment where keyboard is missed. Read controller command byte again to check that it is correct.
If you have seen bad English in my words, tell me what's wrong, please.
-
- Posts: 19
- Joined: Sat Oct 22, 2011 3:03 pm
Re: ps/2 mouse initalization / keyboard interrupt
After enabling interrupts IRQ12 fires once where neither bit 0 nor bit 5 ist set in the byte from port 0x64. my handler then does not read data from port 0x60 and returns instead.
after that everything works as it should except IRQ1 does not fire anymore.
after that everything works as it should except IRQ1 does not fire anymore.
Re: ps/2 mouse initalization / keyboard interrupt
Controller command byte is the byte which you can read by command 20h. This byte contains "enable keyboard/mouse interrupt" bits and "disable keyboard/mouse" bits. Read and show this byte.
If you have seen bad English in my words, tell me what's wrong, please.
Re: ps/2 mouse initalization / keyboard interrupt
That could take a while to set. Read and check it in a loop (timeout). For example I try it 1000 times before saying it was a false IRQ.megatron23 wrote:After enabling interrupts IRQ12 fires once where neither bit 0 nor bit 5 ist set in the byte from port 0x64.