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	select DEPRECATED
11	help
12	  Enable USB device stack.
13
14if USB_DEVICE_STACK
15
16module = USB_DEVICE
17module-str = usb device
18source "subsys/logging/Kconfig.template.log_config"
19
20config USB_DEVICE_VID
21	hex "USB Vendor ID"
22	default 0x2FE3
23	help
24	  USB device vendor ID. MUST be configured by vendor.
25
26config USB_DEVICE_PID
27	hex "USB Product ID"
28	default 0x0100
29	help
30	  USB device product ID. MUST be configured by vendor.
31
32config USB_DEVICE_MANUFACTURER
33	string "USB manufacturer name"
34	default "ZEPHYR"
35	help
36	  USB device Manufacturer string. MUST be configured by vendor.
37
38config USB_DEVICE_PRODUCT
39	string "USB product name"
40	default "USB-DEV"
41	help
42	  USB device Product string. MUST be configured by vendor.
43
44config USB_DEVICE_SN
45	string "USB device Serial Number String"
46	default "0123456789ABCDEF"
47	help
48	  Placeholder for USB device Serial Number String.
49	  Serial Number String will be derived from
50	  Hardware Information Driver (HWINFO).
51
52config USB_CONFIGURATION_STRING_DESC_ENABLE
53	bool "USB configuration string descriptor support"
54	help
55	  Enable string descriptor that describes the default configuration.
56	  Since there is only one configuration, this string descriptor may not
57	  provide much useful information.
58
59if USB_CONFIGURATION_STRING_DESC_ENABLE
60
61config USB_CONFIGURATION_STRING_DESC
62	string "USB configuration string descriptor"
63	default "Default Configuration"
64	help
65	  String descriptor that describes the default configuration.
66
67endif # USB_CONFIGURATION_STRING_DESC_ENABLE
68
69config USB_COMPOSITE_DEVICE
70	bool "Use Interface Association Descriptor code triple"
71	help
72	  This option modifies the code triple in the device descriptor
73	  to signal that one of the functions has two or more interfaces and
74	  uses the Interface Association Descriptor.
75
76config USB_MAX_NUM_TRANSFERS
77    int "Set number of USB transfer data buffers"
78    range 1 32
79    default 4
80    help
81        Allocates buffers used for parallel transfers. Increase this number
82        according to USB devices count.
83
84config USB_DEVICE_BLUETOOTH_BIG_BUF
85	bool
86	# Hidden option to simplify bluetooth buffer requirement
87	# TODO: Add BUF reserve in H4 mode and ISO?
88	default y if BT_BUF_ACL_RX_SIZE > 123 # 4 byte header
89	default y if BT_BUF_ACL_TX_SIZE > 123 # 4 byte header
90	default y if BT_BUF_EVT_RX_SIZE > 125 # 2 byte header
91	default y if BT_BUF_CMD_TX_SIZE > 124 # 3 byte header
92
93config USB_REQUEST_BUFFER_SIZE
94	int "Set buffer size for Standard, Class and Vendor request handlers"
95	range 64 512 if USB_DEVICE_NETWORK_RNDIS
96	range 8 65536
97	default 256 if USB_DEVICE_NETWORK_RNDIS
98	default 266 if (USB_DEVICE_BLUETOOTH && USB_DEVICE_BLUETOOTH_BIG_BUF)
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