It seems to work very well and sound great except that I can't seem to change SPDif frequencies more than 7 times.
The system seems to hang.
After some tracing, it seems to hang in decouple.xc, where it tells the audio thread that the frequency has changed.
It sends a token into delivery in audio.xc, which shuts it down, reinitializes and it sends a token back to the decouple thread. The decouple thread waits for this token, reinitializes some things, turns the interrupt back on and it is ready to receive more SPDif data, at the higher speed this time.
Well, this works well for up to 7 times. After 7 times, the handshake token from the audio thread is not being received by the decouple thread, for some reason.
I've put some test points where the token is sent and where the token is received. It clearly hangs waiting for the token.
The following code can be found in decouple, around line 750 or so:
Code: Select all
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);
SET_SHARED_GLOBAL(aud_data_remaining_to_device, 0);
/* Wait for handshake back and pass back up */
p_USB_debugLED <: 1; // turn on debug LED
chkct(c_del_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();
p_USB_debugLED <: 0; // turn on debug LED
Any light shed on this would be greatly appreciated.