forked from PAWPAW-Mirror/lib_xua
Merge pull request #324 from xross/fix/sw_usb_audio_156
Fix for exception when entering DSD mode (also some tidies)
This commit is contained in:
@@ -5,6 +5,7 @@ UNRELEASED
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* FIXED: Memory corruption during initialisation of mixer weights
|
* FIXED: Memory corruption during initialisation of mixer weights
|
||||||
|
* FIXED: Exception when entering DSD mode
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
-----
|
-----
|
||||||
|
|||||||
@@ -706,7 +706,6 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
/* TODO; we should catch and handle the case when divide is 0. Currently design will lock up */
|
/* TODO; we should catch and handle the case when divide is 0. Currently design will lock up */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (DSD_CHANS_DAC > 0)
|
#if (DSD_CHANS_DAC > 0)
|
||||||
if(dsdMode)
|
if(dsdMode)
|
||||||
{
|
{
|
||||||
@@ -724,7 +723,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
null,
|
null,
|
||||||
p_dsd_clk,
|
p_dsd_clk,
|
||||||
#endif
|
#endif
|
||||||
p_mclk_in, clk_audio_bclk, divide, curSamFreq, dsdMode);
|
p_mclk_in, clk_audio_bclk, divide, curSamFreq);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -747,10 +746,9 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
p_bclk,
|
p_bclk,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
p_mclk_in, clk_audio_bclk, divide, curSamFreq, dsdMode);
|
p_mclk_in, clk_audio_bclk, divide, curSamFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned curFreq = curSamFreq;
|
unsigned curFreq = curSamFreq;
|
||||||
#if (DSD_CHANS_DAC > 0)
|
#if (DSD_CHANS_DAC > 0)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2013-2022 XMOS LIMITED.
|
// Copyright 2013-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
@@ -9,17 +9,17 @@
|
|||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
|
|
||||||
/* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */
|
/* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */
|
||||||
#if DSD_CHANS_DAC > 0
|
#if (DSD_CHANS_DAC > 0)
|
||||||
port p_dsd_dac[DSD_CHANS_DAC] = {
|
port p_dsd_dac[DSD_CHANS_DAC] = {
|
||||||
PORT_DSD_DAC0,
|
PORT_DSD_DAC0,
|
||||||
#endif
|
#endif
|
||||||
#if DSD_CHANS_DAC > 1
|
#if (DSD_CHANS_DAC > 1)
|
||||||
PORT_DSD_DAC1,
|
PORT_DSD_DAC1,
|
||||||
#endif
|
#endif
|
||||||
#if DSD_CHANS_DAC > 2
|
#if (DSD_CHANS_DAC > 2)
|
||||||
#error > 2 DSD chans currently not supported
|
#error > 2 DSD chans currently not supported
|
||||||
#endif
|
#endif
|
||||||
#if DSD_CHANS_DAC > 0
|
#if (DSD_CHANS_DAC > 0)
|
||||||
};
|
};
|
||||||
port p_dsd_clk = PORT_DSD_CLK;
|
port p_dsd_clk = PORT_DSD_CLK;
|
||||||
#endif
|
#endif
|
||||||
@@ -45,7 +45,7 @@ void ConfigAudioPortsWrapper(
|
|||||||
port p_lrclk,
|
port p_lrclk,
|
||||||
port p_bclk,
|
port p_bclk,
|
||||||
#endif
|
#endif
|
||||||
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode)
|
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq)
|
||||||
{
|
{
|
||||||
ConfigAudioPorts(
|
ConfigAudioPorts(
|
||||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2022 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#ifndef _AUDIOPORTS_H_
|
#ifndef _AUDIOPORTS_H_
|
||||||
#define _AUDIOPORTS_H_
|
#define _AUDIOPORTS_H_
|
||||||
@@ -79,7 +79,7 @@ void ConfigAudioPortsWrapper(
|
|||||||
buffered in port:32 p_bclk,
|
buffered in port:32 p_bclk,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
|
in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void ConfigAudioPortsWrapper(
|
void ConfigAudioPortsWrapper(
|
||||||
@@ -95,7 +95,7 @@ void ConfigAudioPortsWrapper(
|
|||||||
port p_lrclk,
|
port p_lrclk,
|
||||||
port p_bclk,
|
port p_bclk,
|
||||||
#endif
|
#endif
|
||||||
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
|
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __XC__*/
|
#endif /* __XC__*/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2022 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
@@ -6,9 +6,7 @@
|
|||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
#include "audioports.h"
|
#include "audioports.h"
|
||||||
|
|
||||||
//extern in port p_mclk_in;
|
|
||||||
extern clock clk_audio_mclk;
|
extern clock clk_audio_mclk;
|
||||||
//extern clock clk_audio_bclk;
|
|
||||||
|
|
||||||
void ConfigAudioPorts(
|
void ConfigAudioPorts(
|
||||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||||
@@ -58,7 +56,7 @@ void ConfigAudioPorts(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (I2S_CHANS_DAC != 0)
|
#if (I2S_CHANS_DAC != 0)|| (DSD_CHANS_DAC != 0)
|
||||||
for(int i = 0; i < numPortsDac; i++)
|
for(int i = 0; i < numPortsDac; i++)
|
||||||
{
|
{
|
||||||
clearbuf(p_i2s_dac[i]);
|
clearbuf(p_i2s_dac[i]);
|
||||||
@@ -82,7 +80,7 @@ void ConfigAudioPorts(
|
|||||||
/* Some adustments for timing. Sample ADC lines on negative edge and add some delay */
|
/* Some adustments for timing. Sample ADC lines on negative edge and add some delay */
|
||||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < I2S_WIRES_ADC; i++)
|
for(int i = 0; i < numPortsAdc; i++)
|
||||||
{
|
{
|
||||||
set_port_sample_delay(p_i2s_adc[i]);
|
set_port_sample_delay(p_i2s_adc[i]);
|
||||||
set_pad_delay(p_i2s_adc[i], 4);
|
set_pad_delay(p_i2s_adc[i], 4);
|
||||||
@@ -91,7 +89,6 @@ void ConfigAudioPorts(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif (CODEC_MASTER)
|
#elif (CODEC_MASTER)
|
||||||
|
|
||||||
/* Stop bit and master clock blocks */
|
/* Stop bit and master clock blocks */
|
||||||
stop_clock(clk_audio_bclk);
|
stop_clock(clk_audio_bclk);
|
||||||
|
|
||||||
@@ -112,9 +109,9 @@ void ConfigAudioPorts(
|
|||||||
set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall);
|
set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (I2S_CHANS_DAC != 0)
|
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||||
/* Clock I2S output data ports from b-clock clock block */
|
/* Clock I2S/DSD output data ports from b-clock clock block */
|
||||||
for(int i = 0; i < I2S_WIRES_DAC; i++)
|
for(int i = 0; i < numPortsDac; i++)
|
||||||
{
|
{
|
||||||
configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0);
|
configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0);
|
||||||
}
|
}
|
||||||
@@ -122,7 +119,7 @@ void ConfigAudioPorts(
|
|||||||
|
|
||||||
#if (I2S_CHANS_ADC != 0)
|
#if (I2S_CHANS_ADC != 0)
|
||||||
/* Clock I2S input data ports from clock block */
|
/* Clock I2S input data ports from clock block */
|
||||||
for(int i = 0; i < I2S_WIRES_ADC; i++)
|
for(int i = 0; i < numPortsAdc; i++)
|
||||||
{
|
{
|
||||||
configure_in_port_no_ready(p_i2s_adc[i], clk_audio_bclk);
|
configure_in_port_no_ready(p_i2s_adc[i], clk_audio_bclk);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user