diff --git a/configs/clicker2-stm32/Kconfig b/configs/clicker2-stm32/Kconfig index 572a3498ff7..06af60e12c6 100644 --- a/configs/clicker2-stm32/Kconfig +++ b/configs/clicker2-stm32/Kconfig @@ -166,4 +166,13 @@ config CLICKER2_STM32_SYSLOG_FILE_DELAY endif # CLICKER2_STM32_SYSLOG_FILE +config CLICKER2_STM32_RNDIS_MACADDR + hex "RNDIS MAC address" + default 0xfadedeadbeef + depends on RNDIS + ---help--- + If the hardware has no built-in MAC address then the fixed, + software-assigned MAC address MAC address must provided + with this selection. + endif # ARCH_BOARD_CLICKER2_STM32 diff --git a/configs/clicker2-stm32/src/stm32_bringup.c b/configs/clicker2-stm32/src/stm32_bringup.c index ec3abe242c0..7b0ba27bec4 100644 --- a/configs/clicker2-stm32/src/stm32_bringup.c +++ b/configs/clicker2-stm32/src/stm32_bringup.c @@ -52,9 +52,24 @@ # include #endif +#ifdef CONFIG_RNDIS +# include +# include +#endif + #include "stm32.h" #include "clicker2-stm32.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_RNDIS +# ifndef CONFIG_CLICKER2_STM32_RNDIS_MACADDR +# define CONFIG_CLICKER2_STM32_RNDIS_MACADDR 0xfadedeadbeef +# endif +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -168,6 +183,25 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_RNDIS + uint8_t mac[IFHWADDRLEN]; + + mac[0] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 5)) & 0xff; + mac[1] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 4)) & 0xff; + mac[2] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 3)) & 0xff; + mac[3] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 2)) & 0xff; + mac[4] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 1)) & 0xff; + mac[5] = (CONFIG_CLICKER2_STM32_RNDIS_MACADDR >> (8 * 0)) & 0xff; + + /* Register USB RNDIS Driver */ + + ret = usbdev_rndis_initialize(mac); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: usbdev_rndis_initialize() failed %d\n", ret); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/clicker2-stm32/src/stm32_mrf24j40.c b/configs/clicker2-stm32/src/stm32_mrf24j40.c index f8464382a40..e3732fefd98 100644 --- a/configs/clicker2-stm32/src/stm32_mrf24j40.c +++ b/configs/clicker2-stm32/src/stm32_mrf24j40.c @@ -228,9 +228,7 @@ static int stm32_mrf24j40_devsetup(FAR struct stm32_priv_s *priv) FAR struct ieee802154_radio_s *radio; MACHANDLE mac; FAR struct spi_dev_s *spi; -#ifdef CONFIG_IEEE802154_NETDEV int ret; -#endif /* Configure the interrupt pin */