From 61726fd98b00cbfc9609cb1d2afe48c3a6701a02 Mon Sep 17 00:00:00 2001 From: Russell Date: Mon, 21 Nov 2011 11:54:45 +0000 Subject: [PATCH] Tidying up in decouple --- module_usb_aud_shared/usb_buffer/decouple.xc | 21 +++++--------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/module_usb_aud_shared/usb_buffer/decouple.xc b/module_usb_aud_shared/usb_buffer/decouple.xc index 22071daa..3377047f 100644 --- a/module_usb_aud_shared/usb_buffer/decouple.xc +++ b/module_usb_aud_shared/usb_buffer/decouple.xc @@ -1033,12 +1033,8 @@ void decouple(chanend c_mix_out, /* Swap the collecting and sending buffer */ swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent); - { - /* Request to send packet */ - int len; - asm("ldw %0, %1[0]":"=r"(len):"r"(midi_to_host_buffer_being_sent)); - XUD_SetReady_In(midi_to_host_usb_ep, 0, midi_to_host_buffer_being_sent+4, len); - } + /* Request to send packet */ + XUD_SetReady_In(midi_to_host_usb_ep, 0, midi_to_host_buffer_being_sent+4, midi_data_collected_from_device); /* Mark as waiting for host to poll us */ midi_waiting_on_send_to_host = 1; @@ -1058,9 +1054,6 @@ void decouple(chanend c_mix_out, if (midi_from_host_flag) { /* The buffer() thread has filled up a buffer */ - int datalength; - int space_left; - /* Reset flag */ SET_SHARED_GLOBAL(g_midi_from_host_flag, 0); @@ -1123,16 +1116,12 @@ void decouple(chanend c_mix_out, if (!midi_waiting_on_send_to_host) { write_via_xc_ptr(midi_to_host_buffer_being_collected, midi_data_collected_from_device); - - midi_data_collected_from_device = 0; + swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent); // Signal other side to swap - { - int len; - asm("ldw %0, %1[0]":"=r"(len):"r"(midi_to_host_buffer_being_sent)); - XUD_SetReady_In(midi_to_host_usb_ep, 0, midi_to_host_buffer_being_sent+4, len); - } + XUD_SetReady_In(midi_to_host_usb_ep, 0, midi_to_host_buffer_being_sent+4, midi_data_collected_from_device); + midi_data_collected_from_device = 0; midi_waiting_on_send_to_host = 1; } }