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
19source "samples/subsys/usb/usb_pid.Kconfig"
20
21config USB_DEVICE_VID
22	hex "USB Vendor ID"
23	default 0x2FE3
24	help
25	  USB device vendor ID. MUST be configured by vendor.
26
27config USB_DEVICE_PID
28	hex "USB Product ID"
29	default 0x0100
30	help
31	  USB device product ID. MUST be configured by vendor.
32
33config USB_DEVICE_MANUFACTURER
34	string "USB manufacturer name"
35	default "ZEPHYR"
36	help
37	  USB device Manufacturer string. MUST be configured by vendor.
38
39config USB_DEVICE_PRODUCT
40	string "USB product name"
41	default "USB-DEV"
42	help
43	  USB device Product string. MUST be configured by vendor.
44
45config USB_DEVICE_SN
46	string "USB device Serial Number String"
47	default "0123456789ABCDEF"
48	help
49	  Placeholder for USB device Serial Number String.
50	  Serial Number String will be derived from
51	  Hardware Information Driver (HWINFO).
52
53config USB_COMPOSITE_DEVICE
54	bool "Enable composite device driver"
55	help
56	  Enable composite USB device driver.
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 "Enable Start of Frame processing in events"
100	default y if (USB_DEVICE_AUDIO && NRFX_USBD)
101
102config USB_DEVICE_REMOTE_WAKEUP
103	bool "Enable support for remote wakeup"
104	help
105	  This option requires USBD peripheral driver to also support remote wakeup.
106
107config USB_DEVICE_BOS
108	bool "Enable USB Binary Device Object Store (BOS)"
109
110config USB_DEVICE_OS_DESC
111	bool "Enable MS OS Descriptors support"
112
113config USB_SELF_POWERED
114	bool "Set Self-powered characteristic"
115	default y
116	help
117	  Set Self-powered characteristic in bmAttributes to indicate
118	  self powered USB device.
119
120config USB_MAX_POWER
121	int "Set bMaxPower value"
122	default 50
123	range 0 250
124	help
125	  Set bMaxPower value in the Standard Configuration Descriptor,
126	  the result is 2mA times the value provided.
127
128config USB_WORKQUEUE
129	bool "Use a dedicate work queue in the USB subsystem"
130	default y if USB_CDC_ACM
131	help
132	  This option provides a dedicated work queue that is used for
133	  all offloaded operations initiated by the USB subsystem.
134	  This prevents deadlock situations where tasks on the system
135	  workqueue inadvertently initiate operations that block, such
136	  as UART transmission on CDC-ACM, preventing the system work
137	  queue from making progress on the USB tasks that would
138	  release the task.
139
140	  Without this the system work queue is used for all USB
141	  offloaded transfers.
142
143config USB_WORKQUEUE_STACK_SIZE
144	int "USB workqueue stack size"
145	depends on USB_WORKQUEUE
146	default 4096 if COVERAGE
147	default 1024
148
149config USB_WORKQUEUE_PRIORITY
150	int "USB workqueue priority"
151	depends on USB_WORKQUEUE
152	default -2 if COOP_ENABLED && !PREEMPT_ENABLED
153	default  0 if !COOP_ENABLED
154	default -1
155	help
156	  By default, USB work queue priority is the lowest cooperative
157	  priority. This means that any work handler, once started, won't
158	  be preempted by any other thread until finished.
159
160source "subsys/usb/class/Kconfig"
161
162endif # USB_DEVICE_STACK
163