diff --git a/devices/pl110.c b/devices/pl110.c index 2a1419c..b633b97 100644 --- a/devices/pl110.c +++ b/devices/pl110.c @@ -20,12 +20,13 @@ #include #include +#include +#include #define PL110_CR_EN 0x001 #define PL110_CR_PWR 0x800 #define PL110_IOBASE 0xc0000000 #define PL110_PALBASE (PL110_IOBASE + 0x200) -#define PL110_FB_BASE 0x200000; struct pl110_control { uint32 volatile timing0; //0 @@ -41,12 +42,27 @@ struct pl110_control { struct fbdev pl110_fb_device; int pl110_init(struct fb *f, unsigned int color_depth) { + unsigned int width, height; + unsigned int fb_size, power; struct pl110_control *plio = (struct pl110_control*)PL110_IOBASE; + struct page *p; /* 640x480 pixels */ + width = 640; + height = 480; plio->timing0 = 0x3f1f3f9c; plio->timing1 = 0x080b61df; - plio->upbase = PL110_FB_BASE; + + /* Allocate memory for framebuffer */ + fb_size = width * height * (color_depth / 8); + power = log(fb_size) - log(MM_PAGE_SIZE); + if ((unsigned int)1<upbase = (uint32)p->address; if (color_depth == FB_COLOR_DEPTH_8) { plio->control = 0x1827; @@ -61,11 +77,11 @@ int pl110_init(struct fb *f, unsigned int color_depth) { } f->device = &pl110_fb_device; - f->device->fbaddr = (void*)PL110_FB_BASE; - f->width = 640; - f->device->pixelwidth = 640; - f->height = 480; - f->device->pixelheight = 480; + f->device->fbaddr = (void*)plio->upbase; + f->width = width; + f->device->pixelwidth = width; + f->height = height; + f->device->pixelheight = height; f->color_depth = color_depth; f->device->color_depth = color_depth; diff --git a/devices/pl111.c b/devices/pl111.c index 666d309..099dc45 100644 --- a/devices/pl111.c +++ b/devices/pl111.c @@ -20,12 +20,13 @@ #include #include +#include +#include #define PL111_CR_EN 0x001 #define PL111_CR_PWR 0x800 #define PL111_IOBASE 0x10020000 #define PL111_PALBASE (PL111_IOBASE + 0x200) -#define PL111_FB_BASE 0x200000; struct pl111_control { uint32 volatile timing0; //0 @@ -40,12 +41,27 @@ struct pl111_control { struct fbdev pl111_fb_device; int pl111_init(struct fb *f, unsigned int color_depth) { + unsigned int width, height; + unsigned int fb_size, power; struct pl111_control *plio = (struct pl111_control*)PL111_IOBASE; + struct page *p; /* 640x480 pixels */ + width = 640; + height = 480; plio->timing0 = 0x3f1f3f9c; plio->timing1 = 0x080b61df; - plio->upbase = PL111_FB_BASE; + + /* Allocate memory for framebuffer */ + fb_size = width * height * (color_depth / 8); + power = log(fb_size) - log(MM_PAGE_SIZE); + if ((unsigned int)1<upbase = (uint32)p->address; if (color_depth == FB_COLOR_DEPTH_8) { plio->control = 0x1827; @@ -60,11 +76,11 @@ int pl111_init(struct fb *f, unsigned int color_depth) { } f->device = &pl111_fb_device; - f->device->fbaddr = (void*)PL111_FB_BASE; - f->width = 640; - f->device->pixelwidth = 640; - f->height = 480; - f->device->pixelheight = 480; + f->device->fbaddr = (void*)plio->upbase; + f->width = width; + f->device->pixelwidth = width; + f->height = height; + f->device->pixelheight = height; f->color_depth = color_depth; f->device->color_depth = color_depth;