This is the documentation for the latest (master) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

PS/2

Overview

The PS/2 connector first hit the market in 1987 on IBM’s desktop PC line of the same name before becoming an industry-wide standard for mouse and keyboard connections. Starting around 2007, USB superseded PS/2 and is the modern peripheral device connection standard. For legacy support on boards with a PS/2 connector, Zephyr provides these PS/2 driver APIs.

Configuration Options

Related configuration options:

API Reference

group ps2_interface

PS/2 Driver APIs.

Typedefs

typedef void (*ps2_callback_t)(struct device *dev, u8_t data)

PS/2 callback called when user types or click a mouse.

Parameters
  • dev: Pointer to the device structure for the driver instance.

  • data: Data byte passed pack to the user.

Functions

int ps2_config(struct device *dev, ps2_callback_t callback_isr)

Configure a ps2 instance.

Parameters
  • dev: Pointer to the device structure for the driver instance.

  • callback_isr: called when PS/2 devices reply to a configuration command or when a mouse/keyboard send data to the client application.

Return Value
  • 0: If successful.

  • Negative: errno code if failure.

int ps2_write(struct device *dev, u8_t value)

Write to PS/2 device.

Parameters
  • dev: Pointer to the device structure for the driver instance.

  • value: Data for the PS2 device.

Return Value
  • 0: If successful.

  • Negative: errno code if failure.

int ps2_read(struct device *dev, u8_t *value)

Read slave-to-host values from PS/2 device.

Parameters
  • dev: Pointer to the device structure for the driver instance.

  • value: Pointer used for reading the PS/2 device.

Return Value
  • 0: If successful.

  • Negative: errno code if failure.

int ps2_enable_callback(struct device *dev)

Enables callback.

Parameters
  • dev: Pointer to the device structure for the driver instance.

Return Value
  • 0: If successful.

  • Negative: errno code if failure.

int ps2_disable_callback(struct device *dev)

Disables callback.

Parameters
  • dev: Pointer to the device structure for the driver instance.

Return Value
  • 0: If successful.

  • Negative: errno code if failure.