ImageVerifierCode 换一换
你正在下载:

boardc.docx

[预览]
格式:DOCX , 页数:16 ,大小:20.57KB ,
资源ID:12037628      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12037628.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(boardc.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

boardc.docx

1、boardc/* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wddenx.de. * * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH * Marius Groeger * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or

2、* modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the imp

3、lied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suit

4、e 330, Boston, * MA 02111-1307 USA */#include #include #include #include #include #include #ifdef CONFIG_DRIVER_SMC91111 /添加 驱动支持#include ./drivers/smc91111.h#endif#ifdef CONFIG_DRIVER_LAN91C96#include ./drivers/lan91c96.h#endif#if (CONFIG_COMMANDS & CFG_CMD_NAND) /命令选项 & NAND 设置void nand_init (void

5、);#endifulong monitor_flash_len;#ifdef CONFIG_HAS_DATAFLASHextern int AT91F_DataflashInit(void);extern void dataflash_print_info(void);#endif#ifndef CONFIG_IDENT_STRING#define CONFIG_IDENT_STRING #endifconst char version_string = U_BOOT_VERSION ( _DATE_ - _TIME_ )CONFIG_IDENT_STRING;#ifdef CONFIG_DR

6、IVER_CS8900 /添加驱动extern void cs8900_get_enetaddr (uchar * addr);#endif#ifdef CONFIG_DRIVER_RTL8019extern void rtl8019_get_enetaddr (uchar * addr);#endif/* * Begin and End of memory area for malloc(), and current brk */static ulong mem_malloc_start = 0; /MEM 显示内存状态static ulong mem_malloc_end = 0; /存储

7、器分配 malloc.static ulong mem_malloc_brk = 0;staticvoid mem_malloc_init (ulong dest_addr) mem_malloc_start = dest_addr; mem_malloc_end = dest_addr + CFG_MALLOC_LEN; mem_malloc_brk = mem_malloc_start; memset (void *) mem_malloc_start, 0, mem_malloc_end - mem_malloc_start);void *sbrk (ptrdiff_t incremen

8、t) /*本函数用于扩展堆空间,用incriment来指定扩展的大小*/ ulong old = mem_malloc_brk; ulong new = old + increment; if (new mem_malloc_end) return (NULL); mem_malloc_brk = new; return (void *) old);/* * Init Utilities * * * Some of this code should be moved into the core functions, * or dropped completely, * but lets get

9、 it working (again) first. */*获取环境变量,把波特率值赋给全局gd,若获取为空值,则赋给默认115200*/static int init_baudrate (void) DECLARE_GLOBAL_DATA_PTR; uchar tmp64; /* long enough for environment variables */*把环境变量获取到tmp中,i为得到的环境变量的长度*/ int i = getenv_r (baudrate, tmp, sizeof (tmp);/*如果获得了env,则把它赋给gd,否则把115200赋给gd*/ gd-bd-bi

10、_baudrate = gd-baudrate = (i 0)/*此函数把字符串转换为ulong型*/ ? (int) simple_strtoul (tmp, NULL, 10) : CONFIG_BAUDRATE; return (0);static int display_banner (void) printf (nn%snn, version_string); printf (U-Boot code: %08lX - %08lX BSS: - %08lXn, _armboot_start, _bss_start, _bss_end);#ifdef CONFIG_MODEM_SUPPO

11、RT puts (Modem Support enabledn);#endif#ifdef CONFIG_USE_IRQ printf (IRQ Stack: %08lxn, IRQ_STACK_START); printf (FIQ Stack: %08lxn, FIQ_STACK_START);#endif return (0);/* * WARNING: this code looks cleaner than the PowerPC version, but * has the disadvantage that you either get nothing, or everythin

12、g. * On PowerPC, you might see DRAM: before the system hangs - which * gives a simple yet clear indication which part of the * initialization if failing. */static int display_dram_config (void) DECLARE_GLOBAL_DATA_PTR; int i; puts (RAM Configuration:n); for(i=0; ibd-bi_drami.start); print_size (gd-b

13、d-bi_drami.size, n); return (0);static void display_flash_config (ulong size) puts (Flash: ); print_size (size, n);/* * Breathe some life into the board. * * Initialize a serial port as console, and carry out some hardware * tests. * * The first part of initialization is running from Flash memory; *

14、 its main purpose is to initialize the RAM so that we * can relocate the monitor code to RAM. */* * All attempts to come up with a common initialization sequence * that works for all boards and architectures failed: some of the * requirements are just _too_ different. To get rid of the resulting * m

15、ess of board dependent #ifdefed code we now make the whole * initialization sequence configurable to the user. * * The requirements for any new initalization function is simple: it * receives a pointer to the global data structure as its only * argument, and returns an integer return code, where 0 m

16、eans * continue and != 0 means fatal error, hang the system. */typedef int (init_fnc_t) (void);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

17、 environment 初始化环境变量*/ init_baudrate, /* initialze baudrate settings 初始化波特率设置*/ serial_init, /* serial communications setup 串口通讯设置*/ console_init_f, /* stage 1 init of console 控制台初始化阶段1*/ display_banner, /* say that we are here 打印 u-boot信息*/ dram_init, /* configure available RAM banks 配置可用的RAM*/ dis

18、play_dram_config, /显示 RAM的配置大小#if defined(CONFIG_VCMA9) checkboard,#endif NULL,;/*start_armboot是U-Boot执行的第一个C语言函数,完成系统初始化工作,进入主循环,处理用户输入的命令。*/void start_armboot (void) DECLARE_GLOBAL_DATA_PTR; ulong size; init_fnc_t *init_fnc_ptr; char *s;#if defined(CONFIG_VFD) | defined(CONFIG_LCD) unsigned long a

19、ddr;#endif /* Pointer is writable since we allocated a register for it */*全局数据结构的初始化*/*gd_t结构的初始化:*/ gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t); /* compiler optimization barrier needed for GCC = 3.4 */ _asm_ _volatile_(: : :memory); memset (void*)gd, 0, sizeof (gd_t); /用0填充全局数据表gd g

20、d-bd = (bd_t*)(char*)gd - sizeof(bd_t); /bd_t结构的初始化: memset (gd-bd, 0, sizeof (bd_t); /用0填充(初始化)*gd-bd monitor_flash_len = _bss_start - _armboot_start; /取u-boot的 长度/*调用通用初始化函数*/* 顺序执行init_sequence数组中的初始化函数 */ for (init_fnc_ptr = init_sequence; *init_fnc_ptr; +init_fnc_ptr) if (*init_fnc_ptr)() != 0)

21、 hang (); /打印错误信息并死锁 /*init_sequence是init_fnc_t函数指针数组,这个数组包含了众多初始化函数,比如cpu_init,board_init等。*/ /* configure available FLASH banks */ /*配置可用的Flash */ size = flash_init (); /初始化 flash display_flash_config (size); /显示 flash 大小#ifdef CONFIG_VFD# ifndef PAGE_SIZE# define PAGE_SIZE 4096# endif /* * reserv

22、e memory for VFD display (always full pages)为VFD显示预留内存(整个页面) */ /* bss_end is defined in the board-specific linker script */* _armboot_start 在u-boot.lds链接脚本中定义 */ addr = (_bss_end + (PAGE_SIZE - 1) & (PAGE_SIZE - 1); size = vfd_setmem (addr); gd-fb_base = addr; #endif /* CONFIG_VFD */ /进入下一个界面#ifdef

23、 CONFIG_LCD# 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); size = lcd_setmem (addr); gd-fb_base = addr;#endif /* CONFIG_LCD *

24、/*内存分配的初始化(全局数据结构的初始化)*/ /* armboot_start is defined in the board-specific linker script */ mem_malloc_init (_armboot_start - CFG_MALLOC_LEN);/*将CFG_MALLOC_LEN 区域用memset清0(直接往目的地址写0)*/*初始化具体设备*/#if (CONFIG_COMMANDS & CFG_CMD_NAND) puts (NAND:); nand_init(); /* go init the NAND nand初始化*/#endif#ifdef

25、CONFIG_HAS_DATAFLASH AT91F_DataflashInit(); dataflash_print_info();#endif /* initialize environment 初始化环境*/ env_relocate ();/函数作用将环境变量从flash到RAM的拷贝#ifdef CONFIG_VFD /* must do this after the framebuffer is allocated 配置环境变量,重新定位*/ drv_vfd_init();#endif /* CONFIG_VFD */ /* IP Address */ /* 从环境变量中获取IP地

26、址 */ gd-bd-bi_ip_addr = getenv_IPaddr (ipaddr); /* MAC Address */* 以太网接口MAC 地址 */ int i; ulong reg; char *s, *e; uchar tmp64; i = getenv_r (ethaddr, tmp, sizeof (tmp); s = (i 0) ? tmp : NULL; for (reg = 0; reg bd-bi_enetaddrreg = s ? simple_strtoul (s, &e, 16) : 0; if (s) s = (*e) ? e + 1 : e; devic

27、es_init (); /* get the devices list going. */* 获取列表中的设备(外围设备初始化) */ jumptable_init (); /跳转表初始化 console_init_r (); /* fully init console as a device */* 完整地初始化控制台设备 */#if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations 其他平台由初始化决定*/ misc_init_r ();#endif /* enable excep

28、tions */*启用异常处理 */ enable_interrupts (); /* Perform network card initialisation if necessary */#ifdef CONFIG_DRIVER_CS8900 cs8900_get_enetaddr (gd-bd-bi_enetaddr);#endif#if defined(CONFIG_DRIVER_SMC91111) | defined (CONFIG_DRIVER_LAN91C96) if (getenv (ethaddr) smc_set_mac_addr(gd-bd-bi_enetaddr); #endif /* CONFIG_DRIVER_SMC91111 | CONFIG_DRIVER_LAN91C96 */ /* Initialize from environment */* 通过环境变量初始化 */ if (s = getenv (loadaddr) != NULL) load_addr = simple_strtoul (s, NULL, 16); #if (CONFIG_COMMANDS & CFG_CMD_NET) if (s = getenv (bootfile) != NULL) copy_filename (BootFile, s,

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1