Just changes after MIDI sysex debug

This commit is contained in:
Ross Owen
2013-02-07 17:14:16 +00:00
parent 4aafabd7cc
commit d921f04cd5

View File

@@ -11,7 +11,7 @@
#include "iapuser.h" #include "iapuser.h"
#endif #endif
//#define MIDI_LOOPBACK 1 //#define MIDI_LOOPBACK 1
int icount = 0;
static unsigned makeSymbol(unsigned data) static unsigned makeSymbol(unsigned data)
{ {
// Start and stop bits to the data packet // Start and stop bits to the data packet
@@ -32,38 +32,6 @@ static unsigned bit_time_2 = (XS1_TIMER_MHZ * 1000000 / (unsigned) RATE) / 2;
int mr_count = 0; // MIDI received (from HOST) int mr_count = 0; // MIDI received (from HOST)
int th_count = 0; // MIDI sent (To Host) int th_count = 0; // MIDI sent (To Host)
#ifdef MIDI_LOOPBACK
static inline void handle_byte_from_uart(chanend c_midi, struct midi_in_parse_state &mips, int cable_number,
int &got_next_event, int &next_event, int &waiting_for_ack, int byte)
{
int valid;
unsigned event;
{valid, event} = midi_in_parse(mips, cable_number, byte);
if (valid && !got_next_event)
{
// data to send to host
if (!waiting_for_ack)
{
// send data
event = byterev(event);
outuint(c_midi, event);
th_count++;
waiting_for_ack = 1;
}
else
{
event = byterev(event);
next_event = event;
got_next_event = 1;
}
}
else if (valid)
{
// printstr("g\n");
}
}
#endif
int uout_count = 0; // UART bytes out int uout_count = 0; // UART bytes out
int uin_count = 0; // UART bytes in int uin_count = 0; // UART bytes in
@@ -132,7 +100,6 @@ void usb_midi(port ?p_midi_in, port ?p_midi_out,
t :> txT; t :> txT;
t2 :> rxT; t2 :> rxT;
#ifndef MIDI_LOOPBACK
#ifdef IAP #ifdef IAP
CoProcessorDisable(); CoProcessorDisable();
#endif #endif
@@ -142,8 +109,6 @@ void usb_midi(port ?p_midi_in, port ?p_midi_out,
CoProcessorEnable(); CoProcessorEnable();
#endif #endif
#endif
#ifdef IAP #ifdef IAP
/* Check for special case where MIDI and i2c ports are shared... */ /* Check for special case where MIDI and i2c ports are shared... */
if(isnull(c_i2c) && isnull(p_scl) && isnull(p_sda)) if(isnull(c_i2c) && isnull(p_scl) && isnull(p_sda))
@@ -211,6 +176,7 @@ void usb_midi(port ?p_midi_in, port ?p_midi_out,
{valid, event} = midi_in_parse(mips, cable_number, rxByte); {valid, event} = midi_in_parse(mips, cable_number, rxByte);
if (valid && isempty(midi_to_host_fifo)) if (valid && isempty(midi_to_host_fifo))
{ {
event = byterev(event); event = byterev(event);
// data to send to host - add to fifo // data to send to host - add to fifo
if (!waiting_for_ack) if (!waiting_for_ack)
@@ -228,7 +194,7 @@ void usb_midi(port ?p_midi_in, port ?p_midi_out,
} }
else if (valid) else if (valid)
{ {
// printstr("g"); //printstr("g");
} }
} }
isRX = 0; isRX = 0;
@@ -328,6 +294,11 @@ void usb_midi(port ?p_midi_in, port ?p_midi_out,
event = byterev(event); event = byterev(event);
enqueue(midi_to_host_fifo, event); enqueue(midi_to_host_fifo, event);
} }
midi_send_ack(c_midi);
}
else
{
//printstr("DROP\n");
} }
#else #else
{midi[0], midi[1], midi[2], size} = midi_out_parse(event); {midi[0], midi[1], midi[2], size} = midi_out_parse(event);