switch back to RAW interface and some cosmetic changes

This commit is contained in:
Stefan Lankes 2011-09-07 10:07:22 +02:00
parent 24ea129456
commit 4f5e5e2449

View file

@ -55,7 +55,7 @@
#include <lwip/ip.h>
#if LWIP_SOCKET
#define PING_USE_SOCKETS 1
#define PING_USE_SOCKETS 0
#endif
#if PING_USE_SOCKETS
@ -102,7 +102,7 @@
#endif
/* ping variables */
static u16_t ping_seq_num;
static u16_t ping_seq_num = 0;
static u32_t ping_time;
#if !PING_USE_SOCKETS
static struct raw_pcb *ping_pcb;
@ -216,7 +216,7 @@ ping_thread(void *arg)
ping_target = PING_TARGET;
if (ping_send(s, &ping_target) == ERR_OK) {
LWIP_DEBUGF( PING_DEBUG, ("ping: send on core %d to " , CORE_ID));
LWIP_DEBUGF( PING_DEBUG, ("ping: send to "));
ip_addr_debug_print(PING_DEBUG, &ping_target);
LWIP_DEBUGF( PING_DEBUG, ("\n"));
@ -293,6 +293,7 @@ ping_send(struct raw_pcb *raw, ip_addr_t *addr)
static void
ping_timeout(void *arg)
{
static unsigned counter = 0;
struct raw_pcb *pcb = (struct raw_pcb*)arg;
ip_addr_t ping_target = PING_TARGET;
@ -300,7 +301,9 @@ ping_timeout(void *arg)
ping_send(pcb, &ping_target);
sys_timeout(PING_DELAY, ping_timeout, pcb);
counter++;
if (counter < 5)
sys_timeout(PING_DELAY, ping_timeout, pcb);
}
static void
@ -314,13 +317,15 @@ ping_raw_init(void)
sys_timeout(PING_DELAY, ping_timeout, ping_pcb);
}
#if 0
void
ping_send_now()
ping_send_now(void)
{
ip_addr_t ping_target = PING_TARGET;
LWIP_ASSERT("ping_pcb != NULL", ping_pcb != NULL);
ping_send(ping_pcb, &ping_target);
}
#endif
#endif /* PING_USE_SOCKETS */