- 积分
- 552
贡献3960
飞刀22 FD
注册时间2015-12-16
在线时间0 小时
|
发表于 2012-7-27 21:10:59
|
显示全部楼层
int dram_init(void)
{
DECLARE_GLOBAL_DATA_PTR;
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
return 0;
}
我寻找根源:
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
再看看gd_t:
typedef struct global_data {
bd_t *bd;
unsigned long flags;
unsigned long baudrate;
unsigned long have_console; /* serial_init() was called */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
unsigned long fb_base; /* base address of frame buffer */
#ifdef CONFIG_VFD
unsigned char vfd_type; /* display type */
#endif
#ifdef CONFIG_FSL_ESDHC
unsigned long sdhc_clk;
#endif
#if 0
unsigned long cpu_clk; /* CPU clock in Hz! */
unsigned long bus_clk;
phys_size_t ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
#endif
void **jt; /* jump table */
} gd_t;
这个函数式正确的,这里告诉我们*gd存入r8寄存器中,并且是*gd专用,因为u-boot的所有信息(内存大小、ID等等)都保存在*gd中。
如果你真心想学习u-boot,http://wenku.baidu.com/view/ae78a00390c69ec3d5bb75ce.html。你要最新版本的话,可以发邮件给我。 |
|