当前位置: 代码迷 >> 驱动开发 >> uboot LCD字符输出解决方案
  详细解决方案

uboot LCD字符输出解决方案

热度:537   发布时间:2016-04-28 10:16:05.0
uboot LCD字符输出
各位大神,我想在uboot启动时在LCD输出字符,目前已经实现,但是输出的字体很小,我想放大字体怎么弄,还有输出的字体周边有一黑框要怎么去掉,以下是自己写LCD代码
omap3Lcd.c文件内容
#include <common.h>   
#include <asm/io.h>   
#include <asm/arch/mem.h>   
#include <asm/arch/mux.h>   
#include <asm/arch/sys_proto.h>   
#include <asm/mach-types.h>   
#include <video_fb.h>   
  
#include "omap3Lcd.h"   
  
GraphicDevice glcd_dev;  
  
//static int lcd_static_mem[800][480];   
static int lcd_static_mem[1024*1024*2] __attribute__((aligned(0x1000)));
  
int lcd_ctrl_init(void )  
{  
    u32 l = clkctrl_read_reg(CM_CLKSEL2_PLL);  
    printf("CLKSEL2_PLL is %d\n",l);  
  
    u32 m = clkctrl_read_reg(CM_CLKEN_PLL);  
    printf("CM_CLLEN_PLL is %d\n",m);     
    m &= 0xffffff;    
    m |= (0x7 << 16);//|(0x0f<<20);   
    clkctrl_write_reg(CM_CLKEN_PLL,m);  
//  printf("CM_CLLEN_PLL is %d\n",m);   
  
    dss_clk_write_reg(CM_CLKSEL_DSS,0x10009);  
  
  
    dss_clk_write_reg(CM_FCLKEN_DSS, 5);  
    dss_clk_write_reg(CM_ICLKEN_DSS, 1);  
    dss_clk_write_reg(CM_AUTOIDLE_DSS, 0);  
    dss_clk_write_reg(CM_SLEEPDEP_DSS,0);  
    dss_clk_write_reg(CM_CLKSTCTRL_DSS,0);  
  
  
    dss_write_reg(DSS_SYSCONFIG,0x0002);  
  //  dss_write_reg(DSS_CONTROL, 0x00000019);
  //  dss_write_reg(DSS_SDI_CONTROL, 0x00);
   // dss_write_reg(DSS_PLL_CONTROL, 0x00);
    while(! dss_read_reg(DSS_SYSSTATUS));  
    dispc_write_reg(DISPC_SYSCONFIG, 0x2015);
    dispc_write_reg(DISPC_CONTROL, 0x00018309 );//change 18309 to 18109 for 16bit per pix   
    dispc_write_reg(DISPC_SIZE_LCD, 0x01df031f);    //size:800*480   0x01df027f-> 0x01df031f
    dispc_write_reg(DISPC_CONFIG,0x00000204);  
   // dispc_write_reg(DISPC_TIMING_H, 0x0720101e);    //LCD Timing params   
    dispc_write_reg(DISPC_TIMING_H, 0x02d0d101);
    dispc_write_reg(DISPC_TIMING_V, 0x01401601); 
    dispc_write_reg(DISPC_POL_FREQ, 0x00);  
    dispc_write_reg(DISPC_DIVISOR, 0x00010002);     //maybe need change   
  
    dispc_write_reg(DISPC_DEFAULT_COLOR0, 0xff);
    dispc_write_reg(DISPC_TRANS_COLOR0, 0xff);
    dispc_write_reg(DISPC_DEFAULT_COLOR1, 0xff);
    dispc_write_reg(DISPC_TRANS_COLOR1, 0xff);
  
    dispc_write_reg(DISPC_GFX_SIZE, 0x01df031f);      
    dispc_write_reg(DISPC_GFX_FIFO_THRESHOLD, 0x03c003ff);  
    dispc_write_reg(DISPC_GFX_ROW_INC, 0x01);  
    dispc_write_reg(DISPC_GFX_PIXEL_INC, 0x01);  
  
  
    memset(lcd_static_mem, 0xff, sizeof(lcd_static_mem));  
   // dispc_write_reg(DISPC_GFX_BA0, 0x8fc00000);
  //  dispc_write_reg(DISPC_GFX_BA1, 0x8fc00000);  
    dispc_write_reg(DISPC_GFX_BA0, (unsigned int )lcd_static_mem);
    dispc_write_reg(DISPC_GFX_BA1, (unsigned int )lcd_static_mem + 800*480*4);  
  
  
//  dispc_write_reg(DISPC_GFX_BA0, LCD_STATIC_MEM);   
  
  
    dispc_write_reg(DISPC_GFX_POSITION, 0);  
    dispc_write_reg(DISPC_GFX_ATTRIBUTES, 0x00000091);  //change for GFX configuration 0x02d  0x00000091
   // dispc_write_reg(DISPC_GFX_ATTRIBUTES, 0x02d);   
   // dispc_write_reg(DISPC_CONTROL, 0x00018129);  
       int r = dispc_read_reg(DISPC_CONTROL);

if (!(r & 1)) {
printf("lcd is not enable\n");
}
if (r & (1<<5)) {
printf("lcd is going\n");
}
r |= (1<<5);
dispc_write_reg(DISPC_CONTROL, r);
  //    dispc_write_reg(DISPC_CONTROL, 0x00018309);
  相关解决方案