board/stm32f401rc-rs485: Add support to RNDIS

Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
This commit is contained in:
Rodrigo Sim 2024-04-28 11:25:13 -03:00 committed by Xiang Xiao
parent 4b3ef4d1fc
commit 2c0dac8691
3 changed files with 134 additions and 0 deletions

View File

@ -494,3 +494,33 @@ NSH commands::
qe_main: 4. 2
qe_main: 5. 2
Terminating!
rndis
-----
Configures the NuttShell (nsh), enables a serial console on USART6 and enables RNDIS over USB.
NSH commands::
nsh> ping -h
Usage: ping [-c <count>] [-i <interval>] [-W <timeout>] [-s <size>] <hostname>
ping -h
Where:
<hostname> is either an IPv4 address or the name of the remote host
that is requested the ICMPv4 ECHO reply.
-c <count> determines the number of pings. Default 10.
-i <interval> is the default delay between pings (milliseconds).
Default 1000.
-W <timeout> is the timeout for wait response (milliseconds).
Default 1000.
-s <size> specifies the number of data bytes to be sent. Default 56.
-h shows this text and exits.
nsh> ping 10.42.0.1
PING 10.42.0.1 56 bytes of data
56 bytes from 10.42.0.1: icmp_seq=0 time=0.0 ms
56 bytes from 10.42.0.1: icmp_seq=1 time=0.0 ms
...
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms

View File

@ -0,0 +1,89 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_FPU is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f401rc-rs485"
CONFIG_ARCH_BOARD_STM32F401RC_RS485=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F401RC=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=8499
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_EXAMPLES_BUTTONS=y
CONFIG_EXAMPLES_BUTTONS_NAME0="SW3"
CONFIG_EXAMPLES_BUTTONS_NAME1="SW4"
CONFIG_EXAMPLES_BUTTONS_NAME2="SW5"
CONFIG_EXAMPLES_BUTTONS_NAMES=y
CONFIG_EXAMPLES_BUTTONS_QTD=3
CONFIG_FS_PROCFS=y
CONFIG_FS_TMPFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INPUT=y
CONFIG_INPUT_BUTTONS=y
CONFIG_INPUT_BUTTONS_LOWER=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x0
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETINIT_DHCPC=y
CONFIG_NETINIT_DRIPADDR=0x0
CONFIG_NETINIT_NETMASK=0x0
CONFIG_NETINIT_NOMAC=y
CONFIG_NETINIT_THREAD=y
CONFIG_NETUTILS_DHCPC=y
CONFIG_NETUTILS_TELNETD=y
CONFIG_NETUTILS_WEBCLIENT=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=98304
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RNDIS=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=5
CONFIG_START_YEAR=2014
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_OTGFS=y
CONFIG_STM32_PWR=y
CONFIG_STM32_USART6=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART6_SERIAL_CONSOLE=y
CONFIG_USBDEV=y

View File

@ -55,6 +55,10 @@
#include "board_qencoder.h"
#endif
#ifdef CONFIG_RNDIS
# include <nuttx/usb/rndis.h>
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -218,5 +222,16 @@ int stm32_bringup(void)
}
#endif
#if defined(CONFIG_RNDIS) && !defined(CONFIG_RNDIS_COMPOSITE)
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
return ret;
}