forked from PAWPAW-Mirror/lib_xua
Added control channel for buffering for lower-power, non-memory polling buffering
This commit is contained in:
@@ -26,6 +26,12 @@ void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
||||
|
||||
extern unsigned int g_curSamFreqMultiplier;
|
||||
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
#define SET_SHARED_GLOBAL2(x,y) SET_SHARED_GLOBAL(x,y); outuchar(c_buff_ctrl, 0);
|
||||
#else
|
||||
#define SET_SHARED_GLOBAL2(x,y) SET_SHARED_GLOBAL(x,y)
|
||||
#endif
|
||||
|
||||
|
||||
/* Global var for speed. Related to feedback. Used by input stream to determine IN packet size */
|
||||
unsigned g_speed;
|
||||
@@ -88,7 +94,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#ifdef HID_CONTROLS
|
||||
,chanend c_hid
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -166,17 +175,12 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
|
||||
xc_ptr p_inZeroBuff = array_to_xc_ptr(inZeroBuff);
|
||||
|
||||
set_thread_fast_mode_on();
|
||||
|
||||
|
||||
#ifdef IAP
|
||||
XUD_ResetEndpoint(ep_iap_from_host, null);
|
||||
iap_send_reset(c_iap);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
asm("stw %0, dp[int_usb_ep]"::"r"(ep_int));
|
||||
#endif
|
||||
@@ -343,14 +347,14 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
* thread locked, it must stay responsive to packets/SOFs. So, set a flag and check for
|
||||
* handshake elsewhere */
|
||||
/* Pass on sample freq change to decouple */
|
||||
SET_SHARED_GLOBAL(g_freqChange, SET_SAMPLE_FREQ);
|
||||
SET_SHARED_GLOBAL2(g_freqChange, SET_SAMPLE_FREQ);
|
||||
SET_SHARED_GLOBAL(g_freqChange_sampFreq, sampleFreq);
|
||||
SET_SHARED_GLOBAL(g_freqChange_flag, SET_SAMPLE_FREQ);
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleFreq = inuint(c_aud_ctl);
|
||||
SET_SHARED_GLOBAL(g_freqChange, tmp); /* Set command */
|
||||
SET_SHARED_GLOBAL2(g_freqChange, tmp); /* Set command */
|
||||
SET_SHARED_GLOBAL(g_freqChange_sampFreq, sampleFreq); /* Set flag */
|
||||
SET_SHARED_GLOBAL(g_freqChange_flag, tmp);
|
||||
}
|
||||
@@ -447,7 +451,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
case XUD_SetData_Select(c_aud_in, ep_aud_in, tmp):
|
||||
{
|
||||
/* Inform stream that buffer sent */
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_flag, bufferIn+1);
|
||||
SET_SHARED_GLOBAL2(g_aud_to_host_flag, bufferIn+1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -486,8 +490,8 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
write_via_xc_ptr(aud_from_host_buffer, tmp);
|
||||
|
||||
/* Sync with audio thread */
|
||||
SET_SHARED_GLOBAL(g_aud_from_host_flag, 1);
|
||||
/* Sync with decouple thread */
|
||||
SET_SHARED_GLOBAL2(g_aud_from_host_flag, 1);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -720,7 +724,4 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
set_thread_fast_mode_off();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user