PS/2: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Driver Model)
m (Fix broken link by linking to archive.org)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Stub}}
{{Stub}}

== PS/2 Overview ==


PS/2 is a type of serial communication, typically used for user input devices (keyboard, mouse, bar code scanner, etc). It involves a controller (e.g. "8042 chip" on PC compatible systems), the mechanical and electrical details of the communication itself, and a device.
PS/2 is a type of serial communication, typically used for user input devices (keyboard, mouse, bar code scanner, etc). It involves a controller (e.g. "8042 chip" on PC compatible systems), the mechanical and electrical details of the communication itself, and a device.


=== History ===
== History ==


Originally (1981) IBM used a different type of serial communication for XT keyboards. The older interface was not bi-directional - the device could talk to the controller, but the controller couldn't talk to the device.
Originally (1981) IBM used a different type of serial communication for XT keyboards. The older interface was not bi-directional - the device could talk to the controller, but the controller couldn't talk to the device.
Line 15: Line 13:
Eventually the PS/2 was superseded by USB, however it is still fairly common (and for compatibility, some system have emulation layers that make USB devices appear as PS/2 devices).
Eventually the PS/2 was superseded by USB, however it is still fairly common (and for compatibility, some system have emulation layers that make USB devices appear as PS/2 devices).


== PS/2 Protocol ==
== Protocol ==


A diagram of the PS2 connector is below.
A diagram of the PS2 connector is below.
Line 34: Line 32:
* 1 stop bit (always 1)
* 1 stop bit (always 1)
* 1 acknowledgement bit
* 1 acknowledgement bit



== Driver Model ==
== Driver Model ==
Line 40: Line 37:
There are various types of PS/2 port controllers; including "bit banging" general purpose IO, special support built into the system's chipset and add-on PCI cards. There are also various types of PS/2 devices (keyboard, mouse, touch-pad, bar code scanner, magnetic card/stripe reader, fingerprint reader, etc).
There are various types of PS/2 port controllers; including "bit banging" general purpose IO, special support built into the system's chipset and add-on PCI cards. There are also various types of PS/2 devices (keyboard, mouse, touch-pad, bar code scanner, magnetic card/stripe reader, fingerprint reader, etc).


Obviously you don't want to duplicate the code for every type of PS/2 device within each different PS/2 controller driver. You want to separate them, so that any driver for a PS/2 device can talk to the any PS/2 controller driver (and so that the PS/2 device's code can be ported to different architectures without any changes). This is relatively simple to do - PS/2 controller drivers only need to be able to send and receive bytes (there's no baud rate control or anything) and a simple "byte stream" approach suffices.
Obviously you don't want to duplicate the code for every type of PS/2 device within each different PS/2 controller driver. You want to separate them, so that any driver for a PS/2 device can talk to any PS/2 controller driver (and so that the PS/2 device's code can be ported to different architectures without any changes). This is relatively simple to do - PS/2 controller drivers only need to be able to send and receive bytes (there's no baud rate control or anything) and a simple "byte stream" approach suffices.


== See Also ==


==See Also==
=== Articles ===
*[["8042" PS/2 Controller]]
*[["8042" PS/2 Controller]]
*[[PL050 PS/2 Controller | PL050 PS/2 Controller (ARM)]]
*[[PL050 PS/2 Controller|PL050 PS/2 Controller (ARM)]]
*[[PS/2 Keyboard]]
*[[PS/2 Keyboard]]
*[[PS/2 Mouse]]
*[[PS/2 Mouse]]

===External Links===
=== External Links ===
*[http://www.versalent.biz/ps2facts.htm PS2 Facts and Info from Versalent]
*[http://www.versalent.biz/ps2facts.htm PS2 Facts and Info from Versalent]
*[http://www.computer-engineering.org/ps2protocol/ www.computer-engineering.org/ps2protocol]
*[https://web.archive.org/web/20180302005138/https://computer-engineering.org/ps2protocol/ https://computer-engineering.org/ps2protocol/]

[[Category:Common Devices]]
[[Category:Hardware Interfaces]]

Latest revision as of 07:14, 10 February 2024

This page is a stub.
You can help the wiki by accurately adding more contents to it.

PS/2 is a type of serial communication, typically used for user input devices (keyboard, mouse, bar code scanner, etc). It involves a controller (e.g. "8042 chip" on PC compatible systems), the mechanical and electrical details of the communication itself, and a device.

History

Originally (1981) IBM used a different type of serial communication for XT keyboards. The older interface was not bi-directional - the device could talk to the controller, but the controller couldn't talk to the device.

Later (1984) IBM replaced the older serial interface with a newer bi-directional interface for AT keyboards. This allowed the host to send commands to the device.

Later still (1987) IBM extended the "AT" standard to create the "PS/2" standard. The PS/2 standard is electrically identical to the older AT standard (it only uses a different plug/connector).

Eventually the PS/2 was superseded by USB, however it is still fairly common (and for compatibility, some system have emulation layers that make USB devices appear as PS/2 devices).

Protocol

A diagram of the PS2 connector is below.

The serial communication typically runs at a baud rate of 10 KHz to 16.7 KHz. Each byte sent by a device to a controller is transmitted as a packet containing 11 bits. The "device to host" packet has the following bits:

  • 1 start bit (always 0)
  • 8 data bits (least significant bit first)
  • 1 parity bit (odd parity)
  • 1 stop bit (always 1)

Each byte sent by a controller to a device is transmitted as a packet containing 12 bits. The "host to device" packet has the following bits:

  • 1 start bit (always 0)
  • 8 data bits (least significant bit first)
  • 1 parity bit (odd parity)
  • 1 stop bit (always 1)
  • 1 acknowledgement bit

Driver Model

There are various types of PS/2 port controllers; including "bit banging" general purpose IO, special support built into the system's chipset and add-on PCI cards. There are also various types of PS/2 devices (keyboard, mouse, touch-pad, bar code scanner, magnetic card/stripe reader, fingerprint reader, etc).

Obviously you don't want to duplicate the code for every type of PS/2 device within each different PS/2 controller driver. You want to separate them, so that any driver for a PS/2 device can talk to any PS/2 controller driver (and so that the PS/2 device's code can be ported to different architectures without any changes). This is relatively simple to do - PS/2 controller drivers only need to be able to send and receive bytes (there's no baud rate control or anything) and a simple "byte stream" approach suffices.

See Also

Articles

External Links