网上S5PV210内核移植的文章不是许多,而描绘2440和6410内核移植的文章多数是讲怎么移植,而非手动编写,可是,韦东山教师的视频中叙述了怎么从头编写LCD驱动,当然是以2440为例的,我看过视频之后在TQ210渠道进步行了试验,试验成功,具体的原理部分以我现在的水平还难以表达清楚。下载是我自己写的代码,适用于TQ210的7寸电容屏。
- #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三原色构造出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;
-
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/iot/256201.html