You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/06/15 13:23:44 UTC

[incubator-nuttx-apps] 01/02: netlib: add AF_CAN family and CONFIG_NET_CAN support

This is an automated email from the ASF dual-hosted git repository.

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

commit 839b3530d45bcec8c5933aae2dc5ae32630bfd83
Author: Peter van der Perk <pe...@nxp.com>
AuthorDate: Mon Jun 15 10:52:34 2020 +0200

    netlib: add AF_CAN family and CONFIG_NET_CAN support
---
 include/netutils/netlib.h  |  4 ++++
 netutils/netinit/netinit.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/netutils/netlib.h b/include/netutils/netlib.h
index 8ddcde7..04c87e7 100644
--- a/include/netutils/netlib.h
+++ b/include/netutils/netlib.h
@@ -98,6 +98,8 @@
 #  define NETLIB_SOCK_FAMILY  AF_LOCAL
 #elif defined(CONFIG_NET_PKT)
 #  define NETLIB_SOCK_FAMILY  AF_PACKET
+#elif defined(CONFIG_NET_CAN)
+#  define NETLIB_SOCK_FAMILY  AF_CAN
 #elif defined(CONFIG_NET_IEEE802154)
 #  define NETLIB_SOCK_FAMILY  AF_IEEE802154
 #elif defined(CONFIG_WIRELESS_PKTRADIO)
@@ -152,6 +154,8 @@
 #  endif
 #elif NETLIB_SOCK_FAMILY == AF_PACKET
 #  define NETLIB_SOCK_TYPE SOCK_RAW
+#elif NETLIB_SOCK_FAMILY == AF_CAN
+#  define NETLIB_SOCK_TYPE SOCK_RAW
 #elif NETLIB_SOCK_FAMILY == AF_IEEE802154
 #  define NETLIB_SOCK_TYPE SOCK_DGRAM
 #elif NETLIB_SOCK_FAMILY == AF_BLUETOOTH
diff --git a/netutils/netinit/netinit.c b/netutils/netinit/netinit.c
index 0bc5346..c2ae868 100644
--- a/netutils/netinit/netinit.c
+++ b/netutils/netinit/netinit.c
@@ -100,6 +100,7 @@
 #  undef CONFIG_NET_LOCAL
 #  undef CONFIG_NET_USRSOCK
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_6LOWPAN)
 #  undef CONFIG_NET_SLIP
@@ -107,26 +108,34 @@
 #  undef CONFIG_NET_LOCAL
 #  undef CONFIG_NET_USRSOCK
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_SLIP)
 #  undef CONFIG_NET_TUN
 #  undef CONFIG_NET_LOCAL
 #  undef CONFIG_NET_USRSOCK
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_TUN)
 #  undef CONFIG_NET_LOCAL
 #  undef CONFIG_NET_USRSOCK
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_LOCAL)
 #  undef CONFIG_NET_USRSOCK
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_USRSOCK)
 #  undef CONFIG_NET_IEEE802154
+#  undef CONFIG_NET_CAN
 #  undef CONFIG_NET_LOOPBACK
 #elif defined(CONFIG_NET_IEEE802154)
+#  undef CONFIG_NET_CAN
+#  undef CONFIG_NET_LOOPBACK
+#elif defined(CONFIG_NET_CAN)
 #  undef CONFIG_NET_LOOPBACK
 #endif
 
@@ -189,6 +198,9 @@
 #elif defined(CONFIG_NET_LOCAL)
 #  define NET_DEVNAME "lo"
 #  define NETINIT_HAVE_NETDEV
+#elif defined(CONFIG_NET_CAN)
+#  define NET_DEVNAME "can0"
+#  define NETINIT_HAVE_NETDEV
 #endif
 
 /* If we have no network device (perhaps only USRSOCK, local loopback, or