From 6d4c99f2aa2033948a6a64f383e59a5931fb0581 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 11 Jun 2019 11:18:18 +0000 Subject: [PATCH] Merged in masayuki2009/nuttx.nuttx/fix_macaddr_for_rndis (pull request #889) configs: Fix mac address settings for rndis Recently CONFIG_NETINIT_MACADDR_2 and CONFIG_NETINIT_MACADDR_1 were newly introduced instead of CONFIG_NETINIT_MACADDR. This PR conforms to this change. Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- configs/lc823450-xgevk/src/lc823450_bringup.c | 12 ++++++------ configs/omnibusf4/src/stm32_bringup.c | 12 ++++++------ configs/stm32f4discovery/rndis/defconfig | 1 + configs/stm32f4discovery/src/stm32_bringup.c | 12 ++++++------ configs/viewtool-stm32f107/src/stm32_max3421e.c | 12 ++++++------ 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/configs/lc823450-xgevk/src/lc823450_bringup.c b/configs/lc823450-xgevk/src/lc823450_bringup.c index 647aaab262..bc86875e99 100644 --- a/configs/lc823450-xgevk/src/lc823450_bringup.c +++ b/configs/lc823450-xgevk/src/lc823450_bringup.c @@ -116,14 +116,14 @@ int lc823450_bringup(void) lc823450_wm8776initialize(0); #endif -#if defined(CONFIG_RNDIS) && defined(CONFIG_NETINIT_MACADDR) +#if defined(CONFIG_RNDIS) uint8_t mac[6]; mac[0] = 0xa0; /* TODO */ - mac[1] = (CONFIG_NETINIT_MACADDR >> (8 * 4)) & 0xff; - mac[2] = (CONFIG_NETINIT_MACADDR >> (8 * 3)) & 0xff; - mac[3] = (CONFIG_NETINIT_MACADDR >> (8 * 2)) & 0xff; - mac[4] = (CONFIG_NETINIT_MACADDR >> (8 * 1)) & 0xff; - mac[5] = (CONFIG_NETINIT_MACADDR >> (8 * 0)) & 0xff; + 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 diff --git a/configs/omnibusf4/src/stm32_bringup.c b/configs/omnibusf4/src/stm32_bringup.c index 5801a21cf2..6eda07ff22 100644 --- a/configs/omnibusf4/src/stm32_bringup.c +++ b/configs/omnibusf4/src/stm32_bringup.c @@ -306,16 +306,16 @@ int stm32_bringup(void) } #endif -#if defined(CONFIG_RNDIS) && defined(CONFIG_NETINIT_MACADDR) +#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 >> (8 * 4)) & 0xff; - mac[2] = (CONFIG_NETINIT_MACADDR >> (8 * 3)) & 0xff; - mac[3] = (CONFIG_NETINIT_MACADDR >> (8 * 2)) & 0xff; - mac[4] = (CONFIG_NETINIT_MACADDR >> (8 * 1)) & 0xff; - mac[5] = (CONFIG_NETINIT_MACADDR >> (8 * 0)) & 0xff; + 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 diff --git a/configs/stm32f4discovery/rndis/defconfig b/configs/stm32f4discovery/rndis/defconfig index f7a60d8012..01aa71f15f 100644 --- a/configs/stm32f4discovery/rndis/defconfig +++ b/configs/stm32f4discovery/rndis/defconfig @@ -47,6 +47,7 @@ CONFIG_NETDEVICES=y CONFIG_NETINIT_DHCPC=y CONFIG_NETINIT_DRIPADDR=0x0 CONFIG_NETINIT_MACADDR_1=0xdeadcafe +CONFIG_NETINIT_MACADDR_2=0x00e0 CONFIG_NETINIT_NETMASK=0x0 CONFIG_NETINIT_NOMAC=y CONFIG_NETINIT_THREAD=y diff --git a/configs/stm32f4discovery/src/stm32_bringup.c b/configs/stm32f4discovery/src/stm32_bringup.c index f9ff25c940..801cfa8d37 100644 --- a/configs/stm32f4discovery/src/stm32_bringup.c +++ b/configs/stm32f4discovery/src/stm32_bringup.c @@ -427,14 +427,14 @@ int stm32_bringup(void) } #endif -#if defined(CONFIG_RNDIS) && defined(CONFIG_NETINIT_MACADDR) +#if defined(CONFIG_RNDIS) uint8_t mac[6]; mac[0] = 0xa0; /* TODO */ - mac[1] = (CONFIG_NETINIT_MACADDR >> (8 * 4)) & 0xff; - mac[2] = (CONFIG_NETINIT_MACADDR >> (8 * 3)) & 0xff; - mac[3] = (CONFIG_NETINIT_MACADDR >> (8 * 2)) & 0xff; - mac[4] = (CONFIG_NETINIT_MACADDR >> (8 * 1)) & 0xff; - mac[5] = (CONFIG_NETINIT_MACADDR >> (8 * 0)) & 0xff; + 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 diff --git a/configs/viewtool-stm32f107/src/stm32_max3421e.c b/configs/viewtool-stm32f107/src/stm32_max3421e.c index 12bd225268..c19fd7b233 100644 --- a/configs/viewtool-stm32f107/src/stm32_max3421e.c +++ b/configs/viewtool-stm32f107/src/stm32_max3421e.c @@ -364,16 +364,16 @@ int stm32_max3421e_setup(void) } #endif -#if defined(CONFIG_RNDIS) && defined(CONFIG_NETINIT_MACADDR) +#if defined(CONFIG_RNDIS) { uint8_t mac[6]; mac[0] = 0xa0; /* TODO */ - mac[1] = (CONFIG_NETINIT_MACADDR >> (8 * 4)) & 0xff; - mac[2] = (CONFIG_NETINIT_MACADDR >> (8 * 3)) & 0xff; - mac[3] = (CONFIG_NETINIT_MACADDR >> (8 * 2)) & 0xff; - mac[4] = (CONFIG_NETINIT_MACADDR >> (8 * 1)) & 0xff; - mac[5] = (CONFIG_NETINIT_MACADDR >> (8 * 0)) & 0xff; + 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; ret = usbdev_rndis_initialize(mac); if (ret < 0)