Author Topic: Modern PS/2 ports + Interrupt / Poll Progamming  (Read 1228 times)

0 Members and 1 Guest are viewing this topic.

Offline anmol2701

  • Thread Starter
  • Posts: 1
Modern PS/2 ports + Interrupt / Poll Progamming
« on: Tue, 10 April 2012, 07:44:50 »
Hello to all the mebers,

Pl. welcome me first. It's my first post into this forum.

Now, the question is I have to develop JPOS driver for keyboard having PS/2 interface. Now some of the questions that are making me doubtful are:-

    which one ie. poll or interrupt mode should be used ?? Any relevant link would be appreciated.


    A friend of mine told me that port 0x60 and 0x64 would not work for modern PS/2. I googled but not found any new port. All are discussing about these only.


I am developing these driver for Ubuntu.

Welcome in case of any further information.

Anmol

Offline Turbinia

  • Posts: 64
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #1 on: Tue, 10 April 2012, 08:04:48 »
Poll method, what I know about is firmware/controller type stuff so hopefully this helps.

Explains a keyboard matrix
http://www.dribin.org/dave/keyboard/html/

An example of keyboard firmware
http://geekhack.org/showwiki.php?title=Island:14618
http://www.pjrc.com/teensy/usb_keyboard.html

PS/2 scan codes
http://www.computer-engineering.org/ps2keyboard/scancodes2.html

Not sure what POS stuff you need to do, the card reader may need to be an interrupt though.
| Dolch | KBT ONE | QFR w/PBT | Poker II |

Offline Squelos

  • Posts: 153
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #2 on: Tue, 10 April 2012, 15:10:32 »
Why would you use polling over IRQ's ? On a few occasion I have had terrible drivers that used the polling method, which just resulted in a massive waste of CPU time.
I switched hardware very fast after noticing this.

Im far from saying that your driver will chew up CPU time, but IMO, IRQ's are better than polling.

Btw, Polling got replaced by IRQ's for a reason. Im not saying that im sure 100% about using IRQ's over polling for a keyboard driver, because I never made a keyboard driver, but from my point of view, you are going the wrong direction.

Offline Soarer

  • * Elevated Elder
  • Posts: 1918
  • Location: UK
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #3 on: Tue, 10 April 2012, 16:02:01 »
I'm curious why it has to be so low-level - isn't there a good point in the driver chain to insert new code, that would avoid dealing with the hardware directly?

Offline mich

  • Posts: 156
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #4 on: Tue, 10 April 2012, 17:11:00 »
AFAIK keyboard controllers still run at 0x60/0x64, but in Linux you have the "i8042" driver which presents them as an abstract "serio" (serial i/o) device which kernel code can read/write bytes to without dealing directly with the hardware. There is also the "serio_raw" driver, which can make any serio device available as a dev file for userspace access (so it should be possible to write the whole driver in userland).

Finally, how exactly is your keyboad different from an ordinary PC board? It might be easier to adapt the standard "atkbd" driver to work with it.

Offline Turbinia

  • Posts: 64
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #5 on: Tue, 10 April 2012, 23:31:04 »
The keyboard controller polls. PC takes interrupts from the keyboard.
| Dolch | KBT ONE | QFR w/PBT | Poker II |

Offline Squelos

  • Posts: 153
Modern PS/2 ports + Interrupt / Poll Progamming
« Reply #6 on: Wed, 11 April 2012, 11:24:11 »
Quote from: Turbinia;572682
The keyboard controller polls. PC takes interrupts from the keyboard.

Oh ok, I had misunderstood the OP.
I was like : why dafuq would you make a driver that polls in 2012 ? And for a keyboard.

Never thought he could be talking about the keyboard itself.