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