summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/host/midi_rx/CMakeLists.txt25
-rw-r--r--examples/host/midi_rx/Makefile12
-rw-r--r--examples/host/midi_rx/only.txt19
-rw-r--r--examples/host/midi_rx/src/main.c4
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/class/midi/midi_host.c5
-rw-r--r--src/class/midi/midi_host.h2
-rw-r--r--src/host/usbh.c4
-rw-r--r--src/tinyusb.mk1
9 files changed, 51 insertions, 22 deletions
diff --git a/examples/host/midi_rx/CMakeLists.txt b/examples/host/midi_rx/CMakeLists.txt
index b5e5f6bc8..33953233d 100644
--- a/examples/host/midi_rx/CMakeLists.txt
+++ b/examples/host/midi_rx/CMakeLists.txt
@@ -1,27 +1,32 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
-# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
+# gets PROJECT name for the example
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
-project(${PROJECT})
+project(${PROJECT} C CXX ASM)
# Checks this example is valid for the family and initializes the project
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
+# Espressif has its own cmake build system
+if(FAMILY STREQUAL "espressif")
+ return()
+endif()
+
add_executable(${PROJECT})
# Example source
target_sources(${PROJECT} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ )
# Example include
target_include_directories(${PROJECT} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/src
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
-# Configure compilation flags and libraries for the example... see the corresponding function
-# in hw/bsp/FAMILY/family.cmake for details.
-family_configure_host_example(${PROJECT})
+# Configure compilation flags and libraries for the example without RTOS.
+# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
+family_configure_host_example(${PROJECT} noos)
diff --git a/examples/host/midi_rx/Makefile b/examples/host/midi_rx/Makefile
index af8ef4275..0235e08c3 100644
--- a/examples/host/midi_rx/Makefile
+++ b/examples/host/midi_rx/Makefile
@@ -1,9 +1,13 @@
-include ../../../tools/top.mk
-include ../../make.mk
+include ../../build_system/make/make.mk
+
INC += \
src \
$(TOP)/hw \
+
# Example source
-EXAMPLE_SOURCE += $(wildcard src/*.c)
+EXAMPLE_SOURCE += \
+ src/main.c
+
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-include ../../rules.mk
+
+include ../../build_system/make/rules.mk
diff --git a/examples/host/midi_rx/only.txt b/examples/host/midi_rx/only.txt
index 2ba4438fd..b6f87f423 100644
--- a/examples/host/midi_rx/only.txt
+++ b/examples/host/midi_rx/only.txt
@@ -1 +1,20 @@
+mcu:ESP32S2
+mcu:ESP32S3
+mcu:ESP32P4
+mcu:KINETIS_KL
+mcu:LPC175X_6X
+mcu:LPC177X_8X
+mcu:LPC18XX
+mcu:LPC40XX
+mcu:LPC43XX
+mcu:MAX3421
+mcu:MIMXRT1XXX
+mcu:MIMXRT10XX
+mcu:MIMXRT11XX
+mcu:MSP432E4
mcu:RP2040
+mcu:RX65X
+mcu:RAXXX
+mcu:STM32F4
+mcu:STM32F7
+mcu:STM32H7
diff --git a/examples/host/midi_rx/src/main.c b/examples/host/midi_rx/src/main.c
index 6c3311043..8b83977e2 100644
--- a/examples/host/midi_rx/src/main.c
+++ b/examples/host/midi_rx/src/main.c
@@ -27,10 +27,8 @@
#include <stdio.h>
#include <string.h>
-#include "bsp/board.h"
+#include "bsp/board_api.h"
#include "tusb.h"
-#include "class/midi/midi_host.h"
-
#if CFG_TUH_MIDI
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b3ab4d42..55c52033c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,6 +29,7 @@ function(tinyusb_target_add TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/host/hub.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_host.c
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/midi/midi_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
# typec
diff --git a/src/class/midi/midi_host.c b/src/class/midi/midi_host.c
index 061e17fee..fbb994ade 100644
--- a/src/class/midi/midi_host.c
+++ b/src/class/midi/midi_host.c
@@ -29,7 +29,7 @@
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_MIDI)
#include "host/usbh.h"
-#include "host/usbh_classdriver.h"
+#include "host/usbh_pvt.h"
#include "midi_host.h"
@@ -131,7 +131,7 @@ static uint32_t write_flush(uint8_t dev_addr, midih_interface_t* midi);
//--------------------------------------------------------------------+
// USBH API
//--------------------------------------------------------------------+
-void midih_init(void)
+bool midih_init(void)
{
tu_memclr(&_midi_host, sizeof(_midi_host));
// config fifos
@@ -146,6 +146,7 @@ void midih_init(void)
tu_fifo_config_mutex(&p_midi_host->tx_ff, osal_mutex_create(&p_midi_host->tx_ff_mutex), NULL);
#endif
}
+ return true;
}
bool midih_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
diff --git a/src/class/midi/midi_host.h b/src/class/midi/midi_host.h
index 292c596e4..edf57bfcb 100644
--- a/src/class/midi/midi_host.h
+++ b/src/class/midi/midi_host.h
@@ -107,7 +107,7 @@ uint8_t tuh_midi_get_all_istrings(uint8_t dev_addr, const uint8_t** istrings);
//--------------------------------------------------------------------+
// Internal Class Driver API
//--------------------------------------------------------------------+
-void midih_init (void);
+bool midih_init (void);
bool midih_open (uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *desc_itf, uint16_t max_len);
bool midih_set_config (uint8_t dev_addr, uint8_t itf_num);
bool midih_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 30a4f5f63..e38ee3187 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -1489,7 +1489,7 @@ static void process_enumeration(tuh_xfer_t* xfer) {
dev->i_serial = desc_device->iSerialNumber;
if (tuh_desc_device_cb) {
- tuh_desc_device_cb(daddr, (tusb_desc_device_t const*) _usbh_ctrl_buf);
+ tuh_desc_device_cb(daddr, (tusb_desc_device_t const*) _usbh_epbuf.ctrl);
}
// Get 9-byte for total length
@@ -1520,7 +1520,7 @@ static void process_enumeration(tuh_xfer_t* xfer) {
case ENUM_SET_CONFIG:
if (tuh_desc_config_cb) {
- tuh_desc_config_cb(daddr, (const tusb_desc_configuration_t*) _usbh_ctrl_buf);
+ tuh_desc_config_cb(daddr, (const tusb_desc_configuration_t*) _usbh_epbuf.ctrl);
}
TU_ASSERT(tuh_configuration_set(daddr, CONFIG_NUM, process_enumeration, ENUM_CONFIG_DRIVER),);
diff --git a/src/tinyusb.mk b/src/tinyusb.mk
index 89ea0212c..a9f623c24 100644
--- a/src/tinyusb.mk
+++ b/src/tinyusb.mk
@@ -21,6 +21,7 @@ TINYUSB_SRC_C += \
src/host/hub.c \
src/class/cdc/cdc_host.c \
src/class/hid/hid_host.c \
+ src/class/midi/midi_host.c \
src/class/msc/msc_host.c \
src/class/vendor/vendor_host.c \
src/typec/usbc.c \