summaryrefslogtreecommitdiff
path: root/src/kernel/libs/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/libs/drivers')
-rw-r--r--src/kernel/libs/drivers/serial.c20
-rw-r--r--src/kernel/libs/drivers/video.c3
2 files changed, 11 insertions, 12 deletions
diff --git a/src/kernel/libs/drivers/serial.c b/src/kernel/libs/drivers/serial.c
index 665f06c..25f89ad 100644
--- a/src/kernel/libs/drivers/serial.c
+++ b/src/kernel/libs/drivers/serial.c
@@ -1,10 +1,6 @@
#include <stdint.h>
#include <serial.h>
-//you can add more options if you need to later
-// PORT + 3: values are from bit zero (right) to left
-// dlab(1) | misteryyy bone(1) | paraty(3) | stop bits (1) | character length (2)
static inline void outb(uint16_t port, uint8_t value) {
- //here "a" is the a register, and "Nd" is inteter (I think?) in the d register
asm volatile(
"outb %0, %1" :: "a"(value), "Nd"(port)
);
@@ -19,14 +15,14 @@ static inline uint8_t inb(uint16_t port) {
}
int init_serial(uint16_t port) {
- outb(port + 1, 0x00); // disable them fuckin interupts
- outb(port + 3, 0x80); // sets dlab, allowing custom serial speeds
- outb(port + 0, 0x06); // speed is 115200/6
+ outb(port + 1, 0x00);
+ outb(port + 3, 0x80);
+ outb(port + 0, 0x06);
outb(port + 1, 0x00);
- outb(port + 3, 0x03); // disables dlab, as well as 8 bit char len, 1 stop bit, no paraty, no mystery
- outb(port + 2, 0xc7); // I have no fucking clue what this means
- outb(port + 4, 0x0b); // don't know what this means eather... delete if you can
- outb(port + 4, 0x1e); // loopback mode (where the hell is this documented????)
+ outb(port + 3, 0x03);
+ outb(port + 2, 0xc7);
+ outb(port + 4, 0x0b);
+ outb(port + 4, 0x1e);
outb(port + 0, 0xae); // test char
@@ -38,6 +34,6 @@ int init_serial(uint16_t port) {
}
void _putchar_serial(uint16_t port, char msg) {
- while(!(inb(port + 5) & 0x20)); //wait for transmit to be doneroni
+ while(!(inb(port + 5) & 0x20)); //wait for transmit to be done
outb(port, msg);
}
diff --git a/src/kernel/libs/drivers/video.c b/src/kernel/libs/drivers/video.c
index 9bb4187..ab73bb0 100644
--- a/src/kernel/libs/drivers/video.c
+++ b/src/kernel/libs/drivers/video.c
@@ -1,5 +1,8 @@
#include <printf.h>
#include <video.h>
+
+//to be implimented when paging is set up
+
void dump_video() {
struct mode_info *video = (struct mode_info *)0x600;
printf("Video info:\nx:\t%u\ny:\t%u\nbbp:\t%u\nloc:\t0x%p\n", video->width, video->height, video->bpp, video->framebuffer);