CHAPTER 17
PS2 KEYBOARD AND MOUSE
The PS2 port is an interface used by a mouse or a keyboard. The device's activities are embedded in a stream of packets and transmitted to the host via two serial lines. Integrating a PS2 device to a Nios II system requires a custom controller and a proper software driver. In this chapter, we discuss the development of the hardware and software. The hardware includes a PS2 controller to transmit and receive data packets and an Avalon interface wrapping circuit. The software consists of driver routines to process the packets and to decode the keyboard or mouse activities.
17.1 INTRODUCTION
The PS2 port was introduced in IBM's Personal System/2 personnel computers. It is a widely supported interface for a keyboard or mouse to communicate with the host. The PS2 port contains two wires for communication purposes. One wire is for data, which is transmitted in a serial stream. The other wire is for the clock information, which specifies when the data are valid and can be retrieved. Although a host receives data from a device most of the time, it occasionally sends a command to the keyboard or mouse to set certain parameters. Thus, the communication of the PS2 port is bidirectional.
The information in a PS2 interface is transmitted as an 11-bit “packet” that contains a start bit, 8 data bits, an odd parity bit, and a stop bit. Whereas the basic format of the packet is identical for a keyboard and a mouse, the interpretation for the data bits is different. ...
Get Embedded SoPC Design with Nios II Processor and Verilog Examples now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.