Mouse + IRQ slave questions
Mouse + IRQ slave questions
Hi!
These days i was trying to write a driver for ps/2 mouse, but it seems to doesn't work. It seems like the IRQ wasn't raised
Now some questions arrived in my brain:
1. When some IRQ from the slave pic are enable, i have to enable the cascade IRQ? (IRQ 2 in master PIC?)
2. I have to do particular things to enable slave pic irq? So for example if i have to enable irq 12 i have to clear the bit 5 in slave pic?
And after i serve the IRQ in pic slave, i have to send an EOI both to master and pic?
And another question: laptops touchpad is a PS2 or usb mouse?
And in bochs if i enable the mouse, it is ps2 or usb? or depend from real hw mouse?
Thanks,
And sorry for my english.
These days i was trying to write a driver for ps/2 mouse, but it seems to doesn't work. It seems like the IRQ wasn't raised
Now some questions arrived in my brain:
1. When some IRQ from the slave pic are enable, i have to enable the cascade IRQ? (IRQ 2 in master PIC?)
2. I have to do particular things to enable slave pic irq? So for example if i have to enable irq 12 i have to clear the bit 5 in slave pic?
And after i serve the IRQ in pic slave, i have to send an EOI both to master and pic?
And another question: laptops touchpad is a PS2 or usb mouse?
And in bochs if i enable the mouse, it is ps2 or usb? or depend from real hw mouse?
Thanks,
And sorry for my english.
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
Re: Mouse + IRQ slave questions
well
first
you will have to use the secoundary PIC, and yes, mask off IRQ 12
and you will have to send the EOI to both (read the datasheet for the PIC )
USB and laptop is a little speciel
USB should act like PS2, but use the USB IRQ, however i have tried where it uses the IRQ 12 ???( dont relay on that)
the laptop is also ouht to act like PS2, and Fire the IRQ 12
BOCHS is default PS2
but it can appere as a serial and some other ..
KMT dk
first
you will have to use the secoundary PIC, and yes, mask off IRQ 12
and you will have to send the EOI to both (read the datasheet for the PIC )
USB and laptop is a little speciel
USB should act like PS2, but use the USB IRQ, however i have tried where it uses the IRQ 12 ???( dont relay on that)
the laptop is also ouht to act like PS2, and Fire the IRQ 12
BOCHS is default PS2
but it can appere as a serial and some other ..
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse + IRQ slave questions
Now another question:
if a irq>7 is raised, what happens? i find IRQ2=1 or it is 0?
and if i want to check where the IRQ is raised, is correct that piece of code:
Is correct to check if(icur_irq==0)? should it be cur_irq==4?
Thanks!
if a irq>7 is raised, what happens? i find IRQ2=1 or it is 0?
and if i want to check where the IRQ is raised, is correct that piece of code:
Code: Select all
int get_current_irq(){
int cur_irq;
outportb(GET_IRR_STATUS, MASTER_PORT);
cur_irq = inportb(MASTER_PORT);
if(cur_irq == 0) {
outportb(GET_IRR_STATUS, SLAVE_PORT);
cur_irq = inportb(SLAVE_PORT);
}
return find_first_bit(cur_irq);
}
Thanks!
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
Re: Mouse + IRQ slave questions
Why do you even check where the IRQ is raised?
There is IDT entry corresponding IRQ number, isn't it?
There is IDT entry corresponding IRQ number, isn't it?
Re: Mouse + IRQ slave questions
Yes i have an IDT entry,
but i use a global handler for all IRQ's, when an IRQ is raised the first function called is _irqinterrupt, that call get_current_irq and after it execute the correct handler.
Now the problem seems that mouse didn't raise any IRQ. It seems like nothing happen, irqinterrupt isn't called.
but i use a global handler for all IRQ's, when an IRQ is raised the first function called is _irqinterrupt, that call get_current_irq and after it execute the correct handler.
Now the problem seems that mouse didn't raise any IRQ. It seems like nothing happen, irqinterrupt isn't called.
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
Re: Mouse + IRQ slave questions
Are you sure that you've enable mouse interupt in 8042?
On-Board 8042 Keyboard Microcontroller Command byte
Second bit is Mouse device interrupt enable.
So you have to do something like following code.
On-Board 8042 Keyboard Microcontroller Command byte
Second bit is Mouse device interrupt enable.
So you have to do something like following code.
Code: Select all
kSendKeyboardCmd( 0x20 );
bCmdByte = kGetKeyboardData();
bCmdByte |= 0x02;
kSendKeyboardCmd( 0x60 );
kSendKeyboardData( bCmdByte );
Re: Mouse + IRQ slave questions
The problem seems to be that the Mouse IRQ isn't raised.
I cleared the bit of IRQ 12, and the IRQ 2 for the cascade into pic registers
configured the IDT entries
teorycally with that operations mouse irq wil begin to work?
I need to do something else?
In bochs my touchpad is viewed like a ps2 mouse?
Thanks!!!
I cleared the bit of IRQ 12, and the IRQ 2 for the cascade into pic registers
configured the IDT entries
teorycally with that operations mouse irq wil begin to work?
I need to do something else?
In bochs my touchpad is viewed like a ps2 mouse?
Thanks!!!
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
Re: Mouse + IRQ slave questions
well
have you init the mouse currectly ??
but let me summerice a tinny list of what to do:
KMT dk
have you init the mouse currectly ??
but let me summerice a tinny list of what to do:
- Do map IRQ's
Do enable all IRQ
Do enable aux line, using the KBC status byte
Do ensure that "packed reporting" are enable ( the mouse)
and be sure to send EOI for all interrupts,
and when it is a IRQ from 0-7 it is only the master whitch need the EOI
above means that the slave also needs the EOI
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: Mouse + IRQ slave questions
In notebook, they clear mouse interupt enable bit in 8042, normally.The problem seems to be that the Mouse IRQ isn't raised.
I cleared the bit of IRQ 12, and the IRQ 2 for the cascade into pic registers
So make sure that bit is set.