diff --git a/snippets/usbip-native-sim/README.rst b/snippets/usbip-native-sim/README.rst new file mode 100644 index 00000000000..c082445e190 --- /dev/null +++ b/snippets/usbip-native-sim/README.rst @@ -0,0 +1,17 @@ +.. _snippet-usbip-native-sim: + +USB/IP on Native Simulator Snippet (usbip-native-sim) +##################################################### + +.. code-block:: console + + west build -S usbip-native-sim [...] + +Overview +******** + +This snippet allows to configure USB device samples with USB/IP support on a +native simulator. When building samples with this snippet, you need to provide +samples DTC overlays using the EXTRA_DTC_OVERLAY_FILE argument. + +This snippet is experimental, the behavior may change without notice. diff --git a/snippets/usbip-native-sim/snippet.yml b/snippets/usbip-native-sim/snippet.yml new file mode 100644 index 00000000000..794930c0596 --- /dev/null +++ b/snippets/usbip-native-sim/snippet.yml @@ -0,0 +1,4 @@ +name: usbip-native-sim +append: + EXTRA_CONF_FILE: usbip-native-sim.conf + EXTRA_DTC_OVERLAY_FILE: usbip-native-sim.overlay diff --git a/snippets/usbip-native-sim/usbip-native-sim.conf b/snippets/usbip-native-sim/usbip-native-sim.conf new file mode 100644 index 00000000000..74bad457277 --- /dev/null +++ b/snippets/usbip-native-sim/usbip-native-sim.conf @@ -0,0 +1,21 @@ +CONFIG_NETWORKING=y +CONFIG_NET_IPV4=y +CONFIG_NET_TCP=y +CONFIG_NET_SOCKETS=y + +# Network address config +CONFIG_NET_CONFIG_SETTINGS=y +CONFIG_NET_CONFIG_NEED_IPV4=y +CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" +CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2" + +CONFIG_NET_LOG=y + +CONFIG_USB_HOST_STACK=y +CONFIG_USBH_LOG_LEVEL_WRN=y +CONFIG_UHC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_USBIP=y +CONFIG_USBIP_LOG_LEVEL_WRN=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000000 +CONFIG_UHC_BUF_COUNT=32 +CONFIG_UHC_XFER_COUNT=32 diff --git a/snippets/usbip-native-sim/usbip-native-sim.overlay b/snippets/usbip-native-sim/usbip-native-sim.overlay new file mode 100644 index 00000000000..d206391f3cd --- /dev/null +++ b/snippets/usbip-native-sim/usbip-native-sim.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/delete-node/ &zephyr_udc0; + +/ { + zephyr_uhc0: uhc_vrt0 { + compatible = "zephyr,uhc-virtual"; + + zephyr_udc0: udc_vrt0 { + compatible = "zephyr,udc-virtual"; + num-bidir-endpoints = <8>; + maximum-speed = "high-speed"; + }; + }; +};