forked from PAWPAW-Mirror/lib_xua
Add comments
This commit is contained in:
@@ -39,7 +39,7 @@ void midi_get_ack_or_data(chanend c, int &is_ack, unsigned int &datum);
|
|||||||
INLINE void midi_get_ack_or_data(chanend c, int &is_ack, unsigned int &datum) {
|
INLINE void midi_get_ack_or_data(chanend c, int &is_ack, unsigned int &datum) {
|
||||||
if (testct(c)) {
|
if (testct(c)) {
|
||||||
is_ack = 1;
|
is_ack = 1;
|
||||||
(void) inct(c);
|
(void) inct(c); // read 1-bytes control token
|
||||||
(void) inuchar(c);
|
(void) inuchar(c);
|
||||||
(void) inuchar(c);
|
(void) inuchar(c);
|
||||||
(void) inuchar(c);
|
(void) inuchar(c);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ static unsigned bit_time = XS1_TIMER_MHZ * 1000000 / (unsigned) RATE;
|
|||||||
static unsigned bit_time_2 = (XS1_TIMER_MHZ * 1000000 / (unsigned) RATE) / 2;
|
static unsigned bit_time_2 = (XS1_TIMER_MHZ * 1000000 / (unsigned) RATE) / 2;
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
int mr_count = 0;
|
int mr_count = 0; // MIDI received (from HOST)
|
||||||
int th_count = 0;
|
int th_count = 0; // MIDI sent (To Host)
|
||||||
|
|
||||||
#ifdef MIDI_LOOPBACK
|
#ifdef MIDI_LOOPBACK
|
||||||
static inline void handle_byte_from_uart(chanend c_midi, struct midi_in_parse_state &mips, int cable_number,
|
static inline void handle_byte_from_uart(chanend c_midi, struct midi_in_parse_state &mips, int cable_number,
|
||||||
@@ -49,19 +49,17 @@ static inline void handle_byte_from_uart(chanend c_midi, struct midi_in_parse_
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int uout_count = 0;
|
int uout_count = 0; // UART bytes out
|
||||||
int uin_count = 0;
|
int uin_count = 0; // UART bytes in
|
||||||
|
|
||||||
void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
|
void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
|
||||||
clock ?clk_midi,
|
clock ?clk_midi,
|
||||||
chanend c_midi,
|
chanend c_midi,
|
||||||
unsigned cable_number)
|
unsigned cable_number)
|
||||||
{
|
{
|
||||||
int is_ack;
|
unsigned symbol = 0x0; // Symbol in progress of being sent out
|
||||||
unsigned int datum;
|
unsigned outputting = 0; // Guard when outputting data
|
||||||
unsigned symbol = 0x0;
|
unsigned time; // Timer value used for outputting
|
||||||
unsigned outputting = 0;
|
|
||||||
unsigned time;
|
|
||||||
//unsigned inputPortState, newInputPortState;
|
//unsigned inputPortState, newInputPortState;
|
||||||
int waiting_for_ack = 0;
|
int waiting_for_ack = 0;
|
||||||
// Receiver
|
// Receiver
|
||||||
@@ -106,6 +104,8 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int is_ack;
|
||||||
|
unsigned int datum;
|
||||||
select
|
select
|
||||||
{
|
{
|
||||||
// Input to read the start bit
|
// Input to read the start bit
|
||||||
|
|||||||
Reference in New Issue
Block a user