您好,
首先非常感谢您的回答。我所碰到的问题是MAC address 出错,是不是因为两个核的NDK所使用的EMAC channel 相同造成的呢?另外,我在NDK USER'S GUIDE 和 NDK software programmer's reference guide 两篇文档中好像没发现有设置EMAC channel 的API 呀。我把我的代码和错误信息贴在下面,还想麻烦您看一下,指出问题所在。
使用的核为 CORE_0 和 CORE_1 ,两个核单独启动 即: Ipc.procSync = Ipc.ProcSync_NONE; // in file.cfg
错误信息如下:
[C66xx_0] EVM in StaticIP mode at 192.168.0.218
[C66xx_0] QMSS successfully initialized[C66xx_0] CPPI successfully initialized[C66xx_0] PASS successfully initialized[C66xx_0] Ethernet subsystem successfully initialized[C66xx_0] eventId : 48 and vectId : 7[C66xx_0] Registration of the EMAC Successful, waiting for link up ..
[C66xx_0] run in daemon[C66xx_0] receive :[C66xx_1] QMSS successfully initialized[C66xx_1] CPPI successfully initialized[C66xx_1] PASS successfully initialized[C66xx_1] Ethernet subsystem successfully initialized[C66xx_1] eventId : 48 and vectId : 7[C66xx_1] Timeout waiting for reply from PA to Pa_addMac command
[C66xx_1] Add_MACAddress failed[C66xx_1] Error: Unable to register the EMAC
CORE_0 网络配置代码:
int RunUDP_sever()
{
HANDLE hCfg;
CI_IPNET NA;
IPN IPTmp;
int nStatus, nRecv;
char *HostName = "UDP_SEVER_0";
char *DomainName = "demo0.net"; /* Not used when using DHCP */
char *DNSServer = "0.0.0.0"; /* Used when set to anything but zero */
nStatus = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
if(nStatus != NC_OPEN_SUCCESS)
{
#ifdef UDP_SEVER_DEBUG
printf("NC_SystemOpen Failed (%d)\n",nStatus);
#endif
goto close_n_exit;
}
hCfg = CfgNew();
if( !hCfg )
{
#ifdef UDP_SEVER_DEBUG
printf("Unable to create configuration\n");
#endif
goto close_n_exit;
}
/* Validate the length of the supplied names */
if( strlen( DomainName ) >= CFG_DOMAIN_MAX ||
strlen( HostName ) >= CFG_HOSTNAME_MAX )
{
#ifdef UDP_SEVER_DEBUG
printf("Domain or Host Name too long\n");
#endif
goto close_n_exit;
}
/* Add our global hostname to hCfg (to be claimed in all connected domains) */
CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(HostName), (UINT8 *)HostName, 0 );
/* Setup an IP address to this EVM */
bzero( &NA, sizeof(NA) );
NA.IPAddr = inet_addr("192.168.0.218");
NA.IPMask = inet_addr("255.255.255.0");
strcpy( NA.Domain, DomainName );
/* Add the address to interface 1 */
CfgAddEntry( hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0 );
/* Manually add the DNS server when specified */
IPTmp = inet_addr(DNSServer);
if( IPTmp )
CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );
/* Set debug message level */
nStatus = DBG_WARN;
CfgAddEntry( hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL, CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&nStatus, 0 );
// UDP Receive limit
nRecv = 8192;
CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&nRecv, 0 );
do
{
nStatus = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
} while( nStatus > 0 );
#ifdef UDP_SEVER_DEBUG
platform_write ("Shutting things down\n");
#endif
close_n_exit:
CfgFree( hCfg );
NC_SystemClose();
return 0;
}
static HANDLE hDaemon=0;
static void NetworkOpen()
{
hDaemon = DaemonNew( SOCK_DGRAM, 0, 1062, RecvImg, OS_TASKPRIHIGH, OS_TASKSTKNORM, 0, 1 );//7//OS_TASKPRINORM
}
CORE_1网络配置代码:
int UDP_Sever()
{
HANDLE hCfg;
CI_IPNET NA;
IPN IPTmp;
int nStatus, nRecv;
char *HostName = "UDP_SEVER";
char *DomainName = "demo.net"; /* Not used when using DHCP */
char *DNSServer = "0.0.0.0"; /* Used when set to anything but zero */
nStatus = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
if(nStatus != NC_OPEN_SUCCESS)
{
#ifdef UDP_SEVER_DEBUG
printf("NC_SystemOpen Failed (%d)\n",nStatus);
#endif
goto close_n_exit;
}
hCfg = CfgNew();
if( !hCfg )
{
#ifdef UDP_SEVER_DEBUG
printf("Unable to create configuration\n");
#endif
goto close_n_exit;
}
/* Validate the length of the supplied names */
if( strlen( DomainName ) >= CFG_DOMAIN_MAX ||
strlen( HostName ) >= CFG_HOSTNAME_MAX )
{
#ifdef UDP_SEVER_DEBUG
printf("Domain or Host Name too long\n");
#endif
goto close_n_exit;
}
/* Add our global hostname to hCfg (to be claimed in all connected domains) */
CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(HostName), (UINT8 *)HostName, 0 );
/* Setup an IP address to this EVM */
bzero( &NA, sizeof(NA) );
NA.IPAddr = inet_addr("192.168.0.217");
NA.IPMask = inet_addr("255.255.255.0");
strcpy( NA.Domain, DomainName );
/* Add the address to interface 1 */
CfgAddEntry( hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0 );
/* Manually add the DNS server when specified */
IPTmp = inet_addr(DNSServer);
if( IPTmp )
CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );
/* Set debug message level */
nStatus = DBG_WARN;
CfgAddEntry( hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL, CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&nStatus, 0 );
// UDP Receive limit
nRecv = 8192;
CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&nRecv, 0 );
do
{
nStatus = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
} while( nStatus > 0 );
#ifdef UDP_SEVER_DEBUG
platform_write ("Shutting things down\n");
#endif
close_n_exit:
CfgFree( hCfg );
NC_SystemClose();
return 0;
}
static HANDLE hDaemon=0;
static void NetworkOpen()
{
// Create our local server
hHello = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_hello, OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
}
Thomas Yang1:
你好
请单步跟踪nimu_eth.c中
Add_MACAddress函数和paReturn_t Pa_addMac 获取具体失败的信息
谢谢!
weifeng guo:
回复 Thomas Yang1:
非常感谢Thomas Yang 的解答。