ping.h, ping.c: Minor change: allow to use ping sample with NO_SYS=1. You need to call the ping_send_now() in your application.

This commit is contained in:
fbernon 2008-07-08 10:11:53 +00:00
parent 3ab94a43bf
commit 73f3e94486
2 changed files with 15 additions and 2 deletions

View File

@ -91,6 +91,9 @@
/* ping variables */ /* ping variables */
static u16_t ping_seq_num; static u16_t ping_seq_num;
static u32_t ping_time; static u32_t ping_time;
#if !LWIP_SOCKET
static struct raw_pcb *pcb;
#endif /* LWIP_SOCKET */
#if NO_SYS #if NO_SYS
/* port-defined functions used for timer execution */ /* port-defined functions used for timer execution */
@ -281,8 +284,6 @@ ping_timeout(void *arg)
static void static void
ping_raw_init(void) ping_raw_init(void)
{ {
struct raw_pcb *pcb;
if (!(pcb = raw_new(IP_PROTO_ICMP))) { if (!(pcb = raw_new(IP_PROTO_ICMP))) {
return; return;
} }
@ -292,6 +293,14 @@ ping_raw_init(void)
sys_timeout(PING_DELAY, ping_timeout, pcb); sys_timeout(PING_DELAY, ping_timeout, pcb);
} }
#if NO_SYS
void
ping_send_now()
{
ping_timeout((void*)pcb);
}
#endif /* NO_SYS */
#endif /* LWIP_SOCKET */ #endif /* LWIP_SOCKET */
void void

View File

@ -3,4 +3,8 @@
void ping_init(void); void ping_init(void);
#if NO_SYS
void ping_send_now();
#endif /* NO_SYS */
#endif /* __PING_H__ */ #endif /* __PING_H__ */