diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-05 23:04:16 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-05 23:04:16 +0000 |
commit | 13a1d731ec51a27983bc9e6fcaa841607a090764 (patch) | |
tree | 93b32ce5f98ff118a21eb072cf111e164fd38686 /nuttx/arch | |
parent | 4cfb76d4d59acfdadc0f50527533b9c129edde41 (diff) | |
download | px4-nuttx-13a1d731ec51a27983bc9e6fcaa841607a090764.tar.gz px4-nuttx-13a1d731ec51a27983bc9e6fcaa841607a090764.tar.bz2 px4-nuttx-13a1d731ec51a27983bc9e6fcaa841607a090764.zip |
Basic TCP send functional
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@371 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r-- | nuttx/arch/sim/src/up_uipdriver.c | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/nuttx/arch/sim/src/up_uipdriver.c b/nuttx/arch/sim/src/up_uipdriver.c index fbb8550de..3bd08c0b5 100644 --- a/nuttx/arch/sim/src/up_uipdriver.c +++ b/nuttx/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(); } |