From 37637344e44bb6abaebd738d2dda14b206ab3944 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 5 Nov 2007 23:04:16 +0000 Subject: [PATCH] Basic TCP send functional git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@371 42af7a65-404d-4744-a932-0658087f49c3 --- arch/sim/src/up_uipdriver.c | 53 ++++++++++++++----------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/arch/sim/src/up_uipdriver.c b/arch/sim/src/up_uipdriver.c index fbb8550de8..3bd08c0b51 100644 --- a/arch/sim/src/up_uipdriver.c +++ b/arch/sim/src/up_uipdriver.c @@ -112,6 +112,25 @@ static inline int uip_comparemac(struct uip_eth_addr *paddr1, struct uip_eth_add } #endif +static int sim_uiptxpoll(struct uip_driver_s *dev) +{ + /* If the polling resulted in data that should be sent out on the network, + * the field d_len is set to a value > 0. + */ + + if (g_sim_dev.d_len > 0) + { + uip_arp_out(&g_sim_dev); + tapdev_send(g_sim_dev.d_buf, g_sim_dev.d_len); + } + + /* If zero is returned, the polling will continue until all connections have + * been examined. + */ + + return 0; +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -182,39 +201,7 @@ void uipdriver_loop(void) else if (timer_expired(&g_periodic_timer)) { timer_reset(&g_periodic_timer); - for(i = 0; i < UIP_CONNS; i++) - { - uip_tcppoll(&g_sim_dev,i); - - /* If the above function invocation resulted in data that - * should be sent out on the network, the global variable - * d_len is set to a value > 0. - */ - - if (g_sim_dev.d_len > 0) - { - uip_arp_out(&g_sim_dev); - tapdev_send(g_sim_dev.d_buf, g_sim_dev.d_len); - } - } - -#ifdef CONFIG_NET_UDP - for(i = 0; i < UIP_UDP_CONNS; i++) - { - uip_udppoll(&g_sim_dev,i); - - /* If the above function invocation resulted in data that - * should be sent out on the network, the global variable - * d_len is set to a value > 0. - */ - - if (g_sim_dev.d_len > 0) - { - uip_arp_out(&g_sim_dev); - tapdev_send(g_sim_dev.d_buf, g_sim_dev.d_len); - } - } -#endif /* CONFIG_NET_UDP */ + uip_poll(&g_sim_dev, sim_uiptxpoll, UIP_TIMER); } sched_unlock(); }