mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
fix build error with midi, use usbd_edpt_xfer/busy for midi to replace dcd_*
This commit is contained in:
parent
15208e710a
commit
7156bfb54d
@ -95,6 +95,9 @@
|
||||
// Should be sufficient to hold ID (if any) + Data
|
||||
#define CFG_TUD_HID_BUFSIZE 16
|
||||
|
||||
#define CFG_TUD_MIDI_RX_BUFSIZE 512
|
||||
#define CFG_TUD_MIDI_TX_BUFSIZE 512
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@ SRC_C += \
|
||||
src/class/msc/msc_device.c \
|
||||
src/class/cdc/cdc_device.c \
|
||||
src/class/hid/hid_device.c \
|
||||
src/class/midi/midi_device.c \
|
||||
src/tusb.c \
|
||||
src/portable/$(VENDOR)/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool cusd_open(uint8_t rhport, tusb_desc_interface_t const * p_desc_itf, uint16_
|
||||
(*p_len) = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
|
||||
|
||||
// TODO Prepare for incoming data
|
||||
// TU_ASSERT( dcd_edpt_xfer(rhport, p_itf->ep_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cbw_t)) );
|
||||
// TU_ASSERT( usbd_edpt_xfer(rhport, p_itf->ep_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cbw_t)) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ typedef struct
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
CFG_TUSB_ATTR_USBRAM midid_interface_t _midid_itf[CFG_TUD_MIDI];
|
||||
CFG_TUSB_MEM_SECTION midid_interface_t _midid_itf[CFG_TUD_MIDI];
|
||||
|
||||
bool tud_midi_n_connected(uint8_t itf) {
|
||||
midid_interface_t* midi = &_midid_itf[itf];
|
||||
@ -133,13 +133,13 @@ void midi_rx_done_cb(midid_interface_t* midi, uint8_t const* buffer, uint32_t bu
|
||||
|
||||
static bool maybe_transmit(midid_interface_t* midi, uint8_t itf_index)
|
||||
{
|
||||
TU_VERIFY( !dcd_edpt_busy(TUD_OPT_RHPORT, midi->ep_in) ); // skip if previous transfer not complete
|
||||
TU_VERIFY( !usbd_edpt_busy(TUD_OPT_RHPORT, midi->ep_in) ); // skip if previous transfer not complete
|
||||
|
||||
uint16_t count = tu_fifo_read_n(&midi->tx_ff, midi->epin_buf, CFG_TUD_MIDI_EPSIZE);
|
||||
if (count > 0)
|
||||
{
|
||||
TU_VERIFY( tud_midi_n_connected(itf_index) ); // fifo is empty if not connected
|
||||
TU_ASSERT( dcd_edpt_xfer(TUD_OPT_RHPORT, midi->ep_in, midi->epin_buf, count) );
|
||||
TU_ASSERT( usbd_edpt_xfer(TUD_OPT_RHPORT, midi->ep_in, midi->epin_buf, count) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -304,7 +304,7 @@ bool midid_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc,
|
||||
}
|
||||
|
||||
// Prepare for incoming data
|
||||
TU_ASSERT( dcd_edpt_xfer(rhport, p_midi->ep_out, p_midi->epout_buf, CFG_TUD_MIDI_EPSIZE), false);
|
||||
TU_ASSERT( usbd_edpt_xfer(rhport, p_midi->ep_out, p_midi->epout_buf, CFG_TUD_MIDI_EPSIZE), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -334,7 +334,7 @@ bool midid_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint
|
||||
midi_rx_done_cb(p_midi, p_midi->epout_buf, xferred_bytes);
|
||||
|
||||
// prepare for next
|
||||
TU_ASSERT( dcd_edpt_xfer(rhport, p_midi->ep_out, p_midi->epout_buf, CFG_TUD_MIDI_EPSIZE), false );
|
||||
TU_ASSERT( usbd_edpt_xfer(rhport, p_midi->ep_out, p_midi->epout_buf, CFG_TUD_MIDI_EPSIZE), false );
|
||||
} else if ( edpt_addr == p_midi->ep_in ) {
|
||||
maybe_transmit(p_midi, itf);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "tusb.h"
|
||||
#include "usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
#include "dcd.h"
|
||||
|
||||
#ifndef CFG_TUD_TASK_QUEUE_SZ
|
||||
#define CFG_TUD_TASK_QUEUE_SZ 16
|
||||
|
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/dcd.h"
|
||||
#include "dcd.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Application API
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "tusb.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
#include "dcd.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -77,7 +77,7 @@
|
||||
#define CFG_TUD_MSC 1
|
||||
#define CFG_TUD_HID 1
|
||||
|
||||
#define CFG_TUD_MIDI 0
|
||||
#define CFG_TUD_MIDI 1
|
||||
#define CFG_TUD_CUSTOM_CLASS 0
|
||||
|
||||
//------------- CDC -------------//
|
||||
|
Loading…
x
Reference in New Issue
Block a user