# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0

menuconfig USB_DEVICE_STACK_NEXT
	bool "New USB device stack"
	select UDC_DRIVER
	imply HWINFO
	help
	  New USB device stack.

if USB_DEVICE_STACK_NEXT

module = USBD
module-str = usbd
source "subsys/logging/Kconfig.template.log_config"

choice USBD_MAX_SPEED_CHOICE
	prompt "Max supported connection speed"
	default USBD_MAX_SPEED_HIGH if UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
	default USBD_MAX_SPEED_FULL

config USBD_MAX_SPEED_HIGH
	bool "High-Speed"
	depends on UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT

config USBD_MAX_SPEED_FULL
	bool "Full-Speed"
	depends on !UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED

endchoice

config USBD_MAX_SPEED
	int
	default 0 if USBD_MAX_SPEED_FULL
	default 1 if USBD_MAX_SPEED_HIGH

config USBD_BOS_SUPPORT
	bool "USB device BOS support"
	default y
	help
	  BOS support can be disabled if the application does not use a BOS
	  descriptor.

config USBD_VREQ_SUPPORT
	bool "USB device vendor request support"
	default y
	help
	  Allow the application to register a handler for the vendor request
	  with the recipient device.

config USBD_SHELL
	bool "USB device shell"
	depends on SHELL
	help
	  Enable USB device shell.

config USBD_THREAD_INIT_PRIO
	int
	default 90
	help
	  USB device thread initialization priority level.

config USBD_THREAD_STACK_SIZE
	int "USB device stack thread stack size"
	default 1024
	help
	  USB device stack thread stack size in bytes.

config USBD_MAX_UDC_MSG
	int "Maximum number of UDC events"
	default 10
	help
	  Maximum number of USB device controller events that can be queued.

config USBD_MSG_DEFERRED_MODE
	bool "Execute message callback from system workqueue"
	default y
	help
	  Execute message callback from system workqueue. If disabled, message
	  callback will be executed in the device stack context.

config USBD_MSG_SLAB_COUNT
	int "Maximum number of USB device notification messages" if USBD_MSG_DEFERRED_MODE
	range 4 64
	default 8
	help
	  Maximum number of USB device notification messages that can be queued.

config USBD_MSG_WORK_DELAY
	int "USB device notification messages work delay" if USBD_MSG_DEFERRED_MODE
	range 1 100
	default 1
	help
	  Message work may need to be delayed because the device stack is not
	  yet ready to publish the message. The delay unit is milliseconds.

config USBD_HWINFO_DEVID_LENGTH
	int "The length of the device ID requested from HWINFO in bytes"
	depends on HWINFO
	range 8 128
	default 16
	help
	  Each byte represents two digits in the serial number string
	  descriptor. This option can be used to limit the length requested
	  from HWINFO to a meaningful number of digits.

rsource "class/Kconfig"
rsource "app/Kconfig.cdc_acm_serial"

endif # USB_DEVICE_STACK_NEXT
