40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOX_KEYBOARD_H
|
|
#define NOX_KEYBOARD_H
|
|
|
|
#include "utils/stdtypes.h"
|
|
#include "utils/string.h"
|
|
|
|
|
|
typedef enum {
|
|
PS2_KEYBOARD_COMMAND_SET_LEDS = 0xED,
|
|
PS2_KEYBOARD_COMMAND_ECHO = 0xEE,
|
|
PS2_KEYBOARD_COMMAND_SET_SCANCODE_SET = 0xF0,
|
|
PS2_KEYBOARD_COMMAND_IDENTIFY = 0xF2,
|
|
PS2_KEYBOARD_COMMAND_SET_TYPEMATIC = 0xF3,
|
|
PS2_KEYBOARD_COMMAND_ENABLE_SCAN = 0xF4,
|
|
PS2_KEYBOARD_COMMAND_DISABLE_SCAN = 0xF5,
|
|
PS2_KEYBOARD_COMMAND_SET_DEFAULT_PARAMS = 0xF6,
|
|
PS2_KEYBOARD_COMMAND_RESEND_LAST_BYTE = 0xFE,
|
|
PS2_KEYBOARD_COMMAND_SELF_TEST = 0xFF
|
|
} ps2_keyboard_command_E;
|
|
|
|
typedef enum {
|
|
PS2_KEYBOARD_RESPONSE_KEY_DETECTION_ERROR_1 = 0x00,
|
|
PS2_KEYBOARD_RESPONSE_SELF_TEST_PASSED = 0xAA,
|
|
PS2_KEYBOARD_RESPONSE_ECHO = 0xEE,
|
|
PS2_KEYBOARD_RESPONSE_ACKNOWLEDGED = 0xFA,
|
|
PS2_KEYBOARD_RESPONSE_SELF_TEST_FAILED_1 = 0xFC,
|
|
PS2_KEYBOARD_RESPONSE_SELF_TEST_FAILED_2 = 0xFD,
|
|
PS2_KEYBOARD_RESPONSE_RESEND = 0xFE,
|
|
PS2_KEYBOARD_RESPONSE_KEY_DETECTION_ERROR_2 = 0xFF
|
|
} ps2_keyboard_response_E;
|
|
|
|
uint8_t ps2_keyboard_command (ps2_keyboard_command_E command, uint8_t data);
|
|
void ps2_keyboard_init ();
|
|
void ps2_keyboard_read ();
|
|
string_t ps2_keyboard_command_to_string (ps2_keyboard_command_E command);
|
|
|
|
#endif //NOX_KEYBOARD_H
|