This commit is contained in:
Russell Gallop
2011-08-15 17:24:40 +01:00
parent cb99f0ee4f
commit 23280b0a66

View File

@@ -128,18 +128,17 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
break; break;
// Input to read the remaining bits // Input to read the remaining bits
case isRX => t2 when timerafter(rxT) :> int _ : case isRX => t2 when timerafter(rxT) :> int _ :
{
unsigned bit;
p_midi_in :> bit;
if (rxI++ < 8) { if (rxI++ < 8) {
// shift in bits into the high end of a word // shift in bits into the high end of a word
unsigned bit;
p_midi_in :> bit;
rxByte = (bit << 31) | (rxByte >> 1); rxByte = (bit << 31) | (rxByte >> 1);
rxT += bit_time; rxT += bit_time;
rxPT += bit_time; rxPT += bit_time;
asm("setpt res[%0],%1"::"r"(p_midi_in),"r"(rxPT)); asm("setpt res[%0],%1"::"r"(p_midi_in),"r"(rxPT));
} else { } else {
unsigned bit;
// rcv and check stop bit // rcv and check stop bit
p_midi_in :> bit;
if ((bit & 0x1) == 1) { if ((bit & 0x1) == 1) {
unsigned valid = 0; unsigned valid = 0;
unsigned event = 0; unsigned event = 0;
@@ -171,6 +170,7 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
isRX = 0; isRX = 0;
} }
break; break;
}
// Output // Output
// If outputting then feed the bits out one at a time // If outputting then feed the bits out one at a time
@@ -229,11 +229,10 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
waiting_for_ack = 0; waiting_for_ack = 0;
} }
} else { } else {
int event;
unsigned midi[3]; unsigned midi[3];
unsigned size; unsigned size;
// received data from host // received data from host
event = byterev(datum); int event = byterev(datum);
mr_count++; mr_count++;
#ifdef MIDI_LOOPBACK #ifdef MIDI_LOOPBACK
if (isempty(to_host_fifo)) { if (isempty(to_host_fifo)) {