Author: Alan Carvalho de Assis <acassis@gmail.com>
Run nxstyle against .c .h files and fix it
Author: Adam Feuer <adam@starcat.io>
Summary
Adds CDC ECM Ethernet over USB High Speed for SAMA5D36-Xplained
(and maybe other boards) (most of the code was there already,
but didn't work out of the box for the SAMA5D36-Xplained)
Only SAMA5D36-Xplained has been tested so far
Impact
None if you don't use the CDC ECM Ethernet driver
On SAMA5D36-Xplained, this adds high-speed Internet connectivity
over USB 2.0 High Speed. via the USB CDC ECM Gadget driver.
It may work on other boards too.
This also fixed full-speed (low-speed) mode for the board too.
Limitations
Hasn't been tested on anything other than SAMA5D36-Xplained board.
TODO
Ideally this would include a composite RNDIS device so it would
also work seamlessly on Windows. That is for a future PR
Ideally this would include software to help configuration via
mDNS/DNS-SD for plug and play compatibility with Linux and macOS.
That is for a future PR.
Detail
Only a few lines of C driver code needed to be changed, since the
capability was there already. The rest is config and documentation.
Changes the SAMA5D3-Xplained board bringup to match the SAMA5D3-EK
board bringup
A helper script to configure Linux routing and iptables NAT is also
provided, along with documentation on how to use it.
Testing
Manual, on a Ubuntu Linux 19.10 system and MacOS 10.14.6 Mojave
MacBook Pro.
How To Verify
Follow the new CDC ECM Ethernet over USB instructions in the board
README.txt file
Commits:
remove non-UTF-8 chars in comment and reformat
removed unneeded comment markers
instructions for using the defconfigs
removed EMAC from config
- to prove this example only needs the CDC ECM Ethernet over USB to work
added CDC-ECM Ethernet over USB info to README
added U-Boot image
added netusb helper script
- this can configure the Linux network interface and routes
so you can ping or access the NuttX system via TCP/IP.
renamed defconfig dirs to be ethernet-over-usb
- was usb-over-ethernet which is not right
added USB DMA to defconfigs
updated readme with autoboot and debugging info
bringing ethernet-over-usb examples into parity
added cdc ecm ethernet over usb with telnetd config
added defconfig
only use phy interrupt if netdevices is ethernet
- because now netdevice could be CDC ECM ethernet over usb
which has no PHY interrupt
add bringup to Makefile
add bringup
app init cleanup
init cdc ecm driver and rndis driver; some cleanup
fixed some typos and odd characters
usb over ethernet working over usb 2.0 hs
* Simplify EINTR/ECANCEL error handling
1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx
* Unify the void cast usage
1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
Ran nxstyle against many of the affected files. But this job was too big for today. Many of the network drivers under arch are highly non-compiant and generate many, many faults from nxstyle. Those will have to be visited again another day.
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
This effects all network drivers as well as timing related portions of net/: devif_poll_tcp_timer shouldn't be skipped in the multiple card case. devif_timer will be called multiple time in one period if the multiple card exist, the elapsed time calculated for the first callback is right, but the flowing callback in the same period is wrong(very short) because the global variable g_polltimer is used in the calculation. So let's pass the delay time to devif_timer and remove g_polltimer.
drivers: usbdev: usbmsc: fix usbmsc_exportluns declaration
* drivers: usbdev: usbmsc: fix usbmsc_exportluns declaration
fixes the following error
apps/system/usbmsc/usbmsc_main.c:567:
undefined reference to `usbmsc_exportluns'
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: nsh: register the procfs
this is a configuration change in sync with the other ones
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable READLINE_CMD_HISTORY
we are following the default spresense board configuration
regarding CMD HISTORY configuration
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable by default SPI 4 and 5
we are following the default spresense board configuration
regarding SPI configuration
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: add I2C configuration
in sync with the default spresense board configuration
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
Initial OTG support for STM32H7 and some minor improvements
arch/arm/src/stm32h7/stm32h7x3xx_rcc.c: add support for HSI48 clock
configs/nucleo-f207zg: add support for USB and initialize CDCACM if configured
configs/nucleo-h743zi: add support for USB and initialize CDCACM if configured
drivers/usbdev/Kconfig: fix type for USBDEV_TRACE_INITIALIDSET
configs/teensy-3.x/usbnsh/defconfig: update config according to change in USBDEV_TRACE_INITIALIDSET
Approved-by: Gregory Nutt <gnutt@nuttx.org>
1. lost data when receiving buffer is full;
2. low-water mask implement issue;
3. re-flush cdc buffer when enabling
4. serial dma is conflict with cdc , modify the serial.h
RNDIS composite support
* NuttX usb/composite.h: Forward-declare composite_devdesc_s.
This avoids "error: conflicting types for 'composite_initialize'"
on some versions of GCC. Because of the cross-inclusion between
usbdev.h and composite.h, the full declaration is not always
available.
* NuttX: USB Composite driver: Fix strid comparison
The last string ID used by composite driver is 4, and
the number of IDs used is 5 (0..4). The comparison
strid <= COMPOSITE_NSTRIDS caused composite driver to
reply with -EINVAL for id 5, even though it should be
available for subdevices to use.
* NuttX: RNDIS USB driver: Add support for composite configuration.
Approved-by: GregoryN <gnutt@nuttx.org>
These Microsoft-only descriptors help in loading the correct driver on Windows.
They are especially helpful to give libusb access to a custom device without
having to manually configure/install WinUSB driver.
With this change DFU interface works automatically on
Windows 10 with dfu-util 0.9 and libusb 1.0.22. On Windows 7
it still appears to need driver installation.
drivers/usbdev: Fix buffer overrun check in rndis.c
The rndis driver has been working since 13 Nov 2017.
However, I finally found that it depends on network and buffer
configurations. If a receiving TCP packet is devided into smaller
ones based on USB max packet size, this condition check works
correctly.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: GregoryN <gnutt@nuttx.org>
This makes the user interface a little hostile. People thing of an MTU of 1500 bytes, but the corresponding packet is really 1514 bytes (including the 14 byte Ethernet header). A more friendly solution would configure the MTU (as before), but then derive the packet buffer size by adding the MAC header length. Instead, we define the packet buffer size then derive the MTU.
The MTU is not common currency in networking. On the wire, the only real issue is the MSS which is derived from MTU by subtracting the IP header and TCP header sizes (for the case of TCP). Now it is derived for the PKTSIZE by subtracting the IP header, the TCP header, and the MAC header sizes. So we should be all good and without the recurring 14 byte error in MTU's and MSS's.
Squashed commit of the following:
Trivial update to fix some spacing issues.
net/: Rename several macros containing _MTU to _PKTSIZE.
net/: Rename CONFIG_NET_SLIP_MTU to CONFIG_NET_SLIP_PKTSIZE and similarly for CONFIG_NET_TUN_MTU. These are not the MTU which does not include the size of the link layer header. These are the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename CONFIG_NET_6LOWPAN_MTU to CONFIG_NET_6LOWPAN_PKTSIZE and similarly for CONFIG_NET_TUN_MTU. These are not the MTU which does not include the size of the link layer header. These are the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename CONFIG_NET_ETH_MTU to CONFIG_NET_ETH_PKTSIZE. This is not the MTU which does not include the size of the link layer header. This is the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename the file d_mtu in the network driver structure to d_pktsize. That value saved there is not the MTU. The packetsize is the memory large enough to hold the maximum packet PLUS the size of the link layer header. The MTU does not include the link layer header.
RNDIS support on STM32F4Discovery
* stm32f4discovery: Add stm32_netinit.c to avoid a compilation error
* stm32f4discovery: Add rndis initialization in stm32_bringup.c
NOTE: MAC address for the host side starts 0xaa. This assignment
scheme should be fixed later.
* stm32f4discovery: Add rndis configuration
NOTE: STM32F4Discovery + DM-STF4BB
* drivers/usbdev/rndis.c: Fix some issues in rndis.c
Introduce rndis_transmit() and change rndis_rxdispatch() to avoid
packet corruption. Introduce max packet size for dual speed which
is mainly used for high speed mode. Fix adjusting MTU warning
on Linux host. Fix data corruption if a packet size excceds MTU.
NOTE: Max packet size is not configured dynamically. This should
be fixed in the future version.
* stm32f4discovery: Modify #ifdef condition for rndis in stm32_bringup()
* drivers/usbdev/rndis.c: Change HPWORK to ETHWORK
* drivers/usbdev/rndis.c: Merge the commit 07b98ccbb5
Previous commit b09365784a was based on old rndis.c thus resulted
in reverting the commit 07b98ccbb5. This change merges the commit.
NOTE: In the commit 07b98ccbb5, max packet size of bulkout was
assumed to be 64. In this commit, priv->epbulkout->maxpacket is
used instead.
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit backs out most of commit b4747286b1. That change was added because sem_wait() would sometimes cause cancellation points inappropriated. But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.
In the OS, all calls to sem_wait() changed to nxsem_wait(). nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.
In all OS functions (not libraries), change sem_wait() to nxsem_wait(). This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.
sched/semaphore: Add the function nxsem_wait(). This is a new internal OS interface. It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.