'Release: 6.5.0beta0'

This commit is contained in:
Ross Owen
2014-03-06 17:50:18 +00:00
parent bee1470310
commit 9c5e0a1dd8
11 changed files with 213 additions and 212 deletions

View File

@@ -1,7 +1,7 @@
USB Audio Shared
................
:Latest release: 6.4.0beta4
:Latest release: 6.5.0beta0
:Maintainer: xross
:Description: USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.

View File

@@ -87,7 +87,7 @@ unsigned char DFUcfgDesc[] = {
};
int DFUReportResetState(NULLABLE_RESOURCE(chanend , c_user_cmd));
int DFUDeviceRequests(XUD_ep c_ep0_out, NULLABLE_REFERENCE_PARAM(XUD_ep, ep0_in), REFERENCE_PARAM(USB_SetupPacket_t, sp),
int DFUDeviceRequests(XUD_ep c_ep0_out, NULLABLE_REFERENCE_PARAM(XUD_ep, ep0_in), REFERENCE_PARAM(USB_SetupPacket_t, sp),
NULLABLE_RESOURCE(chanend, c_user_cmd), unsigned int altInterface, unsigned int user_reset);
/* Helper function for C */

View File

@@ -26,7 +26,7 @@
#define SET_SAMPLE_FREQ 4
#define SET_DSD_MODE 7
#define SET_STREAM_FORMAT_OUT 8
#define SET_STREAM_FORMAT_IN 9
#define SET_STREAM_FORMAT_IN 9
#include "dsd_support.h"

View File

@@ -295,7 +295,7 @@
/* Device release number in BCD: 0xJJMN */
#define BCD_DEVICE_J 6
#define BCD_DEVICE_M 4
#define BCD_DEVICE_M 5
#define BCD_DEVICE_N 0
#ifndef BCD_DEVICE
@@ -316,7 +316,7 @@
#error only OUTPUT_FORMAT_COUNT of 3 or less supported
#endif
#if defined(NATIVE_DSD) && (OUTPUT_FORMAT_COUNT == 1)
#if defined(NATIVE_DSD) && (OUTPUT_FORMAT_COUNT == 1)
#error OUTPUT_FORMAT_COUNT should be >= 2 when NATIVE_DSD enabled
#endif
@@ -353,31 +353,31 @@
/* Default resolutions for HS */
#ifndef HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#endif
#ifndef HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#endif
#ifndef HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#define HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#endif
/* Default resolutions for FS (same as HS) */
#ifndef FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
#endif
#ifndef FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
#endif
#ifndef FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#define FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
#endif
/* Setup default subslot size based on resolution
/* Setup default subslot size based on resolution
* Catch special 24bit case where 4 byte subslot is nicer for our 32-bit machine.
* Typically do not care about this extra bus overhead at High-speed */
#ifndef HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES
@@ -386,7 +386,7 @@
#else
#define HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES (HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS/8)
#endif
#endif
#endif
#ifndef HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES
#if (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS == 24)
@@ -394,7 +394,7 @@
#else
#define HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS/8)
#endif
#endif
#endif
#ifndef HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES
#if (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS == 24)
@@ -402,18 +402,18 @@
#else
#define HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS/8)
#endif
#endif
#endif
/* Setup default FS subslot sizes - make as small as possible */
#ifndef FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES
#ifndef FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES
#define FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS/8)
#endif
#ifndef FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES
#ifndef FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES
#define FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS/8)
#endif
#ifndef FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES
#ifndef FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES
#define FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS/8)
#endif
@@ -443,23 +443,23 @@
#endif
/* Some stream format checks */
#if (OUTPUT_FORMAT_COUNT > 0)
#if (OUTPUT_FORMAT_COUNT > 0)
#if !defined(HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS) || \
!defined(HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES) || \
!defined(STREAM_FORMAT_OUTPUT_1_DATAFORMAT)
#error HS_OUTPUT_STREAM_1 not properly defined
#endif
#endif
#if (OUTPUT_FORMAT_COUNT > 1)
#endif
#endif
#if (OUTPUT_FORMAT_COUNT > 1)
#if !defined(HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS) || \
!defined(HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES) || \
!defined(STREAM_FORMAT_OUTPUT_2_DATAFORMAT)
#error HS_OUTPUT_STREAM_2 not properly defined
#endif
#endif
#if (OUTPUT_FORMAT_COUNT > 2)
#endif
#endif
#if (OUTPUT_FORMAT_COUNT > 2)
#if !defined(HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS) || \
!defined(HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES) || \
!defined(STREAM_FORMAT_OUTPUT_3_DATAFORMAT)
@@ -521,12 +521,12 @@
/* Default resolutions for HS */
#ifndef HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#define HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#define HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#endif
/* Default resolutions for FS (same as HS) */
#ifndef FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#define FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#define FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
#endif
/* Setup default subslot sized based on resolution */
@@ -536,10 +536,10 @@
#else
#define HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8)
#endif
#endif
#endif
/* Setup default FS subslot sizes */
#ifndef FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES
#ifndef FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES
#define FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8)
#endif
@@ -549,7 +549,7 @@
#endif
/* Useful for dropping lower part of macs in volume processing... */
#if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_INPUT_2_RESOLUTION_BITS > 24)
#if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_INPUT_2_RESOLUTION_BITS > 24)
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 1
#else
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 0

View File

@@ -200,7 +200,7 @@ enum {
};
#ifdef HID_CONTROLS
unsigned char hidReportDescriptor[] =
unsigned char hidReportDescriptor[] =
{
0x05, 0x0c, /* Usage Page (Consumer Device) */
0x09, 0x01, /* Usage (Consumer Control) */
@@ -230,7 +230,7 @@ unsigned char hidReportDescriptor[] =
#define MAX_PACKET_SIZE_MULT_OUT_HS ((((MAX_FREQ+7999)/8000)+1) * NUM_USB_CHAN_OUT)
#define MAX_PACKET_SIZE_MULT_OUT_FS ((((MAX_FREQ_FS+999)/1000)+1) * NUM_USB_CHAN_OUT_FS)
#define MAX_PACKET_SIZE_MULT_IN_HS ((((MAX_FREQ+7999)/8000)+1) * NUM_USB_CHAN_IN)
#define MAX_PACKET_SIZE_MULT_IN_FS ((((MAX_FREQ_FS+999)/1000)+1) * NUM_USB_CHAN_IN_FS)
#define MAX_PACKET_SIZE_MULT_IN_FS ((((MAX_FREQ_FS+999)/1000)+1) * NUM_USB_CHAN_IN_FS)
#define HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_OUT_HS * HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES)
#define HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_OUT_HS * HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES)
@@ -240,19 +240,19 @@ unsigned char hidReportDescriptor[] =
#define FS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_OUT_FS * FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES)
#define FS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_OUT_FS * FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES)
#define HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_IN_HS * HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
#define FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_IN_FS * FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
#define HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_IN_HS * HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
#define FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_IN_FS * FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
typedef struct
typedef struct
{
/* Class Specific Audio Control Interface Header Descriptor */
UAC_Descriptor_Interface_AC_t Audio_ClassControlInterface;
UAC_Descriptor_Interface_AC_t Audio_ClassControlInterface;
USB_Descriptor_Audio_ClockSource_t Audio_ClockSource;
USB_Descriptor_Audio_ClockSelector_t Audio_ClockSelector;
#ifdef OUTPUT
/* Output path */
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
USB_Descriptor_Audio_OutputTerminal_t Audio_Out_OutputTerminal;
#endif
#ifdef INPUT
@@ -264,16 +264,16 @@ typedef struct
} __attribute__((packed)) USB_CfgDesc_Audio2_CS_Control_Int;
typedef struct
{
{
/* Configuration header */
USB_Descriptor_Configuration_Header_t Config;
/* Audio Control */
USB_Descriptor_Interface_Association_t Audio_InterfaceAssociation;
USB_Descriptor_Interface_t Audio_StdControlInterface; /* Standard Audio Control Interface Header Descriptor */
USB_CfgDesc_Audio2_CS_Control_Int Audio_CS_Control_Int;
#ifdef OUTPUT
#ifdef OUTPUT
/* Audio streaming: Output stream */
USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt0; /* Zero bandwith alternative */
USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt1;
@@ -326,7 +326,7 @@ typedef struct
#ifdef IAP_INT_EP
USB_Descriptor_Endpoint_t iAP_Interrupt_Endpoint;
#endif
#endif
#endif
#ifdef HID_CONTROLS
USB_Descriptor_Interface_t HID_Interface;
@@ -337,38 +337,38 @@ typedef struct
}__attribute__((packed)) USB_Config_Descriptor_Audio2_t;
#if 1
USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
{
.Config =
.Config =
{
.bLength = sizeof(USB_Descriptor_Configuration_Header_t),
.bDescriptorType = USB_DESCTYPE_CONFIGURATION,
.wTotalLength = sizeof(USB_Config_Descriptor_Audio2_t),
.bLength = sizeof(USB_Descriptor_Configuration_Header_t),
.bDescriptorType = USB_DESCTYPE_CONFIGURATION,
.wTotalLength = sizeof(USB_Config_Descriptor_Audio2_t),
.bNumInterfaces = NUM_INTERFACES,
.bConfigurationValue = 0x01,
.iConfiguration = 0x00,
#ifdef SELF_POWERED
.bmAttributes = 192,
#else
.bmAttributes = 128,
#endif
.bMaxPower = BMAX_POWER,
},
.bmAttributes = 128,
#endif
.bMaxPower = BMAX_POWER,
},
.Audio_InterfaceAssociation =
.Audio_InterfaceAssociation =
{
.bLength = sizeof(USB_Descriptor_Interface_Association_t),
.bDescriptorType = USB_DESCTYPE_INTERFACE_ASSOCIATION,
.bFirstInterface = 0x00,
.bFirstInterface = 0x00,
.bInterfaceCount = AUDIO_INTERFACES,
.bFunctionClass = AUDIO_FUNCTION,
.bFunctionSubClass = FUNCTION_SUBCLASS_UNDEFINED,
.bFunctionProtocol = UAC_FUNC_PROTOCOL_AF_VERSION_02_00,
.iFunction = 0x00,
},
/* Standard Audio Control Interface Descriptor (Note: Must be first with lowest interface number)r */
.Audio_StdControlInterface =
.Audio_StdControlInterface =
{
.bLength = sizeof(USB_Descriptor_Interface_t),
.bDescriptorType = USB_DESCTYPE_INTERFACE,
@@ -379,20 +379,20 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#else
.bNumEndpoints = 0x00,
#endif
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = UAC_INT_SUBCLASS_AUDIOCONTROL,
.bInterfaceProtocol = UAC_INT_PROTOCOL_IP_VERSION_02_00,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = UAC_INT_SUBCLASS_AUDIOCONTROL,
.bInterfaceProtocol = UAC_INT_PROTOCOL_IP_VERSION_02_00,
.iInterface = PRODUCT_STR_INDEX_A2,
},
},
.Audio_CS_Control_Int =
.Audio_CS_Control_Int =
{
/* Class Specific Audio Control Interface Header Descriptor: */
.Audio_ClassControlInterface =
{
.bLength = sizeof(UAC_Descriptor_Interface_AC_t),
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_HEADER,
.bLength = sizeof(UAC_Descriptor_Interface_AC_t),
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_HEADER,
.bcdADC = 0x0200,
.bCatagory = UAC_FUNCTION_IO_BOX, /*(Primary use of audio function) */
.wTotalLength = sizeof(USB_CfgDesc_Audio2_CS_Control_Int),
@@ -403,9 +403,9 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
.Audio_ClockSource =
{
.bLength = sizeof(USB_Descriptor_Audio_ClockSource_t),
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SOURCE,
.bClockID = ID_CLKSRC_INT,
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SOURCE,
.bClockID = ID_CLKSRC_INT,
.bmAttributes = 0x03, /* D[1:0] :
00: External Clock
01: Internal Fixed Clock
@@ -417,7 +417,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
D[1:0] : Clock Freq Control
D[3:2] : Clock Validity Control
D[7:4] : Reserved (0) */
.bAssocTerminal = 0x00,
.bAssocTerminal = 0x00,
.iClockSource = INTERNAL_CLOCK_STRING_INDEX,
},
@@ -425,10 +425,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
.Audio_ClockSelector =
{
.bLength = sizeof(USB_Descriptor_Audio_ClockSelector_t),
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SELECTOR,
.bClockID = ID_CLKSEL,
.bNrPins = NUM_CLOCKS,
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SELECTOR,
.bClockID = ID_CLKSEL,
.bNrPins = NUM_CLOCKS,
.baCSourceId[0] = ID_CLKSRC_INT,
#ifdef SPDIF_RX
ID_CLKSRC_EXT,
@@ -436,13 +436,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#ifdef ADAT_RX
ID_CLKSRC_ADAT,
#endif
.bmControl = 0x03,
.bmControl = 0x03,
.iClockSelector = 13, /* TODO Shoudn't be hard-coded */
},
#ifdef OUTPUT
/* Input Terminal Descriptor (USB Input Terminal) */
.Audio_Out_InputTerminal =
.Audio_Out_InputTerminal =
{
.bLength = sizeof(USB_Descriptor_Audio_InputTerminal_t),
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType */
@@ -459,8 +459,8 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Feature Unit Descriptor */
.Audio_Out_FeatureUnit =
{
.Audio_Out_FeatureUnit =
{
.bLength = sizeof(USB_Descriptor_Audio_FeatureUnit_Out_t), /* 0 bLength: 6+(ch + 1)*4 */
0x24, /* 1 bDescriptorType: CS_INTERFACE */
0x06, /* 2 bDescriptorSubType: FEATURE_UNIT */
@@ -531,11 +531,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#endif
},
0, /* 60 iFeature */
},
},
/* Output Terminal Descriptor (Audio) */
.Audio_Out_OutputTerminal =
{
.Audio_Out_OutputTerminal =
{
0x0C, /* 0 bLength */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
UAC_CS_AC_INTERFACE_SUBTYPE_OUTPUT_TERMINAL, /* 2 bDescriptorSubType: OUTPUT_TERMINAL */
@@ -550,23 +550,23 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#endif
#ifdef INPUT
/* Input Terminal Descriptor (Analogue Input Terminal) */
.Audio_In_InputTerminal =
.Audio_In_InputTerminal =
{
.bLength = sizeof(USB_Descriptor_Audio_InputTerminal_t),
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_INPUT_TERMINAL,
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_INPUT_TERMINAL,
.bTerminalID = ID_IT_AUD,
.wTerminalType = UAC_TT_INPUT_TERMTYPE_MICROPHONE,
.wTerminalType = UAC_TT_INPUT_TERMTYPE_MICROPHONE,
.bAssocTerminal = 0x00,
.bCSourceID = ID_CLKSEL,
.bNrChannels = NUM_USB_CHAN_IN,
.bNrChannels = NUM_USB_CHAN_IN,
.bmChannelConfig = 0x00000000,
.iChannelNames = INPUT_INTERFACE_STRING_INDEX,
.iChannelNames = INPUT_INTERFACE_STRING_INDEX,
.bmControls = 0x0000,
.iTerminal = 0,
.iTerminal = 0,
},
.Audio_In_FeatureUnit =
.Audio_In_FeatureUnit =
{
.bLength = sizeof(USB_Descriptor_Audio_FeatureUnit_In_t),
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: CS_INTERFACE */
@@ -638,9 +638,9 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#endif
},
0, /* 60 iFeature */
},
.Audio_In_OutputTerminal =
},
.Audio_In_OutputTerminal =
{
/* Output Terminal Descriptor (USB Streaming) */
0x0C, /* 0 bLength */
@@ -660,7 +660,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#ifdef OUTPUT
/* Zero bandwith alternative 0 */
/* Standard AS Interface Descriptor (4.9.1) */
.Audio_Out_StreamInterface_Alt0 =
.Audio_Out_StreamInterface_Alt0 =
{
0x09, /* 0 bLength: (in bytes, 9) */
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
@@ -675,7 +675,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
/* Alternative 1 */
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_Out_StreamInterface_Alt1 =
.Audio_Out_StreamInterface_Alt1 =
{
0x09, /* 0 bLength: (in bytes, 9) */
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
@@ -689,7 +689,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* STREAMING_OUTPUT_ALT1_OFFSET: */
/* Class Specific AS Interface Descriptor */
.Audio_Out_ClassStreamInterface =
.Audio_Out_ClassStreamInterface =
{
0x10, /* 0 bLength: 16 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -704,29 +704,29 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Type 1 Format Type Descriptor */
.Audio_Out_Format =
.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,
.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) */
.Audio_Out_Endpoint =
.Audio_Out_Endpoint =
{
.bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01, /* (D7: 0:out, 1:in) */
.bmAttributes = 0x05, /* (bitmap) */
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
.bInterval = 1,
.bInterval = 1,
},
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor (4.10.1.2) */
.Audio_Out_ClassEndpoint =
.Audio_Out_ClassEndpoint =
{
0x08, /* 0 bLength */
UAC_CS_DESCTYPE_ENDPOINT, /* 1 bDescriptorType */
@@ -737,7 +737,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x0008, /* 6:7 bLockDelay */
},
.Audio_Out_Fb_Endpoint =
.Audio_Out_Fb_Endpoint =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
@@ -748,7 +748,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
#if (OUTPUT_FORMAT_COUNT > 1)
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_Out_StreamInterface_Alt2 =
.Audio_Out_StreamInterface_Alt2 =
{
0x09, /* 0 bLength: (in bytes, 9) */
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
@@ -762,7 +762,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Class Specific AS Interface Descriptor */
.Audio_Out_ClassStreamInterface_2 =
.Audio_Out_ClassStreamInterface_2 =
{
0x10, /* 0 bLength: 16 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -777,28 +777,28 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Type 1 Format Type Descriptor */
.Audio_Out_Format_2 =
.Audio_Out_Format_2 =
{
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_2_SUBSLOT_BYTES,
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES,
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS,
},
},
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
.Audio_Out_Endpoint_2 =
.Audio_Out_Endpoint_2 =
{
.bLength = sizeof(USB_Descriptor_Endpoint_t),
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE,
.bInterval = 1,
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = 0x05,
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE,
.bInterval = 1,
},
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor (4.10.1.2) */
.Audio_Out_ClassEndpoint_2 =
.Audio_Out_ClassEndpoint_2 =
{
0x08, /* 0 bLength */
UAC_CS_DESCTYPE_ENDPOINT, /* 1 bDescriptorType */
@@ -809,7 +809,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x0008, /* 6:7 bLockDelay */
},
.Audio_Out_Fb_Endpoint_2 =
.Audio_Out_Fb_Endpoint_2 =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
@@ -821,7 +821,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#endif
#if (OUTPUT_FORMAT_COUNT > 2)
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_Out_StreamInterface_Alt3 =
.Audio_Out_StreamInterface_Alt3 =
{
0x09, /* 0 bLength: (in bytes, 9) */
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
@@ -835,7 +835,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Class Specific AS Interface Descriptor */
.Audio_Out_ClassStreamInterface_3 =
.Audio_Out_ClassStreamInterface_3 =
{
0x10, /* 0 bLength: 16 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -850,7 +850,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Type 1 Format Type Descriptor */
.Audio_Out_Format_3 =
.Audio_Out_Format_3 =
{
0x06, /* 0 bLength (in bytes): 6 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -858,10 +858,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
UAC_FORMAT_TYPE_I, /* 3 bFormatType: FORMAT_TYPE_1 */
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES,
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS,
},
},
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
.Audio_Out_Endpoint_3 =
.Audio_Out_Endpoint_3 =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
@@ -872,7 +872,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor (4.10.1.2) */
.Audio_Out_ClassEndpoint_3 =
.Audio_Out_ClassEndpoint_3 =
{
0x08, /* 0 bLength */
UAC_CS_DESCTYPE_ENDPOINT, /* 1 bDescriptorType */
@@ -883,7 +883,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x0008, /* 6:7 bLockDelay */
},
.Audio_Out_Fb_Endpoint_3 =
.Audio_Out_Fb_Endpoint_3 =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
@@ -895,7 +895,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#endif /* OUTPUT_FORMAT_COUNT > 2 */
#endif /* OUTPUT */
#ifdef INPUT
/* Zero bandwith alternative 0 */
/* Standard AS Interface Descriptor (4.9.1) */
.Audio_In_StreamInterface_Alt0 =
@@ -913,7 +913,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
/* Alternative 1 */
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
.Audio_In_StreamInterface_Alt1 =
.Audio_In_StreamInterface_Alt1 =
{
0x09, /* 0 bLength: (in bytes, 9) */
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
@@ -927,7 +927,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
},
/* Class Specific AS Interface Descriptor */
.Audio_In_ClassStreamInterface =
.Audio_In_ClassStreamInterface =
{
0x10, /* 0 bLength: 16 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -939,10 +939,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
NUM_USB_CHAN_IN, /* 11 bNrChannels */
0x00000000, /* 12:14: bmChannelConfig */
INPUT_INTERFACE_STRING_INDEX, /* 15 iChannelNames */
},
},
/* Type 1 Format Type Descriptor */
.Audio_In_Format =
.Audio_In_Format =
{
0x06, /* 0 bLength (in bytes): 6 */
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
@@ -950,28 +950,28 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
UAC_FORMAT_TYPE_I, /* 3 bFormatType: FORMAT_TYPE_1 */
.bSubslotSize = HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* 4 bSubslotSize (Number of bytes per subslot) */
.bBitResolution = HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS,
},
},
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
.Audio_In_Endpoint =
{
.Audio_In_Endpoint =
{
0x07, /* 0 bLength: 7 */
USB_DESCTYPE_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
0x82, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
5, /* 3 bmAttributes (bitmap) */
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE,
.bInterval = 0x01,
.bInterval = 0x01,
},
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor (4.10.1.2) */
.Audio_In_ClassEndpoint =
.Audio_In_ClassEndpoint =
{
.bLength = sizeof(USB_Descriptor_Audio_Class_AS_Endpoint_t),
.bDescriptorType = UAC_CS_DESCTYPE_ENDPOINT,
.bDescriptorType = UAC_CS_DESCTYPE_ENDPOINT,
.bDescriptorSubtype = UAC_CS_ENDPOINT_SUBTYPE_EP_GENERAL,
.bmAttributes = 0x00,
.bmControls = 0x00,
.bLockDelayUnits = 0x02,
.bmControls = 0x00,
.bLockDelayUnits = 0x02,
.wLockDelay = 0x0008,
},
#endif
@@ -1131,25 +1131,25 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
#ifdef IAP
/* Interface descriptor */
.iAP_Interface =
.iAP_Interface =
{
.bLength = sizeof(USB_Descriptor_Interface_t),
.bDescriptorType = USB_DESCTYPE_INTERFACE,
.bInterfaceNumber = (INPUT_INTERFACES+OUTPUT_INTERFACES+MIDI_INTERFACES+DFU_INTERFACES+1),
.bAlternateSetting = 0x00,
.bDescriptorType = USB_DESCTYPE_INTERFACE,
.bInterfaceNumber = (INPUT_INTERFACES+OUTPUT_INTERFACES+MIDI_INTERFACES+DFU_INTERFACES+1),
.bAlternateSetting = 0x00,
#ifdef IAP_INT_EP
.bNumEndpoints = 0x03,
.bNumEndpoints = 0x03,
#else
.bNumEndpoints = 0x02,
#endif
.bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC,
.bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 38-1) */
.bInterfaceClass = USB_CLASS_VENDOR_SPECIFIC,
.bInterfaceSubClass = 0xF0, /* MFI Accessory (Table 38-1) */
.bInterfaceProtocol = 0x00,
.iInterface = IAP_INTERFACE_STRING_INDEX, /* Note, string is important! */
},
},
/* iAP Bulk OUT Endpoint Descriptor */
.iAP_Out_Endpoint =
.iAP_Out_Endpoint =
{
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
@@ -1157,10 +1157,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */
0x0200, /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
},
},
/* iAP Bulk IN Endpoint Descriptor */
.iAP_In_Endpoint =
.iAP_In_Endpoint =
{
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
@@ -1168,11 +1168,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */
0x0200, /* 4 wMaxPacketSize : Has to be 0x200 for compliance*/
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
},
},
#ifdef IAP_INT_EP
/* iAP Interrupt IN Endpoint Descriptor. Note, its usage is now deprecated */
.iAP_Interrupt_Endpoint =
.iAP_Interrupt_Endpoint =
{
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */

View File

@@ -100,15 +100,15 @@ XUD_BusSpeed_t g_curUsbSpeed = 0;
unsigned g_dsdMode = 0;
#endif
const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES,
HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES};
const unsigned g_subSlot_Out_FS[OUTPUT_FORMAT_COUNT] = {FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
const unsigned g_subSlot_Out_FS[OUTPUT_FORMAT_COUNT] = {FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES,
FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES};
const unsigned g_dataFormat_Out[OUTPUT_FORMAT_COUNT] = {STREAM_FORMAT_OUTPUT_1_DATAFORMAT,
const unsigned g_dataFormat_Out[OUTPUT_FORMAT_COUNT] = {STREAM_FORMAT_OUTPUT_1_DATAFORMAT,
STREAM_FORMAT_OUTPUT_2_DATAFORMAT,
STREAM_FORMAT_OUTPUT_3_DATAFORMAT};
@@ -116,12 +116,12 @@ const unsigned g_subSlot_In_HS[INPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_INPUT_1_S
const unsigned g_subSlot_In_FS[INPUT_FORMAT_COUNT] = {FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES};
const unsigned g_dataFormat_In[INPUT_FORMAT_COUNT] = {STREAM_FORMAT_INPUT_1_DATAFORMAT};
const unsigned g_dataFormat_In[INPUT_FORMAT_COUNT] = {STREAM_FORMAT_INPUT_1_DATAFORMAT};
/* Endpoint 0 function. Handles all requests to the device */
void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
NULLABLE_RESOURCE(chanend, c_mix_ctl),
NULLABLE_RESOURCE(chanend, c_clk_ctl),
NULLABLE_RESOURCE(chanend, c_mix_ctl),
NULLABLE_RESOURCE(chanend, c_clk_ctl),
NULLABLE_RESOURCE(chanend, c_usb_test))
{
USB_SetupPacket_t sp;
@@ -143,7 +143,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
#ifdef MIXER
/* Set up mixer default state */
for (int i = 0; i < 18*8; i++)
for (int i = 0; i < 18*8; i++)
{
mixer1Weights[i] = 0x8001; //-inf
}
@@ -276,7 +276,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
/* Send format of data onto buffering */
outuint(c_audioControl, SET_STREAM_FORMAT_OUT);
outuint(c_audioControl, g_dataFormat_Out[sp.wValue-1]); /* Data format (PCM/DSD) */
if(g_curUsbSpeed == XUD_SPEED_HS)
{
outuint(c_audioControl, NUM_USB_CHAN_OUT); /* Channel count */
@@ -287,7 +287,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
outuint(c_audioControl, NUM_USB_CHAN_OUT_FS);
outuint(c_audioControl, g_subSlot_Out_FS[sp.wValue-1]);
}
/* Handshake */
chkct(c_audioControl, XS1_CT_END);
}
@@ -304,7 +304,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
/* Send format of data onto buffering */
outuint(c_audioControl, SET_STREAM_FORMAT_IN);
outuint(c_audioControl, g_dataFormat_In[sp.wValue-1]); /* Data format (PCM/DSD) */
if(g_curUsbSpeed == XUD_SPEED_HS)
{
outuint(c_audioControl, NUM_USB_CHAN_IN); /* Channel count */
@@ -315,7 +315,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
outuint(c_audioControl, NUM_USB_CHAN_IN_FS);
outuint(c_audioControl, g_subSlot_In_FS[sp.wValue-1]);
}
/* Handshake */
chkct(c_audioControl, XS1_CT_END);
}
@@ -356,7 +356,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
//TODO - we should stall out of range requests
} /* if(sp.bRequest == SET_INTERFACE) */
break; /* BMREQ_H2D_STANDARD_INT */
@@ -406,7 +406,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
/* Consider host active with valid driver at this point */
UserHostActive(1);
}
///* No data stage for this request, just do status stage */
//result = XUD_DoSetRequestStatus(ep0_in);
@@ -472,12 +472,12 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
#ifdef __XC__
/* This will return 1 if reset requested */
if (DFUDeviceRequests(ep0_out, ep0_in, sp, null, g_interfaceAlt[sp.wIndex], 1))
#else
#else
/* This will return 1 if reset requested */
if (DFUDeviceRequests(ep0_out, &ep0_in, &sp, null, g_interfaceAlt[sp.wIndex], 1))
#endif
{
DFUDelay(50000000);
#endif
{
DFUDelay(50000000);
device_reboot(c_audioControl);
}
@@ -580,7 +580,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
#endif
}
else
{
{
/* Modify Audio Class 2.0 Config descriptor for Full-speed operation */
#if (NUM_USB_CHAN_OUT > 0)
cfgDesc_Audio2.Audio_CS_Control_Int.Audio_Out_InputTerminal.bNrChannels = NUM_USB_CHAN_OUT_FS;
@@ -620,7 +620,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
null, 0,
#ifdef __XC__
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), sp, c_usb_test, g_curUsbSpeed);
#else
#else
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed);
#endif
#elif (AUDIO_CLASS == 1)
@@ -654,7 +654,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), sp, c_usb_test, g_curUsbSpeed);
#else
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed);
#endif
#endif
}
#endif
}
@@ -663,7 +663,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
{
#ifdef __XC__
g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, ep0_in);
#else
#else
g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, &ep0_in);
#endif
g_currentConfig = 0;

View File

@@ -12,8 +12,8 @@
* */
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
unsigned short unitId, unsigned char direction, chanend c_audioControl,
NULLABLE_RESOURCE(chanend, c_mix_ctl),
unsigned short unitId, unsigned char direction, chanend c_audioControl,
NULLABLE_RESOURCE(chanend, c_mix_ctl),
NULLABLE_RESOURCE(chanend, c_clk_ctL));
#endif

View File

@@ -93,10 +93,10 @@ on tile[AUDIO_IO_TILE] : buffered in port:32 p_i2s_adc[I2S_WIRES_ADC] =
#if (XUD_SERIES_SUPPORT == XUD_L_SERIES) && (AUDIO_IO_TILE == XUD_TILE)
/* Note: L series ref clocked clocked from USB clock when USB enabled - use another clockblock for MIDI
* if MIDI and XUD on same tile. See XUD documentation.
* if MIDI and XUD on same tile. See XUD documentation.
*
* This is a clash with S/PDIF Tx but simultaneous S/PDIF and MIDI not currently supported on single tile device
*
* This is a clash with S/PDIF Tx but simultaneous S/PDIF and MIDI not currently supported on single tile device
*
*/
#define CLKBLK_MIDI XS1_CLKBLK_1;
#else

View File

@@ -187,7 +187,7 @@ __builtin_unreachable();
g_aud_to_host_dptr+=2;
}
break;
case 4:
{
#if (STREAM_FORMAT_INPUT_SUBSLOT_4_USED == 1)
@@ -320,7 +320,7 @@ __builtin_unreachable();
{
switch(g_curSubSlot_out)
{
case 2:
#if (STREAM_FORMAT_OUTPUT_SUBSLOT_2_USED == 0)
__builtin_unreachable();
@@ -433,7 +433,7 @@ __builtin_unreachable();
}
break;
default:
__builtin_unreachable();
break;
@@ -617,15 +617,15 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
{
mid *= NUM_USB_CHAN_IN_FS * slotSize;
}
asm("stw %0, %1[0]"::"r"(mid),"r"(g_aud_to_host_zeros));
/* Mark EP ready with the zero buffer. Note this will simply update the packet size
* if it is already ready */
GET_SHARED_GLOBAL(p, g_aud_to_host_buffer);
XUD_SetReady_InPtr(aud_to_host_usb_ep, p+4, mid);
}
unsigned char tmpBuffer[1026];
@@ -670,7 +670,7 @@ void decouple(chanend c_mix_out,
/* Setup pointer to In stream 0 buffer. Note, length will be innited to 0
* However, this should be over-written on first stream start (assuming host
properly sends a SetInterface() before streaming. In any case we will send
properly sends a SetInterface() before streaming. In any case we will send
0 length packets, which is reasonable behaviour */
t = array_to_xc_ptr(inZeroBuff);
g_aud_to_host_zeros = t;
@@ -697,7 +697,7 @@ void decouple(chanend c_mix_out,
asm("stw %0, %1[%2]"::"r"(MAX_VOL),"r"(p_multIn),"r"(i));
}
#endif
set_interrupt_handler(handle_audio_request, 200, 1, c_mix_out, 0);
/* Wait for usb_buffer() to set up globals for us to use
@@ -777,7 +777,7 @@ void decouple(chanend c_mix_out,
SET_SHARED_GLOBAL(g_aud_to_host_buffer,g_aud_to_host_zeros);
/* Update size of zeros buffer */
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_in);
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_in);
/* Reset OUT buffer state */
outUnderflow = 1;
@@ -810,11 +810,11 @@ void decouple(chanend c_mix_out,
/* Change in IN channel count */
DISABLE_INTERRUPTS();
SET_SHARED_GLOBAL(g_freqChange_flag, 0);
GET_SHARED_GLOBAL(g_numUsbChanIn, g_formatChange_NumChans);
GET_SHARED_GLOBAL(g_numUsbChanIn, g_formatChange_NumChans);
GET_SHARED_GLOBAL(g_curSubSlot_in, g_formatChange_SubSlot);
GET_SHARED_GLOBAL(dataFormat, g_formatChange_DataFormat); /* Not currently used for input stream */
/* Reset IN buffer state */
inOverflow = 0;
inUnderflow = 1;
@@ -827,7 +827,7 @@ void decouple(chanend c_mix_out,
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
/* Update size of zeros buffer */
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_in);
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_in);
GET_SHARED_GLOBAL(usbSpeed, g_curUsbSpeed);
if (usbSpeed == XUD_SPEED_HS)
@@ -841,7 +841,7 @@ void decouple(chanend c_mix_out,
SET_SHARED_GLOBAL(g_freqChange, 0);
asm("outct res[%0],%1"::"r"(buffer_aud_ctl_chan),"r"(XS1_CT_END));
ENABLE_INTERRUPTS();
}
else if(tmp == SET_STREAM_FORMAT_OUT)
@@ -852,7 +852,7 @@ void decouple(chanend c_mix_out,
/* Change in OUT channel count - note we expect this on every stream start event */
DISABLE_INTERRUPTS();
SET_SHARED_GLOBAL(g_freqChange_flag, 0);
GET_SHARED_GLOBAL(g_numUsbChanOut, g_formatChange_NumChans);
GET_SHARED_GLOBAL(g_numUsbChanOut, g_formatChange_NumChans);
GET_SHARED_GLOBAL(g_curSubSlot_out, g_formatChange_SubSlot);
GET_SHARED_GLOBAL(dataFormat, g_formatChange_DataFormat);
@@ -869,14 +869,14 @@ void decouple(chanend c_mix_out,
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
outOverflow = 0;
}
#ifdef NATIVE_DSD
#ifdef NATIVE_DSD
/* TODO only send when there is a change */
if(dataFormat == UAC_FORMAT_TYPEI_RAW_DATA)
{
dsdMode = DSD_MODE_NATIVE;
}
/* Wait for the audio code to request samples and respond with command */
inuint(c_mix_out);
outct(c_mix_out, SET_DSD_MODE);

View File

@@ -240,11 +240,11 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
else
{
unsigned cmd = inuint(c_aud_ctl);
if(cmd == SET_SAMPLE_FREQ)
{
sampleFreq = inuint(c_aud_ctl);
/* Don't update things for DFU command.. */
if(sampleFreq != AUDIO_STOP_FOR_DFU)
{
@@ -262,17 +262,17 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
/* Ideally we want to wait for handshake (and pass back up) here. But we cannot keep this
* core locked, it must stay responsive to packets (MIDI etc) and SOFs. So, set a flag and check for
* handshake elsewhere */
SET_SHARED_GLOBAL(g_freqChange_sampFreq, sampleFreq);
SET_SHARED_GLOBAL(g_freqChange_sampFreq, sampleFreq);
}
else if(cmd == SET_STREAM_FORMAT_IN)
{
unsigned formatChange_SubSlot, formatChange_NumChans, formatChange_DataFormat;
formatChange_DataFormat = inuint(c_aud_ctl);
formatChange_NumChans = inuint(c_aud_ctl);
formatChange_NumChans = inuint(c_aud_ctl);
formatChange_SubSlot = inuint(c_aud_ctl);
SET_SHARED_GLOBAL(g_formatChange_NumChans, formatChange_NumChans);
SET_SHARED_GLOBAL(g_formatChange_NumChans, formatChange_NumChans);
SET_SHARED_GLOBAL(g_formatChange_SubSlot, formatChange_SubSlot);
SET_SHARED_GLOBAL(g_formatChange_DataFormat, formatChange_DataFormat);
}
@@ -281,15 +281,15 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
XUD_BusSpeed_t busSpeed;
unsigned formatChange_SubSlot, formatChange_NumChans, formatChange_DataFormat;
formatChange_DataFormat = inuint(c_aud_ctl);
formatChange_NumChans = inuint(c_aud_ctl);
formatChange_NumChans = inuint(c_aud_ctl);
formatChange_SubSlot = inuint(c_aud_ctl);
SET_SHARED_GLOBAL(g_formatChange_NumChans, formatChange_NumChans);
SET_SHARED_GLOBAL(g_formatChange_NumChans, formatChange_NumChans);
SET_SHARED_GLOBAL(g_formatChange_SubSlot, formatChange_SubSlot);
SET_SHARED_GLOBAL(g_formatChange_DataFormat, formatChange_DataFormat);
/* 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
/* 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 */
GET_SHARED_GLOBAL(busSpeed, g_curUsbSpeed);
@@ -409,7 +409,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
case XUD_SetData_Select(c_aud_fb, ep_aud_fb, result):
{
XUD_BusSpeed_t busSpeed;
GET_SHARED_GLOBAL(busSpeed, g_curUsbSpeed);
if (busSpeed == XUD_SPEED_HS)
@@ -438,7 +438,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
#ifdef MIDI
case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result):
if((result == XUD_RES_OKAY) && (length > 0))
{
/* Get buffer data from host - MIDI OUT from host always into a single buffer */
@@ -483,7 +483,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
#ifdef IAP
/* IAP OUT from host. Datalength writen to tmp */
case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result):
if((result == XUD_RES_OKAY) && (length > 0))
{
iap_data_remaining_to_device = length;
@@ -530,7 +530,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
#ifdef IAP_INT_EP
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result):
/* Do nothing.. */
/* Note, could get a reset notification here, but deal with it in the case above */
break;
@@ -664,7 +664,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
result1 = XUD_SetReady_In(ep_iap_to_host_int, gc_zero_buffer, 0);
#endif
result2 = XUD_SetReady_In(ep_iap_to_host, iap_to_host_buffer, iap_data_collected_from_device);
if((result1 == XUD_RES_RST) || (result2 == XUD_RES_RST))
{
#ifdef IAP_INT_EP
@@ -674,9 +674,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
iap_send_reset(c_iap);
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
iap_data_remaining_to_device = -1;
iap_from_host_rdptr = 0;
iap_from_host_rdptr = 0;
}
iap_data_collected_from_device = 0;
iap_expected_data_length = 0;
}

View File

@@ -20,8 +20,8 @@
</component>
<component description = "MIDI" type = "demoCode" scope = "General Use" path = "module_usb_midi" local = "false" id = "module_usb_midi" name = "MIDI Module for USB Audio Framework">
<board></board>
<componentDependency version = "6.4.0">module_queue</componentDependency>
<componentDependency repo = "git://github.com/xcore/sc_util" version = "1.0.3">module_xassert</componentDependency>
<componentDependency version = "6.4.0">module_queue</componentDependency>
<keyword>MIDI</keyword>
</component>
</components>
@@ -48,6 +48,7 @@
<release parenthash = "fe3b0251da73729f957b1a5a766fe60b494d717a" version = "6.4.0beta2" githash = "432d39434a59418ef3449ae02005bf12e8f6fc61"></release>
<release parenthash = "bbd02f157fba840d918838a4922ca5b1fa4cae21" version = "6.4.0beta3" githash = "c6ed243a82555bd3e2825dad48266e3a307db716"></release>
<release parenthash = "486a19f54934e9eaa6662f316a4913b9af5db43b" version = "6.4.0beta4" githash = "80817b73ccbefa48819c70ec46b997af27de2ff7"></release>
<release parenthash = "bee14703105874475756abeaefe2fbfc42f6b035" version = "6.5.0beta0"></release>
<subpartnumber>XM-004720-SM</subpartnumber>
<vendor>XMOS</vendor>
<version_defines>