1# Copyright (c) 2020 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig USB_DFU_CLASS
5	bool "USB DFU Class Driver"
6	select MPU_ALLOW_FLASH_WRITE
7	select POLL
8	depends on IMG_MANAGER
9	select IMG_ERASE_PROGRESSIVELY if (SOC_FLASH_NRF || FLASH_MCUX_FLEXSPI_NOR)
10	help
11	  USB DFU class driver
12
13if USB_DFU_CLASS
14
15config USB_DEVICE_DFU_PID
16	hex "USB DFU Product ID"
17	default 0xFFFF
18	help
19	  USB device product ID in DFU mode. MUST be configured by vendor.
20
21config USB_DFU_WILL_DETACH
22	bool "Generate detach-attach sequence on DFU detach"
23	default y
24	help
25	  Enabling this option makes the device responsible for detaching
26	  itself from the bus after the DFU_DETACH request. Select this
27	  for compatibility with host drivers that cannot issue USB reset.
28	  DFU fails on Windows with WinUSB driver if this is not enabled.
29
30config USB_DFU_DETACH_TIMEOUT
31	int
32	default 100 if USB_DFU_WILL_DETACH
33	default 1000
34
35config USB_DFU_DEFAULT_POLLTIMEOUT
36	int "Default value for bwPollTimeout"
37	default 8
38	range 0 1000
39	help
40	  Default value for bwPollTimeout (in ms)
41
42config USB_DFU_ENABLE_UPLOAD
43	bool "Firmware uploading to the host"
44	help
45	  Enabling this option allows to upload firmware image to the host.
46	  Be aware that upload capability can be a security risk because
47	  the executable image is always decrypted despite the image
48	  encryption is enabled.
49
50config USB_DFU_REBOOT
51	bool "Reboot after download"
52	select REBOOT
53	help
54	  When enabled the device will automatically reboot after a download
55	  so the bootloader can swap the images.
56
57config USB_DFU_PERMANENT_DOWNLOAD
58	bool "Mark slot 1 as permanent after download"
59	help
60	  When enabled the image written to slot 1 will be marked as permanent.
61	  WARNING: This bypasses Mcuboot's test-confirm mechanism!
62	  Downloading the wrong image will cause a bricked device.
63	  Make sure there is some kind of recovery mechanism.
64
65
66endif # USB_DFU_CLASS
67