From 268018abd62745587909f0b2535508d97f524440 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 20 Nov 2012 17:31:36 +0000 Subject: [PATCH] Removed Audio Int EP --- module_usb_audio/endpoint0/descriptors_2.h | 28 +++++++++++++--------- module_usb_audio/main.xc | 8 ++++--- module_usb_audio/usb_buffer/decouple.xc | 2 +- module_usb_audio/usb_buffer/usb_buffer.h | 2 ++ module_usb_audio/usb_buffer/usb_buffer.xc | 24 ++++--------------- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/module_usb_audio/endpoint0/descriptors_2.h b/module_usb_audio/endpoint0/descriptors_2.h index 69a8d5af..faea4d57 100644 --- a/module_usb_audio/endpoint0/descriptors_2.h +++ b/module_usb_audio/endpoint0/descriptors_2.h @@ -178,6 +178,12 @@ unsigned char devQualDesc_Null[] = #define IAP_LENGTH (0) #endif +#if defined(SPDIF_RX) || defined(ADAT_RX) +#define AUD_INT_EP_LEN (7) +#else +#define AUD_INT_EP_LEN (0) +#endif + #ifdef AUDIO_PATH_XUS #define LEN_XU_OUT (16 * OUTPUT_INTERFACES) #define LEN_XU_IN (16 * INPUT_INTERFACES) @@ -288,7 +294,7 @@ unsigned char hidReportDescriptor[] = { #define HID_LENGTH (25*HID_INTERFACES) /* Total length of config descriptor */ -#define CFG_TOTAL_LENGTH_A2 (7 + 26 + (INPUT_INTERFACES * 55) + (OUTPUT_INTERFACES * 62) + (MIDI_LENGTH) + (DFU_INTERFACES * 18) + TLEN_AC + (MIXER_LENGTH) + IAP_LENGTH + INPUT_ALT_LENGTH + OUTPUT_ALT_LENGTH + HID_LENGTH) +#define CFG_TOTAL_LENGTH_A2 (7 + 19 + (AUD_INT_EP_LEN) + (INPUT_INTERFACES * 55) + (OUTPUT_INTERFACES * 62) + (MIDI_LENGTH) + (DFU_INTERFACES * 18) + TLEN_AC + (MIXER_LENGTH) + IAP_LENGTH + INPUT_ALT_LENGTH + OUTPUT_ALT_LENGTH + HID_LENGTH) /* Configuration Descriptor for Audio 2.0 (HS) operation */ unsigned char cfgDesc_Audio2[] = @@ -323,7 +329,11 @@ unsigned char cfgDesc_Audio2[] = INTERFACE, /* 1 bDescriptorType: INTERFACE */ 0x00, /* 2 bInterfaceNumber */ 0x00, /* 3 bAlternateSetting: Must be 0 */ +#if defined(SPDIF_RX) || defined(ADAT_RX) 0x01, /* 4 bNumEndpoints (0 or 1 if optional interrupt endpoint is present */ +#else + 0x00, +#endif AUDIO, /* 5 bInterfaceClass: AUDIO */ AUDIOCONTROL, /* 6 bInterfaceSubClass: AUDIOCONTROL*/ IP_VERSION_02_00, /* 7 bInterfaceProtocol: IP_VERSION_02_00 */ @@ -456,7 +466,7 @@ unsigned char cfgDesc_Audio2[] = #endif /* Feature Unit Descriptor */ - LEN_FU_OUT, /* 0 bLength: 6+(ch + 1)*4 */ + LEN_FU_OUT, /* 0 bLength: 6+(ch + 1)*4 */ 0x24, /* 1 bDescriptorType: CS_INTERFACE */ 0x06, /* 2 bDescriptorSubType: FEATURE_UNIT */ FU_USBOUT, /* 3 bUnitID */ @@ -754,15 +764,15 @@ unsigned char cfgDesc_Audio2[] = #if MIX_BMCONTROLS_LEN > 18 #error unxpected BMCONTROLS_LEN #endif - 0x00, /* bmControls */ - 0, /* Mixer unit string descriptor index */ + 0x00, /* bmControls */ + 0, /* Mixer unit string descriptor index */ #endif -#if 1 +#if defined(SPDIF_RX) || defined (ADAT_RX) /* Standard AS Interrupt Endpoint Descriptor (4.8.2.1): */ 0x07, /* 0 bLength: 7 */ 0x05, /* 1 bDescriptorType: ENDPOINT */ - EP_ADR_IN_AUD_INT, /* 2 bEndpointAddress (D7: 0:out, 1:in) */ + EP_ADR_IN_AUD_INT, /* 2 bEndpointAddress (D7: 0:out, 1:in) */ 3, /* 3 bmAttributes (bitmap) */ 6,0, /* 4 wMaxPacketSize */ 8, /* 6 bInterval */ @@ -1585,11 +1595,7 @@ unsigned char cfgDesc_Audio1[] = CONFIGURATION, (CFG_TOTAL_LENGTH_A1 & 0xFF), /* wTotalLength */ (CFG_TOTAL_LENGTH_A1 >> 8), /* wTotalLength */ -#ifdef MIDI - NUM_INTERFACES_A1-2, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/ -#else - NUM_INTERFACES_A1, -#endif + NUM_INTERFACES_A1, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/ 0x01, /* ID of this configuration */ 0x00, /* Unused */ #ifdef SELF_POWERED diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index eff5ffab..e8d4459c 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -214,7 +214,7 @@ int main() /* Endpoint 0 */ on stdcore[0]:{ thread_speed(); - Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, null,null, c_usb_test); + Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, null, null, c_usb_test); } on stdcore[0]: @@ -240,8 +240,10 @@ int main() #ifdef IAP c_xud_out[3], c_xud_in[5], c_xud_in[6], #endif - - c_xud_in[EP_NUM_IN_AUD_INT], /* Int */ +#if defined(SPDIF_RX) || defined(ADAT_RX) + /* Audio Interrupt - only used for interrupts on external clock change */ + c_xud_in[EP_NUM_IN_AUD_INT], +#endif c_sof, c_aud_ctl, p_for_mclk_count #ifdef HID_CONTROLS ,c_xud_in[EP_NUM_IN_HID] diff --git a/module_usb_audio/usb_buffer/decouple.xc b/module_usb_audio/usb_buffer/decouple.xc index 2fff105b..c3186d4b 100644 --- a/module_usb_audio/usb_buffer/decouple.xc +++ b/module_usb_audio/usb_buffer/decouple.xc @@ -838,7 +838,7 @@ void decouple(chanend c_mix_out, read_via_xc_ptr(datalength, released_buffer); /* Ignore bad small packets */ - if ((datalength >= (g_numUsbChanOut * slotSize)) && (released_buffer == g_aud_from_host_wrptr)) + if ((datalength >= (g_numUsbChanOut * slotSize)) && (released_buffer == aud_from_host_wrptr)) { /* Move the write pointer of the fifo on - round up to nearest word */ diff --git a/module_usb_audio/usb_buffer/usb_buffer.h b/module_usb_audio/usb_buffer/usb_buffer.h index 768b0fc3..d4954847 100644 --- a/module_usb_audio/usb_buffer/usb_buffer.h +++ b/module_usb_audio/usb_buffer/usb_buffer.h @@ -29,7 +29,9 @@ void buffer(chanend c_aud_out, chanend c_iap_to_host, chanend c_iap_to_host_int, #endif +#if defined(SPDIF_RX) || defined(ADAT_RX) chanend? c_int, +#endif chanend c_sof, chanend c_aud_ctl, in port p_off_mclk diff --git a/module_usb_audio/usb_buffer/usb_buffer.xc b/module_usb_audio/usb_buffer/usb_buffer.xc index e60df770..0ee4e410 100644 --- a/module_usb_audio/usb_buffer/usb_buffer.xc +++ b/module_usb_audio/usb_buffer/usb_buffer.xc @@ -88,7 +88,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud chanend c_iap_to_host, chanend c_iap_to_host_int, #endif - chanend ?c_int, chanend c_sof, +#if defined(SPDIF_RX) || defined(ADAT_RX) + chanend ?c_int, +#endif + chanend c_sof, chanend c_aud_ctl, in port p_off_mclk #ifdef HID_CONTROLS @@ -287,25 +290,8 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud case inuint_byref(c_int, tmp): { int sent_ok = 0; - /* Start XUD_SetData */ - - //XUD_SetData_Inline(ep_int, c_int); - -#if 0 - while (!sent_ok) - { - outct(c_int, 64); - asm("ldw %0, dp[g_intData]":"=r"(tmp)); - outuint(c_int, tmp); - asm("ldw %0, dp[g_intData+4]":"=r"(tmp)); - outct(c_int, 64); - outuint(c_int, tmp); - sent_ok = inuint(c_int); - /* End XUD_SetData */ - } -#endif + XUD_SetData_Inline(ep_int, c_int); asm("stw %0, dp[g_intFlag]" :: "r" (0) ); - //XUD_SetNotReady(ep_int); break; } #endif