Rename outputting guard to isTX to be more consistent.

This commit is contained in:
Russell Gallop
2011-08-25 12:01:00 +01:00
parent 5e14a17287
commit 25e2b5c1ed

View File

@@ -59,7 +59,7 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
chanend c_midi, chanend c_midi,
unsigned cable_number) { unsigned cable_number) {
unsigned symbol = 0x0; // Symbol in progress of being sent out unsigned symbol = 0x0; // Symbol in progress of being sent out
unsigned outputting = 0; // Guard when outputting data unsigned isTX = 0; // Guard when outputting data
unsigned txT; // Timer value used for outputting unsigned txT; // Timer value used for outputting
//unsigned inputPortState, newInputPortState; //unsigned inputPortState, newInputPortState;
int waiting_for_ack = 0; int waiting_for_ack = 0;
@@ -67,7 +67,7 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
unsigned rxByte; unsigned rxByte;
int rxI; int rxI;
int rxT; int rxT;
int isRX = 0; int isRX = 0; // Guard when receiving data
timer t; timer t;
timer t2; timer t2;
@@ -173,10 +173,10 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
} }
// Output // Output
// If outputting then feed the bits out one at a time // If isTX then feed the bits out one at a time
// until symbol is zero expect pattern like 10'b1dddddddd0 // until symbol is zero expect pattern like 10'b1dddddddd0
// This code will leave the output high afterwards due to the stop bit added with makeSymbol // This code will leave the output high afterwards due to the stop bit added with makeSymbol
case outputting => t when timerafter(txT) :> int _: case isTX => t when timerafter(txT) :> int _:
if (symbol == 0) { if (symbol == 0) {
// Got something to output but not mid-symbol. // Got something to output but not mid-symbol.
// Start sending symbol. // Start sending symbol.
@@ -197,7 +197,7 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
t :> txT; t :> txT;
txT += bit_time; txT += bit_time;
txPT += bit_time; txPT += bit_time;
outputting = 1; isTX = 1;
} else { } else {
// Mid-symbol // Mid-symbol
txT += bit_time; // Should this be after the output otherwise be double the length of the high before the start bit txT += bit_time; // Should this be after the output otherwise be double the length of the high before the start bit
@@ -210,7 +210,7 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
uout_count++; uout_count++;
outputted_symbol = outputting_symbol; outputted_symbol = outputting_symbol;
if (isempty(symbol_fifo)) { // FIFO empty if (isempty(symbol_fifo)) { // FIFO empty
outputting = 0; isTX = 0;
} }
} }
} }
@@ -260,10 +260,10 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
} else { } else {
midi_from_host_overflow = 1; midi_from_host_overflow = 1;
} }
// Drop through to the outputting guarded case // Drop through to the isTX guarded case
if (!outputting) { if (!isTX) {
t :> txT; // Should be enough to trigger the other case t :> txT; // Should be enough to trigger the other case
outputting = 1; isTX = 1;
} }
#endif #endif
} }