手机版
你好,游客 登录 注册
背景:
阅读新闻

三星U-Boot-1.1.6源码分析

start.s(10)--C语言部分(4)

[日期:2012-06-15] 来源:Linux社区  作者:tianxiawuzhei [字体:大 中 小]

接着上一篇的分析。

-------------------------------------------------------------------------------------

init_fnc_t *init_sequence[] = {
cpu_init, /* basic cpu dependent setup */
board_init, /* basic board dependent setup */
interrupt_init,/* set up exceptions */
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

dram_init, /* configure available RAM banks */
display_dram_config,
NULL,

};

---------------------------------------------------------------------------------------------

5、

/************************************************************************
 * Init Utilities *
 ************************************************************************
 * Some of this code should be moved into the core functions,
 * or dropped completely,
 * but let's get it working (again) first...
 */
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
int i = getenv_r ("baudrate", tmp, sizeof (tmp));    得到环境变量中的波特率
gd->bd->bi_baudrate = gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
: CONFIG_BAUDRATE;  -----
#define CONFIG_BAUDRATE115200



return (0);
}

--------------------------------------------------------------------------------------------

6、

/*
 * Initialise the serial port with the given baudrate. The settings
 * are always 8 data bits, no parity, 1 stop bit, no start bits.

 *
 */
int serial_init(void)
{
serial_setbrg();

------------------------------------------------------

void serial_setbrg(void)
{
DECLARE_GLOBAL_DATA_PTR;  

----------------------------------------------

#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")

----------------------------------------------

int i;
for (i = 0; i < 100; i++);
}

不太明白是怎样设置串口的呢?

------------------------------------------------------

return (0);
}

------------------------------------------------------------------------------------

7、 应该与控制台有关


/* Called before relocation - use serial functions */
int console_init_f (void)
{
gd->have_console = 1;


#ifdef CONFIG_SILENT_CONSOLE
if (getenv("silent") != NULL)
gd->flags |= GD_FLG_SILENT;
#endif


return (0);
}

-----------------------------------------------------------------------------------------

8、打印一些信息

static int display_banner (void)
{
printf ("\n\n%s\n\n", version_string);
debug ("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
      _armboot_start, _bss_start, _bss_end);
#ifdef CONFIG_MEMORY_UPPER_CODE /* by scsuh */
debug("\t\bMalloc and Stack is above the U-Boot Code.\n");
#else
debug("\t\bMalloc and Stack is below the U-Boot Code.\n");
#endif
#ifdef CONFIG_MODEM_SUPPORT
debug ("Modem Support enabled\n");
#endif
#ifdef CONFIG_USE_IRQ
debug ("IRQ Stack: %08lx\n", IRQ_STACK_START);
debug ("FIQ Stack: %08lx\n", FIQ_STACK_START);
#endif


return (0);
}

--------------------------------------------------

其中:

#undef debug
#ifdef MII_DEBUG
#define debug(fmt,args...) printf (fmt ,##args)
#else
#define debug(fmt,args...)
#endif /* MII_DEBUG */

-----------------------------------------------------------------------------------------

9、

-------------------------------------------------------

其中在Smdk6410.h (include\configs)文件中有如下定义:


#define CONFIG_DISPLAY_CPUINFO
#define CONFIG_DISPLAY_BOARDINFO

-----------------------------------------

int print_cpuinfo(void)
{
printf("**    u-boot 1.1.6                    **\r\n");
printf("**    Version 1.0 (10-01-15)          **\r\n");

printf("\nCPU:     S3C6410 @%dMHz\n", get_ARMCLK()/1000000);
printf("         Fclk = %dMHz, Hclk = %dMHz, Pclk = %dMHz",
get_FCLK()/1000000, get_HCLK()/1000000, get_PCLK()/1000000);


/**************
* Display Serial SRC
***************/


#if defined(CONFIG_CLKSRC_CLKUART)
puts(", Serial = CLKUART ");
#else
puts(", Serial = PCLK ");
#endif


if(OTHERS_REG & 0x80)
printf("(SYNC Mode) \n");
else
printf("(ASYNC Mode) \n");
return 0;
}

----------------------------------------------------

#ifdef CONFIG_DISPLAY_BOARDINFO
int checkboard(void)
{
printf("Board:   SMDK6410\n");
return (0);
}
#endif

---------------------------------------------------------------------

这一篇有分析完了,下一篇接着分析。

---------------------------------------------------------------------

linux
【内容导航】
第1页:lowlevel_init.S (board\samsung\smdk6410) 第2页:时钟配置
第3页:串口 第4页:lowlevel_init.S源码
第5页:start.s(1) 第6页:start.s(2)--从NAND复制uboot源码到RAM(1)
第7页:start.s(3)---从NAND复制uboot到外部RAM(2) 第8页:start.s(4)——从NAND复制源码到RAM(3)
第9页:start.s(5)——与MMU有关的源码(1) 第10页:start.s(5)——与MMU有关的源码(2)
第11页:start.s(6)--汇编部分完! 第12页:C语言部分(1)
第13页:start.s(8)--C语言部分(2) 第14页:start.s(9)--C语言部分(3)
第15页:start.s(10)--C语言部分(4) 第16页:start.s(11)--C语言部分(5)
第17页:start.s(12)--C语言部分(6) 第18页:start.s(13)--C语言部分(7)
相关资讯       U-boot 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款