Merged in antmerlino/nuttx/clicker2-stm32-rndis (pull request #540)
clicker2-stm32: Adds support for USB RNDIS device Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
commit
b8f38fd3de
|
@ -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
|
||||
|
|
|
@ -52,9 +52,24 @@
|
|||
# include <nuttx/usb/usbmonitor.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RNDIS
|
||||
# include <nuttx/usb/rndis.h>
|
||||
# include <net/if.h>
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue