您的位置 首页 IOT

S5PV210(TQ210)学习笔记——LCD驱动编写

网上S5PV210内核移植的文章不是很多,而描述2440和6410内核移植的文章多数是讲如何移植,而非手动编写,但是,韦东山老师的视频中讲述了如

网上S5PV210内核移植的文章不是许多,而描绘2440和6410内核移植的文章多数是讲怎么移植,而非手动编写,可是,韦东山教师的视频中叙述了怎么从头编写LCD驱动,当然是以2440为例的,我看过视频之后在TQ210渠道进步行了试验,试验成功,具体的原理部分以我现在的水平还难以表达清楚。下载是我自己写的代码,适用于TQ210的7寸电容屏。

  1. #include
  2. #include
  3. #include
  4. #include
  5. staticstructfb_info*lcd_info;
  6. unsignedlongpseudo_palette[16];
  7. unsignedlong*display_control;
  8. volatileunsignedlong*gpf0con;
  9. volatileunsignedlong*gpf1con;
  10. volatileunsignedlong*gpf2con;
  11. volatileunsignedlong*gpf3con;
  12. volatileunsignedlong*gpd0con;
  13. volatileunsignedlong*gpd0dat;
  14. volatileunsignedlong*vidcon0;
  15. volatileunsignedlong*vidcon1;
  16. volatileunsignedlong*vidtcon0;
  17. volatileunsignedlong*vidtcon1;
  18. volatileunsignedlong*vidtcon2;
  19. volatileunsignedlong*wincon0;
  20. volatileunsignedlong*vidosd0a;
  21. volatileunsignedlong*vidosd0b;
  22. volatileunsignedlong*vidosd0c;
  23. volatileunsignedlong*vidw00add0b0;
  24. volatileunsignedlong*vidw00add1b0;
  25. volatileunsignedlong*shodowcon;
  26. structclk*lcd_clk;
  27. staticinlineunsignedintchan_to_field(unsignedintchan,structfb_bitfield*bf)
  28. {
  29. chan&=0xffff;
  30. chan>>=16-bf->length;
  31. returnchan<offset;
  32. }
  33. staticintlcdfb_setcolreg(unsignedintregno,unsignedintred,
  34. unsignedintgreen,unsignedintblue,
  35. unsignedinttransp,structfb_info*info)
  36. {
  37. unsignedintval;
  38. if(regno>16)
  39. return1;
  40. /*用red,green,blue三原色构造出val*/
  41. val=chan_to_field(red,&info->var.red);
  42. val|=chan_to_field(green,&info->var.green);
  43. val|=chan_to_field(blue,&info->var.blue);
  44. //((u32*)(info->pseudo_palette))[regno]=val;
  45. pseudo_palette[regno]=val;
  46. return0;
  47. }
  48. staticstructfb_opslcd_fbops={
  49. .owner=THIS_MODULE,
  50. .fb_setcolreg=lcdfb_setcolreg,
  51. .fb_fillrect=cfb_fillrect,
  52. .fb_copyarea=cfb_copyarea,
  53. .fb_imageblit=cfb_imageblit,
  54. };
  55. staticintlcd_init(void){
  56. intret;
  57. /*分配fb_info*/
  58. lcd_info=framebuffer_alloc(0,NULL);
  59. if(lcd_info==NULL){
  60. printk(KERN_ERR”allocframebufferfailed!”);
  61. return-ENOMEM;
  62. }
  63. /*装备fb_info各成员*/
  64. /*fix*/
  65. strcpy(lcd_info->fix.id,”s5pv210_lcd”);
  66. lcd_info->fix.smem_len=800*480*4;
  67. lcd_info->fix.type=FB_TYPE_PACKED_PIXELS;
  68. lcd_info->fix.visual=FB_VISUAL_TRUECOLOR;
  69. lcd_info->fix.line_length=800*4;
  70. /*var*/
  71. lcd_info->var.xres=800;
  72. lcd_info->var.yres=480;
  73. lcd_info->var.xres_virtual=800;
  74. lcd_info->var.yres_virtual=480;
  75. lcd_info->var.bits_per_pixel=32;
  76. lcd_info->var.red.offset=16;
  77. lcd_info->var.red.length=8;
  78. lcd_info->var.green.offset=8;
  79. lcd_info->var.green.length=8;
  80. lcd_info->var.blue.offset=0;
  81. lcd_info->var.blue.length=8;
  82. lcd_info->var.activate=FB_ACTIVATE_NOW;

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/iot/256201.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部