OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:32 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [RESOLVED] ps/2 mouse initalization / keyboard interrupt
PostPosted: Sun Oct 23, 2011 3:58 pm 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
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.

Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Sun Oct 23, 2011 4:10 pm 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
Show your ISR code for IRQ12.

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Sun Oct 23, 2011 4:19 pm 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
Code:
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;
  }
}


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Sun Oct 23, 2011 6:51 pm 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
Well :) But where's EOI command?

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 3:27 am 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
egos wrote:
Well :) But where's EOI command?


That is in my ISR. I replied before you edited your reply from "Post your mouse handler".

The ISR calls the mouse_handler and EOI afterwards.
Other IRQs like 0 or 8 do fire, exept IRQ 1.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 3:37 am 
Offline
Member
Member

Joined: Wed Apr 20, 2011 6:57 am
Posts: 100
What PIC mask did you set?


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 4:44 am 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
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.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 6:08 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
That's only the second half of the answer :wink:

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 6:50 am 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
It seems I missed the plot a little. Then what would be the first half? :?


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 7:20 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
I think he means PIC1 mask.

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 8:38 am 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
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.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 9:14 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
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.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 10:21 am 
Offline

Joined: Sat Oct 22, 2011 3:03 pm
Posts: 19
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.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 12:28 pm 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
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.


Top
 Profile  
 
 Post subject: Re: ps/2 mouse initalization / keyboard interrupt
PostPosted: Mon Oct 24, 2011 1:42 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 08, 2011 1:58 pm
Posts: 496
megatron23 wrote:
After enabling interrupts IRQ12 fires once where neither bit 0 nor bit 5 ist set in the byte from port 0x64.

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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: 0xY, DotBot [Bot], Majestic-12 [Bot] and 122 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group