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_COMPOSITE_DEVICE
52	bool "Use Interface Association Descriptor code triple"
53	help
54	  This option modifies the code triple in the device descriptor
55	  to signal that one of the functions has two or more interfaces and
56	  uses the Interface Association Descriptor.
57
58config USB_MAX_NUM_TRANSFERS
59    int "Set number of USB transfer data buffers"
60    range 1 32
61    default 4
62    help
63        Allocates buffers used for parallel transfers. Increase this number
64        according to USB devices count.
65
66config USB_DEVICE_BLUETOOTH_BIG_BUF
67	bool
68	# Hidden option to simplify bluetooth buffer requirement
69	# TODO: Add BUF reserve in H4 mode and ISO?
70	default y if BT_BUF_ACL_RX_SIZE > 123 # 4 byte header
71	default y if BT_BUF_ACL_TX_SIZE > 123 # 4 byte header
72	default y if BT_BUF_EVT_RX_SIZE > 125 # 2 byte header
73	default y if BT_BUF_CMD_TX_SIZE > 124 # 3 byte header
74
75config USB_REQUEST_BUFFER_SIZE
76	int "Set buffer size for Standard, Class and Vendor request handlers"
77	range 64 512 if USB_DEVICE_NETWORK_RNDIS
78	range 8 65536
79	default 256 if USB_DEVICE_NETWORK_RNDIS
80	default 266 if (USB_DEVICE_BLUETOOTH && USB_DEVICE_BLUETOOTH_BIG_BUF)
81	default 1024 if USB_DEVICE_LOOPBACK
82	default 128
83
84config USB_MAX_ALT_SETTING
85	int "Size of the array where alternate settings are stored"
86	range 0 16
87	default 8
88	help
89	  Size of the array where alternate settings are stored.
90	  Should not be smaller than the number of interfaces.
91
92config USB_NUMOF_EP_WRITE_RETRIES
93	int "Number of endpoint write retries"
94	default 3
95	help
96	  Number of endpoint write retries.
97
98config USB_DEVICE_SOF
99	bool "Start of Frame processing in events"
100	default y if (USB_DEVICE_AUDIO && NRFX_USBD)
101
102config USB_DEVICE_BOS
103	bool "USB Binary Device Object Store (BOS)"
104
105config USB_DEVICE_OS_DESC
106	bool "MS OS Descriptors support"
107
108config USB_SELF_POWERED
109	bool "Set Self-powered characteristic"
110	default y
111	help
112	  Set Self-powered characteristic in bmAttributes to indicate
113	  self powered USB device.
114
115config USB_MAX_POWER
116	int "Set bMaxPower value"
117	default 50
118	range 0 250
119	help
120	  Set bMaxPower value in the Standard Configuration Descriptor,
121	  the result is 2mA times the value provided.
122
123config USB_WORKQUEUE
124	bool "Use a dedicate work queue in the USB subsystem"
125	default y if USB_CDC_ACM
126	help
127	  This option provides a dedicated work queue that is used for
128	  all offloaded operations initiated by the USB subsystem.
129	  This prevents deadlock situations where tasks on the system
130	  workqueue inadvertently initiate operations that block, such
131	  as UART transmission on CDC-ACM, preventing the system work
132	  queue from making progress on the USB tasks that would
133	  release the task.
134
135	  Without this the system work queue is used for all USB
136	  offloaded transfers.
137
138config USB_WORKQUEUE_STACK_SIZE
139	int "USB workqueue stack size"
140	depends on USB_WORKQUEUE
141	default 4096 if COVERAGE_GCOV
142	default 1024
143
144config USB_WORKQUEUE_PRIORITY
145	int "USB workqueue priority"
146	depends on USB_WORKQUEUE
147	default -2 if COOP_ENABLED && !PREEMPT_ENABLED
148	default  0 if !COOP_ENABLED
149	default -1
150	help
151	  By default, USB work queue priority is the lowest cooperative
152	  priority. This means that any work handler, once started, won't
153	  be preempted by any other thread until finished.
154
155config USB_DEVICE_INITIALIZE_AT_BOOT
156	bool "Initialize USB device support at boot"
157	depends on USB_CDC_ACM
158	help
159	  Use CDC ACM UART as backend for console, shell, or logging.
160
161source "subsys/usb/device/class/Kconfig"
162
163endif # USB_DEVICE_STACK
164