Skip to content

Commit d009787

Browse files
committed
Update TinyUSB
1 parent 57b7e4c commit d009787

File tree

146 files changed

+12768
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+12768
-559
lines changed

platform.txt

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

tools/platformio-build-esp32s2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
"UNITY_INCLUDE_CONFIG_H",
222222
"WITH_POSIX",
223223
"_GNU_SOURCE",
224-
("IDF_VER", '\\"v4.2-dev-1660-g7d7521367\\"'),
224+
("IDF_VER", '\\"v4.2-dev-1660-g7d7521367-dirty\\"'),
225225
"ESP_PLATFORM",
226226
("CFG_TUSB_MCU", 'OPT_MCU_ESP32_S2'),
227227
"ARDUINO_ARCH_ESP32",

tools/sdk/esp32s2/include/config/sdkconfig.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,22 +353,13 @@
353353
#define CONFIG_SPIFFS_META_LENGTH 4
354354
#define CONFIG_SPIFFS_USE_MTIME 1
355355
#define CONFIG_USB_ENABLED 1
356-
#define CONFIG_USB_CDC_ENABLED 1
357-
#define CONFIG_USB_CDC_RX_BUFSIZE 64
358-
#define CONFIG_USB_CDC_TX_BUFSIZE 64
359-
#define CONFIG_USB_MSC_ENABLED 1
360-
#define CONFIG_USB_MSC_BUFSIZE 512
361-
#define CONFIG_USB_HID_ENABLED 1
362-
#define CONFIG_USB_HID_BUFSIZE 16
356+
#define CONFIG_USB_MAX_POWER_USAGE 250
363357
#define CONFIG_USB_DESC_USE_ESPRESSIF_VID 1
364358
#define CONFIG_USB_DESC_USE_DEFAULT_PID 1
365359
#define CONFIG_USB_DESC_BCDDEVICE 0x0100
366360
#define CONFIG_USB_DESC_MANUFACTURER_STRING "Espressif Systems"
367361
#define CONFIG_USB_DESC_PRODUCT_STRING "Espressif Device"
368362
#define CONFIG_USB_DESC_SERIAL_STRING "123456"
369-
#define CONFIG_USB_DESC_CDC_STRING "Espressif CDC Device"
370-
#define CONFIG_USB_DESC_MSC_STRING "Espressif MSC Device"
371-
#define CONFIG_USB_DESC_HID_STRING "Espressif HID Device"
372363
#define CONFIG_UNITY_ENABLE_FLOAT 1
373364
#define CONFIG_UNITY_ENABLE_DOUBLE 1
374365
#define CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER 1

tools/sdk/esp32s2/include/tinyusb/port/common/include/descriptors_control.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* [MSB] HID | MSC | CDC [LSB]
2626
*/
2727
#define EPNUM_MSC 0x03
28+
#define EPNUM_VENDOR 0x06
29+
#define EPNUM_MIDI 0x05
2830

2931
#ifdef __cplusplus
3032
extern "C" {
@@ -52,12 +54,21 @@ enum {
5254
ITF_NUM_HID,
5355
# endif
5456

55-
ITF_NUM_TOTAL
57+
# if CFG_TUD_MIDI
58+
ITF_NUM_MIDI,
59+
ITF_NUM_MIDI_STREAMING,
60+
# endif
61+
62+
# if CFG_TUD_VENDOR
63+
ITF_NUM_VENDOR,
64+
# endif
65+
66+
ITF_NUM_TOTAL
5667
};
5768

5869
enum {
5970
CONFIG_TOTAL_LEN = TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + CFG_TUD_MSC * TUD_MSC_DESC_LEN +
60-
CFG_TUD_HID * TUD_HID_DESC_LEN
71+
CFG_TUD_HID * TUD_HID_DESC_LEN + CFG_TUD_VENDOR * TUD_VENDOR_DESC_LEN + CFG_TUD_MIDI * TUD_MIDI_DESC_LEN
6172
};
6273

6374
bool tusb_desc_set;

tools/sdk/esp32s2/include/tinyusb/port/common/include/usb_descriptors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define USB_ESPRESSIF_VID 0x303A
2222

23-
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 7
23+
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 9
2424
typedef char *tusb_desc_strarray_device_t[USB_STRING_DESCRIPTOR_ARRAY_SIZE];
2525

2626
tusb_desc_device_t descriptor_tinyusb;

tools/sdk/esp32s2/include/tinyusb/port/esp32s2/include/tinyusb.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ extern "C" {
6161
# endif
6262
# endif
6363

64+
# if CFG_TUD_VENDOR
65+
# if (CFG_TUD_VENDOR_EPSIZE < 4)
66+
# define CFG_TUD_VENDOR_EPSIZE 4
67+
# warning "CFG_TUD_VENDOR_EPSIZE was too low and was set to 4"
68+
# endif
69+
# endif
70+
6471
# if CFG_TUD_CUSTOM_CLASS
6572
# warning "Please check that the buffer is more then 4 bytes"
6673
# endif

tools/sdk/esp32s2/include/tinyusb/port/esp32s2/include/tusb_config.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ extern "C" {
8989
# define CONFIG_USB_CUSTOM_CLASS_ENABLED 0
9090
#endif
9191

92+
#ifndef CONFIG_USB_VENDOR_ENABLED
93+
# define CONFIG_USB_VENDOR_ENABLED 0
94+
#endif
95+
9296
//------------- CLASS -------------//
9397
#define CFG_TUD_CDC CONFIG_USB_CDC_ENABLED
9498
#define CFG_TUD_MSC CONFIG_USB_MSC_ENABLED
@@ -97,7 +101,7 @@ extern "C" {
97101
#define CFG_TUD_MIDI CONFIG_USB_MIDI_ENABLED
98102
#define CFG_TUD_CUSTOM_CLASS CONFIG_USB_CUSTOM_CLASS_ENABLED
99103

100-
104+
#define CFG_TUD_VENDOR CONFIG_USB_VENDOR_ENABLED
101105

102106
// CDC FIFO size of TX and RX
103107
#define CFG_TUD_CDC_RX_BUFSIZE CONFIG_USB_CDC_RX_BUFSIZE
@@ -109,6 +113,13 @@ extern "C" {
109113
// HID buffer size Should be sufficient to hold ID (if any) + Data
110114
#define CFG_TUD_HID_BUFSIZE CONFIG_USB_HID_BUFSIZE
111115

116+
// VENDOR FIFO size of TX and RX
117+
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
118+
#define CFG_TUD_VENDOR_TX_BUFSIZE 64
119+
120+
// MIDI FIFO size of TX and RX
121+
#define CFG_TUD_MIDI_RX_BUFSIZE CONFIG_USB_MIDI_RX_BUFSIZE
122+
#define CFG_TUD_MIDI_TX_BUFSIZE CONFIG_USB_MIDI_TX_BUFSIZE
112123
#ifdef __cplusplus
113124
}
114125
#endif

tools/sdk/esp32s2/include/tinyusb/tinyusb/hw/bsp/board.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
#include <stdbool.h>
4040

4141
#include "ansi_escape.h"
42-
4342
#include "tusb.h"
4443

45-
#define CFG_UART_BAUDRATE 115200
44+
#define CFG_BOARD_UART_BAUDRATE 115200
4645

4746
//--------------------------------------------------------------------+
4847
// Board Porting API
@@ -68,18 +67,21 @@ int board_uart_write(void const * buf, int len);
6867
#if CFG_TUSB_OS == OPT_OS_NONE
6968
// Get current milliseconds, must be implemented when no RTOS is used
7069
uint32_t board_millis(void);
70+
7171
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
7272
static inline uint32_t board_millis(void)
7373
{
7474
return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ );
7575
}
76+
7677
#elif CFG_TUSB_OS == OPT_OS_MYNEWT
7778
static inline uint32_t board_millis(void)
7879
{
7980
return os_time_ticks_to_ms32( os_time_get() );
8081
}
81-
#elif
82-
#error "Need to implement board_millis() for this OS"
82+
83+
#else
84+
#error "board_millis() is not implemented for this OS"
8385
#endif
8486

8587
//--------------------------------------------------------------------+
@@ -95,20 +97,23 @@ static inline void board_led_off(void)
9597
board_led_write(false);
9698
}
9799

100+
// TODO remove
98101
static inline void board_delay(uint32_t ms)
99102
{
100103
uint32_t start_ms = board_millis();
101104
while (board_millis() - start_ms < ms)
102105
{
106+
#if TUSB_OPT_DEVICE_ENABLED
103107
// take chance to run usb background
104108
tud_task();
109+
#endif
105110
}
106111
}
107112

108-
static inline int8_t board_uart_getchar(void)
113+
static inline int board_uart_getchar(void)
109114
{
110115
uint8_t c;
111-
return board_uart_read(&c, 1) ? c : (-1);
116+
return board_uart_read(&c, 1) ? (int) c : (-1);
112117
}
113118

114119
static inline int board_uart_putchar(uint8_t c)
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2020, Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
28+
#ifndef BOARD_MCU_H_
29+
#define BOARD_MCU_H_
30+
31+
#include "tusb_option.h"
32+
33+
//--------------------------------------------------------------------+
34+
// Low Level MCU header include. TinyUSB stack and example should be
35+
// platform independent and mostly doens't need to include this file.
36+
// However there are still certain situation where this file is needed:
37+
// - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
38+
// - SWO logging for Cortex M with ITM_SendChar() / ITM_ReceiveChar()
39+
//--------------------------------------------------------------------+
40+
41+
// Include order follows OPT_MCU_ number
42+
#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
43+
CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
44+
CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
45+
CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
46+
#include "chip.h"
47+
48+
#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
49+
CFG_TUSB_MCU == OPT_MCU_LPC55XX
50+
#include "fsl_device_registers.h"
51+
52+
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
53+
#include "nrf.h"
54+
55+
#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
56+
#include "sam.h"
57+
58+
#elif CFG_TUSB_MCU == OPT_MCU_SAMG
59+
#undef LITTLE_ENDIAN // hack to suppress "LITTLE_ENDIAN" redefined
60+
#include "sam.h"
61+
62+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
63+
#include "stm32f0xx.h"
64+
65+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
66+
#include "stm32f1xx.h"
67+
68+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
69+
#include "stm32f2xx.h"
70+
71+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
72+
#include "stm32f3xx.h"
73+
74+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
75+
#include "stm32f4xx.h"
76+
77+
#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
78+
#include "stm32f7xx.h"
79+
80+
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
81+
#include "stm32h7xx.h"
82+
83+
#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
84+
#include "stm32l0xx.h"
85+
86+
#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
87+
#include "stm32l1xx.h"
88+
89+
#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
90+
#include "stm32l4xx.h"
91+
92+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
93+
// no header needed
94+
95+
#elif CFG_TUSB_MCU == OPT_MCU_MSP430x5xx
96+
#include "msp430.h"
97+
98+
#elif CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI
99+
// no header needed
100+
101+
#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
102+
#include "fsl_device_registers.h"
103+
104+
#elif CFG_TUSB_MCU == OPT_MCU_NUC120
105+
#include "NUC100Series.h"
106+
107+
#elif CFG_TUSB_MCU == OPT_MCU_NUC121 || CFG_TUSB_MCU == OPT_MCU_NUC126
108+
#include "NuMicro.h"
109+
110+
#elif CFG_TUSB_MCU == OPT_MCU_NUC505
111+
#include "NUC505Series.h"
112+
113+
#elif CFG_TUSB_MCU == OPT_MCU_ESP32S2
114+
// no header needed
115+
116+
#else
117+
#error "Missing MCU header"
118+
#endif
119+
120+
121+
#endif /* BOARD_MCU_H_ */

0 commit comments

Comments
 (0)