Handle sending ZLP to interrupt endpoint.

This commit is contained in:
Russell Gallop
2011-08-16 17:59:35 +01:00
parent 4693b9d0b5
commit bb5840fb66
2 changed files with 17 additions and 1 deletions

View File

@@ -181,6 +181,7 @@ int g_midi_from_host_buffer[MAX_USB_MIDI_PACKET_SIZE/4+4];
unsigned int g_iap_to_host_buffer_A[MAX_IAP_PACKET_SIZE/4+4];
unsigned int g_iap_to_host_buffer_B[MAX_IAP_PACKET_SIZE/4+4];
int g_iap_from_host_buffer[MAX_IAP_PACKET_SIZE/4+4];
unsigned g_zero_buffer[1];
#endif
#endif
@@ -667,6 +668,7 @@ void decouple(chanend c_mix_out,
xc_ptr iap_from_host_buffer;
xc_ptr iap_to_host_buffer_being_sent = array_to_xc_ptr(g_iap_to_host_buffer_A);
xc_ptr iap_to_host_buffer_being_collected = array_to_xc_ptr(g_iap_to_host_buffer_B);
xc_ptr zero_buffer = array_to_xc_ptr(g_zero_buffer);
int is_ack_iap;
unsigned int datum_iap;
@@ -1187,6 +1189,7 @@ void decouple(chanend c_mix_out,
swap(iap_to_host_buffer_being_collected, iap_to_host_buffer_being_sent);
/* Request to send packet */
XUD_SetReady_In(iap_to_host_int_usb_ep, 0, zero_buffer, 0); // ZLP to int ep
XUD_SetReady_In(iap_to_host_usb_ep, 0, iap_to_host_buffer_being_sent+4, iap_data_collected_from_device);
/* Mark as waiting for host to poll us */
@@ -1277,6 +1280,7 @@ void decouple(chanend c_mix_out,
swap(iap_to_host_buffer_being_collected, iap_to_host_buffer_being_sent);
// Signal other side to swap
XUD_SetReady_In(iap_to_host_int_usb_ep, 0, zero_buffer, 0);
XUD_SetReady_In(iap_to_host_usb_ep, 0, iap_to_host_buffer_being_sent+4, iap_data_collected_from_device);
iap_data_collected_from_device = 0;
iap_waiting_on_send_to_host = 1;

View File

@@ -576,7 +576,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
/* IAP IN to host */
case inuint_byref(c_iap_to_host, tmp):
asm("#iap d->h");
// fill in the data
XUD_SetData_Inline(ep_iap_to_host, c_iap_to_host);
@@ -588,6 +588,18 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
swap(iap_to_host_buffer, iap_to_host_waiting_buffer);
break;
/* IAP interrupt IN to host */
case inuint_byref(c_iap_to_host_int, tmp):
asm("#iap interrupt d->h");
// fill in the data
XUD_SetData_Inline(ep_iap_to_host_int, c_iap_to_host_int);
XUD_SetNotReady(ep_iap_to_host_int);
// Don't need to handle data here as always ZLP
break;
#endif
#endif
}