zephyr/subsys/usb/device_next/CMakeLists.txt
Johann Fischer 3aef852fc0 usb: device_next: implementation of USB device support notification
The implementation uses the system workqueue and a callback provided
and registered by the application. The application callback is called in
the context of the workqueue. Notification messages are stored in a
queue and delivered to the callback in sequence.

We cannot call application callback directly from the USB device stack
thread because the behavior of arbitrary code provided by the
application is unpredictable, and we do not want it to be executed in
the same context where all events from the device controller are
handled.

Nor can we use the ZBUS subsystem directly. ZBUS offloads responsibility
for defined behavior to the observers and application, and does not
provide any way for the publisher to enforce defined behavior and
execution context.
ZBUS listener would be called from the USB thread context and is not
acceptable. ZBUS subscriber does not provide delivery guarantee and
cached message can be overwritten. ZBUS message subscriber has
cumbersome global configuration and buffers that are too complicated to
handle from USB configuration, and even if we would use it, defined
behavior is not possible because of how listener and subscriber are
handled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-03-22 10:10:42 +01:00

66 lines
1.1 KiB
CMake

# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
zephyr_library_sources(
usbd_device.c
usbd_desc.c
usbd_ch9.c
usbd_core.c
usbd_init.c
usbd_config.c
usbd_class.c
usbd_interface.c
usbd_endpoint.c
usbd_msg.c
)
zephyr_library_sources_ifdef(
CONFIG_USBD_SHELL
usbd_shell.c
)
zephyr_library_sources_ifdef(
CONFIG_USBD_LOOPBACK_CLASS
class/loopback.c
)
zephyr_library_sources_ifdef(
CONFIG_USBD_CDC_ACM_CLASS
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
)
zephyr_library_sources_ifdef(
CONFIG_USBD_MSC_CLASS
class/usbd_msc.c
class/usbd_msc_scsi.c
)
zephyr_linker_sources_ifdef(
CONFIG_USBD_MSC_CLASS
SECTIONS class/usbd_msc.ld
)
zephyr_library_sources_ifdef(
CONFIG_USBD_AUDIO2_CLASS
class/usbd_uac2.c
)
zephyr_linker_sources(DATA_SECTIONS usbd_data.ld)