mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests: add pkg_tinyusb_netdev for tinyUSB netdec
This commit is contained in:
parent
e7d0fbbc71
commit
ee8dcfe664
21
tests/pkg_tinyusb_netdev/Makefile
Normal file
21
tests/pkg_tinyusb_netdev/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
BOARD ?= samr21-xpro
|
||||
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USB_VID ?= $(USB_VID_TESTING)
|
||||
USB_PID ?= $(USB_PID_TESTING)
|
||||
|
||||
CLASS ?= tinyusb_class_net_rndis
|
||||
|
||||
USEPKG += tinyusb
|
||||
|
||||
USEMODULE += auto_init_gnrc_netif
|
||||
USEMODULE += gnrc_ipv6_router_default
|
||||
USEMODULE += gnrc_icmpv6_echo
|
||||
USEMODULE += shell
|
||||
USEMODULE += shell_cmds_default
|
||||
USEMODULE += ps
|
||||
USEMODULE += tinyusb_netdev
|
||||
USEMODULE += $(CLASS)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
3
tests/pkg_tinyusb_netdev/Makefile.ci
Normal file
3
tests/pkg_tinyusb_netdev/Makefile.ci
Normal file
@ -0,0 +1,3 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
stm32f7508-dk \
|
||||
#
|
54
tests/pkg_tinyusb_netdev/README.md
Normal file
54
tests/pkg_tinyusb_netdev/README.md
Normal file
@ -0,0 +1,54 @@
|
||||
Overview
|
||||
========
|
||||
|
||||
This test application can be used to check the implementation of the tinyUSB
|
||||
netdev driver. The implementation of the tinyUSB netdev driver uses Ethernet
|
||||
over USB and supports the following protocols:
|
||||
|
||||
- CDC ECM (Ethernet Control Model)
|
||||
- CDC NCM (Network Control Model)
|
||||
- RNDIS (Microsoft Remote NDIS)
|
||||
|
||||
While Linux and macOS support all these protocols, Microsoft Windows only
|
||||
supports RNDIS and since Windows version 11 also CDC NCM. Which protocol is
|
||||
used is selected by the corresponding pseudomodules `tinyusb_class_net_cdc_ecm`,
|
||||
`tinyusb_class_net_cdc_ncm` and `tinyusb_class_net_rndis`.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
The test application use the protocol defined by the CLASS variable, which
|
||||
defaults to the RNDIS protocol (`tinyusb_class_net_rndis`). This can be
|
||||
changed by setting this variable in the make command line, for example:
|
||||
```
|
||||
CLASS=tinyusb_class_net_cdc_ecm BOARD=... make -C tests/pkg_tinyusb_netdev flash
|
||||
```
|
||||
The CDC ECM protocol (`tinyusb_class_net_cdc_ecm`) and the RNDIS protocol
|
||||
(`tinyusb_class_net_rndis`) can be used simultaneously to support all operating
|
||||
systems, for example :
|
||||
```
|
||||
CLASS='tinyusb_class_net_rndis tinyusb_class_net_cdc_ecm' \
|
||||
BOARD=... make -C tests/pkg_tinyusb_netdev flash
|
||||
```
|
||||
In this case, the CDC ECM protocol is the default protocol and the RNDIS
|
||||
protocol the alternative protocol defined as second device configuration.
|
||||
|
||||
The CDC NCM protocol cannot be used together with the CDC ECM or the RNDIS
|
||||
protocol
|
||||
|
||||
Expected result
|
||||
===============
|
||||
|
||||
Use the network related shell commands to verify the network link between the
|
||||
board under test and the host computer. Ping to the link local address from and
|
||||
to the host computer must work.
|
||||
|
||||
On the host computer, using tools such as `ethtool` must show the USB CDC ECM
|
||||
interface as link detected:
|
||||
|
||||
```
|
||||
# ethtool enp0s20u9u4
|
||||
Settings for enp0s20u9u4:
|
||||
Current message level: 0x00000007 (7)
|
||||
drv probe link
|
||||
Link detected: yes
|
||||
```
|
48
tests/pkg_tinyusb_netdev/main.c
Normal file
48
tests/pkg_tinyusb_netdev/main.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Koen Zandberg <koen@bergzand.net>
|
||||
* 2022 Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for the tinyUSB netdev
|
||||
*
|
||||
* @author Koen Zandberg <koen@bergzand.net>
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8U)
|
||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* we need a message queue for the thread running the shell in order to
|
||||
* receive potentially fast incoming networking packets */
|
||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||
puts("Test application for the tinyUSB net device interface\n");
|
||||
puts("This test pulls in parts of the GNRC network stack, use the\n"
|
||||
"provided shell commands (i.e. ifconfig, ping) to interact with\n"
|
||||
"the tinyUSB based network interface.\n");
|
||||
|
||||
/* start shell */
|
||||
puts("Starting the shell now...");
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||
|
||||
/* should be never reached */
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user