usb: move USB device stack code to own directory

Until now the whole USB device stack code is located
in the top subsys/usb directory. Move it to own directory
in preparation for upcoming extension and rework of USB support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2022-03-31 11:17:28 +02:00 committed by Carles Cufí
commit 6be45c2a18
51 changed files with 70 additions and 66 deletions

View file

@ -771,7 +771,7 @@ scripts/gen_image_info.py @tejlmand
/subsys/testsuite/ztest/*/ztress* @nordic-krch /subsys/testsuite/ztest/*/ztress* @nordic-krch
/subsys/timing/ @nashif @dcpleung /subsys/timing/ @nashif @dcpleung
/subsys/usb/ @jfischer-no /subsys/usb/ @jfischer-no
/subsys/usb/class/dfu/usb_dfu.c @nvlsianpu /subsys/usb/device/class/dfu/usb_dfu.c @nvlsianpu
/tests/ @nashif /tests/ @nashif
/tests/arch/arm/ @ioannisg @stephanosio /tests/arch/arm/ @ioannisg @stephanosio
/tests/benchmarks/cmsis_dsp/ @stephanosio /tests/benchmarks/cmsis_dsp/ @stephanosio

View file

@ -52,7 +52,7 @@ The following structures and callbacks need to be defined:
For example, for the USB loopback application: For example, for the USB loopback application:
.. literalinclude:: ../../../subsys/usb/class/loopback.c .. literalinclude:: ../../../subsys/usb/device/class/loopback.c
:language: c :language: c
:start-after: usb.rst config structure start :start-after: usb.rst config structure start
:end-before: usb.rst config structure end :end-before: usb.rst config structure end
@ -60,7 +60,7 @@ For example, for the USB loopback application:
Endpoint configuration: Endpoint configuration:
.. literalinclude:: ../../../subsys/usb/class/loopback.c .. literalinclude:: ../../../subsys/usb/device/class/loopback.c
:language: c :language: c
:start-after: usb.rst endpoint configuration start :start-after: usb.rst endpoint configuration start
:end-before: usb.rst endpoint configuration end :end-before: usb.rst endpoint configuration end
@ -68,7 +68,7 @@ Endpoint configuration:
USB Device configuration structure: USB Device configuration structure:
.. literalinclude:: ../../../subsys/usb/class/loopback.c .. literalinclude:: ../../../subsys/usb/device/class/loopback.c
:language: c :language: c
:start-after: usb.rst device config data start :start-after: usb.rst device config data start
:end-before: usb.rst device config data end :end-before: usb.rst device config data end
@ -81,7 +81,7 @@ class driver through the registered vendor handler.
For the loopback class driver, :c:func:`loopback_vendor_handler` processes For the loopback class driver, :c:func:`loopback_vendor_handler` processes
the vendor requests: the vendor requests:
.. literalinclude:: ../../../subsys/usb/class/loopback.c .. literalinclude:: ../../../subsys/usb/device/class/loopback.c
:language: c :language: c
:start-after: usb.rst vendor handler start :start-after: usb.rst vendor handler start
:end-before: usb.rst vendor handler end :end-before: usb.rst vendor handler end

View file

@ -6,7 +6,7 @@ project(wpanusb)
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip) target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip)
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/l2) target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/l2)
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/usb) target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/usb/device)
FILE(GLOB app_sources src/*.c) FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources}) target_sources(app PRIVATE ${app_sources})

View file

@ -14,7 +14,7 @@ add_subdirectory(ipc)
add_subdirectory(mgmt) add_subdirectory(mgmt)
add_subdirectory_ifdef(CONFIG_MCUBOOT_IMG_MANAGER dfu) add_subdirectory_ifdef(CONFIG_MCUBOOT_IMG_MANAGER dfu)
add_subdirectory_ifdef(CONFIG_NET_BUF net) add_subdirectory_ifdef(CONFIG_NET_BUF net)
add_subdirectory_ifdef(CONFIG_USB_DEVICE_STACK usb) add_subdirectory(usb)
add_subdirectory(random) add_subdirectory(random)
add_subdirectory(storage) add_subdirectory(storage)
add_subdirectory_ifdef(CONFIG_SETTINGS settings) add_subdirectory_ifdef(CONFIG_SETTINGS settings)

View file

@ -46,7 +46,7 @@ source "subsys/shell/Kconfig"
source "subsys/stats/Kconfig" source "subsys/stats/Kconfig"
source "subsys/usb/Kconfig" source "subsys/usb/device/Kconfig"
source "subsys/dfu/Kconfig" source "subsys/dfu/Kconfig"

View file

@ -1,34 +1,4 @@
# Copyright (c) 2022 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(CONFIG_USB_DEVICE_STACK) add_subdirectory_ifdef(CONFIG_USB_DEVICE_STACK device)
zephyr_include_directories(${ZEPHYR_BASE}/subsys/usb)
zephyr_sources(
usb_device.c
usb_descriptor.c
usb_transfer.c
)
add_subdirectory(class)
endif()
zephyr_sources_ifdef(CONFIG_USB_DEVICE_BOS bos.c)
zephyr_sources_ifdef(CONFIG_USB_DEVICE_OS_DESC os_desc.c)
zephyr_sources_ifdef(CONFIG_USB_WORKQUEUE usb_work_q.c)
if(CONFIG_USB_DEVICE_VID EQUAL 0x2FE3)
message(WARNING
"CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products."
)
if(CONFIG_USB_DEVICE_PID EQUAL 0x100)
message(WARNING
"CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products."
)
endif()
endif()

View file

@ -1,20 +0,0 @@
# USB class drivers configuration options
# Copyright (c) 2016 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
source "subsys/usb/class/Kconfig.cdc"
source "subsys/usb/class/Kconfig.msc"
source "subsys/usb/class/Kconfig.bt"
source "subsys/usb/class/Kconfig.test"
source "subsys/usb/class/netusb/Kconfig"
source "subsys/usb/class/hid/Kconfig"
source "subsys/usb/class/audio/Kconfig"
source "subsys/usb/class/dfu/Kconfig"

View file

@ -0,0 +1,34 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_USB_DEVICE_STACK)
zephyr_include_directories(${ZEPHYR_BASE}/subsys/usb/device)
zephyr_sources(
usb_device.c
usb_descriptor.c
usb_transfer.c
)
add_subdirectory(class)
endif()
zephyr_sources_ifdef(CONFIG_USB_DEVICE_BOS bos.c)
zephyr_sources_ifdef(CONFIG_USB_DEVICE_OS_DESC os_desc.c)
zephyr_sources_ifdef(CONFIG_USB_WORKQUEUE usb_work_q.c)
if(CONFIG_USB_DEVICE_VID EQUAL 0x2FE3)
message(WARNING
"CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products."
)
if(CONFIG_USB_DEVICE_PID EQUAL 0x100)
message(WARNING
"CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products."
)
endif()
endif()

View file

@ -158,6 +158,6 @@ config USB_DEVICE_INITIALIZE_AT_BOOT
help help
Use CDC ACM UART as backend for console, shell, or logging. Use CDC ACM UART as backend for console, shell, or logging.
source "subsys/usb/class/Kconfig" source "subsys/usb/device/class/Kconfig"
endif # USB_DEVICE_STACK endif # USB_DEVICE_STACK

View file

@ -0,0 +1,20 @@
# USB class drivers configuration options
# Copyright (c) 2016 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
source "subsys/usb/device/class/Kconfig.cdc"
source "subsys/usb/device/class/Kconfig.msc"
source "subsys/usb/device/class/Kconfig.bt"
source "subsys/usb/device/class/Kconfig.test"
source "subsys/usb/device/class/netusb/Kconfig"
source "subsys/usb/device/class/hid/Kconfig"
source "subsys/usb/device/class/audio/Kconfig"
source "subsys/usb/device/class/dfu/Kconfig"

View file

@ -6,7 +6,7 @@ zephyr_library_include_directories(
# USB headers # USB headers
#${ZEPHYR_BASE}/include/drivers/usb #${ZEPHYR_BASE}/include/drivers/usb
${ZEPHYR_BASE}/include/usb ${ZEPHYR_BASE}/include/usb
${ZEPHYR_BASE}/subsys/usb ${ZEPHYR_BASE}/subsys/usb/device
) )
zephyr_library_sources( zephyr_library_sources(

View file

@ -20,7 +20,7 @@ config USB_HID_DEVICE_NAME
module = USB_HID module = USB_HID
default-count = 1 default-count = 1
source "subsys/usb/class/Kconfig.template.composite_device_number" source "subsys/usb/device/class/Kconfig.template.composite_device_number"
module = USB_HID module = USB_HID
module-str = usb hid module-str = usb hid

View file

@ -6,7 +6,7 @@ zephyr_library_include_directories(
# USB headers # USB headers
${ZEPHYR_BASE}/include/drivers/usb ${ZEPHYR_BASE}/include/drivers/usb
${ZEPHYR_BASE}/include/usb/ ${ZEPHYR_BASE}/include/usb/
${ZEPHYR_BASE}/subsys/usb/ ${ZEPHYR_BASE}/subsys/usb/device/
.. ..
# IP headers # IP headers

View file

@ -5,7 +5,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(os_desc) project(os_desc)
zephyr_library_include_directories( zephyr_library_include_directories(
${ZEPHYR_BASE}/subsys/usb/ ${ZEPHYR_BASE}/subsys/usb/device/
) )
FILE(GLOB app_sources src/*.c) FILE(GLOB app_sources src/*.c)

View file

@ -5,7 +5,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(os_desc) project(os_desc)
zephyr_library_include_directories( zephyr_library_include_directories(
${ZEPHYR_BASE}/subsys/usb/ ${ZEPHYR_BASE}/subsys/usb/device/
) )
FILE(GLOB app_sources src/*.c) FILE(GLOB app_sources src/*.c)