fix host midi build

This commit is contained in:
hathach
2025-02-12 11:50:57 +07:00
parent 294fb268d7
commit 7c405236cf
9 changed files with 51 additions and 22 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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);

View File

@@ -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),);

View File

@@ -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 \