Save resources if SPDIF or MIXER not enabled
This commit is contained in:
@@ -60,7 +60,7 @@ extern void device_reboot(void);
|
||||
|
||||
/* I2S delivery thread */
|
||||
#pragma unsafe arrays
|
||||
unsigned deliver(chanend c_out, chanend c_spd_out, unsigned divide, chanend ?c_dig_rx)
|
||||
unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_dig_rx)
|
||||
{
|
||||
unsigned sample;
|
||||
#if NUM_USB_CHAN_OUT > 0
|
||||
@@ -515,7 +515,9 @@ static unsigned dummy_deliver(chanend c_out) {
|
||||
|
||||
void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config)
|
||||
{
|
||||
#ifdef SPDIF
|
||||
chan c_spdif_out;
|
||||
#endif
|
||||
unsigned curSamFreq = DEFAULT_FREQ;
|
||||
unsigned mClk;
|
||||
unsigned divide;
|
||||
@@ -589,7 +591,13 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config)
|
||||
outuint(c_spdif_out, mClk);
|
||||
#endif
|
||||
|
||||
curSamFreq = deliver(c_mix_out, c_spdif_out, divide, c_dig_rx);
|
||||
curSamFreq = deliver(c_mix_out,
|
||||
#ifdef SPDIF
|
||||
c_spdif_out,
|
||||
#else
|
||||
null,
|
||||
#endif
|
||||
divide, c_dig_rx);
|
||||
|
||||
// Currently no more audio will happen after this point
|
||||
if (curSamFreq == AUDIO_STOP_FOR_DFU)
|
||||
|
||||
@@ -35,6 +35,7 @@ extern int volsIn[];
|
||||
extern unsigned int mutesIn[];
|
||||
|
||||
/* Mixer settings */
|
||||
#ifdef MIXER
|
||||
extern unsigned char mixer1Crossbar[];
|
||||
extern short mixer1Weights[];
|
||||
|
||||
@@ -48,6 +49,7 @@ extern unsigned char channelMapUsb[NUM_USB_CHAN_IN];
|
||||
|
||||
/* Mixer input mapping */
|
||||
extern unsigned char mixSel[MIX_INPUTS];
|
||||
#endif
|
||||
|
||||
/* Global var for current frequency */
|
||||
extern unsigned int g_curSamFreq;
|
||||
|
||||
@@ -63,6 +63,7 @@ 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
|
||||
@@ -75,6 +76,7 @@ unsigned char channelMapAud[NUM_USB_CHAN_OUT];
|
||||
unsigned char channelMapUsb[NUM_USB_CHAN_IN];
|
||||
#endif
|
||||
unsigned char mixSel[MIX_INPUTS];
|
||||
#endif
|
||||
|
||||
int min(int x, int y);
|
||||
|
||||
@@ -161,6 +163,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
mutesIn[i] = 0;
|
||||
}
|
||||
|
||||
#ifdef MIXER
|
||||
/* Set up mixer default state */
|
||||
for (int i = 0; i < 18*8; i++) {
|
||||
mixer1Weights[i] = 0x8001; //-inf
|
||||
@@ -210,6 +213,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
{
|
||||
mixSel[i] = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy langIDs string desc into string[0] */
|
||||
/* TODO: Macro? */
|
||||
|
||||
@@ -165,17 +165,21 @@ static inline void swap(xc_ptr &a, xc_ptr &b)
|
||||
}
|
||||
|
||||
// shared global midi buffering variables
|
||||
#ifdef MIDI
|
||||
unsigned g_midi_from_host_flag = 0;
|
||||
unsigned g_midi_to_host_flag = 0;
|
||||
int midi_to_host_usb_ep = 0;
|
||||
int midi_from_host_usb_ep = 0;
|
||||
#endif
|
||||
int aud_from_host_usb_ep = 0;
|
||||
int aud_to_host_usb_ep = 0;
|
||||
int int_usb_ep = 0;
|
||||
|
||||
#ifdef MIDI
|
||||
unsigned int g_midi_to_host_buffer_A[MAX_USB_MIDI_PACKET_SIZE/4+4];
|
||||
unsigned int g_midi_to_host_buffer_B[MAX_USB_MIDI_PACKET_SIZE/4+4];
|
||||
int g_midi_from_host_buffer[MAX_USB_MIDI_PACKET_SIZE+4];
|
||||
#endif
|
||||
|
||||
// shared global aud buffering variables
|
||||
|
||||
|
||||
@@ -85,7 +85,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
XUD_ep ep_midi_from_host = XUD_Init_Ep(c_midi_from_host);
|
||||
XUD_ep ep_midi_to_host = XUD_Init_Ep(c_midi_to_host);
|
||||
#endif
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
XUD_ep ep_int = XUD_Init_Ep(c_int);
|
||||
#endif
|
||||
|
||||
unsigned datalength;
|
||||
unsigned tmp;
|
||||
@@ -116,7 +118,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
set_thread_fast_mode_on();
|
||||
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
asm("stw %0, dp[int_usb_ep]"::"r"(ep_int));
|
||||
#endif
|
||||
asm("stw %0, dp[aud_from_host_usb_ep]"::"r"(ep_aud_out));
|
||||
asm("stw %0, dp[aud_to_host_usb_ep]"::"r"(ep_aud_in));
|
||||
asm("stw %0, dp[buffer_aud_ctl_chan]"::"r"(c_aud_ctl));
|
||||
@@ -195,6 +199,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
/* Wait for response from XUD and service relevant EP */
|
||||
select
|
||||
{
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
/* Interrupt EP, send back interrupt data. Note, request made from decouple */
|
||||
case inuint_byref(c_int, tmp):
|
||||
{
|
||||
@@ -221,6 +226,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
XUD_SetNotReady(ep_int);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Sample Freq our chan count update from ep 0 */
|
||||
case inuint_byref(c_aud_ctl, tmp):
|
||||
|
||||
Reference in New Issue
Block a user