nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] 13/31: SocketCAN removed NET_TCP and NET_PKT dependencies
Date Thu, 23 Apr 2020 13:31:18 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch SocketCAN
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit a99d7da952b4ad190ece292a07fd966e31c82539
Author: Peter van der Perk <peter.vanderperk@nxp.com>
AuthorDate: Thu Mar 5 16:36:56 2020 +0100

    SocketCAN removed NET_TCP and NET_PKT dependencies
---
 fs/vfs/fs_write.c         |  2 +-
 include/nuttx/mm/iob.h    |  2 +-
 net/can/can_send.c        |  2 +-
 net/devif/Make.defs       |  2 +-
 net/devif/devif.h         | 23 ++++++++++++++++++++++-
 net/devif/devif_pktsend.c |  2 +-
 6 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c
index 6e9a379..ef5f137 100644
--- a/fs/vfs/fs_write.c
+++ b/fs/vfs/fs_write.c
@@ -149,7 +149,7 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
 
   if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
     {
-#ifdef CONFIG_NET_TCP
+#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_CAN)
       /* Write to a socket descriptor is equivalent to send with flags == 0. */
 
       ret = nx_send(fd, buf, nbytes, 0);
diff --git a/include/nuttx/mm/iob.h b/include/nuttx/mm/iob.h
index 5903c50..e986105 100644
--- a/include/nuttx/mm/iob.h
+++ b/include/nuttx/mm/iob.h
@@ -221,7 +221,7 @@ enum iob_user_e
 #ifdef CONFIG_WIRELESS_BLUETOOTH
   IOBUSER_WIRELESS_BLUETOOTH,
 #endif
-#if defined(CONFIG_NET_CAN)
+#ifdef CONFIG_NET_CAN
   IOBUSER_NET_CAN_READAHEAD,
 #endif
   IOBUSER_GLOBAL,
diff --git a/net/can/can_send.c b/net/can/can_send.c
index 1d8677d..be621b4 100644
--- a/net/can/can_send.c
+++ b/net/can/can_send.c
@@ -119,7 +119,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
         {
           /* Copy the packet data into the device packet buffer and send it */
           //FIXME potentialy wrong function do we have a header??
-    	  devif_pkt_send(dev, pstate->snd_buffer, pstate->snd_buflen);
+    	  devif_can_send(dev, pstate->snd_buffer, pstate->snd_buflen);
           pstate->snd_sent = pstate->snd_buflen;
         }
 
diff --git a/net/devif/Make.defs b/net/devif/Make.defs
index 57aac89..492c7d8 100644
--- a/net/devif/Make.defs
+++ b/net/devif/Make.defs
@@ -67,7 +67,7 @@ NET_CSRCS += devif_pktsend.c
 endif
 
 ifeq ($(CONFIG_NET_CAN),y)
-NET_CSRCS += devif_pktsend.c
+NET_CSRCS += devif_cansend.c
 endif
 
 # Include network device interface build support
diff --git a/net/devif/devif.h b/net/devif/devif.h
index c54a68d..f924ebc 100644
--- a/net/devif/devif.h
+++ b/net/devif/devif.h
@@ -494,11 +494,32 @@ void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *buf,
  *
  ****************************************************************************/
 
-#if defined(CONFIG_NET_PKT) || defined(CONFIG_NET_CAN)
+#if defined(CONFIG_NET_PKT)
 void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
                     unsigned int len);
 #endif
 
+/****************************************************************************
+ * Name: devif_can_send
+ *
+ * Description:
+ *   Called from socket logic in order to send a raw packet in response to
+ *   an xmit or poll request from the network interface driver.
+ *
+ *   This is almost identical to calling devif_send() except that the data to
+ *   be sent is copied into dev->d_buf (vs. dev->d_appdata), since there is
+ *   no header on the data.
+ *
+ * Assumptions:
+ *   This function must be called with the network locked.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_NET_CAN)
+void devif_can_send(FAR struct net_driver_s *dev, FAR const void *buf,
+                    unsigned int len);
+#endif
+
 #undef EXTERN
 #ifdef __cplusplus
 }
diff --git a/net/devif/devif_pktsend.c b/net/devif/devif_pktsend.c
index a5d0515..465def2 100644
--- a/net/devif/devif_pktsend.c
+++ b/net/devif/devif_pktsend.c
@@ -45,7 +45,7 @@
 
 #include <nuttx/net/netdev.h>
 
-#if defined(CONFIG_NET_PKT) || defined(CONFIG_NET_CAN)
+#if defined(CONFIG_NET_PKT)
 
 /****************************************************************************
  * Pre-processor Definitions


Mime
View raw message