Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/class/midi/midi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ uint32_t tuh_midi_stream_write(uint8_t idx, uint8_t cable_num, uint8_t const *bu
if (data >= MIDI_STATUS_SYSREAL_TIMING_CLOCK) {
// real-time messages need to be sent right away
midi_driver_stream_t streamrt;
streamrt.buffer[0] = MIDI_CIN_SYSEX_END_1BYTE;
streamrt.buffer[0] = (uint8_t)((cable_num << 4) | MIDI_CIN_SYSEX_END_1BYTE);
streamrt.buffer[1] = data;
streamrt.index = 2;
streamrt.total = 2;
Expand All @@ -476,9 +476,9 @@ uint32_t tuh_midi_stream_write(uint8_t idx, uint8_t cable_num, uint8_t const *bu
stream->buffer[1] = data;

// Check to see if we're still in a SysEx transmit.
if (stream->buffer[0] == MIDI_CIN_SYSEX_START) {
if ((stream->buffer[0] & 0xF) == MIDI_CIN_SYSEX_START) {
if (data == MIDI_STATUS_SYSEX_END) {
stream->buffer[0] = MIDI_CIN_SYSEX_END_1BYTE;
stream->buffer[0] = (uint8_t)((cable_num << 4) | MIDI_CIN_SYSEX_END_1BYTE);
stream->total = 2;
} else {
stream->total = 4;
Expand Down Expand Up @@ -506,6 +506,7 @@ uint32_t tuh_midi_stream_write(uint8_t idx, uint8_t cable_num, uint8_t const *bu
stream->buffer[0] = MIDI_CIN_SYSEX_END_1BYTE;
stream->total = 2;
}
stream->buffer[0] |= (uint8_t)(cable_num << 4);
} else {
// Pack individual bytes if we don't support packing them into words.
stream->buffer[0] = (uint8_t) (cable_num << 4 | 0xf);
Expand All @@ -520,8 +521,8 @@ uint32_t tuh_midi_stream_write(uint8_t idx, uint8_t cable_num, uint8_t const *bu
stream->buffer[stream->index] = data;
stream->index++;
// See if this byte ends a SysEx.
if (stream->buffer[0] == MIDI_CIN_SYSEX_START && data == MIDI_STATUS_SYSEX_END) {
stream->buffer[0] = MIDI_CIN_SYSEX_START + (stream->index - 1);
if ((stream->buffer[0] & 0xF) == MIDI_CIN_SYSEX_START && data == MIDI_STATUS_SYSEX_END) {
stream->buffer[0] = (uint8_t)((cable_num << 4) | (MIDI_CIN_SYSEX_START + (stream->index - 1)));
stream->total = stream->index;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/common/tusb_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
#elif TU_CHECK_MCU(OPT_MCU_STM32C0)
#define TUP_USBIP_FSDEV
#define TUP_USBIP_FSDEV_STM32
#define TUP_USBIP_FSDEV_DRD
#define CFG_TUSB_FSDEV_PMA_SIZE 2048u

#elif TU_CHECK_MCU(OPT_MCU_STM32F0)
Expand Down Expand Up @@ -278,6 +279,7 @@
#elif TU_CHECK_MCU(OPT_MCU_STM32G0)
#define TUP_USBIP_FSDEV
#define TUP_USBIP_FSDEV_STM32
#define TUP_USBIP_FSDEV_DRD
#define CFG_TUSB_FSDEV_PMA_SIZE 2048u

#elif TU_CHECK_MCU(OPT_MCU_STM32G4)
Expand All @@ -293,6 +295,7 @@
#elif TU_CHECK_MCU(OPT_MCU_STM32H5)
#define TUP_USBIP_FSDEV
#define TUP_USBIP_FSDEV_STM32
#define TUP_USBIP_FSDEV_DRD
#define CFG_TUSB_FSDEV_PMA_SIZE 2048u

#elif TU_CHECK_MCU(OPT_MCU_STM32H7)
Expand Down Expand Up @@ -366,13 +369,15 @@
#elif TU_CHECK_MCU(OPT_MCU_STM32U3)
#define TUP_USBIP_FSDEV
#define TUP_USBIP_FSDEV_STM32
#define TUP_USBIP_FSDEV_DRD
#define CFG_TUSB_FSDEV_PMA_SIZE 2048u

#elif TU_CHECK_MCU(OPT_MCU_STM32U5)
// U535/545 use fsdev
#if defined(STM32U535xx) || defined(STM32U545xx)
#define TUP_USBIP_FSDEV
#define TUP_USBIP_FSDEV_STM32
#define TUP_USBIP_FSDEV_DRD
#define CFG_TUSB_FSDEV_PMA_SIZE 2048u
#else
#define TUP_USBIP_DWC2
Expand Down
2 changes: 1 addition & 1 deletion src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void dcd_edpt_close_all(uint8_t rhport) {
dcd_int_enable(rhport);

// Reset PMA allocation
ep_buf_ptr = FSDEV_BTABLE_BASE + 8 * CFG_TUD_ENDPPOINT_MAX + 2 * CFG_TUD_ENDPOINT0_SIZE;
ep_buf_ptr = FSDEV_BTABLE_BASE + 8 * FSDEV_EP_COUNT + 2 * CFG_TUD_ENDPOINT0_SIZE;
}

bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size) {
Expand Down
7 changes: 2 additions & 5 deletions src/portable/st/stm32_fsdev/hcd_stm32_fsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@

#include "tusb_option.h"

#if CFG_TUH_ENABLED && defined(TUP_USBIP_FSDEV) && \
TU_CHECK_MCU(OPT_MCU_STM32C0, OPT_MCU_STM32G0, OPT_MCU_STM32H5, OPT_MCU_STM32U5)
#if CFG_TUH_ENABLED && defined(TUP_USBIP_FSDEV) && defined(TUP_USBIP_FSDEV_DRD)

#include "host/hcd.h"
#include "host/usbh.h"
Expand Down Expand Up @@ -672,10 +671,8 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
// Clear stall, data toggle is also reset to DATA0
bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) {
(void) rhport;
(void) dev_addr;
(void) ep_addr;

uint8_t const ep_id = endpoint_find(dev_addr, 0);
uint8_t const ep_id = endpoint_find(dev_addr, ep_addr);
TU_ASSERT(ep_id != TUSB_INDEX_INVALID_8);

hcd_endpoint_t *edpt = &_hcd_data.edpt[ep_id];
Expand Down
Loading