日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

第十九章、TIny4412 U-BOOT移植十九 LCD移植

發(fā)布時(shí)間:2023/12/31 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 第十九章、TIny4412 U-BOOT移植十九 LCD移植 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

這一篇主要參考博文,流程差不多,只是代碼內(nèi)容得自己寫

http://5istt.com/cookies/blog/?post=122

《s5pv-u-boot-2011.06之增加LCD顯示功能.PDF》的文檔

?

其實(shí)我一直就只想學(xué)一點(diǎn)東西,當(dāng)時(shí)心太大了,就直接買了Tiny4412,才發(fā)現(xiàn)這是一塊硬骨頭,網(wǎng)上資料少的可憐,FriendlyARM給的資料基本就是代碼,說明性、講原理的東西也沒有。看了好久才發(fā)現(xiàn)其給的U-BOOT是不帶LCD顯示功能的,我就想給這個(gè)U-BOOT增加LCD顯示功能,我所有的學(xué)習(xí)過程,都是為了增加LCD功能而開展的。這一篇雖然也有參考別人成份,但絕大多數(shù)內(nèi)容都是我最近這段時(shí)間分析U-BOOT后,也進(jìn)行相關(guān)裸機(jī)程序后(裸機(jī)代碼的實(shí)現(xiàn)我有一篇相關(guān)的說明文檔),有了一定的感覺,才順利完成的。

下面依據(jù)《s5pv-u -boot-2011.06之增加LCD顯示功能》的實(shí)現(xiàn)過程,來說明一下:我增加LCD功能的過程。

?

《s5pv-u-boot-2011.06之增加LCD顯示功能》上說,其主要完成 U-Boot 層可以在 LCD 上顯示字符,而且對(duì)于軟件分層的 U-Boot 來說,只要將底層驅(qū)動(dòng)移植過來并調(diào)整好初始化參數(shù)就可以在LCD上顯示console。下圖17-1是LCD 驅(qū)動(dòng)軟件分層執(zhí)行流程示意??梢钥吹?LCD 在執(zhí)行時(shí)最終調(diào)用的是底層的 board_video_init() 函數(shù),其主要作用是對(duì) LCD控制寄存器進(jìn)行初始化??捎捎脩舾鶕?jù)實(shí)際 LCD 硬件編寫。

這個(gè)功能的移植修改了5 個(gè)文件。

圖19-1、LCD 驅(qū)動(dòng)軟件分層執(zhí)行流程示意


廢話不多說,開始按步驟說明吧:

我用的U-Boot代碼就是光盤中FriendlyARM提供的uboot_tiny4412-20130729.tgz。我的所有編輯操作都是在windows環(huán)境下,應(yīng)用sourcein sight等工具進(jìn)行的,最后才到linux環(huán)境下面進(jìn)行編譯。

第一步:增加底層頭文件

復(fù)制LCD裸機(jī)程序下的字庫(kù)文件,font_8x16.h,font_10x18.h,font_sun12x22.h到\uboot_tiny4412-lcd\include\下,這三個(gè)字庫(kù)文件是從Linux源碼下提取出來的。具體說明可參看我裸機(jī)LCD程序說明文檔。

接著,在\uboot_tiny4412-lcd\include\目錄下添加一個(gè)驅(qū)動(dòng)程序所需的頭文件,文件名為zth_tiny4412_lcd.h,此文件是從我的LCD裸機(jī)程序里復(fù)制過來的。zth_tiny4412_lcd.h內(nèi)容如下,大家可以將其粘貼過去。

/****************************************

NAME:LCD.h

TRAD:

PROJECT:

CREATER:Zhang Taohua

DATA:2014-06-07

MAIL :zthvivid@163.com

DESCRIPTION:

?*****************************************/

?

#ifndef __LCD_H

#define __LCD_H

?

extern void lcd_init(void);

extern void lcd_draw_pixel(introw, int col, int color);

extern void lcd_clear_screen(intcolor);

extern void lcd_draw_hline(introw, int col1, int col2, int color);

extern void lcd_draw_vline(intcol, int row1, int row2, int color);

extern void lcd_draw_cross(introw, int col, int halflen, int color);

extern void led_blink(intlink_times);??

extern void delay(unsigned longcount);

extern void draw_point(int x, inty, int r, int g, int b);

//extern void memset_int(unsignedint * s, int c,unsigned int count);

extern void lcd_draw_bmp(constunsigned char gImage_bmp[]);

extern voidlcd_draw_char(unsigned char c);

?

#define readb(a)?????????????????? (*(volatile unsigned char*)(a))

#define readw(a)????????????????? (*(volatile unsigned short*)(a))

#define readl(a)??????????????????? (*(volatile unsigned int*)(a))

?

#define writeb(v,a)??????? (*(volatile unsigned char *)(a) = (v))

#define writew(v,a)????????????? (*(volatile unsigned short *)(a) =(v))

#define writel(v,a)???????? (*(volatile unsigned int *)(a) = (v))

?

//FONT

//#define FONT8_16? 1

//#define FONT10_18 1

#define FONT12_22? 1

?

#define FONT_STATIC_ROW 8

?

#if FONT8_16

#define FONT_ROW 8

#define FONT_COL 16

#endif

?

#if FONT10_18

#define FONT_ROW 10

#define FONT_COL? 18

#endif

?

#if FONT12_22?

#define FONT_ROW 12

#define FONT_COL? 22

#endif

?

//PICTURE

#define PICTURE_WIDTH

#define PICTURE_HEIGHT

?

//LCD Clock Relate Register

#define CLK_DIV_LCD (*(volatileunsigned int *)0x1003c534)

#define CLK_SRC_MASK_LCD(*(volatile unsigned int *)0x1003c334)

#define CLK_GATE_IP_LCD(*(volatile unsigned int *)0x1003c934)

#define CLK_SRC_LCD0 (*(volatileunsigned int *)0x1003c234)

?

//Framer Buffer Address And Size

?

//#define LCD_VIDEO_ADDR???? (0x54000000)????

//#define ?????? VIDEO_MEM_SIZE?0x200000??????? /* 800x480x24bit =0X119400 bytes */

?

//LED IO Control Regiester

#define GPM4CON ???? (*(volatile unsigned long *) 0x110002E0)

#define GPM4DAT??????? (*(volatile unsigned long *) 0x110002E4)

//LCD OP Control Regiester

#define GPF0CON??????? (*(volatile unsigned int *)0x11400180)

#define GPF0DAT???????? (*(volatile unsigned int *)0x11400184)

#define GPF0PUD??????? (*(volatile unsigned int *)0x11400188)

#define GPF0DRV??????? (*(volatile unsigned int *)0x1140018C)

?

#define GPF1CON ????? (*(volatile unsigned int *)0x114001a0)

#define GPF1DAT? ???? (*(volatileunsigned int *)0x114001a4)

#define GPF1PUD ?????? (*(volatile unsigned int *)0x114001a8)

#define GPF1DRV ?????? (*(volatile unsigned int *)0x114001ac)

?

#define GPF2CON??????? (*(volatile unsigned int *)0x114001c0)

#define GPF2DAT?? ??? (*(volatileunsigned int *)0x114001c4)

#define GPF2PUD ?????? (*(volatile unsigned int *)0x114001c8)

#define GPF2DRV ?????? (*(volatile unsigned int *)0x114001cc)

?

#define GPF3CON ????? (*(volatile unsigned int *)0x114001e0)

#define GPF3DAT? ???? (*(volatileunsigned int *)0x114001e4)

#define GPF3PUD ?????? (*(volatile unsigned int *)0x114001e8)

#define GPF3DRV ?????? (*(volatile unsigned int *)0x114001ec)

?

#define LCDBLK_CFG (*(volatileunsigned int *)0x10010210)

#define LCDBLK_CFG2 (*(volatileunsigned int *)0x10010214)

?

//LCD Control Register

#define LCD_BASE 0x11C00000

?

#define VIDCON0 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0000))

#define VIDCON1 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0004))

#define VIDCON2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0008))

#define VIDCON3 ?????? (*(volatile unsigned int *)(LCD_BASE +0x000C))

#define VIDTCON0 ???? (*(volatile unsigned int *)(LCD_BASE +0x0010))

#define VIDTCON1 ???? (*(volatile unsigned int *)(LCD_BASE +0x0014))

#define VIDTCON2 ???? (*(volatile unsigned int *)(LCD_BASE +0x0018))

#define VIDTCON3 ???? (*(volatile unsigned int *)(LCD_BASE +0x001C))

#define WINCON0 ????? (*(volatile unsigned int *)(LCD_BASE +0x0020))

#define WINCON1 ????? (*(volatile unsigned int *)(LCD_BASE +0x0024))

#define WINCON2 ????? (*(volatile unsigned int *)(LCD_BASE +0x0028))

#define WINCON3 ????? (*(volatile unsigned int *)(LCD_BASE + 0x002C))

#define WINCON4 ????? (*(volatile unsigned int *)(LCD_BASE +0x0030))

#define SHADOWCON ????? (*(volatile unsigned int *)(LCD_BASE +0x0034))

#define WINCHMAP2 (*(volatile unsigned int *)(LCD_BASE + 0x003C))

#define VIDOSD0A ???? (*(volatile unsigned int *)(LCD_BASE +0x0040))

#define VIDOSD0B ???? (*(volatile unsigned int *)(LCD_BASE +0x0044))

#define VIDOSD0C ???? (*(volatile unsigned int *)(LCD_BASE +0x0048))

#define VIDOSD1A ???? (*(volatile unsigned int *)(LCD_BASE +0x0050))

#define VIDOSD1B ???? (*(volatile unsigned int *)(LCD_BASE +0x0054))

#define VIDOSD1C ???? (*(volatile unsigned int *)(LCD_BASE +0x0058))

#define VIDOSD1D ??? (*(volatile unsigned int *)(LCD_BASE +0x005C))

#define VIDOSD2A ???? (*(volatile unsigned int *)(LCD_BASE +0x0060))

#define VIDOSD2B ???? (*(volatile unsigned int *)(LCD_BASE +0x0064))

#define VIDOSD2C ???? (*(volatile unsigned int *)(LCD_BASE +0x0068))

#define VIDOSD2D ??? (*(volatile unsigned int *)(LCD_BASE +0x006C))

#define VIDOSD3A ???? (*(volatile unsigned int *)(LCD_BASE +0x0070))

#define VIDOSD3B ???? (*(volatile unsigned int *)(LCD_BASE +0x0074))

#define VIDOSD3C ???? (*(volatile unsigned int *)(LCD_BASE +0x0078))

#define VIDOSD4A ???? (*(volatile unsigned int *)(LCD_BASE +0x0080))

#define VIDOSD4B ???? (*(volatile unsigned int *)(LCD_BASE +0x0084))

#define VIDOSD4C ???? (*(volatile unsigned int *)(LCD_BASE +0x0088))

#define VIDW00ADD0B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00A0))

#define VIDW00ADD0B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00A4))

#define VIDW00ADD0B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20A0))

#define VIDW01ADD0B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00A8))

#define VIDW01ADD0B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00AC))

#define VIDW01ADD0B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20A8))

#define VIDW02ADD0B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00B0))

#define VIDW02ADD0B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00B4))

#define VIDW02ADD0B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20B0))

#define VIDW03ADD0B0 ?? (*(volatile unsigned int *)(LCD_BASE + 0x00B8))

#define VIDW03ADD0B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00BC))

#define VIDW03ADD0B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20B8))

#define VIDW04ADD0B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00C0))

#define VIDW04ADD0B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00C4))

#define VIDW04ADD0B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20C0))

#define VIDW00ADD1B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00D0))

#define VIDW00ADD1B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00D4))

#define VIDW00ADD1B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20D0))

#define VIDW01ADD1B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00D8))

#define VIDW01ADD1B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00DC))

#define VIDW01ADD1B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20D8))

#define VIDW02ADD1B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00E0))

#define VIDW02ADD1B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00E4))

#define VIDW02ADD1B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20E0))

#define VIDW03ADD1B0 ?? (*(volatile unsigned int *)(LCD_BASE +0x00E8))

#define VIDW03ADD1B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00EC))

#define VIDW03ADD1B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20E8))

#define VIDW04ADD1B0 ?? (*(volatile unsigned int *)(LCD_BASE + 0x00F0))

#define VIDW04ADD1B1 ?? (*(volatile unsigned int *)(LCD_BASE +0x00F4))

#define VIDW04ADD1B2 ?? (*(volatile unsigned int *)(LCD_BASE +0x20F0))

#define VIDW00ADD2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0100))

#define VIDW01ADD2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0104))

#define VIDW02ADD2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0108))

#define VIDW03ADD2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x010C))

#define VIDW04ADD2 ?????? (*(volatile unsigned int *)(LCD_BASE +0x0110))

#define VIDINTCON0 (*(volatile unsigned int *)(LCD_BASE + 0x0130))

#define VIDINTCON1 (*(volatile unsigned int *)(LCD_BASE + 0x0134))

#define W1KEYCON0 (*(volatile unsigned int *)(LCD_BASE + 0x0140))

#define VIDW0ALPHA0 ??? (*(volatile unsigned int *)(LCD_BASE +0x021C))

#define VIDW0ALPHA1 ??? (*(volatile unsigned int *)(LCD_BASE +0x0220))

#define VIDW1ALPHA0 ??? (*(volatile unsigned int *)(LCD_BASE +0x0224))

#define VIDW1ALPHA1 ??? (*(volatile unsigned int *)(LCD_BASE +0x0228))

#define VIDW2ALPHA0 ??? (*(volatile unsigned int *)(LCD_BASE +0x022C))

#define VIDW2ALPHA1 ??? (*(volatile unsigned int *)(LCD_BASE +0x0230))

#define VIDW3ALPHA0 ??? (*(volatile unsigned int *)(LCD_BASE +0x0234))

#define VIDW3ALPHA1 ??? (*(volatile unsigned int *)(LCD_BASE +0x0238))

#define VIDW4ALPHA0 ??? (*(volatile unsigned int *)(LCD_BASE +0x023C))

#define VIDW4ALPHA1 ??? (*(volatile unsigned int *)(LCD_BASE +0x0240))

??

/*

??*<Exyons 4412 datasheet pg1874 pg1848(時(shí)序)> <S700-AT070TN92 pg13(時(shí)序)>

??*VIDTCON0:

??*?????? ?? [23:16]:?VBPD + 1 <------> tvpw (1 - 20)?13

??*?????? ?? [15:8]: VFPD + 1 <------> tvfp 22

??*?????? ?? [7:0]: VSPW??? +1 <------> tvb - tvpw = 23 - 13 = 10

??* */

#define VBPD??????????????????????????? (22)? //12?22

#define VFPD????????????????????? (21)

#define VSPW??????????????????????????? (0)? //9???0

?

?/*<Exyons 4412 datasheet pg1874 pg1848(時(shí)序)> <S700-AT070TN92 pg13(時(shí)序)>

*VIDTCON1:

*??????????? [23:16]:? HBPD + 1 <------> thpw (1 - 40)? 36

*??????????? [15:8]:?? HFPD + 1 <------> thfp 210

*??????????? [7:0]:????? ?HSPW + 1 <------> thb - thpw= 46 - 36 = 10

* */

#define HBPD???????????????????? (45)? //35 45

#define HFPD?????????????? (209)

#define HSPW???????????????????? (0)? //9? 0

?

#define ROW?????????????????????? (480)

#define COL??????????????????????? (800)

#define HOZVAL???????????????? (COL-1)

#define LINEVAL??????????????? (ROW-1)// 479

?

/*

?*?Register offsets

*/

#define EXYNOS_WINCON(x)??????????????????????? (x * 0x04)

#define EXYNOS_VIDOSD(x)???????????????????????? (x * 0x10)

#define EXYNOS_BUFFER_OFFSET(x)?????????? (x * 0x08)

#define EXYNOS_BUFFER_SIZE(x)?????????????????????? (x * 0x04)

?

/*

?* Bit Definitions

*/

?

/* VIDCON0 */

#defineEXYNOS_VIDCON0_DSI_DISABLE???????????????? (0<< 30)

#define EXYNOS_VIDCON0_DSI_ENABLE????????????????? (1 << 30)

#defineEXYNOS_VIDCON0_SCAN_PROGRESSIVE?????????????????? (0<< 29)

#define EXYNOS_VIDCON0_SCAN_INTERLACE??????????????? (1 << 29)

#define EXYNOS_VIDCON0_SCAN_MASK?????????????????? (1 << 29)

#define EXYNOS_VIDCON0_VIDOUT_RGB????????????????? (0 << 26)

#define EXYNOS_VIDCON0_VIDOUT_ITU?????????????????? (1 << 26)

#defineEXYNOS_VIDCON0_VIDOUT_I80LDI0?????????????????? (2<< 26)

#defineEXYNOS_VIDCON0_VIDOUT_I80LDI1?????????????????? (3<< 26)

#defineEXYNOS_VIDCON0_VIDOUT_WB_RGB???????????????? (4<< 26)

#defineEXYNOS_VIDCON0_VIDOUT_WB_I80LDI0??????????? (6<< 26)

#defineEXYNOS_VIDCON0_VIDOUT_WB_I80LDI1??????????? (7<< 26)

#defineEXYNOS_VIDCON0_VIDOUT_MASK?????????????? (7<< 26)

#defineEXYNOS_VIDCON0_PNRMODE_RGB_P???????????????? (0<< 17)

#defineEXYNOS_VIDCON0_PNRMODE_BGR_P???????????????? (1<< 17)

#defineEXYNOS_VIDCON0_PNRMODE_RGB_S???????????????? (2<< 17)

#defineEXYNOS_VIDCON0_PNRMODE_BGR_S???????????????? (3<< 17)

#defineEXYNOS_VIDCON0_PNRMODE_MASK????????????????? (3<< 17)

#defineEXYNOS_VIDCON0_PNRMODE_SHIFT????????????????? (17)

#define EXYNOS_VIDCON0_CLKVALUP_ALWAYS??????????????????? (0 << 16)

#defineEXYNOS_VIDCON0_CLKVALUP_START_FRAME????????? (1<< 16)

#defineEXYNOS_VIDCON0_CLKVALUP_MASK???????????????? (1<< 16)

#defineEXYNOS_VIDCON0_CLKVAL_F(x)????????????????? (((x)& 0xff) << 6)

#defineEXYNOS_VIDCON0_VCLKEN_NORMAL??????????????? (0<< 5)

#define EXYNOS_VIDCON0_VCLKEN_FREERUN?????????????? (1 << 5)

#defineEXYNOS_VIDCON0_VCLKEN_MASK???????????????????? (1<< 5)

#defineEXYNOS_VIDCON0_CLKDIR_DIRECTED?????????????? (0<< 4)

#defineEXYNOS_VIDCON0_CLKDIR_DIVIDED???????????????? (1<< 4)

#defineEXYNOS_VIDCON0_CLKDIR_MASK?????????????? (1<< 4)

#define EXYNOS_VIDCON0_CLKSEL_HCLK??????????????? (0 << 2)

#defineEXYNOS_VIDCON0_CLKSEL_SCLK??????????????? (1<< 2)

#defineEXYNOS_VIDCON0_CLKSEL_MASK?????????????? (1<< 2)

#defineEXYNOS_VIDCON0_ENVID_ENABLE??????????????????? (1<< 1)

#defineEXYNOS_VIDCON0_ENVID_DISABLE?????????????????? (0<< 1)

#defineEXYNOS_VIDCON0_ENVID_F_ENABLE???????? (1<< 0)

#defineEXYNOS_VIDCON0_ENVID_F_DISABLE??????? (0<< 0)

?

/* VIDCON1 */

#defineEXYNOS_VIDCON1_VCLK_HOLD?????????????????????? (0 << 9)

#defineEXYNOS_VIDCON1_VCLK_RUNNING??????????????????? ???? (1 << 9)

#defineEXYNOS_VIDCON1_VCLK_RUNNING_DIS_VDEN (3<< 9)

#define EXYNOS_VIDCON1_IVCLK_FALLING_EDGE? (0 << 7)

#defineEXYNOS_VIDCON1_IVCLK_RISING_EDGE?????????? (1<< 7)

#defineEXYNOS_VIDCON1_IHSYNC_NORMAL????????? (0<< 6)

#defineEXYNOS_VIDCON1_IHSYNC_INVERT?????????????????? (1<< 6)

#defineEXYNOS_VIDCON1_IVSYNC_NORMAL????????? (0<< 5)

#defineEXYNOS_VIDCON1_IVSYNC_INVERT?????????????????? (1<< 5)

#defineEXYNOS_VIDCON1_IVDEN_NORMAL?????????????????? (0<< 4)

#defineEXYNOS_VIDCON1_IVDEN_INVERT???????????????????? (1<< 4)

?

/* VIDCON2 */

#defineEXYNOS_VIDCON2_EN601_DISABLE??????????????????? (0<< 23)

#defineEXYNOS_VIDCON2_EN601_ENABLE???????????????????? (1<< 23)

#define EXYNOS_VIDCON2_EN601_MASK????????????????? (1 << 23)

#define EXYNOS_VIDCON2_WB_DISABLE????????????????? (0 << 15)

#define EXYNOS_VIDCON2_WB_ENABLE?????????????????? (1 << 15)

#define EXYNOS_VIDCON2_WB_MASK????????????????????? (1 << 15)

#defineEXYNOS_VIDCON2_TVFORMATSEL_HW?????????????? (0<< 14)

#defineEXYNOS_VIDCON2_TVFORMATSEL_SW?????????????? (1<< 14)

#define EXYNOS_VIDCON2_TVFORMATSEL_MASK???????????????? (1 << 14)

#defineEXYNOS_VIDCON2_TVFORMATSEL_YUV422??????? (1<< 12)

#defineEXYNOS_VIDCON2_TVFORMATSEL_YUV444??????? (2<< 12)

#defineEXYNOS_VIDCON2_TVFORMATSEL_YUV_MASK??????? (3<< 12)

#defineEXYNOS_VIDCON2_ORGYUV_YCBCR?????????????????? (0<< 8)

#define EXYNOS_VIDCON2_ORGYUV_CBCRY?????????????????? (1 << 8)

#defineEXYNOS_VIDCON2_ORGYUV_MASK??????????????????? (1<< 8)

#defineEXYNOS_VIDCON2_YUVORD_CBCR???????????????????? (0<< 7)

#defineEXYNOS_VIDCON2_YUVORD_CRCB???????????????????? (1<< 7)

#defineEXYNOS_VIDCON2_YUVORD_MASK??????????????????? (1<< 7)

?

/* PRTCON */

#define EXYNOS_PRTCON_UPDATABLE????????????????????? (0 << 11)

#define EXYNOS_PRTCON_PROTECT????????????????????????? (1 << 11)

?

/* VIDTCON0 */

#define EXYNOS_VIDTCON0_VBPDE(x)?????????????? (((x) & 0xff) << 24)

#define EXYNOS_VIDTCON0_VBPD(x)??????????????????????? (((x) & 0xff)<< 16)

#define EXYNOS_VIDTCON0_VFPD(x)??????????????????????? (((x) & 0xff)<< 8)

#define EXYNOS_VIDTCON0_VSPW(x)??????????????????????? (((x) & 0xff)<< 0)

?

/* VIDTCON1 */

#define EXYNOS_VIDTCON1_VFPDE(x)?????????????? (((x) & 0xff) << 24)

#define EXYNOS_VIDTCON1_HBPD(x)??????????????????????? (((x) & 0xff)<< 16)

#define EXYNOS_VIDTCON1_HFPD(x)??????????????????????? (((x) & 0xff)<< 8)

#define EXYNOS_VIDTCON1_HSPW(x)??????????????????????? (((x) & 0xff)<< 0)

?

/* VIDTCON2 */

#defineEXYNOS_VIDTCON2_LINEVAL(x)?????????????????? (((x)& 0x7ff) << 11)

#define EXYNOS_VIDTCON2_HOZVAL(x)?????????????????????????? (((x) & 0x7ff)<< 0)

#defineEXYNOS_VIDTCON2_LINEVAL_E(x)?????????????? ((((x)& 0x800) >> 11) << 23)

#define EXYNOS_VIDTCON2_HOZVAL_E(x)??????????????? ((((x) & 0x800) >> 11)<< 22)

?

/* Window 0~4 Control - WINCONx*/

#defineEXYNOS_WINCON_DATAPATH_DMA???????????????????? (0<< 22)

#defineEXYNOS_WINCON_DATAPATH_LOCAL????????????????? (1<< 22)

#defineEXYNOS_WINCON_DATAPATH_MASK?????????????????? (1<< 22)

#define EXYNOS_WINCON_BUFSEL_0??????????????????????? (0 << 20)

#define EXYNOS_WINCON_BUFSEL_1??????????????????????? (1 << 20)

#define EXYNOS_WINCON_BUFSEL_MASK??????????????? (1 << 20)

#defineEXYNOS_WINCON_BUFSEL_SHIFT??????????????? (20)

#defineEXYNOS_WINCON_BUFAUTO_DISABLE?????????????? (0<< 19)

#defineEXYNOS_WINCON_BUFAUTO_ENABLE??????????????? (1<< 19)

#define EXYNOS_WINCON_BUFAUTO_MASK??????????????????? (1 << 19)

#defineEXYNOS_WINCON_BITSWP_DISABLE????????????????? (0<< 18)

#defineEXYNOS_WINCON_BITSWP_ENABLE?????????????????? (1<< 18)

#defineEXYNOS_WINCON_BITSWP_SHIFT??????????????? (18)

#defineEXYNOS_WINCON_BYTESWP_DISABLE?????????????? (0<< 17)

#defineEXYNOS_WINCON_BYTESWP_ENABLE???????? ?????? (1 << 17)

#defineEXYNOS_WINCON_BYTESWP_SHIFT??????????????????? (17)

#defineEXYNOS_WINCON_HAWSWP_DISABLE??????????????? (0<< 16)

#defineEXYNOS_WINCON_HAWSWP_ENABLE???????????????? (1<< 16)

#defineEXYNOS_WINCON_HAWSWP_SHIFT???????????????????? (16)

#defineEXYNOS_WINCON_WSWP_DISABLE???????????????????? (0<< 15)

#define EXYNOS_WINCON_WSWP_ENABLE?????????????? (1 << 15)

#define EXYNOS_WINCON_WSWP_SHIFT?????????????????? (15)

#define EXYNOS_WINCON_INRGB_RGB??????????????????????????? (0 << 13)

#define EXYNOS_WINCON_INRGB_YUV??????????????????????????? (1 << 13)

#define EXYNOS_WINCON_INRGB_MASK????????????????? (1 << 13)

#defineEXYNOS_WINCON_BURSTLEN_16WORD???????????????????? (0<< 9)

#defineEXYNOS_WINCON_BURSTLEN_8WORD??????????????? (1<< 9)

#defineEXYNOS_WINCON_BURSTLEN_4WORD??????????????? (2<< 9)

#defineEXYNOS_WINCON_BURSTLEN_MASK????????????????? (3<< 9)

#defineEXYNOS_WINCON_ALPHA_MULTI_DISABLE????????????? (0<< 7)

#defineEXYNOS_WINCON_ALPHA_MULTI_ENABLE??????? (1<< 7)

#define EXYNOS_WINCON_BLD_PLANE??????????????????????????? (0 << 6)

#define EXYNOS_WINCON_BLD_PIXEL????????????????????? (1 << 6)

#define EXYNOS_WINCON_BLD_MASK????????????????????? (1 << 6)

#defineEXYNOS_WINCON_BPPMODE_1BPP???????????????????? (0<< 2)

#defineEXYNOS_WINCON_BPPMODE_2BPP???????????????????? (1<< 2)

#defineEXYNOS_WINCON_BPPMODE_4BPP???????????????????? (2<< 2)

#defineEXYNOS_WINCON_BPPMODE_8BPP_PAL??????????????????? (3<< 2)

#defineEXYNOS_WINCON_BPPMODE_8BPP???????????????????? (4<< 2)

#defineEXYNOS_WINCON_BPPMODE_16BPP_565??????????????????? (5<< 2)

#defineEXYNOS_WINCON_BPPMODE_16BPP_A555????????? (6<< 2)

#defineEXYNOS_WINCON_BPPMODE_18BPP_666??????????????????? (8<< 2)

#defineEXYNOS_WINCON_BPPMODE_18BPP_A665????????? (9<< 2)

#defineEXYNOS_WINCON_BPPMODE_24BPP_888??????????????????? (0xb<< 2)

#defineEXYNOS_WINCON_BPPMODE_24BPP_A887????????? (0xc<< 2)

#defineEXYNOS_WINCON_BPPMODE_32BPP??????????????????? (0xd<< 2)

#defineEXYNOS_WINCON_BPPMODE_16BPP_A444????????? (0xe<< 2)

#defineEXYNOS_WINCON_BPPMODE_15BPP_555??????????????????? (0xf<< 2)

#defineEXYNOS_WINCON_BPPMODE_MASK?????????????????? (0xf<< 2)

#defineEXYNOS_WINCON_BPPMODE_SHIFT??????????????????? (2)

#define EXYNOS_WINCON_ALPHA0_SEL?????????????????? (0 << 1)

#define EXYNOS_WINCON_ALPHA1_SEL?????????????????? (1 << 1)

#define EXYNOS_WINCON_ALPHA_SEL_MASK??????????????? (1 << 1)

#defineEXYNOS_WINCON_ENWIN_DISABLE?????????????????? (0<< 0)

#defineEXYNOS_WINCON_ENWIN_ENABLE??????????????????? (1<< 0)

?

/* WINCON1 special */

#define EXYNOS_WINCON1_VP_DISABLE????????????????? (0 << 24)

#define EXYNOS_WINCON1_VP_ENABLE?????????????????? (1 << 24)

#define EXYNOS_WINCON1_LOCALSEL_FIMC1??????????????? (0 << 23)

#defineEXYNOS_WINCON1_LOCALSEL_VP?????????????? (1<< 23)

#defineEXYNOS_WINCON1_LOCALSEL_MASK???????????????? (1<< 23)

?

/* WINSHMAP */

#defineEXYNOS_WINSHMAP_PROTECT(x)??????????????? (((x)& 0x1f) << 10)

#defineEXYNOS_WINSHMAP_CH_ENABLE(x)????????????????? ?????? (1 << (x))

#define EXYNOS_WINSHMAP_CH_DISABLE(x)???????????????? (~(7 << (x)))

#defineEXYNOS_WINSHMAP_LOCAL_ENABLE(x)?????????????????? (0x20<< (x))

#defineEXYNOS_WINSHMAP_LOCAL_DISABLE(x)?????????? (0x20<< (x))

?

/* VIDOSDxA, VIDOSDxB */

#define EXYNOS_VIDOSD_LEFT_X(x)???????????????????????? (((x) & 0x7ff)<< 11)

#define EXYNOS_VIDOSD_TOP_Y(x)?????????????????????????? (((x) & 0x7ff)<< 0)

#define EXYNOS_VIDOSD_RIGHT_X(x)??????????????? (((x) & 0x7ff) << 11)

#define EXYNOS_VIDOSD_BOTTOM_Y(x)?????????????????? (((x) & 0x7ff) <<0)

#defineEXYNOS_VIDOSD_RIGHT_X_E(x)?????????????????? (((x)& 0x1) << 23)

#defineEXYNOS_VIDOSD_BOTTOM_Y_E(x)?????????????? (((x)& 0x1) << 22)

?

/* VIDOSD0C, VIDOSDxD */

#define EXYNOS_VIDOSD_SIZE(x)?????????????????????? (((x) & 0xffffff)<< 0)

?

/* VIDOSDxC (1~4) */

#define EXYNOS_VIDOSD_ALPHA0_R(x)??????????????????? (((x) & 0xf) <<20)

#define EXYNOS_VIDOSD_ALPHA0_G(x)??????????????????? (((x) & 0xf) <<16)

#define EXYNOS_VIDOSD_ALPHA0_B(x)??????????????????? (((x) & 0xf) <<12)

#define EXYNOS_VIDOSD_ALPHA1_R(x)??????????????????? (((x) & 0xf) << 8)

#define EXYNOS_VIDOSD_ALPHA1_G(x)??????????????????? (((x) & 0xf) << 4)

#define EXYNOS_VIDOSD_ALPHA1_B(x)??????????????????? (((x) & 0xf) << 0)

#defineEXYNOS_VIDOSD_ALPHA0_SHIFT???????????????? (12)

#define EXYNOS_VIDOSD_ALPHA1_SHIFT???????????????? (0)

?

/* Start Address */

#defineEXYNOS_VIDADDR_START_VBANK(x)???????????????? (((x)& 0xff) << 24)

#defineEXYNOS_VIDADDR_START_VBASEU(x)??????????????? (((x)& 0xffffff) << 0)

?

/* End Address */

#defineEXYNOS_VIDADDR_END_VBASEL(x)?????????????????? (((x)& 0xffffff) << 0)

?

/* Buffer Size */

#define EXYNOS_VIDADDR_OFFSIZE(x)???????????????????? (((x) & 0x1fff)<< 13)

#defineEXYNOS_VIDADDR_PAGEWIDTH(x)???????????????????? (((x)& 0x1fff) << 0)

#defineEXYNOS_VIDADDR_OFFSIZE_E(x)???????????????? ((((x)& 0x2000) >> 13) << 27)

#defineEXYNOS_VIDADDR_PAGEWIDTH_E(x)???????????????? ((((x)& 0x2000) >> 13) << 26)

?

/* WIN Color Map */

#define EXYNOS_WINMAP_COLOR(x)???????????????????????? ((x) & 0xffffff)

?

/* VIDINTCON0 */

#defineEXYNOS_VIDINTCON0_SYSMAINCON_DISABLE??????? (0<< 19)

#defineEXYNOS_VIDINTCON0_SYSMAINCON_ENABLE???????? (1<< 19)

#defineEXYNOS_VIDINTCON0_SYSSUBCON_DISABLE?????????? (0<< 18)

#defineEXYNOS_VIDINTCON0_SYSSUBCON_ENABLE??????????? (1<< 18)

#defineEXYNOS_VIDINTCON0_SYSIFDONE_DISABLE??????????? (0<< 17)

#defineEXYNOS_VIDINTCON0_SYSIFDONE_ENABLE???????????? (1<< 17)

#defineEXYNOS_VIDINTCON0_FRAMESEL0_BACK????????? (0<< 15)

#define EXYNOS_VIDINTCON0_FRAMESEL0_VSYNC????????????? (1 << 15)

#defineEXYNOS_VIDINTCON0_FRAMESEL0_ACTIVE???????????? (2<< 15)

#defineEXYNOS_VIDINTCON0_FRAMESEL0_FRONT??????? (3<< 15)

#defineEXYNOS_VIDINTCON0_FRAMESEL0_MASK???????? (3<< 15)

#defineEXYNOS_VIDINTCON0_FRAMESEL1_NONE???????? (0<< 13)

#define EXYNOS_VIDINTCON0_FRAMESEL1_BACK????????? (1 << 13)

#defineEXYNOS_VIDINTCON0_FRAMESEL1_VSYNC????????????? (2<< 13)

#defineEXYNOS_VIDINTCON0_FRAMESEL1_FRONT??????? (3<< 13)

#defineEXYNOS_VIDINTCON0_INTFRMEN_DISABLE????????????? (0<< 12)

#defineEXYNOS_VIDINTCON0_INTFRMEN_ENABLE??????? (1<< 12)

#defineEXYNOS_VIDINTCON0_FIFOSEL_WIN4??????????????? (1<< 11)

#defineEXYNOS_VIDINTCON0_FIFOSEL_WIN3??????????????? (1<< 10)

#defineEXYNOS_VIDINTCON0_FIFOSEL_WIN2??????????????? (1<< 9)

#defineEXYNOS_VIDINTCON0_FIFOSEL_WIN1??????????????? (1<< 6)

#defineEXYNOS_VIDINTCON0_FIFOSEL_WIN0??????????????? (1<< 5)

#define EXYNOS_VIDINTCON0_FIFOSEL_ALL?????????????????? (0x73 << 5)

#defineEXYNOS_VIDINTCON0_FIFOSEL_MASK?????????????? (0x73<< 5)

#defineEXYNOS_VIDINTCON0_FIFOLEVEL_25???????????????? (0<< 2)

#defineEXYNOS_VIDINTCON0_FIFOLEVEL_50???????????????? (1<< 2)

#defineEXYNOS_VIDINTCON0_FIFOLEVEL_75???????????????? (2<< 2)

#define EXYNOS_VIDINTCON0_FIFOLEVEL_EMPTY???????? (3 << 2)

#defineEXYNOS_VIDINTCON0_FIFOLEVEL_FULL??????????? (4<< 2)

#defineEXYNOS_VIDINTCON0_FIFOLEVEL_MASK????????? (7<< 2)

#defineEXYNOS_VIDINTCON0_INTFIFO_DISABLE?????????? (0<< 1)

#defineEXYNOS_VIDINTCON0_INTFIFO_ENABLE??????????? (1<< 1)

#define EXYNOS_VIDINTCON0_INT_DISABLE?????????????????? (0 << 0)

#defineEXYNOS_VIDINTCON0_INT_ENABLE??????????????????? (1<< 0)

#defineEXYNOS_VIDINTCON0_INT_MASK??????????????? (1<< 0)

?

/* VIDINTCON1 */

#defineEXYNOS_VIDINTCON1_INTVPPEND???????????????????? (1<< 5)

#defineEXYNOS_VIDINTCON1_INTI80PEND???????????????????? (1<< 2)

#define EXYNOS_VIDINTCON1_INTFRMPEND?????????????????? (1 << 1)

#defineEXYNOS_VIDINTCON1_INTFIFOPEND????????????????? (1<< 0)

?

/* WINMAP */

#define EXYNOS_WINMAP_ENABLE?????????????????????????? (1 << 24)

?

/* WxKEYCON0 (1~4) */

#defineEXYNOS_KEYCON0_KEYBLEN_DISABLE??????????????????? (0<< 26)

#defineEXYNOS_KEYCON0_KEYBLEN_ENABLE???????????????????? (1<< 26)

#defineEXYNOS_KEYCON0_KEY_DISABLE?????????????? (0<< 25)

#define EXYNOS_KEYCON0_KEY_ENABLE??????????????? (1 << 25)

#defineEXYNOS_KEYCON0_DIRCON_MATCH_FG??????????????????? (0<< 24)

#defineEXYNOS_KEYCON0_DIRCON_MATCH_BG?????????????????? (1<< 24)

#define EXYNOS_KEYCON0_COMPKEY(x)???????????????? (((x) & 0xffffff) <<0)

?

/* WxKEYCON1 (1~4) */

#define EXYNOS_KEYCON1_COLVAL(x)???????????????????? (((x) & 0xffffff)<< 0)

?

/* DUALRGB */

#defineEXYNOS_DUALRGB_BYPASS_SINGLE????????????????? (0x00<< 0)

#defineEXYNOS_DUALRGB_BYPASS_DUAL???????????????????? (0x01<< 0)

#define EXYNOS_DUALRGB_MIE_DUAL??????????????????????????? (0x10 << 0)

#define EXYNOS_DUALRGB_MIE_SINGLE????????????????? (0x11 << 0)

#define EXYNOS_DUALRGB_LINESPLIT???????????????????? (0x0 << 2)

#define EXYNOS_DUALRGB_FRAMESPLIT???????????????? (0x1 << 2)

#define EXYNOS_DUALRGB_SUB_CNT(x)?????????????????? ((x & 0xfff) << 4)

#defineEXYNOS_DUALRGB_VDEN_EN_DISABLE??????????????????? (0x0<< 16)

#define EXYNOS_DUALRGB_VDEN_EN_ENABLE???????????????????? (0x1 << 16)

#defineEXYNOS_DUALRGB_MAIN_CNT(x)??????????????? ((x& 0xfff) << 18)

?

/* I80IFCONA0 and I80IFCONA1 */

#define EXYNOS_LCD_CS_SETUP(x)?????????????????????????? (((x) & 0xf)<< 16)

#define EXYNOS_LCD_WR_SETUP(x)????????????????????????? (((x) & 0xf)<< 12)

#define EXYNOS_LCD_WR_ACT(x)?????????????????????? (((x) & 0xf) <<8)

#define EXYNOS_LCD_WR_HOLD(x)?????????????????????????? (((x) & 0xf)<< 4)

#define EXYNOS_RSPOL_LOW????????????????????? (0 << 2)

#define EXYNOS_RSPOL_HIGH??????????????????????????? (1 << 2)

#define EXYNOS_I80IFEN_DISABLE?????????????????????????? (0 << 0)

#define EXYNOS_I80IFEN_ENABLE??????????????????????????? (1 << 0)

?

/* TRIGCON */

#define EXYNOS_I80SOFT_TRIG_EN?????????????????????????? (1 << 0)

#define EXYNOS_I80START_TRIG???????????????????????? (1 << 1)

#defineEXYNOS_I80STATUS_TRIG_DONE????????????????? (1<< 2)

?

/* DP_MIE_CLKCON */

#define EXYNOS_DP_MIE_DISABLE?????????????????????????? (0 << 0)

#define EXYNOS_DP_CLK_ENABLE??????????????????????????? (1 << 1)

#define EXYNOS_MIE_CLK_ENABLE????????????????????????? (3 << 0)

?

#endif

第二步:增加底層驅(qū)動(dòng)文件

在\uboot_tiny4412-lcd \drivers\video\目錄下添加一個(gè)底層驅(qū)動(dòng)程序文件,文件名為zth_tiny4412_lcd.c,此文件是從我的LCD裸機(jī)程序里復(fù)制過來后,進(jìn)行點(diǎn)點(diǎn)修改的。zth_tiny4412_lcd.c內(nèi)容如下,大家可以將其粘貼過去。

?????? /****************************************

NAME:LCD.C

TRAD:/USER/

PROJECT:

CREATER:Zhang Taohua

DATA:2014-05-07

DESCRIPTION:

?

?LCD relation function

?

?*****************************************/

?

//#include "stdio.h"

#include "videomodes.h"

#include <config.h>

#include <common.h>

#include <video_fb.h>

#include <lcd.h>

#include<zth_tiny4412_lcd.h>

?

#if FONT8_16

#include <font_8x16.h>

#endif

?

#if FONT10_18

#include <font_10x18.h>

#endif

?

?

#if FONT12_22?

#include <font_sun12x22.h>

#endif

?

?

#ifdefined(CONFIG_LCD_EXYNOS4412)//add by zth

?

void delay(unsigned long count)

{

?????? volatileunsigned long j,i = count;

?????? for(;i>0;i--)

????????????? {

???????????????????? for(j=0x20000;j>0;j--){}

????????????? }

}

?

/*void memset_int(unsigned int *s, int c,unsigned int count)

{

?????? unsignedint *xs = (unsigned int *) s;

?

?????? while(count--)

????????????? *xs++= c;

?

?????? //returns;

}

*/

?

?

/****************************************

FUNCTION :led_blink()

PARAMETERS:??? link_times : blink times

REMARKS:

EXAMPLE

?

SEE ALSO:

DATA:

?*****************************************/

?

void led_blink(int link_times)?????????????

{

?????? GPM4CON= 0x00001111;????????????????? //IO SET

?????? inti;

?????? for(i=0;i<= link_times;i++)

?????? {

????????????? GPM4DAT= 0;?????????????????????????? // LED on

????????????? delay(0x2);

????????????? GPM4DAT= 0xf;??????????????????????? // LED off

????????????? delay(0x2);

?????? }

?

}

?

/****************************************

FUNCTION :led_blink()

PARAMETERS:??? link_times : blink times

REMARKS:

EXAMPLE

?

SEE ALSO:

DATA:

?*****************************************/

?

DECLARE_GLOBAL_DATA_PTR;

GraphicDevice smi;

?

//extern voidboard_video_init(GraphicDevice *pGD);

?

?

void *video_hw_init (void)

{

?

??????

??? GraphicDevice *pGD = (GraphicDevice*)&smi;

??? int videomode;

??? unsigned long t1, hsynch, vsynch;

??? char *penv;

??? int tmp, i, bits_per_pixel;

??? struct ctfb_res_modes *res_mode;

??? struct ctfb_res_modes var_mode;

??? int clkval;

?????? unsignedlong long src_clock;

?????? unsignedint cfg = 0, div = 0, remainder, remainder_div;

??????

?

?????? //indicateLCD start Init

??????

?????? printf("addby zth now? now is in zthtiny_fb.c ;video_hw_init() \n ");

?????? printf("modifyby zth, Strat to Init the lCD\r\n");

?

??? /*

???? *SET IO IS LCD

???? *<Exyons 4412 datasheet pg138 pg141pg144 pg147>

???? *

???? * GPF0CON : [31:0] : 0x2

???? * GPF1CON : [31:0] : 0x2

???? * GPF2CON : [31:0] : 0x2

???? * GPF3CON : [31:0] : 0x2

???? * */??????

?

?????? GPF0CON= 0x22222222;????????????????????????

?????? GPF1CON= 0x22222222;

?????? GPF2CON= 0x22222222;

?????? GPF3CON= 0x00222222;

?????? //Set pull-up,down disable

?????? GPF0PUD= 0x0000FFFF;

?????? GPF1PUD= 0x0000FFFF;

?????? GPF2PUD= 0x0000FFFF;

?????? GPF3PUD= 0x00000FFF;

??????

?????? //MAXdrive strength---------//

?????? GPF0DRV= 0x0000FFFF;

?????? GPF1DRV= 0x0000FFFF;

?????? GPF2DRV= 0x0000FFFF;

?????? GPF3DRV= 0x00000FFF;

??? /*

???? *<Exyons 4412 datasheet pg526>

???? *CLK_DIV_LCD:

???? *????????????? [3:0]:FIMD0_RATIO?? 0

???? *????????????? SCLK_FIMD0 =MOUTFIMD0/(FIMD0_RATIO + 1)

???? *???????????????????????? = MOUTFIMD0/1 = 800MHz

???? *????????????? MOUTFIMD0 == SCLKmpll_user_t ==800MHz????? <Exyons 4412 datasheetpg453> LCD0_BLK

???? * */

?????? CLK_DIV_LCD&= ~0xf;

??? /*

???? *<Exyons 4412 datasheet pg501>

???? *CLK_SRC_LCD0:

???? *?????????[3:0]:FIMD0_SEL 0110 ===> SCLKmpll_user_t 選擇時(shí)鐘源為SCLKmpll_user_t

???? *

???? * */

?????? CLK_SRC_LCD0&= ~0xf;

?????? CLK_SRC_LCD0|= 6;

?????? //LCD0_SYS_PWR_REG== 7 Don't use

???

???

??? /*<Exyons 4412 datasheet pg1799>

???? *Using the display controller data, youcan select one of the above data paths by setting LCDBLK_CFG Register

???? *(0x1001_0210). For more information,refer to the "System Others" manual.

???? *

???? *

???? * <Exyons 4412 datasheet pg880>

???? * LCDBLK_CFG:

???? *?????????[1] : FIMD of LBLK0 Bypass Selection???1 : FIMD Bypass 使用FIMD接口

???? *

???? * LCDBLK_CFG :

???? *?????????[0]:MIE0_DISPON???? 1 :? PWM outpupt enable

???? *

???? *

???? * */

?????? LCDBLK_CFG|= 1 << 1;

??? LCDBLK_CFG2 |= 1;

?

?????? printf("Video:");

??? tmp = 0;

??? videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;

??? /* get video mode via environment */

??? if ((penv = getenv ("videomode"))!= NULL) {

??????? /* deceide if it is a string */

??????? if (penv[0] <= '9') {

??????????? videomode = (int) simple_strtoul(penv, NULL, 16);

??????????? tmp = 1;

??????? }

??? } else {

??????? tmp = 1;

??? }

?if (tmp){

??? /* parameter are vesa modes */

??? /* search params */

????? ??for (i = 0; i < VESA_MODES_COUNT; i++) {

??????????? if (vesa_modes[i].vesanr ==videomode)

??????????? break;

??????? }

??????? if (i == VESA_MODES_COUNT) {

???????????????????????? printf ("no VESAMode found, switching to mode 0x%x ", CONFIG_SYS_DEFAULT_VIDEO_MODE);

??????????? i = 0;

??????? }

??????? res_mode =(struct ctfb_res_modes *)&res_mode_init[vesa_modes[i].resindex];

??????? bits_per_pixel =vesa_modes[i].bits_per_pixel;

??? } else {

??????? res_mode = (struct ctfb_res_modes *)&var_mode;

???????bits_per_pixel =video_get_params (res_mode, penv);

??? }

?

?????? ?printf("add by zth now calculate hsynchand vsynch freq (info only )\n ");

??? /* calculate hsynch and vsynch freq (infoonly) */

??? t1 = (res_mode->left_margin +res_mode->xres + res_mode->right_margin + res_mode->hsync_len) / 8;

??? t1 *= 8;

??? t1 *= res_mode->pixclock;

?????? printf("addby zth;res_mode->pixclock= %d\n ",res_mode->pixclock);

??? t1 /= 1000;

??? hsynch = 1000000000L / t1;

??? t1 *= (res_mode->upper_margin +res_mode->yres + res_mode->lower_margin + res_mode->vsync_len);

??? t1 /= 1000;

??? vsynch = 1000000000L / t1;

??? /* fill in Graphic device struct */

??? sprintf (pGD->modeIdent, "%dx%dx%d%ldkHz %ldHz", res_mode->xres, res_mode->yres, bits_per_pixel,(hsynch /

1000), (vsynch / 1000));

??? printf ("%s\n",pGD->modeIdent);

??? pGD->winSizeX = res_mode->xres;

??? pGD->winSizeY = res_mode->yres;

??? pGD->plnSizeX = res_mode->xres;

??? pGD->plnSizeY = res_mode->yres;?????

?

?????? printf("bits_per_pixel%d\n ",bits_per_pixel);

??? switch (bits_per_pixel) {

??? case 8:

?????????? pGD->gdfBytesPP = 1;

?????????? pGD->gdfIndex = GDF__8BIT_INDEX;

?????????? break;

??? case 15:

?????????? pGD->gdfBytesPP = 2;

?????????? pGD->gdfIndex = GDF_15BIT_555RGB;

?????????? break;

??? case 16:

????????? ?pGD->gdfBytesPP = 2;

?????????? pGD->gdfIndex = GDF_16BIT_565RGB;

?????????? break;

??? case 24:

?????????? pGD->gdfBytesPP = 4;

?????????? pGD->gdfIndex = GDF_24BIT_888RGB;

?????????? break;

??case 32:

?????????? pGD->gdfBytesPP = 4;

?????????? pGD->gdfIndex =GDF_32BIT_X888RGB;

?????????? break;

??? }

?

?????? //pGD->frameAdrs= gd->fb_base;

?????? pGD->frameAdrs= LCD_VIDEO_ADDR;

?????? pGD->memSize= VIDEO_MEM_SIZE;

?????? /*Clear video memory */

??????

?????? memset((void*)pGD->frameAdrs, 0xFF00, pGD->memSize);

??// memset(LCD_VIDEO_ADDR, 0xFF00, VIDEO_MEM_SIZE);

?

??/*

???? *<Exyons 4412 datasheet pg1869>

???? *VIDCON0:

???? *????[13:6]: CLKVAL_F???? //設(shè)置LCD時(shí)鐘分頻系數(shù)

???? *

???? *?VCLK == 33.3Mhz????????<S700-AT070TN92 pg14> DCLK?Frequency ===> Type : 33.3Mhz

???? *?VCLK = FIMD * SCLK/(CLKVAL+1)

???? *?VCLK =? 800000000 / (CLKVAL +1)??

???? *?33300000 = 800000000 /(CLKVAL + 1)

???? *?CLKVAL + 1 = 24.02

???? *?CLKVAL = 23

???? * */

?

??? t1 = res_mode->pixclock;

??? t1 /= 1000;

??? t1 = 1000000000L / t1;

??? clkval = (CONFIG_SYS_VIDEO_VCLOCK_HZ / t1)- 1;

??? //clkval = (800000000 / 33300000) - 1;

????

??? // VIDCON0 = (23 << 6);

?????? VIDCON0=? EXYNOS_VIDCON0_CLKVAL_F(clkval);

??????

?????? printf("VIDCON0= %d? or %d? \r\n",(23 <<6),EXYNOS_VIDCON0_CLKVAL_F(clkval));

??? /*

???? *<Exyons 4412 datasheet pg1870 pg1848(時(shí)序)> <S700-AT070TN92 pg13(時(shí)序)>

???? *VIDTCON1:

???? *?????[5]:IVSYNC? ===> 1 : Inverted(反轉(zhuǎn))

???? *?????[6]:IHSYNC? ===> 1 : Inverted(反轉(zhuǎn))

???? *?????[7]:IVCLK?? ===> 1 : Fetchesvideo data at VCLK rising edge (下降沿觸發(fā))

???? *?? ???[10:9]:FIXVCLK? ====> 01 : VCLK running

???? * */

?

?????? //VIDCON1= (1 << 9) | (1 << 7) | (1 << 5) | (1 << 6);

?????? VIDCON1=? ( EXYNOS_VIDCON1_VCLK_RUNNING |

??????????????????????????? ?EXYNOS_VIDCON1_IVCLK_RISING_EDGE|

??????????????????????????? ?EXYNOS_VIDCON1_IVSYNC_INVERT |

??????????????????????????? ?EXYNOS_VIDCON1_IHSYNC_INVERT);???? ???

??????

?????? /*

?????? printf("VIDCON1= %d? or %d? \r\n",(1 << 9) | (1 << 7) |(1 << 5) | (1 << 6),

??????????????????????????????????????????????????????? EXYNOS_VIDCON1_VCLK_RUNNING|

??????????????????????????? ? ???????????????????????? EXYNOS_VIDCON1_IVCLK_RISING_EDGE|

??????????????????????????? ? ???????????????????????? EXYNOS_VIDCON1_IVSYNC_INVERT|

??????????????????????????? ?? ?????????????????????? EXYNOS_VIDCON1_IHSYNC_INVERT);

?????? */

??????

??/*

???? *<Exyons 4412 datasheet pg1874 pg1848(時(shí)序)> <S700-AT070TN92 pg13(時(shí)序)>

???? *VIDTCON0:

???? *??????[23:16]:? VBPD + 1 <------>tvpw (1 - 20)? 13

???? *??????[15:8]: VFPD + 1 <------> tvfp 22

???? *??????[7:0]: VSPW? + 1 <------>tvb - tvpw = 23 - 13 = 10

???? * */

???? //? VIDTCON0 = (12 << 16) | (21 << 8)| (9);??

???? // VIDTCON0 = (22 << 16)| (21 << 8) | (0);

?????? /*VIDTCON0= ( EXYNOS_VIDTCON0_VBPD(VBPD) |??????

??????????????????????????? ?EXYNOS_VIDTCON0_VFPD(VFPD) |

??????????????????????????? ?EXYNOS_VIDTCON0_VSPW(VSPW));??

?????? */

?????? VIDTCON0= ( EXYNOS_VIDTCON0_VBPD(res_mode->upper_margin) |???

??????????????????????????? ?EXYNOS_VIDTCON0_VFPD(res_mode->lower_margin)|

??????????????????????????? ?EXYNOS_VIDTCON0_VSPW(res_mode->vsync_len));??

??????

?

?????? printf("VIDTCON0= is 22,21,0 %d; %d; %d; \r\n",?res_mode->upper_margin,

?????????????????????????????????????????????????????????????? ??????????????????????????? ? res_mode->lower_margin,

?????????????????????????????????????????????????????????????????????????????????????????? ? res_mode->vsync_len);

?

?????? /*<Exyons4412 datasheet pg1874 pg1848(時(shí)序)><S700-AT070TN92 pg13(時(shí)序)>

???? *VIDTCON1:

???? *??????[23:16]:? HBPD + 1 <------>thpw (1 - 40)? 36

???? *??????[15:8]:?? HFPD + 1 <------>thfp 210

???? *??????[7:0]:??? HSPW? + 1 <------> thb - thpw = 46 - 36 = 10

???? */

???? ???? //VIDTCON1= (35 << 16) | (209 << 8) | (9);

??? ?????? //VIDTCON1= (45 << 16) | (209 << 8) | (0);

?????? /*??? VIDTCON1 = ( EXYNOS_VIDTCON1_HBPD(HBPD) |

??????????????????????????? ??? EXYNOS_VIDTCON1_HFPD(HFPD) |

??????????????????????????? ??? EXYNOS_VIDTCON1_HSPW(HSPW));?

?????? */

?????? VIDTCON1= ( EXYNOS_VIDTCON1_HBPD(res_mode->left_margin) |

??????????????????????????? ???EXYNOS_VIDTCON1_HFPD(res_mode->right_margin) |

??????????????????????????? ???EXYNOS_VIDTCON1_HSPW(res_mode->hsync_len));?

??????

?????? printf("VIDTCON1= is 45,209,0 %d; %d; %d; \r\n",?res_mode->left_margin,

?????????????????????????????????????????????????????????????????????????????????????????? ? res_mode->right_margin,

?????????????????????????????????????????????????????????????????????????????????????????? ? res_mode->hsync_len);

?

??? /*

???? *<Exyons 4412 datasheet pg1875>

???? *

???? *HOZVAL = (Horizontal display size) – 1and LINEVAL = (Vertical display size) – 1.

???? * Horizontal(水平) display size : 800

???? *Vertical(垂直) display size : 480

???? * */

?

?????? //VIDTCON2= (479 << 11) | 799;

?????? /*VIDTCON2= ( EXYNOS_VIDTCON2_LINEVAL(LINEVAL) |

??????????????????????????? ?EXYNOS_VIDTCON2_HOZVAL(HOZVAL));

?????? */

?

?????? VIDTCON2= ( EXYNOS_VIDTCON2_LINEVAL(pGD->winSizeY - 1) |

?????????????????????????????????? ?EXYNOS_VIDTCON2_HOZVAL(pGD->winSizeX - 1));

?

?????? printf("VIDTCON2=? 479 799 %d? or %d?\r\n", pGD->winSizeY - 1,pGD->winSizeX - 1);

?

//win0

??? /*

???? *<Exyons 4412 datasheet pg1877>

???? *WINCON0:

???? *?[5:2]: Selects Bits Per Pixel (BPP) mode for Window image : 1011 ===>24BPP

???? *?[1]:Enables/disables video output??1 = Enables

???? *

???? *modify by zth; have an error;add [15] :specifies word swap control bit :1=Enable ;2014 06-15 need enable

???? * */

??? //WINCON0 =( (1<<15) | (11 <<2) | 1);

?????? WINCON0=(EXYNOS_WINCON_WSWP_ENABLE | EXYNOS_WINCON_BPPMODE_24BPP_888 |

???????????????????? ? EXYNOS_WINCON_ENWIN_ENABLE);

?

?????? /*

?????? printf("WINCON0= %d? or %d? \r\n",(1<<15)|(11 << 2) | 1,

?????????????????????????????????????????????????????????????? EXYNOS_WINCON_WSWP_ENABLE|

?????????????????????????????????????????????????????????????? EXYNOS_WINCON_BPPMODE_24BPP_888|

?????????????????????????????????????????????????????????????? EXYNOS_WINCON_ENWIN_ENABLE);

?????? */

??????

??/*

???? *<Exyons 4412 datasheet pg1895>

???? *VIDOSD0C:Specifies the Window Size (窗口尺寸 單位為word)

???? *?????????

???? *

???? * */

???? //VIDOSD0C = 480 * 800;

?????? //VIDOSD0C= EXYNOS_VIDOSD_SIZE(ROW * COL);

?????? VIDOSD0C= EXYNOS_VIDOSD_SIZE(pGD->winSizeY * pGD->winSizeX);

??????

?????? //printf("VIDOSD0C= %d? or %d? \r\n",480 * 800,EXYNOS_VIDOSD_SIZE(ROW *COL));

?

??? /*

???? *<Exyons 4412 datasheet pg1891pg1801>

???? *[0]: Enables Channel 0. 1 = Enables

???? * */

???? // SHADOWCON |= 1;

??? SHADOWCON |= EXYNOS_WINSHMAP_CH_ENABLE(0);

?????? printf("SHADOWCON= %d?????? or %d? \r\n",1,EXYNOS_WINSHMAP_CH_ENABLE(0));

?

??? /*

???? *<Exyons 4412 datasheet? pg1894 pg1801>

???? *[18:16] Selects Channel 0's channel. ===>001 = Window 0

???? *[2:0] Selects Window 0's channel.? ===> 001 = Channel 0

???? *

???? *

???? * */

?

?????? /*WINCHMAP2&= ~(7 << 16);

?????? WINCHMAP2|= 1 << 16;

?????? WINCHMAP2&= ~7;

?????? WINCHMAP2|= 1;

?????? */

??????

?????? WINCHMAP2&=? EXYNOS_WINSHMAP_CH_DISABLE(16);

?????? WINCHMAP2|= EXYNOS_WINSHMAP_CH_ENABLE(16);

?????? WINCHMAP2&=? EXYNOS_WINSHMAP_CH_DISABLE(0);

?????? WINCHMAP2|= EXYNOS_WINSHMAP_CH_ENABLE(0);

?????????????

?????? printf("~(7<< 16) = %d?????? or %d? \r\n",~(7 <<16),EXYNOS_WINSHMAP_CH_DISABLE(16));

?????? printf("1<< 16= %d???? or %d? \r\n",1 << 16,EXYNOS_WINSHMAP_CH_ENABLE(16));

?????? printf("~7= %d???? or %d? \r\n",~7,EXYNOS_WINSHMAP_CH_DISABLE(0));

??? /*

???? *<Exyons 4412 datasheet? pg1895>

???? *VIDOSD0A: LCD左上角坐標(biāo)

???? *VIDOSD0B: LCD右下角坐標(biāo)

???? */

?????? //VIDOSD0A= 0;

?????? //VIDOSD0B= (799 << 11) | 479;

?????? VIDOSD0A=? ( EXYNOS_VIDOSD_LEFT_X(0) |EXYNOS_VIDOSD_TOP_Y(0));//0

?????? VIDOSD0B=? (EXYNOS_VIDOSD_RIGHT_X(pGD->winSizeX - 1) |EXYNOS_VIDOSD_BOTTOM_Y(pGD->winSizeY - 1));

?

?????? //printf("VIDOSD0A= %d?? or %d? \r\n",0,EXYNOS_VIDOSD_LEFT_X(0) |EXYNOS_VIDOSD_TOP_Y(0));

?????? printf("VIDOSD0B= %d???? or %d? \r\n",(799 << 11) | 479,

????????????????????????????????????????????????????????????????????? EXYNOS_VIDOSD_RIGHT_X(pGD->winSizeX- 1) | EXYNOS_VIDOSD_BOTTOM_Y(pGD->winSizeY - 1));

??? /*

???? *<Exyons 4412 datasheet? pg1902>

???? * VIDW00ADD0B0 : window0 frame buffer 起始地址

???? *?VIDW00ADD1B0 : window0 frame buffer 結(jié)束地址

???? * */

????

?????? //VIDW00ADD0B0= LCD_VIDEO_ADDR;

?????? //VIDW00ADD1B0= LCD_VIDEO_ADDR + VIDOSD0C * 4;

?????? VIDW00ADD0B0= pGD->frameAdrs;

?????? VIDW00ADD1B0= pGD->frameAdrs + VIDOSD0C * pGD->gdfBytesPP;

?????? printf("pGD->gdfBytesPP= 4 ;? %d?\r\n",pGD->gdfBytesPP);

?

??? /*

???? * <Exyons 4412 datasheet pg1869>

???? * Display On: ENVID and ENVID_F are set to"1".

???? *?[0]:ENVID ===> 1 = Enables

???? *?[1]:ENVID_F ===> 1 = Enables

???? * */

??? // VIDCON0 |= 3;

?????? VIDCON0|=? (EXYNOS_VIDCON0_ENVID_ENABLE |

??????????????????????????? ?EXYNOS_VIDCON0_ENVID_F_ENABLE);??

?

?????? /*printf("VIDCON0= %d???? or %d? \r\n",3,

??????????????????????????????????????????????????????? (EXYNOS_VIDCON0_ENVID_ENABLE|EXYNOS_VIDCON0_ENVID_F_ENABLE));

??????

?????? */???

?

?????? led_blink(10);//youcan see led blink and the lce is green now!

?????? printf("Video:video_hw_init complete \n");

?????? return((void*)&smi);???

}

?

// 描點(diǎn)

void lcd_draw_pixel(int row, intcol, int color)? //行,列 ,顏色

{

?????? unsignedlong * pixel = (unsigned long?*)LCD_VIDEO_ADDR;

?

?????? *(pixel+ row * COL + col) = color;

?

}

// 畫圖

//此函數(shù)僅支持img2lcd轉(zhuǎn)換格式包含信息頭的文件

void lcd_draw_bmp(const unsignedchar gImage_bmp[])

{

?????? inti, j;

?????? unsignedchar *p = (unsigned char *)gImage_bmp+8;//img2lcd轉(zhuǎn)換出來的包含信息頭8字節(jié)

?????? intblue, green, red;

?????? intcolor;

?????? intpic_width, pic_height;

?

?????? //獲取圖片大小 參考img2lcd軟件,可知其轉(zhuǎn)換的第3、4字節(jié)為寬,5、6字節(jié)為高

?????? pic_width= ((*(gImage_bmp+3)<<8) | *(gImage_bmp+2) );

?????? pic_height=((*(gImage_bmp+5)<<8) | *(gImage_bmp+4) );

?????? printf("pic_width= %d,? pic_height = %d",pic_width,pic_height);

?

?????? for(i = 0; i < pic_height; i++)

????????????? for(j = 0; j < pic_width; j++)

????????????? {

???????????????????? blue? = *p++;

???????????????????? green= *p++;

???????????????????? red?? = *p++;

?????????????

???????????????????? color= red << 16 | green << 8 | blue << 0;

???????????????????? lcd_draw_pixel(i,j, color);

????????????? }

?

}

// 清屏

void lcd_clear_screen(int color)

{

?????? inti, j;

?

?????? for(i = 0; i < ROW; i++)

????????????? for(j = 0; j < COL; j++)

???????????????????? lcd_draw_pixel(i,j, color);

?

}

// 劃?rùn)M線

void lcd_draw_hline(int row, intcol1, int col2, int color)

{

?????? intj;

?

?????? //描第row行,第j列

?????? for(j = col1; j <= col2; j++)

????????????? lcd_draw_pixel(row,j, color);

?

}

?

// 劃豎線

void lcd_draw_vline(int col, introw1, int row2, int color)

{

?????? inti;

?????? //描第i行,第col列

?????? for(i = row1; i <= row2; i++)

????????????? lcd_draw_pixel(i,col, color);

?

}

?

// 劃十字

void lcd_draw_cross(int row, intcol, int halflen, int color)

{

?????? lcd_draw_hline(row,col-halflen, col+halflen, color);

?????? lcd_draw_vline(col,row-halflen, row+halflen, color);

}

?

// 畫字符

void lcd_draw_char(unsigned charc)

{

?????? //必須是靜態(tài)變量

?????? staticint x = 0;?????? // 第幾列

?????? staticint y = 0;?????? // 第幾行

?????? inti,j;

?????? unsignedint line_dots=0x0;

?

?????? //獲得字模

#if FONT8_16

unsigned char *char_dots =(unsigned char *) (fontdata_8x16 + c * FONT_COL);

#endif

?

#if FONT10_18

unsigned char *char_dots =(unsigned char *) (fontdata_10x18 + c * FONT_COL*2);

#endif

?

#if FONT12_22?

unsigned char *char_dots =(unsigned char *) (fontdata_sun12x22 + c * FONT_COL*2);

#endif

?

?????? //是否需要回車換行

?????? if(c == '\n')

?????? {

????????????? y+= FONT_COL;

????????????? if(y > ROW)

???????????????????? y= 0;

????????????? return;

?????? }

?????? elseif (c == '\r')

?????? {

????????????? x= 0;

????????????? return;

?????? }

?

?????? unsignedlinek;

????????????? #ifFONT8_16??????

????????????? for(i = 0; i < FONT_COL; i++)

???????????????????? {

??????????????????????????? line_dots= char_dots[i];

??????????????????????????? for(j = 0; j < FONT_ROW; j++)

??????????????????????????? {

?????????????????????????????????? //為1,則描藍(lán)點(diǎn)

?????????????????????????????????? if(line_dots & (0x80 >> j))

?????????????????????????????????? {

????????????????????????????????????????? lcd_draw_pixel(y+i,x+j, 0xff);

?????????????????????????????????? }

??????????????????????????? }

???????????????????? }

?

?????????????

????????????? #endif???????????

?????????????

????????????? #ifFONT10_18

????????????? for(i = 0; i < FONT_COL; i++)

???????????????????? {

??????????????????????????? line_dots= ((char_dots[i*2]<<8) | char_dots[i*2+1]);

??????????????????????????? for(j = 0; j < FONT_ROW; j++)

??????????????????????????? {

?????????????????????????????????? //為1,則描藍(lán)點(diǎn)

?????????????????????????????????? if(line_dots & (0x8000 >> j))

?????????????????????????????????? {

????????????????????????????????????????? lcd_draw_pixel(y+i,x+j, 0xff);

?????????????????????????????????? }

??????????????????????????? }

???????????????????? }

????????????? #endif

?

????????????? #ifFONT12_22

????????????? for(i = 0; i < FONT_COL; i++)

???????????????????? {

???????????????????? line_dots= ((char_dots[i*2]<<8) | char_dots[i*2+1]);

??????????????????????????? for(j = 0; j < FONT_ROW; j++)

??????????????????????????? {

?????????????????????????????????? //為1,則描藍(lán)點(diǎn)

?????????????????????????????????? if(line_dots & (0x8000 >> j))

?????????????????????????????????? {

????????????????????????????????????????? lcd_draw_pixel(y+i,x+j, 0xff);

?????????????????????????????????? }

??????????????????????????? }

???????????????????? }

????????????? #endif

?????????????

// 光標(biāo)移動(dòng)到下一個(gè)字符的位置

x += FONT_ROW;

if (x > COL)

{

?????? x= 0;

?????? y+= FONT_COL;

?????? if(y > ROW)

?????? ?????? y = 0;

}

}

#endif

第三步:修改Makefile

打開/drivers/video/Makefile,定位到后面點(diǎn)位置增加:

COBJS-$(CONFIG_LCD_EXYNOS4412)+= zth_tiny4412_lcd.o videomodes.o

如下圖所示:

圖19-2 修改Makefile示意圖


第四步:修改videomodes.c

//參考的第3步?jīng)]有去修改。

打開/drivers/video/videomodes.c,首先定位到97行左右增加:

const struct ctfb_vesa_modes vesa_modes[VESA_MODES_COUNT] = {

???????? {0x301,RES_MODE_640x480, 8},

???????? {0x310,RES_MODE_640x480, 15},

???????? {0x311,RES_MODE_640x480, 16},

???????? {0x312,RES_MODE_640x480, 24},

???????? {0x303,RES_MODE_800x600, 8},

???????? {0x313,RES_MODE_800x600, 15},

???????? {0x314, RES_MODE_800x600,16},

???????? {0x315,RES_MODE_800x600, 24},

???????? {0x305,RES_MODE_1024x768, 8},

???????? {0x316,RES_MODE_1024x768, 15},

???????? {0x317,RES_MODE_1024x768, 16},

???????? {0x318,RES_MODE_1024x768, 24},

???????? {0x161,RES_MODE_1152x864, 8},

???????? {0x162,RES_MODE_1152x864, 15},

???????? {0x163,RES_MODE_1152x864, 16},

???????? {0x307,RES_MODE_1280x1024, 8},

???????? {0x319,RES_MODE_1280x1024, 15},

???????? {0x31A,RES_MODE_1280x1024, 16},

???????? {0x31B,RES_MODE_1280x1024, 24},

???????? {0x211,RES_MODE_800x480, 24},?? //modify by zth

};

?

接著、定位到106行附近,修改如下:

?

const struct ctfb_res_modes res_mode_init[RES_MODES_COUNT] = {

???????? /* x? y pixclk??le? ri? up?????? lo?? hs vs?s? vmode */

???????? {640, 480, 39721, 40,24, 32, 11, 96, 2, 0, FB_VMODE_NONINTERLACED},

???????? {800, 600, 27778, 64,24, 22, 1, 72, 2, 0, FB_VMODE_NONINTERLACED},

???????? {1024, 768, 15384,168, 8, 29, 3, 144, 4, 0, FB_VMODE_NONINTERLACED},

???????? {960, 720, 13100, 160,40, 32, 8, 80, 4, 0, FB_VMODE_NONINTERLACED},

???????? {1152, 864, 12004,200, 64, 32, 16, 80, 4, 0, FB_VMODE_NONINTERLACED},

???????? {1280, 1024, 9090,200, 48, 26, 1, 184, 3, 0, FB_VMODE_NONINTERLACED},

???????? {800, 480 ,30030 , 45,????? 209,22,21, 0, 0, 0, FB_VMODE_NONINTERLACED},

};

第五步:修改videomodes.h

打開/drivers/video/videomodes.h,定位到25行附近,修改如下:

#ifndefCONFIG_SYS_DEFAULT_VIDEO_MODE

//#defineCONFIG_SYS_DEFAULT_VIDEO_MODE? 0x301

//#ifndefCFG_SYS_DEFAULT_VIDEO_MODE

//#defineCFG_SYS_DEFAULT_VIDEO_MODE? 0x211

#define CONFIG_SYS_DEFAULT_VIDEO_MODE????? 0x211

#endif

?

接著定位到86行左右,修改如下:

#defineRES_MODE_640x480 ???????? 0

#defineRES_MODE_800x600 ???????? 1

#defineRES_MODE_1024x768??????? 2

#defineRES_MODE_960_720 ???????? 3

#defineRES_MODE_1152x864??????? 4

#defineRES_MODE_1280x1024????? 5

//#define RES_MODES_COUNT?????? 6

#define RES_MODE_800x480?6

#define RES_MODES_COUNT?7

?

//#define VESA_MODES_COUNT ?19?

#define VESA_MODES_COUNT ?20?//19->20

第六步:增加圖片數(shù)組

在\uboot_tiny4412-lcd\include\目錄下添加一個(gè)圖片數(shù)組文件:jpg_104160.h

此文件是用img2lcd來轉(zhuǎn)換實(shí)現(xiàn)得到,其設(shè)置示意如下圖18-3所示。

圖19-3img2lcd 軟件設(shè)置示意圖


第七步:修改cfb_console.c

首先,打開/drivers/video/cfb_console.c文件。

定們到98行左右,增加:

#if defined(CONFIG_LCD_EXYNOS4412)//modify? by zth

#include <zth_tiny4412_lcd.h>

#include <jpg_104160.h>

#endif

?

接著,定位到285行左右,修改:

//modify by zth

//#define VIDEO_INFO_X????????????????? (VIDEO_LOGO_WIDTH)

//#define VIDEO_INFO_Y????????????????? (VIDEO_FONT_HEIGHT/2)

#define VIDEO_INFO_X?? (0)

#define VIDEO_INFO_Y?? (VIDEO_LOGO_HEIGHT)

接著定位到1615行,增加修改:

#ifdef CONFIG_VIDEO_LOGO

???????? /* Plot the logo andget start point of console */

???????? PRINTD ("Video:Drawing the logo ...\n");

???????? video_console_address= video_logo ();

????????

???????? lcd_draw_bmp(gImage_bmp);

#else

???????? video_console_address= video_fb_address;

#endif

第八步:修改/common/console.c

打開/common/console.c,定位368行左右,為了輸出字符到LCD上,修改printf()函數(shù)。修改內(nèi)容如下:

int printf(constchar *fmt, ...)

{

???? va_list args;

???? uint i;

???? char printbuffer[CONFIG_SYS_PBSIZE];

?

???? va_start(args, fmt);

???? /* For this to work, printbuffer must belarger than

???? ?*anything we ever want to print.

???? ?*/

???? i = vsprintf(printbuffer, fmt, args);

???? va_end(args);

???? /* Print the string */

???? puts(printbuffer);

?

???? //modify by zth

???? uint j;

???? for (j = 0; j <strlen(printbuffer); j++)

???? {

????????????? lcd_draw_char((unsignedchar)printbuffer[j]);

???? }

????

???? return i;

}

?

第九步:修改zth_tiny4412.h

這一步修改配置文件,打開/include/configs/zth_tiny4412.h,首先定位到155行左右,使能調(diào)試輸出信息,這樣你會(huì)看到很多其他額外的信息,但這樣會(huì)去檢測(cè)Memorry,我們?cè)賹ONFIG_RAM_TEST注釋了,修改如下:

//#undefCONFIG_LL_DEBUG???????????????????????? /*disable debug */

#defineCONFIG_LL_DEBUG?????????????????? 1

#defineDEBUG 1

//#ifdefCONFIG_LL_DEBUG

//#defineCONFIG_RAM_TEST???????????????? 1???? /* Memory R/W test */

//#endif

?

定位到文件的最后部分,文件的第443行左右。增加下面內(nèi)容:

/*LCD*/

?

#define CONFIG_VIDEO???????????????? ? //Video support

#defineCONFIG_LCD_EXYNOS4412? 1

#defineCONFIG_VIDEO_LOGO????? 1?? //display Linux Logo in upper left corner

?

//#defineCONFIG_VIDEO_BMP_LOGO??? ????//use bmp_logo instead of linux_logo

//#defineCONFIG_CMD_BMP???????? //BMP support

//#defineCONFIG_VIDEO_BMP_GZIP????? //Gzipcompressed BMP image support

//#defineCONFIG_CMD_UNZIP

//#defineCONFIG_SPLASH_SCREEN??? //enable splashscreen support,implicitly enable U-Boot Bitmap Support.

#defineCONFIG_VGA_AS_SINGLE_DEVICE 1

#defineCONFIG_CFB_CONSOLE

#defineVIDEO_KBD_INIT_FCT? 0?????? //init function for keyboard

#defineVIDEO_TSTC_FCT? serial_tstc?? //keyboard_tstc function

#defineVIDEO_GETC_FCT? serial_getc?? //keyboard_getc function

?

?

#define LCD_VIDEO_ADDR???? (0x58000000)????

#define ?????? VIDEO_MEM_SIZE? 0x200000??????? /* 800x480x24bit = 0X119400 bytes */

#define? CONFIG_SYS_VIDEO_VCLOCK_HZ? (800000000)

?

?

#defineCONFIG_EXTRA_ENV_SETTINGS?? \

?"stdin=serial\0"????? \

?"stdout=vga\0"?????? \

?"stderr=serial\0"???? \

""

?

第十步:修改/sd_fuse/tiny4412/ sd_fusing.sh

其實(shí)經(jīng)過上面的步驟,大家可以按第十二步進(jìn)行編譯,煤寫到SD卡運(yùn)行u-boot了,但會(huì)出現(xiàn)一個(gè)問題,你會(huì)發(fā)現(xiàn)程序串口輸出運(yùn)行輸出到如下圖18-4所示的位置,就不會(huì)繼續(xù)往下執(zhí)行了,正常運(yùn)行的串口輸出如圖18-6所示。這是為什么呢?大家查看生成的u-boot.bin大小,就會(huì)發(fā)現(xiàn)其大小為372.8K左右,如下圖18-5所示。

圖19-4、未正常運(yùn)行串口輸出信息截圖


?

圖19-5、u-boot.bin 大小說明圖


我們來看下/sd_fuse/tiny4412/ sd_fusing.sh的文件,有如下幾行語(yǔ)句,下面的語(yǔ)句是說明BL1、BL2、u-boot.bin、還有E4412_tzsw.bin燒寫到SD卡的位置。

# fusing images

signed_bl1_position=1

bl2_position=17

uboot_position=49

tzsw_position=705

?

來算一下,一個(gè)扇區(qū)為512byte ,那么(705-49)*512/1024=328K,即給u-boot.bin的空間只有328k大小,后面的u-boot.bin程序被燒寫到tzsw_position 位置片的E4412_tzsw.bin給覆蓋了。

所以這們這里需要修改一下,修改內(nèi)容如下

tzsw_position=1073

?

這里為什么是1073呢,是因?yàn)槲疫€改了一個(gè)地方,增加拷貝u-boot.bin大小為512K,那么512*2+49=1073了

還要修改一下程序里的文件/arch/arm/include/asm/arch-exynos/ movi_partition.h定位到28行

#ifdefCONFIG_TRUSTZONE

#definePART_SIZE_UBOOT????????????? (512 *1024)? //modify by zth 328->512

#else

#definePART_SIZE_UBOOT????????????? (512 * 1024)

#endif

?

這樣就可以真正進(jìn)行第十二步了。

第十一步:燒寫SD卡

???????? 以下命令提供參考:

cp -R /media/sf_share/u-boot_zth .

chmod 777 -R u-boot_zth /

cd u-boot_zth

make distclean

make zthtiny4412_config

make

cd sd_fuse/

make

cd zthtiny4412/

./sd_fusing.sh /dev/sdb

運(yùn)行后的串口信息如下圖所示:

圖19-6 、正常運(yùn)行串口輸出信息截圖


?

圖19-7 、正常運(yùn)行效果圖


總結(jié)

以上是生活随笔為你收集整理的第十九章、TIny4412 U-BOOT移植十九 LCD移植的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。