forked from PAWPAW-Mirror/lib_xua
Added define OUTPUT_VOLUME_CONTROL which disables output volume control - both in the descriptors and processing. NOTE: Still could be extended to disable volume in MIXER
This commit is contained in:
@@ -617,6 +617,17 @@ enum USBEndpointNumber_Out
|
|||||||
ENDPOINT_COUNT_OUT /* End marker */
|
ENDPOINT_COUNT_OUT /* End marker */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Enable output volume control by default */
|
||||||
|
#ifndef OUTPUT_VOLUME_CONTROL
|
||||||
|
#define OUTPUT_VOLUME_CONTROL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable input volume control by default */
|
||||||
|
#ifndef INPUT_VOLUME_CONTROL
|
||||||
|
#define INPUT_VOLUME_CONTROL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
||||||
#define AUDIO_START_FROM_DFU (0x87654321)
|
#define AUDIO_START_FROM_DFU (0x87654321)
|
||||||
#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5)
|
#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5)
|
||||||
|
|||||||
@@ -840,7 +840,9 @@ typedef struct
|
|||||||
#ifdef OUTPUT
|
#ifdef OUTPUT
|
||||||
/* Output path */
|
/* Output path */
|
||||||
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
|
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
|
||||||
|
#if(OUTPUT_VOLUME_CONTROL==1)
|
||||||
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
|
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
|
||||||
|
#endif
|
||||||
USB_Descriptor_Audio_OutputTerminal_t Audio_Out_OutputTerminal;
|
USB_Descriptor_Audio_OutputTerminal_t Audio_Out_OutputTerminal;
|
||||||
#endif
|
#endif
|
||||||
#ifdef INPUT
|
#ifdef INPUT
|
||||||
@@ -1066,7 +1068,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SELECTOR,
|
.bDescriptorSubType = UAC_CS_AC_INTERFACE_SUBTYPE_CLOCK_SELECTOR,
|
||||||
.bClockID = ID_CLKSEL,
|
.bClockID = ID_CLKSEL,
|
||||||
.bNrPins = NUM_CLOCKS,
|
.bNrPins = NUM_CLOCKS,
|
||||||
ID_CLKSRC_INT, /* baCSourceID */
|
.baCSourceId[0] = ID_CLKSRC_INT, /* baCSourceID */
|
||||||
#ifdef SPDIF_RX
|
#ifdef SPDIF_RX
|
||||||
ID_CLKSRC_SPDIF, /* baCSourceID */
|
ID_CLKSRC_SPDIF, /* baCSourceID */
|
||||||
|
|
||||||
@@ -1083,19 +1085,20 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
.Audio_Out_InputTerminal =
|
.Audio_Out_InputTerminal =
|
||||||
{
|
{
|
||||||
.bLength = sizeof(USB_Descriptor_Audio_InputTerminal_t),
|
.bLength = sizeof(USB_Descriptor_Audio_InputTerminal_t),
|
||||||
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType */
|
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
|
||||||
UAC_CS_AC_INTERFACE_SUBTYPE_INPUT_TERMINAL, /* 2 bDescriptorSubType: INPUT_TERMINAL */
|
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_INPUT_TERMINAL,
|
||||||
ID_IT_USB, /* 3 bTerminalID */
|
.bTerminalID = ID_IT_USB,
|
||||||
USB_TERMTYPE_USB_STREAMING, /* 5 wTerminalType: USB Streaming */
|
.wTerminalType = USB_TERMTYPE_USB_STREAMING,
|
||||||
0x00, /* 6 bAssocTerminal */
|
.bAssocTerminal = 0x00,
|
||||||
ID_CLKSEL, /* 7 bCSourceID: ID of Clock Entity */
|
.bCSourceID = ID_CLKSEL,
|
||||||
NUM_USB_CHAN_OUT, /* 8 bNrChannels */
|
.bNrChannels = NUM_USB_CHAN_OUT,
|
||||||
0x00000000, /* 9 bmChannelConfig TODO. Set me! */
|
.bmChannelConfig = 0x00000000, /* TODO. Set me! */
|
||||||
.iChannelNames = offsetof(StringDescTable_t, outputChanStr_1)/sizeof(char *),
|
.iChannelNames = offsetof(StringDescTable_t, outputChanStr_1)/sizeof(char *),
|
||||||
0x0000, /* 14 bmControls */
|
.bmControls = 0x0000,
|
||||||
6, /* 16 iTerminal */
|
.iTerminal = offsetof(StringDescTable_t, usbInputTermStr_Audio2)/sizeof(char *)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#if(OUTPUT_VOLUME_CONTROL == 1)
|
||||||
/* Feature Unit Descriptor */
|
/* Feature Unit Descriptor */
|
||||||
.Audio_Out_FeatureUnit =
|
.Audio_Out_FeatureUnit =
|
||||||
{
|
{
|
||||||
@@ -1170,6 +1173,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
},
|
},
|
||||||
0, /* 60 iFeature */
|
0, /* 60 iFeature */
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Output Terminal Descriptor (Audio) */
|
/* Output Terminal Descriptor (Audio) */
|
||||||
.Audio_Out_OutputTerminal =
|
.Audio_Out_OutputTerminal =
|
||||||
@@ -1180,7 +1184,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
ID_OT_AUD, /* 3 bTerminalID */
|
ID_OT_AUD, /* 3 bTerminalID */
|
||||||
.wTerminalType = UAC_TT_OUTPUT_TERMTYPE_SPEAKER,
|
.wTerminalType = UAC_TT_OUTPUT_TERMTYPE_SPEAKER,
|
||||||
0x00, /* 6 bAssocTerminal */
|
0x00, /* 6 bAssocTerminal */
|
||||||
|
#if (OUTPUT_VOLUME_CONTROL == 1)
|
||||||
FU_USBOUT, /* 7 bSourceID Connect to analog input feature unit*/
|
FU_USBOUT, /* 7 bSourceID Connect to analog input feature unit*/
|
||||||
|
#else
|
||||||
|
ID_IT_USB, /* 7 bSourceID Connect to analog input feature unit*/
|
||||||
|
#endif
|
||||||
ID_CLKSEL, /* 8 bCSourceUD */
|
ID_CLKSEL, /* 8 bCSourceUD */
|
||||||
0x0000, /* 9 bmControls */
|
0x0000, /* 9 bmControls */
|
||||||
0, /* 11 iTerminal */
|
0, /* 11 iTerminal */
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ __builtin_unreachable();
|
|||||||
g_aud_from_host_rdptr+=2;
|
g_aud_from_host_rdptr+=2;
|
||||||
sample <<= 16;
|
sample <<= 16;
|
||||||
|
|
||||||
#ifndef OUT_VOLUME_IN_MIXER
|
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||||
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||||
{h, l} = macs(mult, sample, 0, 0);
|
{h, l} = macs(mult, sample, 0, 0);
|
||||||
/* Note, in 2 byte subslot mode - ignore lower result of macs */
|
/* Note, in 2 byte subslot mode - ignore lower result of macs */
|
||||||
@@ -367,7 +367,7 @@ __builtin_unreachable();
|
|||||||
read_via_xc_ptr(sample, g_aud_from_host_rdptr);
|
read_via_xc_ptr(sample, g_aud_from_host_rdptr);
|
||||||
g_aud_from_host_rdptr+=4;
|
g_aud_from_host_rdptr+=4;
|
||||||
|
|
||||||
#ifndef OUT_VOLUME_IN_MIXER
|
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||||
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||||
{h, l} = macs(mult, sample, 0, 0);
|
{h, l} = macs(mult, sample, 0, 0);
|
||||||
h <<= 3;
|
h <<= 3;
|
||||||
@@ -422,7 +422,7 @@ __builtin_unreachable();
|
|||||||
}
|
}
|
||||||
unpackState++;
|
unpackState++;
|
||||||
|
|
||||||
#ifndef OUT_VOLUME_IN_MIXER
|
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||||
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||||
{h, l} = macs(mult, sample, 0, 0);
|
{h, l} = macs(mult, sample, 0, 0);
|
||||||
h <<= 3;
|
h <<= 3;
|
||||||
|
|||||||
Reference in New Issue
Block a user