1、如果要使用NDK,那你所建立的ccs工程必须是跑sys/bios的工程。
2、如果想看6678的网络demo,那么其demo路径为:C:\ti\mcsdk_2_01_02_06\examples\ndk\helloWorld
3、DSP的本地IP主要在helloworld.c中的以下代码段设置 - char *HostName = "tidsp";
- char *LocalIPAddr = "192.168.2.100";
- char *LocalIPMask = "255.255.255.0"; // Not used when using DHCP
- char *GatewayIP = "192.168.2.101"; // Not used when using DHCP
- char *DomainName = "demo.net"; // Not used when using DHCP
- char *DNSServer = "0.0.0.0"; // Used when set to anything but zero
复制代码
a4、设置DHCP还是静态IP,主要体现在helloworld.c中的以下代码段: // If the IP address is specified, manually configure IP and Gateway - <p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "="">#if defined(_SCBP6618X_) || defined(_EVMTCI6614_) || defined(DEVICE_K2H) || defined(DEVICE_K2K)
- /* SCBP6618x, EVMTCI6614, EVMK2H, EVMK2K always uses DHCP */
- if (0)
- #else
- if (!platform_get_switch_state(1))
- #endif
- {
- CI_IPNET NA;
- CI_ROUTE RT;
- IPN IPTmp;</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Setup manual IP address
- bzero( &NA, sizeof(NA) );
- NA.IPAddr = inet_addr(LocalIPAddr);
- NA.IPMask = inet_addr(LocalIPMask);
- strcpy( NA.Domain, DomainName );
- NA.NetType = 0;</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Add the address to interface 1
- CfgAddEntry( hCfg, CFGTAG_IPNET, 1, 0,
- sizeof(CI_IPNET), (UINT8 *)&NA, 0 );</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Add the default gateway. Since it is the default, the
- // destination address and mask are both zero (we go ahead
- // and show the assignment for clarity).
- bzero( &RT, sizeof(RT) );
- RT.IPDestAddr = 0;
- RT.IPDestMask = 0;
- RT.IPGateAddr = inet_addr(GatewayIP);</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Add the route
- CfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0,
- sizeof(CI_ROUTE), (UINT8 *)&RT, 0 );</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // 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 );
- }
- // Else we specify DHCP
- else
- {
- CI_SERVICE_DHCPC dhcpc;</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Specify DHCP Service on IF-1
- bzero( &dhcpc, sizeof(dhcpc) );
- dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID;
- dhcpc.cisargs.IfIdx = 1;
- dhcpc.cisargs.pCbSrv = &ServiceReport;
- CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
- sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );
- }</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "="">其中switch_state是拨码开</font></font></p>
复制代码
关,有的开发板上直接是固定的,官方板上该开关可以拨动。 5、可以在以下代码段创建socket进程,用来传输数据: - <p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "="">static void NetworkOpen()
- {</font></font></p><p style="line-height: 28px;"><font color="rgb(51, 51, 51)"><font face="" "=""> // Create our local server
- // 下面这个函数的第三个参数是接收进程的端口设定
- // hHello = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_hello,
- // OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
- hSend = TaskCreate ( dtask_udp_hello, "UDP_Send", OS_TASKPRIHIGH,
- OS_TASKSTKNORM, 0, 0, 0 );
- hSend = TaskCreate ( task_sendto_PC, "UDP_Send", OS_TASKPRINORM,
- OS_TASKSTKNORM, 0, 0, 0 );
- // 当然也可以创建接收进程啦
- }</font></font></p>
复制代码
注意:必须在发送/接收进程执行任务完成之后执行fdCloseSession(TaskSelf());否则影响堆栈分配
6、至于task_sendto_PC怎么写,那就是socket编程的事情啦!
|