1menu "USB-OTG"
2    visible if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
3
4    # Invisible item, enabled when USB_OTG peripheral does exist
5    config USB_OTG_SUPPORTED
6        bool
7        default y if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
8
9    config USB_HOST_CONTROL_TRANSFER_MAX_SIZE
10        depends on USB_OTG_SUPPORTED
11        int "Largest size (in bytes) of transfers to/from default endpoints"
12        default 256
13        help
14            Each USB device attached is allocated a dedicated buffer for its OUT/IN transfers to/from the device's
15            control endpoint. The maximum size of that buffer is determined by this option. The limited size of the
16            transfer buffer have the following implications:
17            - The maximum length of control transfers is limited
18            - Device's with configuration descriptors larger than this limit cannot be supported
19
20    choice USB_HOST_HW_BUFFER_BIAS
21        depends on USB_OTG_SUPPORTED
22        prompt "Hardware FIFO size biasing"
23        default USB_HOST_HW_BUFFER_BIAS_BALANCED
24        help
25            The underlying hardware has size adjustable FIFOs to cache USB packets on reception (IN) or for
26            transmission (OUT). The size of these FIFOs will affect the largest MPS (maximum packet size) and the
27            maximum number of packets that can be cached at any one time. The hardware contains the following
28            FIFOS: RX (for all IN packets), Non-periodic TX (for Bulk and Control OUT packets), and Periodic TX
29            (for Interrupt and Isochronous OUT packets). This configuration option allows biasing the FIFO sizes
30            towards a particular use case, which may be necessary for devices that have endpoints with large MPS.
31            The MPS limits for each biasing are listed below:
32
33            Balanced:
34            - IN (all transfer types), 408 bytes
35            - OUT non-periodic (Bulk/Control), 192 bytes (i.e., 3 x 64 byte packets)
36            - OUT periodic (Interrupt/Isochronous), 192 bytes
37
38            Bias IN:
39            - IN (all transfer types), 600 bytes
40            - OUT non-periodic (Bulk/Control), 64 bytes (i.e., 1 x 64 byte packets)
41            - OUT periodic (Interrupt/Isochronous), 128 bytes
42
43            Bias Periodic OUT:
44            - IN (all transfer types), 128 bytes
45            - OUT non-periodic (Bulk/Control), 64 bytes (i.e., 1 x 64 byte packets)
46            - OUT periodic (Interrupt/Isochronous), 600 bytes
47
48        config USB_HOST_HW_BUFFER_BIAS_BALANCED
49            bool "Balanced"
50        config USB_HOST_HW_BUFFER_BIAS_IN
51            bool "Bias IN"
52        config USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT
53            bool "Periodic OUT"
54    endchoice
55
56endmenu #USB-OTG
57