- change signature of tuh_midi_mount/umount_cb()
- rename midi_stream_t to midi_driver_stream_t and move to midi.h (common for device and host)
This commit is contained in:
@@ -40,11 +40,7 @@
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
typedef struct {
|
||||
uint8_t buffer[4];
|
||||
uint8_t index;
|
||||
uint8_t total;
|
||||
} midid_stream_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t itf_num;
|
||||
@@ -54,8 +50,8 @@ typedef struct {
|
||||
// For Stream read()/write() API
|
||||
// Messages are always 4 bytes long, queue them for reading and writing so the
|
||||
// callers can use the Stream interface with single-byte read/write calls.
|
||||
midid_stream_t stream_write;
|
||||
midid_stream_t stream_read;
|
||||
midi_driver_stream_t stream_write;
|
||||
midi_driver_stream_t stream_read;
|
||||
|
||||
/*------------- From this point, data is not cleared by bus reset -------------*/
|
||||
// FIFO
|
||||
@@ -122,7 +118,7 @@ uint32_t tud_midi_n_available(uint8_t itf, uint8_t cable_num)
|
||||
(void) cable_num;
|
||||
|
||||
midid_interface_t* midi = &_midid_itf[itf];
|
||||
const midid_stream_t* stream = &midi->stream_read;
|
||||
const midi_driver_stream_t* stream = &midi->stream_read;
|
||||
|
||||
// when using with packet API stream total & index are both zero
|
||||
return tu_fifo_count(&midi->rx_ff) + (uint8_t) (stream->total - stream->index);
|
||||
@@ -136,7 +132,7 @@ uint32_t tud_midi_n_stream_read(uint8_t itf, uint8_t cable_num, void* buffer, ui
|
||||
uint8_t* buf8 = (uint8_t*) buffer;
|
||||
|
||||
midid_interface_t* midi = &_midid_itf[itf];
|
||||
midid_stream_t* stream = &midi->stream_read;
|
||||
midi_driver_stream_t* stream = &midi->stream_read;
|
||||
|
||||
uint32_t total_read = 0;
|
||||
while( bufsize )
|
||||
@@ -241,7 +237,7 @@ uint32_t tud_midi_n_stream_write(uint8_t itf, uint8_t cable_num, const uint8_t*
|
||||
midid_interface_t* midi = &_midid_itf[itf];
|
||||
TU_VERIFY(midi->ep_in, 0);
|
||||
|
||||
midid_stream_t* stream = &midi->stream_write;
|
||||
midi_driver_stream_t* stream = &midi->stream_write;
|
||||
|
||||
uint32_t i = 0;
|
||||
while ( (i < bufsize) && (tu_fifo_remaining(&midi->tx_ff) >= 4) )
|
||||
|
Reference in New Issue
Block a user