forked from PAWPAW-Mirror/lib_xua
Changes to support DSD Native mode
This commit is contained in:
@@ -190,6 +190,7 @@ void handle_audio_request(chanend c_mix_out)
|
||||
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multIn),"r"(i));
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
sample = h << 3;
|
||||
sample |= (l >> 29) & 0x7; // Note, this step is not required if we assume sample depth is 24 (rather than 32)
|
||||
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||
sample = sample << 3;
|
||||
#endif
|
||||
@@ -296,6 +297,7 @@ void handle_audio_request(chanend c_mix_out)
|
||||
asm("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h <<= 3;
|
||||
h |= (l >>29)& 0x7; // Note this step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
outuint(c_mix_out, h);
|
||||
#else
|
||||
outuint(c_mix_out, sample);
|
||||
@@ -670,7 +672,7 @@ void decouple(chanend c_mix_out,
|
||||
/* Pass on to mixer */
|
||||
DISABLE_INTERRUPTS();
|
||||
inuint(c_mix_out);
|
||||
outct(c_mix_out, 9);
|
||||
outct(c_mix_out, SET_SAMPLE_FREQ);
|
||||
outuint(c_mix_out, sampFreq);
|
||||
|
||||
inOverflow = 0;
|
||||
@@ -778,6 +780,41 @@ void decouple(chanend c_mix_out,
|
||||
SET_SHARED_GLOBAL(g_freqChange, 0);
|
||||
ENABLE_INTERRUPTS();
|
||||
}
|
||||
#ifdef NATIVE_DSD
|
||||
else if(tmp == SET_DSD_MODE)
|
||||
{
|
||||
unsigned dsdMode;
|
||||
DISABLE_INTERRUPTS();
|
||||
|
||||
/* Clear the buffer as we dont want to send out old PCM samples.. */
|
||||
SET_SHARED_GLOBAL(g_freqChange_flag, 0);
|
||||
GET_SHARED_GLOBAL(dsdMode, g_freqChange_sampFreq); /* Misuse of g_freqChange_sampFreq */
|
||||
|
||||
/* Reset OUT buffer state */
|
||||
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_from_host_wrptr, aud_from_host_fifo_start);
|
||||
|
||||
outUnderflow = 1;
|
||||
if(outOverflow)
|
||||
{
|
||||
/* If we were previously in overflow we wont have marked as ready */
|
||||
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
||||
outOverflow = 0;
|
||||
}
|
||||
|
||||
inuint(c_mix_out);
|
||||
outct(c_mix_out, SET_DSD_MODE);
|
||||
outuint(c_mix_out, dsdMode);
|
||||
|
||||
/* Wait for handshake back */
|
||||
chkct(c_mix_out, XS1_CT_END);
|
||||
|
||||
SET_SHARED_GLOBAL(g_freqChange, 0);
|
||||
asm("outct res[%0],%1"::"r"(buffer_aud_ctl_chan),"r"(XS1_CT_END));
|
||||
|
||||
ENABLE_INTERRUPTS();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OUTPUT
|
||||
|
||||
@@ -278,7 +278,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Sample Freq our chan count update from ep 0 */
|
||||
/* Sample Freq or chan count update from ep 0 */
|
||||
case testct_byref(c_aud_ctl, u_tmp):
|
||||
{
|
||||
if (u_tmp)
|
||||
@@ -354,19 +354,18 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
else
|
||||
{
|
||||
sampleFreq = inuint(c_aud_ctl);
|
||||
SET_SHARED_GLOBAL0(g_freqChange, tmp); /* Set command */
|
||||
|
||||
SET_SHARED_GLOBAL0(g_freqChange, tmp); /* Set command */
|
||||
SET_SHARED_GLOBAL(g_freqChange_sampFreq, sampleFreq); /* Set flag */
|
||||
SET_SHARED_GLOBAL(g_freqChange_flag, tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#define MASK_16_13 (7) // Bits that should not be transmitted as part of feedback.
|
||||
#define MASK_16_10 (127) //(63) /* For Audio 1.0 we use a mask 1 bit longer than expected to avoid Windows LSB isses */
|
||||
#define MASK_16_13 (7) /* Bits that should not be transmitted as part of feedback */
|
||||
#define MASK_16_10 (127) /* For Audio 1.0 we use a mask 1 bit longer than expected to avoid Windows LSB issues */
|
||||
/* (previously used 63 instead of 127) */
|
||||
|
||||
case inuint_byref(c_sof, u_tmp):
|
||||
|
||||
@@ -381,7 +380,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
if(freqChange == SET_SAMPLE_FREQ)
|
||||
{
|
||||
/* Keep getting MCLK counts */
|
||||
lastClock = u_tmp;
|
||||
lastClock = u_tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -434,7 +433,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
}
|
||||
}
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
clocks = 0;
|
||||
@@ -697,7 +698,6 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
else
|
||||
{
|
||||
// Too many events from device - drop
|
||||
//printstr("DROP");
|
||||
}
|
||||
|
||||
/* Once we have the whole message, sent it to host */
|
||||
|
||||
Reference in New Issue
Block a user