RedBoot_init
RedBoot_init(_do_flash_init, RedBoot_INIT_FIRST);
RedBoot_init(load_flash_config, RedBoot_INIT_FIRST);
RedBoot_init(ide_init, RedBoot_INIT_FIRST);
RedBoot_init(_zlib_init, RedBoot_INIT_FIRST);
RedBoot_init(net_init, RedBoot_INIT_LAST);
void
net_init(void)
{
......
// Initialize all network devices
for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) {
if (t->init(t)) { // 我的ep9312开发板对应ep93xx_init[luther.gliethttp]
t->status = CYG_NETDEVTAB_STATUS_AVAIL;
} else {
// What to do if device init fails?
t->status = 0; // Device not [currently] available
}
}
}
CYG_HAL_TABLE_BEGIN( __NETDEVTAB__, netdev );
#define NETDEVTAB_ENTRY(_l,_name,_init,_instance) \
static bool _init(struct cyg_netdevtab_entry *tab); \
cyg_netdevtab_entry_t _l CYG_HAL_TABLE_ENTRY(netdev) = { \
_name, \
_init, \
_instance \
};
ecos-2.0/packages/devs/eth/arm/ep93xx/v2_0/src/if_ep93xx.c|166| NETDEVTAB_ENTRY(ep93xx_netdev,
NETDEVTAB_ENTRY(ep93xx_netdev,
"ep93xx",
ep93xx_init,
&ep93xx_sc);
ecos-2.0/packages/devs/eth/arm/ep93xx/v2_0/src/if_ep93xx.c|74| ep93xx_esa,
ecos-2.0/packages/devs/eth/arm/ep93xx/v2_0/src/if_ep93xx.c|82| "ep93xx_esa",
ecos-2.0/packages/redboot/v2_0/src/flash.c|1913| diag_printf("Request for config value '%s' - wrong type\n", key);
后来在启动时发现一个错误提示:
+ep93xx_init
... Scan for PHY units
PHY ID[1] = 15/f441, stat = 782d, control = 3000
After scan, phys_found 00000002, phys_good 00000002
Request for config value 'ep93xx_esa' - wrong type // 从这里看未找到ep93xx_esa定义
EP93xx - no EEPROM, static ESA, or RedBoot config option.
从代码中查看到ep93xx_esa定义,因为flash_get_config向config中追加内容的函数,只在2个地方对我们用户提供了接口,
一个是alias命令,另一个就是fconfig -i命令中config_init函数,
config_init函数会将__CONFIG_options_TAB_END__中的所有built-in的config追加到config中,
CYG_HAL_TABLE_BEGIN( __CONFIG_options_TAB__, RedBoot_config_options);
#define RedBoot_config_option(_t_,_n_,_e_,_ie_,_type_,_dflt_) \
struct config_option _config_option_##_n_ \
CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_config_options,_n_) = \
{#_n_,_t_,_e_,_ie_,_type_,(unsigned long)_dflt_};
ecos-2.0/packages/devs/eth/arm/ep93xx/v2_0/src/if_ep93xx.c
RedBoot_config_option("Set eth0 network hardware address [MAC]",
ep93xx_esa,
ALWAYS_ENABLED,
true,
CONFIG_BOOL,
false
);
RedBoot_config_option("eth0 network hardware address [MAC]",
ep93xx_esa_data,
"ep93xx_esa",
true,
CONFIG_ESA,
0
);
另外还有如下文件定义了RedBoot_config_option函数.
packages/redboot/v2_0/src/flash.c
packages/redboot/v2_0/src/net/net_io.c
我们可以使用
RedBoot> fconfig ep93xx_esa
来查看系统中定义了的config key值.
所以我们来重新初始化一次
RedBoot> fconfig -i
Initialize non-volatile configuration - continue (y/n)? y
Run script at boot: true
Boot script:
Enter script, terminate with empty line
>> fis load ramdisk
>> fis load zImage
>> exec -r 0x800000 -s 0x600000
>>
Boot script timeout (1000ms resolution): 3
Use BOOTP for network configuration: false
Gateway IP address: 192.168.1.1
Local IP address: 192.168.1.150
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.1.101
现在看到下面2个配置都出现了,这下正常了,呵呵[luther.gliethttp]
RedBoot> fconfig ep93xx_esa
ep93xx_esa: true
RedBoot> fconfig ep93xx_esa_data
ep93xx_esa_data: 0x00:0x00:0x00:0x00:0x30:0x3A
RedBoot>
好了现在,eth需要的2个变量都已经有了,来ping一个试试了[luther.gliethttp]
RedBoot> ping -h 192.168.1.1 -v
Network PING - from 192.168.1.150 to 192.168.1.1
seq: 1, time: 1 (ticks)
seq: 2, time: 1 (ticks)
seq: 3, time: 1 (ticks)
seq: 4, time: 1 (ticks)
seq: 5, time: 1 (ticks)
seq: 6, time: 1 (ticks)
seq: 7, time: 1 (ticks)
seq: 8, time: 1 (ticks)
seq: 9, time: 1 (ticks)
seq: 10, time: 1 (ticks)
PING - received 10 of 10 expected
阅读(2808) | 评论(0) | 转发(0) |