Bladeren bron

Merge tag '0.13.0' into patch

tfx2001 4 jaren geleden
bovenliggende
commit
5624638a75

+ 10 - 3
CONTRIBUTORS.rst

@@ -18,6 +18,12 @@ Notable contributors
 -  Design the project logo
 
 
+`Gordon McNab <https://github.com/ftdigdm>`__
+---------------------------------------------
+
+-  Add new DCD port for Bridgetek FT90x and FT93x
+
+
 `Ha Thach <https://github.com/hathach>`__
 -----------------------------------------
 
@@ -53,6 +59,7 @@ Notable contributors
 -----------------------------------------------
 
 -  Add new DCD port for Dialog DA1469x
+-  Add new DCD port for PIC32MZ
 -  Add new class driver for Bluetooth HCI
 -  Add ISO transfer for STM32 Synopsys, Nordic nRF, Dialog DA1469x
 -  Improve Audio driver and add uac2\_headset example
@@ -81,11 +88,11 @@ Notable contributors
 `Koji KITAYAMA <https://github.com/kkitayam>`__
 -----------------------------------------------
 
--  Add new DCD port for NXP Kinetis KL25
--  Add new DCD port for Renesas RX family (RX600, RX700 ..) with GR-CITRUS, RX65n target board
+-  Add new DCD and HCD port for NXP Kinetis KL25
+-  Add new DCD and HCD port for Renesas RX family (RX600, RX700 ..) with GR-CITRUS, RX65n target board
+-  Add new DCD and HCD port for Mentor musb with MSP432E4
 -  Add new class driver for USB Video Class (UVC 1.5)
 
-
 `Nathan Conrad <https://github.com/pigrew>`__
 ---------------------------------------------
 

+ 40 - 0
docs/info/changelog.rst

@@ -2,6 +2,46 @@
 Changelog
 *********
 
+0.13.0
+======
+
+- [tu_fifo] Fix locked mutex when full, and return type in peek_n()
+
+Controller Driver (DCD & HCD)
+-----------------------------
+
+- [DWC2] Generalize synopsys dwc2 with synopsys/dwc2 which support both FS and HS phy (UTMI and ULPI) for various MCUs.
+  - Broadcom 28/27xx on raspberrypi SBC
+  - Silicon Labs EFM32
+  - Espressif ESP32 Sx
+  - GigaDevice GD32
+  - ST STM32
+  - Infineon XMC
+- [KL25] Add new HCD for NXP KL25
+- [MUSB] Add new DCD and HCD for Mentor musb with TI MSP432E4
+- [F1C100s] Add new DCD for Allwinner F1C100s family
+- [PIC32MZ] Add new DCD for PIC32MZ
+- [nRF] Fix/Enhance varous race condtion with: EASY DMA, request HFXO, EPOUT
+- [ChipIdea] rename Transdimension to more popular ChipIdea Highspeed, 
+- [RP2040] various update/fix for hcd/dcd
+- [FT9XX] new DCD port for Bridgetek FT90x and FT93x devices
+- [DA1469X] Fix resume
+- [OHCI] Fix device array out of bound
+
+Note: legacy drivers such as st/synopsys, nxp/transdimension are still present in this release but won't recieve more update and could be removed in the future.
+
+Device Stack
+------------
+
+- [Audio] Support disabling feedback format correction (16.16 <-> 10.14 format)
+- [MSC] Add tud_msc_request_sense_cb() callback, change most default sense error to medium not present (0x02, 0x3A, 0x00)
+- [Video] Fix video_capture example fails enumeration when 8FPS
+
+Host Stack
+----------
+
+No notable changes
+
 0.12.0
 ======
 

+ 4 - 0
docs/reference/getting_started.rst

@@ -52,6 +52,8 @@ Some TinyUSB examples also requires external submodule libraries in ``/lib`` suc
 
 In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the ``make`` to build your board.
 
+Some modules will also require a module-specific SDK (e.g. RP2040) or binary (e.g. Sony Spresense) to build examples.
+
 Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy ``/examples/device/99-tinyusb.rules`` file to /etc/udev/rules.d/ then run ``sudo udevadm control --reload-rules && sudo udevadm trigger`` is good enough.
 
 Build
@@ -63,6 +65,8 @@ To build example, first change directory to an example folder.
 
    $ cd examples/device/cdc_msc
 
+Some modules (e.g. RP2040 and ESP32s2) require the project makefiles to be customized using CMake. If necessary apply any setup steps for the platform's SDK.
+
 Then compile with ``make BOARD=[board_name] all``\ , for example
 
 .. code-block::

+ 4 - 0
examples/device/cdc_msc_freertos/src/CMakeLists.txt

@@ -13,6 +13,10 @@ target_include_directories(${COMPONENT_TARGET} PUBLIC
   "${TOP}/src"
 )
 
+target_compile_definitions(${COMPONENT_TARGET} PUBLIC
+  ESP_PLATFORM
+)
+
 target_sources(${COMPONENT_TARGET} PUBLIC
   "${TOP}/src/tusb.c"
   "${TOP}/src/common/tusb_fifo.c"

+ 4 - 0
examples/device/hid_composite_freertos/src/CMakeLists.txt

@@ -13,6 +13,10 @@ target_include_directories(${COMPONENT_TARGET} PUBLIC
   "${TOP}/src"
 )
 
+target_compile_definitions(${COMPONENT_TARGET} PUBLIC
+  ESP_PLATFORM
+)
+
 target_sources(${COMPONENT_TARGET} PUBLIC
   "${TOP}/src/tusb.c"
   "${TOP}/src/common/tusb_fifo.c"

+ 6 - 1
hw/bsp/esp32s2/boards/esp32s2.c

@@ -32,9 +32,14 @@
 #include "hal/usb_hal.h"
 #include "soc/usb_periph.h"
 
-#include "driver/periph_ctrl.h"
 #include "driver/rmt.h"
 
+#if ESP_IDF_VERSION_MAJOR > 4
+  #include "esp_private/periph_ctrl.h"
+#else
+  #include "driver/periph_ctrl.h"
+#endif
+
 #ifdef NEOPIXEL_PIN
 #include "led_strip.h"
 static led_strip_t *strip;

+ 1 - 0
hw/bsp/esp32s2/family.mk

@@ -10,6 +10,7 @@ build: all
 fullclean:
 	if test -f sdkconfig; then $(RM) -f sdkconfig ; fi
 	if test -d $(BUILD); then $(RM) -rf $(BUILD) ; fi
+	idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) $@
 
 clean flash bootloader-flash app-flash erase monitor dfu-flash dfu size size-components size-files:
 	idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) $@

+ 6 - 1
hw/bsp/esp32s3/boards/esp32s3.c

@@ -32,9 +32,14 @@
 #include "hal/usb_hal.h"
 #include "soc/usb_periph.h"
 
-#include "driver/periph_ctrl.h"
 #include "driver/rmt.h"
 
+#if ESP_IDF_VERSION_MAJOR > 4
+  #include "esp_private/periph_ctrl.h"
+#else
+  #include "driver/periph_ctrl.h"
+#endif
+
 #ifdef NEOPIXEL_PIN
 #include "led_strip.h"
 static led_strip_t *strip;

+ 3 - 1
src/osal/osal_freertos.h

@@ -68,6 +68,7 @@ static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
     BaseType_t res = xSemaphoreGiveFromISR(sem_hdl, &xHigherPriorityTaskWoken);
 
 #if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
+    // not needed after https://github.com/espressif/esp-idf/commit/c5fd79547ac9b7bae06fa660e9f814d18d3390b7
     if ( xHigherPriorityTaskWoken ) portYIELD_FROM_ISR();
 #else
     portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
@@ -151,6 +152,7 @@ static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in
     BaseType_t res = xQueueSendToBackFromISR(qhdl, data, &xHigherPriorityTaskWoken);
 
 #if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
+    // not needed after https://github.com/espressif/esp-idf/commit/c5fd79547ac9b7bae06fa660e9f814d18d3390b7
     if ( xHigherPriorityTaskWoken ) portYIELD_FROM_ISR();
 #else
     portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
@@ -169,4 +171,4 @@ static inline bool osal_queue_empty(osal_queue_t qhdl)
  }
 #endif
 
-#endif /* _TUSB_OSAL_FREERTOS_H_ */
+#endif

+ 1 - 1
src/osal/osal_rtx4.h

@@ -167,4 +167,4 @@ static inline bool osal_queue_empty(osal_queue_t qhdl)
  }
 #endif
 
-#endif /* _TUSB_OSAL_FREERTOS_H_ */
+#endif

+ 14 - 2
src/portable/nordic/nrf5x/dcd_nrf5x.c

@@ -79,6 +79,9 @@ typedef struct
 
 } xfer_td_t;
 
+static osal_mutex_def_t dcd_mutex_def;
+static osal_mutex_t dcd_mutex;
+
 // Data for managing dcd
 static struct
 {
@@ -154,6 +157,7 @@ static void edpt_dma_start(volatile uint32_t* reg_startep)
     // Should be safe to blocking wait until previous DMA transfer complete
     uint8_t const rhport = 0;
     bool started = false;
+    osal_mutex_lock(dcd_mutex, OSAL_TIMEOUT_WAIT_FOREVER);
     while(!started)
     {
       // LDREX/STREX may be needed in form of std atomic (required C11) or
@@ -170,6 +174,7 @@ static void edpt_dma_start(volatile uint32_t* reg_startep)
 
       // osal_yield();
     }
+    osal_mutex_unlock(dcd_mutex);
   }
 }
 
@@ -243,6 +248,7 @@ static void xact_in_dma(uint8_t epnum)
 void dcd_init (uint8_t rhport)
 {
   TU_LOG1("dcd init\r\n");
+  dcd_mutex = osal_mutex_create(&dcd_mutex_def);
   (void) rhport;
 }
 
@@ -457,11 +463,17 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
 
   xfer_td_t* xfer = get_td(epnum, dir);
 
-  dcd_int_disable(rhport);
+  if (!is_in_isr()) {
+    osal_mutex_lock(dcd_mutex, OSAL_TIMEOUT_WAIT_FOREVER);
+    dcd_int_disable(rhport);
+  }
   xfer->buffer     = buffer;
   xfer->total_len  = total_bytes;
   xfer->actual_len = 0;
-  dcd_int_enable(rhport);
+  if (!is_in_isr()) {
+    dcd_int_enable(rhport);
+    osal_mutex_unlock(dcd_mutex);
+  }
 
   // Control endpoint with zero-length packet and opposite direction to 1st request byte --> status stage
   bool const control_status = (epnum == 0 && total_bytes == 0 && dir != tu_edpt_dir(NRF_USBD->BMREQUESTTYPE));

+ 1 - 1
src/tusb_option.h

@@ -30,7 +30,7 @@
 #include "common/tusb_compiler.h"
 
 #define TUSB_VERSION_MAJOR     0
-#define TUSB_VERSION_MINOR     12
+#define TUSB_VERSION_MINOR     13
 #define TUSB_VERSION_REVISION  0
 #define TUSB_VERSION_STRING    TU_STRING(TUSB_VERSION_MAJOR) "." TU_STRING(TUSB_VERSION_MINOR) "." TU_STRING(TUSB_VERSION_REVISION)