From 22b1676cb7aa0e2fa7087d631b1f3f9b74387a6b Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 18 Aug 2021 22:24:00 +0200 Subject: [PATCH] Better function name --- drivers/vga.c | 11 ++++++++--- drivers/vga.h | 2 +- kernel/io.c | 8 ++++---- kernel/io.h | 8 ++++---- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/vga.c b/drivers/vga.c index cde216f..56a76c8 100644 --- a/drivers/vga.c +++ b/drivers/vga.c @@ -1,5 +1,5 @@ // VGA Graphics Library -#include +#include "../kernel/io.h" // VGA base address: 0xb8000 // Charpos = 0xb8000 + 2(row*80 + col) @@ -35,9 +35,14 @@ void clear_screen() { *c = 0x20; } -void disable_cursor() { +void disable_vga_cursor() { + /* outb(0x3d4, 0x0a); outb(0x3d5, 0x20); + */ + + port_outb(0x0a, 0x3d4); + port_outb(0x20, 0x3d5); } @@ -62,6 +67,6 @@ void println(char* str, int colorcode) { // VGA Initialization Function void vga_init() { - disable_cursor(); + disable_vga_cursor(); clear_screen(); } diff --git a/drivers/vga.h b/drivers/vga.h index b5f2517..cf7a721 100644 --- a/drivers/vga.h +++ b/drivers/vga.h @@ -1,7 +1,7 @@ char* get_vga_charpos_pointer(unsigned int col, unsigned int row); void writechar(char c, unsigned int col, unsigned int row, int colorcode); void clear_screen(); -void disable_cursor(); +void disable_vga_cursor(); void set_cursor_pos(); void print(); void println(); diff --git a/kernel/io.c b/kernel/io.c index 4bdffb8..951ba67 100644 --- a/kernel/io.c +++ b/kernel/io.c @@ -1,5 +1,5 @@ // Function to read a byte from port -unsigned char port_byte_in(unsigned short port) { +unsigned char port_inb(unsigned short port) { unsigned char res; __asm__("in %%dx, %%al" : "=a" (res) : "d" (port)); @@ -7,13 +7,13 @@ unsigned char port_byte_in(unsigned short port) { } // to write a byte to port -void port_byte_out(unsigned short port, unsigned char data) { +void port_outb(unsigned short port, unsigned char data) { __asm__("out %%al, %%dx" : :"a" (data), "d" (port)); } // Read word from port -unsigned short port_word_in(unsigned short port) { +unsigned short port_inw(unsigned short port) { unsigned short res; __asm__("in %%dx, %%ax" : "=a" (res) : "d" (port)); @@ -21,6 +21,6 @@ unsigned short port_word_in(unsigned short port) { } // write word to port -void port_word_out(unsigned short port, unsigned short data) { +void port_outw(unsigned short port, unsigned short data) { __asm__("out %%ax, %%dx" : :"a" (data), "d" (port)); } diff --git a/kernel/io.h b/kernel/io.h index 87c3e5c..74b7419 100644 --- a/kernel/io.h +++ b/kernel/io.h @@ -1,5 +1,5 @@ -unsigned char port_byte_in(); -void port_byte_out(); +unsigned char port_inb(); +void port_outb(); -unsigned short port_word_in(); -void port_word_out(); +unsigned short port_inw(); +void port_outw();