Stable -> master conflicted merge

This commit is contained in:
Ross Owen
2015-12-03 11:32:47 +00:00
19 changed files with 410 additions and 1138 deletions

View File

@@ -3,21 +3,22 @@ sc_usb_audio Change Log
6.14.0 6.14.0
------ ------
- ADDED: Support for the use and integration of PDM microphones (including PDM to PCM
conversion) via lib_mic_array
- ADDED: Support for various "low" sample rates (i.e. < 44100) into UAC2 sample rate list
and UAC1 descriptors
- ADDED: Support for for master-clock/sample-rate divides that are not a power of 2 - ADDED: Support for for master-clock/sample-rate divides that are not a power of 2
(i.e. 32kHz from 24.567MHz) (i.e. 32kHz from 24.567MHz)
- ADDED: Extended available sample-rate/master-clock ratios. Previous restriction was <= - ADDED: Extended available sample-rate/master-clock ratios. Previous restriction was <=
512x (i.e. could not support 1024x and above e.g. 49.152MHz MCLK for Sample Rates 512x (i.e. could not support 1024x and above e.g. 49.152MHz MCLK for Sample Rates
below 96kHz) (#13893) below 96kHz) (#13893)
- ADDED: Support for various "low" sample rates (i.e. < 44100) into UAC 2.0 sample rate
list and UAC 1.0 descriptors
- ADDED: Support for the use and integration of PDM microphones (including PDM to PCM
conversion) via lib_mic_array
- RESOLVED: MIDI data not accepted after "sleep" in OSX 10.11 (El Capitan) - related to sc_xud - RESOLVED: MIDI data not accepted after "sleep" in OSX 10.11 (El Capitan) - related to sc_xud
bug #17092 issue #17092
- CHANGE: Asynchronous feedback system re-implemented to allow the previous two changelog - CHANGE: Asynchronous feedback system re-implemented to allow for the first two ADDED
items changelog items
- CHANGE: Hardware divider used to generate bit-clock from master clock (xCORE-200 only). - CHANGE: Hardware divider used to generate bit-clock from master clock (xCORE-200 only).
Allows easy support for greater number of master-clock to sample-rate ratios. Allows easy support for greater number of master-clock to sample-rate ratios.
- CHANGE: module_queue no longer uses any assert module/lib
6.13.0 6.13.0
------ ------

View File

@@ -1,7 +1,7 @@
USB Audio Shared USB Audio Shared
................ ................
:Latest release: 6.13.0beta2 :Latest release: 6.14.0beta2
:Maintainer: xross :Maintainer: xross
:Description: USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs. :Description: USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.
@@ -9,5 +9,5 @@ USB Audio Shared
Required software (dependencies) Required software (dependencies)
================================ ================================
* lib_xassert (git@github.com:xmos/lib_xassert.git) * None

View File

@@ -156,10 +156,7 @@
<option id = "com.xmos.xc.compiler.option.include.paths.84748440" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath"> <option id = "com.xmos.xc.compiler.option.include.paths.84748440" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
</option> </option>
@@ -272,10 +269,7 @@
<option id = "com.xmos.c.compiler.option.include.paths.1482631" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath"> <option id = "com.xmos.c.compiler.option.include.paths.1482631" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
</option> </option>
@@ -394,10 +388,7 @@
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
</option> </option>

View File

@@ -11,4 +11,4 @@
MODULE_XCC_XC_FLAGS = $(XCC_XC_FLAGS) MODULE_XCC_XC_FLAGS = $(XCC_XC_FLAGS)
DEPENDENT_MODULES = lib_xassert DEPENDENT_MODULES =

View File

@@ -1,7 +1,7 @@
#ifndef QUEUE_H_ #ifndef QUEUE_H_
#define QUEUE_H_ #define QUEUE_H_
#include <xassert.h> #define assert(x) asm("ecallf %0"::"r"(x));
typedef struct queue_t { typedef struct queue_t {
/// Read index. /// Read index.

File diff suppressed because it is too large Load Diff

View File

@@ -1,90 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>module_usb_audio</name> <name>module_usb_audio</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>com.xmos.cdt.core.LegacyProjectCheckerBuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments> <triggers>clean,full,incremental,</triggers>
</arguments> <arguments>
</buildCommand> <dictionary>
<buildCommand> <key>?children?</key>
<name>com.xmos.cdt.core.ProjectInfoSyncBuilder</name> <value>?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\||</value>
<arguments> </dictionary>
</arguments> <dictionary>
</buildCommand> <key>?name?</key>
<buildCommand> <value></value>
<name>com.xmos.cdt.core.ModulePathBuilder</name> </dictionary>
<arguments> <dictionary>
</arguments> <key>org.eclipse.cdt.make.core.append_environment</key>
</buildCommand> <value>true</value>
<buildCommand> </dictionary>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <dictionary>
<triggers>clean,full,incremental,</triggers> <key>org.eclipse.cdt.make.core.buildArguments</key>
<arguments> <value>CONFIG=Debug</value>
<dictionary> </dictionary>
<key>?children?</key> <dictionary>
<value>?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\||</value> <key>org.eclipse.cdt.make.core.buildCommand</key>
</dictionary> <value>xmake</value>
<dictionary> </dictionary>
<key>?name?</key> <dictionary>
<value></value> <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
</dictionary> <value>clean</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key> <dictionary>
<value>true</value> <key>org.eclipse.cdt.make.core.contents</key>
</dictionary> <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key> <dictionary>
<value>CONFIG=Debug</value> <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
</dictionary> <value>false</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key> <dictionary>
<value>xmake</value> <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
</dictionary> <value>true</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key> <dictionary>
<value>clean</value> <key>org.eclipse.cdt.make.core.enableFullBuild</key>
</dictionary> <value>true</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.contents</key> <dictionary>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value> <key>org.eclipse.cdt.make.core.stopOnError</key>
</dictionary> <value>true</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key> <dictionary>
<value>false</value> <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
</dictionary> <value>false</value>
<dictionary> </dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key> </arguments>
<value>true</value> </buildCommand>
</dictionary> <buildCommand>
<dictionary> <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<key>org.eclipse.cdt.make.core.enableFullBuild</key> <triggers>full,incremental,</triggers>
<value>true</value> <arguments>
</dictionary> </arguments>
<dictionary> </buildCommand>
<key>org.eclipse.cdt.make.core.stopOnError</key> </buildSpec>
<value>true</value> <natures>
</dictionary> <nature>org.eclipse.cdt.core.cnature</nature>
<dictionary> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<value>false</value> <nature>com.xmos.cdt.core.XdeProjectNature</nature>
</dictionary> </natures>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.xmos.cdt.core.XdeProjectNature</nature>
</natures>
</projectDescription> </projectDescription>

View File

@@ -26,7 +26,7 @@ void audio(chanend c_in,
#if (XUD_TILE != 0) #if (XUD_TILE != 0)
, server interface i_dfu dfuInterface , server interface i_dfu dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_in , chanend c_pdm_in
#endif #endif
); );

View File

@@ -705,14 +705,14 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
/* Get samples from PDM->PCM comverter */ /* Get samples from PDM->PCM comverter */
c_pdm_pcm <: 1; c_pdm_pcm <: 1;
#pragma loop unroll #pragma loop unroll
for(int i = 0; i < NUM_PDM_MICS; i++) for(int i = 0; i < NUM_PDM_MICS; i++)
{ {
c_pdm_pcm :> samplesIn_0[i]; c_pdm_pcm :> samplesIn_0[i];
} }
#endif #endif
} }
@@ -1190,7 +1190,7 @@ chanend ?c_config, chanend ?c
#if NUM_PDM_MICS > 0 #if NUM_PDM_MICS > 0
/* Send decimation factor to PDM task(s) */ /* Send decimation factor to PDM task(s) */
c_pdm_in <: curSamFreq; c_pdm_in <: curSamFreq;
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX

View File

@@ -123,7 +123,7 @@ unsafe
{ {
unsigned * unsafe curSamFreqMultiplier = &g_curSamFreqMultiplier; unsigned * unsafe curSamFreqMultiplier = &g_curSamFreqMultiplier;
static void setG_curSamFreqMultiplier(unsigned x) static void setG_curSamFreqMultiplier(unsigned x)
{ {
// asm(" stw %0, dp[g_curSamFreqMultiplier]" :: "r"(x)); // asm(" stw %0, dp[g_curSamFreqMultiplier]" :: "r"(x));
*curSamFreqMultiplier = x; *curSamFreqMultiplier = x;
@@ -337,7 +337,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
} }
setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512)); setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512));
#endif #endif
#ifdef ADAT_RX #ifdef ADAT_RX
/* Configure ADAT SMUX based on sample rate */ /* Configure ADAT SMUX based on sample rate */
outuint(c_clk_ctl, SET_SMUX); outuint(c_clk_ctl, SET_SMUX);
@@ -875,7 +875,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
#endif #endif
/* Special case for some low sample rates */ /* Special case for some low sample rates */
unsigned lowSampleRateList[] = {8000, 11025, 12000, 16000, 32000}; unsigned lowSampleRateList[] = {8000, 11025, 12000, 16000, 32000};
for (int k = 0; k < sizeof(lowSampleRateList)/sizeof(unsigned); k++) for (int k = 0; k < sizeof(lowSampleRateList)/sizeof(unsigned); k++)
{ {
if((lowSampleRateList[k] >= MIN_FREQ) && (lowSampleRateList[k] <= MAX_FREQ)) if((lowSampleRateList[k] >= MIN_FREQ) && (lowSampleRateList[k] <= MAX_FREQ))
@@ -884,7 +884,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
num_freqs++; num_freqs++;
} }
} }
/* Just keep doubling for standard freqs >= 44.1/48kHz */ /* Just keep doubling for standard freqs >= 44.1/48kHz */
currentFreq44 = 44100; currentFreq44 = 44100;
currentFreq48 = 48000; currentFreq48 = 48000;
@@ -917,7 +917,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
num_freqs++; num_freqs++;
} }
#endif #endif
storeShort(buffer, 0, num_freqs); storeShort(buffer, 0, num_freqs);
return XUD_DoGetRequest(ep0_out, ep0_in, buffer, i, sp.wLength); return XUD_DoGetRequest(ep0_out, ep0_in, buffer, i, sp.wLength);

View File

@@ -2208,38 +2208,38 @@ unsigned char cfgDesc_Null[] =
#define AC_LENGTH (8 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1) #define AC_LENGTH (8 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1)
/* In UAC1 supported sample rates are listed in descriptor /* In UAC1 supported sample rates are listed in descriptor
* Note, using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows. * Note, using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows.
* To work around this we repeat MAX_FREQ_FS multiple times in some cases */ * To work around this we repeat MAX_FREQ_FS multiple times in some cases */
#define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))
const unsigned num_freqs_a1 = MAX(3, (0 const unsigned num_freqs_a1 = MAX(3, (0
#if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) #if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000)
+ 1 + 1
#endif #endif
#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025) #if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025)
+1 +1
#endif #endif
#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000) #if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000)
+1 +1
#endif #endif
#if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000) #if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000)
+1 +1
#endif #endif
#if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000) #if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000)
+1 +1
#endif #endif
#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100) #if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100)
+1 +1
#endif #endif
#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000) #if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000)
+1 +1
#endif #endif
#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200) #if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200)
+1 +1
#endif #endif
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
+1 +1
#endif #endif
)); ));
@@ -2260,7 +2260,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
#define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16)
#if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000) #if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000)
#error SAMPLE RATE RANGE TO GREAT FOR UAC1 ON WINDOWS #error SAMPLE RATE RANGE TO GREAT FOR UAC1 ON WINDOWS
#endif #endif
unsigned char cfgDesc_Audio1[] = unsigned char cfgDesc_Audio1[] =
@@ -2431,47 +2431,47 @@ unsigned char cfgDesc_Audio1[] =
|| (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \ || (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \
|| (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \ || (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \
|| (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \ || (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \
|| (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000) || (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000)
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
#endif #endif
#if (MIN_FREQ == MAX_FREQ_FS) #if (MIN_FREQ == MAX_FREQ_FS)
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
#endif #endif
#if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) #if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000)
0x40, 0x1F, 0x00, /* sampleFreq - 8KHz */ 0x40, 0x1F, 0x00, /* sampleFreq - 8KHz */
#endif #endif
#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025) #if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025)
0x11, 0x2B, 0x00, /* sampleFreq - 11.25KHz */ 0x11, 0x2B, 0x00, /* sampleFreq - 11.25KHz */
#endif #endif
#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000) #if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000)
0xE0, 0x2E, 0x00, /* sampleFreq - 12KHz */ 0xE0, 0x2E, 0x00, /* sampleFreq - 12KHz */
#endif #endif
#if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000) #if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000)
CHARIFY_SR(16000), /* sampleFreq - 16KHz */ CHARIFY_SR(16000), /* sampleFreq - 16KHz */
#endif #endif
#if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000) #if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000)
CHARIFY_SR(32000), /* sampleFreq - 32KHz */ CHARIFY_SR(32000), /* sampleFreq - 32KHz */
#endif #endif
#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100) #if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100)
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */
#endif #endif
#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000) #if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000)
0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */
#endif #endif
#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200) #if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200)
0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */
#endif #endif
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#endif #endif
@@ -2559,50 +2559,50 @@ unsigned char cfgDesc_Audio1[] =
|| (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \ || (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \
|| (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \ || (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \
|| (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \ || (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \
|| (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000) || (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000)
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
#endif #endif
#if (MIN_FREQ == MAX_FREQ_FS) #if (MIN_FREQ == MAX_FREQ_FS)
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
CHARIFY_SR(MAX_FREQ_FS), CHARIFY_SR(MAX_FREQ_FS),
#endif #endif
#if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) #if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000)
0x40, 0x1F, 0x00, /* sampleFreq - 8000KHz */ 0x40, 0x1F, 0x00, /* sampleFreq - 8000KHz */
#endif #endif
#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025) #if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025)
0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */ 0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */
#endif #endif
#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000) #if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000)
0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */ 0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */
#endif #endif
#if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000) #if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000)
CHARIFY_SR(16000), /* sampleFreq - 32KHz */ CHARIFY_SR(16000), /* sampleFreq - 32KHz */
#endif #endif
#if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000) #if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000)
CHARIFY_SR(32000), /* sampleFreq - 32KHz */ CHARIFY_SR(32000), /* sampleFreq - 32KHz */
#endif #endif
#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100) #if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100)
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */
#endif #endif
#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000) #if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000)
0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */
#endif #endif
#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200) #if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200)
0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */
#endif #endif
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#endif #endif
/* Standard Endpoint Descriptor */ /* Standard Endpoint Descriptor */
0x09, 0x09,
0x05, /* ENDPOINT */ 0x05, /* ENDPOINT */

View File

@@ -454,7 +454,7 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
#if XUD_TILE != 0 #if XUD_TILE != 0
, dfuInterface , dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, c_pdm_pcm , c_pdm_pcm
#endif #endif
); );
@@ -653,7 +653,7 @@ int main()
} }
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
on stdcore[PDM_TILE]: pcm_pdm_mic(c_pdm_pcm); on stdcore[PDM_TILE]: pcm_pdm_mic(c_pdm_pcm);
#endif #endif
USER_MAIN_CORES USER_MAIN_CORES

View File

@@ -189,7 +189,7 @@ DOMIX_BOT(7)
.linkset setPtr.maxtimers, 0; .linkset setPtr.maxtimers, 0;
.linkset setPtr.maxthreads, 1; .linkset setPtr.maxthreads, 1;
setPtr: setPtr:
ENTSP_lu6 0 ENTSP_lu6 0
shl r2, r2, 1 shl r2, r2, 1
.xtabranch .label_0 .xtabranch .label_0
bru r2 bru r2

View File

@@ -29,7 +29,7 @@ void user_pdm_init();
int data_0[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0}; int data_0[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0};
int data_1[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0}; int data_1[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0};
frame_audio mic_audio[2]; frame_audio mic_audio[2];
void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, chanend c_audio) void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, chanend c_audio)
{ {
@@ -38,13 +38,13 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_
int output[NUM_PDM_MICS]; int output[NUM_PDM_MICS];
user_pdm_init(); user_pdm_init();
while(1) while(1)
{ {
unsigned samplerate; unsigned samplerate;
c_audio :> samplerate; c_audio :> samplerate;
unsigned decimationfactor = 48000/samplerate; unsigned decimationfactor = 48000/samplerate;
unsafe unsafe
@@ -60,16 +60,16 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_
while(1) while(1)
{ {
frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio); frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio);
unsafe unsafe
{ {
int req; int req;
user_pdm_process(current, output); user_pdm_process(current, output);
c_audio :> req; c_audio :> req;
if(req) if(req)
{ {
for(int i = 0; i < NUM_PDM_MICS; i++) for(int i = 0; i < NUM_PDM_MICS; i++)
{ {
c_audio <: output[i]*decimationfactor; c_audio <: output[i]*decimationfactor;
@@ -80,7 +80,7 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_
break; break;
} }
} }
} }
} }
} }
@@ -92,14 +92,14 @@ void pcm_pdm_mic(chanend c_pcm_out)
{ {
streaming chan c_4x_pdm_mic_0, c_4x_pdm_mic_1; streaming chan c_4x_pdm_mic_0, c_4x_pdm_mic_1;
streaming chan c_ds_output_0, c_ds_output_1; streaming chan c_ds_output_0, c_ds_output_1;
/* TODO, always run mics at 3MHz */ /* TODO, always run mics at 3MHz */
configure_clock_src_divide(pdmclk, p_mclk, 2); configure_clock_src_divide(pdmclk, p_mclk, 2);
configure_port_clock_output(p_pdm_clk, pdmclk); configure_port_clock_output(p_pdm_clk, pdmclk);
configure_in_port(p_pdm_mics, pdmclk); configure_in_port(p_pdm_mics, pdmclk);
start_clock(pdmclk); start_clock(pdmclk);
par par
{ {
pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1); pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output_0); decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output_0);

View File

@@ -56,7 +56,7 @@ unsigned int divide)
#endif #endif
#if defined(__XS2A__) #if defined(__XS2A__)
/* Clock bitclock clock block from master clock pin (divided) */ /* Clock bitclock clock block from master clock pin (divided) */
configure_clock_src_divide(clk_audio_bclk, p_mclk_in, (divide/2)); configure_clock_src_divide(clk_audio_bclk, p_mclk_in, (divide/2));
configure_port_clock_output(p_bclk, clk_audio_bclk); configure_port_clock_output(p_bclk, clk_audio_bclk);
#else #else

View File

@@ -481,10 +481,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in,
/* Number of MCLK ticks in this SOF period (E.g = 125 * 24.576 = 3072) */ /* Number of MCLK ticks in this SOF period (E.g = 125 * 24.576 = 3072) */
int count = (int) ((short)(u_tmp - lastClock)); int count = (int) ((short)(u_tmp - lastClock));
unsigned long long full_result = count * feedbackMul * sampleFreq; unsigned long long full_result = count * feedbackMul * sampleFreq;
clockcounter += full_result; clockcounter += full_result;
/* Store MCLK for next time around... */ /* Store MCLK for next time around... */
lastClock = u_tmp; lastClock = u_tmp;
@@ -494,20 +494,20 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in,
if(sofCount == 128) if(sofCount == 128)
{ {
sofCount = 0; sofCount = 0;
clockcounter += mod_from_last_time; clockcounter += mod_from_last_time;
clocks = clockcounter / masterClockFreq; clocks = clockcounter / masterClockFreq;
mod_from_last_time = clockcounter % masterClockFreq; mod_from_last_time = clockcounter % masterClockFreq;
if(usb_speed == XUD_SPEED_HS) if(usb_speed == XUD_SPEED_HS)
{ {
clocks <<= 3; clocks <<= 3;
} }
else else
{ {
clocks <<= 6; clocks <<= 6;
} }
#ifdef FB_TOLERANCE_TEST #ifdef FB_TOLERANCE_TEST
if (clocks > (expected_fb - FB_TOLERANCE) && if (clocks > (expected_fb - FB_TOLERANCE) &&
clocks < (expected_fb + FB_TOLERANCE)) clocks < (expected_fb + FB_TOLERANCE))

View File

@@ -156,10 +156,7 @@
<option id = "com.xmos.xc.compiler.option.include.paths.70620891" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath"> <option id = "com.xmos.xc.compiler.option.include.paths.70620891" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' />
@@ -274,10 +271,7 @@
<option id = "com.xmos.c.compiler.option.include.paths.57949831" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath"> <option id = "com.xmos.c.compiler.option.include.paths.57949831" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' />
@@ -398,10 +392,7 @@
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/> <listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/>
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/api}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/lib_xassert}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_queue}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi/src}&quot;' />
<listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' /> <listOptionValue builtIn="false" value='&quot;${workspace_loc:/module_usb_midi}&quot;' />

View File

@@ -2,11 +2,9 @@
* @file midiinparse.xc * @file midiinparse.xc
* @brief Generates USB MIDI events from MIDI events * @brief Generates USB MIDI events from MIDI events
* @author Russell Gallop, XMOS Semiconductor * @author Russell Gallop, XMOS Semiconductor
* @version 0.1
*/ */
#include <print.h> #include <print.h>
//#include <assert.h>
#include "midiinparse.h" #include "midiinparse.h"
/** /**
@@ -14,13 +12,13 @@
* *
*/ */
void dump_midi_in_parse_state(struct midi_in_parse_state &s) { void dump_midi_in_parse_state(struct midi_in_parse_state &s) {
printstr("expect_msg_len: 0x"); printhexln(s.expect_msg_len); printstr("expect_msg_len: 0x"); printhexln(s.expect_msg_len);
printstr("msg_type: 0x"); printhexln(s.msg_type); printstr("msg_type: 0x"); printhexln(s.msg_type);
printstr("receivebuffer: 0x"); printhex(s.receivebuffer[0]); printstr("receivebuffer: 0x"); printhex(s.receivebuffer[0]);
printstr(", 0x"); printhex(s.receivebuffer[1]); printstr(", 0x"); printhex(s.receivebuffer[1]);
printstr(", 0x"); printhexln(s.receivebuffer[2]); printstr(", 0x"); printhexln(s.receivebuffer[2]);
printstr("received: 0x"); printhexln(s.received); printstr("received: 0x"); printhexln(s.received);
printstr("codeIndexNumber: 0x"); printhexln(s.codeIndexNumber); printstr("codeIndexNumber: 0x"); printhexln(s.codeIndexNumber);
} }
/** /**

11
xpd.xml
View File

@@ -7,7 +7,6 @@
</component> </component>
<component description = "queue" type = "demoCode" scope = "General Use" path = "module_queue" local = "false" id = "module_queue" name = "Queuing Module For USB Audio Framework"> <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> <board></board>
<componentDependency repo = "git://github.com/xmos/lib_xassert.git">lib_xassert</componentDependency>
<keyword>UAC2</keyword> <keyword>UAC2</keyword>
</component> </component>
<component description = "Core USB Audio Module" type = "demoCode" scope = "General Use" path = "module_usb_audio" local = "false" id = "module_usb_audio" name = "USB AUDIO MODULE"> <component description = "Core USB Audio Module" type = "demoCode" scope = "General Use" path = "module_usb_audio" local = "false" id = "module_usb_audio" name = "USB AUDIO MODULE">
@@ -16,16 +15,10 @@
</component> </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"> <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> <board></board>
<componentDependency version = "6.13.0">module_queue</componentDependency> <componentDependency version = "6.14.0">module_queue</componentDependency>
<componentDependency repo = "git://github.com/xmos/lib_xassert.git">lib_xassert</componentDependency>
<keyword>MIDI</keyword> <keyword>MIDI</keyword>
</component> </component>
</components> </components>
<dependency repo = "lib_xassert">
<gitbranch>master</gitbranch>
<githash>9c4955e3ab0604e6ba4b66ad46e01b5d96d5d6fb</githash>
<uri>git@github.com:xmos/lib_xassert.git</uri>
</dependency>
<description>USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.</description> <description>USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.</description>
<docdir>module_dfu/doc</docdir> <docdir>module_dfu/doc</docdir>
<git_export>False</git_export> <git_export>False</git_export>
@@ -112,4 +105,4 @@
<version_define name = "BCD_DEVICE_N" format = "%POINT%"></version_define> <version_define name = "BCD_DEVICE_N" format = "%POINT%"></version_define>
</version_defines> </version_defines>
<xpd_version>1.0</xpd_version> <xpd_version>1.0</xpd_version>
</xpd> </xpd>