1# USB device stack configuration options
2
3# Copyright (c) 2016 Wind River Systems, Inc.
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig USB_DEVICE_STACK
7	bool "USB Device Support"
8	select USB_DEVICE_DRIVER
9	select HWINFO
10	help
11	  Enable USB device stack.
12
13if USB_DEVICE_STACK
14
15module = USB_DEVICE
16module-str = usb device
17source "subsys/logging/Kconfig.template.log_config"
18
19config USB_DEVICE_VID
20	hex "USB Vendor ID"
21	default 0x2FE3
22	help
23	  USB device vendor ID. MUST be configured by vendor.
24
25config USB_DEVICE_PID
26	hex "USB Product ID"
27	default 0x0100
28	help
29	  USB device product ID. MUST be configured by vendor.
30
31config USB_DEVICE_MANUFACTURER
32	string "USB manufacturer name"
33	default "ZEPHYR"
34	help
35	  USB device Manufacturer string. MUST be configured by vendor.
36
37config USB_DEVICE_PRODUCT
38	string "USB product name"
39	default "USB-DEV"
40	help
41	  USB device Product string. MUST be configured by vendor.
42
43config USB_DEVICE_SN
44	string "USB device Serial Number String"
45	default "0123456789ABCDEF"
46	help
47	  Placeholder for USB device Serial Number String.
48	  Serial Number String will be derived from
49	  Hardware Information Driver (HWINFO).
50
51config USB_CONFIGURATION_STRING_DESC_ENABLE
52	bool "USB configuration string descriptor support"
53	help
54	  Enable string descriptor that describes the default configuration.
55	  Since there is only one configuration, this string descriptor may not
56	  provide much useful information.
57
58if USB_CONFIGURATION_STRING_DESC_ENABLE
59
60config USB_CONFIGURATION_STRING_DESC
61	string "USB configuration string descriptor"
62	default "Default Configuration"
63	help
64	  String descriptor that describes the default configuration.
65
66endif # USB_CONFIGURATION_STRING_DESC_ENABLE
67
68config USB_COMPOSITE_DEVICE
69	bool "Use Interface Association Descriptor code triple"
70	help
71	  This option modifies the code triple in the device descriptor
72	  to signal that one of the functions has two or more interfaces and
73	  uses the Interface Association Descriptor.
74
75config USB_MAX_NUM_TRANSFERS
76    int "Set number of USB transfer data buffers"
77    range 1 32
78    default 4
79    help
80        Allocates buffers used for parallel transfers. Increase this number
81        according to USB devices count.
82
83config USB_DEVICE_BLUETOOTH_BIG_BUF
84	bool
85	# Hidden option to simplify bluetooth buffer requirement
86	# TODO: Add BUF reserve in H4 mode and ISO?
87	default y if BT_BUF_ACL_RX_SIZE > 123 # 4 byte header
88	default y if BT_BUF_ACL_TX_SIZE > 123 # 4 byte header
89	default y if BT_BUF_EVT_RX_SIZE > 125 # 2 byte header
90	default y if BT_BUF_CMD_TX_SIZE > 124 # 3 byte header
91
92config USB_REQUEST_BUFFER_SIZE
93	int "Set buffer size for Standard, Class and Vendor request handlers"
94	range 64 512 if USB_DEVICE_NETWORK_RNDIS
95	range 8 65536
96	default 256 if USB_DEVICE_NETWORK_RNDIS
97	default 266 if (USB_DEVICE_BLUETOOTH && USB_DEVICE_BLUETOOTH_BIG_BUF)
98	default 1024 if USB_DEVICE_LOOPBACK
99	default 128
100
101config USB_MAX_ALT_SETTING
102	int "Size of the array where alternate settings are stored"
103	range 0 16
104	default 8
105	help
106	  Size of the array where alternate settings are stored.
107	  Should not be smaller than the number of interfaces.
108
109config USB_NUMOF_EP_WRITE_RETRIES
110	int "Number of endpoint write retries"
111	default 3
112	help
113	  Number of endpoint write retries.
114
115config USB_DEVICE_SOF
116	bool "Start of Frame processing in events"
117	default y if (USB_DEVICE_AUDIO && NRF_USBD_COMMON)
118
119config USB_DEVICE_BOS
120	bool "USB Binary Device Object Store (BOS)"
121
122config USB_DEVICE_OS_DESC
123	bool "MS OS Descriptors support"
124
125config USB_SELF_POWERED
126	bool "Set Self-powered characteristic"
127	default y
128	help
129	  Set Self-powered characteristic in bmAttributes to indicate
130	  self powered USB device.
131
132config USB_MAX_POWER
133	int "Set bMaxPower value"
134	default 50
135	range 0 250
136	help
137	  Set bMaxPower value in the Standard Configuration Descriptor,
138	  the result is 2mA times the value provided.
139
140config USB_WORKQUEUE
141	bool "Use a dedicate work queue in the USB subsystem"
142	default y if USB_CDC_ACM
143	help
144	  This option provides a dedicated work queue that is used for
145	  all offloaded operations initiated by the USB subsystem.
146	  This prevents deadlock situations where tasks on the system
147	  workqueue inadvertently initiate operations that block, such
148	  as UART transmission on CDC-ACM, preventing the system work
149	  queue from making progress on the USB tasks that would
150	  release the task.
151
152	  Without this the system work queue is used for all USB
153	  offloaded transfers.
154
155config USB_WORKQUEUE_STACK_SIZE
156	int "USB workqueue stack size"
157	depends on USB_WORKQUEUE
158	default 4096 if COVERAGE_GCOV
159	default 1024
160
161config USB_WORKQUEUE_PRIORITY
162	int "USB workqueue priority"
163	depends on USB_WORKQUEUE
164	default -2 if COOP_ENABLED && !PREEMPT_ENABLED
165	default  0 if !COOP_ENABLED
166	default -1
167	help
168	  By default, USB work queue priority is the lowest cooperative
169	  priority. This means that any work handler, once started, won't
170	  be preempted by any other thread until finished.
171
172config USB_DEVICE_INITIALIZE_AT_BOOT
173	bool "Initialize USB device support at boot"
174	depends on USB_CDC_ACM
175	help
176	  Use CDC ACM UART as backend for console, shell, or logging.
177
178source "subsys/usb/device/class/Kconfig"
179
180endif # USB_DEVICE_STACK
181