diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-03-01 13:22:21 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2015-03-01 13:22:21 -0500 |
| commit | b8f54e63d2b8f8007c580adf2a6034c98a0f2eaa (patch) | |
| tree | 9e22526dd25bff3be2f78a5d29e62f7f677d4c09 | |
| parent | 6e86a3abee2d9b2c03452cd62997c2152a3332aa (diff) | |
| download | kappa-b8f54e63d2b8f8007c580adf2a6034c98a0f2eaa.zip kappa-b8f54e63d2b8f8007c580adf2a6034c98a0f2eaa.tar.gz kappa-b8f54e63d2b8f8007c580adf2a6034c98a0f2eaa.tar.bz2 kappa-b8f54e63d2b8f8007c580adf2a6034c98a0f2eaa.tar.xz | |
rename TTY driver to vgatext
| -rw-r--r-- | OBJ | 2 | ||||
| -rw-r--r-- | drivers/include/tty.h | 9 | ||||
| -rw-r--r-- | drivers/include/vgatext.h | 9 | ||||
| -rw-r--r-- | drivers/vgatext.c (renamed from drivers/tty.c) | 36 | ||||
| -rw-r--r-- | kernel/main.c | 6 |
5 files changed, 31 insertions, 31 deletions
@@ -14,7 +14,7 @@ drivers/gfx_font.o drivers/pcspkr.o drivers/ps2_keymaps.o drivers/ps2kbd.o -drivers/tty.o +drivers/vgatext.o kernel/fpu.o kernel/gdt-as.o kernel/gdt.o diff --git a/drivers/include/tty.h b/drivers/include/tty.h deleted file mode 100644 index 4748d81..0000000 --- a/drivers/include/tty.h +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdint.h> - -void tty_init(void); -void tty_clear(void); -void tty_set_color(uint8_t); -uint8_t tty_get_color(void); -void tty_putchar_at(int ch, uint8_t color, int x, int y); -void tty_putchar(int ch); -void tty_puts(const char*); diff --git a/drivers/include/vgatext.h b/drivers/include/vgatext.h new file mode 100644 index 0000000..1cfe4c4 --- /dev/null +++ b/drivers/include/vgatext.h @@ -0,0 +1,9 @@ +#include <stdint.h> + +void vgatext_init(void); +void vgatext_clear(void); +void vgatext_set_color(uint8_t); +uint8_t vgatext_get_color(void); +void vgatext_putchar_at(int ch, uint8_t color, int x, int y); +void vgatext_putchar(int ch); +void vgatext_puts(const char*); diff --git a/drivers/tty.c b/drivers/vgatext.c index a77071b..d0633af 100644 --- a/drivers/tty.c +++ b/drivers/vgatext.c @@ -3,7 +3,7 @@ #include "gfx.h" #include "io.h" #include "panic.h" -#include "tty.h" +#include "vgatext.h" static int term_x, term_y; static uint8_t term_col; @@ -16,7 +16,7 @@ static uint16_t video_detect_hardware(void) return *ptr; } -void tty_init(void) +void vgatext_init(void) { uint16_t vid_type = video_detect_hardware() & 0x30; if(vid_type == 0x20) @@ -31,12 +31,12 @@ void tty_init(void) else { /* none */ - panic("TTY init failed!"); + panic("VGATEXT init failed!"); } - tty_set_color(VGA_MAKE_COLOR(VGA_LIGHT_GRAY, VGA_BLACK)); - tty_clear(); - set_putchar(tty_putchar); - set_puts(tty_puts); + vgatext_set_color(VGA_MAKE_COLOR(VGA_LIGHT_GRAY, VGA_BLACK)); + vgatext_clear(); + set_putchar(vgatext_putchar); + set_puts(vgatext_puts); } static void move_cursor(uint16_t cursor_idx) @@ -52,7 +52,7 @@ static void update_cursor(void) move_cursor(term_y * VGA_WIDTH + term_x); } -void tty_clear(void) +void vgatext_clear(void) { term_x = 0; term_y = 0; @@ -65,32 +65,32 @@ void tty_clear(void) } } -void tty_set_color(uint8_t color) +void vgatext_set_color(uint8_t color) { term_col = color; } -uint8_t tty_get_color(void) +uint8_t vgatext_get_color(void) { return term_col; } -void tty_putchar_at(int ch, uint8_t col, int x, int y) +void vgatext_putchar_at(int ch, uint8_t col, int x, int y) { term_buf[y * VGA_WIDTH + x] = VGA_MAKE_ENTRY((char)ch, col); } -void tty_putchar(int ch) +void vgatext_putchar(int ch) { if(ch != '\n' && ch != '\b') { - tty_putchar_at(ch, term_col, term_x, term_y); + vgatext_putchar_at(ch, term_col, term_x, term_y); if(++term_x == VGA_WIDTH) { term_x = 0; if(++term_y == VGA_HEIGHT) { - tty_clear(); + vgatext_clear(); term_y = 0; } } @@ -100,7 +100,7 @@ void tty_putchar(int ch) term_x = 0; if(++term_y == VGA_HEIGHT) { - tty_clear(); + vgatext_clear(); term_y = 0; } } @@ -109,16 +109,16 @@ void tty_putchar(int ch) int temp_x = term_x - 1; if(temp_x >= 0) term_x = temp_x; - tty_putchar_at(' ', term_col, term_x, term_y); + vgatext_putchar_at(' ', term_col, term_x, term_y); } update_cursor(); } -void tty_puts(const char *str) +void vgatext_puts(const char *str) { while(*str) { - tty_putchar(*str++); + vgatext_putchar(*str++); } } diff --git a/kernel/main.c b/kernel/main.c index 9311359..76c62f8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -16,8 +16,8 @@ #include "ps2kbd.h" #include "fpu.h" #include "timer.h" -#include "tty.h" #include "version.h" +#include "vgatext.h" void gpf(struct regs_t *regs) { @@ -115,8 +115,8 @@ bool boot(struct multiboot_info_t *hdr, uint32_t magic) /* if graphical initialization fails, fall back to text mode */ if(!gfx_status) { - tty_init(); - printf("Graphics init failed, fell back to text mode.\n"); + vgatext_init(); + printf("Graphics init failed, fell back to VGA text mode.\n"); } if(magic != 0x2BADB002) |