EnableBufferedPort() now run on p_dsd_clk on every audio port config. This is because deliver sets p_dsd_clk low to ensure that stop_clock() completes. This avoids a run time exception when p_dsd_clk is not yet turned on.

This commit is contained in:
Ross Owen
2014-03-27 19:43:59 +00:00
parent 23eaa438a5
commit a9815ca850
2 changed files with 16 additions and 6 deletions

View File

@@ -619,9 +619,14 @@ enum USBEndpointNumber_Out
#define MAX_VOL (0x20000000) #define MAX_VOL (0x20000000)
#ifdef SELF_POWERED #ifdef SELF_POWERED
/* Default to taking no power from the bus in self-powered mode */
#ifndef BMAX_POWER
#define BMAX_POWER 0 #define BMAX_POWER 0
#endif
#else #else
/* Default to taking 500mA from the bus in bus-powered mode */
#ifndef BMAX_POWER #ifndef BMAX_POWER
#define BMAX_POWER 250 #define BMAX_POWER 250
#endif #endif

View File

@@ -53,6 +53,12 @@ void ConfigAudioPortsWrapper(
#endif #endif
unsigned int divide, unsigned int dsdMode) unsigned int divide, unsigned int dsdMode)
{ {
/* Ensure dsd clock is on in all modes since I2S mode sets it low on exit
* to avoid stop_clock() potentially pausing forever. If this is not done
* an exception will be raised with audio() attempts to set this port low
*/
/* TODO Do we really need to do this on every SF change? Once is probably enough */
EnableBufferedPort(p_dsd_clk, 32);
if(dsdMode) if(dsdMode)
{ {
@@ -61,7 +67,6 @@ unsigned int divide, unsigned int dsdMode)
{ {
EnableBufferedPort(p_dsd_dac[i], 32); EnableBufferedPort(p_dsd_dac[i], 32);
} }
EnableBufferedPort(p_dsd_clk, 32);
ConfigAudioPorts( ConfigAudioPorts(
#if (DSD_CHANS_DAC != 0) #if (DSD_CHANS_DAC != 0)