First attempt at complete removal of feedback EP code when not required.

This commit is contained in:
Ross Owen
2014-12-08 18:19:56 +00:00
parent 56e79c0af9
commit 8d2b65127e
5 changed files with 42 additions and 29 deletions

View File

@@ -1044,7 +1044,9 @@
enum USBEndpointNumber_In
{
ENDPOINT_NUMBER_IN_CONTROL, /* Endpoint 0 */
#if (NUM_USB_CHAN_IN == 0) || (defined UAC_FORCE_FEEDBACK_EP)
ENDPOINT_NUMBER_IN_FEEDBACK,
#endif
ENDPOINT_NUMBER_IN_AUDIO,
#if defined(SPDIF_RX) || defined(ADAT_RX)
ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */

View File

@@ -1928,12 +1928,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
/* Type 1 Format Type Descriptor */
.Audio_Out_Format =
{
0x06, /* 0 bLength (in bytes): 6 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE, /* 2 bDescriptorSubtype: FORMAT_TYPE */
UAC_FORMAT_TYPE_I, /* 3 bFormatType: FORMAT_TYPE_1 */
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS,
.bLength = 0x06,
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubtype = UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE,
.bFormatType = UAC_FORMAT_TYPE_I,
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS,
},
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
@@ -1941,7 +1941,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01, /* (D7: 0:out, 1:in) */
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05, /* (bitmap) */
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
.bInterval = 1,
@@ -1962,12 +1962,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.Audio_Out_Fb_Endpoint =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
17, /* 3 bmAttributes (bitmap) */
0x0004, /* 4 wMaxPacketSize */
4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
.bmAttributes = 17, /* (bitmap) */
.wMaxPacketSize = 0x0004,
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
},
#endif
#if (OUTPUT_FORMAT_COUNT > 1)
@@ -2019,7 +2019,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE,
.bInterval = 1,
@@ -2042,7 +2042,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
ENDPOINT_ADDRESS_IN_FEEDBACK, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
17, /* 3 bmAttributes (bitmap) */
0x0004, /* 4 wMaxPacketSize */
4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */
@@ -2099,7 +2099,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE,
.bInterval = 1,
@@ -2122,7 +2122,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
.bmAttributes = 17, /* (bitmap) */
.wMaxPacketSize = 0x0004,
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
@@ -2192,7 +2192,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
@@ -2260,7 +2260,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
@@ -2329,7 +2329,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
@@ -2927,7 +2927,7 @@ unsigned char cfgDesc_Audio1[] =
/* Feedback EP */
0x09,
0x05, /* bDescriptorType: ENDPOINT */
0x81, /* bEndpointAddress (D3:0 - EP no. D6:4 - reserved 0. D7 - 0:out, 1:in) */
ENDPOINT_ADDRESS_IN_FEEDBACK, /* bEndpointAddress (D3:0 - EP no. D6:4 - reserved 0. D7 - 0:out, 1:in) */
0x01, /* bmAttributes (bitmap) */
0x03,0x0, /* wMaxPacketSize */
0x01, /* bInterval - Must be 1 for compliance */
@@ -2994,7 +2994,7 @@ unsigned char cfgDesc_Audio1[] =
/* Standard Endpoint Descriptor */
0x09,
0x05, /* ENDPOINT */
0x82, /* EndpointAddress */
ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */
0x05, /* Attributes - isochronous async */
FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/
(FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */

View File

@@ -332,12 +332,14 @@ void usb_audio_core(chanend c_mix_out
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
#endif
//:buffer
buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO], /* Audio Out*/
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
#endif
#ifdef MIDI
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
c_midi,
#endif
#ifdef IAP

View File

@@ -19,7 +19,9 @@
*/
void buffer(chanend c_aud_out,
chanend c_aud_in,
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_ENDPOINT)
chanend c_aud_fb,
#endif
#ifdef MIDI
chanend c_midi_from_host,
chanend c_midi_to_host,

View File

@@ -94,7 +94,10 @@ unsigned char fb_clocks[16];
* @param c_aud_fb chanend for feeback to xud
* @return void
*/
void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud_fb,
void buffer(register chanend c_aud_out, register chanend c_aud_in,
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_ENDPOINT)
chanend c_aud_fb,
#endif
#ifdef MIDI
chanend c_midi_from_host,
chanend c_midi_to_host,
@@ -131,7 +134,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
{
XUD_ep ep_aud_out = XUD_InitEp(c_aud_out);
XUD_ep ep_aud_in = XUD_InitEp(c_aud_in);
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_ENDPOINT)
XUD_ep ep_aud_fb = XUD_InitEp(c_aud_fb);
#endif
#ifdef MIDI
XUD_ep ep_midi_from_host = XUD_InitEp(c_midi_from_host);
XUD_ep ep_midi_to_host = XUD_InitEp(c_midi_to_host);
@@ -344,6 +349,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
SET_SHARED_GLOBAL(g_formatChange_DataFormat, formatChange_DataFormat);
SET_SHARED_GLOBAL(g_formatChange_SampRes, formatChange_SampRes);
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
/* Host is starting up the output stream. Setup (or potentially resize) feedback packet based on bus-speed
* This is only really important on inital start up (when bus-speed
was unknown) and when changing bus-speeds */
@@ -357,7 +363,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
{
XUD_SetReady_In(ep_aud_fb, fb_clocks, 3);
}
#endif
}
/* Pass on sample freq change to decouple() via global flag (saves a chanend) */
/* Note: freqChange flags now used to communicate other commands also */
@@ -460,6 +466,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
#endif
#if (NUM_USB_CHAN_OUT > 0)
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
/* Feedback Pipe */
case XUD_SetData_Select(c_aud_fb, ep_aud_fb, result):
{
@@ -477,7 +484,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
}
}
break;
#endif
/* Received Audio packet HOST -> DEVICE. Datalength written to length */
case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result):
{