|
自己顶一下,分加上去了哈,大家帮帮忙!
把驱动程序相关的部分也贴出来让大家分析分析:
typedef struct
{struct fb_info_gen gen;
unsigned char *VmemAddr;
volatile unsigned char *RegAddr;
#ifdef CONFIG_FBCON_EPSON_PCI
u32 PhysAddr;
#endif
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif}FB_INFO_S1D13xxx;
static FB_INFO_S1D13xxx fb_info;
static struct display disp;
static char __initdata default_fontname[40] = { 0 };
static int
static int s1d13xxx_encode_fix(struct fb_fix_screeninfo *fix, const void *par,
struct fb_info_gen *info)
{memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, fb_info.gen.info.modename);
fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0;
fix->line_length = S1D_DISPLAY_SCANLINE_BYTES;
#ifdef FBCON_HAS_CFB4
fix->visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
#endif
#ifdef FBCON_HAS_CFB8
fix->visual = FB_VISUAL_PSEUDOCOLOR;
#endif
#ifdef FBCON_HAS_CFB16
fix->visual = FB_VISUAL_DIRECTCOLOR;
#endif
fix->mmio_start = S1D_PHYSICAL_REG_ADDR;
fix->mmio_len = S1D_PHYSICAL_REG_SIZE;
fix->smem_start = S1D_PHYSICAL_VMEM_ADDR;
fix->smem_len = S1D_PHYSICAL_VMEM_SIZE;
fix->xpanstep = fix->ypanstep = fix->ywrapstep = 0;
fix->accel = FB_ACCEL_NONE;
return 0;}
static int s1d13xxx_encode_var(struct fb_var_screeninfo *var, const void *fb_par,
struct fb_info_gen *info)
{memset(var, 0, sizeof(struct fb_var_screeninfo));
var->xres = S1D_DISPLAY_WIDTH;
var->yres = S1D_DISPLAY_HEIGHT;
var->xres_virtual = var->xres;
var->yres_virtual = var->yres;
var->xoffset = var->yoffset = 0;
var->bits_per_pixel = S1D_DISPLAY_BPP;
var->grayscale = 0;
var->nonstd = 0; /* != 0 Non standard pixel format */
var->activate = FB_ACTIVATE_NOW; /* see FB_ACTIVATE_* */
var->height = -1; /* height of picture in mm */
var->width = -1; /* width of picture in mm */
var->accel_flags = 0; /* acceleration flags (hints */
var->pixclock = S1D_DISPLAY_PCLK;
var->right_margin = 0;
var->lower_margin = 0;
var->hsync_len = 0;
var->vsync_len = 0;
var->left_margin = 0;
var->upper_margin = 0;
var->sync = 0;
var->vmode = FB_VMODE_INTERLACED;//FB_VMODE_NONINTERLACED;
#ifdef FBCON_HAS_CFB16 // RGB 565
var->red.offset = 11;
var->red.length = 5;
var->green.offset = 5;
var->green.length = 6;
var->blue.offset = 0;
var->blue.length = 5;
#endif
var->red.msb_right = var->green.msb_right = var->blue.msb_right = 0;
var->transp.offset = var->transp.length = var->transp.msb_right = 0;
return 0;
}
static int s1d13xxx_getcolreg(unsigned regno, unsigned *red, unsigned *green,
unsigned *blue, unsigned *transp, struct fb_info *info)
{
u32 r,g,b;
if (regno >= S1D_PALETTE_SIZE)
return 1;
S1D_READ_PALETTE(fb_info.RegAddr,regno,r,g,b);
*red = (r << 8) | r;
*green = (g << 8) | g;
*blue = (b << 8) | b;
*transp = 0;
return 0;}
static int s1d13xxx_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, struct fb_info *info)
{// printk("S1D13XXX: (setcolreg) i:%d r=%x g=%x b=%x\n", regno,red,green,blue);
if (regno >= S1D_PALETTE_SIZE)
return 1;
//#if !defined(FBCON_HAS_CFB16)
S1D_WRITE_PALETTE(fb_info.RegAddr,regno,red>>8,green>>8,blue>>8);
//#endif
#if defined(FBCON_HAS_CFB16)
// Make the first 16 colors of the palette available to fbcon
if (regno < 16)
{
fb_info.cfb16[regno] =
(red & 0xf800)|((green & 0xfc00) >> 5)|((blue & 0xf800) >> 11);
}
#endif
return 0;
}
static int s1d13xxx_pan_display(const struct fb_var_screeninfo *var,
struct fb_info_gen *info)
{
return 0;
}
static void s1d13xxx_set_disp(const void *par, struct display *disp,
struct fb_info_gen *info)
{
disp->screen_base = fb_info.VmemAddr;
#ifdef FBCON_HAS_CFB4
disp->dispsw = &fbcon_cfb4;
#endif
#ifdef FBCON_HAS_CFB8
disp->dispsw = &fbcon_cfb8;
#endif
#ifdef FBCON_HAS_CFB16
disp->dispsw = &fbcon_cfb16;
disp->dispsw_data = fb_info.cfb16; /* console palette */
#endif
disp->scrollmode = SCROLL_YREDRAW;
}
//-----------------------------------------------------------------------------
// Initialize the chip and the frame buffer driver.
//-----------------------------------------------------------------------------
int __init s1d13xxxfb_init(char *dummy) //这里调用的参数dummy,在哪里可以把dummy时候的onsole也设置成{ // 800*600的窗口大小啊。
int i;
S1D_INDEX s1dReg;
S1D_VALUE s1dValue;
S1D_VALUE temp;
plateform_init_video();
if (!request_mem_region(S1D_PHYSICAL_REG_ADDR,S1D_PHYSICAL_REG_SIZE, "EpsonFB_RG"))
printk("Error request mem \n");
if (!request_mem_region(S1D_PHYSICAL_VMEM_ADDR,S1D_PHYSICAL_VMEM_SIZE, "EpsonFB"))
printk("Error request mem \n");
fb_info.RegAddr = (unsigned char*) ioremap_nocache(S1D_PHYSICAL_REG_ADDR,S1D_PHYSICAL_REG_SIZE);
fb_info.VmemAddr = (unsigned char*) ioremap_nocache(S1D_PHYSICAL_VMEM_ADDR,S1D_PHYSICAL_VMEM_SIZE);
printk("S1D13XXX: Phys address:%X Phys Reg address:%X \n", fb_info.VmemAddr,fb_info.RegAddr);//@@GC
if (!fb_info.VmemAddr || !fb_info.RegAddr)
{
printk("s1d13xxx_init: ioremap() returned NULL\n");
}
local_s1d13xxxfb_open();
strcpy(fb_info.gen.info.modename, "s1d13xxx");
fb_info.gen.info.changevar = NULL;
fb_info.gen.info.node = -1;
fb_info.gen.info.fbops = &s1d13xxxfb_ops;
fb_info.gen.info.disp = &disp; //会是这里的问题吗?
fb_info.gen.info.switch_con = &fbgen_switch;
fb_info.gen.info.updatevar = &fbgen_update_var;
fb_info.gen.info.blank = &fbgen_blank;
strcpy(fb_info.gen.info.fontname, default_fontname);
fb_info.gen.parsize = 0;
fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT;
fb_info.gen.fbhw = &s1d13xxx_hwswitch;
fb_info.gen.fbhw->detect();
fbgen_get_var(&disp.var, -1, &fb_info.gen.info);
disp.var.activate = FB_ACTIVATE_NOW;
fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
fbgen_set_disp(-1, &fb_info.gen);
fbgen_install_cmap(0, &fb_info.gen);
if (register_framebuffer(&fb_info.gen.info) < 0) {
return -EINVAL;
}
printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.gen.info.node),
fb_info.gen.info.modename);
printk("Display %d x %d %dBpp\n",
S1D_DISPLAY_WIDTH,S1D_DISPLAY_HEIGHT,S1D_DISPLAY_BPP);
switch_display();
return 0;
}
//-----------------------------------------------------------------------------
//
// Parse user speficied options (`video=s1d13xxxfb:')
//
//-----------------------------------------------------------------------------
int __init
s1d13xxxfb_setup(char *options, int *ints)
{
if (options!=NULL)
printk("s1d13xxxfb_setup options: %s",options);
return 0;
} |
|