基于s3c2440的u-boot-2010.3 LCD驱动流程以及LOGO的显示详解

  如果需要在UBOOT的阶段就要显示LOGO,直到内核启动完毕后UI接管FrameBuffer为止。这样可以避免内核启动过程的这段时间大约5-8秒内的黑屏。所以我们要为u-boot添加LCD驱动并且了解LCD驱动的流程便于修改。

u-boot的启动流程:从文件层面上看主要流程是在两个文件中:cpu/arm920t/start.s,lib_arm/board.c,

其中start.s 是用汇编写的初始化cpu的堆栈 中断向量 时钟频率 SDRAM,并把c部分的代码从nand flash拷贝到SDRAM中,board.c的代码主要是初始化各外设比如串口 i2c LCD等,所以LCD驱动的开始在board.c中。下面分析board.c的部分源码


typedef int (init_fnc_t) (void);//定义一个函数数据类型


int print_cpuinfo (void);

/***一个函数数组里面是各种初始化函数***/
init_fnc_t *init_sequence[] = {
#if defined(CONFIG_ARCH_CPU_INIT)
arch_cpu_init,/* basic arch cpu dependent setup */
#endif
board_init
,/* 初始化开发板的相关外设  下面会详细分析 */
#if defined(CONFIG_USE_IRQ)
interrupt_init,/* set up exceptions */
#endif
timer_init,/* initialize timer */
#ifdef CONFIG_FSL_ESDHC
get_clocks,
#endif
env_init,/* initialize environment */
init_baudrate,/* initialze baudrate settings */
serial_init,/* serial communications setup */
console_init_f,/* stage 1 init of console */
display_banner,/* say that we are here */
#if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo,/* display cpu info (and speed) */
#endif
#if defined(CONFIG_DISPLAY_BOARDINFO)
checkboard,/* display board info */
#endif
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
init_func_i2c,
#endif
dram_init,/* configure available RAM banks */
#if defined(CONFIG_CMD_PCI) || defined (CONFIG_PCI)
arm_pci_init,
#endif
display_dram_config,
NULL,
};

/*******c入口*******/
void start_armboot (void)
{
init_fnc_t **init_fnc_ptr;//定义一个init_fnc_t类型的指针
char *s;
#if defined(CONFIG_VFD) || defined(CONFIG_LCD)
unsigned long addr;
#endif


/* Pointer is writable since we allocated a register for it */
gd = (gd_t*)(_armboot_start - CONFIG_SYS_MALLOC_LEN - sizeof(gd_t));//u-boot的全局变量存储各种信息
/* compiler optimization barrier needed for GCC >= 3.4 */
__asm__ __volatile__("": : :"memory");


memset ((void*)gd, 0, sizeof (gd_t));
gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
memset (gd->bd, 0, sizeof (bd_t));


gd->flags |= GD_FLG_RELOC;


monitor_flash_len = _bss_start - _armboot_start;

/******************下面这个循环将上面数组的函数都执行一遍********************/
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
}


/* armboot_start is defined in the board-specific linker script */
mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN,
CONFIG_SYS_MALLOC_LEN);


#ifndef CONFIG_SYS_NO_FLASH
/* configure available FLASH banks */
display_flash_config (flash_init ());
#endif /* CONFIG_SYS_NO_FLASH */


#ifdef CONFIG_VFD
#ifndef PAGE_SIZE
# define PAGE_SIZE 4096
#endif
/*
* reserve memory for VFD display (always full pages)
*/
/* bss_end is defined in the board-specific linker script */
addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
vfd_setmem (addr);
gd->fb_base = addr;
#endif /* CONFIG_VFD */


#ifdef CONFIG_LCD
/* board init may have inited fb_base */
if (!gd->fb_base) {
#ifndef PAGE_SIZE
# define PAGE_SIZE 4096
#endif
/*
* reserve memory for LCD display (always full pages)
*/
/* bss_end is defined in the board-specific linker script */
addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
lcd_setmem (addr);
gd->fb_base = addr;
}
#endif /* CONFIG_LCD */


#if defined(CONFIG_CMD_NAND)
puts ("NAND:  ");
nand_init();/* go init the NAND */
#endif


#if defined(CONFIG_CMD_ONENAND)
onenand_init();
#endif


#ifdef CONFIG_HAS_DATAFLASH
AT91F_DataflashInit();
dataflash_print_info();
#endif


/* initialize environment */
env_relocate ();


#ifdef CONFIG_VFD
/* must do this after the framebuffer is allocated */
drv_vfd_init();//mini2440的LCD初始化和此函数无关

#endif /* CONFIG_VFD */


#ifdef CONFIG_SERIAL_MULTI
serial_initialize();
#endif


/* IP Address */
gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");


stdio_init ()
;/* 初始化设备列表mini2440LCD设备初始化就在这里  下面会详细分析此函数*/


jumptable_init ();


#if defined(CONFIG_API)
/* Initialize API */
api_init ();
#endif

cosole_init_r ();/* fully init console as a device */


#if defined(CONFIG_ARCH_MISC_INIT)
/* miscellaneous arch dependent initialisations */
arch_misc_init ();
#endif
#if defined(CONFIG_MISC_INIT_R)
/* miscellaneous platform dependent initialisations */
misc_init_r ();
#endif
      // extern void  Port_Init(void);
  //  Port_Init();
/* enable exceptions */
enable_interrupts ();
      extern  int    usb_init_slave(void);
                 usb_init_slave();


/* Perform network card initialisation if necessary */
#ifdef CONFIG_DRIVER_TI_EMAC
/* XXX: this needs to be moved to board init */
extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
if (getenv ("ethaddr")) {
uchar enetaddr[6];
eth_getenv_enetaddr("ethaddr", enetaddr);
davinci_eth_set_mac_addr(enetaddr);
}
#endif


#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
/* XXX: this needs to be moved to board init */
if (getenv ("ethaddr")) {

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值