Merge branch 'DEV_IMP_FB'

This commit is contained in:
Ross Owen
2015-09-08 11:39:06 +01:00
6 changed files with 104 additions and 37 deletions

View File

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

View File

@@ -671,24 +671,30 @@ typedef struct
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format; USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format;
USB_Descriptor_Endpoint_t Audio_Out_Endpoint; USB_Descriptor_Endpoint_t Audio_Out_Endpoint;
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint; USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint;
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint; USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint;
#endif
#if (OUTPUT_FORMAT_COUNT > 1) #if (OUTPUT_FORMAT_COUNT > 1)
USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt2; USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt2;
USB_Descriptor_Audio_Interface_AS_t Audio_Out_ClassStreamInterface_2; USB_Descriptor_Audio_Interface_AS_t Audio_Out_ClassStreamInterface_2;
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_2; USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_2;
USB_Descriptor_Endpoint_t Audio_Out_Endpoint_2; USB_Descriptor_Endpoint_t Audio_Out_Endpoint_2;
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_2; USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_2;
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_2; USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_2;
#endif #endif
#endif
#if (OUTPUT_FORMAT_COUNT > 2) #if (OUTPUT_FORMAT_COUNT > 2)
USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt3; USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt3;
USB_Descriptor_Audio_Interface_AS_t Audio_Out_ClassStreamInterface_3; USB_Descriptor_Audio_Interface_AS_t Audio_Out_ClassStreamInterface_3;
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_3; USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_3;
USB_Descriptor_Endpoint_t Audio_Out_Endpoint_3; USB_Descriptor_Endpoint_t Audio_Out_Endpoint_3;
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_3; USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_3;
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_3; USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_3;
#endif #endif
#endif #endif
#endif
#if (NUM_USB_CHAN_IN > 0) #if (NUM_USB_CHAN_IN > 0)
/* Audio Streaming: Input stream */ /* Audio Streaming: Input stream */
USB_Descriptor_Interface_t Audio_In_StreamInterface_Alt0; /* Zero bandwith alternative */ USB_Descriptor_Interface_t Audio_In_StreamInterface_Alt0; /* Zero bandwith alternative */
@@ -1382,7 +1388,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */ USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */ INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
1, /* 3 bAlternateSetting */ 1, /* 3 bAlternateSetting */
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
2, /* 4 bNumEndpoints */ 2, /* 4 bNumEndpoints */
#else
1, /* 4 bNumEndpoints */
#endif
USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */ USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */
UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */ UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */
UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */ UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */
@@ -1407,10 +1417,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
/* Type 1 Format Type Descriptor */ /* Type 1 Format Type Descriptor */
.Audio_Out_Format = .Audio_Out_Format =
{ {
0x06, /* 0 bLength (in bytes): 6 */ .bLength = 0x06,
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */ .bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE, /* 2 bDescriptorSubtype: FORMAT_TYPE */ .bDescriptorSubtype = UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE,
UAC_FORMAT_TYPE_I, /* 3 bFormatType: FORMAT_TYPE_1 */ .bFormatType = UAC_FORMAT_TYPE_I,
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, .bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, .bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS,
}, },
@@ -1420,7 +1430,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = sizeof(USB_Descriptor_Endpoint_t), .bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01, /* (D7: 0:out, 1:in) */ .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05, /* (bitmap) */ .bmAttributes = 0x05, /* (bitmap) */
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
.bInterval = 1, .bInterval = 1,
@@ -1438,15 +1448,17 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x0008, /* 6:7 bLockDelay */ 0x0008, /* 6:7 bLockDelay */
}, },
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.Audio_Out_Fb_Endpoint = .Audio_Out_Fb_Endpoint =
{ {
0x07, /* 0 bLength: 7 */ .bLength = 0x07,
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */ .bDescriptorType = USB_DESCTYPE_ENDPOINT,
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */ .bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
17, /* 3 bmAttributes (bitmap) */ .bmAttributes = 17, /* (bitmap) */
0x0004, /* 4 wMaxPacketSize */ .wMaxPacketSize = 0x0004,
4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */ .bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
}, },
#endif
#if (OUTPUT_FORMAT_COUNT > 1) #if (OUTPUT_FORMAT_COUNT > 1)
/* Standard AS Interface Descriptor (4.9.1) (Alt) */ /* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_Out_StreamInterface_Alt2 = .Audio_Out_StreamInterface_Alt2 =
@@ -1455,7 +1467,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */ USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */ INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
2, /* 3 bAlternateSetting */ 2, /* 3 bAlternateSetting */
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
2, /* 4 bNumEndpoints */ 2, /* 4 bNumEndpoints */
#else
1, /* 4 bNumEndpoints */
#endif
USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */ USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */
UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */ UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */
UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */ UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */
@@ -1492,7 +1508,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = sizeof(USB_Descriptor_Endpoint_t), .bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05, .bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE,
.bInterval = 1, .bInterval = 1,
@@ -1510,16 +1526,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x0008, /* 6:7 bLockDelay */ 0x0008, /* 6:7 bLockDelay */
}, },
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.Audio_Out_Fb_Endpoint_2 = .Audio_Out_Fb_Endpoint_2 =
{ {
0x07, /* 0 bLength: 7 */ 0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */ 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) */ 17, /* 3 bmAttributes (bitmap) */
0x0004, /* 4 wMaxPacketSize */ 0x0004, /* 4 wMaxPacketSize */
4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */ 4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */
}, },
#endif #endif
#endif
#if (OUTPUT_FORMAT_COUNT > 2) #if (OUTPUT_FORMAT_COUNT > 2)
/* Standard AS Interface Descriptor (4.9.1) (Alt) */ /* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_Out_StreamInterface_Alt3 = .Audio_Out_StreamInterface_Alt3 =
@@ -1528,7 +1546,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */ USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */ INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
3, /* 3 bAlternateSetting */ 3, /* 3 bAlternateSetting */
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
2, /* 4 bNumEndpoints */ 2, /* 4 bNumEndpoints */
#else
1, /* 4 bNumEndpoints */
#endif
USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */ USB_CLASS_AUDIO, /* 5 bInterfaceClass: AUDIO */
UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */ UAC_INT_SUBCLASS_AUDIOSTREAMING, /* 6 bInterfaceSubClass: AUDIO_STREAMING */
UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */ UAC_INT_PROTOCOL_IP_VERSION_02_00,/* 7 bInterfaceProtocol: IP_VERSION_02_00 */
@@ -1566,7 +1588,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = 0x07, .bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
.bmAttributes = 0x05, .bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE,
.bInterval = 1, .bInterval = 1,
@@ -1584,15 +1606,17 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
.wLockDelay = 0x0008, .wLockDelay = 0x0008,
}, },
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.Audio_Out_Fb_Endpoint_3 = .Audio_Out_Fb_Endpoint_3 =
{ {
.bLength = 0x07, .bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
.bmAttributes = 17, /* (bitmap) */ .bmAttributes = 17, /* (bitmap) */
.wMaxPacketSize = 0x0004, .wMaxPacketSize = 0x0004,
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */ .bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
}, },
#endif
#endif /* OUTPUT_FORMAT_COUNT > 2 */ #endif /* OUTPUT_FORMAT_COUNT > 2 */
#endif /* OUTPUT */ #endif /* OUTPUT */
#if (NUM_USB_CHAN_IN > 0) #if (NUM_USB_CHAN_IN > 0)
@@ -1657,8 +1681,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = 0x07, .bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
.bmAttributes = 5, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
.bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */
#endif
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE,
.bInterval = 0x01, .bInterval = 0x01,
}, },
@@ -1721,8 +1749,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = 0x07, .bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
.bmAttributes = 5, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
.bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */
#endif
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE,
.bInterval = 0x01, .bInterval = 0x01,
}, },
@@ -1786,8 +1818,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{ {
.bLength = 0x07, .bLength = 0x07,
.bDescriptorType = USB_DESCTYPE_ENDPOINT, .bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x82, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
.bmAttributes = 5, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
.bmAttributes = 0x05, /* Iso, async, data endpoint */
#else
.bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */
#endif
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE, .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE,
.bInterval = 0x01, .bInterval = 0x01,
}, },
@@ -2179,7 +2215,11 @@ unsigned char cfgDesc_Null[] =
/* Note, this is different that INTERFACE_COUNT since we dont support items such as MIDI, iAP etc in UAC1 mode */ /* Note, this is different that INTERFACE_COUNT since we dont support items such as MIDI, iAP etc in UAC1 mode */
#define NUM_INTERFACES_A1 (1+INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1) #define NUM_INTERFACES_A1 (1+INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1)
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * 61) + (OUTPUT_INTERFACES_A1 * 70)) #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * 61) + (OUTPUT_INTERFACES_A1 * 70))
#else
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * 61) + (OUTPUT_INTERFACES_A1 * 61))
#endif
/* In UAC1 supported sample rates are listed in descriptor */ /* In UAC1 supported sample rates are listed in descriptor */
/* Note, we always report 4 freqs, doing otherwise seems to cause an enumeration issue on Windows */ /* Note, we always report 4 freqs, doing otherwise seems to cause an enumeration issue on Windows */
@@ -2317,7 +2357,11 @@ unsigned char cfgDesc_Audio1[] =
0x04, /* INTERFACE */ 0x04, /* INTERFACE */
0x01, /* Interface no */ 0x01, /* Interface no */
0x01, /* AlternateSetting */ 0x01, /* AlternateSetting */
0x02, /* num endpoints 2: audio EP and feedback EP */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
0x02, /* bNumEndpoints 2: audio EP and feedback EP */
#else
0x01, /* bNumEndpoints */
#endif
0x01, /* Interface class - AUDIO */ 0x01, /* Interface class - AUDIO */
0x02, /* subclass - AUDIO_STREAMING */ 0x02, /* subclass - AUDIO_STREAMING */
0x00, /* Unused */ 0x00, /* Unused */
@@ -2367,7 +2411,11 @@ unsigned char cfgDesc_Audio1[] =
(FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */
0x01, /* bInterval */ 0x01, /* bInterval */
0x00, /* bRefresh */ 0x00, /* bRefresh */
0x81, /* bSynchAdddress - address of EP used to communicate sync info */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
ENDPOINT_ADDRESS_IN_FEEDBACK, /* bSynchAdddress - address of EP used to communicate sync info */
#else
ENDPOINT_ADDRESS_IN_AUDIO,
#endif
/* CS_Endpoint Descriptor ?? */ /* CS_Endpoint Descriptor ?? */
0x07, 0x07,
@@ -2377,16 +2425,18 @@ unsigned char cfgDesc_Audio1[] =
0x02, /* bLockDelayUnits */ 0x02, /* bLockDelayUnits */
0x00, 0x00, /* bLockDelay */ 0x00, 0x00, /* bLockDelay */
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
/* Feedback EP */ /* Feedback EP */
0x09, 0x09,
0x05, /* bDescriptorType: ENDPOINT */ 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) */ 0x01, /* bmAttributes (bitmap) */
0x03,0x0, /* wMaxPacketSize */ 0x03,0x0, /* wMaxPacketSize */
0x01, /* bInterval - Must be 1 for compliance */ 0x01, /* bInterval - Must be 1 for compliance */
0x04, /* bRefresh 2^x */ 0x04, /* bRefresh 2^x */
0x0, /* bSynchAddress */ 0x0, /* bSynchAddress */
#endif #endif
#endif
#if (NUM_USB_CHAN_IN > 0) #if (NUM_USB_CHAN_IN > 0)
/* Standard Interface Descriptor - Audio streaming IN */ /* Standard Interface Descriptor - Audio streaming IN */
@@ -2447,8 +2497,12 @@ unsigned char cfgDesc_Audio1[] =
/* Standard Endpoint Descriptor */ /* Standard Endpoint Descriptor */
0x09, 0x09,
0x05, /* ENDPOINT */ 0x05, /* ENDPOINT */
0x82, /* EndpointAddress */ ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */
0x05, /* Attributes - isochronous async */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
0x05, /* Iso, async, data endpoint */
#else
0x25, /* Iso, async, implicit feedback data endpoint */
#endif
FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/ FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/
(FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ (FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */
0x01, /* bInterval */ 0x01, /* bInterval */

View File

@@ -525,7 +525,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
{ {
unsigned epNum = sp.wIndex & 0xff; unsigned epNum = sp.wIndex & 0xff;
if ((epNum == 0x82) || (epNum == 0x01)) if ((epNum == ENDPOINT_ADDRESS_OUT_AUDIO) || (epNum == ENDPOINT_ADDRESS_IN_AUDIO))
{ {
#if (AUDIO_CLASS == 2) && defined(AUDIO_CLASS_FALLBACK) #if (AUDIO_CLASS == 2) && defined(AUDIO_CLASS_FALLBACK)
if(g_curUsbSpeed == XUD_SPEED_FS) if(g_curUsbSpeed == XUD_SPEED_FS)

View File

@@ -330,9 +330,11 @@ void usb_audio_core(chanend c_mix_out
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x)); asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
#endif #endif
//:buffer //:buffer
buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/ buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO], /* Audio Out*/
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */ 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 */ c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
#endif
#ifdef MIDI #ifdef MIDI
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2 c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4 c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4

View File

@@ -21,7 +21,9 @@
void buffer(chanend c_aud_out, void buffer(chanend c_aud_out,
chanend c_aud_in, chanend c_aud_in,
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
chanend c_aud_fb, chanend c_aud_fb,
#endif
#ifdef MIDI #ifdef MIDI
chanend c_midi_from_host, chanend c_midi_from_host,
chanend c_midi_to_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 * @param c_aud_fb chanend for feeback to xud
* @return void * @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_EP)
chanend c_aud_fb,
#endif
#ifdef MIDI #ifdef MIDI
chanend c_midi_from_host, chanend c_midi_from_host,
chanend c_midi_to_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_out = XUD_InitEp(c_aud_out);
XUD_ep ep_aud_in = XUD_InitEp(c_aud_in); XUD_ep ep_aud_in = XUD_InitEp(c_aud_in);
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
XUD_ep ep_aud_fb = XUD_InitEp(c_aud_fb); XUD_ep ep_aud_fb = XUD_InitEp(c_aud_fb);
#endif
#ifdef MIDI #ifdef MIDI
XUD_ep ep_midi_from_host = XUD_InitEp(c_midi_from_host); XUD_ep ep_midi_from_host = XUD_InitEp(c_midi_from_host);
XUD_ep ep_midi_to_host = XUD_InitEp(c_midi_to_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_DataFormat, formatChange_DataFormat);
SET_SHARED_GLOBAL(g_formatChange_SampRes, formatChange_SampRes); 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 /* 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 * This is only really important on inital start up (when bus-speed
was unknown) and when changing bus-speeds */ 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); XUD_SetReady_In(ep_aud_fb, fb_clocks, 3);
} }
#endif
} }
/* Pass on sample freq change to decouple() via global flag (saves a chanend) */ /* Pass on sample freq change to decouple() via global flag (saves a chanend) */
/* Note: freqChange flags now used to communicate other commands also */ /* 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 #endif
#if (NUM_USB_CHAN_OUT > 0) #if (NUM_USB_CHAN_OUT > 0)
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
/* Feedback Pipe */ /* Feedback Pipe */
case XUD_SetData_Select(c_aud_fb, ep_aud_fb, result): 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; break;
#endif
/* Received Audio packet HOST -> DEVICE. Datalength written to length */ /* Received Audio packet HOST -> DEVICE. Datalength written to length */
case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result): case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result):
{ {