forked from PAWPAW-Mirror/lib_xua
Merge branch 'IAP2_DEV'
Conflicts: module_usb_audio/usb_buffer/usb_buffer.xc
This commit is contained in:
@@ -112,6 +112,10 @@
|
|||||||
#undef IAP
|
#undef IAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(IAP_INT_EP) && (IAP_INT_EP == 0)
|
||||||
|
#undef IAP_INT_EP
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0)
|
#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0)
|
||||||
#undef SU1_ADC_ENABLE
|
#undef SU1_ADC_ENABLE
|
||||||
#endif
|
#endif
|
||||||
@@ -380,7 +384,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EP_CNT_OUT_IAP (IAP_INTERFACES)
|
#define EP_CNT_OUT_IAP (IAP_INTERFACES)
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
#define EP_CNT_IN_IAP (IAP_INTERFACES * 2)
|
#define EP_CNT_IN_IAP (IAP_INTERFACES * 2)
|
||||||
|
#else
|
||||||
|
#define EP_CNT_IN_IAP (IAP_INTERFACES)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EP_CNT_OUT_HID (0)
|
#define EP_CNT_OUT_HID (0)
|
||||||
#define EP_CNT_IN_HID (HID_INTERFACES)
|
#define EP_CNT_IN_HID (HID_INTERFACES)
|
||||||
@@ -405,7 +413,9 @@
|
|||||||
#define EP_NUM_IN_MIDI (EP_NUM_IN_AUD_INT + 1)
|
#define EP_NUM_IN_MIDI (EP_NUM_IN_AUD_INT + 1)
|
||||||
#define EP_NUM_IN_HID (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + 1)
|
#define EP_NUM_IN_HID (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + 1)
|
||||||
#define EP_NUM_IN_IAP (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 1) /* iAP Bulk */
|
#define EP_NUM_IN_IAP (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 1) /* iAP Bulk */
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
#define EP_NUM_IN_IAP_INT (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 2) /* iAP interrupt */
|
#define EP_NUM_IN_IAP_INT (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 2) /* iAP interrupt */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EP_NUM_OUT_AUD (1) /* Always 1 */
|
#define EP_NUM_OUT_AUD (1) /* Always 1 */
|
||||||
#define EP_NUM_OUT_MIDI (2) /* Always 2 */
|
#define EP_NUM_OUT_MIDI (2) /* Always 2 */
|
||||||
@@ -418,7 +428,9 @@
|
|||||||
#define EP_ADR_IN_MIDI (EP_NUM_IN_MIDI | 0x80)
|
#define EP_ADR_IN_MIDI (EP_NUM_IN_MIDI | 0x80)
|
||||||
#define EP_ADR_IN_HID (EP_NUM_IN_HID | 0x80)
|
#define EP_ADR_IN_HID (EP_NUM_IN_HID | 0x80)
|
||||||
#define EP_ADR_IN_IAP (EP_NUM_IN_IAP | 0x80)
|
#define EP_ADR_IN_IAP (EP_NUM_IN_IAP | 0x80)
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
#define EP_ADR_IN_IAP_INT (EP_NUM_IN_IAP_INT | 0x80)
|
#define EP_ADR_IN_IAP_INT (EP_NUM_IN_IAP_INT | 0x80)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EP_ADR_OUT_AUD EP_NUM_OUT_AUD
|
#define EP_ADR_OUT_AUD EP_NUM_OUT_AUD
|
||||||
#define EP_ADR_OUT_MIDI EP_NUM_OUT_MIDI
|
#define EP_ADR_OUT_MIDI EP_NUM_OUT_MIDI
|
||||||
|
|||||||
@@ -172,8 +172,12 @@ unsigned char devQualDesc_Null[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
#define IAP_LENGTH (30)
|
#define IAP_LENGTH (30)
|
||||||
#else
|
#else
|
||||||
|
#define IAP_LENGTH (23)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#define IAP_LENGTH (0)
|
#define IAP_LENGTH (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1350,6 +1354,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
0x02, /* 5 wMaxPacketSize */
|
0x02, /* 5 wMaxPacketSize */
|
||||||
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
|
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
|
||||||
|
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
/* iAP Interrupt IN Endpoint Descriptor */
|
/* iAP Interrupt IN Endpoint Descriptor */
|
||||||
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
||||||
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
|
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
|
||||||
@@ -1358,6 +1363,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
0x40, /* 4 wMaxPacketSize : 64 bytes per packet. (field size 2 bytes) - has to be 0x40 for compliance*/
|
0x40, /* 4 wMaxPacketSize : 64 bytes per packet. (field size 2 bytes) - has to be 0x40 for compliance*/
|
||||||
0x00, /* 5 wMaxPacketSize */
|
0x00, /* 5 wMaxPacketSize */
|
||||||
0x08, /* 6 bInterval : (2^(bInterval-1))/8 ms. Must be between 4 and 32ms (field size 1 bytes) */
|
0x08, /* 6 bInterval : (2^(bInterval-1))/8 ms. Must be between 4 and 32ms (field size 1 bytes) */
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,12 @@ void usb_audio_core(chanend c_mix_out
|
|||||||
c_midi,
|
c_midi,
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
c_xud_out[EP_NUM_OUT_IAP], c_xud_in[EP_NUM_IN_IAP], c_xud_in[EP_NUM_IN_IAP_INT], c_iap,
|
c_xud_out[EP_NUM_OUT_IAP], /* iAP Out */
|
||||||
|
c_xud_in[EP_NUM_IN_IAP], /* iAP In */
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
|
c_xud_in[EP_NUM_IN_IAP_INT], /* iAP Interrupt In */
|
||||||
|
#endif
|
||||||
|
c_iap,
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
/* Audio Interrupt - only used for interrupts on external clock change */
|
/* Audio Interrupt - only used for interrupts on external clock change */
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ void buffer(chanend c_aud_out,
|
|||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
chanend c_iap_from_host,
|
chanend c_iap_from_host,
|
||||||
chanend c_iap_to_host,
|
chanend c_iap_to_host,
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
chanend c_iap_to_host_int,
|
chanend c_iap_to_host_int,
|
||||||
|
#endif
|
||||||
chanend c_iap,
|
chanend c_iap,
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
chanend c_iap_from_host,
|
chanend c_iap_from_host,
|
||||||
chanend c_iap_to_host,
|
chanend c_iap_to_host,
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
chanend c_iap_to_host_int,
|
chanend c_iap_to_host_int,
|
||||||
|
#endif
|
||||||
chanend c_iap,
|
chanend c_iap,
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
@@ -113,8 +115,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
XUD_ep ep_iap_from_host = XUD_InitEp(c_iap_from_host);
|
XUD_ep ep_iap_from_host = XUD_InitEp(c_iap_from_host);
|
||||||
XUD_ep ep_iap_to_host = XUD_InitEp(c_iap_to_host);
|
XUD_ep ep_iap_to_host = XUD_InitEp(c_iap_to_host);
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
XUD_ep ep_iap_to_host_int = XUD_InitEp(c_iap_to_host_int);
|
XUD_ep ep_iap_to_host_int = XUD_InitEp(c_iap_to_host_int);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
XUD_ep ep_int = XUD_InitEp(c_int);
|
XUD_ep ep_int = XUD_InitEp(c_int);
|
||||||
#endif
|
#endif
|
||||||
@@ -548,8 +552,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
|
|
||||||
if(tmp == -1)
|
if(tmp == -1)
|
||||||
{
|
{
|
||||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
#ifdef IAP_INT_EP
|
||||||
|
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||||
|
#endif
|
||||||
iap_send_reset(c_iap);
|
iap_send_reset(c_iap);
|
||||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||||
iap_data_collected_from_device = 0;
|
iap_data_collected_from_device = 0;
|
||||||
@@ -564,6 +570,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
}
|
}
|
||||||
break; /* IAP IN to host */
|
break; /* IAP IN to host */
|
||||||
|
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, tmp):
|
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, tmp):
|
||||||
asm("#iap int d->h");
|
asm("#iap int d->h");
|
||||||
|
|
||||||
@@ -571,6 +578,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
/* Note, could get a reset notification here, but deal with it in the case above */
|
/* Note, could get a reset notification here, but deal with it in the case above */
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HID_CONTROLS
|
#ifdef HID_CONTROLS
|
||||||
/* HID Report Data */
|
/* HID Report Data */
|
||||||
@@ -698,13 +706,17 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
/* Note we don't ack the last byte yet... */
|
/* Note we don't ack the last byte yet... */
|
||||||
if (iap_data_collected_from_device == iap_expected_data_length)
|
if (iap_data_collected_from_device == iap_expected_data_length)
|
||||||
{
|
{
|
||||||
int reset1, reset2;
|
int reset1 = 0, reset2;
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
reset1 = XUD_SetReady_In(ep_iap_to_host_int, gc_zero_buffer, 0);
|
reset1 = XUD_SetReady_In(ep_iap_to_host_int, gc_zero_buffer, 0);
|
||||||
|
#endif
|
||||||
reset2 = XUD_SetReady_In(ep_iap_to_host, iap_to_host_buffer, iap_data_collected_from_device);
|
reset2 = XUD_SetReady_In(ep_iap_to_host, iap_to_host_buffer, iap_data_collected_from_device);
|
||||||
|
|
||||||
if((reset1 == -1) || (reset2 == -1))
|
if((reset1 == -1) || (reset2 == -1))
|
||||||
{
|
{
|
||||||
|
#ifdef IAP_INT_EP
|
||||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||||
|
#endif
|
||||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||||
iap_send_reset(c_iap);
|
iap_send_reset(c_iap);
|
||||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ void usb_midi(buffered in port:1 ?p_midi_in, port ?p_midi_out,
|
|||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
iAPTimer :> polltime;
|
iAPTimer :> polltime;
|
||||||
polltime += XS1_TIMER_HZ / 2;
|
polltime += XS1_TIMER_HZ / 2;
|
||||||
|
SelectUSBPc(); // Select the PC connector to begin with, as we cannot actively detect connections to the USB B
|
||||||
#endif
|
#endif
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user