S5PV210(TQ210)學(xué)習(xí)筆記——LCD驅(qū)動編寫
- #include
- #include
- #include
- #include
- staticstructfb_info*lcd_info;
- unsignedlongpseudo_palette[16];
- unsignedlong*display_control;
- volatileunsignedlong*gpf0con;
- volatileunsignedlong*gpf1con;
- volatileunsignedlong*gpf2con;
- volatileunsignedlong*gpf3con;
- volatileunsignedlong*gpd0con;
- volatileunsignedlong*gpd0dat;
- volatileunsignedlong*vidcon0;
- volatileunsignedlong*vidcon1;
- volatileunsignedlong*vidtcon0;
- volatileunsignedlong*vidtcon1;
- volatileunsignedlong*vidtcon2;
- volatileunsignedlong*wincon0;
- volatileunsignedlong*vidosd0a;
- volatileunsignedlong*vidosd0b;
- volatileunsignedlong*vidosd0c;
- volatileunsignedlong*vidw00add0b0;
- volatileunsignedlong*vidw00add1b0;
- volatileunsignedlong*shodowcon;
- structclk*lcd_clk;
- staticinlineunsignedintchan_to_field(unsignedintchan,structfb_bitfield*bf)
- {
- chan&=0xffff;
- chan>>=16-bf->length;
- returnchan<
offset; - }
- staticintlcdfb_setcolreg(unsignedintregno,unsignedintred,
- unsignedintgreen,unsignedintblue,
- unsignedinttransp,structfb_info*info)
- {
- unsignedintval;
- if(regno>16)
- return1;
- /*用red,green,blue三原色構(gòu)造出val*/
- val=chan_to_field(red,&info->var.red);
- val|=chan_to_field(green,&info->var.green);
- val|=chan_to_field(blue,&info->var.blue);
- //((u32*)(info->pseudo_palette))[regno]=val;
- pseudo_palette[regno]=val;
- return0;
- }
- staticstructfb_opslcd_fbops={
- .owner=THIS_MODULE,
- .fb_setcolreg=lcdfb_setcolreg,
- .fb_fillrect=cfb_fillrect,
- .fb_copyarea=cfb_copyarea,
- .fb_imageblit=cfb_imageblit,
- };
- staticintlcd_init(void){
- intret;
- /*分配fb_info*/
- lcd_info=framebuffer_alloc(0,NULL);
- if(lcd_info==NULL){
- printk(KERN_ERR"allocframebufferfailed!");
- return-ENOMEM;
- }
- /*配置fb_info各成員*/
- /*fix*/
- strcpy(lcd_info->fix.id,"s5pv210_lcd");
- lcd_info->fix.smem_len=800*480*4;
- lcd_info->fix.type=FB_TYPE_PACKED_PIXELS;
- lcd_info->fix.visual=FB_VISUAL_TRUECOLOR;
- lcd_info->fix.line_length=800*4;
- /*var*/
- lcd_info->var.xres=800;
- lcd_info->var.yres=480;
- lcd_info->var.xres_virtual=800;
- lcd_info->var.yres_virtual=480;
- lcd_info->var.bits_per_pixel=32;
- lcd_info->var.red.offset=16;
- lcd_info->var.red.length=8;
- lcd_info->var.green.offset=8;
- lcd_info->var.green.length=8;
- lcd_info->var.blue.offset=0;
- lcd_info->var.blue.length=8;
- lcd_info->var.activate=FB_ACTIVATE_NOW;
-
關(guān)鍵詞:
S5PV210LCD驅(qū)動編
評論