noxos (docs): documented PS/2

This commit is contained in:
antifallobst 2023-05-01 01:28:55 +02:00
parent 0b5927f563
commit a4d48780f3
5 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
title: "ps2"
summary: "The PS/2 standard for communicating with keyboards and mice"
---

View File

@ -0,0 +1,6 @@
---
title: "ps2"
---
The PS/2 standard for communicating with keyboards and mice.

View File

@ -0,0 +1,39 @@
---
title: "controller.h"
summary: "Communicates with the PS/2 controller chip"
---
**Warning:** This whole code needs to be reworked!
# `PS2_CONTROLLER_DATA_PORT` - macro
The data transmission IO port.
# `PS2_CONTROLLER_STATUS_PORT` - macro
The Status register IO port.
# `PS2_CONTROLLER_COMMAND_PORT` - macro
The command transmission IO port.
# `PS2_CONTROLLER_TIMEOUT` - macro
The amount of cycles the system waits for the controller before cancelling an operation.
# `ps2_controller_init()` - function (void)
Initializes the PS/2 controller and devices.
At the moment it trusts very much stuff blindly.
This needs to be changed.
The osdev wiki has a list of stuff to do while initializing PS/2.
# `ps2_controller_command(command)` - function (uint8_t)
Sends the PS/2 controller a command.
# `ps2_controller_command_with_data(command, data)` - function (uint8_t)
Sends the PS/2 controller a command that needs additional data on the data port.
# `ps2_controller_wait_until_ready_for_input()` - function (bool)
Halts until the status register says that there can be data read, or the timeout is reached.
# `ps2_controller_wait_until_ready_for_output()` - function (bool)
Halts until the status register says that there can be data written, or the timeout is reached.
# `ps2_controller_read_data()` - function (uint8_t)
Reads data from the PS/2 controller.

View File

@ -0,0 +1,24 @@
---
title: "keyboard.h"
summary: "The driver for PS/2 keyboards"
---
# `ps2_keyboard_command_E` - enum
Commands that can be issued to the keyboard.
# `ps2_keyboard_response_E` - enum
Responses that a keyboard can reply on a command.
# `ps2_keyboard_command(command, data)` - function (uint8_t)
Sends a command to the keyboard.
# `ps2_keyboard_init()` - function (void)
Initializes the keyboard driver.
This should only be called by the PS/2 controller init function.
# `ps2_keyboard_read()` - function (void)
Reads a key from the keyboard and writes it to the tty.
This should be called when IRQ1 is fired.
# `ps2_keyboard_command_to_string(command)` - function (string_t)
Returns a matching string for **_command_** in `ps2_keyboard_command_E`.

View File

@ -0,0 +1,7 @@
---
title: "scancodes.h"
summary: "key mapping definitions"
---
This holds definitions on which key is mapped to which scancode.
Currently only scancode set 1 is supported.