blob: 718bb2043c94479037d08116e71290afd2e2a74b [file] [log] [blame]
swissChilid8137922021-02-17 15:34:07 -08001#pragma once
2
3#include "kint.h"
swissChili19ef4182021-02-21 17:45:51 -08004#include "registers.h"
5
6#define KBD_CMD_PORT 0x64
7#define KBD_DATA_PORT 0x60
8
9struct kbd_scan_code_info
10{
11 bool pressed;
12 bool escape;
13 char key;
14};
15
16extern struct kbd_scan_code_info scan_code_table[0xff];
swissChilid8137922021-02-17 15:34:07 -080017
18void outb(ushort port, uchar val);
swissChili0d248832021-04-08 18:16:02 -070019void outl(ushort port, uint val);
swissChilid8137922021-02-17 15:34:07 -080020uchar inb(ushort port);
21ushort inw(ushort port);
swissChili0d248832021-04-08 18:16:02 -070022uint inl(ushort port);
swissChilid8137922021-02-17 15:34:07 -080023
swissChilif5448622021-03-08 20:17:36 -080024/* Random string.h stuff, TODO: move to own header */
swissChilid8137922021-02-17 15:34:07 -080025void *memset(void *s, int c, size_t n);
26void *memcpy(void *dest, const void *src, size_t n);
swissChilie9289ee2021-03-20 21:54:28 -070027void strcpy(char *dest, char *src);
swissChilif5448622021-03-08 20:17:36 -080028int strcmp(char *a, char *b);
29uint strlen(char *a);
swissChili9b3584b2021-02-18 13:57:27 -080030
swissChili9bd74de2021-06-15 20:30:48 -070031bool isdigit(char c);
32uint parse_int(char *string);
33
swissChili19ef4182021-02-21 17:45:51 -080034uchar kbd_scan_code();
35void kbd_handle_input(struct registers *registers);
36void init_kbd();