您的位置:首页 > 编程语言 > C语言/C++

三星uboot1.1.6源码分析——start.s(10)--C语言部分(4)

2012-07-01 12:58 525 查看
接着上一篇的分析。

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

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

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

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

---------------------------------------------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: