forked from PAWPAW-Mirror/lib_xua
Tidying up in decouple
This commit is contained in:
@@ -1033,12 +1033,8 @@ void decouple(chanend c_mix_out,
|
|||||||
/* Swap the collecting and sending buffer */
|
/* Swap the collecting and sending buffer */
|
||||||
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||||
|
|
||||||
{
|
/* Request to send packet */
|
||||||
/* 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);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mark as waiting for host to poll us */
|
/* Mark as waiting for host to poll us */
|
||||||
midi_waiting_on_send_to_host = 1;
|
midi_waiting_on_send_to_host = 1;
|
||||||
@@ -1058,9 +1054,6 @@ void decouple(chanend c_mix_out,
|
|||||||
if (midi_from_host_flag)
|
if (midi_from_host_flag)
|
||||||
{
|
{
|
||||||
/* The buffer() thread has filled up a buffer */
|
/* The buffer() thread has filled up a buffer */
|
||||||
int datalength;
|
|
||||||
int space_left;
|
|
||||||
|
|
||||||
/* Reset flag */
|
/* Reset flag */
|
||||||
SET_SHARED_GLOBAL(g_midi_from_host_flag, 0);
|
SET_SHARED_GLOBAL(g_midi_from_host_flag, 0);
|
||||||
|
|
||||||
@@ -1124,15 +1117,11 @@ void decouple(chanend c_mix_out,
|
|||||||
{
|
{
|
||||||
write_via_xc_ptr(midi_to_host_buffer_being_collected, midi_data_collected_from_device);
|
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);
|
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||||
|
|
||||||
// Signal other side to swap
|
// Signal other side to swap
|
||||||
{
|
XUD_SetReady_In(midi_to_host_usb_ep, 0, midi_to_host_buffer_being_sent+4, midi_data_collected_from_device);
|
||||||
int len;
|
midi_data_collected_from_device = 0;
|
||||||
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);
|
|
||||||
}
|
|
||||||
midi_waiting_on_send_to_host = 1;
|
midi_waiting_on_send_to_host = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user