新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > S5PV210(TQ210)學習筆記——LCD驅動編寫

        S5PV210(TQ210)學習筆記——LCD驅動編寫

        作者: 時間:2016-11-28 來源:網絡 收藏
        網上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;

        83. 上一頁 1 2 3 下一頁

        關鍵詞: S5PV210LCD驅動編

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 宁强县| 云霄县| 京山县| 阳曲县| 桓台县| 浙江省| 临江市| 邛崃市| 甘德县| 吉首市| 平安县| 军事| 建湖县| 公主岭市| 洞头县| 深泽县| 翁牛特旗| 长海县| 泾源县| 巴塘县| 长葛市| 扶沟县| 汉沽区| 申扎县| 平邑县| 绥化市| 独山县| 靖安县| 永寿县| 兴国县| 城固县| 镇赉县| 新乡市| 赫章县| 吴忠市| 曲沃县| 山阴县| 徐汇区| 来宾市| 定安县| 枝江市|