Better function name

pull/27/head
E. Almqvist 3 years ago
parent 91923430c4
commit 22b1676cb7
  1. 11
      drivers/vga.c
  2. 2
      drivers/vga.h
  3. 8
      kernel/io.c
  4. 8
      kernel/io.h

@ -1,5 +1,5 @@
// VGA Graphics Library // VGA Graphics Library
#include <sys/io.h> #include "../kernel/io.h"
// VGA base address: 0xb8000 // VGA base address: 0xb8000
// Charpos = 0xb8000 + 2(row*80 + col) // Charpos = 0xb8000 + 2(row*80 + col)
@ -35,9 +35,14 @@ void clear_screen() {
*c = 0x20; *c = 0x20;
} }
void disable_cursor() { void disable_vga_cursor() {
/*
outb(0x3d4, 0x0a); outb(0x3d4, 0x0a);
outb(0x3d5, 0x20); outb(0x3d5, 0x20);
*/
port_outb(0x0a, 0x3d4);
port_outb(0x20, 0x3d5);
} }
@ -62,6 +67,6 @@ void println(char* str, int colorcode) {
// VGA Initialization Function // VGA Initialization Function
void vga_init() { void vga_init() {
disable_cursor(); disable_vga_cursor();
clear_screen(); clear_screen();
} }

@ -1,7 +1,7 @@
char* get_vga_charpos_pointer(unsigned int col, unsigned int row); char* get_vga_charpos_pointer(unsigned int col, unsigned int row);
void writechar(char c, unsigned int col, unsigned int row, int colorcode); void writechar(char c, unsigned int col, unsigned int row, int colorcode);
void clear_screen(); void clear_screen();
void disable_cursor(); void disable_vga_cursor();
void set_cursor_pos(); void set_cursor_pos();
void print(); void print();
void println(); void println();

@ -1,5 +1,5 @@
// Function to read a byte from port // 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; unsigned char res;
__asm__("in %%dx, %%al" : "=a" (res) : "d" (port)); __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 // 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)); __asm__("out %%al, %%dx" : :"a" (data), "d" (port));
} }
// Read word from port // Read word from port
unsigned short port_word_in(unsigned short port) { unsigned short port_inw(unsigned short port) {
unsigned short res; unsigned short res;
__asm__("in %%dx, %%ax" : "=a" (res) : "d" (port)); __asm__("in %%dx, %%ax" : "=a" (res) : "d" (port));
@ -21,6 +21,6 @@ unsigned short port_word_in(unsigned short port) {
} }
// write word to 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)); __asm__("out %%ax, %%dx" : :"a" (data), "d" (port));
} }

@ -1,5 +1,5 @@
unsigned char port_byte_in(); unsigned char port_inb();
void port_byte_out(); void port_outb();
unsigned short port_word_in(); unsigned short port_inw();
void port_word_out(); void port_outw();

Loading…
Cancel
Save