diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-02-07 16:56:02 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2015-02-07 16:56:02 -0500 |
| commit | 2be70c3b7c3cb806614318858090c039bdfd4fc5 (patch) | |
| tree | 61faa241e572d3241718b868ef9b32c20312ffc9 /drivers | |
| parent | c0df0ee6437aa2786b1a92bc6af1284958d104c7 (diff) | |
| download | kappa-2be70c3b7c3cb806614318858090c039bdfd4fc5.zip kappa-2be70c3b7c3cb806614318858090c039bdfd4fc5.tar.gz kappa-2be70c3b7c3cb806614318858090c039bdfd4fc5.tar.bz2 kappa-2be70c3b7c3cb806614318858090c039bdfd4fc5.tar.xz | |
fix RNG with zero seed, rename VGA->GFX
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gfx.c (renamed from drivers/vga.c) | 14 | ||||
| -rw-r--r-- | drivers/include/gfx.h (renamed from drivers/include/vga.h) | 18 | ||||
| -rw-r--r-- | drivers/tty.c | 2 |
3 files changed, 15 insertions, 19 deletions
diff --git a/drivers/vga.c b/drivers/gfx.c index ccf0949..538dadb 100644 --- a/drivers/vga.c +++ b/drivers/gfx.c @@ -3,7 +3,7 @@ #include "log.h" #include "multiboot.h" #include "panic.h" -#include "vga.h" +#include "gfx.h" static uint8_t *framebuffer = NULL; static uint16_t fb_width; @@ -11,15 +11,15 @@ static uint16_t fb_height; /* this is BYTES per pixel */ static uint8_t fb_bpp; -const uint16_t *vga_width = &fb_width; -const uint16_t *vga_height = &fb_height; +const uint16_t *gfx_width = &fb_width; +const uint16_t *gfx_height = &fb_height; -void vga_drawpixel(int x, int y, uint32_t col) +void gfx_drawpixel(int x, int y, uint32_t col) { ((uint32_t*)framebuffer)[y * fb_width + x] = col; } -void vga_clear(uint32_t col) +void gfx_clear(uint32_t col) { uint8_t *p = framebuffer; uint8_t *stop = framebuffer + fb_width * fb_height * fb_bpp; @@ -30,7 +30,7 @@ void vga_clear(uint32_t col) } } -void vga_init(struct vbe_info_t *vbe_mode_info) +void gfx_init(struct vbe_info_t *vbe_mode_info) { framebuffer = (uint8_t*)vbe_mode_info->physbase; fb_width = vbe_mode_info->Xres; @@ -38,5 +38,5 @@ void vga_init(struct vbe_info_t *vbe_mode_info) fb_bpp = vbe_mode_info->bpp / 8; if(fb_bpp != 4) panic("BPP *MUST* be 32!!!\n"); - vga_clear(VGA_RGBPACK(0, 0, 0)); + gfx_clear(VGA_RGBPACK(0, 0, 0)); } diff --git a/drivers/include/vga.h b/drivers/include/gfx.h index 8ea478b..bafd7a3 100644 --- a/drivers/include/vga.h +++ b/drivers/include/gfx.h @@ -22,23 +22,19 @@ enum vga_color_t { #define VGA_WIDTH 80 #define VGA_HEIGHT 25 -#define VGA_SEQ_INDEX 0x3C4 -#define VGA_SEQ_DATA 0x3C5 -#define VGA_GC_INDEX 0x3CE -#define VGA_GC_DATA 0x3CF -#define VGA_CRTC_INDEX 0x3D4 -#define VGA_CRTC_DATA 0x3D5 - #define VGA_MAKE_COLOR(fg, bg) (fg | bg << 4) #define VGA_MAKE_ENTRY(ch, col) (((uint16_t)ch)|((uint16_t)col<<8)) #define VGA_RGBPACK(r, g, b) ((r << 16)|(g << 8)|(b << 0)) +#define GFX_WHITE 0xFFFFFF +#define GFX_BLACK 0x000000 + struct vbe_info_t; -void vga_init(struct vbe_info_t *vbe_mode_info); +void gfx_init(struct vbe_info_t *vbe_mode_info); -void vga_drawpixel(int x, int y, uint32_t color); +void gfx_drawpixel(int x, int y, uint32_t color); -void vga_clear(uint32_t color); +void gfx_clear(uint32_t color); -extern const uint16_t *vga_width, *vga_height; +extern const uint16_t *gfx_width, *gfx_height; diff --git a/drivers/tty.c b/drivers/tty.c index 7bce7e7..ae15778 100644 --- a/drivers/tty.c +++ b/drivers/tty.c @@ -1,9 +1,9 @@ #include <stdint.h> #include <stdio.h> +#include "gfx.h" #include "io.h" #include "panic.h" #include "tty.h" -#include "vga.h" static int term_x, term_y; static uint8_t term_col; |