Initial commit

This commit is contained in:
2021-01-28 22:59:39 +01:00
commit d7f0e8dd36
30 changed files with 2092 additions and 0 deletions

33
kernel/drivers/ports.c Normal file
View File

@@ -0,0 +1,33 @@
/*
* ports.c
*
* Created on: Aug 18, 2019
* Author: rick
*/
#include "ports.h"
/**
* Read a byte from the specified port
*/
unsigned char port_byte_in(unsigned short port) {
unsigned char result;
__asm__("in %%dx, %%al" : "=a" (result) : "d" (port));
return result;
}
void port_byte_out(unsigned short port, unsigned char data) {
__asm__("out %%al, %%dx" : : "a" (data), "d" (port));
}
unsigned short port_word_in(unsigned short port) {
unsigned short result;
__asm__("in %%dx, %%ax" : "=a" (result) : "d" (port));
return result;
}
void port_wordt_out(unsigned short port, unsigned short data) {
__asm__("out %%ax, %%dx" : : "a" (data), "d" (port));
}