uboot2012 LCD驱动流程及机制分析

学习Uboot有一段时间了,对LCD的流程没有深入了解过,借助于sourceinsight对LCD的驱动流程进行分析

board_init_r()(Board.c) ===>stdio_init()(Stdio.c)===>drv_video_init()(Cfb_console.c)====>video_init()===>video_hw_init()(S3c24x0_fb.c)=====>board_video_init()

int drv_video_init(void)函数中首先初始化VGA设备,建立设备描述信息, 对输入输出设备进行注册,将lcd设备驱动加入驱动链表中。
int console_init_r(void)函数从设备链表中获取出lcd设备,置设备初始化标志,并将当前设备信息打印。

初始化完成之后沿着puts()输出函数具体分析

puts()(console.c)======>fputs()====>console_putcs()中通过stdio_device[file]->putc()在设备中的注册映射到相关函数video_puts()==>video_puts()(cfb_console.c)

void video_putc(const char c)
{
static int nl = 1;


CURSOR_OFF;


switch (c) {
case 13: /* back to first column */
console_cr();
break;


case '\n': /* next line */
if (console_col || (!console_col && nl))
console_newline();
nl = 1;
break;


case 9: /* tab 8 */
console_col |= 0x0008;
console_col &= ~0x0007;


if (console_col >= CONSOLE_COLS)
console_newline();
break;


case 8: /* backspace */
console_back();
break;


case 7: /* bell */
break; /* ignored */


default: /* draw the char */
video_putchar(console_col * VIDEO_FONT_WIDTH,
     console_row * VIDEO_FONT_HEIGHT, c);
console_col++;


/* check for newline */
if (console_col >= CONSOLE_COLS) {
console_newline();
nl = 0;
}
}
CURSOR_SET;
}

以上代码是特殊命令的转换与解析当满屏时进入console_newline()函数

追踪此函数

console_newline()====>console_scrollup()

static void console_scrollup(void)
{
/* copy up rows ignoring the first one */


#ifdef VIDEO_HW_BITBLT
video_hw_bitblt(VIDEO_PIXEL_SIZE, /* bytes per pixel */
0, /* source pos x */
video_logo_height +
VIDEO_FONT_HEIGHT, /* source pos y */
0, /* dest pos x */
video_logo_height, /* dest pos y */
VIDEO_VISIBLE_COLS, /* frame width */
VIDEO_VISIBLE_ROWS
- video_logo_height
- VIDEO_FONT_HEIGHT /* frame height */
);
#else
memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
CONSOLE_SCROLL_SIZE >> 2);
#endif
/* clear the last one */
console_clear_line(CONSOLE_ROWS - 1, 0, CONSOLE_COLS - 1);
}

从上述代码看出memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,CONSOLE_SCROLL_SIZE >> 2)将

显存内容从下一行复制到上一行然后清空最后一行,至此代码跟踪完成,uboot学习告一段落开始编译linux。


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值