@@ -38,17 +38,43 @@ extern "C" {
38
38
// libraries, this file is used to make it compatible with ESP32 Arduino core.
39
39
40
40
// This file also contains additional configuration for EPS32 in addition to
41
- // tools/sdk /esp32xx/include/arduino_tinyusb/include/tusb_config.h
41
+ // tools/esp32-arduino-libs /esp32xx/include/arduino_tinyusb/include/tusb_config.h
42
42
43
43
//--------------------------------------------------------------------+
44
44
// ESP32 out-of-sync
45
45
//--------------------------------------------------------------------+
46
46
#include "esp_arduino_version.h"
47
+ #include "sdkconfig.h"
47
48
48
49
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL (2 , 0 , 8 )
49
50
#error "ESP32 Arduino core version 2.0.8 or later is required"
50
51
#endif
51
52
53
+ //--------------------------------------------------------------------
54
+ // COMMON CONFIGURATION
55
+ // Note: it is possible to use tinyusb + max3421e as host controller
56
+ // with no OTG USB MCU such as eps32, c3 etc...
57
+ //--------------------------------------------------------------------
58
+
59
+ #if CONFIG_IDF_TARGET_ESP32S2
60
+ #define CFG_TUSB_MCU OPT_MCU_ESP32S2
61
+ #elif CONFIG_IDF_TARGET_ESP32S3
62
+ #define CFG_TUSB_MCU OPT_MCU_ESP32S3
63
+ #elif CONFIG_IDF_TARGET_ESP32P4
64
+ #define CFG_TUSB_MCU OPT_MCU_ESP32P4
65
+ #else
66
+ #define CFG_TUSB_MCU OPT_MCU_ESP32
67
+ #define CFG_TUH_MAX3421 1
68
+ #endif
69
+
70
+ #if CONFIG_IDF_TARGET_ESP32P4
71
+ #define CFG_TUD_MAX_SPEED OPT_MODE_HIGH_SPEED
72
+ #define CFG_TUH_MAX_SPEED OPT_MODE_HIGH_SPEED
73
+ #else
74
+ #define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED
75
+ #define CFG_TUH_MAX_SPEED OPT_MODE_FULL_SPEED
76
+ #endif
77
+
52
78
#ifndef CFG_TUSB_OS
53
79
#define CFG_TUSB_OS OPT_OS_FREERTOS
54
80
// clang-format off
@@ -64,34 +90,57 @@ extern "C" {
64
90
#define CFG_TUH_LOG_LEVEL 2
65
91
#endif
66
92
67
- //--------------------------------------------------------------------
68
- // COMMON CONFIGURATION
69
- // Note: it is possible to use tinyusb + max3421e as host controller
70
- // with no OTG USB MCU such as eps32, c3 etc...
71
- //--------------------------------------------------------------------
72
-
73
93
#ifndef CFG_TUSB_DEBUG
74
94
#define CFG_TUSB_DEBUG 0
75
95
#endif
76
96
77
97
// For selectively disable device log (when > CFG_TUSB_DEBUG)
78
98
// #define CFG_TUD_LOG_LEVEL 3
79
99
100
+ #define CFG_TUSB_MEM_SECTION
101
+ #define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
102
+
80
103
//--------------------------------------------------------------------
81
104
// DEVICE CONFIGURATION
82
105
//--------------------------------------------------------------------
106
+ #define CFG_TUD_ENABLED 1
107
+
108
+ #define CFG_TUD_CDC 2
109
+ #define CFG_TUD_MSC 1
110
+ #define CFG_TUD_HID 2
111
+ #define CFG_TUD_MIDI 1
112
+ #define CFG_TUD_VENDOR 1
113
+ #define CFG_TUD_VIDEO 1
114
+ #define CFG_TUD_VIDEO_STREAMING 1
115
+
116
+ // video streaming endpoint buffer size
117
+ #define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE \
118
+ CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE
83
119
84
- // device configuration is configured in BSP
85
- // sdk/include/arduino_tinyusb/include/tusb_config.h
120
+ // CDC FIFO size of TX and RX
121
+ #define CFG_TUD_CDC_RX_BUFSIZE CONFIG_TINYUSB_CDC_RX_BUFSIZE
122
+ #define CFG_TUD_CDC_TX_BUFSIZE CONFIG_TINYUSB_CDC_TX_BUFSIZE
123
+
124
+ // MSC Buffer size of Device Mass storage
125
+ #define CFG_TUD_MSC_EP_BUFSIZE CONFIG_TINYUSB_MSC_BUFSIZE
126
+
127
+ // HID buffer size Should be sufficient to hold ID (if any) + Data
128
+ #define CFG_TUD_HID_BUFSIZE CONFIG_TINYUSB_HID_BUFSIZE
129
+
130
+ // MIDI FIFO size of TX and RX
131
+ #define CFG_TUD_MIDI_RX_BUFSIZE CONFIG_TINYUSB_MIDI_RX_BUFSIZE
132
+ #define CFG_TUD_MIDI_TX_BUFSIZE CONFIG_TINYUSB_MIDI_TX_BUFSIZE
133
+
134
+ // Vendor FIFO size of TX and RX
135
+ #define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE
136
+ #define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE
86
137
87
138
//--------------------------------------------------------------------
88
139
// Host Configuration
89
140
//--------------------------------------------------------------------
90
141
91
142
// Enable host stack with MAX3421E (host shield)
92
143
#define CFG_TUH_ENABLED 1
93
- #define CFG_TUH_MAX_SPEED OPT_MODE_FULL_SPEED
94
- #define CFG_TUH_MAX3421 1
95
144
96
145
#ifndef CFG_TUH_MAX3421_ENDPOINT_TOTAL
97
146
#define CFG_TUH_MAX3421_ENDPOINT_TOTAL (8 + 4 * (CFG_TUH_DEVICE_MAX - 1))
0 commit comments