Add pl111 support
This commit is contained in:
parent
aaa714d89a
commit
955d15803f
@ -1,4 +1,5 @@
|
|||||||
DEVICES_PREFIX = devices
|
DEVICES_PREFIX = devices
|
||||||
|
|
||||||
KOBJS += $(DEVICES_PREFIX)/pl110.o
|
|
||||||
KOBJS += $(DEVICES_PREFIX)/pl011.o
|
KOBJS += $(DEVICES_PREFIX)/pl011.o
|
||||||
|
KOBJS += $(DEVICES_PREFIX)/pl110.o
|
||||||
|
KOBJS += $(DEVICES_PREFIX)/pl111.o
|
||||||
|
54
devices/pl111.c
Normal file
54
devices/pl111.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <framebuffer.h>
|
||||||
|
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
|
||||||
|
#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
|
||||||
|
uint32 volatile timing1; //4
|
||||||
|
uint32 volatile timing2; //8
|
||||||
|
uint32 volatile timing3; //c
|
||||||
|
uint32 volatile upbase; //10
|
||||||
|
uint32 volatile lpbase; //14
|
||||||
|
uint32 volatile control; //18
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fbdev pl111_fb_device;
|
||||||
|
|
||||||
|
int pl111_init(struct fb *f, unsigned int color_depth) {
|
||||||
|
struct pl111_control *plio = (struct pl111_control*)PL111_IOBASE;
|
||||||
|
|
||||||
|
/* 640x480 pixels */
|
||||||
|
plio->timing0 = 0x3f1f3f9c;
|
||||||
|
plio->timing1 = 0x080b61df;
|
||||||
|
plio->upbase = PL111_FB_BASE;
|
||||||
|
|
||||||
|
if (color_depth == FB_COLOR_DEPTH_8) {
|
||||||
|
plio->control = 0x1827;
|
||||||
|
} else if (color_depth == FB_COLOR_DEPTH_16) {
|
||||||
|
plio->control = 0x1829;
|
||||||
|
} else if (color_depth == FB_COLOR_DEPTH_24) {
|
||||||
|
plio->control = 0x182B;
|
||||||
|
} else {
|
||||||
|
//assume 16 if nothing else fit
|
||||||
|
color_depth = 16;
|
||||||
|
plio->control = 0x1829;
|
||||||
|
}
|
||||||
|
|
||||||
|
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->color_depth = color_depth;
|
||||||
|
f->device->color_depth = color_depth;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
3
include/devices/pl111.h
Normal file
3
include/devices/pl111.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include <framebuffer.h>
|
||||||
|
|
||||||
|
int pl111_init(struct fb *f, unsigned int color_depth);
|
@ -1,7 +1,7 @@
|
|||||||
#include <print.h>
|
#include <print.h>
|
||||||
#include <devices/pl011.h>
|
#include <devices/pl011.h>
|
||||||
|
|
||||||
#include <devices/pl110.h>
|
#include <devices/pl111.h>
|
||||||
#include <framebuffer.h>
|
#include <framebuffer.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ struct fb myfb;
|
|||||||
|
|
||||||
void video(void) {
|
void video(void) {
|
||||||
// unsigned int x, y;
|
// unsigned int x, y;
|
||||||
pl110_init(&myfb, 24);
|
pl111_init(&myfb, 24);
|
||||||
// x = 0, y = 0;
|
// x = 0, y = 0;
|
||||||
// for (y=0; y<480; y++)
|
// for (y=0; y<480; y++)
|
||||||
// for (x=0; x<640; x++)
|
// for (x=0; x<640; x++)
|
||||||
|
Loading…
Reference in New Issue
Block a user