You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/01/10 10:03:38 UTC

[incubator-nuttx] 04/21: init cdc ecm driver and rndis driver; some cleanup

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

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

commit 508f5ac0e6ef357ec7b5177e03802028df11f1fb
Author: Adam Feuer <ad...@starcat.io>
AuthorDate: Wed Jan 8 17:39:05 2020 -0800

    init cdc ecm driver and rndis driver; some cleanup
---
 .../arm/sama5/sama5d3-xplained/src/sam_bringup.c   | 57 ++++++++++++----------
 1 file changed, 32 insertions(+), 25 deletions(-)

diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c b/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c
index d5617d1..6da4ebc 100755
--- a/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c
+++ b/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c
@@ -54,12 +54,17 @@
 #include <nuttx/i2c/i2c_master.h>
 
 #include "sam_twi.h"
-#include "sama5d4-ek.h"
+#include "sama5d3-xplained.h"
 
 #ifdef HAVE_ROMFS
 #  include <arch/board/boot_romfsimg.h>
 #endif
 
+#ifdef CONFIG_NET_CDCECM
+#  include <nuttx/usb/cdcecm.h>
+#  include <net/if.h>
+#endif
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -151,26 +156,6 @@ int sam_bringup(void)
 
   sam_i2ctool();
 
-#ifdef HAVE_NAND
-  /* Initialize the NAND driver */
-
-  ret = sam_nand_automount(NAND_MINOR);
-  if (ret < 0)
-    {
-      _err("ERROR: sam_nand_automount failed: %d\n", ret);
-    }
-#endif
-
-#ifdef HAVE_AT25
-  /* Initialize the AT25 driver */
-
-  ret = sam_at25_automount(AT25_MINOR);
-  if (ret < 0)
-    {
-      _err("ERROR: sam_at25_automount failed: %d\n", ret);
-    }
-#endif
-
 #ifdef HAVE_HSMCI
 #ifdef CONFIG_SAMA5_HSMCI0
   /* Initialize the HSMCI0 driver */
@@ -352,10 +337,32 @@ int sam_bringup(void)
     }
 #endif
 
-  /* If we got here then perhaps not all initialization was successful, but
-   * at least enough succeeded to bring-up NSH with perhaps reduced
-   * capabilities.
-   */
+#if defined(CONFIG_RNDIS)
+  /* Set up a MAC address for the RNDIS device. */
+
+  uint8_t mac[6];
+  mac[0] = 0xa0; /* TODO */
+  mac[1] = (CONFIG_NETINIT_MACADDR_2 >> (8 * 0)) & 0xff;
+  mac[2] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 3)) & 0xff;
+  mac[3] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 2)) & 0xff;
+  mac[4] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 1)) & 0xff;
+  mac[5] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 0)) & 0xff;
+  usbdev_rndis_initialize(mac);
+#endif
+
+#ifdef CONFIG_NET_CDCECM
+  ret = cdcecm_initialize(0, NULL);
+  if (ret < 0)
+    {
+      _err("ERROR: cdcecm_initialize() failed: %d\n", ret);
+    }
+#endif
+
+
+    /* If we got here then perhaps not all initialization was successful, but
+     * at least enough succeeded to bring-up NSH with perhaps reduced
+     * capabilities.
+     */
 
   UNUSED(ret);
   return OK;