diff options
| author | Miguel <m.i@gmx.at> | 2018-09-21 19:49:53 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-21 19:49:53 +0200 |
| commit | 1e5f3a249d4d389f6f7747c8f26aaf8e2988d930 (patch) | |
| tree | f3d81b0324d0a09595ad5737f8c167f8a7138686 /driver | |
| parent | d7086073d9cc2d6f9174731bf8d8fb907d5d99e7 (diff) | |
struggling with UEFI
Diffstat (limited to 'driver')
| -rw-r--r-- | driver/vesa.c | 44 | ||||
| -rw-r--r-- | driver/vesa.h | 3 |
2 files changed, 32 insertions, 15 deletions
diff --git a/driver/vesa.c b/driver/vesa.c index c882595..ba87e6d 100644 --- a/driver/vesa.c +++ b/driver/vesa.c @@ -12,7 +12,7 @@ //#define FOOLSOS_SHOW_VESAMODES static foolfont *deffont; -static vbemodeinfo *VbeModeInfoBlock; +//static vbemodeinfo *VbeModeInfoBlock; static int console_x; static int console_y; @@ -26,6 +26,13 @@ static uint8_t* physbase; void PutConsoleNL(); void PutPixel(int x,int y, int color); +// we need to obtain this from somewhere else.. +static uint32_t vesaXres; +static uint32_t vesaYres; +static uint32_t vesaPitch; +static uint32_t vesaBpp; +static uint32_t vesaAddr; + //static char buf[80][24]; void vesa_update_cursor(uint32_t col,uint32_t row) @@ -96,12 +103,12 @@ void vesa_put_rect(int x, int y, int w , int h, int color) void vesa_clear_screen() { - vesa_put_rect(0,0,VbeModeInfoBlock->Xres, VbeModeInfoBlock->Yres, 0xffffff); + vesa_put_rect(0,0,vesaXres, vesaYres, 0xffffff); } void vesa_set_physbase(uint32_t addr) { - VbeModeInfoBlock->physbase=addr; + vesaAddr=addr; } // @@ -124,23 +131,31 @@ void vesa_set_physbase(uint32_t addr) // our video memory // -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) +uint32_t vesa_init(multiboot_information *inf, foolfont *rawfont) { +//inf->framebuffer_type + + vesaXres=inf->framebuffer_width; + vesaYres=inf->framebuffer_height; + vesaPitch=inf->framebuffer_pitch; + vesaBpp=inf->framebuffer_bpp; + vesaAddr=inf->framebuffer_addr; + //the only functionallu important init lines! (rest is log) - VbeModeInfoBlock=mode; + //VbeModeInfoBlock=mode; deffont=rawfont; console_x=0; console_y=0; int line_height=12; int col_width=10; - console_lines=mode->Yres/line_height; - console_cols=mode->Xres/col_width; + console_lines=vesaYres/line_height; + console_cols=vesaXres/col_width; //TODO dynamic (but need to sync with terminal!) console_cols=80; console_lines=24; - + /* // vesa info klog("vbe version: 0x%x / video mode ptr: 0x%x 0x%x", info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]); @@ -167,9 +182,10 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) modeptr++; } #endif +*/ - return VbeModeInfoBlock->physbase; + return vesaAddr; } @@ -177,9 +193,9 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) void PutPixel(int x,int y, int color) { //do not write memory outside the screen buffer, check parameters against the VBE mode info - if (x<0 || x>VbeModeInfoBlock->Xres|| y<0 || y>VbeModeInfoBlock->Yres) return; - if (x) x = (x*(VbeModeInfoBlock->bpp>>3)); // get bytes (divide by 8) - if (y) y = (y*VbeModeInfoBlock->pitch); + if (x<0 || x>vesaXres|| y<0 || y>vesaYres) return; + if (x) x = (x*(vesaBpp>>3)); // get bytes (divide by 8) + if (y) y = (y*vesaPitch); //uint8_t *cTemp=VbeModeInfoBlock->physbase; uint8_t *cTemp=VMEM_FRAMEBUFFER; @@ -300,12 +316,12 @@ static int boxy; void vesa_render() { vesa_clear_screen(); - vesa_put_rect(100,100,VbeModeInfoBlock->Xres-200,VbeModeInfoBlock->Yres-200,0xff); + vesa_put_rect(100,100,vesaXres-200,vesaYres-200,0xff); vesa_put_rect(boxx-10,boxy-10,20,20,0x999999); boxx++; // boxy+=boxx; - if(boxx>VbeModeInfoBlock->Xres-100)boxx=100; + if(boxx>vesaXres-100)boxx=100; // if(boxy>VbeModeInfoBlock->Yres-200)boxy=200; vesa_switch_buffers(); diff --git a/driver/vesa.h b/driver/vesa.h index 168013f..f98e612 100644 --- a/driver/vesa.h +++ b/driver/vesa.h @@ -1,5 +1,6 @@ #include <stdint.h> #include "lib/printf/printf.h" +#include "multiboot.h" void vesa_update_cursor(uint32_t col,uint32_t row); void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y); @@ -45,7 +46,7 @@ typedef struct ModeInfoBlock { uint16_t reserved2; }vbemodeinfo; -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont); +uint32_t vesa_init(multiboot_information *info,foolfont *); void PutConsoleChar(char c, int color); void PutConsole(char *str, int color); |
