feat: setup structure for block devices

added ide block device
added mbr block device driver
started fat block device driver

reordered boot
start timer before pci/ide/etc.
enable interrupts earlier

fixed exception from ide controller

cleanup code
more printfs
This commit is contained in:
2021-02-09 22:47:35 +01:00
parent 9440fae968
commit 2ac0da6574
16 changed files with 467 additions and 106 deletions

View File

@@ -3,10 +3,8 @@
//
#include "keyboard.h"
#include <kprint.h>
#include <drivers/ports.h>
#include <cpu/isr.h>
#include <libc/libc.h>
#include <libc/stdbool.h>
#include <libc/ringqueue.h>
#include <mem/mem.h>
@@ -27,28 +25,6 @@ const char scancode_map_uppercase[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
//
//char scancodes_ascii[] = {
// 0, 0,
// '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0,
// 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 0,
// 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
// 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0,
// '*',
// 0, ' ',
// 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F1-F10
// 0, 0,
// '7', '8', '9', '-',
// '4', '5', '6', '+',
// '1', '2', '3',
// '0', 0,
// 0, // sysrq
// 0, 0, // weird
// 0, 0, // F11 F12
// // weid
//};
struct {
u8 shift: 1;
u8 ctrl: 1;
@@ -58,11 +34,9 @@ struct {
void *keyboard_event_buffer = NULL;
char *MSG_KEY = "Clicked on key 'x'\n";
char getc() {
while (true) {
KeyEvent* event = get_next_event();
KeyEvent *event = get_next_event();
char retval = 0;
if (event == NULL) {
goto _getc_end;
@@ -154,7 +128,6 @@ static void keyboard_callback(registers_t regs) {
}
unsigned char scancode = port_byte_in(PORT_PS2_DATA);
publish_key_event(scancode);
// print_scancode(scancode);
}
void init_keyboard() {
@@ -165,25 +138,3 @@ void init_keyboard() {
keyboard_state.extended = 0;
keyboard_event_buffer = create_buffer(256, sizeof(KeyEvent));
}
//void print_scancode(unsigned char scancode) {
// char msg[256];
// char release = 0;
// if (scancode > 0x80) {
// // release
// release = 1;
// scancode -= 0x80;
// }
// char code = scancodes_ascii[scancode];
// if (code == 0) {
// // special
// } else {
// if (release && code > 0x60 && code < 0x7B) {
// code -= 0x20; // to lowercase
// }
//
// strcpy(msg, MSG_KEY);
// msg[strlen(msg) - 3] = code;
// kprint(msg);
// }
//}