?? testping.c
字號:
#include "debug.h"
#include "true_false.h"
#include "stdlib.h"
#include "typedef.h"
#include "mem_man.h"
#include "rtl8019.h"
#include "netif.h"
#include "etherif.h"
#include "ip.h"
#include "arp.h"
#include "utilities.h"
#include "tcp.h"
#include "icmp.h"
u8_t myip[20]={"192.168.2.13"},hisip[20]={"192.168.2.12"};
/*這份代碼經(jīng)源碼格式軟件格式化過
yang_hx@neusoft.com */
void do_ping(u8_t*my_ip,u8_t*his_ip,u32_t lenth,u32_t count)
{
u8_t tmr ;
//testtmr();
for(;count>0;--count)
{
//Uart_Printf( "PINGOut(iptoul(ips),iptoul(ipd),1000);" ) ;
PINGOut(iptoul(my_ip),iptoul(his_ip),lenth);
for(tmr=0;tmr<100;tmr++)
{
wait_ms(10);
if(get_state()==PING_OK)
break ;
}
if(get_state()==PING_OK)
{
if(tmr==0)
{
Uart_Printf("\nReply from %s: byte=%d time<%dms",hisip,lenth,10);
}
else
{
Uart_Printf("\nReply from %s: byte=%d time=%dms",hisip,lenth,tmr*10);
}
}
else
{
Uart_Printf("\nRequst timed out.");
}
}
}
void ping(void)
{
u32_t cnt,len ;
while(1)
{
Uart_Printf("\npls input the IP address you want to ping\n==>");
Uart_GetString(hisip);
if(iptoul(hisip)==0)break ;
Uart_Printf("pls input the times you want to ping\n==>");
cnt=Uart_GetIntNum();
Uart_Printf("pls input the lenth of the package\n==>");
len=Uart_GetIntNum();
do_ping(myip,hisip,len,cnt);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -