--- 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.