Implement better scaling version of string descriptor memory optimisation
This commit is contained in:
@@ -220,6 +220,17 @@ unsigned char devQualDesc_Null[] =
|
||||
#define OUTPUT_ALT_LENGTH 0
|
||||
#endif
|
||||
|
||||
#define OUTPUT_INTERFACE_STRING_INDEX 15
|
||||
#define INPUT_INTERFACE_STRING_INDEX 15 + NUM_USB_CHAN_OUT
|
||||
#define MIXER_STRING_INDEX 15 + NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN
|
||||
|
||||
#ifdef IAP
|
||||
#ifdef MIXER
|
||||
#define IAP_INTERFACE_STRING_INDEX 15 + NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT
|
||||
#else
|
||||
#define IAP_INTERFACE_STRING_INDEX 15 + NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Total length of config descriptor */
|
||||
#define CFG_TOTAL_LENGTH_A2 (7 + 26 + (INPUT_INTERFACES * 55) + (OUTPUT_INTERFACES * 62) + (MIDI_LENGTH) + (DFU_INTERFACES * 18) + TLEN_AC + (MIXER_LENGTH) + IAP_LENGTH + INPUT_ALT_LENGTH + OUTPUT_ALT_LENGTH)
|
||||
@@ -368,7 +379,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 */
|
||||
INPUT_INTERFACE_STRING_INDEX, /* 13 iChannelNames */
|
||||
0x00, 0x00, /* 14 bmControls */
|
||||
6, /* 16 iTerminal */
|
||||
|
||||
@@ -633,7 +644,7 @@ unsigned char cfgDesc_Audio2[] =
|
||||
ID_XU_MIXSEL, /* Connected terminal or unit id for input pin */
|
||||
MAX_MIX_COUNT, /* Number of mixer output channels */
|
||||
0x00, 0x00, 0x00, 0x00, /* Spacial location ???? */
|
||||
49, /* Channel name index */
|
||||
MIXER_STRING_INDEX, /* Channel name index */
|
||||
#if MIX_BMCONTROLS_LEN > 0 /* Mixer programmable control bitmap */
|
||||
0xff,
|
||||
#endif
|
||||
@@ -738,7 +749,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 */
|
||||
INPUT_INTERFACE_STRING_INDEX, /* 15 iChannelNames */
|
||||
|
||||
/* Type 1 Format Type Descriptor */
|
||||
0x06, /* 0 bLength (in bytes): 6 */
|
||||
@@ -795,7 +806,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 */
|
||||
INPUT_INTERFACE_STRING_INDEX, /* 15 iChannelNames */
|
||||
|
||||
/* Type 1 Format Type Descriptor */
|
||||
0x06, /* 0 bLength (in bytes): 6 */
|
||||
@@ -866,7 +877,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 */
|
||||
OUTPUT_INTERFACE_STRING_INDEX, /* 15 iChannelNames */
|
||||
|
||||
/* Type 1 Format Type Descriptor */
|
||||
0x06, /* 0 bLength (in bytes): 6 */
|
||||
@@ -915,7 +926,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 */
|
||||
OUTPUT_INTERFACE_STRING_INDEX, /* 15 iChannelNames */
|
||||
|
||||
/* Type 1 Format Type Descriptor */
|
||||
0x06, /* 0 bLength (in bytes): 6 */
|
||||
@@ -1162,7 +1173,7 @@ unsigned char cfgDesc_Audio2[] =
|
||||
0xFF, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */
|
||||
0xF0, /* 6 bInterfaceSubclass : (field size 1 bytes) */
|
||||
0x00, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
||||
59, /* 8 iInterface : Used. (field size 1 bytes) */
|
||||
IAP_INTERFACE_STRING_INDEX, /* 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) */
|
||||
@@ -1211,7 +1222,7 @@ static unsigned char strDescs_Audio2[][40] =
|
||||
APPEND_VENDOR_STR(Audio 2.0 Input), // 7 "USB Output Terminal" (User sees as input to host)
|
||||
|
||||
APPEND_VENDOR_STR(Clock Selector), // 8 iClockSel
|
||||
APPEND_VENDOR_STR(Internal Clock), // 9 iClockSource
|
||||
APPEND_VENDOR_STR(Internal Clock), // 9 iClockSource
|
||||
APPEND_VENDOR_STR(S/PDIF Clock), // 10 iClockSource
|
||||
APPEND_VENDOR_STR(ADAT Clock), // 11 iClockSource
|
||||
APPEND_VENDOR_STR(DFU), // 12 iInterface for DFU interface
|
||||
@@ -1219,53 +1230,155 @@ static unsigned char strDescs_Audio2[][40] =
|
||||
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
|
||||
#if (NUM_USB_CHAN_OUT > 0)
|
||||
"Analogue 1", // Output channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 1)
|
||||
"Analogue 2",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 2)
|
||||
"Analogue 3",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 3)
|
||||
"Analogue 4",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 4)
|
||||
"Analogue 5",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 5)
|
||||
"Analogue 6",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 6)
|
||||
"Analogue 7",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 7)
|
||||
"Analogue 8",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 8)
|
||||
"Analogue 9",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 9)
|
||||
"Analogue 10",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 10)
|
||||
"Analogue 11",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 11)
|
||||
"Analogue 12",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 12)
|
||||
"Analogue 13",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 13)
|
||||
"Analogue 14",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 14)
|
||||
"Analogue 15",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 15)
|
||||
"Analogue 16",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 16)
|
||||
"Analogue 17",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 17)
|
||||
"Analogue 18",
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_OUT > 18)
|
||||
#error NUM_USB_CHAN > 18
|
||||
#endif
|
||||
|
||||
"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 */
|
||||
|
||||
"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 */
|
||||
"iAP Interface", // 59 /* Required name for iAP interface */
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
"Analogue 1", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 1)
|
||||
"Analogue 2", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 2)
|
||||
"Analogue 3", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 3)
|
||||
"Analogue 4", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 4)
|
||||
"Analogue 5", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 5)
|
||||
"Analogue 6", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 6)
|
||||
"Analogue 7", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 7)
|
||||
"Analogue 8", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 8)
|
||||
"Analogue 9", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 9)
|
||||
"Analogue 10", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 10)
|
||||
"Analogue 11", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 11)
|
||||
"Analogue 12", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 12)
|
||||
"Analogue 13", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 13)
|
||||
"Analogue 14", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 14)
|
||||
"Analogue 15", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 15)
|
||||
"Analogue 16", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 16)
|
||||
"Analogue 17", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 17)
|
||||
"Analogue 18", // Input channel name place holders - Get customised at runtime based on device config
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN > 18)
|
||||
#error NUM_USB_CHAN > 18
|
||||
#endif
|
||||
|
||||
#ifdef MIXER
|
||||
#if (MAX_MIX_COUNT > 0)
|
||||
"Mixer Out 1", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 1)
|
||||
"Mixer Out 2", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 2)
|
||||
"Mixer Out 3", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 3)
|
||||
"Mixer Out 4", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 4)
|
||||
"Mixer Out 5", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 5)
|
||||
"Mixer Out 6", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 6)
|
||||
"Mixer Out 7", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 7)
|
||||
"Mixer Out 8", // /* Mixer output names */
|
||||
#endif
|
||||
#if (MAX_MIX_COUNT > 8)
|
||||
#error MAX_MIX_COUNT > 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IAP
|
||||
"iAP Interface", // /* Required name for iAP interface */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Configuration Descriptor for Null device */
|
||||
|
||||
Reference in New Issue
Block a user