Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb: device_next: add CDC ECM class implementation #54448

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dts/bindings/ethernet/zephyr,cdc-ecm-ethernet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

description: USB CDC ECM virtual Ethernet controller

compatible: "zephyr,cdc-ecm-ethernet"

include: ethernet.yaml

properties:
remote-mac-address:
type: string
tmon-nordic marked this conversation as resolved.
Show resolved Hide resolved
required: true
description: |
Remote MAC address of the virtual Ethernet connection.
Should not be the same as local-mac-address property.
5 changes: 5 additions & 0 deletions samples/net/zperf/overlay-usbd_next_ecm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_USB_DEVICE_STACK_NEXT=y

CONFIG_LOG=y
CONFIG_USBD_LOG_LEVEL_WRN=y
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
6 changes: 6 additions & 0 deletions samples/net/zperf/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ tests:
extra_args: OVERLAY_CONFIG="overlay-netusb.conf"
tags: usb net zperf
depends_on: usb_device
sample.net.zperf.device_next_ecm:
extra_args: OVERLAY_CONFIG="overlay-usbd_next_ecm.conf"
DTC_OVERLAY_FILE="usbd_next_ecm.overlay"
platform_allow: nrf52840dk_nrf52840 frdm_k64f
tags: usb net zperf
depends_on: usb_device
sample.net.zperf.netusb_eem:
extra_args: OVERLAY_CONFIG="overlay-netusb.conf"
extra_configs:
Expand Down
12 changes: 12 additions & 0 deletions samples/net/zperf/usbd_next_ecm.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
cdc_ecm_eth0: cdc_ecm_eth0 {
compatible = "zephyr,cdc-ecm-ethernet";
remote-mac-address = "00005E005301";
};
};
9 changes: 9 additions & 0 deletions subsys/usb/device_next/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ zephyr_library_sources_ifdef(
class/usbd_cdc_acm.c
)

zephyr_include_directories_ifdef(
CONFIG_USBD_CDC_ECM_CLASS
${ZEPHYR_BASE}/drivers/ethernet
)
zephyr_library_sources_ifdef(
CONFIG_USBD_CDC_ECM_CLASS
class/usbd_cdc_ecm.c
)

zephyr_library_sources_ifdef(
CONFIG_USBD_BT_HCI
class/bt_hci.c
Expand Down
1 change: 1 addition & 0 deletions subsys/usb/device_next/class/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

rsource "Kconfig.loopback"
rsource "Kconfig.cdc_acm"
rsource "Kconfig.cdc_ecm"
rsource "Kconfig.bt"
rsource "Kconfig.msc"
21 changes: 21 additions & 0 deletions subsys/usb/device_next/class/Kconfig.cdc_ecm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0

config USBD_CDC_ECM_CLASS
bool "USB CDC ECM implementation [EXPERIMENTAL]"
default y
depends on NET_L2_ETHERNET
depends on DT_HAS_ZEPHYR_CDC_ECM_ETHERNET_ENABLED
help
USB CDC Ethernet Control Model (ECM) implementation"

if USBD_CDC_ECM_CLASS

module = USBD_CDC_ECM
module-str = usbd cdc_ecm
default-count = 1
source "subsys/logging/Kconfig.template.log_config"
rsource "Kconfig.template.instances_count"

endif
Loading