diff --git a/module_usb_audio/audio.xc b/module_usb_audio/audio.xc index 22ede8f6..9b5830e2 100755 --- a/module_usb_audio/audio.xc +++ b/module_usb_audio/audio.xc @@ -317,7 +317,7 @@ static inline void InitPorts(unsigned divide) #endif /* Pre-fill the LR clock output port */ p_lrclk <: 0x0; - + doI2SClocks(divide); } @@ -407,7 +407,7 @@ chanend ?c_adc) #endif #if 1 - unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord); + unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord); if(command) { @@ -554,7 +554,7 @@ chanend ?c_adc) p_i2s_dac[index++] <: bitrev(samplesOut[(frameCount)+i]); } #endif - + /* Clock out the LR Clock, the DAC data and Clock in the next sample into ADC */ doI2SClocks(divide); @@ -564,7 +564,7 @@ chanend ?c_adc) /* First input (i.e. frameCoint == 0) we read last ADC channel of previous frame.. */ unsigned buffIndex = frameCount ? !readBuffNo : readBuffNo; -#pragma loop unroll +#pragma loop unroll /* First time around we get channel 7 of TDM8 */ for(int i = 0; i < I2S_CHANS_ADC; i+=I2S_CHANS_PER_FRAME) { @@ -582,7 +582,7 @@ chanend ?c_adc) if(frameCount == 0) { - + #if defined(SPDIF_RX) || defined(ADAT_RX) /* Sync with clockgen */ inuint(c_dig_rx); @@ -649,9 +649,9 @@ chanend ?c_adc) /* Manual IN instruction since compiler generates an extra setc per IN (bug #15256) */ asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++])); if(readBuffNo) - samplesIn_0[frameCount+i] = bitrev(sample); + samplesIn_0[frameCount+i] = bitrev(sample); else - samplesIn_1[frameCount+i] = bitrev(sample); + samplesIn_1[frameCount+i] = bitrev(sample); } #ifdef SU1_ADC_ENABLE @@ -710,7 +710,7 @@ chanend ?c_adc) } } #endif - + #ifdef I2S_MODE_TDM /* Increase frameCount by 2 since we have output two channels (per data line) */ frameCount+=2; @@ -721,16 +721,16 @@ chanend ?c_adc) /* The below looks a bit odd but forces the compiler to inline twice */ unsigned command; if(readBuffNo) - command = DoSampleTransfer(c_out, 1, underflowWord); + command = DoSampleTransfer(c_out, 1, underflowWord); else - command = DoSampleTransfer(c_out, 0, underflowWord); + command = DoSampleTransfer(c_out, 0, underflowWord); if(command) { return command; } - + /* Reset frame counter and flip the ADC buffer */ frameCount = 0; readBuffNo = !readBuffNo; diff --git a/module_usb_audio/mixer/mixer.xc b/module_usb_audio/mixer/mixer.xc index 01147865..94faef36 100644 --- a/module_usb_audio/mixer/mixer.xc +++ b/module_usb_audio/mixer/mixer.xc @@ -172,7 +172,7 @@ static inline void GiveSamplesToHost(chanend c, xc_ptr ptr, xc_ptr multIn) { int sample; int index; - + #if MAX_MIX_COUNT > 0 read_via_xc_ptr_indexed(index,ptr,i); #else @@ -239,7 +239,7 @@ static inline void GetSamplesFromHost(chanend c, unsigned underflow) #else ptr_samples[i] = sample; #endif - } + } } } @@ -263,10 +263,10 @@ static inline void GiveSamplesToDevice(chanend c, xc_ptr ptr, xc_ptr multOut, un #if MAX_MIX_COUNT > 0 /* If mixer turned on sort out the channel mapping */ - + /* Read pointer to sample from the map */ read_via_xc_ptr_indexed(index, ptr, i); - + /* Read the actual sample value */ read_via_xc_ptr_indexed(sample, samples, index); #else @@ -340,7 +340,7 @@ static inline void GetSamplesFromDevice(chanend c) { ptr_samples[NUM_USB_CHAN_OUT + i] = sample; } -#endif +#endif } } @@ -361,13 +361,13 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2) #pragma xta endpoint "mixer1_req" /* Request from audio() */ inuint(c_mixer2); - + GiveSamplesToDevice(c_mixer2, samples_to_device_map, multOut, underflow); - GetSamplesFromDevice(c_mixer2); - + GetSamplesFromDevice(c_mixer2); + /* Request data from decouple thread */ outuint(c_host, 0); - + /* Between request to decouple and respose ~ 400nS latency for interrupt to fire */ select { @@ -611,7 +611,7 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2) } #else /* IF MAX_MIX_COUNT > 0 */ /* No mixes, this thread runs on its own doing just volume */ - + GiveSamplesToHost(c_host, samples_to_host_map, multIn); GetSamplesFromHost(c_host, underflow); #endif