esp-idf/components/usb/Kconfig
Peter Marcisovsky 24adb6ed3c feat(us/host): set device cfg during enumeration
- user callback funciton to set device configuration
      as a part of usb_host_install
    - callback provides device descriptor of a device being enumerated
    - user can set which cfg descriptor the USB device will be set with
    - user can filter device enumeration
    - Kconfig menu to enable callback function
    - usb_host_lib example demonstration
2024-01-04 16:09:13 +01:00

119 lines
5.6 KiB
Plaintext

menu "USB-OTG"
depends on SOC_USB_OTG_SUPPORTED
config USB_HOST_CONTROL_TRANSFER_MAX_SIZE
int "Largest size (in bytes) of transfers to/from default endpoints"
default 256
help
Each USB device attached is allocated a dedicated buffer for its OUT/IN transfers to/from the device's
control endpoint. The maximum size of that buffer is determined by this option. The limited size of the
transfer buffer have the following implications:
- The maximum length of control transfers is limited
- Device's with configuration descriptors larger than this limit cannot be supported
choice USB_HOST_HW_BUFFER_BIAS
prompt "Hardware FIFO size biasing"
default USB_HOST_HW_BUFFER_BIAS_BALANCED
help
The underlying hardware has size adjustable FIFOs to cache USB packets on reception (IN) or for
transmission (OUT). The size of these FIFOs will affect the largest MPS (maximum packet size) and the
maximum number of packets that can be cached at any one time. The hardware contains the following
FIFOS: RX (for all IN packets), Non-periodic TX (for Bulk and Control OUT packets), and Periodic TX
(for Interrupt and Isochronous OUT packets). This configuration option allows biasing the FIFO sizes
towards a particular use case, which may be necessary for devices that have endpoints with large MPS.
The MPS limits for each biasing are listed below:
Balanced:
- IN (all transfer types), 408 bytes
- OUT non-periodic (Bulk/Control), 192 bytes (i.e., 3 x 64 byte packets)
- OUT periodic (Interrupt/Isochronous), 192 bytes
Bias IN:
- IN (all transfer types), 600 bytes
- OUT non-periodic (Bulk/Control), 64 bytes (i.e., 1 x 64 byte packets)
- OUT periodic (Interrupt/Isochronous), 128 bytes
Bias Periodic OUT:
- IN (all transfer types), 128 bytes
- OUT non-periodic (Bulk/Control), 64 bytes (i.e., 1 x 64 byte packets)
- OUT periodic (Interrupt/Isochronous), 600 bytes
config USB_HOST_HW_BUFFER_BIAS_BALANCED
bool "Balanced"
config USB_HOST_HW_BUFFER_BIAS_IN
bool "Bias IN"
config USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT
bool "Periodic OUT"
endchoice
menu "Root Hub configuration"
config USB_HOST_DEBOUNCE_DELAY_MS
int "Debounce delay in ms"
default 250
help
On connection of a USB device, the USB 2.0 specification requires a "debounce interval with a minimum
duration of 100ms" to allow the connection to stabilize (see USB 2.0 chapter 7.1.7.3 for more details).
During the debounce interval, no new connection/disconnection events are registered.
The default value is set to 250 ms to be safe.
config USB_HOST_RESET_HOLD_MS
int "Reset hold in ms"
default 30
help
The reset signaling can be generated on any Hub or Host Controller port by request from the USB System
Software. The USB 2.0 specification requires that "the reset signaling must be driven for a minimum of
10ms" (see USB 2.0 chapter 7.1.7.5 for more details). After the reset, the hub port will transition to
the Enabled state (refer to Section 11.5).
The default value is set to 30 ms to be safe.
config USB_HOST_RESET_RECOVERY_MS
int "Reset recovery delay in ms"
default 30
help
After a port stops driving the reset signal, the USB 2.0 specification requires that the "USB System
Software guarantees a minimum of 10 ms for reset recovery" before the attached device is expected to
respond to data transfers (see USB 2.0 chapter 7.1.7.3 for more details). The device may ignore any
data transfers during the recovery interval.
The default value is set to 30 ms to be safe.
config USB_HOST_SET_ADDR_RECOVERY_MS
int "SetAddress() recovery time in ms"
default 10
help
"After successful completion of the Status stage, the device is allowed a SetAddress() recovery
interval of 2 ms. At the end of this interval, the device must be able to accept Setup packets
addressed to the new address. Also, at the end of the recovery interval, the device must not respond to
tokens sent to the old address (unless, of course, the old and new address is the same)." See USB 2.0
chapter 9.2.6.3 for more details.
The default value is set to 10 ms to be safe.
endmenu #Root Hub configuration
config USB_HOST_ENABLE_ENUM_FILTER_CALLBACK
bool "Enable enumeration filter callback"
default n
help
The enumeration filter callback is called before enumeration of each newly attached device. This callback
allows users to control whether a device should be enumerated, and what configuration number to use when
enumerating a device.
If enabled, the enumeration filter callback can be set via 'usb_host_config_t' when calling
'usb_host_install()'.
# Hidden or compatibility options
config USB_OTG_SUPPORTED
# Invisible config kept for compatibility
# Todo: Remove in v6.0 (IDF-8936)
bool
default y
endmenu #USB-OTG