35,7 → 35,7 |
|
#include "kernel/kern.h" |
#include <drivers/fg.h> |
#include <drivers/vga.h> |
#include <drivers/glib.h> |
#include <drivers/keyb.h> |
#include <unistd.h> |
#include <stdlib.h> |
43,8 → 43,6 |
#define WIDTH 640 |
#define HEIGHT 480 |
#define BYTES_PP 2 |
#define INITSTR G640x480x64K //SVGAlib standard mode definitions |
#define CARD VESA //Video driver |
|
unsigned char *video_buf = NULL; //Video Buffer |
unsigned long int VMEMLONG = WIDTH * HEIGHT * BYTES_PP / 4; // Used by copy_videomem_16to16 |
57,33 → 55,23 |
|
unsigned int color = FG_MONO; |
|
static int screen(int mode) |
extern DWORD flbaddr; |
|
static void screen() |
{ |
|
vga_modeinfo *minf; |
/* graphic card Initialization */ |
if (grx_init() < 1) { |
sys_abort(1); |
} |
|
vga_setmode(mode,CARD); |
minf = vga_getmodeinfo(mode); |
if(! (minf->flags & CAPABLE_LINEAR)){ |
vga_setmode(TEXT,CARD); |
printk(KERN_INFO "The mode %d is not capable of linear\n",mode); |
return 1; |
if (grx_open(640, 480, 16) < 0) { |
cprintf("GRX Err\n"); |
sys_abort(1); |
} |
vga_setpage(0); |
if(vga_setlinearaddressing() == -1) { |
vga_setmode(TEXT,CARD); |
printk(KERN_INFO "Could not set linear addressing for mode %d\n",mode); |
return 1; |
} |
|
video_buf = vga_getgraphmem(); |
video_buf = (unsigned char *)flbaddr; |
|
memset(video_buf, 0, RGB565MEM); |
|
grx_setbuffer(video_buf, WIDTH, HEIGHT); //Init of RGBA version of grx functions |
//created to work with Mesa buffer |
return 0; |
|
} |
|
void program_end(void *arg) |
91,7 → 79,7 |
|
FG_close(); |
|
vga_setmode(TEXT,CARD); |
grx_close(); |
|
sys_end(); |
|
134,8 → 122,8 |
|
} |
|
printf_xy(0,0,WHITE,"Grabbed = %08lx",*(DWORD *)(imageptr + 50*FG_W + 50)); |
printf_xy(0,1,WHITE,"Grabbed = %08lx",*(DWORD *)(imageptr + 51*FG_W + 50)); |
//printf_xy(0,0,WHITE,"Grabbed = %08lx",*(DWORD *)(imageptr + 50*FG_W + 50)); |
//printf_xy(0,1,WHITE,"Grabbed = %08lx",*(DWORD *)(imageptr + 51*FG_W + 50)); |
|
} |
|
160,9 → 148,10 |
keyb_hook(k,program_key_end); |
} |
|
//screen(INITSTR); |
video_buf = malloc(RGB565MEM); |
|
screen(); |
//video_buf = malloc(RGB565MEM); |
|
sleep(1); |
|
FG_init(FG_PERIOD, FG_WCET, FG_W, FG_H, color, channel); |