summaryrefslogtreecommitdiff
path: root/nuttx/net/uip/uip-poll.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 20:38:12 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 20:38:12 +0000
commite7d4d115566c113f2cba32f16857ea5e90c03be0 (patch)
treeacc29e9bf0f255f5ade7780723e9101f4dcf5580 /nuttx/net/uip/uip-poll.c
parenta376ebf2a0c8b3b2d50eeb6be645311eb27579dd (diff)
downloadpx4-nuttx-e7d4d115566c113f2cba32f16857ea5e90c03be0.tar.gz
px4-nuttx-e7d4d115566c113f2cba32f16857ea5e90c03be0.tar.bz2
px4-nuttx-e7d4d115566c113f2cba32f16857ea5e90c03be0.zip
sendto.c
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@868 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip/uip-poll.c')
-rw-r--r--nuttx/net/uip/uip-poll.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/nuttx/net/uip/uip-poll.c b/nuttx/net/uip/uip-poll.c
index 1e8483ea6..d05e9f58f 100644
--- a/nuttx/net/uip/uip-poll.c
+++ b/nuttx/net/uip/uip-poll.c
@@ -70,6 +70,31 @@
*
****************************************************************************/
+#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
+static inline int uip_pollicmp(struct uip_driver_s *dev, uip_poll_callback_t callback)
+{
+ /* Perform the UDP TX poll */
+
+ uip_icmppoll(dev);
+
+ /* Call back into the driver */
+
+ return callback(dev);
+}
+#endif /* CONFIG_NET_UDP */
+
+/****************************************************************************
+ * Function: uip_polludpconnections
+ *
+ * Description:
+ * Poll all UDP connections for available packets to send.
+ *
+ * Assumptions:
+ * This function is called from the CAN device driver and may be called from
+ * the timer interrupt/watchdog handle level.
+ *
+ ****************************************************************************/
+
#ifdef CONFIG_NET_UDP
static int uip_polludpconnections(struct uip_driver_s *dev,
uip_poll_callback_t callback)
@@ -92,8 +117,6 @@ static int uip_polludpconnections(struct uip_driver_s *dev,
return bstop;
}
-#else
-# define uip_polludpconnections(dev,callback) (0)
#endif /* CONFIG_NET_UDP */
/****************************************************************************
@@ -210,9 +233,19 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback)
bstop = uip_polltcpconnections(dev, callback);
if (!bstop)
{
+#ifdef CONFIG_NET_UDP
/* Traverse all of the allocated UDP connections and perform the poll action */
bstop = uip_polludpconnections(dev, callback);
+ if (!bstop)
+#endif
+ {
+#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
+ /* Traverse all of the tasks waiting to send an ICMP ECHO request */
+
+ bstop = uip_pollicmp(dev, callback);
+#endif
+ }
}
return bstop;
@@ -262,7 +295,17 @@ int uip_timer(struct uip_driver_s *dev, uip_poll_callback_t callback, int hsec)
{
/* Traverse all of the allocated UDP connections and perform the poll action */
+#ifdef CONFIG_NET_UDP
bstop = uip_polludpconnections(dev, callback);
+ if (!bstop)
+#endif
+ {
+#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
+ /* Traverse all of the tasks waiting to send an ICMP ECHO request */
+
+ bstop = uip_pollicmp(dev, callback);
+#endif
+ }
}
return bstop;