Copy across from apps_usb_aud_shared

This commit is contained in:
Russell Gallop
2011-07-08 15:12:28 +01:00
parent 0235ee8dcc
commit 7bc53853c4
14 changed files with 248 additions and 305 deletions

View File

@@ -35,25 +35,27 @@ extern int volsIn[];
extern unsigned int mutesIn[];
/* Mixer settings */
#ifdef MIXER
extern unsigned char mixer1Crossbar[];
extern short mixer1Weights[];
/* Device channel mapping */
#if NUM_USB_CHAN_OUT > 0
extern unsigned char channelMapAud[NUM_USB_CHAN_OUT];
#endif
#if NUM_USB_CHAN_IN > 0
extern unsigned char channelMapUsb[NUM_USB_CHAN_IN];
#endif
/* Mixer input mapping */
extern unsigned char mixSel[MIX_INPUTS];
#endif
/* Global var for current frequency */
extern unsigned int g_curSamFreq;
extern unsigned int g_curSamFreq48000Family;
extern unsigned int g_curSamFreqMultiplier;
/* Global level data */
//unsigned short g_lvlMixOut[MAX_MIX_COUNT];
//unsigned short g_lvlMixIn[NUM_USB_CHAN_IN + NUM_USB_CHAN_OUT];
/* Store an int into a char array: Note this allows non-word aligned access unlike reinerpret cast */
void storeInt(unsigned char buffer[], int index, int val)
{

View File

@@ -170,6 +170,18 @@ unsigned char devQualDesc_Null[] =
#define MIDI_LENGTH (0)
#endif
#ifdef MIXER
#define MIXER_LENGTH (13+1+18)
#else
#define MIXER_LENGTH (0)
#endif
#ifdef IAP
#define IAP_LENGTH (30)
#else
#define IAP_LENGTH (0)
#endif
#ifdef AUDIO_PATH_XUS
#define LEN_XU_OUT (16 * OUTPUT_INTERFACES)
#define LEN_XU_IN (16 * INPUT_INTERFACES)
@@ -179,18 +191,9 @@ unsigned char devQualDesc_Null[] =
#endif
#ifdef MIXER
#define LEN_XU_MIX (17)
#define MIX_BMCONTROLS_LEN_TMP ((MAX_MIX_COUNT * MIX_INPUTS) / 8)
#if ((MAX_MIX_COUNT * MIX_INPUTS)%8)==0
#define MIX_BMCONTROLS_LEN (MIX_BMCONTROLS_LEN_TMP)
#else
#define MIX_BMCONTROLS_LEN (MIX_BMCONTROLS_LEN_TMP+1)
#endif
#define MIXER_LENGTH (13+1+MIX_BMCONTROLS_LEN)
#define LEN_XU_MIX (17)
#else
#define LEN_XU_MIX (0)
#define MIXER_LENGTH (0)
#define LEN_XU_MIX (0)
#endif
#define LEN_CLK (8)
@@ -216,7 +219,7 @@ unsigned char devQualDesc_Null[] =
/* 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) + INPUT_ALT_LENGTH + OUTPUT_ALT_LENGTH)
#define CFG_TOTAL_LENGTH_A2 (7 + 26 + (INPUT_INTERFACES * 55) + (OUTPUT_INTERFACES * 62) + (MIDI_LENGTH) + (DFU_INTERFACES * 16) + TLEN_AC + (MIXER_LENGTH) + IAP_LENGTH + INPUT_ALT_LENGTH + OUTPUT_ALT_LENGTH)
/* Define for number of audio interfaces (+1 for mandatory control interface) */
#define AUDIO_INTERFACES (INPUT_INTERFACES + OUTPUT_INTERFACES + 1)
@@ -233,7 +236,7 @@ unsigned char cfgDesc_Audio2[] =
0x00, /* 6 iConfiguration */
#ifdef SELF_POWERED
192, /* 7 bmAttributes */
5, /* 8 bMaxPower */
1, /* 8 bMaxPower */
#else
128, /* 7 bmAttributes */
250, /* 8 bMaxPower */
@@ -362,7 +365,7 @@ unsigned char cfgDesc_Audio2[] =
ID_CLKSEL, /* 7 bCSourceID: ID of Clock Entity */
NUM_USB_CHAN_OUT, /* 8 bNrChannels */
0,0,0,0, /* 9 bmChannelConfig */
15, /* 13 iChannelNames */
13, /* 13 iChannelNames */
0x00, 0x00, /* 14 bmControls */
6, /* 16 iTerminal */
@@ -481,7 +484,7 @@ unsigned char cfgDesc_Audio2[] =
ID_CLKSEL, /* 7 bCSourceID: ID of Clock Entity */
NUM_USB_CHAN_IN, /* 8 bNrChannels */
0,0,0,0, /* 9 bmChannelConfig */
33, /* 13 iChannelNames */
31, /* 13 iChannelNames */
0x00, 0x00, /* 14 bmControls */
0, /* 16 iTerminal */
@@ -601,7 +604,7 @@ unsigned char cfgDesc_Audio2[] =
2, /* 6 bNrPins */
ID_IT_USB, /* 7 baSourceId(1) */
ID_IT_AUD, /* 7 baSourceId(2) */
MIX_INPUTS, /* 8+p bNrChannels */
MIX_INPUTS, /* 8+p bNrChannels */
0, /* 9+p bmChannelConfig */
0, /* 10+p bmChannelConfig */
0, /* 11+p bmChannelConfig */
@@ -615,76 +618,23 @@ unsigned char cfgDesc_Audio2[] =
/* Mixer Unit Descriptors */
/* N = 144 (18 * 8) */
/* Mixer Unit Bitmap - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff */
MIXER_LENGTH, /* 0 bLength : 13 + num inputs + bit map (inputs * outputs) */
0x0D+0x01+0x12, /* 0 bLength : 13 + num inputs + bit map (inputs * outputs) */
CS_INTERFACE, /* 1 bDescriptorType: 0x24 */
0x04, /* bDescriptorSubtype: MIXER_UNIT */
ID_MIXER_1, /* Mixer unit id */
0x01, /* Number of input pins */
ID_XU_MIXSEL, /* Connected terminal or unit id for input pin */
MAX_MIX_COUNT, /* Number of mixer output channels */
ID_XU_MIXSEL, /* Connected terminal or unit id for input pin*/
0x08, /* Number of mixer output channels */
0x00, 0x00, 0x00, 0x00, /* Spacial location ???? */
49, /* Channel name index */
#if MIX_BMCONTROLS_LEN > 0 /* Mixer programmable control bitmap */
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 1
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 2
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 3
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 4
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 5
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 6
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 7
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 8
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 9
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 10
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 11
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 12
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 13
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 14
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 15
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 16
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 17
0xff,
#endif
#if MIX_BMCONTROLS_LEN > 18
#error unxpected BMCONTROLS_LEN
#endif
49, /* Channel name index */
0xff, 0xff, 0xff, 0xff, /* Mixer programmable control bitmap */
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff,
0x00, /* bmControls */
0, /* Mixer unit string descriptor index */
#endif
@@ -730,9 +680,9 @@ unsigned char cfgDesc_Audio2[] =
0x00, /* 4 bmControls */
0x01, /* 5 bFormatType */
PCM, 0x00, 0x00, 0x00, /* 6:10 bmFormats (note this is a bitmap) */
NUM_USB_CHAN_OUT, /* 11 bNrChannels */
NUM_USB_CHAN_OUT, /* 11 bNrChannels */
0,0,0,0, /* 12:14: bmChannelConfig */
15, /* 15 iChannelNames */
13, /* 15 iChannelNames */
/* Type 1 Format Type Descriptor */
0x06, /* 0 bLength (in bytes): 6 */
@@ -765,7 +715,7 @@ unsigned char cfgDesc_Audio2[] =
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
17, /* 3 bmAttributes (bitmap) */
4,0, /* 4 wMaxPacketSize */
4, /* 6 bInterval. Only values <= 1 frame (8) supported by MS */
8, /* 6 bInterval */
#ifdef ADAT_TX
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
@@ -789,7 +739,7 @@ unsigned char cfgDesc_Audio2[] =
PCM, 0x00, 0x00, 0x00, /* 6:10 bmFormats (note this is a bitmap) */
NUM_USB_CHAN_OUT, /* 11 bNrChannels */
0,0,0,0, /* 12:14: bmChannelConfig */
15, /* 15 iChannelNames */
13, /* 15 iChannelNames */
/* Type 1 Format Type Descriptor */
0x06, /* 0 bLength (in bytes): 6 */
@@ -860,7 +810,7 @@ unsigned char cfgDesc_Audio2[] =
PCM, 0x00, 0x00, 0x00, /* 6:10 bmFormats (note this is a bitmap) */
NUM_USB_CHAN_IN, /* 11 bNrChannels */
0,0,0,0, /* 12:14: bmChannelConfig */
33, /* 15 iChannelNames */
31, /* 15 iChannelNames */
/* Type 1 Format Type Descriptor */
0x06, /* 0 bLength (in bytes): 6 */
@@ -909,7 +859,7 @@ unsigned char cfgDesc_Audio2[] =
PCM, 0x00, 0x00, 0x00, /* 6:10 bmFormats (note this is a bitmap) */
NUM_USB_CHAN_IN - 4, /* 11 bNrChannels */
0,0,0,0, /* 12:14: bmChannelConfig */
33, /* 15 iChannelNames */
31, /* 15 iChannelNames */
/* Type 1 Format Type Descriptor */
0x06, /* 0 bLength (in bytes): 6 */
@@ -1048,7 +998,7 @@ unsigned char cfgDesc_Audio2[] =
0x02, /* 2 bDescriptorSubtype : MIDI_IN_JACK subtype. (field size 1 bytes) */
0x02, /* 3 bJackType : EXTERNAL. (field size 1 bytes) */
0x02, /* 4 bJackID : ID of this Jack. (field size 1 bytes) */
14, /* 5 iJack : Unused. (field size 1 bytes) */
0x00, /* 5 iJack : Unused. (field size 1 bytes) */
/* Table B-9: MIDI Adapter MIDI OUT Jack Descriptor (Embedded) */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
@@ -1070,7 +1020,7 @@ unsigned char cfgDesc_Audio2[] =
0x01, /* 5 bNrInputPins : Number of Input Pins of this Jack. (field size 1 bytes) */
0x01, /* 6 BaSourceID(1) : ID of the Entity to which this Pin is connected. (field size 1 bytes) */
0x01, /* 7 BaSourcePin(1) : Output Pin number of the Entity to which this Input Pin is connected. */
13, /* 8 iJack : Unused. (field size 1 bytes) */
0x00, /* 8 iJack : Unused. (field size 1 bytes) */
/* Table B-11: MIDI Adapter Standard Bulk OUT Endpoint Descriptor */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
@@ -1118,33 +1068,60 @@ unsigned char cfgDesc_Audio2[] =
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFE, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */
0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
12, /* 8 iInterface : Unused. (field size 1 bytes) */
0x00, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
12, /* 8 iInterface : Used. (field size 1 bytes) */
#if 0
/* DFU 1.0 Run-Time DFU Functional Descriptor */
/* Standard DFU class functional descriptor */
0x07,
0x21,
0x07,
0xFA,
0x00,
0x40,
0x00
#else
/* DFU 1.1 Run-Time DFU Functional Descriptor */
0x09, /* 0 Size */
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
0x07, /* 2 bmAttributes */
0xFA, /* 3 wDetachTimeOut */
0x00, /* 4 wDetachTimeOut */
0x40, /* 5 wTransferSize */
0x00, /* 6 wTransferSize */
0x10, /* 7 bcdDFUVersion */
0x01, /* 7 bcdDFUVersion */
#endif
0x00,
#endif
#ifdef IAP
/* Please write an iAP descriptor here */
/* Interface descriptor */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
(INPUT_INTERFACES+OUTPUT_INTERFACES+MIDI_INTERFACES+1+1), /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
0x03, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFF, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */
0xF0, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0x00, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
57, /* 8 iInterface : Used. (field size 1 bytes) */
/* iAP Bulk OUT Endpoint Descriptor */
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
0x03, /* 2 bEndpointAddress : OUT Endpoint 3. High bit isIn (field size 1 bytes) */
0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */
0x00, /* 4 wMaxPacketSize : 64 bytes per packet. (field size 2 bytes) - has to be 0x200 for compliance*/
0x02, /* 5 wMaxPacketSize */
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
/* iAP Bulk IN Endpoint Descriptor */
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
0x85, /* 2 bEndpointAddress : IN Endpoint 5. (field size 1 bytes) */
0x02, /* 3 bmAttributes : Bulk, not shared. (field size 1 bytes) */
0x00, /* 4 wMaxPacketSize : 64 bytes per packet. (field size 2 bytes) - has to be 0x200 for compliance*/
0x02, /* 5 wMaxPacketSize */
0x00, /* 6 bInterval : Ignored for Bulk. Set to zero. (field size 1 bytes) */
/* iAP Interrupt IN Endpoint Descriptor */
0x07, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x05, /* 1 bDescriptorType : ENDPOINT descriptor. (field size 1 bytes) */
0x86, /* 2 bEndpointAddress : IN Endpoint 6. (field size 1 bytes) */
0x03, /* 3 bmAttributes : Interrupt, not shared. (field size 1 bytes) */
0x00, /* 4 wMaxPacketSize : 64 bytes per packet. (field size 2 bytes) - has to be 0x200 for compliance*/
0x02, /* 5 wMaxPacketSize */
0x08, /* 6 bInterval : in ms must be between 4 and 32ms (field size 1 bytes) */
#endif
};
#define APPEND_VENDOR_STR(x) VENDOR_STR#x
@@ -1168,56 +1145,54 @@ static unsigned char strDescs_Audio2[][40] =
APPEND_VENDOR_STR(S/PDIF Clock), // 10 iClockSource
APPEND_VENDOR_STR(ADAT Clock), // 11 iClockSource
APPEND_VENDOR_STR(DFU), // 12 iInterface for DFU interface
APPEND_VENDOR_STR(MIDI Out), // 13
APPEND_VENDOR_STR(MIDI In ), // 14
"Analogue 1", // 15 Output channel name place holders - Get customised at runtime based on device config
"Analogue 2", // 16
"Analogue 3", // 17
"Analogue 4", // 18
"Analogue 5", // 19
"Analogue 6", // 20
"Analogue 7", // 21
"Analogue 8", // 22
"Analogue 9", // 23
"Analogue 10", // 24
"Analogue 11", // 25
"Analogue 12", // 26
"Analogue 13", // 27
"Analogue 14", // 28
"Analogue 15", // 29
"Analogue 16", // 30
"Analogue 17", // 31
"Analogue 18", // 32
"Analogue 1", // 13 Output channel name place holders - Get customised at runtime based on device config
"Analogue 2", // 14
"Analogue 3", // 15
"Analogue 4", // 16
"Analogue 5", // 17
"Analogue 6", // 18
"Analogue 7", // 19
"Analogue 8", // 20
"Analogue 9", // 21
"Analogue 10", // 22
"Analogue 11", // 23
"Analogue 12", // 24
"Analogue 13", // 25
"Analogue 14", // 26
"Analogue 15", // 27
"Analogue 16", // 28
"Analogue 17", // 29
"Analogue 18", // 30
"Analogue 1", // 33 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 2", // 34 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 3", // 35 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 4", // 36 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 5", // 37 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 6", // 38 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 7", // 39 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 8", // 40 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 9", // 41 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 10", // 42 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 11", // 43 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 12", // 44 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 13", // 45 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 14", // 46 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 15", // 47 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 16", // 48 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 17", // 49 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 18", // 50 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 1", // 31 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 2", // 32 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 3", // 33 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 4", // 34 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 5", // 35 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 6", // 36 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 7", // 37 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 8", // 38 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 9", // 39 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 10", // 40 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 11", // 41 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 12", // 42 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 13", // 43 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 14", // 44 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 15", // 45 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 16", // 46 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 17", // 47 Input channel name place holders - Get customised at runtime based on device config */
"Analogue 18", // 48 Input channel name place holders - Get customised at runtime based on device config */
"Mixer Out 1", // 51/* Mixer output names */
"Mixer Out 2", // 52 /* Mixer output names */
"Mixer Out 3", // 53 /* Mixer output names */
"Mixer Out 4", // 54 /* Mixer output names */
"Mixer Out 5", // 55 /* Mixer output names */
"Mixer Out 6", // 56 /* Mixer output names */
"Mixer Out 7", // 57 /* Mixer output names */
"Mixer Out 8", // 58 /* Mixer output names */
"Mixer Out 1", // 49/* Mixer output names */
"Mixer Out 2", // 50 /* Mixer output names */
"Mixer Out 3", // 51 /* Mixer output names */
"Mixer Out 4", // 52 /* Mixer output names */
"Mixer Out 5", // 53 /* Mixer output names */
"Mixer Out 6", // 54 /* Mixer output names */
"Mixer Out 7", // 55 /* Mixer output names */
"Mixer Out 8", // 56 /* Mixer output names */
"iAP Interface", // 57 /* Required name for iAP interface */
};
/* Configuration Descriptor for Null device */
@@ -1235,7 +1210,7 @@ unsigned char cfgDesc_Null[] =
#else
128,
#endif
250, /* 8 bMaxPower */
1, /* 8 bMaxPower */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
@@ -1282,7 +1257,7 @@ unsigned char oSpeedCfgDesc[] =
#define STREAMING_INTERFACES (INPUT_INTERFACES + OUTPUT_INTERFACES)
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES * 61) + (OUTPUT_INTERFACES * 70) + (DFU_INTERFACES * 18))
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES * 61) + (OUTPUT_INTERFACES * 70) + (DFU_INTERFACES * 16))
#ifdef AUDIO_CLASS_FALLBACK
unsigned char cfgDesc_Audio1[] =
{
@@ -1299,7 +1274,7 @@ unsigned char cfgDesc_Audio1[] =
0x00, /* Unused */
#ifdef SELF_POWERED
192, /* 7 bmAttributes */
5, /* 8 bMaxPower */
1, /* 8 bMaxPower */
#else
128, /* 7 bmAttributes */
250, /* 8 bMaxPower */
@@ -1561,19 +1536,19 @@ unsigned char cfgDesc_Audio1[] =
0x00, 0x00, /* Unused */
#endif
#ifdef DFU
/* Standard DFU class Interface descriptor */
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
(INPUT_INTERFACES+OUTPUT_INTERFACES+1), /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
(INPUT_INTERFACES+OUTPUT_INTERFACES+1), /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFE, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */
0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
8, /* 8 iInterface : Unused. (field size 1 bytes) */
0x00, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
0x08, /* 8 iInterface : Unused. (field size 1 bytes) */
#if 0
/* DFU 1.0 Run-Time DFU Functional Descriptor */
/* Standard DFU class functional descriptor */
0x07,
0x21,
0x07,
@@ -1581,18 +1556,6 @@ unsigned char cfgDesc_Audio1[] =
0x00,
0x40,
0x00
#else
/* DFU 1.1 Run-Time DFU Functional Descriptor */
0x09, /* 0 Size */
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
0x07, /* 2 bmAttributes */
0xFA, /* 3 wDetachTimeOut */
0x00, /* 4 wDetachTimeOut */
0x40, /* 5 wTransferSize */
0x00, /* 6 wTransferSize */
0x10, /* 7 bcdDFUVersion */
0x01, /* 7 bcdDFUVersion */
#endif
};

View File

@@ -20,7 +20,7 @@
#include "vendorrequests.h"
#include "dfu_types.h"
/* Windows does not have a built in DFU driver (windows will prompt), so warn that DFU will not be functional in Audio 1.0 mode.Udi
/* Windows does not have a built in DFU driver (windows will prompt), so warn that DFU will not be functional in Audio 1.0 mode.
* Of course, OSX is unaffected.
*/
#if ((AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK)) && defined(DFU)
@@ -63,18 +63,17 @@ int volsIn[NUM_USB_CHAN_IN + 1];
unsigned int mutesIn[NUM_USB_CHAN_IN + 1];
//unsigned int multIn[NUM_USB_CHAN_IN + 1];
#ifdef MIXER
unsigned char mixer1Crossbar[18];
short mixer1Weights[18*8];
//#define MAX_MIX_COUNT 8
unsigned char channelMap[NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT];
#if NUM_USB_CHAN_OUT > 0
unsigned char channelMapAud[NUM_USB_CHAN_OUT];
#endif
#if NUM_USB_CHAN_IN > 0
unsigned char channelMapUsb[NUM_USB_CHAN_IN];
#endif
unsigned char mixSel[MIX_INPUTS];
#endif
int min(int x, int y);
@@ -161,6 +160,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
mutesIn[i] = 0;
}
#ifdef MIXER
/* Set up mixer default state */
for (int i = 0; i < 18*8; i++) {
mixer1Weights[i] = 0x8001; //-inf
@@ -176,20 +176,17 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
mixer1Weights[54] = 0;
mixer1Weights[63] = 0;
#if NUM_USB_CHAN_OUT > 0
/* Setup up audio output channel mapping */
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
{
channelMapAud[i] = i;
}
#endif
#if NUM_USB_CHAN_IN > 0
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
{
channelMapUsb[i] = i + NUM_USB_CHAN_OUT;
}
#endif
/* Set up channel mapping default */
for (int i = 0; i < NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN; i++)
@@ -210,6 +207,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
{
mixSel[i] = i;
}
#endif
/* Copy langIDs string desc into string[0] */
/* TODO: Macro? */
@@ -221,33 +219,33 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
/* Build up channel string table - By default all channels are marked as analogue
* TODO We really want to do this an build time... */
#if defined(SPDIF_RX) && (SPDIF_RX_INDEX != 0)
safestrcpy(strDescs_Audio2[SPDIF_RX_INDEX + 33], "S/PDIF 1");
safestrcpy(strDescs_Audio2[SPDIF_RX_INDEX + 34], "S/PDIF 2");
safestrcpy(strDescs_Audio2[SPDIF_RX_INDEX + 31], "S/PDIF 1");
safestrcpy(strDescs_Audio2[SPDIF_RX_INDEX + 32], "S/PDIF 2");
#endif
#if defined(ADAT_RX) && (ADAT_RX_INDEX != 0)
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 33], "ADAT 1");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 34], "ADAT 2");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 35], "ADAT 3");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 36], "ADAT 4");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 37], "ADAT 5");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 38], "ADAT 6");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 39], "ADAT 7");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 40], "ADAT 8");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 31], "ADAT 1");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 32], "ADAT 2");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 33], "ADAT 3");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 34], "ADAT 4");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 35], "ADAT 5");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 36], "ADAT 6");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 37], "ADAT 7");
safestrcpy(strDescs_Audio2[ADAT_RX_INDEX + 38], "ADAT 8");
#endif
#if defined(SPDIF) && (SPDIF_TX_INDEX != 0) /* "Analogue naming gets priority */
safestrcpy(strDescs_Audio2[SPDIF_TX_INDEX + 15], "S/PDIF 1");
safestrcpy(strDescs_Audio2[SPDIF_TX_INDEX + 16], "S/PDIF 2");
safestrcpy(strDescs_Audio2[SPDIF_TX_INDEX + 13], "S/PDIF 1");
safestrcpy(strDescs_Audio2[SPDIF_TX_INDEX + 14], "S/PDIF 2");
#endif
#if defined(ADAT_TX) && (ADAT_TX_INDEX != 0)
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 15], "ADAT 1");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 16], "ADAT 2");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 17], "ADAT 3");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 18], "ADAT 4");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 19], "ADAT 5");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 20], "ADAT 6");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 21], "ADAT 7");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 22], "ADAT 8");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 13], "ADAT 1");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 14], "ADAT 2");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 15], "ADAT 3");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 16], "ADAT 4");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 17], "ADAT 5");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 18], "ADAT 6");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 19], "ADAT 7");
safestrcpy(strDescs_Audio2[ADAT_TX_INDEX + 20], "ADAT 8");
#endif
#ifdef VENDOR_AUDIO_REQS
@@ -492,6 +490,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
// Handshake
//chkct(c_audioControl, XS1_CT_END);
//printint(8);
break;
#endif
@@ -730,7 +729,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
device_reboot();
}
/* TODO we should not make the assumption that all DFU requests are handled */
/* TODO we should not make the assumtion that all DFU requests are handled */
retVal = 0;
}
/* Check for: Audio interface request - always 0, note we check for DFU first
@@ -739,7 +738,6 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
|| (request == CLASS_ENDPOINT_REQUEST && ((interfaceNum == 0x82) || (interfaceNum == 0x01))))
{
#endif
#if (AUDIO_CLASS == 2) && defined(AUDIO_CLASS_FALLBACK)
if(g_curUsbSpeed == XUD_SPEED_HS)
{
@@ -772,6 +770,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
break;
default:
// TODO: STALL
//printstr("unrecognised request\n");
//printhexln(sp.bRequest);
//printhexln(sp.bmRequestType.Type);
@@ -793,8 +792,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, cha
transfer, and the STALL condition terminates at the beginning of the
next control transfer (Setup). The remainder of this section refers to
the general case of a functional stall */
XUD_SetStall_Out(0);
XUD_SetStall_In(0);
//XUD_ProtocolStall(ep0_out, ep0_in):
}
if (retVal < 0)