微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > uboot 下S3C6410 的LCD 显示

uboot 下S3C6410 的LCD 显示

时间:11-11 来源:互联网 点击:

*res_mode;

struct ctfb_res_modes var_mode;

int clkval;

// unsigned char videoout;

/* Search for video chip */

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 VESA Mode 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);

}

/* calculate hsynch and vsynch freq (info only) */

t1 = (res_mode->left_margin + res_mode->xres +

res_mode->right_margin + res_mode->hsync_len) / 8;

t1 *= 8;

t1 *= 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("videomode = %x;\ni = %d\npgd->winsizex = %d;pGD->winSizeY = %d;pGD->plnSizeX = %d;pGD->plnSizeY = %d;\nbits_per_pixel =%d\n ",videomode,i,pGD->winSizeX,pGD->winSizeY,pGD->plnSizeX,pGD->plnSizeY,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 = 3;

pGD->gdfIndex = GDF_24BIT_888RGB;

break;

}

#if 0

/* statically configure settings for debug*/

pGD->winSizeX = pGD->plnSizeX = 480;

pGD->winSizeY = pGD->plnSizeY = 272;

pGD->gdfBytesPP = 2;

pGD->gdfIndex = GDF_16BIT_565RGB;

#endif

pGD->frameAdrs = LCD_VIDEO_ADDR; //in config file :include/configs/mini6410.h

pGD->memSize = VIDEO_MEM_SIZE;

/* Clear video memory */

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

board_video_init(pGD); //in board init file :board/samsung/mini6410/mini6410.c for gpio etc.

t1 = res_mode->pixclock;

t1 /= 1000;

t1 = 1000000000L / t1;

clkval = (CONFIG_SYS_VIDEO_VCLOCK_HZ / t1) - 1;

fb->VIDCON0 = ( VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |

VIDCON0_CLKVALUP | VIDCON0_CLKVAL_F(clkval)|

VIDCON0_CLKDIR | VIDCON0_CLKSEL_HCLK );

fb->VIDCON1 = ( VIDCON1_INV_VSYNC | VIDCON1_INV_HSYNC);

fb->VIDTCON0 = ( VIDTCON0_VBPD(res_mode->upper_margin) |

VIDTCON0_VFPD(res_mode->lower_margin) |

VIDTCON0_VSPW(res_mode->vsync_len) );

fb->VIDTCON1 = ( VIDTCON1_HBPD(res_mode->left_margin) |

VIDTCON1_HFPD(res_mode->right_margin) |

VIDTCON1_HSPW(res_mode-> VIDTCON

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top