Merge master -> REINSTATE_SPDIF_INPUT

This commit is contained in:
Ross Owen
2014-07-21 11:18:04 +01:00
10 changed files with 68 additions and 108 deletions

View File

@@ -1,7 +1,7 @@
sc_usb_audio Change Log
=======================
6.6.0
6.6.1
-----
* see sw_usb_audio for changelog

View File

@@ -1,7 +1,7 @@
USB Audio Shared
................
:Latest release: 6.6.0rc2
:Latest release: 6.6.1rc1
:Maintainer: xross
:Description: USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.

View File

@@ -26,8 +26,8 @@ unsigned testsamples[100];
int p = 0;
unsigned lastSample = 0;
#if (DSD_CHANS_DAC != 0)
extern unsigned p_dsd_dac[DSD_CHANS_DAC];
extern port p_dsd_clk;
extern buffered out port:32 p_dsd_dac[DSD_CHANS_DAC];
extern buffered out port:32 p_dsd_clk;
#endif
unsigned g_adcVal = 0;
@@ -832,6 +832,15 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
start_clock(clk_audio_mclk);
#if (DSD_CHANS_DAC > 0)
/* Make sure the DSD ports are on and buffered - just in case they are not shared with I2S */
EnableBufferedPort(p_dsd_clk, 32);
for(int i = 0; i< DSD_CHANS_DAC; i++)
{
EnableBufferedPort(p_dsd_dac[i], 32);
}
#endif
#ifdef SPDIF
SpdifTransmitPortConfig(p_spdif_tx, clk_mst_spd, p_mclk_in);
#endif
@@ -872,28 +881,31 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
divide = mClk / ( curSamFreq * numBits );
}
#if (DSD_CHANS_DAC != 0)
#if (DSD_CHANS_DAC > 0)
if(dsdMode)
{
/* Configure audio ports */
ConfigAudioPortsWrapper(
#if (I2S_CHANS_DAC != 0)
p_i2s_dac,
p_dsd_dac,
DSD_CHANS_DAC,
#endif
#if (I2S_CHANS_ADC != 0)
p_i2s_adc,
I2S_WIRES_ADC,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
p_lrclk,
p_bclk,
#else
p_lrclk,
p_bclk,
null,
p_dsd_clk,
#endif
divide, dsdMode);
}
else
#endif
divide, dsdMode);
#else
/* Configure audio ports */
ConfigAudioPorts(
{
ConfigAudioPortsWrapper(
#if (I2S_CHANS_DAC != 0)
p_i2s_dac,
I2S_WIRES_DAC,
@@ -911,9 +923,9 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
p_bclk,
#endif
#endif
divide);
divide, dsdMode);
}
#endif
{
unsigned curFreq = curSamFreq;

View File

@@ -393,7 +393,7 @@
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/
#ifndef BCD_DEVICE_N
#define BCD_DEVICE_N 0
#define BCD_DEVICE_N 1
#endif
/**
@@ -769,6 +769,14 @@
#endif
#endif
#ifndef XUD_PWR_CFG
#ifdef SELF_POWERED
#define XUD_PWR_CFG XUD_PWR_SELF
#else
#define XUD_PWR_CFG XUD_PWR_BUS
#endif
#endif
/* Mixer defines */
/**

View File

@@ -529,7 +529,7 @@ StringDescTable_t g_strTable =
#endif
/*** INPUT CHANNEL STRINGS ***/
#if (NUM_USB_CHAN_IN > 0)
#if defined(SPDIF_RX) && (SPDIF_RX_INDEX == 0)
#if defined(SPDIF_RX) && (SPDIF_RX_INDEX < I2S_CHANS_ADC)
@@ -849,8 +849,8 @@ StringDescTable_t g_strTable =
#if (NUM_USB_CHAN_IN > 18)
#error NUM_USB_CHAN_IN > 18
#endif
#endif
.iAPInterfaceStr = "iAP Interface",
};

View File

@@ -239,12 +239,6 @@ void xscope_user_init()
}
#endif
#ifdef SELF_POWERED
#define pwrConfig XUD_PWR_BUS
#else
#define pwrConfig XUD_PWR_BUS
#endif
/* Core USB Audio functions - must be called on the Tile connected to the USB Phy */
void usb_audio_core(chanend c_mix_out
#ifdef MIDI
@@ -277,11 +271,11 @@ void usb_audio_core(chanend c_mix_out
#if (AUDIO_CLASS==2)
XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
clk, 1, XUD_SPEED_HS, pwrConfig);
clk, 1, XUD_SPEED_HS, XUD_PWR_CFG);
#else
XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
clk, 1, XUD_SPEED_FS, pwrConfig);
clk, 1, XUD_SPEED_FS, XUD_PWR_CFG);
#endif
/* USB Packet buffering Core */

View File

@@ -6,7 +6,6 @@
#include "devicedefines.h"
#include "audioports.h"
#if (DSD_CHANS_DAC != 0)
/* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */
#if DSD_CHANS_DAC > 0
port p_dsd_dac[DSD_CHANS_DAC] = {
@@ -23,23 +22,21 @@ port p_dsd_dac[DSD_CHANS_DAC] = {
port p_dsd_clk = PORT_DSD_CLK;
#endif
static inline void EnableBufferedPort(port p, unsigned transferWidth)
void EnableBufferedPort(port p, unsigned transferWidth)
{
//set_port_use_on(p_dsd_dac[i]);
asm volatile("setc res[%0], %1"::"r"(p), "r"(XS1_SETC_INUSE_ON));
asm volatile("setc res[%0], %1"::"r"(p), "r"(XS1_SETC_BUF_BUFFERS));
asm volatile("settw res[%0], %1"::"r"(p),"r"(transferWidth));
}
/* C wrapper for ConfigAudioPorts() such that we can mess around with arrays of ports */
/* C wrapper for ConfigAudioPorts() to handle DSD ports */
void ConfigAudioPortsWrapper(
#if (I2S_CHANS_DAC != 0)
port p_i2s_dac[I2S_WIRES_DAC],
port p_dac[], int numPortsDac,
#endif
#if (I2S_CHANS_ADC != 0)
port p_i2s_adc[I2S_WIRES_ADC],
port p_adc[], int numPortsAdc,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
@@ -53,63 +50,16 @@ void ConfigAudioPortsWrapper(
#endif
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)
{
/* Make sure the ports are on and buffered - just in case they are not shared with I2S */
for(int i = 0; i< DSD_CHANS_DAC; i++)
{
EnableBufferedPort(p_dsd_dac[i], 32);
}
ConfigAudioPorts(
#if (DSD_CHANS_DAC != 0)
p_dsd_dac,
DSD_CHANS_DAC,
#endif
#if (I2S_CHANS_ADC != 0)
p_i2s_adc,
I2S_WIRES_ADC,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
0, /* NULL */
p_dsd_clk,
#else
0, /* NULL */
p_dsd_clk,
#endif
#endif
divide);
}
else
{
ConfigAudioPorts(
#if (I2S_CHANS_DAC != 0)
p_i2s_dac,
I2S_WIRES_DAC,
p_dac,
numPortsDac,
#endif
#if (I2S_CHANS_ADC != 0)
p_i2s_adc,
I2S_WIRES_ADC,
p_adc,
numPortsAdc,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
p_lrclk,
p_bclk,
#else
p_lrclk,
p_bclk,
#endif
#endif
divide);
}
}
#endif

View File

@@ -4,9 +4,6 @@
#include <xccompat.h>
#include "devicedefines.h"
void ConfigAudioPorts_dsd(unsigned int divide);
#ifdef __XC__
void ConfigAudioPorts(
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
@@ -61,19 +58,19 @@ void ConfigAudioPorts(
#ifdef __XC__
void ConfigAudioPortsWrapper(
#if (I2S_CHANS_DAC != 0)
buffered out port:32 p_i2s_dac[I2S_WIRES_DAC],
buffered out port:32 p_i2s_dac[], int numPortsDAC,
#endif
#if (I2S_CHANS_ADC != 0)
buffered in port:32 p_i2s_adc[I2S_WIRES_ADC],
buffered in port:32 p_i2s_adc[], int numPortsADC,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
buffered out port:32 p_lrclk,
buffered out port:32 ?p_lrclk,
buffered out port:32 p_bclk,
#else
in port p_lrclk,
in port ?p_lrclk,
in port p_bclk,
#endif
#endif
@@ -82,28 +79,26 @@ void ConfigAudioPortsWrapper(
void ConfigAudioPortsWrapper(
#if (I2S_CHANS_DAC != 0)
port p_i2s_dac[I2S_WIRES_DAC],
port p_i2s_dac[], int numPortsDAC,
#endif
#if (I2S_CHANS_ADC != 0)
port p_i2s_adc[I2S_WIRES_ADC],
port p_i2s_adc[], int numPortsADC,
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
port p_lrclk,
port p_bclk,
#else
port p_lrclk,
port p_bclk,
#endif
#endif
unsigned int divide, unsigned int dsdMode);
#endif /* __XC__*/
#ifdef __XC__
void EnableBufferedPort(buffered out port:32 p, unsigned transferWidth);
#else
void EnableBufferedPort(port p, unsigned transferWidth);
#endif
#endif /* _AUDIOPORTS_H_ */

View File

@@ -34,7 +34,6 @@ unsigned int divide)
#ifndef CODEC_MASTER
/* Note this call to stop_clock() will pause forever if the port clocking the clock-block is not low.
* deliver() should return with this being the case */
stop_clock(clk_audio_bclk);
if(!isnull(p_lrclk))

View File

@@ -5,7 +5,7 @@
<board>XMOS USB Audio Reference Designes</board>
<keyword>DFU</keyword>
</component>
<component description = "queue" type = "demoCode" scope = "General Use" path = "module_queue" local = "false" id = "module_queue" name = "Queing Module For USB Audio Framwwork">
<component description = "queue" type = "demoCode" scope = "General Use" path = "module_queue" local = "false" id = "module_queue" name = "Queuing Module For USB Audio Framework">
<board></board>
<componentDependency repo = "git://github.com/xcore/sc_util" version = "1.0.4">module_xassert</componentDependency>
<keyword>UAC2</keyword>
@@ -20,7 +20,7 @@
</component>
<component description = "MIDI" type = "demoCode" scope = "General Use" path = "module_usb_midi" local = "false" id = "module_usb_midi" name = "MIDI Module for USB Audio Framework">
<board></board>
<componentDependency version = "6.6.0">module_queue</componentDependency>
<componentDependency version = "6.6.1">module_queue</componentDependency>
<componentDependency repo = "git://github.com/xcore/sc_util" version = "1.0.4">module_xassert</componentDependency>
<keyword>MIDI</keyword>
</component>
@@ -67,7 +67,9 @@
<release parenthash = "ccf7c66588501a090ab25003f3d646b22c03b243" version = "6.6.0beta1" githash = "91c7bcff7a403fc9638bd05fcb4b63f75b7eccca"></release>
<release parenthash = "91c7bcff7a403fc9638bd05fcb4b63f75b7eccca" version = "6.6.0rc0" githash = "3a340d50732b31012b412d35598bbf311df2b914"></release>
<release parenthash = "d7f0cdd4be780869137968f00f1d2a46663a1f33" version = "6.6.0rc1" githash = "a714e668020fe14128b213eae7ea3290d4ddf28a"></release>
<release parenthash = "192b263d764650b2b498157b192dbda8882aba99" version = "6.6.0rc2"></release>
<release parenthash = "192b263d764650b2b498157b192dbda8882aba99" version = "6.6.0rc2" githash = "74d448097f79524c97fc2967bb227264a39be016"></release>
<release parenthash = "9be1ef8d706be7027c3712a2fef15144767dfe55" version = "6.6.1rc0" githash = "6456645f423546b708db53aa5979967b3c8019aa"></release>
<release parenthash = "7c17932c58c8e1d32a9002fe635672b95fff259d" version = "6.6.1rc1"></release>
<subpartnumber>XM-004720-SM</subpartnumber>
<vendor>XMOS</vendor>
<version_defines>