summaryrefslogtreecommitdiff
path: root/arch/i386/kernel/serial.c
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2025-01-12 01:17:36 -0600
committerDanny Holman <dholman@gymli.org>2025-01-12 01:19:11 -0600
commit95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf (patch)
treec8c35347b50477929727fa5be9f5d0f55cbe18fd /arch/i386/kernel/serial.c
parent5e166f3042a8e7b3031aae4da7006f80caa53ecc (diff)
PROJECT RESTRUCTURING
Move the entire kernel into its own directory. Create new directories for system commands, libraries and other required essentials for a complete Unix-like operating system. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/kernel/serial.c')
-rw-r--r--arch/i386/kernel/serial.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/arch/i386/kernel/serial.c b/arch/i386/kernel/serial.c
deleted file mode 100644
index dc2a8bd..0000000
--- a/arch/i386/kernel/serial.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <kernel/serial.h>
-#include <kernel/pic.h>
-#include <libk/string.h>
-#include <stddef.h>
-
-#define PORT 0x3f8
-
-static inline int _serial_received(void) {
- return inb(PORT + 5) & 1;
-}
-
-static inline int _is_transmit_empty(void) {
- return inb(PORT + 5) & 0x20;
-}
-
-int serial_init(void) {
- outb(PORT + 1, 0x00);
- outb(PORT + 3, 0x80);
- outb(PORT + 0, 0x03);
- outb(PORT + 1, 0x00);
- outb(PORT + 3, 0x03);
- outb(PORT + 2, 0xC7);
- outb(PORT + 4, 0x0B);
- outb(PORT + 4, 0x1E);
- outb(PORT + 0, 0xAE);
-
- if (inb(PORT + 0) != 0xAE)
- return -1;
-
- outb(PORT + 4, 0x0F);
- return 0;
-}
-
-void serial_putchar(char c) {
- while (_is_transmit_empty() == 0);
- outb(PORT, c);
-}
-
-char serial_getchar(void) {
- while (_serial_received() == 0);
- return inb(PORT);
-}