forked from PAWPAW-Mirror/lib_xua
Resolved conflicts merging with develop
This commit is contained in:
@@ -1,860 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="com.xmos.cdt.toolchain.1285928753">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.xmos.cdt.toolchain.1285928753" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="com.xmos.cdt.core.XdeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.xmos.cdt.core.XEBinaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration buildProperties="" description="" id="com.xmos.cdt.toolchain.1285928753" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="com.xmos.cdt.toolchain.1285928753.790908561" name="/" resourcePath="">
|
||||
<toolChain id="com.xmos.cdt.toolchain.1969897956" name="com.xmos.cdt.toolchain" superClass="com.xmos.cdt.toolchain">
|
||||
<targetPlatform archList="all" binaryParser="com.xmos.cdt.core.XEBinaryParser;org.eclipse.cdt.core.GNU_ELF" id="com.xmos.cdt.core.platform.1615568037" isAbstract="false" osList="linux,win32,macosx" superClass="com.xmos.cdt.core.platform"/>
|
||||
<builder arguments="-f .makefile" id="com.xmos.cdt.builder.base.45159417" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="com.xmos.cdt.builder.base">
|
||||
<outputEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="outputPath" name="bin"/>
|
||||
</outputEntries>
|
||||
</builder>
|
||||
<tool id="com.xmos.cdt.xc.compiler.404499215" name="com.xmos.cdt.xc.compiler" superClass="com.xmos.cdt.xc.compiler">
|
||||
<option id="com.xmos.xc.compiler.option.defined.symbols.1492092903" name="com.xmos.xc.compiler.option.defined.symbols" superClass="com.xmos.xc.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__XC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//cc8JvR3b.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.xc.compiler.option.include.paths.834699451" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/xc""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.xc.compiler.input.2062798368" name="XC" superClass="com.xmos.cdt.xc.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="com.xmos.cdt.c.compiler.1931691289" name="com.xmos.cdt.c.compiler" superClass="com.xmos.cdt.c.compiler">
|
||||
<option id="com.xmos.c.compiler.option.defined.symbols.534062814" name="com.xmos.c.compiler.option.defined.symbols" superClass="com.xmos.c.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang_major__=3"/>
|
||||
<listOptionValue builtIn="false" value="__clang_minor__=6"/>
|
||||
<listOptionValue builtIn="false" value="__clang_patchlevel__=0"/>
|
||||
<listOptionValue builtIn="false" value="__clang_version__="3.6.0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_RTTI=1"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_C_SUFFIX__=U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_STDC_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_BOOL_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_SHORT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_INT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LLONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_POINTER_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_VERSION__=199901L"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//ccVdKn1b.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.c.compiler.option.include.paths.1661660573" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.c.compiler.input.c.1188610778" name="C" superClass="com.xmos.cdt.c.compiler.input.c"/>
|
||||
</tool>
|
||||
<tool id="com.xmos.cdt.cxx.compiler.1403352573" name="com.xmos.cdt.cxx.compiler" superClass="com.xmos.cdt.cxx.compiler">
|
||||
<option id="com.xmos.cxx.compiler.option.defined.symbols.665306874" name="com.xmos.cxx.compiler.option.defined.symbols" superClass="com.xmos.cxx.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang_major__=3"/>
|
||||
<listOptionValue builtIn="false" value="__clang_minor__=6"/>
|
||||
<listOptionValue builtIn="false" value="__clang_patchlevel__=0"/>
|
||||
<listOptionValue builtIn="false" value="__clang_version__="3.6.0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_RTTI=1"/>
|
||||
<listOptionValue builtIn="false" value="__DEPRECATED=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_WEAK__=1"/>
|
||||
<listOptionValue builtIn="false" value="__private_extern__=extern"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_C_SUFFIX__=U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_GNU_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_BOOL_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_SHORT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_INT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LLONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_POINTER_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__cplusplus=199711L"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//cc8vh80e.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.cxx.compiler.option.include.paths.1031009526" name="com.xmos.cxx.compiler.option.include.paths" superClass="com.xmos.cxx.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/c++/v1""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.cxx.compiler.input.cpp.223196941" name="C++" superClass="com.xmos.cdt.cxx.compiler.input.cpp"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding=".build*" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="lib_xua.null.1378855182" name="lib_xua"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
</cproject>
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>lib_xua</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.ProjectInfoSyncBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.LegacyProjectCheckerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.ModulePathBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</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>
|
||||
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><xproject><repository>lib_xua</repository><partnum>XM-012639-SM</partnum></xproject>
|
||||
@@ -1,20 +1,22 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// Copyright 2017-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef _XUA_H_
|
||||
#define _XUA_H_
|
||||
|
||||
#ifndef __XUA_H__
|
||||
#define __XUA_H__
|
||||
#include <xs1.h>
|
||||
|
||||
#include "xua_conf_full.h"
|
||||
|
||||
#if __XC__ || __STDC__
|
||||
#ifndef __ASSEMBLER__
|
||||
#include "xua_audiohub.h"
|
||||
|
||||
#include "xua_endpoint0.h"
|
||||
|
||||
#include "xua_buffer.h"
|
||||
#include "xua_mixer.h"
|
||||
#endif
|
||||
|
||||
#if __XC__
|
||||
#ifdef __XC__
|
||||
#include "xua_clocking.h"
|
||||
#include "xua_midi.h"
|
||||
#if XUA_NUM_PDM_MICS > 0
|
||||
#include "xua_pdm_mic.h"
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __XUA_AUDIOHUB_H__
|
||||
#define __XUA_AUDIOHUB_H__
|
||||
#ifndef _XUA_AUDIOHUB_H_
|
||||
#define _XUA_AUDIOHUB_H_
|
||||
|
||||
#if __XC__
|
||||
#ifdef __XC__
|
||||
|
||||
#include "xccompat.h"
|
||||
#include "xs1.h"
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* \param clk_audio_mclk Nullable clockblock to be clocked from master clock
|
||||
*
|
||||
* \param clk_audio_mclk Nullable clockblock to be clocked from i2s clock
|
||||
* \param clk_audio_bclk Nullable clockblock to be clocked from i2s bit clock
|
||||
*
|
||||
* \param p_mclk_in Master clock inport port (must be 1-bit)
|
||||
*
|
||||
@@ -34,21 +34,23 @@
|
||||
*
|
||||
* \param p_i2s_adc Nullable array of ports for I2S data input lines
|
||||
*
|
||||
* \param c_dig channel connected to the clockGen() thread for
|
||||
* \param c_spdif_tx Channel connected to S/PDIF transmiter core from lib_spdif
|
||||
*
|
||||
* \param c_dig Channel connected to the clockGen() thread for
|
||||
* receiving/transmitting samples
|
||||
*/
|
||||
void XUA_AudioHub(chanend ?c_aud,
|
||||
clock ?clk_audio_mclk,
|
||||
clock ?clk_audio_bclk,
|
||||
void XUA_AudioHub(chanend ?c_aud,
|
||||
clock ?clk_audio_mclk,
|
||||
clock ?clk_audio_bclk,
|
||||
in port p_mclk_in,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_lrclk,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_bclk,
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]
|
||||
#if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
#if (XUA_SPDIF_TX_EN) || defined(__DOXYGEN__)
|
||||
, chanend c_spdif_tx
|
||||
#endif
|
||||
#if((SPDIF_RX) || (ADAT_RX))
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN || defined(__DOXYGEN__))
|
||||
, chanend c_dig
|
||||
#endif
|
||||
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
|
||||
@@ -78,4 +80,4 @@ void UserBufferManagementInit();
|
||||
|
||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
|
||||
|
||||
#endif // __XUA_AUDIOHUB_H__
|
||||
#endif // _XUA_AUDIOHUB_H_
|
||||
|
||||
@@ -1,72 +1,63 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __XUA_BUFFER_H__
|
||||
#define __XUA_BUFFER_H__
|
||||
|
||||
#if __XC__
|
||||
|
||||
#include "xua.h"
|
||||
#include "xua_clocking.h" /* Required for pll_ref_if */
|
||||
|
||||
/** USB Audio Buffering Core.
|
||||
/** USB Audio Buffering Core(s).
|
||||
*
|
||||
* This function buffers USB audio data between the XUD layer and the decouple
|
||||
* thread. Most of the chanend parameters to the function should be connected to
|
||||
* XUD_Manager()
|
||||
* This function buffers USB audio data between the XUD and the audio subsystem.
|
||||
* Most of the chanend parameters to the function should be connected to
|
||||
* XUD_Manager(). The uses two cores.
|
||||
*
|
||||
* \param c_aud_out Audio OUT endpoint channel connected to the XUD
|
||||
* \param c_aud_in Audio IN endpoint channel connected to the XUD
|
||||
* \param c_aud_fb Audio feedback endpoint channel connected to the XUD
|
||||
* \param c_midi_from_host MIDI OUT endpoint channel connected to the XUD
|
||||
* \param c_midi_to_host MIDI IN endpoint channel connected to the XUD
|
||||
* \param c_int Audio clocking interrupt endpoint channel connected to the XUD
|
||||
* \param c_clk_int Optional chanend connected to the clockGen() thread if present
|
||||
* \param c_sof Start of frame channel connected to the XUD
|
||||
* \param c_aud_ctl Audio control channel connected to Endpoint0()
|
||||
* \param p_off_mclk A port that is clocked of the MCLK input (not the MCLK input itself)
|
||||
* \param c_aud_out Audio OUT endpoint channel connected to the XUD
|
||||
* \param c_aud_in Audio IN endpoint channel connected to the XUD
|
||||
* \param c_aud_fb Audio feedback endpoint channel connected to the XUD
|
||||
* \param c_midi_from_host MIDI OUT endpoint channel connected to the XUD
|
||||
* \param c_midi_to_host MIDI IN endpoint channel connected to the XUD
|
||||
* \param c_midi Channel connected to MIDI core
|
||||
* \param c_int Audio clocking interrupt endpoint channel connected to the XUD
|
||||
* \param c_clk_int Optional chanend connected to the clockGen() thread if present
|
||||
* \param c_sof Start of frame channel connected to the XUD
|
||||
* \param c_aud_ctl Audio control channel connected to Endpoint0()
|
||||
* \param p_off_mclk A port that is clocked of the MCLK input (not the MCLK input itself)
|
||||
* \param c_aud Channel connected to XUA_AudioHub() core
|
||||
* \param i_pll_ref Interface to task that toggles reference pin to CS2100
|
||||
*/
|
||||
|
||||
void XUA_Buffer(
|
||||
chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
#if (NUM_USB_CHAN_IN > 0) || defined(__DOXYGEN__)
|
||||
chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
chanend c_aud_fb,
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
#if defined(MIDI) || defined(__DOXYGEN__)
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
#ifdef IAP_INT_EP
|
||||
chanend c_iap_to_host_int,
|
||||
#endif
|
||||
chanend c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
chanend c_iap_ea_native_out,
|
||||
chanend c_iap_ea_native_in,
|
||||
chanend c_iap_ea_native_ctrl,
|
||||
chanend c_iap_ea_native_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN || defined(__DOXYGEN__)
|
||||
chanend ?c_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#if (HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOXYGEN__)
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
);
|
||||
|
||||
void XUA_Buffer_Ep(chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
#if (NUM_USB_CHAN_IN > 0) || defined(__DOXYGEN__)
|
||||
chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
@@ -77,32 +68,21 @@ void XUA_Buffer_Ep(chanend c_aud_out,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
#ifdef IAP_INT_EP
|
||||
chanend c_iap_to_host_int,
|
||||
#endif
|
||||
chanend c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
chanend c_iap_ea_native_out,
|
||||
chanend c_iap_ea_native_in,
|
||||
chanend c_iap_ea_native_ctrl,
|
||||
chanend c_iap_ea_native_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
chanend ?c_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#if (HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOXYGEN__)
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -116,7 +96,5 @@ void XUA_Buffer_Decouple(chanend c_audio_out
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,20 +1,32 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _CLOCKING_H_
|
||||
#define _CLOCKING_H_
|
||||
|
||||
#include <xs1.h>
|
||||
|
||||
interface pll_ref_if
|
||||
{
|
||||
void toggle();
|
||||
void init();
|
||||
void toggle_timed(int relative);
|
||||
};
|
||||
|
||||
[[distributable]]
|
||||
void PllRefPinTask(server interface pll_ref_if i_pll_ref, out port p_sync);
|
||||
|
||||
/** Clock generation and digital audio I/O handling.
|
||||
*
|
||||
* \param c_spdif_rx channel connected to S/PDIF receive thread
|
||||
* \param c_adat_rx channel connect to ADAT receive thread
|
||||
* \param p port to output clock signal to drive external frequency synthesizer
|
||||
* \param i_pll_ref interface to taslk that outputs clock signal to drive external frequency synthesizer
|
||||
* \param c_audio channel connected to the audio() thread
|
||||
* \param c_clk_ctl channel connected to Endpoint0() for configuration of the
|
||||
* clock
|
||||
* \param c_clk_int channel connected to the decouple() thread for clock
|
||||
interrupts
|
||||
*/
|
||||
void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int);
|
||||
void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface pll_ref_if i_pll_ref, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/*
|
||||
* @brief Defines relating to device configuration and customisation of lib_xua
|
||||
@@ -11,29 +11,20 @@
|
||||
#include "xua_conf.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Default tile arrangement */
|
||||
|
||||
/**
|
||||
* @brief Location (tile) of audio I/O. Default: 0
|
||||
*/
|
||||
#ifndef AUDIO_IO_TILE
|
||||
#define AUDIO_IO_TILE 0
|
||||
#define AUDIO_IO_TILE (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Location (tile) of audio I/O. Default: 0
|
||||
*/
|
||||
#ifndef XUD_TILE
|
||||
#define XUD_TILE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Location (tile) of IAP. Default: AUDIO_IO_TILE
|
||||
*/
|
||||
#ifndef IAP_TILE
|
||||
#define IAP_TILE AUDIO_IO_TILE
|
||||
#define XUD_TILE (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -57,11 +48,18 @@
|
||||
#define PDM_TILE AUDIO_IO_TILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Disable USB functionalty just leaving AudioHub
|
||||
/**
|
||||
* @brief Location (tile) of reference signal to CS2100. Default: AUDIO_IO_TILE
|
||||
*/
|
||||
#ifndef PLL_REF_TILE
|
||||
#define PLL_REF_TILE AUDIO_IO_TILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Disable USB functionalty just leaving AudioHub
|
||||
*/
|
||||
#ifndef XUA_USB_EN
|
||||
#define XUA_USB_EN 1
|
||||
#define XUA_USB_EN (1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -83,7 +81,7 @@
|
||||
/**
|
||||
* @brief Number of DSD output channels. Default: 0 (disabled)
|
||||
*/
|
||||
#if defined(DSD_CHANS_DAC)
|
||||
#if defined(DSD_CHANS_DAC) && (DSD_CHANS_DAC != 0)
|
||||
#if defined(NATIVE_DSD) && (NATIVE_DSD == 0)
|
||||
#undef NATIVE_DSD
|
||||
#else
|
||||
@@ -93,20 +91,25 @@
|
||||
#define DSD_CHANS_DAC 0
|
||||
#endif
|
||||
|
||||
#define XUA_PCM_FORMAT_I2S (0)
|
||||
#define XUA_PCM_FORMAT_TDM (1)
|
||||
|
||||
/* TODO not required */
|
||||
#ifndef I2S_MODE_TDM
|
||||
#define I2S_MODE_TDM 0
|
||||
#ifdef XUA_PCM_FORMAT
|
||||
#if (XUA_PCM_FORMAT != XUA_PCM_FORMAT_I2S) && (XUA_PCM_FORMAT != XUA_PCM_FORMAT_TDM)
|
||||
#error Bad value for XUA_PCM_FORMAT
|
||||
#endif
|
||||
#else
|
||||
#define XUA_PCM_FORMAT XUA_PCM_FORMAT_I2S
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Channels per I2S frame. *
|
||||
*
|
||||
* Default: 2 i.e standard stereo I2S (8 if using TDM i.e. I2S_MODE_TDM).
|
||||
* Default: 2 i.e standard stereo I2S (8 if using TDM i.e. XUA_PCM_FORMAT_TDM).
|
||||
*
|
||||
**/
|
||||
#ifndef I2S_CHANS_PER_FRAME
|
||||
#if (I2S_MODE_TDM == 1)
|
||||
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
#define I2S_CHANS_PER_FRAME 8
|
||||
#else
|
||||
#define I2S_CHANS_PER_FRAME 2
|
||||
@@ -183,7 +186,7 @@
|
||||
*/
|
||||
#if (I2S_DOWNSAMPLE_MONO_IN == 1)
|
||||
#define I2S_DOWNSAMPLE_CHANS_IN (I2S_CHANS_ADC / 2)
|
||||
#if ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && (I2S_MODE_TDM == 1))
|
||||
#if ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM))
|
||||
#error Mono I2S input downsampling is not avaliable in TDM mode
|
||||
#endif
|
||||
#else
|
||||
@@ -333,13 +336,8 @@
|
||||
/**
|
||||
* @brief Enables ADAT Tx. Default: 0 (Disabled)
|
||||
*/
|
||||
#ifndef ADAT_TX
|
||||
#define ADAT_TX (0)
|
||||
#endif
|
||||
|
||||
/* Tidy up old SPDIF usage */
|
||||
#if defined(ADAT_TX) && (ADAT_TX == 0)
|
||||
#undef ADAT_TX
|
||||
#ifndef XUA_ADAT_TX_EN
|
||||
#define XUA_ADAT_TX_EN (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -354,15 +352,15 @@
|
||||
/**
|
||||
* @brief Enables SPDIF Rx. Default: 0 (Disabled)
|
||||
*/
|
||||
#ifndef SPDIF_RX
|
||||
#define SPDIF_RX (0)
|
||||
#ifndef XUA_SPDIF_RX_EN
|
||||
#define XUA_SPDIF_RX_EN (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables ADAT Rx. Default: 0 (Disabled)
|
||||
*/
|
||||
#ifndef ADAT_RX
|
||||
#define ADAT_RX (0)
|
||||
#ifndef XUA_ADAT_RX_EN
|
||||
#define XUA_ADAT_RX_EN (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -371,9 +369,9 @@
|
||||
*
|
||||
* Default: NONE (Must be defined by app when SPDIF_RX enabled)
|
||||
*/
|
||||
#if (SPDIF_RX) || defined (__DOXYGEN__)
|
||||
#if (XUA_SPDIF_RX_EN) || defined (__DOXYGEN__)
|
||||
#ifndef SPDIF_RX_INDEX
|
||||
#error SPDIF_RX_INDEX not defined and SPDIF_RX defined
|
||||
#error SPDIF_RX_INDEX not defined and XUA_SPDIF_RX_EN defined
|
||||
#define SPDIF_RX_INDEX 0 /* Default define for doxygen */
|
||||
#endif
|
||||
#endif
|
||||
@@ -382,11 +380,11 @@
|
||||
* @brief ADAT Rx first channel index. defines which channels ADAT will be input on.
|
||||
* Note, indexed from 0.
|
||||
*
|
||||
* Default: NONE (Must be defined by app when ADAT_RX enabled)
|
||||
* Default: NONE (Must be defined by app when XUA_ADAT_RX_EN is true)
|
||||
*/
|
||||
#if (ADAT_RX) || defined(__DOXYGEN__)
|
||||
#if (XUA_ADAT_RX_EN) || defined(__DOXYGEN__)
|
||||
#ifndef ADAT_RX_INDEX
|
||||
#error ADAT_RX_INDEX not defined and ADAT_RX defined
|
||||
#error ADAT_RX_INDEX not defined and XUA_ADAT_RX_EN is true
|
||||
#define ADAT_RX_INDEX (0) /* Default define for doxygen */
|
||||
#endif
|
||||
|
||||
@@ -395,7 +393,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
|
||||
/* Setup input stream formats for ADAT */
|
||||
#if(MAX_FREQ > 96000)
|
||||
@@ -433,7 +431,8 @@
|
||||
#define HID_CONTROLS (0)
|
||||
#endif
|
||||
|
||||
/* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
||||
/**
|
||||
* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
||||
*
|
||||
* 0: XMOS is I2S master. 1: CODEC is I2s master.
|
||||
*
|
||||
@@ -452,7 +451,6 @@
|
||||
#define SERIAL_STR ""
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Vendor String used by the device. This is also pre-pended to various strings used by the design.
|
||||
*
|
||||
@@ -959,43 +957,32 @@
|
||||
|
||||
/* Power */
|
||||
|
||||
#define XUA_POWERMODE_SELF (0)
|
||||
#define XUA_POWERMODE_BUS (1)
|
||||
/**
|
||||
* @brief Report as self to the host when enabled, else reports as bus-powered. This affects descriptors
|
||||
* and XUD usage.
|
||||
* @brief Report as self or bus powered device. This affects descriptors
|
||||
* and XUD usage and is important for USB compliance
|
||||
*
|
||||
* Default: 0 (Disabled)
|
||||
* Default: XUA_POWERMODE_BUS
|
||||
*/
|
||||
#ifndef SELF_POWERED
|
||||
#define SELF_POWERED (0)
|
||||
#endif
|
||||
|
||||
/* Tidy-up historical ifndef usage */
|
||||
#if defined(SELF_POWERED) && (SELF_POWERED==0)
|
||||
#undef SELF_POWERED
|
||||
#ifndef XUA_POWERMODE
|
||||
#define XUA_POWERMODE XUA_POWERMODE_BUS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Power drawn from the host (in mA x 2)
|
||||
*
|
||||
* Default: 0 when SELF_POWERED enabled else 250 (500mA)
|
||||
* Default: 0 when self-powered, else 250 (500mA)
|
||||
*/
|
||||
#ifdef SELF_POWERED
|
||||
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
|
||||
/* Default to taking no power from the bus in self-powered mode */
|
||||
#ifndef BMAX_POWER
|
||||
#define BMAX_POWER 0
|
||||
#ifndef _XUA_BMAX_POWER
|
||||
#define _XUA_BMAX_POWER (0)
|
||||
#endif
|
||||
#else
|
||||
/* Default to taking 500mA from the bus in bus-powered mode */
|
||||
#ifndef BMAX_POWER
|
||||
#define BMAX_POWER 250
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef XUD_PWR_CFG
|
||||
#ifdef SELF_POWERED
|
||||
#define XUD_PWR_CFG XUD_PWR_SELF
|
||||
#else
|
||||
#define XUD_PWR_CFG XUD_PWR_BUS
|
||||
#ifndef _XUA_BMAX_POWER
|
||||
#define _XUA_BMAX_POWER (250)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1010,17 +997,12 @@
|
||||
#define MIXER (0)
|
||||
#endif
|
||||
|
||||
/* Tidy up old ifndef usage */
|
||||
#if defined(MIXER) && (MIXER == 0)
|
||||
#undef MIXER
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Number of seperate mixes to perform
|
||||
*
|
||||
* Default: 8 if MIXER enabled, else 0
|
||||
*/
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
#ifndef MAX_MIX_COUNT
|
||||
#define MAX_MIX_COUNT (8)
|
||||
#endif
|
||||
@@ -1100,82 +1082,55 @@
|
||||
#define VOLUME_RES_MIXER (0x100)
|
||||
#endif
|
||||
|
||||
/* Handle out volume control in the mixer */
|
||||
#if defined(OUT_VOLUME_IN_MIXER) && (OUT_VOLUME_IN_MIXER==0)
|
||||
#undef OUT_VOLUME_IN_MIXER
|
||||
#else
|
||||
#if defined(MIXER)
|
||||
// Disabled by default
|
||||
//#define OUT_VOLUME_IN_MIXER
|
||||
#endif
|
||||
/* Handle out volume control in the mixer - enabled by default */
|
||||
#ifndef OUT_VOLUME_IN_MIXER
|
||||
#define OUT_VOLUME_IN_MIXER (1)
|
||||
#endif
|
||||
|
||||
/* Apply out volume controls after the mix */
|
||||
#if defined(OUT_VOLUME_AFTER_MIX) && (OUT_VOLUME_AFTER_MIX==0)
|
||||
#undef OUT_VOLUME_AFTER_MIX
|
||||
#else
|
||||
#if defined(MIXER) && defined(OUT_VOLUME_IN_MIXER)
|
||||
// Enabled by default
|
||||
#define OUT_VOLUME_AFTER_MIX
|
||||
#endif
|
||||
/* Apply out volume controls after the mix. Only relevant when OUT_VOLUME_IN_MIXER enabled. Enabled by default */
|
||||
#ifndef OUT_VOLUME_AFTER_MIX
|
||||
#define OUT_VOLUME_AFTER_MIX (1)
|
||||
#endif
|
||||
|
||||
/* Handle in volume control in the mixer */
|
||||
#if defined(IN_VOLUME_IN_MIXER) && (IN_VOLUME_IN_MIXER==0)
|
||||
#undef IN_VOLUME_IN_MIXER
|
||||
#else
|
||||
#if defined(MIXER)
|
||||
/* Disabled by default */
|
||||
//#define IN_VOLUME_IN_MIXER
|
||||
#endif
|
||||
/* Handle in volume control in the mixer - disabled by default */
|
||||
#ifndef IN_VOLUME_IN_MIXER
|
||||
#define IN_VOLUME_IN_MIXER (0)
|
||||
#endif
|
||||
|
||||
/* Apply in volume controls after the mix */
|
||||
#if defined(IN_VOLUME_AFTER_MIX) && (IN_VOLUME_AFTER_MIX==0)
|
||||
#undef IN_VOLUME_AFTER_MIX
|
||||
#else
|
||||
#if defined(MIXER) && defined(IN_VOLUME_IN_MIXER)
|
||||
// Enabled by default
|
||||
#define IN_VOLUME_AFTER_MIX
|
||||
#endif
|
||||
/* Apply in volume controls after the mix. Only relebant when IN_VOLUMNE_IN MIXER enabled. Enabled by default */
|
||||
#ifndef IN_VOLUME_AFTER_MIX
|
||||
#define IN_VOLUME_AFTER_MIX (1)
|
||||
#endif
|
||||
|
||||
/* IAP */
|
||||
#if defined(IAP) && (IAP == 0)
|
||||
#undef IAP
|
||||
/* Always enable explicit feedback EP, even when input stream is present */
|
||||
#ifndef UAC_FORCE_FEEDBACK_EP
|
||||
#define UAC_FORCE_FEEDBACK_EP (1)
|
||||
#endif
|
||||
|
||||
/* IAP Interrupt endpoint */
|
||||
#if defined(IAP_INT_EP) && (IAP_INT_EP == 0)
|
||||
#undef IAP_INT_EP
|
||||
#endif
|
||||
|
||||
/* IAP EA Native Transport */
|
||||
#if defined(IAP_EA_NATIVE_TRANS) && (IAP_EA_NATIVE_TRANS == 0)
|
||||
#undef IAP_EA_NATIVE_TRANS
|
||||
#endif
|
||||
|
||||
#if defined(IAP_EA_NATIVE_TRANS) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Number of supported EA Native Interface Alternative settings.
|
||||
*
|
||||
* Only 1 supported
|
||||
*/
|
||||
#ifndef IAP_EA_NATIVE_TRANS_ALT_COUNT
|
||||
#define IAP_EA_NATIVE_TRANS_ALT_COUNT 1
|
||||
#endif
|
||||
|
||||
#if (IAP_EA_NATIVE_TRANS_ALT_COUNT > 1)
|
||||
/* Only 1 supported */
|
||||
#error
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(UAC_FORCE_FEEDBACK_EP) && UAC_FORCE_FEEDBACK_EP == 0)
|
||||
#undef UAC_FORCE_FEEDBACK_EP
|
||||
#endif
|
||||
|
||||
/* Synchronisation defines */
|
||||
#define XUA_SYNCMODE_ASYNC (1) // USB_ENDPOINT_SYNCTYPE_ASYNC
|
||||
#define XUA_SYNCMODE_ADAPT (2) // USB_ENDPOINT_SYNCTYPE_ADAPT
|
||||
#define XUA_SYNCMODE_SYNC (3) // USB_ENDPOINT_SYNCTYPE_SYNC
|
||||
|
||||
#ifndef XUA_SYNCMODE
|
||||
#define XUA_SYNCMODE XUA_SYNCMODE_ASYNC
|
||||
#endif
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
#if (XUA_SPDIF_RX_EN|| ADAT_RX)
|
||||
#error "Digital input streams not supported in Sync mode"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/*** Internal defines below here. NOT FOR MODIFICATION ***/
|
||||
/*********************************************************/
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
/* Endpoint addresses enums */
|
||||
enum USBEndpointNumber_In
|
||||
@@ -1185,7 +1140,7 @@ enum USBEndpointNumber_In
|
||||
ENDPOINT_NUMBER_IN_FEEDBACK,
|
||||
#endif
|
||||
ENDPOINT_NUMBER_IN_AUDIO,
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
@@ -1222,50 +1177,44 @@ enum USBEndpointNumber_Out
|
||||
XUA_ENDPOINT_COUNT_OUT /* End marker */
|
||||
};
|
||||
|
||||
|
||||
#ifndef XUA_ENDPOINT_COUNT_CUSTOM_OUT
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_OUT 0
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_OUT (0)
|
||||
#endif
|
||||
|
||||
#ifndef XUA_ENDPOINT_COUNT_CUSTOM_IN
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_IN 0
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_IN (0)
|
||||
#endif
|
||||
|
||||
#define ENDPOINT_COUNT_IN (XUA_ENDPOINT_COUNT_IN + XUA_ENDPOINT_COUNT_CUSTOM_IN)
|
||||
#define ENDPOINT_COUNT_OUT (XUA_ENDPOINT_COUNT_OUT + XUA_ENDPOINT_COUNT_CUSTOM_OUT)
|
||||
#define ENDPOINT_COUNT_IN (XUA_ENDPOINT_COUNT_IN + XUA_ENDPOINT_COUNT_CUSTOM_IN)
|
||||
#define ENDPOINT_COUNT_OUT (XUA_ENDPOINT_COUNT_OUT + XUA_ENDPOINT_COUNT_CUSTOM_OUT)
|
||||
|
||||
#endif
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
/*** Internal defines below here. NOT FOR MODIFICATION ***/
|
||||
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
||||
#define AUDIO_START_FROM_DFU (0x87654321)
|
||||
#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5)
|
||||
|
||||
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
||||
#define AUDIO_START_FROM_DFU (0x87654321)
|
||||
#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5)
|
||||
|
||||
#define MAX_VOL (0x20000000)
|
||||
|
||||
#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0)
|
||||
#undef SU1_ADC_ENABLE
|
||||
#endif
|
||||
/* Result of db_to_mult(MAX_VOLUME, 8, 29) */
|
||||
#define MAX_VOLUME_MULT (0x20000000)
|
||||
|
||||
#if defined(LEVEL_METER_LEDS) && !defined(LEVEL_UPDATE_RATE)
|
||||
#define LEVEL_UPDATE_RATE 400000
|
||||
#define LEVEL_UPDATE_RATE (400000)
|
||||
#endif
|
||||
|
||||
/* The number of clock ticks to wait for the audio feeback to stabalise
|
||||
* Note, feedback always counts 128 SOFs (16ms @ HS, 128ms @ FS) */
|
||||
#ifndef FEEDBACK_STABILITY_DELAY_HS
|
||||
#define FEEDBACK_STABILITY_DELAY_HS (2000000)
|
||||
#define FEEDBACK_STABILITY_DELAY_HS (2000000)
|
||||
#endif
|
||||
|
||||
#ifndef FEEDBACK_STABILITY_DELAY_FS
|
||||
#define FEEDBACK_STABILITY_DELAY_FS (20000000)
|
||||
#define FEEDBACK_STABILITY_DELAY_FS (20000000)
|
||||
#endif
|
||||
|
||||
/* Length of clock unit/clock-selector units */
|
||||
#if (SPDIF_RX) && (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) && (XUA_ADAT_RX_EN)
|
||||
#define NUM_CLOCKS (3)
|
||||
#elif (SPDIF_RX) || (ADAT_RX)
|
||||
#elif (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
#define NUM_CLOCKS (2)
|
||||
#else
|
||||
#define NUM_CLOCKS (1)
|
||||
@@ -1346,9 +1295,9 @@ enum USBEndpointNumber_Out
|
||||
/* Some defines that allow us to remove unused code */
|
||||
|
||||
/* Useful for dropping lower part of macs in volume processing... */
|
||||
#if (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || \
|
||||
(FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || \
|
||||
(HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24)
|
||||
#if (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || \
|
||||
(((FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 1)) || \
|
||||
(((FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 2))
|
||||
#define STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED 1
|
||||
#else
|
||||
#define STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED 0
|
||||
@@ -1480,6 +1429,7 @@ enum USBEndpointNumber_Out
|
||||
#define _XUA_CLK_DIR out
|
||||
#endif
|
||||
|
||||
#if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0)
|
||||
#error CODEC_MASTER with DSD is currently unsupported
|
||||
#if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0)
|
||||
#error CODEC_MASTER with DSD is currently unsupported
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// Copyright 2017-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __XUA_CONF_FULL_H__
|
||||
#define __XUA_CONF_FULL_H__
|
||||
#ifndef _XUA_CONF_FULL_H_
|
||||
#define _XUA_CONF_FULL_H_
|
||||
|
||||
#ifdef __xua_conf_h_exists__
|
||||
#include "xua_conf.h"
|
||||
@@ -9,6 +9,4 @@
|
||||
|
||||
#include "xua_conf_default.h"
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,33 +1,41 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _XUA_ENDPOINT0_H_
|
||||
#define _XUA_ENDPOINT0_H_
|
||||
|
||||
#include "xua.h"
|
||||
#include "dfu_interface.h"
|
||||
#include "vendorrequests.h"
|
||||
|
||||
#if __XC__
|
||||
/** Function implementing Endpoint 0 for enumeration, control and configuration
|
||||
* of USB audio devices. It uses the descriptors defined in ``descriptors_2.h``.
|
||||
*
|
||||
* \param c_ep0_out Chanend connected to the XUD_Manager() out endpoint array
|
||||
* \param c_ep0_in Chanend connected to the XUD_Manager() in endpoint array
|
||||
* \param c_audioCtrl Chanend connected to the decouple thread for control
|
||||
* audio (sample rate changes etc.)
|
||||
* \param c_mix_ctl Optional chanend to be connected to the mixer thread if
|
||||
* present
|
||||
* \param c_clk_ctl Optional chanend to be connected to the clockgen thread if
|
||||
* present.
|
||||
* \param c_usb_test Optional chanend to be connected to XUD if test modes required.
|
||||
* of USB audio devices. It uses the descriptors defined in ``xua_ep0_descriptors.h``.
|
||||
*
|
||||
* \param c_ep0_out Chanend connected to the XUD_Manager() out endpoint array
|
||||
* \param c_ep0_in Chanend connected to the XUD_Manager() in endpoint array
|
||||
* \param c_audioCtrl Chanend connected to the decouple thread for control
|
||||
* audio (sample rate changes etc.). Note when nulled, the
|
||||
* audio device only supports single sample rate/format and
|
||||
* DFU is not supported either since this channel is used
|
||||
* to carry messages about format, rate and DFU state
|
||||
* \param c_mix_ctl Optional chanend to be connected to the mixer core(s) if
|
||||
* present
|
||||
* \param c_clk_ctl Optional chanend to be connected to the clockgen core if
|
||||
* present
|
||||
* \param dfuInterface Interface to DFU task (this task must be run on a tile
|
||||
* connected to boot flash.
|
||||
* \param c_EANativeTransport_ctrl Optional chanend to be connected to EA Native
|
||||
* endpoint manager if present
|
||||
*/
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
|
||||
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu ?dfuInterface
|
||||
VENDOR_REQUESTS_PARAMS_DEC_);
|
||||
void XUA_Endpoint0(chanend c_ep0_out,
|
||||
chanend c_ep0_in, chanend ?c_audioCtrl,
|
||||
chanend ?c_mix_ctl, chanend ?c_clk_ctl,
|
||||
chanend ?c_EANativeTransport_ctrl,
|
||||
client interface i_dfu ?dfuInterface
|
||||
#if !defined(__DOXYGEN__)
|
||||
VENDOR_REQUESTS_PARAMS_DEC_
|
||||
#endif
|
||||
);
|
||||
|
||||
/** Function to set the Vendor ID value
|
||||
*
|
||||
|
||||
@@ -1,34 +1,40 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __usb_midi_h__
|
||||
#define __usb_midi_h__
|
||||
#ifndef _XUA_MIDI_H_
|
||||
#define _XUA_MIDI_H_
|
||||
|
||||
#include "xua.h"
|
||||
|
||||
/** USB MIDI I/O thread.
|
||||
#ifndef MIDI_SHIFT_TX
|
||||
#define MIDI_SHIFT_TX (0)
|
||||
#endif
|
||||
|
||||
/** USB MIDI I/O task.
|
||||
*
|
||||
* This function passes MIDI data from USB to UART I/O.
|
||||
* This function passes MIDI data between XUA_Buffer and MIDI UART I/O.
|
||||
*
|
||||
* \param p_midi_in 1-bit input port for MIDI
|
||||
* \param p_midi_out 1-bit output port for MIDI
|
||||
* \param clk_midi clock block used for clockin the UART; should have
|
||||
* a rate of 100MHz
|
||||
* \param c_midi chanend connected to the decouple() thread
|
||||
* \param cable_number the cable number of the MIDI implementation.
|
||||
* \param p_midi_in 1-bit input port for MIDI
|
||||
* \param p_midi_out 1-bit output port for MIDI
|
||||
* \param clk_midi Clock block used for clockin the UART; should have
|
||||
* a rate of 100MHz
|
||||
* \param c_midi Chanend connected to the decouple() thread
|
||||
* \param cable_number The cable number of the MIDI implementation.
|
||||
* This should be set to 0.
|
||||
**/
|
||||
void usb_midi(
|
||||
#if (MIDI_RX_PORT_WIDTH == 4)
|
||||
buffered in port:4 ?p_midi_in,
|
||||
buffered in port:4 ?p_midi_in,
|
||||
#else
|
||||
buffered in port:1 ?p_midi_in,
|
||||
buffered in port:1 ?p_midi_in,
|
||||
#endif
|
||||
port ?p_midi_out,
|
||||
clock ?clk_midi,
|
||||
chanend ?c_midi,
|
||||
unsigned cable_number,
|
||||
chanend ?c_iap, chanend ?c_i2c, // iOS stuff
|
||||
unsigned cable_number
|
||||
#ifdef IAP
|
||||
, chanend ?c_iap, chanend ?c_i2c, // iOS stuff
|
||||
port ?p_scl, port ?p_sda
|
||||
#endif
|
||||
);
|
||||
|
||||
#define MAX_USB_MIDI_PACKET_SIZE 1024
|
||||
@@ -72,4 +78,4 @@ INLINE void midi_send_ack(chanend c) {
|
||||
#define MIDI_RATE (31250)
|
||||
#define MIDI_BITTIME (XS1_TIMER_MHZ * 1000000 / MIDI_RATE)
|
||||
#define MIDI_BITTIME_2 (MIDI_BITTIME>>1)
|
||||
#endif // __usb_midi_h__
|
||||
#endif // _XUA_MIDI_H_
|
||||
@@ -1,7 +1,9 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __mixer_h__
|
||||
#define __mixer_h__
|
||||
#ifndef _XUA_MIXER_H_
|
||||
#define _XUA_MIXER_H_
|
||||
|
||||
#include "xua.h"
|
||||
|
||||
enum mix_ctl_cmd {
|
||||
SET_SAMPLES_TO_HOST_MAP,
|
||||
@@ -31,4 +33,14 @@ enum mix_ctl_cmd {
|
||||
*/
|
||||
void mixer(chanend c_to_host, chanend c_to_audio, chanend c_mix_ctl);
|
||||
|
||||
#define XUA_MIXER_OFFSET_OUT (0)
|
||||
#define XUA_MIXER_OFFSET_IN (NUM_USB_CHAN_OUT)
|
||||
#define XUA_MIXER_OFFSET_MIX (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN)
|
||||
#define XUA_MIXER_OFFSET_OFF (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT)
|
||||
|
||||
/* Defines uses for DB to actual muliplier conversion */
|
||||
#define XUA_MIXER_MULT_FRAC_BITS (25)
|
||||
#define XUA_MIXER_DB_FRAC_BITS (8)
|
||||
#define XUA_MIXER_MAX_MULT (1<<XUA_MIXER_MULT_FRAC_BITS) /* i.e. multiply by 0 */
|
||||
|
||||
#endif
|
||||
Binary file not shown.
27
lib_xua/doc/rst/add.rst
Normal file
27
lib_xua/doc/rst/add.rst
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
Additional Features
|
||||
-------------------
|
||||
|
||||
The previous sections describes only the basic core set of ``lib_xua`` details on enabling additional features e.g. S/PDIF are discussed in this section.
|
||||
|
||||
Where something must be defined, it is recommended this is done in `xua_conf.h` but could also be done in the application Makefile.
|
||||
|
||||
For each feature steps are listed for if calling ``lib_xua`` functions manually - if using the "codeless" programming model then these steps are informational only.
|
||||
Each section also includes a sub-section on enabling the feature using the "codeless" model.
|
||||
|
||||
For full details of all options please see the API section
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
S/PDIF Transmit <feat_spdif_tx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
lib_xua/doc/rst/api.rst
Normal file
12
lib_xua/doc/rst/api.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
.. _sec_api:
|
||||
|
||||
API Reference
|
||||
*************
|
||||
|
||||
.. toctree::
|
||||
|
||||
api_defines
|
||||
api_user_functions
|
||||
api_component
|
||||
|
||||
35
lib_xua/doc/rst/api_component.rst
Normal file
35
lib_xua/doc/rst/api_component.rst
Normal file
@@ -0,0 +1,35 @@
|
||||
.. _sec_api_component:
|
||||
|
||||
Component API
|
||||
=============
|
||||
|
||||
The following functions can be called from the top level main of an
|
||||
application and implement the various components described in
|
||||
:ref:`usb_audio_sec_architecture`.
|
||||
|
||||
When using the USB audio framework the ``c_ep_in`` array is always
|
||||
composed in the following order:
|
||||
|
||||
* Endpoint 0 (in)
|
||||
* Audio Feedback endpoint (if output enabled)
|
||||
* Audio IN endpoint (if input enabled)
|
||||
* MIDI IN endpoint (if MIDI enabled)
|
||||
* Clock Interrupt endpoint
|
||||
|
||||
The array ``c_ep_out`` is always composed in the following order:
|
||||
|
||||
* Endpoint 0 (out)
|
||||
* Audio OUT endpoint (if output enabled)
|
||||
* MIDI OUT endpoint (if MIDI enabled)
|
||||
|
||||
.. doxygenfunction:: XUA_Endpoint0
|
||||
|
||||
.. doxygenfunction:: XUA_Buffer
|
||||
|
||||
.. doxygenfunction:: XUA_AudioHub
|
||||
|
||||
.. doxygenfunction:: mixer
|
||||
|
||||
.. doxygenfunction:: clockGen
|
||||
|
||||
.. doxygenfunction:: usb_midi
|
||||
170
lib_xua/doc/rst/api_defines.rst
Normal file
170
lib_xua/doc/rst/api_defines.rst
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
.. _sec_api_defines:
|
||||
|
||||
Configuration Defines
|
||||
=====================
|
||||
|
||||
An application using the USB audio framework needs to have defines set for configuration.
|
||||
Defaults for these defines are found in ``xua_conf_default.h``.
|
||||
|
||||
These defines should be over-ridden in an optional header file ``xua_conf.h`` file or in the ``Makefile``
|
||||
for a relevant build configuration.
|
||||
|
||||
This section fully documents all of the settable defines and their default values (where appropriate).
|
||||
|
||||
Code Location (tile)
|
||||
--------------------
|
||||
|
||||
.. doxygendefine:: AUDIO_IO_TILE
|
||||
.. doxygendefine:: XUD_TILE
|
||||
.. doxygendefine:: MIDI_TILE
|
||||
.. doxygendefine:: SPDIF_TX_TILE
|
||||
.. doxygendefine:: PDM_TILE
|
||||
.. doxygendefine:: PLL_REF_TILE
|
||||
|
||||
Channel Counts
|
||||
--------------
|
||||
|
||||
.. doxygendefine:: NUM_USB_CHAN_OUT
|
||||
.. doxygendefine:: NUM_USB_CHAN_IN
|
||||
.. doxygendefine:: I2S_CHANS_DAC
|
||||
.. doxygendefine:: I2S_CHANS_ADC
|
||||
|
||||
Frequencies and Clocks
|
||||
----------------------
|
||||
|
||||
.. doxygendefine:: MAX_FREQ
|
||||
.. doxygendefine:: MIN_FREQ
|
||||
.. doxygendefine:: DEFAULT_FREQ
|
||||
.. doxygendefine:: MCLK_441
|
||||
.. doxygendefine:: MCLK_48
|
||||
|
||||
Audio Class
|
||||
-----------
|
||||
|
||||
.. doxygendefine:: AUDIO_CLASS
|
||||
.. doxygendefine:: AUDIO_CLASS_FALLBACK
|
||||
.. doxygendefine:: FULL_SPEED_AUDIO_2
|
||||
|
||||
|
||||
Feature Configuration
|
||||
---------------------
|
||||
|
||||
MIDI
|
||||
^^^^
|
||||
|
||||
.. doxygendefine:: MIDI
|
||||
.. doxygendefine:: MIDI_RX_PORT_WIDTH
|
||||
|
||||
S/PDIF
|
||||
^^^^^^
|
||||
|
||||
.. doxygendefine:: XUA_SPDIF_TX_EN
|
||||
.. doxygendefine:: SPDIF_TX_INDEX
|
||||
.. doxygendefine:: XUA_SPDIF_RX_EN
|
||||
.. doxygendefine:: SPDIF_RX_INDEX
|
||||
|
||||
ADAT
|
||||
^^^^
|
||||
|
||||
.. doxygendefine:: XUA_ADAT_RX_EN
|
||||
.. doxygendefine:: ADAT_RX_INDEX
|
||||
|
||||
PDM Microphones
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. doxygendefine:: XUA_NUM_PDM_MICS
|
||||
|
||||
DFU
|
||||
^^^
|
||||
|
||||
.. doxygendefine:: XUA_DFU_EN
|
||||
|
||||
.. .. doxygendefine:: DFU_FLASH_DEVICE
|
||||
|
||||
HID
|
||||
^^^
|
||||
|
||||
.. doxygendefine:: HID_CONTROLS
|
||||
|
||||
|
||||
CODEC Interface
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. doxygendefine:: CODEC_MASTER
|
||||
|
||||
|
||||
USB Device Configuration
|
||||
------------------------
|
||||
|
||||
.. doxygendefine:: VENDOR_STR
|
||||
.. doxygendefine:: VENDOR_ID
|
||||
.. doxygendefine:: PRODUCT_STR
|
||||
.. doxygendefine:: PRODUCT_STR_A2
|
||||
.. doxygendefine:: PRODUCT_STR_A1
|
||||
.. doxygendefine:: PID_AUDIO_1
|
||||
.. doxygendefine:: PID_AUDIO_2
|
||||
.. doxygendefine:: BCD_DEVICE
|
||||
|
||||
|
||||
Stream Formats
|
||||
--------------
|
||||
|
||||
Output/Playback
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. doxygendefine:: OUTPUT_FORMAT_COUNT
|
||||
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS
|
||||
|
||||
.. doxygendefine:: HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES
|
||||
.. doxygendefine:: HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES
|
||||
.. doxygendefine:: HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES
|
||||
|
||||
.. doxygendefine:: FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES
|
||||
.. doxygendefine:: FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES
|
||||
.. doxygendefine:: FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES
|
||||
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_1_DATAFORMAT
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_2_DATAFORMAT
|
||||
.. doxygendefine:: STREAM_FORMAT_OUTPUT_3_DATAFORMAT
|
||||
|
||||
Input/Recording
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. doxygendefine:: INPUT_FORMAT_COUNT
|
||||
|
||||
.. doxygendefine:: STREAM_FORMAT_INPUT_1_RESOLUTION_BITS
|
||||
|
||||
.. doxygendefine:: HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES
|
||||
|
||||
.. doxygendefine:: FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES
|
||||
|
||||
.. doxygendefine:: STREAM_FORMAT_INPUT_1_DATAFORMAT
|
||||
|
||||
Volume Control
|
||||
--------------
|
||||
|
||||
.. doxygendefine:: OUTPUT_VOLUME_CONTROL
|
||||
.. doxygendefine:: INPUT_VOLUME_CONTROL
|
||||
.. doxygendefine:: MIN_VOLUME
|
||||
.. doxygendefine:: MAX_VOLUME
|
||||
.. doxygendefine:: VOLUME_RES
|
||||
|
||||
Mixing
|
||||
------
|
||||
|
||||
.. doxygendefine:: MIXER
|
||||
.. doxygendefine:: MAX_MIX_COUNT
|
||||
.. doxygendefine:: MIX_INPUTS
|
||||
.. doxygendefine:: MIN_MIXER_VOLUME
|
||||
.. doxygendefine:: MAX_MIXER_VOLUME
|
||||
.. doxygendefine:: VOLUME_RES_MIXER
|
||||
|
||||
Power
|
||||
-----
|
||||
|
||||
.. doxygendefine:: XUA_POWERMODE
|
||||
|
||||
74
lib_xua/doc/rst/api_user_functions.rst
Normal file
74
lib_xua/doc/rst/api_user_functions.rst
Normal file
@@ -0,0 +1,74 @@
|
||||
Required User Function Definitions
|
||||
==================================
|
||||
|
||||
The following functions need to be defined by an application using the XMOS USB Audio framework.
|
||||
|
||||
External Audio Hardware Configuration Functions
|
||||
-----------------------------------------------
|
||||
|
||||
.. c:function:: void AudioHwInit(chanend ?c_codec)
|
||||
|
||||
This function is called when the audio core starts after the
|
||||
device boots up and should initialize the external audio harware e.g. clocking, DAC, ADC etc
|
||||
|
||||
:param c_codec: An optional chanend that was original passed into
|
||||
:c:func:`audio` that can be used to communicate
|
||||
with other cores.
|
||||
|
||||
|
||||
.. c:function:: void AudioHwConfig(unsigned samFreq, unsigned mclk, chanend ?c_codec, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
|
||||
This function is called when the audio core starts or changes
|
||||
sample rate. It should configure the extenal audio hardware to run at the specified
|
||||
sample rate given the supplied master clock frequency.
|
||||
|
||||
:param samFreq: The sample frequency in Hz that the hardware should be configured to (in Hz).
|
||||
|
||||
:param mclk: The master clock frequency that is required in Hz.
|
||||
|
||||
:param c_codec: An optional chanend that was original passed into
|
||||
:c:func:`audio` that can be used to communicate
|
||||
with other cores.
|
||||
|
||||
:param dsdMode: Signifies if the audio hardware should be configured for DSD operation
|
||||
|
||||
:param sampRes_DAC: The sample resolution of the DAC stream
|
||||
|
||||
:param sampRes_ADC: The sample resolution of the ADC stream
|
||||
|
||||
|
||||
Audio Streaming Functions
|
||||
-------------------------
|
||||
|
||||
The following functions can be optionally used by the design. They can be useful for mute lines etc.
|
||||
|
||||
.. c:function:: void AudioStreamStart(void)
|
||||
|
||||
This function is called when the audio stream from device to host
|
||||
starts.
|
||||
|
||||
.. c:function:: void AudioStreamStop(void)
|
||||
|
||||
This function is called when the audio stream from device to host stops.
|
||||
|
||||
Host Active
|
||||
-----------
|
||||
|
||||
The following function can be used to signal that the device is connected to a valid host.
|
||||
|
||||
This is called on a change in state.
|
||||
|
||||
.. c:function:: void AudioStreamStart(int active)
|
||||
|
||||
:param active: Indicates if the host is active or not. 1 for active else 0.
|
||||
|
||||
|
||||
HID Controls
|
||||
------------
|
||||
|
||||
The following function is called when the device wishes to read physical user input (buttons etc).
|
||||
|
||||
.. c:function:: void UserReadHIDButtons(unsigned char hidData[])
|
||||
|
||||
:param hidData: The function should write relevant HID bits into this array. The bit ordering and functionality is defined by the HID report descriptor used.
|
||||
|
||||
92
lib_xua/doc/rst/arch.rst
Normal file
92
lib_xua/doc/rst/arch.rst
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
.. _usb_audio_sec_architecture:
|
||||
|
||||
Software Architecture
|
||||
*********************
|
||||
|
||||
This section describes the required software architecture of a USB Audio device implemented using `lib_xua`, its dependencies and other supporting libraries.
|
||||
|
||||
`lib_xua` provides fundamental building blocks for producing USB Audio products on XMOS devices. Every system is required to have the components from `lib_xua` listed in :ref:`usb_audio_shared_components`.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _usb_audio_shared_components:
|
||||
.. list-table:: Required XUA Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Endpoint 0
|
||||
- Provides the logic for Endpoint 0 which handles
|
||||
enumeration and control of the device including DFU related requests.
|
||||
* - Endpoint buffer
|
||||
- Buffers endpoint data packets to and from the host. Manages delivery of audio packets between the endpoint buffer
|
||||
component and the audio components. It can also handle volume control processing. Note, this currently utilises two cores
|
||||
* - AudioHub
|
||||
- Handles audio I/O over I2S and manages audio data
|
||||
to/from other digital audio I/O components.
|
||||
|
||||
In addition low-level USB I/0 is required and is provided by the external dependency `lib_xud`
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. list-table:: Additional Components Required
|
||||
:header-rows: 1
|
||||
:widths: 100 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - XMOS USB Device Driver (XUD)
|
||||
- Handles the low level USB I/O.
|
||||
|
||||
In addition :ref:`usb_audio_optional_components` shows optional components that can be added/enabled from within `lib_xua`
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _usb_audio_optional_components:
|
||||
.. list-table:: Optional Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Mixer
|
||||
- Allows digital mixing of input and output channels. It can also
|
||||
handle volume control instead of the decoupler.
|
||||
* - Clockgen
|
||||
- Drives an external frequency generator (PLL) and manages
|
||||
changes between internal clocks and external clocks arising
|
||||
from digital input.
|
||||
* - MIDI
|
||||
- Outputs and inputs MIDI over a serial UART interface.
|
||||
|
||||
`lib_xua` also provides optional support for integrating with the following external dependencies listed in :ref:`usb_audio_external_components`
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _usb_audio_external_components:
|
||||
.. list-table:: External Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - S/PDIF Transmitter (lib_spdif)
|
||||
- Outputs samples of an S/PDIF digital audio interface.
|
||||
* - S/PDIF Receiver (lib_spdif)
|
||||
- Inputs samples of an S/PDIF digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - ADAT Receiver (lib_adat)
|
||||
- Inputs samples of an ADAT digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - PDM Microphones (lib_mic_array)
|
||||
- Receives PDM data from microphones and performs PDM to PCM conversion
|
||||
|
||||
.. _usb_audio_threads:
|
||||
|
||||
.. figure:: images/threads-crop.*
|
||||
:width: 100%
|
||||
|
||||
USB Audio Core Diagram
|
||||
|
||||
:ref:`usb_audio_threads` shows how the components interact with each
|
||||
other in a typical system. The green circles represent cores with arrows indicating inter-core communications.
|
||||
|
||||
|
||||
@@ -1,117 +1,24 @@
|
||||
|
||||
Features & Options
|
||||
------------------
|
||||
Additional Features
|
||||
*******************
|
||||
|
||||
The previous chapter describes the use of core functionality contained within ``lib_xua``
|
||||
This seciton details enabling additional features with supported external dependencies, for example,
|
||||
``lib_xua`` can provide S/PDIF output though the used of ``lib_spdif``
|
||||
|
||||
Where something must be defined, it is recommended this is done in `xua_conf.h` but could also be done in the application Makefile.
|
||||
|
||||
.. toctree::
|
||||
|
||||
S/PDIF Transmit <feat_spdif_tx>
|
||||
S/PDIF Receive <feat_spdif_rx>
|
||||
|
||||
|
||||
|
||||
|
||||
The previous sections describes only the basic core set of ``lib_xua`` details on enabling additional features e.g. S/PDIF are discussed in this section.
|
||||
|
||||
Where something must be defined, it is recommened this is done in `xua_conf.h` but could also be done in the application Makefile.
|
||||
|
||||
For each feature steps are listed for if calling ``lib_xua`` functions manually - if using the "codeless" programming model then these steps informational only.
|
||||
Each section also includes a sub-section on enabling the feature using the "codeless" model.
|
||||
|
||||
For full details of all options please see the API section
|
||||
|
||||
I2S/TDM
|
||||
~~~~~~~
|
||||
|
||||
I2S/TDM is typically fundamental to most products and is built into the ``XUA_AudioHub()`` core.
|
||||
|
||||
In order to enable I2S on must declare an array of ports for the data-lines (one for each direction)::
|
||||
|
||||
/* Port declarations. Note, the defines come from the xn file */
|
||||
buffered out port:32 p_i2s_dac[] = {PORT_I2S_DAC0}; /* I2S Data-line(s) */
|
||||
buffered in port:32 p_i2s_adc[] = {PORT_I2S_ADC0}; /* I2S Data-line(s) */
|
||||
|
||||
Ports for the sample and bit clocks are also required::
|
||||
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK; /* I2S Bit-clock */
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
|
||||
|
||||
.. note::
|
||||
|
||||
All of these ports must be buffered, width 32. Based on whether the xCORE is bus slave/master the ports must be declared as input/output respectively
|
||||
|
||||
These ports must then be passed to the ``XUA_AudioHub()`` task appropriately.
|
||||
|
||||
I2S functionality also requires two clock-blocks, one for bit and sample clock e.g.::
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
|
||||
These hardware resources must be passed into the call to ``XUA_AudioHub()``::
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
on tile[0]: XUA_AudioHub(c_aud, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk);
|
||||
|
||||
|
||||
Codeless Programming Model
|
||||
..........................
|
||||
|
||||
All ports and hardware resources are already fully declared, one must simply set the following:
|
||||
|
||||
* `I2S_CHANS_DAC` must be set to the desired number of output channels via I2S
|
||||
* `I2S_CHANS_ADC` must be set to the desired number of input channels via I2S
|
||||
* `AUDIO_IO_TILE` must be set to the tile where the physical I2S connections reside
|
||||
|
||||
For configuration options, master vs slave, TDM etc please see the API section.
|
||||
|
||||
|
||||
|newpage|
|
||||
|
||||
S/PDIF Transmit
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
``lib_xua`` supports the development of devices with S/PDIF transmit functionality through the use of
|
||||
``lib_spdif``. The XMOS S/PDIF transmitter runs in a single core and supports rates up to 192kHz.
|
||||
|
||||
The S/PDIF transmitter core takes PCM audio samples via a channel and outputs them in S/PDIF format to a port.
|
||||
Samples are provided to the S/PDIF transmitter task from the ``XUA_AudioHub()`` task.
|
||||
|
||||
The channel should be declared a normal::
|
||||
|
||||
chan c_spdif_tx
|
||||
|
||||
|
||||
In order to use the S/PDIF transmmiter with ``lib_xua`` hardware resources must be declared e.g::
|
||||
|
||||
buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; /* SPDIF transmit port */
|
||||
|
||||
This port should be clocked from the master-clock, ``lib_spdif`` provides a helper function for setting up the port::
|
||||
|
||||
spdif_tx_port_config(p_spdif_tx2, clk_audio_mclk, p_mclk_in, delay);
|
||||
|
||||
.. note:: If sharing the master-clock port and clockblock with ``XUA_AudioHub()`` (or any other task) then this setup
|
||||
should be done before running the tasks in a ``par`` statement.
|
||||
|
||||
Finally the S/PDIF transmitter task must be run - passing in the port and channel for communication with ``XUA_AudioHub``.
|
||||
For example::
|
||||
|
||||
par
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
/* Run the S/PDIF transmitter task */
|
||||
spdif_tx(p_spdif_tx2, c_spdif_tx);
|
||||
}
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
/* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */
|
||||
XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_spdif_tx);
|
||||
}
|
||||
|
||||
For further details please see the documentation, application notes and examples provided for ``lib_spdif``.
|
||||
|
||||
Codeless Programming Model
|
||||
..........................
|
||||
|
||||
If using the codeless programming method one must simply ensure the following:
|
||||
|
||||
* `PORT_SPDIF_OUT` is correctly defined in the XN file
|
||||
* `XUA_SPDIF_TX_EN` should be defined as non-zero
|
||||
* `SPDIF_TX_TILE` is correctly defined (note, this defaults to `AUDIO_IO_TILE`)
|
||||
|
||||
For further configuration options please see the API section.
|
||||
|
||||
|
||||
|
||||
|
||||
52
lib_xua/doc/rst/feat_spdif_rx.rst
Normal file
52
lib_xua/doc/rst/feat_spdif_rx.rst
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
S/PDIF Receive
|
||||
==============
|
||||
|
||||
``lib_xua`` supports the development of devices with S/PDIF receive functionality through the use of
|
||||
``lib_spdif``. The XMOS S/PDIF receiver runs in a single core and supports rates up to 192kHz.
|
||||
|
||||
The S/PDIF receiver inputs data via a port and outputs samples via a channel. It requires a 1-bit port
|
||||
which must be 4-bit buffered. For example::
|
||||
|
||||
buffered in port:4 p_spdif_rx = PORT_SPDIF_IN;
|
||||
|
||||
It also requires a clock-block, for example::
|
||||
|
||||
clock clk_spd_rx = XS1_CLKBLK_1;
|
||||
|
||||
Finally, a channel for the output samples must be declared, note, this should be a streaming channel::
|
||||
|
||||
streaming chan c_spdif_rx;
|
||||
|
||||
The S/PDIF receiver should be called on the appropriate tile::
|
||||
|
||||
spdif_rx(c_spdif_rx,p_spdif_rx,clk_spd_rx,192000);
|
||||
|
||||
.. note::
|
||||
|
||||
It is recomended to use the value 192000 for the ``sample_freq_estimate`` parameter
|
||||
|
||||
With the steps above an S/PDIF stream can be captured by the xCORE. To be functionally useful the audio
|
||||
master clock must be able to synchronise to this external digital stream. Additionally, the host can be
|
||||
notified regarding changes in the validity of this stream, it's frequency etc. To synchronise to external
|
||||
streams the codebase assumes the use of an external Cirrus Logic CS2100 device.
|
||||
|
||||
The ``ClockGen()`` task from ``lib_xua`` provides the reference signal to the CS2100 device and also handles
|
||||
recording of clock validity etc. See :ref:`usb_audio_sec_clock_recovery` for full details regarding ``ClockGen()``.
|
||||
|
||||
It also provides a small FIFO for S/PDIF samples before they are forwarded to the ``AudioHub`` core.
|
||||
As such it requires to be inserted in the communication path between the S/PDIF receiver and the
|
||||
``AudioHub`` core. For example::
|
||||
|
||||
chan c_dig_rx;
|
||||
streaming chan c_spdif_rx;
|
||||
|
||||
par
|
||||
{
|
||||
SpdifReceive(..., c_spdif_rx, ...);
|
||||
|
||||
clockGen(c_spdif_rx, ..., c_dig_rx, ...);
|
||||
|
||||
XUA_AudioHub(..., c_dig_rx, ...);
|
||||
}
|
||||
|
||||
47
lib_xua/doc/rst/feat_spdif_tx.rst
Normal file
47
lib_xua/doc/rst/feat_spdif_tx.rst
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
S/PDIF Transmit
|
||||
===============
|
||||
|
||||
``lib_xua`` supports the development of devices with S/PDIF transmit functionality through the use of
|
||||
``lib_spdif``. The XMOS S/PDIF transmitter runs in a single core and supports rates up to 192kHz.
|
||||
|
||||
The S/PDIF transmitter core takes PCM audio samples via a channel and outputs them in S/PDIF format to a port.
|
||||
Samples are provided to the S/PDIF transmitter task from the ``XUA_AudioHub()`` task.
|
||||
|
||||
The channel should be declared as normal::
|
||||
|
||||
chan c_spdif_tx
|
||||
|
||||
|
||||
In order to use the S/PDIF transmitter with ``lib_xua`` a 1-bit port must be declared e.g::
|
||||
|
||||
buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; /* SPDIF transmit port */
|
||||
|
||||
This port should be clocked from the master-clock, ``lib_spdif`` provides a helper function for setting up the port::
|
||||
|
||||
spdif_tx_port_config(p_spdif_tx, clk_audio_mclk, p_mclk_in, delay);
|
||||
|
||||
.. note:: If sharing the master-clock port and clockblock with ``XUA_AudioHub()`` (or any other task) then this setup
|
||||
should be done before running the tasks in a ``par`` statement.
|
||||
|
||||
Finally the S/PDIF transmitter task must be run - passing in the port and channel for communication with ``XUA_AudioHub``.
|
||||
For example::
|
||||
|
||||
par
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
/* Run the S/PDIF transmitter task */
|
||||
spdif_tx(p_spdif_tx, c_spdif_tx);
|
||||
}
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as
|
||||
* a hub for all audio).
|
||||
* Note, since we are not using I2S we pass in null for LR and Bit
|
||||
* clock ports and the I2S dataline ports */
|
||||
XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null,
|
||||
null, null, c_spdif_tx);
|
||||
}
|
||||
|
||||
For further details please see the documentation, application notes and examples provided for ``lib_spdif``.
|
||||
|
||||
@@ -4,59 +4,118 @@ XMOS USB Audio Hardware Platforms
|
||||
|
||||
A range of hardware platforms for evaluating USB Audio on XMOS devices.
|
||||
|
||||
Specific, in depth, details for each platform/board are out of scope of this library documentation however, the features of the most popular platform are described below with the view of providing a worked example.
|
||||
Specific details for each platform/board are out of scope of this library documentation however, the features of the most popular platform are described below with the view of providing a worked example.
|
||||
|
||||
Please also see application note AN00246.
|
||||
|
||||
|
||||
xCORE-200 Multi-Channel Audio Board
|
||||
xCORE.AI Multichannel Audio Board
|
||||
...................................
|
||||
|
||||
`The XMOS xCORE-200 Multi-channel Audio board <https://www.xmos.com/support/boards?product=18334>`_
|
||||
(XK-AUDIO-216-MC) is a complete hardware and reference software platform targeted at up to 32-channel USB and networked audio applications, such as DJ decks and mixers.
|
||||
The XMOS xCORE.ai Multichannel Audio board (XK-AUDIO-316-MC) is a complete hardware and reference software platform targeted at up to 32-channel USB audio applications, such as DJ decks and mixers and other musical instrument interfaces. The board can also be used to prototype products with smaller feature sets or HiFi style products.
|
||||
|
||||
The Multichannel Audio Platform hardware is based around the XE216-512-TQ128 multicore microcontroller; an dual-tile xCORE-200 device with an integrated High Speed USB 2.0 PHY, RGMII (Gigabit Ethernet) interface and 16 logical cores delivering up to 2000MIPS of deterministic and responsive processing power.
|
||||
The Multichannel Audio Platform hardware is based around the XU316-1024-TQ128-C24 multicore microcontroller; an dual-tile xCORE.ai device with an integrated High Speed USB 2.0 PHY and 16 logical cores delivering up to 3200MIPS of deterministic and responsive processing power.
|
||||
|
||||
Exploiting the flexible programmability of the xCORE-200 architecture, the Multi-channel Audio Platform supports either USB or network audio source, streaming 8 analogue input and 8 analogue output audio channels simultaneously - at up to 192kHz.
|
||||
Exploiting the flexible programmability of the xCORE.ai architecture, the Multi-channel Audio Platform supports either USB or network audio source, streaming 8 analogue input and 8 analogue output audio channels simultaneously - at up to 192kHz.
|
||||
|
||||
For full details regarding the hardware please refer to `xCORE-200 Multichannel Audio Platform Hardware Manual <https://www.xmos.com/support/boards?product=18334&component=18687>`_.
|
||||
|
||||
The reference board has an associated firmware application that uses `lib_xua` to implemented a USB Audio Devicce. Full details of this application can be found in the USB Audio Design Guide.
|
||||
The reference board has an associated firmware application that uses `lib_xua` to implemented a USB Audio Device. Full details of this application can be found later in this document.
|
||||
|
||||
Analogue Input & Output
|
||||
+++++++++++++++++++++++
|
||||
|
||||
A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. Each is fed into a CirrusLogic CS5368 ADC.
|
||||
Similarly a total of eight single-ended analog output channels are provided. Each is fed into a CirrusLogic CS4384 DAC.
|
||||
A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. These inputs feed into a pair of quad-channel PCM1865 ADCs from Texas Instruments.
|
||||
|
||||
The four digital I2S/TDM input and output channels are mapped to the xCORE input/outputs through a header array. This jumper allows channel selection when the ADC/DAC is used in TDM mode
|
||||
A total of eight single-ended analog output channels are provided. These a fed from a for PCM5122 stereo DAC's from Texas instruments.
|
||||
|
||||
ADC's and DAC's are configured via an I2C bus.
|
||||
|
||||
The four digital I2S/TDM input and output channels are mapped to the xCORE input/outputs through a header array. These jumpers allow channel selection when the ADC/DAC is used in TDM mode
|
||||
|
||||
Digital Input & Output
|
||||
++++++++++++++++++++++
|
||||
|
||||
Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT.
|
||||
The output data streams from the xCORE-200 are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops.
|
||||
The output data streams from the xCORE are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops.
|
||||
|
||||
MIDI
|
||||
++++
|
||||
|
||||
MIDI I/O is provided on the board via standard 5-pin DIN connectors. The signals are buffered using 5V line drivers and are then connected to 1-bit ports on the xCORE-200, via a 5V to 3.3V buffer.
|
||||
MIDI I/O is provided on the board via standard 5-pin DIN connectors. The signals are buffered using 5V line drivers and are then connected to 1-bit ports on the xCORE, via a 5V to 3.3V buffer.
|
||||
|
||||
Audio Clocking
|
||||
++++++++++++++
|
||||
|
||||
A flexible clocking scheme is provided for both audio and other system services. In order to accommodate a multitude of clocking options, the low-jitter master clock is generated locally using a frequency multiplier PLL chip. The chip used is a Phaselink PL611-01, which is pre-programmed to provide a 24MHz clock from its CLK0 output, and either 24.576 MHz or 22.5792MHz from its CLK1 output.
|
||||
In order to accommodate a multitude of clocking options a flexible clocking scheme is provided for the audio subsystem.
|
||||
|
||||
The 24MHz fixed output is provided to the xCORE-200 device as the main processor clock. It also provides the reference clock to a Cirrus Logic CS2100, which provides a very low jitter audio clock from a synchronisation signal provided from the xCORE-200.
|
||||
Three methods of generating an audio master clock are provided on the board:
|
||||
|
||||
* A Cirrus Logic CS2100-CP PLL device. The CS2100 features both a clock generator and clock multiplier/jitter reduced clock frequency synthesizer (clean up) and can generate a low jitter audio clock based on a synchronisation signal provided by the xCORE
|
||||
|
||||
* A Skyworks Si5351B PLL device. The Si5351 is an I2C configurable clock generator that is ideally suited for replacing crystals, crystal oscillators, VCXOs, phase-locked loops (PLLs), and fanout buffers.
|
||||
|
||||
* xCORE.ai devices are equipped with a secondary (or 'application') PLL which can be used to generate audio clocks
|
||||
|
||||
Selection between these methods is done via writing to bits 6 and 7 of PORT 8D on tile[0].
|
||||
|
||||
Either the locally generated clock (from the PL611) or the recovered low jitter clock (from the CS2100) may be selected to clock the audio stages; the xCORE-200, the ADC/DAC and Digital output stages. Selection is controlled via an additional I/O, bit 5 of PORT 8C, see :ref:`hw_316_ctrlport`.
|
||||
|
||||
.. _hw_316_ctrlport:
|
||||
|
||||
Control I/O
|
||||
+++++++++++
|
||||
|
||||
4 bits of PORT 8C are used to control external hardware on the board. This is described in :ref:`table_316_ctrlport`.
|
||||
|
||||
.. _table_316_ctrlport:
|
||||
|
||||
.. table:: PORT 8C functionality
|
||||
:class: horizontal-borders vertical_borders
|
||||
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
| Bit(s) | Functionality | 0 | 1 |
|
||||
+========+=========================================+============+============+
|
||||
| [0:3] | Unused | | |
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
| 4 | Enable 3v3 power for digital (inverted) | Enabled | Disabled |
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
| 5 | Enable 3v3 power for analogue | Disabled | Enabled |
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
| 6 | PLL Select | CS2100 | Si5351B |
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
| 7 | Master clock direction | Output | Input |
|
||||
+--------+-----------------------------------------+------------+------------+
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
To use the xCORE application PLL bit 7 should be set to 0. To use one of the external PLL's bit 7 should be set to 1.
|
||||
|
||||
Either the locally generated clock (from the PL611) or the recovered low jitter clock (from the CS2100) may be selected to clock the audio stages; the xCORE-200, the ADC/DAC and Digital output stages. Selection is conntrolled via an additional I/O, bit 5 of PORT 8C.
|
||||
|
||||
LEDs, Buttons and Other IO
|
||||
++++++++++++++++++++++++++
|
||||
|
||||
An array of 4*4 green LEDs, 3 buttons and a switch are provided for general purpose user interfacing. The LED array is driven by eight signals each controlling one of 4 rows and 4 columns.
|
||||
All programmable I/O on the board is configured for 3v3.
|
||||
|
||||
A standard XMOS xSYS interface is provided to allow host debug of the board via JTAG.
|
||||
For green LED's and three push buttons are provided for general purpose user interfacing.
|
||||
|
||||
|newpage|
|
||||
The LEDs are connected to PORT 4F and the buttons are connected to bits [0:2] of PORT 4E. Bit 3 of this port is connected to the (currently
|
||||
unused) ADC interrupt line.
|
||||
|
||||
The board also includes support for an AES11 format Word Clock input via 75 ohm BNC. The software does not support this currently and it is
|
||||
provided for future expansion.
|
||||
|
||||
All spare IO and Functional IO brought out on headers for easy connection of expansion boards (via 0.1” headers).
|
||||
|
||||
Power
|
||||
+++++
|
||||
|
||||
The board is capable of acting as a USB2.0 self or bus powered device. If bus powered, board takes power from ``USB DEVICE`` connector (micro-B receptacle).
|
||||
If self powered, board takes power from ``EXTERNAL POWER`` input (micro-B receptacle).
|
||||
|
||||
A Power Source Select (marked ``PWR SRC``) is used to select between bus and self-powered configuration.
|
||||
|
||||
|
||||
Debug
|
||||
+++++
|
||||
|
||||
For convenience the board includes an on-board xTAG4 for debugging via JTAG/xSCOPE. This is accessed via the USB (micro-B) receptacle marked ``DEBUG``.
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
.. include:: ../../../README.rst
|
||||
|
||||
|
||||
About This Document
|
||||
-------------------
|
||||
|
||||
This document describes the structure of the library, its use and resources required. It also covers some implementation detail.
|
||||
|
||||
This document assumes familiarity with the XMOS xCORE architecture, the Universal Serial Bus 2.0 Specification (and related specifications),
|
||||
the XMOS tool chain and XC language.
|
||||
|
||||
|
||||
Host System Requirements
|
||||
------------------------
|
||||
|
||||
USB Audio devices built using `lib_xua` have the following host system requirements.
|
||||
|
||||
- Mac OSX version 10.6 or later
|
||||
|
||||
- Windows Vista, 7, 8 or 10 with Thesycon Audio Class 2.0 driver for Windows (Tested against version 3.20). Please contact XMOS for details.
|
||||
|
||||
- Windows Vista, 7, 8 or 10 with built-in USB Audio Class 1.0 driver.
|
||||
|
||||
Older versions of Windows are not guaranteed to operate as expected. Devices are also expected to operate with various Linux distributions including mobile variants.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Overview <overview>
|
||||
Hardware Platforms <hw>
|
||||
Software Overview <sw>
|
||||
Using lib_xua <using>
|
||||
Features <feat>
|
||||
Software Detail <sw_detail>
|
||||
Known Issues <issues>
|
||||
|
||||
|
||||
|
||||
.. include:: ../../../CHANGELOG.rst
|
||||
@@ -1,20 +1,34 @@
|
||||
|
||||
|appendix|
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
************
|
||||
|
||||
- Quad-SPI DFU will corrupt the factory image with tools version < 14.0.4 due to an issue with libquadflash
|
||||
|
||||
- (#14762) When in DSD mode with S/PDIF output enabled, DSD samples are transmitted over S/PDIF if the DSD and S/PDIF channels are shared, this may or may not be desired
|
||||
- When in DSD mode with S/PDIF output enabled, DSD samples are transmitted over S/PDIF if the DSD and S/PDIF channels are shared, this may or may not be desired (#14762)
|
||||
|
||||
- (#14173) I2S input is completely disabled when DSD output is active - any input stream to the host will contain 0 samples
|
||||
- I2S input is completely disabled when DSD output is active - any input stream to the host will contain 0 samples (#14173)
|
||||
|
||||
- (#14780) Operating the design at a sample rate of less than or equal to the SOF rate (i.e. 8kHz at HS, 1kHz at FS) may expose a corner case relating to 0 length packet handling in both the driver and device and should be considered un-supported at this time.
|
||||
- Operating the design at a sample rate of less than or equal to the SOF rate (i.e. 8kHz at HS, 1kHz at FS) may expose a corner case relating to 0 length packet handling in both the driver and device and should be considered unsupported at this time (#14780)
|
||||
|
||||
- (#14883) Before DoP mode is detected a small number of DSD samples will be played out as PCM via I2S
|
||||
- Before DoP mode is detected a small number of DSD samples will be played out as PCM via I2S (lib_xua #162)
|
||||
|
||||
- (#14887) Volume control settings currently affect samples in both DSD and PCM modes. This results in invalid DSD output if volume control not set to 0
|
||||
- Volume control settings currently affect samples in both DSD and PCM modes. This results in invalid DSD output if volume control not set to 0 (#14887)
|
||||
|
||||
- Windows XP volume control very sensitive. The Audio 1.0 driver built into Windows XP (usbaudio.sys) does not properly support master volume AND channel volume controls, leading to a very sensitive control. Descriptors can be easily modified to disable master volume control if required (one byte - bmaControls(0) in Feature Unit descriptors)
|
||||
|
||||
- 88.2kHz and 176.4kHz sample frequencies are not exposed in Windows control panels. These are known OS restrictions.
|
||||
- 88.2kHz and 176.4kHz sample frequencies are not exposed in Windows control panels. These are known OS restrictions.
|
||||
|
||||
- When DFU flash access fails the device NAKS the host indefinitely (sw_usb_audio #54)
|
||||
|
||||
- Host mixer app (xmos_mixer) is currently not provided (lib_xua #279)
|
||||
|
||||
- In synchronous mode there is no nice transition of the reference signal when moving between internal and SOF clocks (lib_xua #275)
|
||||
|
||||
- Binary images exceeding FLASH_MAX_UPGRADE_SIZE fail silently on DFU download (lib_xua #165)
|
||||
|
||||
- UAC 1.0 mode assumes device always has input. A run time exception occurs if this is not the case (lib_xua #58)
|
||||
|
||||
- No support for I2S_CHANS_DAC = 0 and I2S_CHANS_ADC = 0 (lib_xua #260)
|
||||
|
||||
|
||||
25
lib_xua/doc/rst/lib_xua.rst
Normal file
25
lib_xua/doc/rst/lib_xua.rst
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
.. include:: ../../../README.rst
|
||||
|
||||
About This Document
|
||||
===================
|
||||
|
||||
This document describes the structure of ``lib_xua``, its use and resources required. It also covers some implementation detail.
|
||||
|
||||
This document assumes familiarity with the XMOS xCORE architecture, the Universal Serial Bus 2.0 Specification (and related specifications),
|
||||
the XMOS tool chain and XC language.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Overview <overview>
|
||||
Software Architecture <arch>
|
||||
Basic Usage <using>
|
||||
Options <opt>
|
||||
Advanced Usage <using_adv>
|
||||
Additional Features <feat>
|
||||
Implementation Detail <sw>
|
||||
API <api>
|
||||
Known Issues <issues>
|
||||
|
||||
|
||||
|
||||
37
lib_xua/doc/rst/opt.rst
Normal file
37
lib_xua/doc/rst/opt.rst
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
.. _sec_options:
|
||||
|
||||
Options
|
||||
*******
|
||||
|
||||
This section describes key options of ``lib_xua``. These are typically controlled using build time defines.
|
||||
Where something must be defined, it is recommended this is done in `xua_conf.h` but could also be done in the application Makefile.
|
||||
|
||||
For full details of all options please see ::ref:`sec_api`.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Strings <opt_strings>
|
||||
Code Location <opt_location>
|
||||
Channel Counts and Sample Rates <opt_channels>
|
||||
USB Audio Class Support <opt_audio_class>
|
||||
Synchronisation <opt_sync>
|
||||
I2S/TDM <opt_i2s>
|
||||
S/PDIF Transmit <opt_spdif_tx>
|
||||
S/PDIF Receive <opt_spdif_rx>
|
||||
MIDI <opt_midi>
|
||||
PDM Microphones <opt_pdm>
|
||||
Mixer <opt_mixer>
|
||||
Direct Stream Digital (DSD) <opt_dsd>
|
||||
USB Audio Formats <opt_audio_formats>
|
||||
Other Options <opt_other>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +1,40 @@
|
||||
USB Audio Class Version Support
|
||||
-------------------------------
|
||||
|newpage|
|
||||
|
||||
The XMOS USB Audio framework supports both USB Audio Class 1.0 and Audio Class 2.0.
|
||||
USB Audio Class Version
|
||||
=======================
|
||||
|
||||
USB Audio Class 2.0 offers many improvements over USB Audio Class 1.0, most notable is the complete support for high-speed operation. This means that Audio Class devices are no longer limited to full-speed operation allowing greater channel counts, sample frequencies and sample bit-depths. Additional improvement, amoungst others, include:
|
||||
The codebase supports USB Audio Class versions 1.0 and 2.0.
|
||||
|
||||
USB Audio Class 2.0 offers many improvements over USB Audio Class 1.0, most notable is the complete
|
||||
support for high-speed operation. This means that Audio Class devices are no longer limited to
|
||||
full-speed operation allowing greater channel counts, sample frequencies and sample bit-depths.
|
||||
Additional improvements, amongst others, include:
|
||||
|
||||
- Added support for multiple clock domains, clock description and clock control
|
||||
|
||||
- Extensive support for interrupts to inform the host about dynamic changes that occur to different entities such as Clocks etc
|
||||
|
||||
Driver Support
|
||||
~~~~~~~~~~~~~~
|
||||
--------------
|
||||
|
||||
Audio Class 1.0
|
||||
+++++++++++++++
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Audio Class 1.0 is fully supported in Apple OSX. Audio Class 1.0 is fully supported in all modern Microsoft Windows operating systems (i.e. Windows XP and later).
|
||||
|
||||
Audio Class 2.0
|
||||
+++++++++++++++
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Audio Class 2.0 is fully supported in Apple OSX since version 10.6.4. Audio Class 2.0 is not supported natively by Windows operating systems. It is therefore required that a driver is installed. Documentation of Windows drivers is beyond the scope of this document, please contact XMOS for further details.
|
||||
Audio Class 2.0 is fully supported in Apple OSX since version 10.6.4. Starting with Windows 10, release 1703, a USB Audio 2.0 driver is shipped with Windows.
|
||||
|
||||
Third party Windows drivers are also available, however, documentation of these is beyond the scope of this document, please contact XMOS for further details.
|
||||
|
||||
Audio Class 1.0 Mode and Fall-back
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
----------------------------------
|
||||
|
||||
The normal default for XMOS USB Audio applications is to run as a high-speed Audio Class 2.0
|
||||
The default for XMOS USB Audio applications is to run as a high-speed Audio Class 2.0
|
||||
device. However, some products may prefer to run in Audio Class 1.0 mode, this is normally to
|
||||
allow "driver-less" operation with Windows operating systems.
|
||||
allow "driver-less" operation with older versions of Windows operating systems.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -41,7 +48,7 @@ The device will operate in full-speed Audio Class 1.0 mode if one of the followi
|
||||
to the host over a full speed link (and the Audio Class fall back is
|
||||
enabled).
|
||||
|
||||
The options to control this behavior are detailed in :ref:`usb_audio_sec_custom_defines_api`.
|
||||
The options to control this behavior are detailed in :ref:`sec_api_defines`.
|
||||
|
||||
When running in Audio Class 1.0 mode the following restrictions are applied:
|
||||
|
||||
@@ -55,3 +62,29 @@ Due to bandwidth limitations of full-speed USB the following sample-frequency re
|
||||
|
||||
- Sample rate is limited to a maximum of 96kHz if only input *or* output is enabled.
|
||||
|
||||
|
||||
Related Defines
|
||||
---------------
|
||||
|
||||
:ref:`opt_audio_class_defines` descibes the defines that effect audio class selection.
|
||||
|
||||
.. _opt_audio_class_defines:
|
||||
|
||||
.. list-table:: Audio Class defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``AUDIO_CLASS``
|
||||
- Audio Class version (1 or 2)
|
||||
- N/A (*must* be defined)
|
||||
* - ``AUDIO_CLASS_FALLBACK``
|
||||
- Enable audio class fallback functionalty
|
||||
- ``0`` (disabled)
|
||||
|
||||
.. note::
|
||||
|
||||
Enabling USB Audio Class fallback functionality may have USB Compliance implications
|
||||
|
||||
135
lib_xua/doc/rst/opt_audio_formats.rst
Normal file
135
lib_xua/doc/rst/opt_audio_formats.rst
Normal file
@@ -0,0 +1,135 @@
|
||||
|newpage|
|
||||
|
||||
.. _sec_opt_audio_formats:
|
||||
|
||||
Audio Stream Formats
|
||||
====================
|
||||
|
||||
The design currently supports up to three different stream formats for playback, selectable at
|
||||
run time. This is implemented using standard Alternative Settings to the Audio Streaming interfaces.
|
||||
|
||||
An Audio Streaming interface can have Alternate Settings that can be used to change certain characteristics
|
||||
of the interface and underlying endpoint. A typical use of Alternate Settings is to provide a way to
|
||||
change the subframe size and/or number of channels on an active Audio Streaming interface.
|
||||
Whenever an Audio Streaming interface requires an isochronous data endpoint, it must at least provide
|
||||
the default Alternate Setting (Alternate Setting 0) with zero bandwidth requirements (no isochronous
|
||||
data endpoint defined) and an additional Alternate Setting that contains the actual isochronous
|
||||
data endpoint. This zero bandwidth alternative setting 0 is always implemented by the design.
|
||||
|
||||
For further information refer to 3.16.2 of `USB Audio Device Class Definition for Audio Devices <http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip>`_
|
||||
|
||||
Customisable parameters for the Alternate Settings provided by the design are as follows.:
|
||||
|
||||
* Audio sample resolution
|
||||
* Audio sample subslot size
|
||||
* Audio data format
|
||||
|
||||
.. note::
|
||||
|
||||
Currently only a single format is supported for the recording stream
|
||||
|
||||
By default the design exposes two sets of Alternative Settings for the playback Audio Streaming interface, one for 16-bit and another for
|
||||
24-bit playback. When DSD is enabled an additional (32-bit) alternative is exposed.
|
||||
|
||||
Audio Subslot
|
||||
-------------
|
||||
|
||||
An audio subslot holds a single audio sample. See `USB Device Class Definition for Audio Data Formats
|
||||
<http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip>`_ for full details.
|
||||
This is represented by `bSubslotSize` in the devices descriptor set.
|
||||
|
||||
An audio subslot always contains an integer number of bytes. The specification limits the possible
|
||||
audio subslot size to 1, 2, 3 or 4 bytes per audio subslot.
|
||||
|
||||
Since the xCORE is a 32-bit machine the value 4 is typically used for `bSubSlot` - this means that
|
||||
packing/unpacking samples to/from packets is trivial. Other values can, however, be used and the design
|
||||
supports values 4, 3 and 2.
|
||||
|
||||
Values other than 4 may be used for the following reasons:
|
||||
|
||||
* Bus-bandwidth needs to be efficiently utilised. For example maximising channel-count/sample-rates in
|
||||
full-speed operation.
|
||||
|
||||
* To support restrictions with certain hosts. For example many Android based hosts support only 16bit
|
||||
samples in a 2-byte subslot.
|
||||
|
||||
`bSubSlot` size is set using the following defines:
|
||||
|
||||
* When running in high-speed:
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES`
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES`
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES`
|
||||
|
||||
* When running in full-speed:
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES`
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES`
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES`
|
||||
|
||||
|
||||
Audio Sample Resolution
|
||||
-----------------------
|
||||
|
||||
An audio sample is represented using a number of bits (`bBitResolution`) less than or equal to the number
|
||||
of total bits available in the audio subslot i.e. `bBitResolution` <= `bSubslotSize` * 8). The design
|
||||
supports values 16, 24 and 32.
|
||||
|
||||
`bBitResolution` is set using the following defines:
|
||||
|
||||
* When operating at high-speed:
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS`
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS`
|
||||
|
||||
* `HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS`
|
||||
|
||||
* When operating at full-speed:
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS`
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS`
|
||||
|
||||
* `FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS`
|
||||
|
||||
|
||||
Audio Format
|
||||
------------
|
||||
|
||||
The design supports two audio formats, PCM and, when "Native" DSD is enabled, Direct Stream Digital (DSD).
|
||||
A DSD capable DAC is required for the latter.
|
||||
|
||||
The USB Audio `Raw Data` format is used to indicate DSD data (2.3.1.7.5 of `USB Device Class
|
||||
Definition for Audio Data Formats <http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip>`_).
|
||||
This use of a RAW/DSD format in an alternative setting is termed by XMOS as *Native DSD*
|
||||
|
||||
The following defines affect both full-speed and high-speed operation:
|
||||
|
||||
* STREAM_FORMAT_OUTPUT_1_DATAFORMAT
|
||||
|
||||
* STREAM_FORMAT_OUTPUT_2_DATAFORMAT
|
||||
|
||||
* STREAM_FORMAT_OUTPUT_3_DATAFORMAT
|
||||
|
||||
The following options are supported:
|
||||
|
||||
* UAC_FORMAT_TYPEI_RAW_DATA
|
||||
|
||||
* UAC_FORMAT_TYPEI_PCM
|
||||
|
||||
.. note::
|
||||
|
||||
Currently DSD is only supported on the output/playback stream
|
||||
|
||||
.. note::
|
||||
|
||||
4 byte slot size with a 32 bit resolution is required for RAW/DSD format
|
||||
|
||||
Native DSD requires driver support and is available in the Thesycon Windows driver via ASIO.
|
||||
|
||||
|
||||
73
lib_xua/doc/rst/opt_channels.rst
Normal file
73
lib_xua/doc/rst/opt_channels.rst
Normal file
@@ -0,0 +1,73 @@
|
||||
|newpage|
|
||||
|
||||
Channel Counts and Sample Rates
|
||||
===============================
|
||||
|
||||
The codebase is fully configurable in relation to channel counts and sample rates.
|
||||
Practical limitations of these are normally based on USB packet size restrictions and I/O
|
||||
availablity.
|
||||
|
||||
For example, the maximum packet size for high-speed USB is 1024 bytes, limiting the channel count
|
||||
to 10 channels for a device running at 192kHz with 32bit sample depth.
|
||||
|
||||
The defines in :ref:`opt_channel_defines` set the channel counts exposed to the USB host.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _opt_channel_defines:
|
||||
.. list-table:: Channel count defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``NUM_USB_CHAN_OUT``
|
||||
- Number of output channels the device advertises to the USB host
|
||||
- N/A (must be defined)
|
||||
* - ``NUM_USB_CHAN_IN``
|
||||
- Number of input channels the device advertises to the USB host
|
||||
- N/A (must be defined)
|
||||
|
||||
Sample rates ranges are set by the defines in :ref:`opt_channel_sr_defines`. The codebase will
|
||||
automatically populate the device sample rate list with popular frequencies between the min and
|
||||
max values. All values are in Hz:
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _opt_channel_sr_defines:
|
||||
.. list-table:: Sample rate defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``MAX_FREQ``
|
||||
- Maximum supported sample rate (Hz)
|
||||
- ``192000``
|
||||
* - ``MIN_FREQ``
|
||||
- Minimum supported sample rate (Hz)
|
||||
- ``44100``
|
||||
* - ``DEFAULT_FREQ``
|
||||
- Starting frequency for the device after boot
|
||||
- ``MIN_FREQ``
|
||||
|
||||
|
||||
The codebase requires knowledge of the two master clock frequencies that will be present on the
|
||||
master-clock port(s). One for 44.1kHz, 88.2kHz etc and one for 48kHz, 96kHz etc. These are set
|
||||
using defines in :ref:`opt_channel_mc_defines`. All values are in Hz.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _opt_channel_mc_defines:
|
||||
.. list-table:: Master clock rate defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``CLK_441``
|
||||
- Master clock defines for 44100 rates (Hz)
|
||||
- ``(256 * 44100)``
|
||||
* - ``MCLK_48``
|
||||
- Master clock defines for 48000 rates (Hz)
|
||||
- ``(256 * 48000)``
|
||||
104
lib_xua/doc/rst/opt_dsd.rst
Normal file
104
lib_xua/doc/rst/opt_dsd.rst
Normal file
@@ -0,0 +1,104 @@
|
||||
|newpage|
|
||||
|
||||
Direct Stream Digital (DSD)
|
||||
===========================
|
||||
|
||||
Direct Stream Digital (DSD) is used for digitally encoding audio signals on Super Audio CDs (SACD).
|
||||
It uses pulse-density modulation (PDM) encoding.
|
||||
|
||||
The codebase supports DSD playback from the host via "DSD over PCM" (DoP) and a "Native" implementation
|
||||
which is, while USB specification based, proprietary to XMOS.
|
||||
|
||||
DSD is enabled with by setting the define in :ref:`opt_dsd_defines` to a non-zero value.
|
||||
|
||||
.. _opt_dsd_defines:
|
||||
|
||||
.. list-table:: DSD defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``DSD_CHANS_DAC``
|
||||
- Number of DSD channels
|
||||
- ``0`` (Disabled)
|
||||
|
||||
Typically this would be set to ``2`` for stereo output.
|
||||
|
||||
By default both "Native" and DoP functionality are enabled when DSD is enabled. The Native DSD implementation uses
|
||||
an alternative streaming interface such that the host can inform the device that DSD data is being streamed.
|
||||
See: ::ref:`sec_opt_audio_formats` for details.
|
||||
|
||||
If only DoP functionality is desired the Native implementation can be disabled with the define in
|
||||
:ref:`opt_nativedsd_defines`.
|
||||
|
||||
.. _opt_nativedsd_defines:
|
||||
|
||||
.. list-table:: Native DSD defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``NATIVE_DSD``
|
||||
- Enable/Disable "Native" DSD implementation
|
||||
- ``1`` (Enabled)
|
||||
|
||||
|
||||
DSD over PCM (DoP)
|
||||
------------------
|
||||
|
||||
DoP support follows the method described in the `DoP Open Standard 1.1
|
||||
<http://dsd-guide.com/sites/default/files/white-papers/DoP_openStandard_1v1.pdf>`_.
|
||||
|
||||
While Native DSD support is available in Windows though a driver, OSX incorporates a USB driver
|
||||
that only supports PCM, this is also true of the central audio engine, CoreAudio. It is
|
||||
therefore not possible to use the "Native" scheme defined above using the built in driver of OSX.
|
||||
|
||||
Since the Apple OS only allows a PCM path a method of transporting DSD audio data over PCM frames
|
||||
has been developed.
|
||||
|
||||
Standard DSD has a sample size of 1 bit and a sample rate of 2.8224MHz - this is 64x the speed of a
|
||||
compact disc (CD). This equates to the same data-rate as a 16 bit PCM stream at 176.4kHz.
|
||||
|
||||
In order to clearly identify when this PCM stream contains DSD and when it contains PCM some header
|
||||
bits are added to the sample. A 24-bit PCM stream is therefore used, with the most significant
|
||||
byte being used for a DSD marker (alternating 0x05 and 0xFA values).
|
||||
|
||||
When enabled, if USB audio design detects a un-interrupted run of these samples (above a defined
|
||||
threshold) it switches to DSD mode, using the lower 16-bits as DSD sample data. When this check for
|
||||
DSD headers fails the design falls back to PCM mode. DoP detection and switching is done completely
|
||||
in the Audio/I2S core (`audio.xc`). All other code handles the audio samples as PCM.
|
||||
|
||||
The design supports higher DSD/DoP rates (i.e. DSD128) by simply raising the underlying PCM sample
|
||||
rate e.g. from 176.4kHz to 352.8kHz. The marker byte scheme remains exactly the same regardless
|
||||
of rate.
|
||||
|
||||
.. note::
|
||||
|
||||
DoP requires bit-perfect transmission - therefore any audio/volume processing will break the stream.
|
||||
|
||||
"Native" vs DoP
|
||||
---------------
|
||||
|
||||
Since the DoP specification requires header bytes this eats into the data bandwidth. The "Native" implementation
|
||||
has no such overhead and can therefore transfer the same DSD rate and half the effective PCM rate of DoP.
|
||||
Such a property may be desired when upporting DSD128 without exposing a 352.8kHz PCM rate, for example.
|
||||
|
||||
Ports
|
||||
-----
|
||||
|
||||
The codebase expects 1-bit ports to be defined in the application XN file for the DSD data and
|
||||
clock lines for example::
|
||||
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_DSD_DAC0"/>
|
||||
<port Location="XS1_PORT_1N" Name="PORT_DSD_DAC1"/>
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_DSD_CLK"/>
|
||||
|
||||
.. note::
|
||||
|
||||
The DSD ports may or may not overlap the I2S ports - the codebase will reconfigure the ports as appropriate
|
||||
when switching between PCM and DSD modes.
|
||||
|
||||
49
lib_xua/doc/rst/opt_i2s.rst
Normal file
49
lib_xua/doc/rst/opt_i2s.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
|newpage|
|
||||
|
||||
I2S/TDM
|
||||
=======
|
||||
|
||||
I2S/TDM is typically fundamental to most products and is built into the ``XUA_AudioHub()`` core.
|
||||
|
||||
The defines in :ref:`opt_i2s_defines` effect the I2S implementation.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _opt_i2s_defines:
|
||||
.. list-table:: I2S defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``I2S_CHANS_DAC``
|
||||
- The desired number of output channels via I2S (0 for disabled)
|
||||
- N/A (Must be defined)
|
||||
* - ``I2S_CHANS_ADC``
|
||||
- The desired number of input channels via I2S (0 for disabled)
|
||||
- N/A (Must be defined)
|
||||
* - ``XUA_PCM_FORMAT``
|
||||
- Enabled either TDM or I2S mode
|
||||
- ``XUA_PCM_FORMAT_I2S``
|
||||
* - ``CODEC_MASTER``
|
||||
- Sets is xCORE is I2S master or slave
|
||||
- ``0`` (xCORE is master)
|
||||
|
||||
The I2S code expects that the ports required for I2S (master clock, LR-clock, bit-clock and data lines) are be defined in the application XN file in the relevant `Tile``.
|
||||
For example::
|
||||
|
||||
<Tile Number="0" Reference="tile[0]">
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_MCLK_IN"/>
|
||||
<Port Location="XS1_PORT_1B" Name="PORT_I2S_LRCLK"/>
|
||||
<Port Location="XS1_PORT_1C" Name="PORT_I2S_BCLK"/>
|
||||
<Port Location="XS1_PORT_1D" Name="PORT_I2S_DAC0"/>
|
||||
<port Location="XS1_PORT_1E" Name="PORT_I2S_DAC1"/>
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_I2S_ADC0"/>
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_I2S_ADC1"/>
|
||||
</Tile>
|
||||
|
||||
All of the I2S related ports must be 1-bit ports.
|
||||
|
||||
.. note::
|
||||
|
||||
TDM mode allows 8 channels (rather than 2) to be supplied on each dataline.
|
||||
44
lib_xua/doc/rst/opt_location.rst
Normal file
44
lib_xua/doc/rst/opt_location.rst
Normal file
@@ -0,0 +1,44 @@
|
||||
|newpage|
|
||||
|
||||
Code Location
|
||||
=============
|
||||
|
||||
When designing a system there is a choice as to which hardware resources to use for each interface.
|
||||
In a multi-tile system the codebase needs to be informed as to which tiles to use for these hardware
|
||||
resources and associated code.
|
||||
|
||||
A series of defines are used to allow the programmer to easily move code between tiles. Arguably the
|
||||
most important of these are ``AUDIO_IO_TILE`` and ``XUD_TILE``. :ref:`opt_location_defines` shows a
|
||||
full listing of these ``TILE`` defines.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
.. _opt_location_defines:
|
||||
.. list-table:: Tile defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``AUDIO_IO_TILE``
|
||||
- Tile on which I2S, ADAT Rx, S/PDIF Rx & mixer resides
|
||||
- ``0``
|
||||
* - ``XUD_TILE``
|
||||
- Tile on which USB resides, including buffering for all USB interfaces/endppoints
|
||||
- ``0``
|
||||
* - ``MIDI_TILE``
|
||||
- Tile on which MIDI resides
|
||||
- Same as ``AUDIO_IO_TILE``
|
||||
* - ``SPDIF_TX_TILE``
|
||||
- Tile on which S/PDIF Tx resides
|
||||
- Same as ``AUDIO_IO_TILE``
|
||||
* - ``PDM_TILE``
|
||||
- Tile on which PDM microphones resides
|
||||
- Same as ``AUDIO_IO_TILE``
|
||||
* - ``PLL_REF_TILE``
|
||||
- Tile on which reference signal to CS2100 resides
|
||||
- Same as ``AUDIO_IO_TILE``
|
||||
|
||||
.. note::
|
||||
|
||||
It should be ensured that the relevant port defines in the application XN file match the code location defines
|
||||
54
lib_xua/doc/rst/opt_midi.rst
Normal file
54
lib_xua/doc/rst/opt_midi.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
|newpage|
|
||||
|
||||
MIDI
|
||||
====
|
||||
|
||||
The codebase supports MIDI input/output over USB as per `Universal Serial Bus Device Class Definition for MIDI Devices <https://www.usb.org/sites/default/files/midi10.pdf>`_.
|
||||
|
||||
MIDI functionality is enabled with the define in :ref:`opt_midi_defines`.
|
||||
|
||||
.. _opt_midi_defines:
|
||||
|
||||
.. list-table:: MIDI enable define
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``MIDI``
|
||||
- Enable MIDI functionality
|
||||
- ``0`` (Disabled)
|
||||
|
||||
|
||||
The codebase supports MIDI receive on a 4-bit or 1-bit port, defaulting to using a 1-bit port.
|
||||
MIDI transmit is supported port of any bit-width. By default the codebase assumes the transmit
|
||||
and receive I/O is connected to bit[0] of the port. This is configurable for the transmit port.
|
||||
:ref:`opt_midi_defines` provides information on the configuring these parameters.
|
||||
|
||||
.. _opt_midi_port_defines:
|
||||
|
||||
.. list-table:: MIDI port defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``MIDI_RX_PORT_WIDTH``
|
||||
- Port width of the MIDI rx port (1 or 4bit)
|
||||
- ``1`` (1-bit port)
|
||||
* - ``MIDI_SHIFT_TX``
|
||||
- MIDI tx bit
|
||||
- ``0`` (bit[0])
|
||||
|
||||
The MIDI code expects that the ports for receive and transmit are defined in the application XN file in the relevant Tile.
|
||||
The expected names for the ports are ``PORT_MIDI_IN`` and ``PORT_MIDI_OUT``, for example::
|
||||
|
||||
<Tile Number="0" Reference="tile[0]">
|
||||
<!-- MIDI -->
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_MIDI_IN"/>
|
||||
<Port Location="XS1_PORT_4C" Name="PORT_MIDI_OUT"/>
|
||||
</Tile>
|
||||
|
||||
41
lib_xua/doc/rst/opt_mixer.rst
Normal file
41
lib_xua/doc/rst/opt_mixer.rst
Normal file
@@ -0,0 +1,41 @@
|
||||
|newpage|
|
||||
|
||||
Mixer
|
||||
=====
|
||||
|
||||
The codebase supports audio mixing functionality with highly flexible routing options.
|
||||
|
||||
Essentially the mixer is capable of performing 8 separate mixes with up to 18 inputs at sample rates
|
||||
up to 96kHz and 2 mixes with up to 18 inputs at higher sample rates.
|
||||
|
||||
Inputs to the mixer can be selected from any device input (USB, S/PDIF, I2S etc) and
|
||||
outputs from the mixer can be routed to any device output (USB, S/PDIF, I2S etc).
|
||||
|
||||
See :ref:`usb_audio_sec_mixer` for full details of the mixer including control.
|
||||
|
||||
Basic configuration of mixer functionality is achieved with the defines in :ref:`opt_mixer_defines`.
|
||||
|
||||
.. _opt_mixer_defines:
|
||||
|
||||
.. list-table:: Mixer defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``MIXER``
|
||||
- Enable mixer
|
||||
- ``0`` (Disabled)
|
||||
* - ``MAX_MIX_COUNT``
|
||||
- Number of separate mix outputs to perform
|
||||
- ``8``
|
||||
* - ``MIX_INPUTS``
|
||||
- Number of channels input into the mixer
|
||||
- ``18``
|
||||
|
||||
.. note::
|
||||
|
||||
The mixer cores always run on the tile defined by ``AUDIO_IO_TILE``
|
||||
|
||||
|
||||
26
lib_xua/doc/rst/opt_other.rst
Normal file
26
lib_xua/doc/rst/opt_other.rst
Normal file
@@ -0,0 +1,26 @@
|
||||
|newpage|
|
||||
|
||||
Other Options
|
||||
=============
|
||||
|
||||
There are a few other, lesser used, options available.
|
||||
|
||||
.. _opt_other_defines:
|
||||
|
||||
.. list-table:: Other defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``XUA_USB_EN``
|
||||
- Allows the use of the audio subsytem without USB
|
||||
- ``1`` (enabled)
|
||||
* - ``INPUT_VOLUME_CONTROL``
|
||||
- Enables volume control on input channels, both descriptors and processing
|
||||
- ``1`` (enabled)
|
||||
* - ``OUTPUT_VOLUME_CONTROL``
|
||||
- Enables volume control on output channels, both descriptors and processing
|
||||
- ``1`` (enabled)
|
||||
|
||||
36
lib_xua/doc/rst/opt_pdm.rst
Normal file
36
lib_xua/doc/rst/opt_pdm.rst
Normal file
@@ -0,0 +1,36 @@
|
||||
|newpage|
|
||||
|
||||
PDM Microphones
|
||||
===============
|
||||
|
||||
The codebase supports input from up to 8 PDM microphones.
|
||||
|
||||
PDM microphone support is provided via ``lib_mic_array``. Settings for PDM microphones are controlled
|
||||
via the defines in :ref:`opt_pdm_defines`.
|
||||
|
||||
.. _opt_pdm_defines:
|
||||
|
||||
.. list-table:: PDM defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``XUA_NUM_PDM_MICS``
|
||||
- The number of mics to enable (0 for disabled)
|
||||
- ``0`` (disabled)
|
||||
* - ``PDM_MIC_INDEX``
|
||||
- Defines which input channel the mics map to
|
||||
- ``0``
|
||||
|
||||
The codebase expects 1-bit ports to be defined in the application XN file for ``PORT_PDM_CLK`` and ``PORT_PDM_MCLK``.
|
||||
An 8-bit port is expected for ``PORT_PDM_DATA``. For example::
|
||||
|
||||
<Tile Number="0" Reference="tile[0]">
|
||||
<!-- Mic related ports -->
|
||||
<Port Location="XS1_PORT_1E" Name="PORT_PDM_CLK"/>
|
||||
<Port Location="XS1_PORT_8B" Name="PORT_PDM_DATA"/>
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_PDM_MCLK"/>
|
||||
</Tile>
|
||||
|
||||
60
lib_xua/doc/rst/opt_spdif_rx.rst
Normal file
60
lib_xua/doc/rst/opt_spdif_rx.rst
Normal file
@@ -0,0 +1,60 @@
|
||||
|newpage|
|
||||
|
||||
S/PDIF Receive
|
||||
==============
|
||||
|
||||
The codebase supports a single, stereo, S/PDIF receiver. This can be input via 75 Ω coaxial or optical fibre.
|
||||
In order to provide S/PDIF functionality ``lib_xua`` uses ``lib_spdif`` (https://www.github.com/xmos/lib_spdif).
|
||||
|
||||
Basic configuration of S/PDIF receive functionality is achieved with the defines in :ref:`opt_spdif_rx_defines`.
|
||||
|
||||
.. _opt_spdif_rx_defines:
|
||||
|
||||
.. list-table:: S/PDIF rx defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``XUA_SPDIF_RX_EN``
|
||||
- Enable S/PDIF receive
|
||||
- ``0`` (Disabled)
|
||||
* - ``SPDIF_RX_INDEX``
|
||||
- Defines which channels S/PDIF will be input on
|
||||
- N/A (must defined)
|
||||
|
||||
.. note::
|
||||
|
||||
S/PDIF receive always runs on the tile defined by ``AUDIO_IO_TILE``
|
||||
|
||||
The codebase expects the S/PDIF receive port to be defined in the application XN file as ``PORT_SPDIF_IN``.
|
||||
This must be a 1-bit port, for example::
|
||||
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_SPDIF_IN"/>
|
||||
|
||||
When S/PDIF receive is enabled the codebase expects to drive a synchronisation signal to an external
|
||||
Cirrus Logic CS2100 device for master-clock generation.
|
||||
|
||||
The programmer should ensure the define in :ref:`opt_spdif_rx_ref_defines` is set appropriately.
|
||||
|
||||
.. _opt_spdif_rx_ref_defines:
|
||||
|
||||
.. list-table:: Reference Clock Location
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``PLL_REF_TILE``
|
||||
- Tile location of reference to CS2100 device
|
||||
- ``AUDIO_IO_TILE``
|
||||
|
||||
The codebase expects this reference signal port to be defined in the application XN file as ``PORT_PLL_REF``.
|
||||
This may be a port of any bit-width, however, connection to bit[0] is assumed::
|
||||
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
|
||||
|
||||
Configuration of the external CS2100 device (typically via I2C) is beyond the scope of this document.
|
||||
|
||||
46
lib_xua/doc/rst/opt_spdif_tx.rst
Normal file
46
lib_xua/doc/rst/opt_spdif_tx.rst
Normal file
@@ -0,0 +1,46 @@
|
||||
|newpage|
|
||||
|
||||
S/PDIF Transmit
|
||||
===============
|
||||
|
||||
The codebase supports a single, stereo, S/PDIF transmitter. This can be output over 75 Ω coaxial or optical fibre.
|
||||
In order to provide S/PDIF transmit functionality ``lib_xua`` uses ``lib_spdif`` (https://www.github.com/xmos/lib_spdif).
|
||||
|
||||
Basic configuration of S/PDIF transmit functionality is achieved with the defines in :ref:`opt_spdif_tx_defines`
|
||||
|
||||
.. _opt_spdif_tx_defines:
|
||||
|
||||
.. list-table:: S/PDIF tx defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``XUA_SPDIF_TX_EN``
|
||||
- Enable S/PDIF transmit
|
||||
- ``0`` (Disabled)
|
||||
* - ``SPDIF_TX_INDEX``
|
||||
- Output channel offset to use for S/PDIF transmit
|
||||
- ``0``
|
||||
|
||||
In addition, the developer may choose which tile the S/PDIF transmitter runs on, see :ref:`opt_spdif_tx_tile_defines`.
|
||||
|
||||
.. _opt_spdif_tx_tile_defines:
|
||||
|
||||
.. list-table:: S/PDIF tile define
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``SPDIF_TX_TILE``
|
||||
- Tile that S/PDIF tx is connected to
|
||||
- ``AUDIO_IO_TILE``
|
||||
|
||||
The codebase expects the S/PDIF transmit port to be defined in the application XN file as ``PORT_SPDIF_OUT``.
|
||||
This must be a 1-bit port, for example::
|
||||
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_SPDIF_OUT"/>
|
||||
|
||||
41
lib_xua/doc/rst/opt_strings.rst
Normal file
41
lib_xua/doc/rst/opt_strings.rst
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Strings and ID's
|
||||
================
|
||||
|
||||
The codebase includes various strings and ID's that should be customised to match the product requirements.
|
||||
These are listed in ::ref:`opt_strings_defines`.
|
||||
|
||||
The Vendor ID (VID) should be acquired from the USB Implementers Forum (www.usb.org). Under no circumstances
|
||||
should the XMOS VID or any other VID be used without express permission.
|
||||
|
||||
The VID and Product ID (PID) pair must be unique to each product, otherwise driver incompatibilities may arise.
|
||||
|
||||
.. tabularcolumns:: lp{5cm}l
|
||||
|
||||
.. _opt_strings_defines:
|
||||
|
||||
.. list-table:: String & ID defines
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``VENDOR_STR``
|
||||
- Name of vendor/manufacturer, note the is appended to various strings.
|
||||
- ``"XMOS"``
|
||||
* - ``PRODUCT_STR_A2``
|
||||
- Name of the product when running in Audio Class 2.0 mode
|
||||
- ``"XMOS xCORE (UAC2.0)"``
|
||||
* - ``PRODUCT_STR_A1``
|
||||
- Name of the product when running in Audio Class 1.0 mode
|
||||
- ``"XMOS xCORE (UAC1.0)"``
|
||||
* - ``PID_AUDIO_2``
|
||||
- Product ID when running in Audio Class 2.0 mode
|
||||
- ``0x0002``
|
||||
* - ``PID_AUDIO_1``
|
||||
- Product ID when running in Audio Class 1.0 mode
|
||||
- ``0x0003``
|
||||
|
||||
|
||||
|
||||
66
lib_xua/doc/rst/opt_sync.rst
Normal file
66
lib_xua/doc/rst/opt_sync.rst
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
|newpage|
|
||||
|
||||
Synchronisation
|
||||
===============
|
||||
|
||||
The codebase supports "Synchronous" and "Asynchronous" modes for USB transfer as defined by the
|
||||
USB specification(s).
|
||||
|
||||
Asynchronous mode (``XUA_SYNCMODE_ASYNC``) has the advantage that the device is clock-master. This means that
|
||||
a high-quality local master-clock source can be utilised. It also has the benefit that the device may
|
||||
synchronise it's master clock to an external digital input stream e.g. S/PDIF and thus avoiding sample-rate
|
||||
conversion.
|
||||
|
||||
The drawback of this mode is that it burdens the host with syncing to the device which some hosts
|
||||
may not support. This is especially pertinent to embedded hosts, however, most PC's and mobile devices
|
||||
will indeed support this mode.
|
||||
|
||||
Synchronous mode (``XUA_SYNCMODE_SYNC``) is an option if the target host does not support asynchronous mode
|
||||
or if it is desirable to synchronise many devices to a single host. It should be noted, however, that input
|
||||
from digital streams, such as S/PDIF, are not currently supported in this mode.
|
||||
|
||||
.. note::
|
||||
|
||||
The selection of synchronisation mode is done at build time and cannot be changed dynamically.
|
||||
|
||||
Setting the synchronisation mode of the device is done using the define in :ref:`opt_sync_defines`
|
||||
|
||||
.. _opt_sync_defines:
|
||||
|
||||
.. list-table:: Sync Define
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``XUA_SYNCMODE``
|
||||
- USB synchronisation mode
|
||||
- ``XUA_SYNCMODE_ASYNC``
|
||||
|
||||
When operating in synchronous mode an external Cirrus Logic CS2100 device is required for master clock
|
||||
generation. The codebase expects to drive a synchronisation signal to this external device
|
||||
|
||||
The programmer should ensure the define in :ref:`opt_sync_ref_defines` is set appropriately.
|
||||
|
||||
.. _opt_sync_ref_defines:
|
||||
|
||||
.. list-table:: Reference clock location
|
||||
:header-rows: 1
|
||||
:widths: 20 80 20
|
||||
|
||||
* - Define
|
||||
- Description
|
||||
- Default
|
||||
* - ``PLL_REF_TILE``
|
||||
- Tile location of reference to CS2100 device
|
||||
- ``AUDIO_IO_TILE``
|
||||
|
||||
The codebase expects this reference signal port to be defined in the application XN file as ``PORT_PLL_REF``.
|
||||
This may be a port of any bit-width, however, connection to bit[0] is assumed::
|
||||
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
|
||||
|
||||
Configuration of the external CS2100 device (typically via I2C) is beyond the scope of this document.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
USB Audio Solution Overview
|
||||
---------------------------
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
.. table::
|
||||
:class: vertical-borders
|
||||
@@ -48,19 +47,21 @@ USB Audio Solution Overview
|
||||
| **Supported Devices** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| XMOS Devices | xCORE-200 Series |
|
||||
| XMOS Devices | xCORE-200 Series |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | xCORE.AI Series |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Requirements** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Development Tools | xTIMEcomposer Development Tools v14 or later |
|
||||
| Development Tools | xTIMEcomposer Development Tools v15.1 or later |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| USB | xCORE-200 Series device with integrated USB Phy |
|
||||
| USB | xCORE device with integrated USB phy (external phy not supported) |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Audio | External audio DAC/ADC/CODECs (and required supporting componentry) supporting I2S/TDM |
|
||||
| Audio | External audio DAC/ADC/CODECs (and required supporting componentry) supporting I2S/TDM |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Boot/Storage | Compatible SPI Flash device (or xCORE-200 device with internal flash) |
|
||||
| Boot/Storage | Compatible SPI/QSPI Flash device (or xCORE device with internal flash) |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Licensing and Support** |
|
||||
@@ -73,5 +74,3 @@ USB Audio Solution Overview
|
||||
| Reference code is maintained by XMOS Limited. |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,89 +1,21 @@
|
||||
|
||||
.. _usb_audio_sec_architecture:
|
||||
Implementation Detail
|
||||
*********************
|
||||
|
||||
USB Audio Software Overview
|
||||
---------------------------
|
||||
This chapter examines the implementation of the various components that make up ``lib_xua``. It also examines the integration of dependencies and supporting libraries.
|
||||
|
||||
This section describes the software architecture of a USB Audio device implemented using `lib_xua`, its dependencies and other supporting libraries.
|
||||
|
||||
`lib_xua` provides fundamental building blocks for producing USB Audio products on XMOS devices. Every system is required to have the components from `lib_xua` listed in :ref:`usb_audio_shared_components`.
|
||||
|
||||
.. _usb_audio_shared_components:
|
||||
|
||||
.. list-table:: Required XUA Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Endpoint 0
|
||||
- Provides the logic for Endpoint 0 which handles
|
||||
enumeration and control of the device including DFU related requests.
|
||||
* - Endpoint buffer
|
||||
- Buffers endpoint data packets to and from the host. Manages delivery of audio packets between the endpoint buffer
|
||||
component and the audio components. It can also handle volume control processing.Note, this currently utlises two cores
|
||||
* - AudioHub
|
||||
- Handles audio I/O over I2S and manages audio data
|
||||
to/from other digital audio I/O components.
|
||||
|
||||
In addition low-level USB I/0 is required and is provided by the external dependency `lib_xud`
|
||||
|
||||
.. list-table:: Additional Components Required
|
||||
:header-rows: 1
|
||||
:widths: 100 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - XMOS USB Device Driver (XUD)
|
||||
- Handles the low level USB I/O.
|
||||
|
||||
In addition :ref:`usb_audio_optional_components` shows optional components that can be added/enabled from within `lib_xua`
|
||||
|
||||
.. _usb_audio_optional_components:
|
||||
|
||||
.. list-table:: Optional Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Mixer
|
||||
- Allows digital mixing of input and output channels. It can also
|
||||
handle volume control instead of the decoupler.
|
||||
* - Clockgen
|
||||
- Drives an external frequency generator (PLL) and manages
|
||||
changes between internal clocks and external clocks arising
|
||||
from digital input.
|
||||
* - MIDI
|
||||
- Outputs and inputs MIDI over a serial UART interface.
|
||||
|
||||
`lib_xua` also provides optional support for integrating with the following eternal dependencies:
|
||||
|
||||
.. list-table:: Optional Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - S/PDIF Transmitter (lib_spdif)
|
||||
- Outputs samples of an S/PDIF digital audio interface.
|
||||
* - S/PDIF Receiver (lib_spdif)
|
||||
- Inputs samples of an S/PDIF digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - ADAT Receiver (lib_adat)
|
||||
- Inputs samples of an ADAT digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - PDM Microphones (lib_mic_array)
|
||||
- Receives PDM data from microphones and performs PDM to PCM conversion
|
||||
|
||||
.. _usb_audio_threads:
|
||||
|
||||
.. figure:: images/threads-crop.*
|
||||
:width: 100%
|
||||
|
||||
USB Audio Core Diagram
|
||||
|
||||
:ref:`usb_audio_threads` shows how the components interact with each
|
||||
other in a typical system. The green circles represent cores with arrows indicating inter-core communications.
|
||||
.. toctree::
|
||||
|
||||
sw_audio
|
||||
sw_ep0
|
||||
sw_xud
|
||||
sw_clocking
|
||||
sw_mixer
|
||||
sw_spdif
|
||||
sw_spdif_rx
|
||||
sw_adat_rx
|
||||
sw_midi
|
||||
sw_pdm
|
||||
sw_hid
|
||||
sw_resource
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
ADAT Receive
|
||||
------------
|
||||
|
||||
The ADAT receive component receives up to eight channels of audio at a sample rate
|
||||
of 44.1kHz or 48kHz. The API for calling the receiver functions is
|
||||
described in :ref:`usb_audio_sec_component_api`.
|
||||
|
||||
The component outputs 32 bits words split into nine word frames. The
|
||||
frames are laid out in the following manner:
|
||||
|
||||
* Control byte
|
||||
* Channel 0 sample
|
||||
* Channel 1 sample
|
||||
* Channel 2 sample
|
||||
* Channel 3 sample
|
||||
* Channel 4 sample
|
||||
* Channel 5 sample
|
||||
* Channel 6 sample
|
||||
* Channel 7 sample
|
||||
|
||||
Example of code show how to read the output of the ADAT component is shown below::
|
||||
|
||||
control = inuint(oChan);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
sample[i] = inuint(oChan);
|
||||
}
|
||||
|
||||
Samples are 24-bit values contained in the lower 24 bits of the word.
|
||||
|
||||
The control word comprises four control bits in bits [11..8] and the value 0b00000001 in bits [7..0].
|
||||
This control word enables synchronization at a higher level, in that on the channel a single odd
|
||||
word is always read followed by eight words of data.
|
||||
|
||||
.. Timing Requirements
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. The data samples are outputted onto the channel every 2.4 us. The
|
||||
.. control sample follows 1.7 us after the last data sample, and is
|
||||
.. followed 2.4 us later by the first data sample. Given that a channel
|
||||
.. can hold two words of data, when data appears on the channel, it
|
||||
.. should be input within 4.1 us otherwise the ADAT receiver will block,
|
||||
.. and data will be lost. Between data samples a window of 4.8 us is
|
||||
.. available.
|
||||
|
||||
Integration
|
||||
~~~~~~~~~~~
|
||||
|
||||
Since the ADAT is a digital stream the devices master clock must synchronised to it. This is
|
||||
typically achieved with an external fractional-n clock multiplier.
|
||||
|
||||
The ADAT receive function communicates with the clockGen component which passes audio data onto the
|
||||
audio driver and handles locking to the ADAT clock source if required.
|
||||
54
lib_xua/doc/rst/sw_adat_rx.rst
Normal file
54
lib_xua/doc/rst/sw_adat_rx.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
|newpage|
|
||||
|
||||
ADAT Receive
|
||||
============
|
||||
|
||||
The ADAT receive component receives up to eight channels of audio at a sample rate
|
||||
of 44.1kHz or 48kHz. The API for calling the receiver functions is
|
||||
described in :ref:`usb_audio_sec_component_api`.
|
||||
|
||||
The component outputs 32 bits words split into nine word frames. The
|
||||
frames are laid out in the following manner:
|
||||
|
||||
* Control byte
|
||||
* Channel 0 sample
|
||||
* Channel 1 sample
|
||||
* Channel 2 sample
|
||||
* Channel 3 sample
|
||||
* Channel 4 sample
|
||||
* Channel 5 sample
|
||||
* Channel 6 sample
|
||||
* Channel 7 sample
|
||||
|
||||
An example of how to read the output of the ADAT component is shown below::
|
||||
|
||||
control = inuint(oChan);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
sample[i] = inuint(oChan);
|
||||
}
|
||||
|
||||
Samples are 24-bit values contained in the lower 24 bits of the word.
|
||||
|
||||
The control word comprises four control bits in bits [11..8] and the value 0b00000001 in bits [7..0].
|
||||
This control word enables synchronization at a higher level, in that on the channel a single odd
|
||||
word is always read followed by eight words of data.
|
||||
|
||||
|
||||
Usage and Integration
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Since the ADAT is a digital stream the device's master clock must synchronised to it. The integration
|
||||
of ADAT receive is much the same as S/PDIF receive in that the ADAT receive function communicates
|
||||
with the Clock Gen core. This Clock Gen Core then passes audio data onto the Audio Hub core.
|
||||
It also handles locking to the ADAT clock source.
|
||||
|
||||
There are some small differences with the S/PDIF integration accounting for the fact that ADAT
|
||||
typically has 8 channels compared to S/DIF's two.
|
||||
|
||||
The Clock Gen core also handles SMUX II (e.g. 4 channels at 96kHz) and SMUX IV (e.g. 2 channels at
|
||||
192kHz), populating the sample FIFO as appropriate. SMUX modes are communicated to the Clock Gen
|
||||
core from Endpoint 0 via the ``c_clk_ctl`` channel. SMUX modes are exposed to the USB host using
|
||||
Alternative Interfaces, with appropriate channel counts, for the streaming input Endpoint.
|
||||
|
||||
@@ -1,26 +1,32 @@
|
||||
|newpage|
|
||||
|
||||
.. _usb_audio_sec_audio:
|
||||
|
||||
AudioHub/I2S
|
||||
............
|
||||
Audio Hub
|
||||
=========
|
||||
|
||||
The AudioHub task performs many functions. It receives and transmits samples from/to the decoupler or mixer core over an XC channel.
|
||||
The Audio Hub task performs many functions. It receives and transmits samples from/to the Decoupler
|
||||
or Mixer core over a channel.
|
||||
|
||||
It also drives several in and out I2S/TDM channels to/from a CODEC, DAC, ADC etc - from now on termed "audio hardware".
|
||||
It also drives several in and out I2S/TDM channels to/from a CODEC, DAC, ADC etc. From now on these
|
||||
external devices will be termed "audio hardware".
|
||||
|
||||
If the firmware is configured with the xCORE as I2S master the requred clock lines will also be driven out from this task also.
|
||||
If the firmware is configured with the xCORE as I2S master the required clock lines will also be
|
||||
driven from this task. It also has the task of forwarding on and receiving samples to/from other
|
||||
audio related tasks/cores such as S/PDIF tasks, ADAT etc.
|
||||
|
||||
It also has the task of formwarding on and reciving samples to/from other audio related tasks such as S/PDIF tasks, ADAT tasks etc.
|
||||
In master mode, the xCORE generates the I2S "Continuous Serial Clock (SCK)", or "Bit-Clock (BCLK)"
|
||||
and the "Word Select (WS)" or "left-right clock (LRCLK)" signals. Any CODEC or DAC/ADC combination
|
||||
that supports I2S and can be used.
|
||||
|
||||
The AudioHub task must be connected to external audio hardware that supports I2S (other modes such as "left justified" can be supported with firmware changes).
|
||||
The LR-clock, bit-clock and data are all derived from the incoming master clock (typically the
|
||||
output of the external oscillator or PLL). This is not part of the I2S standard but is commonly
|
||||
included for synchronizing the internal operation of the analog/digital converters.
|
||||
|
||||
In master mode, the XMOS device acts as the master generating the I2S "Continous Serial Clock (SCK)" typically called the Bit-Clock (BCLK) and the "Word Select (WS)" line typically called left-right clock (LRCLK) signals. Any CODEC or DAC/ADC combination that supports I2S and can be used.
|
||||
The Audio Hub task is implemented in the file ``xua_audiohub.xc``.
|
||||
|
||||
The LR-clock, bit-clock and data are all derived from the incoming master clock (typically the output of the external oscillator or PLL)
|
||||
- This is not part of the I2S standard but is commonly included for synchronizing the internal operation of the analog/digital converters.
|
||||
|
||||
The AudioHub task is implemented in the file ``xua_audiohub.xc``.
|
||||
|
||||
:ref:`usb_audio_codec_signals` shows the signals used to communicate audio between the XMOS device and the external audio hardware.
|
||||
:ref:`usb_audio_codec_signals` shows the signals used to communicate audio between the XMOS device
|
||||
and the external audio hardware.
|
||||
|
||||
.. _usb_audio_codec_signals:
|
||||
|
||||
@@ -83,13 +89,15 @@ with BCLK then being used to clock data in (SDIN) and data out (SDOUT) of the ex
|
||||
- 12.288
|
||||
- 2
|
||||
|
||||
The master clock must be supplied by an external source e.g. clock generator, fixed oscillators, PLL etc to generate the two frequencies to support
|
||||
44.1kHz and 48kHz audio frequencies (e.g. 11.2896/22.5792MHz and 12.288/24.576MHzrespectively). This master clock input is then provided to the
|
||||
external audio hardware and the xCORE device.
|
||||
For xCORE-200 devices the master clock must be supplied by an external source e.g. clock generator,
|
||||
fixed oscillators, PLL etc. xCORE.ai devices may use the integrated secondary PLL.
|
||||
|
||||
Two master clock frequencies to support 44.1kHz and 48kHz audio frequencies (e.g. 11.2896/22.5792MHz
|
||||
and 12.288/24.576MHz respectively). This master clock input is then provided to the external audio
|
||||
hardware and the xCORE device.
|
||||
|
||||
Port Configuration (xCORE Master)
|
||||
+++++++++++++++++++++++++++++++++
|
||||
---------------------------------
|
||||
|
||||
The default software configuration is xCORE is I2S master. That is, the XMOS device provides the BCLK and LRCLK signals to the external audio hardware
|
||||
|
||||
@@ -122,41 +130,19 @@ The preceding diagram shows the connectivity of ports and clock blocks.
|
||||
input in one input statement. This allows the software to input, process and output 32-bit words, whilst the ports serialize and
|
||||
deserialize to the single I/O pin connected to each port.
|
||||
|
||||
xCORE-200 series devices have the ability to divide an extenal clock in a clock-block.
|
||||
Unlike previous xCORE architectures, xCORE-200 (XS2) and xCORE.ai (XS3) series devices have the ability to divide an external clock in a clock-block.
|
||||
|
||||
However, XS1 based devices do not have this functionality. In order achieve the reqired master-clock
|
||||
to bit-clock/LR-clock divicd on XS1 devices, buffered ports with a transfer width of 32 are also
|
||||
used for ``p_bclk`` and ``p_lrclk``. The bit clock is generated by performing outputs of a particular pattern to ``p_bclk`` to toggle
|
||||
the output at the desired rate. The pattern depends on the divide between the master-clock and bit-clock.
|
||||
The following table shows the required pattern for different values of this divide:
|
||||
|
||||
.. list-table:: Output patterns
|
||||
:header-rows: 1
|
||||
|
||||
* - Divide
|
||||
- Output pattern
|
||||
- Outputs per sample
|
||||
* - 2
|
||||
- ``0xAAAAAAAA``
|
||||
- 2
|
||||
* - 4
|
||||
- ``0xCCCCCCCC``
|
||||
- 4
|
||||
* - 8
|
||||
- ``0xF0F0F0F0``
|
||||
- 8
|
||||
|
||||
In any case, the bit clock outputs 32 clock cycles per sample. In the special case where the divide is 1 (i.e. the bit clock frequency equals
|
||||
The bit clock outputs 32 clock cycles per sample. In the special case where the divide is 1 (i.e. the bit clock frequency equals
|
||||
the master clock frequency), the ``p_bclk`` port is set to a special mode where it simply outputs its clock input (i.e. ``p_mclk``).
|
||||
See ``configure_port_clock_output()`` in ``xs1.h`` for details.
|
||||
|
||||
``p_lrclk`` is clocked by ``p_bclk``. In I2S mode the port outputs the pattern ``0x7fffffff``
|
||||
followed by ``0x80000000`` repeatedly. This gives a signal that has a transition one bit-clock
|
||||
before the data (as required by the I2S standard) and alternates between high and low for the
|
||||
left and right channels of audio.
|
||||
before the data (as required by the I2S standard) and alternates between high and low for the left
|
||||
and right channels of audio.
|
||||
|
||||
Changing Audio Sample Frequency
|
||||
+++++++++++++++++++++++++++++++
|
||||
-------------------------------
|
||||
|
||||
.. _usb_audio_sec_chang-audio-sample:
|
||||
|
||||
@@ -170,7 +156,5 @@ Upon receiving the change of sample frequency request, the audio
|
||||
core stops the I2S/TDM interface and calls the CODEC/port configuration
|
||||
functions.
|
||||
|
||||
Once this is complete, the I2S/TDM interface (i.e. the main look in AudioHub) is restarted at the new frequency.
|
||||
|
||||
|
||||
Once this is complete, the I2S/TDM interface (i.e. the main loop in AudioHub) is restarted at the new frequency.
|
||||
|
||||
|
||||
@@ -1,35 +1,60 @@
|
||||
|
||||
|newpage|
|
||||
|
||||
.. _usb_audio_sec_clock_recovery:
|
||||
|
||||
External Clock Recovery (ClockGen)
|
||||
----------------------------------
|
||||
External Clock Recovery (Clock Gen)
|
||||
===================================
|
||||
|
||||
An application can either provide fixed master clock sources via selectable oscillators, clock
|
||||
generation IC, etc, to provide the audio master or use an external PLL/Clock Multiplier to
|
||||
generate a master clock based on reference from the XMOS device.
|
||||
To provide an audio master clock an application may use selectable oscillators, clock
|
||||
generation IC or, in the case of xCORE.ai devices, integrated secondary PLL, to generate fixed
|
||||
master clock frequencies.
|
||||
|
||||
Using an external PLL/Clock Multiplier allows the design to lock to an external clock source
|
||||
from a digital stream (e.g. S/PDIF or ADAT input).
|
||||
It may also use an external PLL/Clock Multiplier to generate a master clock based on a reference from
|
||||
the xCORE.
|
||||
|
||||
The clock recovery core (clockGen) is responsible for generating the reference frequency
|
||||
to the Fractional-N Clock Generator. This, in turn, generates the master clock used over the
|
||||
whole design.
|
||||
Using an external PLL/Clock Multiplier allows an Asynchronous mode design to lock to an external
|
||||
clock source from a digital stream (e.g. S/PDIF or ADAT input). The codebase supports the Cirrus
|
||||
Logic CS2100 device for this purpose. Other devices may be supported via code modification.
|
||||
|
||||
.. note::
|
||||
|
||||
It is expected that in a future release the secondary PLL in xCORE.ai devices, coupled with
|
||||
associated software changes, will be capable of replacing the CS2100 part for most designs.
|
||||
|
||||
The Clock Recovery core (Clock Gen) is responsible for generating the reference frequency
|
||||
to the CS2100 device. This, in turn, generates the master clock used over the whole design.
|
||||
This core also serves as a smaller buffer between ADAT and S/PDIF receiving cores and the Audio Hub
|
||||
core.
|
||||
|
||||
When running in *Internal Clock* mode this core simply generates this clock using a local
|
||||
timer, based on the XMOS reference clock.
|
||||
|
||||
When running in an external clock mode (i.e. S/PDIF Clock" or "ADAT Clock" mode) digital
|
||||
samples are received from the S/PDIF and/or ADAT receive core.
|
||||
When running in an external clock mode (i.e. S/PDIF Clock" or "ADAT Clock" mode) samples are
|
||||
received from the S/PDIF and/or ADAT receive core. The external frequency is calculated through
|
||||
counting samples in a given period. The reference clock to the CS2100 is then generated based on
|
||||
the reception of these samples.
|
||||
|
||||
The external frequency is calculated through counting samples in a given period. The
|
||||
reference clock to the Fractional-N Clock Multiplier is then generated based on this
|
||||
external stream. If this stream becomes invalid, the timer event will fire to ensure that
|
||||
valid master clock generation continues regardless of cable unplugs etc.
|
||||
If an external stream becomes invalid, the *Internal Clock* timer event will fire to ensure that
|
||||
valid master clock generation continues regardless of cable unplugs etc. Efforts are made to
|
||||
ensure the transition between these clocks are relatively seamless. Additionally efforts are also
|
||||
made to try and keep the jitter on the reference clock as low as possibly, regardless of activity
|
||||
level of the Clock Gen core. The is achieved though the use of port times to schedule pin toggling
|
||||
rather than directly outputting to the port.
|
||||
|
||||
This core gets clock selection Get/Set commands from Endpoint 0 via the ``c_clk_ctl``
|
||||
The Clock Gen core gets clock selection Get/Set commands from Endpoint 0 via the ``c_clk_ctl``
|
||||
channel. This core also records the validity of external clocks, which is also queried
|
||||
through the same channel from Endpoint 0.
|
||||
through the same channel from Endpoint 0. Note, the *Internal Clock* is always reported as being
|
||||
valid. It should be noted that the device always reports the current device sample rate regardless
|
||||
of the clock being interrogated. This results in improved user experience for most driver/operating
|
||||
system combinations
|
||||
|
||||
To inform the host of any status change, the Clock Gen core can also cause the Decouple core to
|
||||
request an interrupt packet on change of clock validity. This functionality is based on the Audio
|
||||
Class 2.0 status/interrupt endpoint feature.
|
||||
|
||||
This core also can cause the decouple core to request an interrupt packet on change of
|
||||
clock validity. This functionality is based on the Audio Class 2.0 status/interrupt endpoint
|
||||
feature.
|
||||
.. note::
|
||||
|
||||
When running in Synchronous mode external digital input streams are currently not supported.
|
||||
Such a feature would require sample-rate conversion to covert from the S/PDIF or ADAT clock
|
||||
domain to the USB host clock domain. As such this core is not used in a Synchronous mode device.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
Implementation Detail
|
||||
---------------------
|
||||
|
||||
This section describes the software architecture of a USB Audio device implemented using `lib_xua`, it's dependancies and other supporting libraries.
|
||||
|
||||
This section will now examine the operation of these components in further detail.
|
||||
|
||||
.. toctree::
|
||||
|
||||
sw_audio
|
||||
sw_spdif
|
||||
|
||||
|
||||
..
|
||||
sw_xud
|
||||
sw_ep0
|
||||
sw_audio
|
||||
sw_mixer
|
||||
sw_spdif_rx
|
||||
sw_adat
|
||||
sw_clocking
|
||||
sw_midi
|
||||
sw_pdm
|
||||
sw_resource
|
||||
..
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
.. _usb_audio_sec_usb:
|
||||
|
||||
Endpoint 0: Management and Control
|
||||
..................................
|
||||
==================================
|
||||
|
||||
All USB devices must support a mandatory control endpoint, Endpoint 0. This controls the management tasks of the USB device.
|
||||
|
||||
These tasks can be generally split into enumeration, audio configuration and firmware upgrade requests.
|
||||
|
||||
Enumeration
|
||||
~~~~~~~~~~~
|
||||
-----------
|
||||
|
||||
When the device is first attached to a host, enumeration occurs. This process involves the host interrogating the device as to its functionality. The device does this by presenting several interfaces to the host via a set of descriptors.
|
||||
|
||||
@@ -19,7 +19,7 @@ During the enumeration process the host will issue various commands to the devic
|
||||
The endpoint 0 code runs in its own core and follows a similar format to that of the USB Device examples in `lib_xud` (i.e. Example HID Mouse Demo). That is, a call is made to ``USB_GetSetupPacket()`` to receive a command from the host. This populates a ``USB_SetupPacket_t`` structure, which is then parsed.
|
||||
|
||||
There are many mandatory requests that a USB Device must support as required by the USB Specification. Since these are required for all devices in order to function a
|
||||
``USB_StandardRequests()`` function is provided (see ``module_usb_device``) which implements all of these requests. This includes the following items:
|
||||
``USB_StandardRequests()`` function is provided (see ``xud_device.xc``) which implements all of these requests. This includes the following items:
|
||||
|
||||
- Requests for standard descriptors (Device descriptor, configuration descriptor etc) and string descriptors
|
||||
- USB GET/SET INTERFACE requests
|
||||
@@ -28,8 +28,8 @@ There are many mandatory requests that a USB Device must support as required by
|
||||
|
||||
For more information and full documentation, including full worked examples of simple devices, please refer to `lib_xud`.
|
||||
|
||||
The ``USB_StandardRequests()`` function takes the devices various descriptors as parameters, these are passed from data structures found in the ``descriptors.h`` file.
|
||||
These data structures are fully customised based on the how the design is configured using various defines (see :ref:`sec_custom_defines_api`).
|
||||
The ``USB_StandardRequests()`` function takes the devices various descriptors as parameters, these are passed from data structures found in the ``xud_ep0_descriptors.h`` file.
|
||||
These data structures are fully customised based on the how the design is configured using various defines.
|
||||
|
||||
The ``USB_StandardRequests()`` functions returns a ``XUD_Result_t``. ``XUD_RESULT_OKAY`` indicates that the request was fully handled without error and no further action is required
|
||||
- The device should move to receiving the next request from the host (via ``USB_GetSetupPacket()``).
|
||||
@@ -38,41 +38,42 @@ The function returns ``XUD_RES_ERR`` if the request was not recognised by the ``
|
||||
|
||||
The function may also return ``XUD_RES_RST`` if a bus-reset has been issued onto the bus by the host and communicated from XUD to Endpoint 0.
|
||||
|
||||
Since the ``USB_StandardRequests()`` function STALLs an unknown request, the endpoint 0 code must parse the ``USB_SetupPacket_t`` structure to handle device specific requests and then calling ``USB_StandardRequests()`` as required. This is described next.
|
||||
Since the ``USB_StandardRequests()`` function STALLs an unknown request, the endpoint 0 code must first parse the ``USB_SetupPacket_t`` structure to handle device specific requests and then call ``USB_StandardRequests()`` as required.
|
||||
|
||||
Over-riding Standard Requests
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-----------------------------
|
||||
|
||||
The USB Audio design "over-rides" some of the requests handled by ``USB_StandardRequests()``, for example it uses the SET_INTERFACE request to indicate it if the host is streaming audio to the device. In this case the setup packet is parsed, the relevant action taken, the ``USB_StandardRequests()`` is called to handle the response to the host etc.
|
||||
The USB Audio design "over-rides" some of the requests handled by ``USB_StandardRequests()``, for example it uses the SET_INTERFACE request to indicate if the host is streaming audio to the device. In this case the setup packet is parsed, the relevant action taken, the ``USB_StandardRequests()`` is still called to handle the response to the host.
|
||||
|
||||
Class Requests
|
||||
~~~~~~~~~~~~~~
|
||||
Before making the call to ``USB_StandardRequests()`` the setup packet is parsed for Class requests. These are handled in functions such as ``AudioClasRequests_2()``, ``AudioClassRequests_2``, ``DFUDeviceRequests()`` etc depending on the type of request.
|
||||
--------------
|
||||
|
||||
Before making the call to ``USB_StandardRequests()`` the setup packet is parsed for Class requests. These are handled in functions such as ``AudioClassRequests_1()``, ``AudioClassRequests_2``, ``DFUDeviceRequests()`` etc depending on the type of request.
|
||||
|
||||
Any device specific requests are handled - in this case Audio Class, MIDI class, DFU requests etc.
|
||||
|
||||
Some of the common Audio Class requests and their associated behaviour will now be examined.
|
||||
|
||||
Audio Requests
|
||||
++++++++++++++
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
When the host issues an audio request (e.g. sample rate or volume change), it sends a command to Endpoint 0. Like all requests this is returned from ``USB_GetSetupPacket()``. After some parsing (namely as Class Request to an Audio Interface) the request is handled by either the ``AudioClassRequests_1()`` or ``AudioClassRequests_2()`` function (based on whether the device is running in Audio Class 1.0 or 2.0 mode).
|
||||
|
||||
Note, Audio Class 1.0 Sample rate changes are send to the relevant endpoint, rather than the interface - this is handled as a special case in he endpoint 0 request parsing where ``AudioEndpointRequests_1()`` is called.
|
||||
|
||||
The ``AudioClassRequests_X()`` functions parses the request further in order to ascertain the correct audio operation to execute.
|
||||
The ``AudioClassRequests_X()`` functions further parses the request in order to ascertain the correct audio operation to execute.
|
||||
|
||||
Audio Request: Set Sample Rate
|
||||
++++++++++++++++++++++++++++++
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``AudioClassRequests_2()`` function parses the passed ``USB_SetupPacket_t`` structure for a ``CUR`` request of type ``SAM_FREQ_CNTROL`` to a Clock Unit in the devices topology (as described in the devices descriptors).
|
||||
The ``AudioClassRequests_2()`` function parses the passed ``USB_SetupPacket_t`` structure for a ``CUR`` request of type ``SAM_FREQ_CONTROL`` to a Clock Unit in the devices topology (as described in the devices descriptors).
|
||||
|
||||
The new sample frequency is extracted and passed via channel to the rest of the design - through the buffering code and eventually to the Audio IO/I2S core. The ``AudioClassRequests_2()`` function waits for a handshake to propagate back though the system before signalling to the host that the request has completed successfully. Note, during this time the USB library is NAKing the host essentially holding off further traffic/requests until the sample-rate change is fully complete.
|
||||
The new sample frequency is extracted and passed via channel to the rest of the design - through the buffering code and eventually to the Audio Hub (I2S) core. The ``AudioClassRequests_2()`` function waits for a handshake to propagate back through the system before signalling to the host that the request has completed successfully. Note, during this time the USB library is NAKing the host essentially holding off further traffic/requests until the sample-rate change is fully complete.
|
||||
|
||||
.. _usb_audio_sec_audio-requ-volume:
|
||||
|
||||
Audio Request: Volume Control
|
||||
+++++++++++++++++++++++++++++
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When the host requests a volume change, it
|
||||
sends an audio interface request to Endpoint 0. An array is
|
||||
@@ -83,7 +84,7 @@ When changing the volume, Endpoint 0 applies the master volume and
|
||||
channel volume, producing a single volume value for each channel.
|
||||
These are stored in the array.
|
||||
|
||||
The volume will either be handled by the ``decoupler`` core or the mixer
|
||||
The volume will either be handled by the ``decouple`` core or the mixer
|
||||
component (if the mixer component is used). Handling the volume in the
|
||||
mixer gives the decoupler more performance to handle more channels.
|
||||
|
||||
@@ -97,34 +98,35 @@ the array (ordering between writes and reads is unimportant in this
|
||||
case). Inline assembly is used by the decoupler core to access
|
||||
the array, avoiding the parallel usage checks of XC.
|
||||
|
||||
If volume control is implemented in the mixer, Endpoint 0 sends a mixer command to the mixer to change the volume. Mixer commands
|
||||
If volume control is implemented in the mixer, Endpoint 0 sends a mixer command
|
||||
to the mixer to change the volume. Mixer commands
|
||||
are described in :ref:`usb_audio_sec_mixer`.
|
||||
|
||||
Audio Endpoints (Endpoint Buffer and Decoupler)
|
||||
...............................................
|
||||
===============================================
|
||||
|
||||
Endpoint Buffer
|
||||
~~~~~~~~~~~~~~~
|
||||
---------------
|
||||
|
||||
All endpoints other that Endpoint 0 are handled in one core. This
|
||||
core is implemented in the file ``usb_buffer.xc``. This core is communicates directly with the XUD library.
|
||||
core is implemented in the file ``ep_buffer.xc``. This core communicates directly with the XUD library.
|
||||
|
||||
The USB buffer core is also responsible for feedback calculation based on USB Start Of Frame
|
||||
(SOF) notification and reads from the port counter of a port connected to the master clock.
|
||||
|
||||
Decoupler
|
||||
~~~~~~~~~
|
||||
Decouple
|
||||
--------
|
||||
|
||||
The decoupler supplies the USB buffering core with buffers to
|
||||
transmit/receive audio data to/from the host. It marshals these buffers into
|
||||
FIFOs. The data from the FIFOs are then sent over XC channels to
|
||||
other parts of the system as they need it. This core also
|
||||
other parts of the system as they need it. In asynchronous mode this core also
|
||||
determines the size of each packet of audio sent to the host (thus
|
||||
matching the audio rate to the USB packet rate). The decoupler is
|
||||
implemented in the file ``decouple.xc``.
|
||||
|
||||
Audio Buffering Scheme
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
----------------------
|
||||
|
||||
This scheme is executed by co-operation between the buffering
|
||||
core, the decouple core and the XUD library.
|
||||
@@ -132,76 +134,69 @@ core, the decouple core and the XUD library.
|
||||
For data going from the device to the host the following scheme is
|
||||
used:
|
||||
|
||||
|
||||
#. The decouple core receives samples from the audio core and
|
||||
#. The Decouple core receives samples from the Audio Hub core and
|
||||
puts them into a FIFO. This FIFO is split into packets when data is
|
||||
entered into it. Packets are stored in a format consisting of their
|
||||
length in bytes followed by the data.
|
||||
|
||||
#. When the buffer cores needs a buffer to send to the XUD core
|
||||
(after sending the previous buffer), the decouple core is
|
||||
#. When the Endpoint Buffer core needs a buffer to send to the XUD core
|
||||
(after sending the previous buffer), the Decouple core is
|
||||
signalled (via a shared memory flag).
|
||||
|
||||
#. Upon this signal from the buffering core, the decouple core
|
||||
passes the next packet from the FIFO to the buffer core. It also
|
||||
signals to the XUD library that the buffer core is able to send a
|
||||
#. Upon this signal from the Endpoint Buffer core, the Decouple core
|
||||
passes the next packet from the FIFO to the Endpoint Buffer core. It also
|
||||
signals to the XUD library that the Endpoint Buffer core is able to send a
|
||||
packet.
|
||||
|
||||
#. When the buffer core has sent this buffer, it signals to the
|
||||
decouple that the buffer has been sent and the decouple core
|
||||
#. When the Endpoint Buffer core has sent this buffer, it signals to the
|
||||
Decouple core that the buffer has been sent and the Decouple core
|
||||
moves the read pointer of the FIFO.
|
||||
|
||||
|
||||
For data going from the host to the device the following scheme is
|
||||
used:
|
||||
|
||||
|
||||
#. The decouple core passes a pointer to the buffering core
|
||||
#. The Decouple core passes a pointer to the Endpoint Buffer core
|
||||
pointing into a FIFO of data and signals to the XUD library that
|
||||
the buffering core is ready to receive.
|
||||
the Endpoint Buffer core is ready to receive.
|
||||
|
||||
#. The buffering core then reads a USB packet into the FIFO and
|
||||
signals to the decoupler that the packet has been read.
|
||||
#. The Endpoint Buffer core then reads a USB packet into the FIFO and
|
||||
signals to the Decouple core that the packet has been read.
|
||||
|
||||
#. Upon receiving this signal the decoupler core updates the
|
||||
#. Upon receiving this signal the Decouple core updates the
|
||||
write pointer of the FIFO and provides a new pointer to the
|
||||
buffering core to fill.
|
||||
|
||||
#. Upon request from the audio core, the decoupler core sends
|
||||
samples to the audio core by reading samples out of the FIFO.
|
||||
Endpoint Buffer core to fill.
|
||||
|
||||
#. Upon request from the Audio Hub core, the Decouple core sends
|
||||
samples to the Audio Hub core by reading samples out of the FIFO.
|
||||
|
||||
Decoupler/Audio Core interaction
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
--------------------------------
|
||||
|
||||
To meet timing requirements of the audio system, the decoupler
|
||||
To meet timing requirements of the audio system (i.e Audio Hub/Mixer), the Decoupler
|
||||
core must respond to requests from the audio system to
|
||||
send/receive samples immediately. An interrupt handler
|
||||
is set up in the decoupler core to do this. The interrupt handler
|
||||
is implemented in the function ``handle_audio_request``.
|
||||
|
||||
The audio system sends a word over a channel to the decouple core to
|
||||
request sample transfer (using the build in outuint function).
|
||||
request sample transfer (using the build in ``outuint()`` function).
|
||||
The receipt of this word in the channel
|
||||
causes the ``handle_audio_request`` interrupt to fire.
|
||||
|
||||
The first operation the interrupt handler does is to send back a word
|
||||
acknowledging the request (if there was a change of sample frequency
|
||||
The first operation the interrupt handler does (once it inputs the word that triggered the interrupt)
|
||||
is to send back a word acknowledging the request (if there was a change of sample frequency
|
||||
a control token would instead be sent---the audio system uses a testct()
|
||||
to inspect for this case).
|
||||
|
||||
Sample transfer may now take place. First the audio subsystem transfers
|
||||
samples destined for the host, then the decouple core sends
|
||||
samples from the host to device. These transfers always take place
|
||||
Sample transfer may now take place. First the Decouple core sends samples from host to device then the
|
||||
audio subsystem transfers samples destined for the host. These transfers always take place
|
||||
in channel count sized chunks (i.e. ``NUM_USB_CHAN_OUT`` and
|
||||
``NUM_USB_CHAN_IN``). That is, if the device has 10 output channels and
|
||||
8 input channels, 10 samples are sent from the decouple core and 8 received
|
||||
every interrupt.
|
||||
``NUM_USB_CHAN_IN``). That is, if the device has 10 output channels and 8 input channels,
|
||||
10 samples are sent from the decouple core and 8 received every interrupt.
|
||||
|
||||
The complete communication scheme is shown in the table below (for non sample
|
||||
frequency change case):
|
||||
|
||||
|
||||
.. table:: Decouple/Audio System Channel Communication
|
||||
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
@@ -237,55 +232,62 @@ frequency change case):
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
|
||||
.. note::
|
||||
The request and acknowledgement sent to/from Decouple to the Audio System is an "output underflow" sample
|
||||
The request and acknowledgement sent to/from the Decouple core to the Audio System is an "output underflow" sample
|
||||
value. If in PCM mode it will be 0, in DSD mode it will be DSD silence.
|
||||
This allows the buffering system to output a suitable underflow value without knowing the format of the stream
|
||||
(this is especially advantageous in the DSD over PCM (DoP) case)
|
||||
|
||||
Asynchronous Feedback
|
||||
+++++++++++++++++++++
|
||||
---------------------
|
||||
|
||||
The device uses a feedback endpoint to report the rate at which
|
||||
When built to operate in Asynchronous mode the device uses a feedback endpoint to report the rate at which
|
||||
audio is output/input to/from external audio interfaces/devices. This feedback is in accordance with
|
||||
the *USB 2.0 Specification*.
|
||||
the *USB 2.0 Specification*. This calculated feedback value is also used to size packets to the host.
|
||||
|
||||
This asynchronous clocking scheme means that the device is the clocking master than therefore
|
||||
means a high-quality local master clock source can be used.
|
||||
This asynchronous clocking scheme means that the device is the clock master and therefore
|
||||
a high-quality local master clock or a digital input stream can be used as the clock source.
|
||||
|
||||
After each received USB SOF token, the buffering core takes a time-stamp from a port clocked off
|
||||
After each received USB Start Of Frame (SOF) token, the buffering core takes a time-stamp from a port clocked off
|
||||
the master clock. By subtracting the time-stamp taken at the previous SOF, the number of master
|
||||
clock ticks since the last SOF is calculated. From this the number of samples (as a fixed
|
||||
point number) between SOFs can be calculated.
|
||||
This count is aggregated over 128 SOFs and used as a basis for the feedback value.
|
||||
point number) between SOFs can be calculated. This count is aggregated over 128 SOFs and used as a
|
||||
basis for the feedback value.
|
||||
|
||||
The sending of feedback to the host is also handled in the USB buffering core via an explicit feedback
|
||||
IN endpoint. If both input and output is enabled then the feedback is implicit based on the audio stream
|
||||
sent to the host.
|
||||
The sending of feedback to the host is also handled in the Endpoint Buffer core via an explicit
|
||||
feedback IN endpoint.
|
||||
|
||||
If both input and output is enabled then the feedback can be implicit based on the audio stream
|
||||
sent to the host. In practice this an explicit feedback endpoint is normally used due to restrictions
|
||||
in Microsoft Windows operating systems (see ``UAC_FORCE_FEEDBACK_EP``).
|
||||
|
||||
USB Rate Control
|
||||
++++++++++++++++
|
||||
----------------
|
||||
|
||||
.. _usb_audio_sec_usb-rate-control:
|
||||
|
||||
The Audio core must consume data from USB
|
||||
and provide data to USB at the correct rate for the selected sample
|
||||
frequency. The *USB 2.0 Specification* states that the maximum
|
||||
variation on USB packets can be +/- 1 sample per USB frame. USB
|
||||
frames are sent at 8kHz, so on average for 48kHz each packet
|
||||
contains six samples per channel. The device uses Asynchronous mode,
|
||||
so the audio clock may drift and run faster or slower than the
|
||||
host. Hence, if the audio clock is slightly fast, the device may
|
||||
occasionally input/output seven samples rather than six. Alternatively,
|
||||
it may be slightly slow and input/output five samples rather than six.
|
||||
:ref:`usb_audio_samples_per_packet` shows the allowed number of samples
|
||||
per packet for each example audio frequency.
|
||||
The device must consume data from USB host and provide data to USB host at the correct rate for the
|
||||
selected sample frequency. When running in asynchronous mode the *USB 2.0 Specification* states
|
||||
that the maximum variation on USB packets can be +/- 1 sample per USB frame (Synchronous mode
|
||||
mandates no variation other than that required to match a sample rate that doesn't cleanly divide
|
||||
the USB SOF period e.g. 44.1kHz)
|
||||
|
||||
See USB Device Class Definition for Audio Data Formats v2.0 section 2.3.1.1
|
||||
for full details.
|
||||
High-speed USB frames are sent at 8kHz, so on average for 48kHz each packet contains six samples
|
||||
per channel.
|
||||
|
||||
When running in Asynchronous mode, so the audio clock may drift and run faster or slower than the
|
||||
host. Hence, if the audio clock is slightly fast, the device may occasionally input/output seven
|
||||
samples rather than six. Alternatively, it may be slightly slow and input/output five samples rather
|
||||
than six. :ref:`usb_audio_samples_per_packet` shows the allowed number of samples per packet for
|
||||
each example audio frequency in Asynchronous mode.
|
||||
|
||||
When running in Synchronous mode the audio clock is synchronised to the USB host SOF clock. Hence,
|
||||
at 48kHz the device always expects six samples from, and always sends size samples to, the host.
|
||||
|
||||
See USB Device Class Definition for Audio Data Formats v2.0 section 2.3.1.1 for full details.
|
||||
|
||||
.. _usb_audio_samples_per_packet:
|
||||
|
||||
.. table:: Allowed samples per packet
|
||||
.. table:: Allowed samples per packet in Async mode
|
||||
|
||||
+-----------------+-------------+-------------+
|
||||
| Frequency (kHz) | Min Packet | Max Packet |
|
||||
@@ -304,46 +306,11 @@ for full details.
|
||||
+-----------------+-------------+-------------+
|
||||
|
||||
|
||||
To implement this control, the decoupler core uses the feedback
|
||||
value calculated in the buffering core. This value is used to
|
||||
work out the size of the next packet it will insert into the audio
|
||||
FIFO.
|
||||
To implement this control, the Decoupler core uses the feedback value calculated in the EP Buffering
|
||||
core. This value is used to work out the size of the next packet it will insert into the audio FIFO.
|
||||
|
||||
.. note::
|
||||
|
||||
In Synchronous mode the same system is used, but the feedback value simply uses a fixed value
|
||||
rather than one derived from the master clock port.
|
||||
|
||||
.. .. _fig_usb_devices:
|
||||
|
||||
.. .. table:: USB interfaces presented to host
|
||||
.. :class: center
|
||||
..
|
||||
.. +-----------------------+----------------------------------+
|
||||
.. | **Mode** | **Interfaces** |
|
||||
.. +=======================+==================================+
|
||||
.. | Application mode | | Audio Class 2/Audio Class 1 |
|
||||
.. | | | DFU Class 1.1 |
|
||||
.. | | | MIDI Device Class 1.0 |
|
||||
.. +-----------------------+----------------------------------+
|
||||
.. | DFU mode | DFU Class 1.1 |
|
||||
.. +-----------------------+----------------------------------+
|
||||
|
||||
.. The device initially starts in Application mode.
|
||||
|
||||
|
||||
|
||||
|
||||
.. :ref:`usb_audio_sec_dfu` describes how DFU mode is used. The
|
||||
.. audio device class (1 or 2) is set at compile time---see :ref:`usb_audio_sec_custom_defines_api`.
|
||||
|
||||
|
||||
|
||||
.. Reset
|
||||
.. ~~~~~
|
||||
|
||||
.. On receiving a reset request, three steps occur:
|
||||
|
||||
.. #. Depending on the DFU state, the device may be set into DFU
|
||||
mode.
|
||||
|
||||
.. #. A XUD function is called to reset the endpoint structure and receive the new bus speed.
|
||||
|
||||
.. _usb_audio_sec_audio-requ-sett:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Audio Controls via Human Interface Device (HID)
|
||||
------------------------------------------------
|
||||
===============================================
|
||||
|
||||
The design supports simple audio controls such as play/pause, volume up/down etc via the USB Human
|
||||
Interface Device Class Specification.
|
||||
@@ -45,4 +45,3 @@ On each HID report request from the host the function ``Vendor_ReadHidButtons(un
|
||||
|
||||
Since the ``Vendor_ReadHidButtons()`` function is called from the ``buffer`` logical core, care should be taken not to add to much execution time to this function since this could cause issues with servicing other endpoints.
|
||||
|
||||
For a full example please see the HID section in :ref:`usb_audio_sec_l1_audio_sw`.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
Apple MFi compatibility
|
||||
-----------------------
|
||||
|
||||
XMOS devices are capable of operating with Apple iPod, iPhone, and iPad devices
|
||||
that feature USB host support. Information regarding this functionality is
|
||||
protected by the Made For iPod (MFi) program and associated licensing.
|
||||
|
||||
Please contact XMOS for details and further documentation.
|
||||
@@ -1,7 +1,13 @@
|
||||
MIDI
|
||||
----
|
||||
|newpage|
|
||||
|
||||
MIDI
|
||||
====
|
||||
|
||||
The MIDI core implements a 31250 baud UART for both input and output. On receiving 32=bit USB MIDI events
|
||||
from the Endpoint Buffer core, it parses these and translates them to 8-bit MIDI messages which are sent
|
||||
over UART. Similarly, incoming 8-bit MIDI messages are aggregated into 32-bit USB MIDI events and
|
||||
passed on to the Endpoint Buffer core. The MIDI core is implemented in the file ``usb_midi.xc``.
|
||||
|
||||
The Endpoint Buffer core implements the two Bulk endpoints (one In and one Out) as well as interacting
|
||||
with small, shared-memory, FIFOs for each endpoint.
|
||||
|
||||
The MIDI driver implements a 31250 baud UART input and output. On receiving 32-bit USB MIDI events
|
||||
from the ``buffer`` core, it parses these and translates them to 8-bit MIDI messages which are sent
|
||||
over UART. Similarly, incoming 8-bit MIDI messages are aggregated into 32-bit USB-MIDI events an
|
||||
passed on to the ``buffer`` core. The MIDI core is implemented in the file ``usb_midi.xc``.
|
||||
|
||||
@@ -3,50 +3,53 @@
|
||||
Digital Mixer
|
||||
-------------
|
||||
|
||||
The mixer core(s) take outgoing audio from the decoupler core and incoming
|
||||
audio from the audio driver core. It then applies the volume to each
|
||||
channel and passes incoming audio on to the decoupler and outgoing
|
||||
audio to the audio driver. The volume update is achieved using the
|
||||
built-in 32bit to 64bit signed multiply-accumulate function
|
||||
(``macs``). The mixer is implemented in the file
|
||||
``mixer.xc``.
|
||||
The Mixer core(s) take outgoing audio from the Decouple core and incoming audio from the Audio Hub
|
||||
core. It then applies the volume to each channel and passes incoming audio on to Decouple and outgoing
|
||||
audio to Audio Hub. The volume update is achieved using the built-in 32bit to 64bit signed
|
||||
multiply-accumulate function (``macs``). The mixer is implemented in the file ``mixer.xc``.
|
||||
|
||||
The mixer takes two cores and can perform eight mixes with
|
||||
up to 18 inputs at sample rates up to 96kHz and two mixes with up to 18
|
||||
inputs at higher sample rates. The component automatically moves
|
||||
down to two mixes when switching to a higher rate.
|
||||
The mixer takes (up to) two cores and can perform eight mixes with up to 18 inputs at sample rates
|
||||
up to 96kHz and two mixes with up to 18 inputs at higher sample rates. The component automatically
|
||||
reverts to generating two mixes when running at the higher rate.
|
||||
|
||||
The mixer can take inputs from either:
|
||||
|
||||
* The USB outputs from the host---these samples come from the decoupler core.
|
||||
* The inputs from the audio interface on the device---these
|
||||
samples come from the audio driver.
|
||||
* The USB outputs from the host---these samples come from the Decouple core.
|
||||
* The inputs from the audio interfaces on the device---these samples come from the Audio Hub core
|
||||
and includes samples from digital input streams.
|
||||
|
||||
Since the sum of these inputs may be more then the 18 possible mix
|
||||
inputs to each mixer, there is a mapping from all the
|
||||
possible inputs to the mixer inputs.
|
||||
Since the sum of these inputs may be more then the 18 possible mix inputs to each mixer, there is a
|
||||
mapping from all the possible inputs to the mixer inputs.
|
||||
|
||||
After the mix occurs, the final outputs are created. There are two
|
||||
output destinations:
|
||||
After the mix occurs, the final outputs are created. There are two possible output destinations
|
||||
for each mix.
|
||||
|
||||
* The USB inputs to the host---these samples are sent to the decoupler core.
|
||||
* The USB inputs to the host---these samples are sent to the Decouple core.
|
||||
|
||||
* The outputs to the audio interface on the device---these samples
|
||||
are sent to the audio driver.
|
||||
* The outputs to the audio interface on the device---these samples are sent to the Audio Hub
|
||||
core
|
||||
|
||||
For each possible output, a mapping exists to tell the mixer what its
|
||||
source is. The possible sources are the USB outputs from the host, the
|
||||
inputs for the audio interface or the outputs from the mixer units.
|
||||
For each possible output from the device, a mapping exists to inform the mixer what it's source is.
|
||||
The possible sources are the output from the USB host, the inputs from the Audio Hub core or the
|
||||
outputs from the mixes.
|
||||
|
||||
As mentioned in :ref:`usb_audio_sec_audio-requ-volume`, the mixer can also
|
||||
handle volume setting. If the mixer is configured to handle volume but
|
||||
the number of mixes is set to zero (so the component is solely doing
|
||||
volume setting) then the component will use only one core.
|
||||
Essentially the mixer/router can be configured such that any device input can be used as an input to
|
||||
any mix or routed directly to any device output. Additionally, any device output can be derived from
|
||||
any mixer output or any device input.
|
||||
|
||||
As mentioned in :ref:`usb_audio_sec_audio-requ-volume`, the mixer can also handle processing or
|
||||
volume controls. If the mixer is configured to handle volume but the number of mixes is set to zero
|
||||
(such that the core is solely doing volume setting) then the component will use only one core. This
|
||||
is sometimes a useful configuration for large channel count devices.
|
||||
|
||||
Control
|
||||
~~~~~~~
|
||||
|
||||
The mixers can receive the following control commands from the Endpoint 0 core via a channel:
|
||||
The mixers can receive the control commands from the host via USB Control Requests to Endpoint 0.
|
||||
The Endpoint 0 core relays these to the Mixer cores(s) via a channel (``c_mix_ctl``). These commands
|
||||
are described in :ref:`table_mixer_commands`.
|
||||
|
||||
.. _table_mixer_commands:
|
||||
|
||||
.. list-table:: Mixer Component Commands
|
||||
:header-rows: 1
|
||||
@@ -79,103 +82,170 @@ Host Control
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The mixer can be controlled from a host PC by sending requests to Endpoint 0. XMOS provides a simple
|
||||
command line based sample application demonstrating how the mixer can be controlled.
|
||||
command line based sample application demonstrating how the mixer can be controlled. This is
|
||||
intended as an example of how you might add mixer control to your own control application. It is not
|
||||
intended to be exposed to end users.
|
||||
|
||||
For details, consult the README file in the host_usb_mixer_control directory.
|
||||
A list of arguments can also be seen with::
|
||||
|
||||
The main requirements of this control are to
|
||||
$ ./xmos_mixer --help
|
||||
|
||||
The main requirements of this control utility are to
|
||||
|
||||
* Set the mapping of input channels into the mixer
|
||||
* Set the coefficients for each mixer output of each input
|
||||
* Set the coefficients for each mixer output for each input
|
||||
* Set the mapping for physical outputs which can either come
|
||||
directly from the inputs or via the mixer.
|
||||
|
||||
There is enough flexibility within this configuration that there will often
|
||||
be multiple ways of creating the required solution.
|
||||
.. note::
|
||||
|
||||
Whilst using the XMOS Host control example application, consider setting the
|
||||
mixer to perform a loop-back from analogue inputs 1 and 2 to analogue
|
||||
outputs 1 and 2.
|
||||
The flexibility within this configuration space us such that there is often multiple ways
|
||||
of producing the desired result. Product developers may only want to expose a subset of this
|
||||
functionality to their end users.
|
||||
|
||||
First consider the inputs to the mixer::
|
||||
Whilst using the XMOS Host control example application, consider the example of setting the
|
||||
mixer to perform a loop-back from analogue inputs 1 & 2 to analogue outputs 1 & 2.
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
.. note::
|
||||
|
||||
displays which channels are mapped to which mixer inputs::
|
||||
The command outputs shown are examples; the actual output will depend on the mixer configuration.
|
||||
|
||||
./xmos_mixer --display-aud-channel-map-sources 0
|
||||
The following will show the index for each device output along with which channel is currently mapped to it.
|
||||
In this example the analogue outputs 1 & 2 are 0 & 1 respectively::
|
||||
|
||||
displays which channels could possibly be mapped to mixer inputs. Notice
|
||||
that analogue inputs 1 and 2 are on mixer inputs 10 and 11.
|
||||
$ ./xmos_mixer --display-aud-channel-map
|
||||
|
||||
Now examine the audio output mapping::
|
||||
Audio Output Channel Map
|
||||
------------------------
|
||||
|
||||
0 (DEVICE OUT - Analogue 1) source is 0 (DAW OUT - Analogue 1)
|
||||
1 (DEVICE OUT - Analogue 2) source is 1 (DAW OUT - Analogue 2)
|
||||
2 (DEVICE OUT - SPDIF 1) source is 2 (DAW OUT - SPDIF 1)
|
||||
3 (DEVICE OUT - SPDIF 2) source is 3 (DAW OUT - SPDIF 2)
|
||||
$ _
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
The DAW Output Map can be seen with::
|
||||
|
||||
displays which channels are mapped to which outputs. By default all
|
||||
of these bypass the mixer. We can also see what all the possible
|
||||
mappings are::
|
||||
$ ./xmos_mixer --display-daw-channel-map
|
||||
|
||||
./xmos_mixer --display-aud-channel-map-sources 0
|
||||
DAW Output To Host Channel Map
|
||||
------------------------
|
||||
|
||||
0 (DEVICE IN - Analogue 1) source is 4 (DEVICE IN - Analogue 1)
|
||||
1 (DEVICE IN - Analogue 2) source is 5 (DEVICE IN - Analogue 2)
|
||||
$ _
|
||||
|
||||
So now map the first two mixer outputs to physical outputs 1 and 2::
|
||||
.. note::
|
||||
|
||||
./xmos_mixer --set-aud-channel-map 0 26
|
||||
./xmos_mixer --set-aud-channel-map 1 27
|
||||
In both cases, by default, these bypass the mixer.
|
||||
|
||||
The following command will list the channels which can be mapped to the device outputs from the
|
||||
Audio Output Channel Map. Note that, in this example, analogue inputs 1 & 2 are source 4 & 5 and
|
||||
Mix 1 & 2 are source 6 & 7::
|
||||
|
||||
$ ./xmos_mixer --display-aud-channel-map-sources
|
||||
|
||||
Audio Output Channel Map Source List
|
||||
------------------------------------
|
||||
|
||||
0 (DAW OUT - Analogue 1)
|
||||
1 (DAW OUT - Analogue 2)
|
||||
2 (DAW OUT - SPDIF 1)
|
||||
3 (DAW OUT - SPDIF 2)
|
||||
4 (DEVICE IN - Analogue 1)
|
||||
5 (DEVICE IN - Analogue 2)
|
||||
6 (MIX - Mix 1)
|
||||
7 (MIX - Mix 2)
|
||||
$ _
|
||||
|
||||
Using the indices from the previous commands, we will now re-map the first two mixer channels (Mix 1 & Mix 2) to device outputs 1 & 2::
|
||||
|
||||
$ ./xmos_mixer --set-aud-channel-map 0 6
|
||||
$ ./xmos_mixer --set-aud-channel-map 1 7
|
||||
$ _
|
||||
|
||||
You can confirm the effect of this by re-checking the map::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
$ ./xmos_mixer --display-aud-channel-map
|
||||
|
||||
This now makes analogue outputs 1 and 2 come from the mixer, rather
|
||||
than directly from USB. However the mixer is still mapped to pass
|
||||
the USB channels through to the outputs, so there will still be no
|
||||
functional change yet.
|
||||
Audio Output Channel Map
|
||||
------------------------
|
||||
|
||||
0 (DEVICE OUT - Analogue 1) source is 6 (MIX - Mix 1)
|
||||
1 (DEVICE OUT - Analogue 2) source is 7 (MIX - Mix 2)
|
||||
2 (DEVICE OUT - SPDIF 1) source is 2 (DAW OUT - SPDIF 1)
|
||||
3 (DEVICE OUT - SPDIF 2) source is 3 (DAW OUT - SPDIF 2)
|
||||
$ _
|
||||
|
||||
The mixer nodes need to be individually set. They can be displayed
|
||||
with::
|
||||
This now derives analogue outputs 1 & 2 from the mixer, rather than directly from USB. However,
|
||||
since the mixer is mapped, by default, to just pass the USB channels through to the outputs there will be no
|
||||
functional change.
|
||||
|
||||
./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
To get the audio from the analogue inputs to outputs 1 and 2, nodes 80
|
||||
and 89 need to be set::
|
||||
.. note::
|
||||
|
||||
./xmos_mixer --set-value 0 80 0
|
||||
./xmos_mixer --set-value 0 89 0
|
||||
The USB audio reference design has only one unit so the mixer_id argument should always be 0.
|
||||
|
||||
The mixer nodes need to be individually set. The nodes in mixer_id 0 can be displayed
|
||||
with the following command::
|
||||
|
||||
$ ./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
Mixer Values (0)
|
||||
----------------
|
||||
|
||||
Mixer outputs
|
||||
1 2
|
||||
DAW - Analogue 1 0:[0000.000] 1:[ -inf ]
|
||||
DAW - Analogue 2 2:[ -inf ] 3:[0000.000]
|
||||
DAW - SPDIF 1 4:[ -inf ] 5:[ -inf ]
|
||||
DAW - SPDIF 2 6:[ -inf ] 7:[ -inf ]
|
||||
AUD - Analogue 1 8:[ -inf ] 9:[ -inf ]
|
||||
AUD - Analogue 2 10:[ -inf ] 11:[ -inf ]
|
||||
$ _
|
||||
|
||||
With mixer outputs 1 & 2 mapped to device outputs analogue 1 & 2; to get the audio from the analogue inputs to device
|
||||
outputs mixer_id 0 node 8 and node 11 need to be set to 0db::
|
||||
|
||||
$ ./xmos_mixer --set-value 0 8 0
|
||||
$ ./xmos_mixer --set-value 0 11 0
|
||||
$ _
|
||||
|
||||
At the same time, the original mixer outputs can be muted::
|
||||
|
||||
./xmos_mixer --set-value 0 0 -inf
|
||||
./xmos_mixer --set-value 0 9 -inf
|
||||
$ ./xmos_mixer --set-value 0 0 -inf
|
||||
$ ./xmos_mixer --set-value 0 3 -inf
|
||||
$ _
|
||||
|
||||
Now audio inputs on analogue 1/2 should be heard on outputs 1/2.
|
||||
Now audio inputs on analogue 1 and 2 should be heard on outputs 1 and 2 respectively.
|
||||
|
||||
As mentioned above, the flexibility of the mixer is such that there
|
||||
will be multiple ways to create a particular mix. Another option to
|
||||
create the same routing would be to change the mixer sources such that
|
||||
mixer 1/2 outputs come from the analogue inputs.
|
||||
As mentioned above, the flexibility of the mixer is such that there will be multiple ways to create
|
||||
a particular mix. Another option to create the same routing would be to change the mixer sources
|
||||
such that mixer outputs 1 and 2 come from the analogue inputs 1 and 2.
|
||||
|
||||
To demonstrate this, firstly undo the changes above::
|
||||
To demonstrate this, firstly undo the changes above (or simply reset the device)::
|
||||
|
||||
./xmos_mixer --set-value 0 80 -inf
|
||||
./xmos_mixer --set-value 0 89 -inf
|
||||
./xmos_mixer --set-value 0 0 0
|
||||
./xmos_mixer --set-value 0 9 0
|
||||
$ ./xmos_mixer --set-value 0 8 -inf
|
||||
$ ./xmos_mixer --set-value 0 11 -inf
|
||||
$ ./xmos_mixer --set-value 0 0 0
|
||||
$ ./xmos_mixer --set-value 0 3 0
|
||||
$ _
|
||||
|
||||
The mixer should now have the default values. The sources for mixer
|
||||
1/2 can now be changed::
|
||||
The mixer should now have the default values. The sources for mixer 0 output 1 and 2 can now be changed
|
||||
using indices from the Audio Output Channel Map Source List::
|
||||
|
||||
./xmos_mixer --set-mixer-source 0 0 10
|
||||
./xmos_mixer --set-mixer-source 0 1 11
|
||||
|
||||
If you rerun::
|
||||
|
||||
./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
the first column now has AUD - Analogue 1 and 2 rather than DAW (Digital Audio Workstation i.e. the
|
||||
host) - Analogue 1 and 2 confirming the new mapping. Again, by playing audio into analogue inputs
|
||||
1/2 this can be heard looped through to analogue outputs 1/2.
|
||||
$ ./xmos_mixer --set-mixer-source 0 0 4
|
||||
|
||||
Set mixer(0) input 0 to device input 4 (AUD - Analogue 1)
|
||||
$ ./xmos_mixer --set-mixer-source 0 1 5
|
||||
|
||||
Set mixer(0) input 1 to device input 5 (AUD - Analogue 2)
|
||||
$ _
|
||||
|
||||
If you re-run the following command then the first column now has "AUD - Analogue 1 and 2" rather
|
||||
than "DAW (Digital Audio Workstation i.e. the host) - Analogue 1 and 2" confirming the new mapping.
|
||||
Again, by playing audio into analogue inputs 1/2 this can be heard looped through to analogue outputs 1/2::
|
||||
|
||||
$ ./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
|newpage|
|
||||
|
||||
PDM Microphones
|
||||
---------------
|
||||
===============
|
||||
|
||||
Overview of PDM implemention
|
||||
----------------------------
|
||||
|
||||
The design is capable of integrating PDM microphones. The PDM stream from the microphones is converted
|
||||
to PCM and output to the host via USB.
|
||||
The XMOS USB Audio Reference Design firmware is capable of integrating with PDM microphones.
|
||||
The PDM stream from the microphones is converted to PCM and output to the host via USB.
|
||||
|
||||
Interfacing to the PDM microphones is done using the XMOS microphone array library (``lib_mic_array``).
|
||||
``lib_mic_array`` is designed to allow interfacing to PDM microphones coupled with efficient decimation
|
||||
@@ -19,9 +18,6 @@ The following components of the library are used:
|
||||
* PDM interface
|
||||
* Four channel decimators
|
||||
|
||||
|newpage|
|
||||
|
||||
|
||||
Up to sixteen PDM microphones can be attached to each high channel count PDM interface (``mic_array_pdm_rx()``).
|
||||
One to four processing tasks, ``mic_array_decimate_to_pcm_4ch()``, each process up to four channels. For 1-4
|
||||
channels the library requires two logical cores:
|
||||
@@ -40,35 +36,39 @@ for 5-8 channels three logical cores are required, as shown below:
|
||||
Five to eight count PDM interface
|
||||
|
||||
The left most task, ``mic_array_pdm_rx()``, samples up to 8 microphones and filters the data to provide up to
|
||||
eight 384 KHz data streams, split in two streams of four channels. The processing thread
|
||||
decimates the signal to a user chosen sample rate (one of 48, 24, 16, 12 or 8 KHz).
|
||||
eight 384kHz data streams, split into two streams of four channels. The processing thread
|
||||
decimates the signal to a user chosen sample rate (one of 48, 24, 16, 12 or 8kHz).
|
||||
|
||||
More channels can be supported by increasing the number of cores dedicated to the PDM tasks. However, the current
|
||||
PDM mic integration into USB Audio limits itself to 8.
|
||||
PDM mic integration into ``lib_xua`` is limited to 8.
|
||||
|
||||
After the decimation to the output sample-rate various other steps take place e.g. DC offset elimination, gain correction
|
||||
and compensation etc. Please refer to ``lib_mic_array`` documention for further implementation detail and complete feature set.
|
||||
|
||||
and compensation etc. Please refer to the documentation provided with ``lib_mic_array`` for further
|
||||
implementation detail and complete feature set.
|
||||
|
||||
PDM Microphone Hardware Characteristics
|
||||
+++++++++++++++++++++++++++++++++++++++
|
||||
---------------------------------------
|
||||
|
||||
The PDM microphones need a *clock input* and provide the PDM signal on a *data output*. All PDM microphones share the same
|
||||
clock signal (buffered on the PCB as appropriate), and output onto eight data wires that are connected to a single 8-bit port:
|
||||
The PDM microphones require a *clock input* and provide the PDM signal on a *data output*. All of
|
||||
the PDM microphones must share the same clock signal (buffered on the PCB as appropriate), and
|
||||
output onto eight data wires that are connected to a single 8-bit port:
|
||||
|
||||
.. _pdm_wire_table:
|
||||
|
||||
.. list-table:: PDM microphone data and signal wires
|
||||
:class: vertical-borders horizontal-borders
|
||||
|
||||
* - *CLOCK*
|
||||
:header-rows: 1
|
||||
|
||||
* - Signal
|
||||
- Description
|
||||
* - CLOCK
|
||||
- Clock line, the PDM clock the used by the microphones to
|
||||
drive the data out.
|
||||
* - *DQ_PDM*
|
||||
* - DQ_PDM
|
||||
- The data from the PDM microphones on an 8 bit port.
|
||||
|
||||
The only port that is passed into ``lib_mic_array`` is the 8-bit data port. The library
|
||||
assumes that the input port is clocked using the PDM clock and requires no knowlege of the
|
||||
assumes that the input port is clocked using the PDM clock and requires no knowledge of the
|
||||
PDM clock source.
|
||||
|
||||
The input clock for the microphones can be generated in a multitude of
|
||||
@@ -76,14 +76,14 @@ ways. For example, a 3.072MHz clock can be generated on the board, or the xCORE
|
||||
divide down 12.288 MHz master clock. Or, if clock accuracy is not important, the internal 100 MHz
|
||||
reference can be divided down to provide an approximate clock.
|
||||
|
||||
Integration of PDM Microphones into USB Audio
|
||||
+++++++++++++++++++++++++++++++++++++++++++++
|
||||
Usage & Integration
|
||||
-------------------
|
||||
|
||||
A PDM microphone wrapper is called from ``main()`` and takes one channel argument connecting it to the rest of the system:
|
||||
|
||||
``pcm_pdm_mic(c_pdm_pcm);``
|
||||
|
||||
The implemetation of this function can be found in the file ``pcm_pdm_mics.xc``.
|
||||
The implementation of this function can be found in the file ``pcm_pdm_mics.xc``.
|
||||
|
||||
The first job of this function is to configure the ports/clocking for the microphones, this divides the external
|
||||
audio master clock input (on port ``p_mclk``) and outputs the divided clock to the microphones via the ``p_pdm_clk`` port::
|
||||
@@ -93,7 +93,7 @@ audio master clock input (on port ``p_mclk``) and outputs the divided clock to t
|
||||
configure_in_port(p_pdm_mics, pdmclk);
|
||||
start_clock(pdmclk);
|
||||
|
||||
It then runs the various cores required for the PDM interface and PDM to PCM conversion as discussed previously::
|
||||
It then runs the various cores required for the PDM interface and PDM to PCM conversion as previously discussed::
|
||||
|
||||
par
|
||||
{
|
||||
@@ -107,8 +107,9 @@ The ``pdm_process()`` task includes the main integration code, it takes audio fr
|
||||
it, performs optional local processing and outputs it to the audio driver (TDM/I2S core).
|
||||
|
||||
This function simply makes a call to ``mic_array_get_next_time_domain_frame()`` in order to get a frame of PCM audio
|
||||
from the microphones. It then waits for an request for audio samples from the audio/I2S/TDM core via a channel and
|
||||
from the microphones. It then waits for an request for audio samples from the Audio Hub core via a channel and
|
||||
sends the frame of audio back over this channel.
|
||||
|
||||
Note, it is assumed that the system shares a global master-clock, therefore no additional buffering or rate-matching/conversion
|
||||
is required.
|
||||
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
|newpage|
|
||||
|
||||
.. _usb_audio_sec_resource_usage:
|
||||
|
||||
Resource Usage
|
||||
--------------
|
||||
==============
|
||||
|
||||
The following table details the resource usage of each
|
||||
component of the reference design software.
|
||||
The following table details the resource usage of each component of the reference design software.
|
||||
Note, memory usage is approximate and varies based on device used, compiler settings etc.
|
||||
|
||||
.. table:: Resource Usage
|
||||
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Component | Cores | Memory (KB) | Ports |
|
||||
+===============+===============+=====================+=====================================+
|
||||
| XUD library | 1 | 9 (6 code) | ULPI ports |
|
||||
| XUD library | 1 | 9 (6 code) | USB ports |
|
||||
| | | | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Endpoint 0 | 1 | 17.5 (10.5 code) | none |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| USB Buffering | 1 | 22.5 (1 code) | none |
|
||||
| USB Buffering | 2 | 22.5 (1 code) | 1 x n bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Audio driver | 1 | 8.5 (6 code) | See :ref:`usb_audio_sec_audio` |
|
||||
| Audio Hub | 1 | 8.5 (6 code) | See :ref:`usb_audio_sec_audio` |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| S/PDIF Tx | 1 | 3.5 (2 code) | 1 x 1 bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
@@ -26,18 +28,18 @@ component of the reference design software.
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| ADAT Rx | 1 | 3.2 (3.2 code) | 1 x 1 bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Midi | 1 | 6.5 (1.5 code) | 2 x 1 bit ports |
|
||||
| MIDI | 1 | 6.5 (1.5 code) | 2 x 1 bit ports |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Mixer | 2 | 8.7 (6.5 code) | |
|
||||
| Mixer | (up to) 2 | 8.7 (6.5 code) | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| ClockGen | 1 | 2.5 (2.4 code) | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
|
||||
.. note::
|
||||
|
||||
These resource estimates are based on the multichannel reference design with
|
||||
all options of that design enabled. For fewer channels, the resource
|
||||
usage is likely to decrease.
|
||||
These resource estimates are based on the multichannel reference design with
|
||||
all options of that design enabled. For fewer channels, the resource
|
||||
usage is likely to decrease.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -46,6 +48,6 @@ component of the reference design software.
|
||||
|
||||
.. note::
|
||||
|
||||
The ULPI ports are a fixed set of ports on the L-Series
|
||||
device. When using these ports, other ports are
|
||||
unavailable when ULPI is active. See the `XS1-L Hardware Design Checklist <http://www.xmos.com/published/xs1lcheck>`_ for further details.
|
||||
Unlike other interfaces, since the USB PHY is internal the USB ports are a fixed set of ports
|
||||
and cannot be modified. See ``lib_xud`` documentation for full details.
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
|
||||
|newpage|
|
||||
|
||||
S/PDIF Transmit
|
||||
...............
|
||||
===============
|
||||
|
||||
``lib_xua`` supports the development of devices with S/PDIF transmit throught the use of ``lib_spdif``.
|
||||
The XMOS S/SPDIF transmitter component runs in a single core and supports sample-rates upto 192kHz.
|
||||
@@ -18,7 +21,7 @@ bits) and transmitted in biphase-mark encoding (BMC) with respect to an *externa
|
||||
Note that a minor change to the ``SpdifTransmitPortConfig`` function would enable *internal* master
|
||||
clock generation (e.g. when clock source is already locked to desired audio clock).
|
||||
|
||||
.. list-table:: S/PDIF Capabilities
|
||||
.. list-table:: S/PDIF Capabilities
|
||||
|
||||
* - **Sample frequencies**
|
||||
- 44.1, 48, 88.2, 96, 176.4, 192 kHz
|
||||
@@ -28,7 +31,7 @@ clock generation (e.g. when clock source is already locked to desired audio cloc
|
||||
- ``lib_spdif``
|
||||
|
||||
Clocking
|
||||
++++++++
|
||||
--------
|
||||
|
||||
.. only:: latex
|
||||
|
||||
@@ -51,7 +54,7 @@ This resamples the master clock to its clock domain (oscillator), which introduc
|
||||
A typical jitter-reduction scheme is an external D-type flip-flop clocked from the master clock (as shown in the preceding diagram).
|
||||
|
||||
Usage
|
||||
+++++
|
||||
-----
|
||||
|
||||
The interface to the S/PDIF transmitter core is via a normal channel with streaming built-ins
|
||||
(``outuint``, ``inuint``). Data format should be 24-bit left-aligned in a 32-bit word: ``0x12345600``
|
||||
@@ -79,10 +82,10 @@ The following protocol is used on the channel:
|
||||
* - ``...``
|
||||
-
|
||||
|
||||
This communication is wrapped up in the API functions provided by ``lib_spdif``.
|
||||
|
||||
|
||||
Output stream structure
|
||||
+++++++++++++++++++++++
|
||||
Output Stream Structure
|
||||
-----------------------
|
||||
|
||||
The stream is composed of words with the following structure shown in
|
||||
:ref:`usb_audio_spdif_stream_structure`. The channel status bits are
|
||||
@@ -126,15 +129,15 @@ indicates sampling frequency as shown in :ref:`usb_audio_spdif_sample_bits`.
|
||||
* - Frequency (kHz)
|
||||
- n
|
||||
* - 44.1
|
||||
- 0
|
||||
- 0x0
|
||||
* - 48
|
||||
- 2
|
||||
- 0x2
|
||||
* - 88.2
|
||||
- 8
|
||||
- 0x8
|
||||
* - 96
|
||||
- A
|
||||
- 0xA
|
||||
* - 176.4
|
||||
- C
|
||||
- 0xC
|
||||
* - 192
|
||||
- E
|
||||
- 0xE
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
|newpage|
|
||||
|
||||
S/PDIF Receive
|
||||
---------------
|
||||
==============
|
||||
|
||||
XMOS devices can support S/PDIF receive up to 192kHz.
|
||||
XMOS devices can support S/PDIF receive up to 192kHz - see ``lib_spdif`` for full specifications.
|
||||
|
||||
The S/PDIF receiver module uses a clockblock and a buffered one-bit port.
|
||||
The S/PDIF receiver module uses a clock-block and a buffered one-bit port.
|
||||
The clock-block is divided of a 100 MHz reference clock. The one bit port is buffered to 4-bits.
|
||||
The receiver code uses this clock to over sample the input data.
|
||||
|
||||
The receiver outputs audio samples over a *streaming channel end* where data can be input using the
|
||||
built-in input operator.
|
||||
built-in input operator. ``lib_spdif`` also provides API functions that wrap up this communication.
|
||||
|
||||
The S/PDIF receive function never returns. The 32-bit value from the channel
|
||||
input comprises:
|
||||
The S/PDIF receive function never returns. The 32-bit value from the channel input comprises:
|
||||
|
||||
.. list-table:: S/PDIF RX Word Structure
|
||||
:header-rows: 1
|
||||
@@ -41,29 +42,34 @@ The tag has one of three values:
|
||||
* - FRAME\_Z
|
||||
- Sample on channel 0 (Left), and the first sample of a frame; can be used if the user bits need to be reconstructed.
|
||||
|
||||
See S/PDIF specification for further details on format, user bits etc.
|
||||
See S/PDIF, IEC 60958-3:2006, specification for further details on format, user bits etc.
|
||||
|
||||
Usage and Integration
|
||||
+++++++++++++++++++++
|
||||
---------------------
|
||||
|
||||
Since S/PDIF is a digital steam the devices master clock must be syncronised to it. This is typically
|
||||
done with an external fractional-n multipier. See `Clock Recovery` (:ref:`usb_audio_sec_clock_recovery`)
|
||||
Since S/PDIF is a digital steam the devices master clock must be synchronised to it. This is typically
|
||||
done with an external device. See `Clock Recovery` (:ref:`usb_audio_sec_clock_recovery`).
|
||||
|
||||
The S/PDIF receive function communicates with the ``clockGen`` component with passes audio data to the
|
||||
audio driver and handles locking to the S/PDIF clock source if required (see External Clock Recovery).
|
||||
.. note::
|
||||
|
||||
Due to the requirement for this clock recovery S/PDIF receive can only be used in Asynchronous
|
||||
mode.
|
||||
|
||||
The S/PDIF receive function communicates with the Clock Gen core, which in turn passes audio data to the
|
||||
Audio Hub core. The Clock Gen core also handles locking to the S/PDIF clock source
|
||||
(see :ref:`usb_audio_sec_clock_recovery`).
|
||||
|
||||
Ideally the parity of each word/sample received should be checked. This is done using the built in
|
||||
``crc32`` function (see ``xs1.h``):
|
||||
|
||||
.. literalinclude:: sc_usb_audio/module_usb_audio/clocking/clockgen.xc
|
||||
.. literalinclude:: lib_xua/src/core/clocking/clockgen.xc
|
||||
:start-after: //:badParity
|
||||
:end-before: //:
|
||||
|
||||
If bad parity is detected the word/sample is ignored, otherwise the tag is inspected for channel
|
||||
(i.e. left or right) and the sample stored.
|
||||
|
||||
The following code snippet illustrates how the output of the S/PDIF receive component could be used::
|
||||
|
||||
The following code snippet illustrates how the output of the S/PDIF receive component could is used::
|
||||
|
||||
while(1)
|
||||
{
|
||||
@@ -90,6 +96,5 @@ The following code snippet illustrates how the output of the S/PDIF receive comp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
The Clock Gen core stores samples in a small FIFO before they are communicated to the Audio Hub core.
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
|newpage|
|
||||
|
||||
XMOS USB Device (XUD) Library
|
||||
.............................
|
||||
=============================
|
||||
|
||||
All low level communication with the USB host is handled by the XMOS USB Device (XUD) library - `lib_xud`
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Using lib_xud
|
||||
-------------
|
||||
|
||||
This sections describes the basic usage of `lib_xud`. It provides a guide on how to program the USB Audio Devices using `lib_xud`.
|
||||
Basic Usage
|
||||
***********
|
||||
|
||||
Reviewing application note AN00246 is highly recommended at this point.
|
||||
This sections describes the basic usage of `lib_xua` and provides a guide on how to program USB Audio Devices.
|
||||
|
||||
Library structure
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Library Structure
|
||||
=================
|
||||
|
||||
The code is split into several directories.
|
||||
|
||||
@@ -18,15 +18,17 @@ The code is split into several directories.
|
||||
- MIDI I/O code
|
||||
* - dfu
|
||||
- Device Firmware Upgrade code
|
||||
* - hid
|
||||
- Human Interface Device code
|
||||
|
||||
|
||||
Note, the midi and dfu directories are potential candidates for separate libs in their own right.
|
||||
|
||||
|
||||
Including in a project
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
Using in a Project
|
||||
==================
|
||||
|
||||
All `lib_xua` functions can be accessed via the ``xua.h`` header filer::
|
||||
All `lib_xua` functions can be accessed via the ``xua.h`` header file::
|
||||
|
||||
#include <xua.h>
|
||||
|
||||
@@ -34,109 +36,51 @@ It is also required to add ``lib_xua`` to the ``USED_MODULES`` field of your app
|
||||
|
||||
USED_MODULES = .. lib_xua ...
|
||||
|
||||
.. _sec_basic_usage_codeless:
|
||||
|
||||
Core hardware resources
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
"Codeless" Programming Model
|
||||
============================
|
||||
|
||||
The user must declare and initialise relevant hardware resources (globally) and pass them to the relevant function of `lib_xua`.
|
||||
Whilst it is possible to code a USB Audio device using the building blocks provided by `lib_xua`
|
||||
it is realised that this might not be desirable for many classes of customers or products.
|
||||
|
||||
As an absolute minimum the following resources are required:
|
||||
For instance, some users may not have a large software development experience and simply want to
|
||||
customise some basic settings such as strings, sample-rates, channel-counts etc.
|
||||
Others may want to fully customise the implementation - adding additional functionality such as
|
||||
adding DSP or possibly only using a subset of the functions provided - just ``XUA_AudioHub``,
|
||||
for example.
|
||||
|
||||
- A 1-bit port for audio master clock input
|
||||
- A n-bit port for internal feedback calculation (typically a free, unused port is used e.g. `16B`)
|
||||
- A clock-block, which will be clocked from the master clock input port
|
||||
In addition, the large number of supported features can lead to a large number of tasks, hardware
|
||||
resources, communication channels etc, requiring quite a lot of code to be authored for each product.
|
||||
|
||||
Example declaration of these resources might look as follows::
|
||||
In order to cater for the former class of users, a "codeless" option is provided. Put simply, a file
|
||||
``main.xc`` is provided which includes a pre-authored ``main()`` function along with all of the
|
||||
required hardware resource declarations. Code is generated based on the options provided by the
|
||||
developer in ``xua_conf.h``
|
||||
|
||||
in port p_mclk_in = PORT_MCLK_IN;
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
Using this development model the user simply must include a ``xua_conf.h`` with their settings and
|
||||
optional implementations of any 'user functions' as desired. This, along with an XN file for their
|
||||
hardware platform, is all that is required to build a fully featured and functioning product. This
|
||||
XN file should contain definitions of the ports used for the various ``lib_xua`` functionality,
|
||||
see ::ref:`sec_options`.
|
||||
|
||||
.. note::
|
||||
This development model also provides the benefit of a full and verified codebase as a basis for a product.
|
||||
|
||||
The `PORT_MCLK_IN` and `PORT_MCLK_COUNT` defintions are derived from the projects XN file
|
||||
This behaviour described in this section is the default behaviour of `lib_xua`, to disable this please
|
||||
set ``EXCLUDE_USB_AUDIO_MAIN`` to 1 in the application makefile or ``xua_conf.h`` and see
|
||||
::ref:`sec_advanced_usage`.
|
||||
|
||||
Configuring lib_xua
|
||||
===================
|
||||
|
||||
The ``XUA_AudioHub()`` function requires an audio master clock input to clock the physical audio I/O. Less obvious is the reasoning for the ``XUA_Buffer()``
|
||||
task having the same requirement - it is used for the USB feedback system and packet sizing.
|
||||
Configuration of the various build time options of ``lib_xua`` is done via the optional header `xua_conf.h`.
|
||||
To allow the build scripts to locate this file it should reside somewhere in the application `src` directory.
|
||||
|
||||
Due to the above, if the ``XUD_AudioHub()`` and ``XUA_Buffer()`` cores must reside on separate tiles a separate master clock input port must be provided to each, for example::
|
||||
Such build time options include audio class version, sample rates, channel counts etc. Please see
|
||||
::ref:`sec_api` for full listings.
|
||||
|
||||
/* Master clock for the audio IO tile */
|
||||
in port p_mclk_in = PORT_MCLK_IN;
|
||||
|
||||
/* Resources for USB feedback */
|
||||
in port p_mclk_in_usb = PORT_MCLK_IN_USB; /* Extra master clock input for the USB tile */
|
||||
|
||||
Whilst the hardware resources described in this section satisfy the basic requirements for the operation (or build) of `lib_xua` projects typically also needs some additional audio I/O,
|
||||
I2S or SPDIF for example.
|
||||
|
||||
These should be passed into the various cores as required - see API and Features sections.
|
||||
|
||||
Running the core components
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In their most basic form the core components can be run as follows::
|
||||
|
||||
par
|
||||
{
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null);
|
||||
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
XUA_AudioHub(c_aud, ...) ;
|
||||
}
|
||||
|
||||
``XUA_Buffer()`` expects its ``p_for_mclk_count`` argument to be clocked from the audio master clock before being passed it.
|
||||
The following code satisfies this requirement::
|
||||
|
||||
{
|
||||
/* Connect master-clock clock-block to clock-block pin */
|
||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb); /* Clock clock-block from mclk pin */
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb); /* Clock the "count" port from the clock block */
|
||||
start_clock(clk_audio_mclk_usb); /* Set the clock off running */
|
||||
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
}
|
||||
|
||||
.. note:: Keeping this configuration outside of ``XUA_Buffer()`` does not preclude the possibllty of sharing ``p_mclk_in_usb`` port with additional components
|
||||
|
||||
To produce a fully operating device a call to ``XUD_Main()`` (from ``lib_xud``) must also be made for USB connectivity::
|
||||
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
Additionally the required communication channels must also be declared::
|
||||
|
||||
/* Channel arrays for lib_xud */
|
||||
chan c_ep_out[2];
|
||||
chan c_ep_in[2];
|
||||
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and AudioHub/IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */
|
||||
chan c_aud_ctl;
|
||||
|
||||
|
||||
This section provides enough information to implement a skeleton program for a USB Audio device. When running the xCORE device will present itself as a USB Audio Class device on the bus.
|
||||
|
||||
|
||||
Configuring XUA
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Configuration of the various build time options of ``lib_xua`` is done via the optional header `xua_conf.h`. Such build time options include audio class version, sample rates, channel counts etc.
|
||||
Please see the API section for full listings.
|
||||
|
||||
The build system will automatically include the `xua_conf.h` header file as appropriate - the user should continue to include `xua.h` as previously directed. A simple example is shown below::
|
||||
The build system will automatically include the `xua_conf.h` header file as appropriate - the developer
|
||||
should continue to include `xua.h` as previously directed. A simple example is shown below::
|
||||
|
||||
#ifndef _XUA_CONF_H_
|
||||
#define _XUA_CONF_H_
|
||||
@@ -149,28 +93,10 @@ The build system will automatically include the `xua_conf.h` header file as appr
|
||||
|
||||
#endif
|
||||
|
||||
User Functions
|
||||
==============
|
||||
|
||||
User functions
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
To enable custom functionality, such as configuring external audio hardware, custom functionality on stream start/stop etc various user overridable functions are provided (see API section for full listings). The default implementations are empty.
|
||||
|
||||
|
||||
Codeless programming model
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Whilst it is possible to code a USB Audio device using the building blocks provided by `lib_xua` it is realised that this might not be desirable for some classes of customers or product.
|
||||
|
||||
For instance, some users may not have a large software development experience and simply want to customise some basic settings such as strings, sample-rates, channel-counts etc. Others may want to fully customise the implementation - adding additional functionality such as adding DSD or possibly only using a subset of the functions provided - just ``XUA_AudioHub``, for example.
|
||||
|
||||
In addition, the large number of supported features can lead to a large number of tasks, hardware resources, communication channels etc, requiring quite a lot of code to be authored for each product.
|
||||
|
||||
In order to cater for the former class of users, a "codeless" option is provided. Put simply, a file ``main.xc`` is provided which includes a pre-authored ``main()`` function along with all of the required hardware resource declarations. Code is generated based on the options provided in ``xua_conf.h``
|
||||
|
||||
Using this development model the user simply must include a ``xua_conf.h`` with their settings and optional implementations of any 'user functions' as desired. This, along with an XN file for their hardware platform, is all that is required to build a fully featured and functioning product.
|
||||
|
||||
This model also provides the benefit of a known-good, full codebase as a basis for a product.
|
||||
|
||||
This behaviour described in this section is the default behaviour of `lib_xua`, to disable this please set ``EXCLUDE_USB_AUDIO_MAIN`` to 1 in the application makefile or ``xua_conf.h``.
|
||||
|
||||
To enable custom functionality, such as configuring external audio hardware, bespoke behaviour on
|
||||
stream start/stop etc, various functions can be overridden by the user. (see ::ref:`sec_api` for
|
||||
full listings). The default implementations of these functions are empty.
|
||||
|
||||
|
||||
25
lib_xua/doc/rst/using_adv.rst
Normal file
25
lib_xua/doc/rst/using_adv.rst
Normal file
@@ -0,0 +1,25 @@
|
||||
.. _sec_advanced_usage:
|
||||
|
||||
Advanced Usage
|
||||
**************
|
||||
|
||||
Whilst it is possible to program USB Audio devices using ``lib_xua`` by only setting defines
|
||||
(see :ref:`sec_basic_usage_codeless`) some developers may want to code a USB Audio device from
|
||||
scratch using the building blocks provided by `lib_xua`.
|
||||
|
||||
This could be for a number of reasons, adding complex DSP, merging with some other functionality
|
||||
etc. This section describes these building blocks and their use.
|
||||
|
||||
Reviewing application note AN00246 is highly recommended at this point.
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
Core Hardware Resources <using_adv_core_hw>
|
||||
Running the Core Components <using_adv_core_comp>
|
||||
I2S/TDM <using_adv_i2s>
|
||||
Mixer <using_adv_mixer>
|
||||
|
||||
|
||||
|
||||
|
||||
64
lib_xua/doc/rst/using_adv_core_comp.rst
Normal file
64
lib_xua/doc/rst/using_adv_core_comp.rst
Normal file
@@ -0,0 +1,64 @@
|
||||
Running the Core Components
|
||||
===========================
|
||||
|
||||
In their most basic form the core components can be run as follows::
|
||||
|
||||
par
|
||||
{
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, ...);
|
||||
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
XUA_AudioHub(c_aud, ...) ;
|
||||
}
|
||||
|
||||
``XUA_Buffer()`` expects its ``p_for_mclk_count`` argument to be clocked from the audio master clock
|
||||
before receiving it as a parameter. The following code satisfies this requirement::
|
||||
|
||||
{
|
||||
/* Connect master-clock clock-block to clock-block pin */
|
||||
|
||||
/* Clock clock-block from mclk pin */
|
||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb);
|
||||
|
||||
/* Clock the "count" port from the clock block */
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb);
|
||||
|
||||
/* Set the clock off running */
|
||||
start_clock(clk_audio_mclk_usb);
|
||||
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
}
|
||||
|
||||
.. note:: Keeping this configuration outside of ``XUA_Buffer()`` means the possibility of sharing the
|
||||
``p_mclk_in_usb`` port with additional components is not precluded
|
||||
|
||||
For USB connectivity a call to ``XUD_Main()`` (from ``lib_xud``) must also be made::
|
||||
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
Additionally, the required communication channels must also be declared::
|
||||
|
||||
/* Channel arrays for lib_xud */
|
||||
chan c_ep_out[2];
|
||||
chan c_ep_in[2];
|
||||
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and AudioHub/IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */
|
||||
chan c_aud_ctl;
|
||||
|
||||
|
||||
This section provides enough information to implement a skeleton program for a USB Audio device. When
|
||||
running the xCORE device will present itself as a USB Audio Class device on the bus. Audio streaming will
|
||||
be impaired since no physical audio interfaces have yet to be instantiated.
|
||||
|
||||
43
lib_xua/doc/rst/using_adv_core_hw.rst
Normal file
43
lib_xua/doc/rst/using_adv_core_hw.rst
Normal file
@@ -0,0 +1,43 @@
|
||||
Core Hardware Resources
|
||||
=======================
|
||||
|
||||
The user must declare and initialise relevant hardware resources (globally) and pass them to the
|
||||
relevant function of `lib_xua`.
|
||||
|
||||
As an absolute minimum the following resources are required:
|
||||
|
||||
- A 1-bit port for audio master clock input
|
||||
- A clock-block, which will be clocked from the master clock input port
|
||||
|
||||
When using the default asynchronous mode of operation an additional port is required:
|
||||
|
||||
- A n-bit port for internal feedback calculation (typically a free, unused port is used e.g. ``XS1_PORT_16B``)
|
||||
|
||||
Example declaration of these resources might look as follows::
|
||||
|
||||
in port p_mclk_in = PORT_MCLK_IN;
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
|
||||
.. note::
|
||||
|
||||
The ``PORT_MCLK_IN`` and ``PORT_MCLK_COUNT`` definitions are derived from the projects XN file
|
||||
|
||||
|
||||
The ``XUA_AudioHub()`` function requires an audio master clock input to clock the physical audio I/O.
|
||||
Less obvious is the reasoning for the ``XUA_Buffer()`` task having the same requirement when running in
|
||||
asynchronous mode - it is used for the USB feedback system and packet sizing.
|
||||
|
||||
Due to the above, if the ``XUD_AudioHub()`` and ``XUA_Buffer()`` cores must reside on separate
|
||||
tiles a separate master clock input port must be provided to each, for example::
|
||||
|
||||
/* Master clock for the audio IO tile */
|
||||
in port p_mclk_in = PORT_MCLK_IN;
|
||||
|
||||
/* Resources for USB feedback */
|
||||
in port p_mclk_in_usb = PORT_MCLK_IN_USB; /* Extra master clock input for the USB tile */
|
||||
|
||||
Whilst the hardware resources described in this section satisfy the basic requirements for the operation (or build)
|
||||
of `lib_xua`, projects typically also need some additional audio I/O, I2S or S/PDIF for example.
|
||||
|
||||
These should be passed into the various cores as required - see :ref:`sec_api`.
|
||||
38
lib_xua/doc/rst/using_adv_i2s.rst
Normal file
38
lib_xua/doc/rst/using_adv_i2s.rst
Normal file
@@ -0,0 +1,38 @@
|
||||
|newpage|
|
||||
|
||||
I2S/TDM
|
||||
=======
|
||||
|
||||
I2S/TDM is typically fundamental to most products and is built into the ``XUA_AudioHub()`` core.
|
||||
|
||||
In order to enable I2S on must declare an array of ports for the data-lines (one for each direction)::
|
||||
|
||||
/* Port declarations. Note, the defines come from the XN file */
|
||||
buffered out port:32 p_i2s_dac[] = {PORT_I2S_DAC0}; /* I2S Data-line(s) */
|
||||
buffered in port:32 p_i2s_adc[] = {PORT_I2S_ADC0}; /* I2S Data-line(s) */
|
||||
|
||||
Ports for the sample and bit clocks are also required::
|
||||
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK; /* I2S Bit-clock */
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
|
||||
|
||||
.. note::
|
||||
|
||||
All of these ports must be 1-bit ports, 32-bit buffed. Based on whether the xCORE is bus slave/master the ports must be declared as input/output respectively
|
||||
|
||||
These ports must then be passed to the ``XUA_AudioHub()`` task appropriately.
|
||||
|
||||
I2S functionality also requires two clock-blocks, one for bit and sample clock e.g.::
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
|
||||
These hardware resources must be passed into the call to ``XUA_AudioHub()``::
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves
|
||||
* as a hub for all audio) */
|
||||
|
||||
on tile[0]: XUA_AudioHub(c_aud, clk_audio_mclk, clk_audio_bclk, p_mclk_in,
|
||||
p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc);
|
||||
|
||||
28
lib_xua/doc/rst/using_adv_mixer.rst
Normal file
28
lib_xua/doc/rst/using_adv_mixer.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
|newpage|
|
||||
|
||||
Mixer
|
||||
=====
|
||||
|
||||
Since the mixer has no I/O the instantiation is straight forward. Communication wises, the mixer cores are inserted
|
||||
between the `AudioHub` and Buffering core(s)
|
||||
|
||||
It takes three channel ends as parameters, one for audio to/from the buffering core(s), one for audio to/from the
|
||||
`AudioHub` core and another one for control requests from the `Endpoint0` core.
|
||||
|
||||
The mixer task will automatically handle the change in mix count based on the current sample frequency (communicated
|
||||
via the data channels from the buffering task).
|
||||
|
||||
An example of how the mixer task might be called is shown below (some parameter lists are abbreviated) ::
|
||||
|
||||
chan c_aud_0, c_aud_1, c_mix_ctl;
|
||||
|
||||
par
|
||||
{
|
||||
XUA_Buffer(..., c_aud_0, ...);
|
||||
|
||||
mixer(c_aud0, c_aud_1, c_mix_ctl);
|
||||
|
||||
XUA_AudioHub(c_aud_1, ...);
|
||||
|
||||
XUA_Endpoint0(..., c_mix_ctl, ...);
|
||||
}
|
||||
@@ -1,2 +1,5 @@
|
||||
XMOSNEWSTYLE = 1
|
||||
XMOSNEWSTYLE = 2
|
||||
DOXYGEN_DIRS=../../api
|
||||
SOURCE_INCLUDE_DIRS=../../../lib_xua
|
||||
SPHINX_MASTER_DOC=lib_xua
|
||||
|
||||
|
||||
@@ -1277,7 +1277,7 @@ enum libusb_capability {
|
||||
* still have to call additional libusb functions such as
|
||||
* \ref libusb_detach_kernel_driver(). */
|
||||
LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
|
||||
/** The library supports detaching of the default USB driver, using
|
||||
/** The library supports detaching of the default USB driver, using
|
||||
* \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
|
||||
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
|
||||
};
|
||||
|
||||
@@ -1273,7 +1273,7 @@ enum libusb_capability {
|
||||
* still have to call additional libusb functions such as
|
||||
* \ref libusb_detach_kernel_driver(). */
|
||||
LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
|
||||
/** The library supports detaching of the default USB driver, using
|
||||
/** The library supports detaching of the default USB driver, using
|
||||
* \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
|
||||
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
|
||||
};
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
VERSION = 1.3.0
|
||||
VERSION = 3.4.0
|
||||
|
||||
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
|
||||
lib_xassert(>=4.0.0) \
|
||||
lib_xud(>=1.0.0) \
|
||||
lib_spdif(>=4.0.0) \
|
||||
lib_mic_array(>=4.0.0)
|
||||
DEBUG ?= 0
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
DEBUG_FLAGS = -g -DXASSERT_ENABLE_ASSERTIONS=1 -DXASSERT_ENABLE_DEBUG=1 -DXASSERT_ENABLE_LINE_NUMBERS=1
|
||||
else
|
||||
DEBUG_FLAGS = -DXASSERT_ENABLE_ASSERTIONS=0 -DXASSERT_ENABLE_DEBUG=0 -DXASSERT_ENABLE_LINE_NUMBERS=0
|
||||
endif
|
||||
|
||||
DEPENDENT_MODULES = lib_locks(>=2.1.0) \
|
||||
lib_logging(>=3.1.1) \
|
||||
lib_mic_array(>=4.5.0) \
|
||||
lib_spdif(>=4.2.1) \
|
||||
lib_xassert(>=4.1.0) \
|
||||
lib_xud(>=2.2.3) \
|
||||
lib_adat(>=1.0.0)
|
||||
|
||||
MODULE_XCC_FLAGS = $(XCC_FLAGS) \
|
||||
-O3 \
|
||||
-DREF_CLK_FREQ=100 \
|
||||
-fasm-linenum \
|
||||
-fcomment-asm
|
||||
-fcomment-asm \
|
||||
$(DEBUG_FLAGS)
|
||||
|
||||
# Core
|
||||
XCC_FLAGS_xua_endpoint0.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||
@@ -40,7 +51,6 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
|
||||
src/core/pdm_mics \
|
||||
src/core/ports \
|
||||
src/core/support \
|
||||
src/core/support/powersave \
|
||||
src/core/user \
|
||||
src/core/user/audiostream \
|
||||
src/core/user/hid \
|
||||
@@ -58,7 +68,6 @@ SOURCE_DIRS = src/core \
|
||||
src/core/pdm_mics \
|
||||
src/core/ports \
|
||||
src/core/support \
|
||||
src/core/support/powersave \
|
||||
src/core/user/audiostream \
|
||||
src/core/user/hostactive \
|
||||
src/core/xuduser \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018-2021 XMOS LIMITED.
|
||||
// Copyright 2018-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
unsigned adatCounter = 0;
|
||||
@@ -11,7 +11,7 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
|
||||
/* Do some re-arranging for SMUX.. */
|
||||
unsafe
|
||||
{
|
||||
unsigned * unsafe samplesFromHostAdat = &samplesFromHost[ADAT_TX_INDEX];
|
||||
unsigned * unsafe samplesFromHostAdat = (unsigned * unsafe) &samplesFromHost[ADAT_TX_INDEX];
|
||||
|
||||
/* Note, when smux == 1 this loop just does a straight 1:1 copy */
|
||||
//if(smux != 1)
|
||||
@@ -38,7 +38,7 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
|
||||
inuint(c_adat_out);
|
||||
|
||||
/* Send buffer pointer over to ADAT core */
|
||||
volatile unsigned * unsafe samplePtr = &adatSamples;
|
||||
volatile unsigned * unsafe samplePtr = (unsigned * unsafe) &adatSamples;
|
||||
outuint(c_adat_out, (unsigned) samplePtr);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018-2021 XMOS LIMITED.
|
||||
// Copyright 2018-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#if (DSD_CHANS_DAC != 0)
|
||||
@@ -28,7 +28,7 @@ static inline void DoDsdNative(unsigned samplesOut[], unsigned &dsdSample_l, uns
|
||||
asm volatile("out res[%0], %1"::"r"(p_dsd_dac[1]),"r"(dsdSample_r));
|
||||
}
|
||||
|
||||
/* This function performs the DOP loop and collects 16b of DSD per loop
|
||||
/* This function performs the DOP loop and collects 16b of DSD per loop
|
||||
and outputs a 32b word into the port buffer every other cycle. */
|
||||
static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &ds
|
||||
dsdSample_r = ((samplesOut[1] & 0xffff00) << 8);
|
||||
everyOther = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
everyOther = 0;
|
||||
dsdSample_l = dsdSample_l | ((samplesOut[0] & 0xffff00) >> 8);
|
||||
@@ -52,7 +52,7 @@ static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &ds
|
||||
/* When DSD is enabled and streaming is standard PCM, this function checks for a series of DoP markers in the upper byte.
|
||||
If found it will exit deliver() with the command to restart in DoP mode.
|
||||
When in DoP mode, this function will check for a single absence of the DoP marker and exit deliver() with the command
|
||||
to restart in I2S mode. */
|
||||
to restart in I2S/PCM mode. */
|
||||
static inline int DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSamFreq, unsigned samplesOut[], unsigned &dsdMarker)
|
||||
{
|
||||
/* Check for DSD - note we only move into DoP mode if valid DoP Freq */
|
||||
@@ -77,7 +77,7 @@ static inline int DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSa
|
||||
dsdMarker = DSD_MARKER_2;
|
||||
}
|
||||
}
|
||||
else if(dsdMode == DSD_MODE_DOP)
|
||||
else if(dsdMode == DSD_MODE_DOP)
|
||||
{
|
||||
/* If we are running in DOP mode, check if we need to come out */
|
||||
if((DSD_MASK(samplesOut[0]) != DSD_MARKER_1) && (DSD_MASK(samplesOut[1]) != DSD_MARKER_1))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018-2021 XMOS LIMITED.
|
||||
// Copyright 2018-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include "xua.h"
|
||||
|
||||
@@ -38,7 +38,6 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma xta endpoint "divide_1"
|
||||
unsigned tmp;
|
||||
#ifdef N_BITS_I2S
|
||||
tmp = partout_timestamped(p_lrclk, N_BITS_I2S, 0);
|
||||
@@ -59,14 +58,18 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
unsigned lrClkVal = 0x7FFFFFFF;
|
||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
{
|
||||
lrclkVal = 0x80000000;
|
||||
}
|
||||
|
||||
#ifdef N_BITS_I2S
|
||||
partout_timed(p_lrclk, N_BITS_I2S, 0x7FFFFFFF, tmp);
|
||||
partout_timed(p_lrclk, N_BITS_I2S, lrClkVal, tmp);
|
||||
#else
|
||||
p_lrclk @ tmp <: 0x7FFFFFFF;
|
||||
p_lrclk @ tmp <: lrClkVal;
|
||||
#endif
|
||||
|
||||
|
||||
#if (I2S_CHANS_ADC != 0)
|
||||
for(int i = 0; i < I2S_WIRES_ADC; i++)
|
||||
{
|
||||
@@ -88,9 +91,7 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#else
|
||||
void InitPorts_slave(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC])
|
||||
{
|
||||
#if (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0)
|
||||
@@ -101,7 +102,7 @@ void InitPorts_slave(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buf
|
||||
p_lrclk when pinseq(1) :> void;
|
||||
p_lrclk when pinseq(0) :> void;
|
||||
p_lrclk when pinseq(1) :> void;
|
||||
#if I2S_MODE_TDM
|
||||
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
p_lrclk when pinseq(0) :> void;
|
||||
p_lrclk when pinseq(1) :> void @ tmp;
|
||||
#else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/**
|
||||
* @file xua_audiohub.xc
|
||||
@@ -25,7 +25,7 @@
|
||||
#if (XUA_SPDIF_TX_EN)
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
#include "adat_tx.h"
|
||||
#ifndef ADAT_TX_USE_SHARED_BUFF
|
||||
#error Designed for ADAT tx shared buffer mode ONLY
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
#include "xua_pdm_mic.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (AUD_TO_USB_RATIO > 1)
|
||||
#include "src.h"
|
||||
@@ -45,12 +45,12 @@
|
||||
|
||||
#define MAX(x,y) ((x)>(y) ? (x) : (y))
|
||||
|
||||
static unsigned samplesOut[MAX(NUM_USB_CHAN_OUT, I2S_CHANS_DAC)];
|
||||
unsigned samplesOut[MAX(NUM_USB_CHAN_OUT, I2S_CHANS_DAC)];
|
||||
|
||||
/* Two buffers for ADC data to allow for DAC and ADC I2S ports being offset */
|
||||
#define IN_CHAN_COUNT (I2S_CHANS_ADC + XUA_NUM_PDM_MICS + (8*ADAT_RX) + (2*SPDIF_RX))
|
||||
#define IN_CHAN_COUNT (I2S_CHANS_ADC + XUA_NUM_PDM_MICS + (8*XUA_ADAT_RX_EN) + (2*XUA_SPDIF_RX_EN))
|
||||
|
||||
static unsigned samplesIn[2][MAX(NUM_USB_CHAN_IN, IN_CHAN_COUNT)];
|
||||
unsigned samplesIn[2][MAX(NUM_USB_CHAN_IN, IN_CHAN_COUNT)];
|
||||
|
||||
#ifdef XTA_TIMING_AUDIO
|
||||
#pragma xta command "add exclusion received_command"
|
||||
@@ -65,11 +65,11 @@ static unsigned samplesIn[2][MAX(NUM_USB_CHAN_IN, IN_CHAN_COUNT)];
|
||||
#pragma xta command "set required - 2000 ns"
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
extern buffered out port:32 p_adat_tx;
|
||||
#endif
|
||||
|
||||
#if defined(ADAT_TX)
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
extern clock clk_mst_spd;
|
||||
#endif
|
||||
|
||||
@@ -78,7 +78,7 @@ void InitPorts_slave
|
||||
#else
|
||||
void InitPorts_master
|
||||
#endif
|
||||
(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]);
|
||||
|
||||
|
||||
@@ -88,73 +88,10 @@ unsigned dsdMode = DSD_MODE_OFF;
|
||||
#include "audiohub_dsd.h"
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
#include "audiohub_adat.h"
|
||||
#endif
|
||||
|
||||
#pragma unsafe arrays
|
||||
static inline unsigned DoSampleTransfer(chanend ?c_out, const int readBuffNo, const unsigned underflowWord)
|
||||
{
|
||||
if(XUA_USB_EN)
|
||||
{
|
||||
outuint(c_out, underflowWord);
|
||||
|
||||
/* Check for sample freq change (or other command) or new samples from mixer*/
|
||||
if(testct(c_out))
|
||||
{
|
||||
unsigned command = inct(c_out);
|
||||
#ifndef CODEC_MASTER
|
||||
if(dsdMode == DSD_MODE_OFF)
|
||||
{
|
||||
#if (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0)
|
||||
/* Set clocks low */
|
||||
p_lrclk <: 0;
|
||||
p_bclk <: 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if(DSD_CHANS_DAC != 0)
|
||||
/* DSD Clock might not be shared with lrclk or bclk... */
|
||||
p_dsd_clk <: 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if (DSD_CHANS_DAC > 0)
|
||||
if(dsdMode == DSD_MODE_DOP)
|
||||
dsdMode = DSD_MODE_OFF;
|
||||
#endif
|
||||
#pragma xta endpoint "received_command"
|
||||
return command;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if NUM_USB_CHAN_OUT > 0
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
int tmp = inuint(c_out);
|
||||
samplesOut[i] = tmp;
|
||||
}
|
||||
#else
|
||||
inuint(c_out);
|
||||
#endif
|
||||
UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
|
||||
|
||||
#if NUM_USB_CHAN_IN > 0
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
|
||||
{
|
||||
outuint(c_out, samplesIn[readBuffNo][i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include "xua_audiohub_st.h"
|
||||
|
||||
static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:32 p_lrclk)
|
||||
{
|
||||
@@ -170,10 +107,10 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3
|
||||
p_lrclk :> lrval;
|
||||
#endif
|
||||
|
||||
if(I2S_MODE_TDM)
|
||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
{
|
||||
/* Only check for the rising edge of frame sync being in the right place because falling edge timing not specified */
|
||||
if (frameCount == 1)
|
||||
if (frameCount == 1)
|
||||
{
|
||||
lrval &= 0xc0000000; // Mask off last two (MSB) frame clock bits which are the most recently sampled
|
||||
syncError += (lrval != 0x80000000); // We need MSB = 1 and MSB-1 = 0 to signify rising edge
|
||||
@@ -187,37 +124,32 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3
|
||||
else
|
||||
{
|
||||
if(frameCount == 0)
|
||||
#ifdef N_BITS_I2S
|
||||
{
|
||||
#ifdef N_BITS_I2S
|
||||
if ((lrval & lrval_mask) != 0x80000000)
|
||||
{
|
||||
syncError = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
syncError += (lrval != 0x80000000);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
#ifdef N_BITS_I2S
|
||||
{
|
||||
if ((lrval | (~lrval_mask)) != 0x7FFFFFFF)
|
||||
{
|
||||
syncError = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
syncError += (lrval != 0x7FFFFFFF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return syncError;
|
||||
|
||||
#else
|
||||
if(I2S_MODE_TDM)
|
||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
{
|
||||
if(frameCount == (I2S_CHANS_PER_FRAME-1))
|
||||
p_lrclk <: 0x80000000;
|
||||
@@ -240,7 +172,7 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -248,18 +180,18 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3
|
||||
|
||||
#pragma unsafe arrays
|
||||
unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
, chanend c_adat_out
|
||||
, unsigned adatSmuxMode
|
||||
#endif
|
||||
, unsigned divide, unsigned curSamFreq
|
||||
#if( (SPDIF_RX==1) || (ADAT_RX == 1))
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
, chanend c_dig_rx
|
||||
#endif
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
, chanend c_pdm_pcm
|
||||
#endif
|
||||
, buffered _XUA_CLK_DIR port:32 ?p_lrclk,
|
||||
, buffered _XUA_CLK_DIR port:32 ?p_lrclk,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_bclk,
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]
|
||||
@@ -278,7 +210,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
#endif
|
||||
unsigned underflowWord = 0;
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
adatCounter = 0;
|
||||
#endif
|
||||
|
||||
@@ -336,7 +268,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
// Reinitialise user state before entering the main loop
|
||||
UserBufferManagementInit();
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
unsafe{
|
||||
//TransferAdatTxSamples(c_adat_out, samplesOut, adatSmuxMode, 0);
|
||||
volatile unsigned * unsafe samplePtr = &samplesOut[ADAT_TX_INDEX];
|
||||
@@ -362,14 +294,14 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
InitPorts_master(divide, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Note we always expect syncError to be 0 when we are master */
|
||||
while(!syncError)
|
||||
{
|
||||
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
||||
if(dsdMode == DSD_MODE_NATIVE)
|
||||
if(dsdMode == DSD_MODE_NATIVE)
|
||||
DoDsdNative(samplesOut, dsdSample_l, dsdSample_r, divide);
|
||||
else if(dsdMode == DSD_MODE_DOP)
|
||||
else if(dsdMode == DSD_MODE_DOP)
|
||||
DoDsdDop(everyOther, samplesOut, dsdSample_l, dsdSample_r, divide);
|
||||
else
|
||||
#endif
|
||||
@@ -461,24 +393,24 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
}
|
||||
#endif // (I2S_CHANS_DAC != 0)
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
TransferAdatTxSamples(c_adat_out, samplesOut, adatSmuxMode, 1);
|
||||
#endif
|
||||
|
||||
if(frameCount == 0)
|
||||
{
|
||||
|
||||
#if (SPDIF_RX == 1) || (ADAT_RX == 1)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* Sync with clockgen */
|
||||
inuint(c_dig_rx);
|
||||
|
||||
/* Note, digi-data we just store in samplesIn[readBuffNo] - we only double buffer the I2S input data */
|
||||
#endif
|
||||
#if (SPDIF_RX == 1)
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
asm("ldw %0, dp[g_digData]" :"=r"(samplesIn[readBuffNo][SPDIF_RX_INDEX + 0]));
|
||||
asm("ldw %0, dp[g_digData+4]":"=r"(samplesIn[readBuffNo][SPDIF_RX_INDEX + 1]));
|
||||
#endif
|
||||
#if (ADAT_RX == 1)
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
asm("ldw %0, dp[g_digData+8]" :"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX]));
|
||||
asm("ldw %0, dp[g_digData+12]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 1]));
|
||||
asm("ldw %0, dp[g_digData+16]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 2]));
|
||||
@@ -489,14 +421,13 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
asm("ldw %0, dp[g_digData+36]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 7]));
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX == 1) || (ADAT_RX == 1)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* Request digital data (with prefill) */
|
||||
outuint(c_dig_rx, 0);
|
||||
#endif
|
||||
#if (XUA_SPDIF_TX_EN) && (NUM_USB_CHAN_OUT > 0)
|
||||
outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward sample to S/PDIF Tx thread */
|
||||
unsigned sample = samplesOut[SPDIF_TX_INDEX + 1];
|
||||
outuint(c_spd_out, sample); /* Forward sample to S/PDIF Tx thread */
|
||||
outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward samples to S/PDIF Tx thread */
|
||||
outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX + 1]);
|
||||
#endif
|
||||
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
@@ -521,7 +452,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
#endif
|
||||
}
|
||||
|
||||
frameCount++;
|
||||
frameCount++;
|
||||
|
||||
#if (I2S_CHANS_ADC != 0)
|
||||
index = 0;
|
||||
@@ -614,7 +545,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
||||
}
|
||||
#endif
|
||||
|
||||
#if I2S_MODE_TDM
|
||||
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
/* Increase frameCount by 2 since we have output two channels (per data line) */
|
||||
frameCount+=1;
|
||||
if(frameCount == I2S_CHANS_PER_FRAME)
|
||||
@@ -724,12 +655,12 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
in port p_mclk_in,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_lrclk,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_bclk,
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]
|
||||
#if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
, chanend c_spdif_out
|
||||
#endif
|
||||
#if ((ADAT_RX == 1) || (SPDIF_RX == 1))
|
||||
#if (XUA_ADAT_RX_EN || XUA_SPDIF_RX_EN)
|
||||
, chanend c_dig_rx
|
||||
#endif
|
||||
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
|
||||
@@ -740,12 +671,11 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
chan c_adat_out;
|
||||
unsigned adatSmuxMode = 0;
|
||||
unsigned adatMultiple = 0;
|
||||
#endif
|
||||
|
||||
unsigned curSamFreq = DEFAULT_FREQ * AUD_TO_USB_RATIO;
|
||||
unsigned curSamRes_DAC = STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS; /* Default to something reasonable */
|
||||
unsigned curSamRes_ADC = STREAM_FORMAT_INPUT_1_RESOLUTION_BITS; /* Default to something reasonable - note, currently this never changes*/
|
||||
@@ -769,7 +699,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
/* Share SPDIF clk blk */
|
||||
configure_clock_src(clk_mst_spd, p_mclk_in);
|
||||
configure_out_port_no_ready(p_adat_tx, clk_mst_spd, 0);
|
||||
@@ -778,26 +708,26 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
start_clock(clk_mst_spd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Perform required CODEC/ADC/DAC initialisation */
|
||||
AudioHwInit();
|
||||
|
||||
while(1)
|
||||
{
|
||||
/* Calculate what master clock we should be using */
|
||||
if ((MCLK_441 % curSamFreq) == 0)
|
||||
if (((MCLK_441) % curSamFreq) == 0)
|
||||
{
|
||||
mClk = MCLK_441;
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
/* Calculate ADAT SMUX mode (1, 2, 4) */
|
||||
adatSmuxMode = curSamFreq / 44100;
|
||||
adatMultiple = mClk / 44100;
|
||||
#endif
|
||||
}
|
||||
else if ((MCLK_48 % curSamFreq) == 0)
|
||||
else if (((MCLK_48) % curSamFreq) == 0)
|
||||
{
|
||||
mClk = MCLK_48;
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
/* Calculate ADAT SMUX mode (1, 2, 4) */
|
||||
adatSmuxMode = curSamFreq / 48000;
|
||||
adatMultiple = mClk / 48000;
|
||||
@@ -807,7 +737,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
/* Calculate master clock to bit clock (or DSD clock) divide for current sample freq
|
||||
* e.g. 11.289600 / (176400 * 64) = 1 */
|
||||
{
|
||||
#if I2S_MODE_TDM
|
||||
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
/* I2S has 32 bits per sample. *8 as 8 channels */
|
||||
unsigned numBits = 256;
|
||||
|
||||
@@ -836,7 +766,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
numBits = 32;
|
||||
}
|
||||
#endif
|
||||
divide = mClk / ( curSamFreq * numBits);
|
||||
divide = mClk / (curSamFreq * numBits);
|
||||
|
||||
//Do some checks
|
||||
xassert((divide > 0) && "Error: divider is 0, BCLK rate unachievable");
|
||||
@@ -849,12 +779,11 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if (DSD_CHANS_DAC > 0)
|
||||
if(dsdMode)
|
||||
{
|
||||
/* Configure audio ports */
|
||||
ConfigAudioPortsWrapper(
|
||||
/* Configure audio ports */
|
||||
ConfigAudioPortsWrapper(
|
||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||
p_dsd_dac,
|
||||
DSD_CHANS_DAC,
|
||||
@@ -867,12 +796,11 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
null,
|
||||
p_dsd_clk,
|
||||
#endif
|
||||
divide, curSamFreq, dsdMode);
|
||||
p_mclk_in, clk_audio_bclk, divide, curSamFreq);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
||||
ConfigAudioPortsWrapper(
|
||||
#if (I2S_CHANS_DAC != 0)
|
||||
p_i2s_dac,
|
||||
@@ -891,9 +819,8 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
p_bclk,
|
||||
#endif
|
||||
#endif
|
||||
divide, curSamFreq, dsdMode);
|
||||
}
|
||||
|
||||
p_mclk_in, clk_audio_bclk, divide, curSamFreq);
|
||||
}
|
||||
|
||||
{
|
||||
unsigned curFreq = curSamFreq;
|
||||
@@ -939,7 +866,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
par
|
||||
{
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
{
|
||||
set_thread_fast_mode_on();
|
||||
adat_tx_port(c_adat_out, p_adat_tx);
|
||||
@@ -958,7 +885,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
c_pdm_in <: curSamFreq / AUD_TO_MICS_RATIO;
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
// Configure ADAT parameters ...
|
||||
//
|
||||
// adat_oversampling = 256 for MCLK = 12M288 or 11M2896
|
||||
@@ -978,12 +905,12 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
#else
|
||||
, null
|
||||
#endif
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
, c_adat_out
|
||||
, adatSmuxMode
|
||||
#endif
|
||||
, divide, curSamFreq
|
||||
#if (ADAT_RX == 1) || (SPDIF_RX == 1)
|
||||
#if (XUA_ADAT_RX_EN || XUA_SPDIF_RX_EN)
|
||||
, c_dig_rx
|
||||
#endif
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
@@ -1043,7 +970,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
||||
c_pdm_in <: 0;
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
#ifdef ADAT_TX_USE_SHARED_BUFF
|
||||
/* Take out-standing handshake from ADAT core */
|
||||
inuint(c_adat_out);
|
||||
|
||||
66
lib_xua/src/core/audiohub/xua_audiohub_st.h
Normal file
66
lib_xua/src/core/audiohub/xua_audiohub_st.h
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#pragma unsafe arrays
|
||||
static inline unsigned DoSampleTransfer(chanend ?c_out, const int readBuffNo, const unsigned underflowWord)
|
||||
{
|
||||
if(XUA_USB_EN)
|
||||
{
|
||||
outuint(c_out, underflowWord);
|
||||
|
||||
/* Check for sample freq change (or other command) or new samples from mixer*/
|
||||
if(testct(c_out))
|
||||
{
|
||||
unsigned command = inct(c_out);
|
||||
#ifndef CODEC_MASTER
|
||||
if(dsdMode == DSD_MODE_OFF)
|
||||
{
|
||||
#if (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0)
|
||||
/* Set clocks low */
|
||||
p_lrclk <: 0;
|
||||
p_bclk <: 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if(DSD_CHANS_DAC != 0)
|
||||
/* DSD Clock might not be shared with lrclk or bclk... */
|
||||
p_dsd_clk <: 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if (DSD_CHANS_DAC > 0)
|
||||
if(dsdMode == DSD_MODE_DOP)
|
||||
dsdMode = DSD_MODE_OFF;
|
||||
#endif
|
||||
return command;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if NUM_USB_CHAN_OUT > 0
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
int tmp = inuint(c_out);
|
||||
samplesOut[i] = tmp;
|
||||
}
|
||||
#else
|
||||
inuint(c_out);
|
||||
#endif
|
||||
UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
|
||||
|
||||
#if NUM_USB_CHAN_IN > 0
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
|
||||
{
|
||||
outuint(c_out, samplesIn[readBuffNo][i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include "xua.h"
|
||||
|
||||
#define XASSERT_UNIT DECOUPLE
|
||||
#include "xassert.h"
|
||||
|
||||
#if XUA_USB_EN
|
||||
#include <xs1.h>
|
||||
#include "xc_ptr.h"
|
||||
@@ -14,12 +17,11 @@
|
||||
#include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#if (HID_CONTROLS)
|
||||
#include "user_hid.h"
|
||||
#endif
|
||||
#define MAX(x,y) ((x)>(y) ? (x) : (y))
|
||||
|
||||
|
||||
/* TODO use SLOTSIZE to potentially save memory */
|
||||
/* Note we could improve on this, for one subslot is set to 4 */
|
||||
/* The *4 is conversion to bytes, note we're assuming a slotsize of 4 here whic is potentially as waste */
|
||||
@@ -41,7 +43,7 @@
|
||||
|
||||
/*** BUFFER SIZES ***/
|
||||
|
||||
#define BUFFER_PACKET_COUNT 3 /* How many packets too allow for in buffer - minimum is 3! */
|
||||
#define BUFFER_PACKET_COUNT (4) /* How many packets too allow for in buffer - minimum is 4 */
|
||||
|
||||
#define BUFF_SIZE_OUT_HS MAX_DEVICE_AUD_PACKET_SIZE_OUT_HS * BUFFER_PACKET_COUNT
|
||||
#define BUFF_SIZE_OUT_FS MAX_DEVICE_AUD_PACKET_SIZE_OUT_FS * BUFFER_PACKET_COUNT
|
||||
@@ -53,25 +55,41 @@
|
||||
#define BUFF_SIZE_IN MAX(BUFF_SIZE_IN_HS, BUFF_SIZE_IN_FS)
|
||||
|
||||
#define OUT_BUFFER_PREFILL (MAX(MAX_DEVICE_AUD_PACKET_SIZE_OUT_HS, MAX_DEVICE_AUD_PACKET_SIZE_OUT_FS))
|
||||
#define IN_BUFFER_PREFILL (MAX(MAX_DEVICE_AUD_PACKET_SIZE_IN_HS, MAX_DEVICE_AUD_PACKET_SIZE_IN_FS)*2)
|
||||
#define IN_BUFFER_PREFILL (MAX(MAX_DEVICE_AUD_PACKET_SIZE_IN_HS, MAX_DEVICE_AUD_PACKET_SIZE_IN_FS)*2)
|
||||
|
||||
/* Volume and mute tables */
|
||||
#if !defined(OUT_VOLUME_IN_MIXER) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
#if (OUT_VOLUME_IN_MIXER == 0) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
unsigned int multOut[NUM_USB_CHAN_OUT + 1];
|
||||
static xc_ptr p_multOut;
|
||||
unsafe
|
||||
{
|
||||
unsigned int volatile * unsafe multOutPtr = multOut;
|
||||
}
|
||||
#endif
|
||||
#if !defined(IN_VOLUME_IN_MIXER) && (INPUT_VOLUME_CONTROL == 1)
|
||||
#if (IN_VOLUME_IN_MIXER == 0) && (INPUT_VOLUME_CONTROL == 1)
|
||||
unsigned int multIn[NUM_USB_CHAN_IN + 1];
|
||||
static xc_ptr p_multIn;
|
||||
unsafe
|
||||
{
|
||||
unsigned int volatile * unsafe multInPtr = multIn;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Number of channels to/from the USB bus - initialised to HS Audio 2.0 */
|
||||
#if (AUDIO_CLASS == 1)
|
||||
unsigned g_numUsbChan_In = NUM_USB_CHAN_IN_FS;
|
||||
unsigned g_numUsbChan_Out = NUM_USB_CHAN_OUT_FS;
|
||||
/* Default to something sensible but the following are setup at stream start (unless UAC1 only..) */
|
||||
#if (AUDIO_CLASS == 2)
|
||||
int g_numUsbChan_In = NUM_USB_CHAN_IN; /* Number of channels to/from the USB bus - initialised to HS for UAC2.0 */
|
||||
int g_numUsbChan_Out = NUM_USB_CHAN_OUT;
|
||||
int g_curSubSlot_Out = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES;
|
||||
int g_curSubSlot_In = HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES;
|
||||
int sampsToWrite = DEFAULT_FREQ/8000; /* HS assumed here. Expect to be junked during a overflow before stream start */
|
||||
int totalSampsToWrite = DEFAULT_FREQ/8000;
|
||||
int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_HS; /* IN packet size. Init to something sensible, but expect to be re-set before stream start */
|
||||
#else
|
||||
unsigned g_numUsbChan_In = NUM_USB_CHAN_IN;
|
||||
unsigned g_numUsbChan_Out = NUM_USB_CHAN_OUT;
|
||||
int g_numUsbChan_In = NUM_USB_CHAN_IN_FS; /* Number of channels to/from the USB bus - initialised to FS for UAC1.0 */
|
||||
int g_numUsbChan_Out = NUM_USB_CHAN_OUT_FS;
|
||||
int g_curSubSlot_Out = FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES;
|
||||
int g_curSubSlot_In = FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES;
|
||||
int sampsToWrite = DEFAULT_FREQ/1000; /* FS assumed here. Expect to be junked during a overflow before stream start */
|
||||
int totalSampsToWrite = DEFAULT_FREQ/1000;
|
||||
int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; /* IN packet size. Init to something sensible, but expect to be re-set before stream start */
|
||||
#endif
|
||||
|
||||
/* Circular audio buffers */
|
||||
@@ -89,13 +107,12 @@ XUD_ep aud_to_host_usb_ep = 0;
|
||||
|
||||
/* Shared global audio buffering variables */
|
||||
unsigned g_aud_from_host_buffer;
|
||||
unsigned g_aud_to_host_buffer;
|
||||
unsigned g_aud_to_host_flag = 0;
|
||||
int buffer_aud_ctl_chan = 0;
|
||||
unsigned g_aud_from_host_flag = 0;
|
||||
unsigned g_aud_from_host_info;
|
||||
unsigned g_freqChange_flag = 0;
|
||||
unsigned g_freqChange_sampFreq;
|
||||
unsigned g_freqChange_sampFreq = DEFAULT_FREQ;
|
||||
|
||||
/* Global vars for sharing stream format change between buffer and decouple (save a channel) */
|
||||
unsigned g_formatChange_SubSlot;
|
||||
@@ -115,14 +132,8 @@ xc_ptr aud_to_host_fifo_end;
|
||||
xc_ptr g_aud_to_host_wrptr;
|
||||
xc_ptr g_aud_to_host_dptr;
|
||||
xc_ptr g_aud_to_host_rdptr;
|
||||
xc_ptr g_aud_to_host_zeros;
|
||||
#if (AUDIO_CLASS == 2)
|
||||
int sampsToWrite = DEFAULT_FREQ/8000; /* HS assumed here. Expect to be junked during a overflow before stream start */
|
||||
int totalSampsToWrite = DEFAULT_FREQ/8000;
|
||||
#else
|
||||
int sampsToWrite = DEFAULT_FREQ/1000; /* HS assumed here. Expect to be junked during a overflow before stream start */
|
||||
int totalSampsToWrite = DEFAULT_FREQ/1000;
|
||||
#endif
|
||||
int g_aud_to_host_fill_level;
|
||||
|
||||
int aud_data_remaining_to_device = 0;
|
||||
|
||||
/* Audio over/under flow flags */
|
||||
@@ -139,28 +150,77 @@ unsigned unpackData = 0;
|
||||
unsigned packState = 0;
|
||||
unsigned packData = 0;
|
||||
|
||||
static inline void SendSamples4(chanend c_mix_out)
|
||||
{
|
||||
/* Doing this checking allows us to unroll */
|
||||
if(g_numUsbChan_Out == NUM_USB_CHAN_OUT)
|
||||
{
|
||||
/* Buffering not underflow condition send out some samples...*/
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
int sample;
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
|
||||
/* Default to something sensible but the following are setup at stream start (unless UAC1 only..) */
|
||||
#if (AUDIO_CLASS == 2)
|
||||
unsigned g_curSubSlot_Out = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES;
|
||||
unsigned g_curSubSlot_In = HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES;
|
||||
#else
|
||||
unsigned g_curSubSlot_Out = FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES;
|
||||
unsigned g_curSubSlot_In = FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES;
|
||||
#endif
|
||||
read_via_xc_ptr(sample, g_aud_from_host_rdptr);
|
||||
g_aud_from_host_rdptr+=4;
|
||||
|
||||
/* IN packet size. Init to something sensible, but expect to be re-set before stream start */
|
||||
#if (AUDIO_CLASS==2)
|
||||
int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_HS;
|
||||
#else
|
||||
int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS;
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && (!OUT_VOLUME_IN_MIXER)
|
||||
unsafe
|
||||
{
|
||||
mult = multOutPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h <<= 3;
|
||||
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
|
||||
h |= (l >>29) & 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
// Note: We need all 32bits for Native DSD
|
||||
#endif
|
||||
outuint(c_mix_out, h);
|
||||
#else
|
||||
outuint(c_mix_out, sample);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma loop unroll
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT_FS; i++)
|
||||
{
|
||||
int sample;
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
|
||||
read_via_xc_ptr(sample, g_aud_from_host_rdptr);
|
||||
g_aud_from_host_rdptr+=4;
|
||||
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && (!OUT_VOLUME_IN_MIXER)
|
||||
unsafe
|
||||
{
|
||||
mult = multOutPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h <<= 3;
|
||||
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
|
||||
h |= (l >>29) & 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
// Note: We need all 32bits for Native DSD
|
||||
#endif
|
||||
outuint(c_mix_out, h);
|
||||
#else
|
||||
outuint(c_mix_out, sample);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma select handler
|
||||
#pragma unsafe arrays
|
||||
void handle_audio_request(chanend c_mix_out)
|
||||
{
|
||||
int space_left;
|
||||
#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES)
|
||||
g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3;
|
||||
g_curSubSlot_In = get_device_to_usb_bit_res() >> 3;
|
||||
@@ -218,8 +278,11 @@ __builtin_unreachable();
|
||||
g_aud_from_host_rdptr+=2;
|
||||
sample <<= 16;
|
||||
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && (!OUT_VOLUME_IN_MIXER)
|
||||
unsafe
|
||||
{
|
||||
mult = multOutPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
/* Note, in 2 byte subslot mode - ignore lower result of macs */
|
||||
h <<= 3;
|
||||
@@ -235,41 +298,17 @@ __builtin_unreachable();
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
/* Buffering not underflow condition send out some samples...*/
|
||||
for(int i = 0; i < g_numUsbChan_Out; i++)
|
||||
{
|
||||
#pragma xta endpoint "mixer_request"
|
||||
int sample;
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
|
||||
read_via_xc_ptr(sample, g_aud_from_host_rdptr);
|
||||
g_aud_from_host_rdptr+=4;
|
||||
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h <<= 3;
|
||||
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
|
||||
h |= (l >>29)& 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
// Note: We need all 32bits for Native DSD
|
||||
#endif
|
||||
outuint(c_mix_out, h);
|
||||
#else
|
||||
outuint(c_mix_out, sample);
|
||||
#endif
|
||||
}
|
||||
|
||||
SendSamples4(c_mix_out);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#if (STREAM_FORMAT_OUTPUT_SUBSLOT_3_USED == 0)
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
/* Buffering not underflow condition send out some samples...*/
|
||||
/* Note, in this case the unpacking of data is more of an overhead than the loop overhead
|
||||
* so we do not currently make attempts to unroll */
|
||||
for(int i = 0; i < g_numUsbChan_Out; i++)
|
||||
{
|
||||
#pragma xta endpoint "mixer_request"
|
||||
int sample;
|
||||
int mult;
|
||||
int h;
|
||||
@@ -301,19 +340,20 @@ __builtin_unreachable();
|
||||
}
|
||||
unpackState++;
|
||||
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && !defined(OUT_VOLUME_IN_MIXER)
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multOut),"r"(i));
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) && (!OUT_VOLUME_IN_MIXER)
|
||||
unsafe
|
||||
{
|
||||
mult = multOutPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h <<= 3;
|
||||
outuint(c_mix_out, h);
|
||||
#else
|
||||
outuint(c_mix_out, sample);
|
||||
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
break;
|
||||
@@ -332,6 +372,9 @@ __builtin_unreachable();
|
||||
#endif
|
||||
|
||||
{
|
||||
int dPtr;
|
||||
GET_SHARED_GLOBAL(dPtr, g_aud_to_host_dptr);
|
||||
|
||||
/* Store samples from mixer into sample buffer */
|
||||
switch(g_curSubSlot_In)
|
||||
{
|
||||
@@ -344,22 +387,25 @@ __builtin_unreachable();
|
||||
/* Receive sample */
|
||||
int sample = inuint(c_mix_out);
|
||||
#if (INPUT_VOLUME_CONTROL == 1)
|
||||
#if !defined(IN_VOLUME_IN_MIXER)
|
||||
#if (!IN_VOLUME_IN_MIXER)
|
||||
/* Apply volume */
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multIn),"r"(i));
|
||||
unsafe
|
||||
{
|
||||
mult = multInPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
sample = h << 3;
|
||||
|
||||
/* Note, in 2 byte sub slot - ignore lower bits of macs */
|
||||
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||
#elif (IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||
sample = sample << 3;
|
||||
#endif
|
||||
#endif
|
||||
write_short_via_xc_ptr(g_aud_to_host_dptr, sample>>16);
|
||||
g_aud_to_host_dptr+=2;
|
||||
write_short_via_xc_ptr(dPtr, sample>>16);
|
||||
dPtr+=2;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -368,36 +414,35 @@ __builtin_unreachable();
|
||||
#if (STREAM_FORMAT_INPUT_SUBSLOT_4_USED == 0)
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
unsigned ptr = g_aud_to_host_dptr;
|
||||
|
||||
for(int i = 0; i < g_numUsbChan_In; i++)
|
||||
{
|
||||
/* Receive sample */
|
||||
int sample = inuint(c_mix_out);
|
||||
#if(INPUT_VOLUME_CONTROL == 1)
|
||||
#if !defined(IN_VOLUME_IN_MIXER)
|
||||
#if (!IN_VOLUME_IN_MIXER)
|
||||
/* Apply volume */
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multIn),"r"(i));
|
||||
unsafe
|
||||
{
|
||||
mult = multInPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
sample = h << 3;
|
||||
#if (STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED == 1)
|
||||
sample |= (l >> 29) & 0x7; // Note, this step is not required if we assume sample depth is 24 (rather than 32)
|
||||
#endif
|
||||
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||
#elif (IN_VOLUME_IN_MIXER) && (IN_VOLUME_AFTER_MIX)
|
||||
sample = sample << 3;
|
||||
#endif
|
||||
#endif
|
||||
/* Write into fifo */
|
||||
write_via_xc_ptr(ptr, sample);
|
||||
ptr+=4;
|
||||
write_via_xc_ptr(dPtr, sample);
|
||||
dPtr+=4;
|
||||
}
|
||||
|
||||
/* Update global pointer */
|
||||
g_aud_to_host_dptr = ptr;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -409,12 +454,15 @@ __builtin_unreachable();
|
||||
{
|
||||
/* Receive sample */
|
||||
int sample = inuint(c_mix_out);
|
||||
#if (INPUT_VOLUME_CONTROL) && !defined(IN_VOLUME_IN_MIXER)
|
||||
#if (INPUT_VOLUME_CONTROL) && (!IN_VOLUME_IN_MIXER)
|
||||
/* Apply volume */
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multIn),"r"(i));
|
||||
unsafe
|
||||
{
|
||||
mult = multInPtr[i];
|
||||
}
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
sample = h << 3;
|
||||
#endif
|
||||
@@ -426,21 +474,21 @@ __builtin_unreachable();
|
||||
break;
|
||||
case 1:
|
||||
packData = (packData >> 8) | ((sample & 0xff00)<<16);
|
||||
write_via_xc_ptr(g_aud_to_host_dptr, packData);
|
||||
g_aud_to_host_dptr+=4;
|
||||
write_via_xc_ptr(g_aud_to_host_dptr, sample>>16);
|
||||
write_via_xc_ptr(dPtr, packData);
|
||||
dPtr+=4;
|
||||
write_via_xc_ptr(dPtr, sample>>16);
|
||||
packData = sample;
|
||||
break;
|
||||
case 2:
|
||||
packData = (packData>>16) | ((sample & 0xffff00) << 8);
|
||||
write_via_xc_ptr(g_aud_to_host_dptr, packData);
|
||||
g_aud_to_host_dptr+=4;
|
||||
write_via_xc_ptr(dPtr, packData);
|
||||
dPtr+=4;
|
||||
packData = sample;
|
||||
break;
|
||||
case 3:
|
||||
packData = (packData >> 24) | (sample & 0xffffff00);
|
||||
write_via_xc_ptr(g_aud_to_host_dptr, packData);
|
||||
g_aud_to_host_dptr+=4;
|
||||
write_via_xc_ptr(dPtr, packData);
|
||||
dPtr+=4;
|
||||
break;
|
||||
}
|
||||
packState++;
|
||||
@@ -452,6 +500,8 @@ __builtin_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr, dPtr);
|
||||
|
||||
/* Input any remaining channels - past this thread we always operate on max channel count */
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN - g_numUsbChan_In; i++)
|
||||
{
|
||||
@@ -466,27 +516,35 @@ __builtin_unreachable();
|
||||
/* Total samps to write could start at 0 (i.e. no MCLK) so need to check for < 0) */
|
||||
if (sampsToWrite <= 0)
|
||||
{
|
||||
int speed;
|
||||
int speed, wrPtr;
|
||||
packState = 0;
|
||||
|
||||
/* Write last packet length into FIFO */
|
||||
unsigned datasize = totalSampsToWrite * g_curSubSlot_In * g_numUsbChan_In;
|
||||
int datasize = totalSampsToWrite * g_curSubSlot_In * g_numUsbChan_In;
|
||||
|
||||
write_via_xc_ptr(g_aud_to_host_wrptr, datasize);
|
||||
GET_SHARED_GLOBAL(wrPtr, g_aud_to_host_wrptr);
|
||||
write_via_xc_ptr(wrPtr, datasize);
|
||||
|
||||
/* Round up to nearest word - note, not needed for slotsize == 4! */
|
||||
datasize = (datasize+3) & (~0x3);
|
||||
assert(datasize >= 0);
|
||||
assert(datasize <= g_maxPacketSize);
|
||||
|
||||
/* Move wr ptr on by old packet length */
|
||||
g_aud_to_host_wrptr += 4+datasize;
|
||||
wrPtr += 4+datasize;
|
||||
int fillLevel;
|
||||
GET_SHARED_GLOBAL(fillLevel, g_aud_to_host_fill_level);
|
||||
fillLevel += 4+datasize;
|
||||
assert(fillLevel <= BUFF_SIZE_IN);
|
||||
|
||||
/* Do wrap */
|
||||
if (g_aud_to_host_wrptr >= aud_to_host_fifo_end)
|
||||
if (wrPtr >= aud_to_host_fifo_end)
|
||||
{
|
||||
g_aud_to_host_wrptr = aud_to_host_fifo_start;
|
||||
wrPtr = aud_to_host_fifo_start;
|
||||
}
|
||||
|
||||
g_aud_to_host_dptr = g_aud_to_host_wrptr + 4;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_wrptr, wrPtr);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr, wrPtr + 4);
|
||||
|
||||
/* Now calculate new packet length...
|
||||
* First get feedback val (ideally this would be syncronised)
|
||||
@@ -506,47 +564,53 @@ __builtin_unreachable();
|
||||
totalSampsToWrite = 0;
|
||||
}
|
||||
|
||||
/* Calc slots left in fifo */
|
||||
space_left = g_aud_to_host_rdptr - g_aud_to_host_wrptr;
|
||||
|
||||
/* Mod and special case */
|
||||
if ((space_left <= 0) && (g_aud_to_host_rdptr == aud_to_host_fifo_start))
|
||||
{
|
||||
space_left = aud_to_host_fifo_end - g_aud_to_host_wrptr;
|
||||
}
|
||||
|
||||
if((space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4)))
|
||||
/* Must allow space for at least one sample per channel, as these are written at the beginning of
|
||||
* the interrupt handler even if totalSampsToWrite is zero (will be overwritten by a later packet). */
|
||||
int spaceRequired = MAX(totalSampsToWrite, 1) * g_numUsbChan_In * g_curSubSlot_In + 4;
|
||||
if (spaceRequired > BUFF_SIZE_IN - fillLevel)
|
||||
{
|
||||
/* In pipe has filled its buffer - we need to overflow
|
||||
* Accept the packet, and throw away the oldest in the buffer */
|
||||
|
||||
/* Keep throwing away packets until buffer is at a nice level.. */
|
||||
unsigned sampFreq;
|
||||
GET_SHARED_GLOBAL(sampFreq, g_freqChange_sampFreq);
|
||||
int min, mid, max;
|
||||
GetADCCounts(sampFreq, min, mid, max);
|
||||
const int max_pkt_size = ((max * g_curSubSlot_In * g_numUsbChan_In + 3) & ~0x3) + 4;
|
||||
int rdPtr;
|
||||
GET_SHARED_GLOBAL(rdPtr, g_aud_to_host_rdptr);
|
||||
|
||||
/* Keep throwing away packets until buffer contains two packets */
|
||||
do
|
||||
{
|
||||
unsigned rdPtr;
|
||||
int wrPtr;
|
||||
GET_SHARED_GLOBAL(wrPtr, g_aud_to_host_wrptr);
|
||||
|
||||
/* Read length of packet in buffer at read pointer */
|
||||
unsigned datalength;
|
||||
|
||||
GET_SHARED_GLOBAL(rdPtr, g_aud_to_host_rdptr);
|
||||
int datalength;
|
||||
asm volatile("ldw %0, %1[0]":"=r"(datalength):"r"(rdPtr));
|
||||
|
||||
/* Round up datalength */
|
||||
datalength = ((datalength+3) & ~0x3) + 4;
|
||||
assert(datalength >= 4);
|
||||
assert(fillLevel >= datalength);
|
||||
|
||||
/* Move read pointer on by length */
|
||||
fillLevel -= datalength;
|
||||
rdPtr += datalength;
|
||||
if (rdPtr >= aud_to_host_fifo_end)
|
||||
{
|
||||
rdPtr = aud_to_host_fifo_start;
|
||||
}
|
||||
|
||||
space_left += datalength;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, rdPtr);
|
||||
assert(rdPtr < aud_to_host_fifo_end && msg("rdPtr must be within buffer"));
|
||||
|
||||
} while(space_left < (BUFF_SIZE_IN/2));
|
||||
} while (fillLevel > 2 * max_pkt_size);
|
||||
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, rdPtr);
|
||||
}
|
||||
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_fill_level, fillLevel);
|
||||
sampsToWrite = totalSampsToWrite;
|
||||
}
|
||||
}
|
||||
@@ -585,10 +649,12 @@ __builtin_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
/* Mark Endpoint (IN) ready with an appropriately sized zero buffer */
|
||||
static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned sampFreq, unsigned slotSize)
|
||||
static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned sampFreq, unsigned slotSize,
|
||||
xc_ptr aud_to_host_zeros)
|
||||
{
|
||||
int min, mid, max, p;
|
||||
int min, mid, max;
|
||||
GetADCCounts(sampFreq, min, mid, max);
|
||||
|
||||
/* Set IN stream packet size to something sensible. We expect the buffer to
|
||||
@@ -598,7 +664,7 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
|
||||
|
||||
mid *= g_numUsbChan_In * slotSize;
|
||||
|
||||
asm volatile("stw %0, %1[0]"::"r"(mid),"r"(g_aud_to_host_zeros));
|
||||
asm volatile("stw %0, %1[0]"::"r"(mid),"r"(aud_to_host_zeros));
|
||||
|
||||
#if XUA_DEBUG_BUFFER
|
||||
printstr("SetupZerosSendBuffer\n");
|
||||
@@ -613,12 +679,9 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
|
||||
/* Mark EP ready with the zero buffer. Note this will simply update the packet size
|
||||
* if it is already ready */
|
||||
|
||||
/* g_aud_to_host_buffer is already set to g_aud_to_host_zeros */
|
||||
|
||||
GET_SHARED_GLOBAL(p, g_aud_to_host_buffer);
|
||||
|
||||
XUD_SetReady_InPtr(aud_to_host_usb_ep, p+4, mid);
|
||||
XUD_SetReady_InPtr(aud_to_host_usb_ep, aud_to_host_zeros+4, mid);
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma unsafe arrays
|
||||
void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
@@ -638,13 +701,6 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
|
||||
int t = array_to_xc_ptr(outAudioBuff);
|
||||
|
||||
#if !defined(OUT_VOLUME_IN_MIXER) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
p_multOut = array_to_xc_ptr(multOut);
|
||||
#endif
|
||||
#if !defined(IN_VOLUME_IN_MIXER) && (INPUT_VOLUME_CONTROL == 1)
|
||||
p_multIn = array_to_xc_ptr(multIn);
|
||||
#endif
|
||||
|
||||
aud_from_host_fifo_start = t;
|
||||
aud_from_host_fifo_end = aud_from_host_fifo_start + BUFF_SIZE_OUT;
|
||||
g_aud_from_host_wrptr = aud_from_host_fifo_start;
|
||||
@@ -652,31 +708,33 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
|
||||
t = array_to_xc_ptr(audioBuffIn);
|
||||
|
||||
int aud_to_host_buffer;
|
||||
aud_to_host_fifo_start = t;
|
||||
aud_to_host_fifo_end = aud_to_host_fifo_start + BUFF_SIZE_IN;
|
||||
g_aud_to_host_wrptr = aud_to_host_fifo_start;
|
||||
g_aud_to_host_rdptr = aud_to_host_fifo_start;
|
||||
g_aud_to_host_dptr = aud_to_host_fifo_start + 4;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_wrptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr, aud_to_host_fifo_start + 4);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_fill_level, 0);
|
||||
|
||||
/* Setup pointer to In stream 0 buffer. Note, length will be innited to 0
|
||||
* However, this should be over-written on first stream start (assuming host
|
||||
properly sends a SetInterface() before streaming. In any case we will send
|
||||
0 length packets, which is reasonable behaviour */
|
||||
t = array_to_xc_ptr(inZeroBuff);
|
||||
g_aud_to_host_zeros = t;
|
||||
xc_ptr aud_to_host_zeros = t;
|
||||
|
||||
/* Init vol mult tables */
|
||||
#if !defined(OUT_VOLUME_IN_MIXER) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
#if (OUT_VOLUME_IN_MIXER == 0) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
for (int i = 0; i < NUM_USB_CHAN_OUT + 1; i++)
|
||||
{
|
||||
asm volatile("stw %0, %1[%2]"::"r"(MAX_VOL),"r"(p_multOut),"r"(i));
|
||||
unsafe{
|
||||
multOutPtr[i] = MAX_VOLUME_MULT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(IN_VOLUME_IN_MIXER) && (INPUT_VOLUME_CONTROL == 1)
|
||||
#if (IN_VOLUME_IN_MIXER == 0) && (INPUT_VOLUME_CONTROL == 1)
|
||||
for (int i = 0; i < NUM_USB_CHAN_IN + 1; i++)
|
||||
{
|
||||
asm volatile("stw %0, %1[%2]"::"r"(MAX_VOL),"r"(p_multIn),"r"(i));
|
||||
unsafe{
|
||||
multInPtr[i] = MAX_VOLUME_MULT;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -715,8 +773,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
#if (AUDIO_CLASS == 1)
|
||||
/* For UAC1 we know we only run at FS */
|
||||
/* Set buffer back to zeros buffer */
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In);
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -748,28 +805,34 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
outct(c_mix_out, SET_SAMPLE_FREQ);
|
||||
outuint(c_mix_out, sampFreq);
|
||||
|
||||
inUnderflow = 1;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_wrptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr,aud_to_host_fifo_start+4);
|
||||
|
||||
/* Set buffer to send back to zeros buffer */
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
|
||||
|
||||
/* Update size of zeros buffer (and sampsToWrite) */
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In);
|
||||
|
||||
/* Reset OUT buffer state */
|
||||
outUnderflow = 1;
|
||||
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);
|
||||
|
||||
if(outOverflow)
|
||||
if(sampFreq != AUDIO_STOP_FOR_DFU)
|
||||
{
|
||||
/* If we were previously in overflow we wont have marked as ready */
|
||||
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
||||
outOverflow = 0;
|
||||
inUnderflow = 1;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_wrptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr,aud_to_host_fifo_start+4);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_fill_level, 0);
|
||||
|
||||
/* Set buffer to send back to zeros buffer */
|
||||
aud_to_host_buffer = aud_to_host_zeros;
|
||||
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
/* Update size of zeros buffer (and sampsToWrite) */
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
|
||||
#endif
|
||||
|
||||
/* Reset OUT buffer state */
|
||||
outUnderflow = 1;
|
||||
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);
|
||||
|
||||
if(outOverflow)
|
||||
{
|
||||
/* If we were previously in overflow we wont have marked as ready */
|
||||
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
||||
outOverflow = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for handshake back and pass back up */
|
||||
@@ -780,7 +843,8 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
|
||||
ENABLE_INTERRUPTS();
|
||||
|
||||
speedRem = 0;
|
||||
if(sampFreq != AUDIO_STOP_FOR_DFU)
|
||||
speedRem = 0;
|
||||
continue;
|
||||
}
|
||||
#if (AUDIO_CLASS == 2)
|
||||
@@ -804,12 +868,15 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_wrptr,aud_to_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_dptr,aud_to_host_fifo_start+4);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_fill_level, 0);
|
||||
|
||||
/* Set buffer back to zeros buffer */
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
|
||||
aud_to_host_buffer = aud_to_host_zeros;
|
||||
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
/* Update size of zeros buffer (and sampsToWrite) */
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In);
|
||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
|
||||
#endif
|
||||
|
||||
GET_SHARED_GLOBAL(usbSpeed, g_curUsbSpeed);
|
||||
if (usbSpeed == XUD_SPEED_HS)
|
||||
@@ -972,28 +1039,26 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
/* Reset flag */
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_flag, 0);
|
||||
|
||||
DISABLE_INTERRUPTS();
|
||||
|
||||
if (inUnderflow)
|
||||
{
|
||||
int aud_to_host_wrptr;
|
||||
int aud_to_host_rdptr;
|
||||
int fill_level;
|
||||
GET_SHARED_GLOBAL(aud_to_host_wrptr, g_aud_to_host_wrptr);
|
||||
GET_SHARED_GLOBAL(aud_to_host_rdptr, g_aud_to_host_rdptr);
|
||||
int fillLevel;
|
||||
GET_SHARED_GLOBAL(fillLevel, g_aud_to_host_fill_level);
|
||||
assert(fillLevel >= 0);
|
||||
assert(fillLevel <= BUFF_SIZE_IN);
|
||||
|
||||
/* Check if we have come out of underflow */
|
||||
fill_level = aud_to_host_wrptr - aud_to_host_rdptr;
|
||||
|
||||
if (fill_level < 0)
|
||||
fill_level += BUFF_SIZE_IN;
|
||||
|
||||
if (fill_level >= IN_BUFFER_PREFILL)
|
||||
if (fillLevel >= IN_BUFFER_PREFILL)
|
||||
{
|
||||
int aud_to_host_rdptr;
|
||||
GET_SHARED_GLOBAL(aud_to_host_rdptr, g_aud_to_host_rdptr);
|
||||
inUnderflow = 0;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, aud_to_host_rdptr);
|
||||
aud_to_host_buffer = aud_to_host_rdptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
|
||||
aud_to_host_buffer = aud_to_host_zeros;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1002,37 +1067,49 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
||||
int datalength;
|
||||
int aud_to_host_wrptr;
|
||||
int aud_to_host_rdptr;
|
||||
int fillLevel;
|
||||
GET_SHARED_GLOBAL(aud_to_host_wrptr, g_aud_to_host_wrptr);
|
||||
GET_SHARED_GLOBAL(aud_to_host_rdptr, g_aud_to_host_rdptr);
|
||||
GET_SHARED_GLOBAL(fillLevel, g_aud_to_host_fill_level);
|
||||
|
||||
/* Read datalength and round to nearest word */
|
||||
read_via_xc_ptr(datalength, aud_to_host_rdptr);
|
||||
aud_to_host_rdptr = aud_to_host_rdptr + ((datalength+3)&~0x3) + 4;
|
||||
datalength = ((datalength + 3) & ~0x3) + 4;
|
||||
assert(datalength >= 4);
|
||||
assert(fillLevel >= datalength);
|
||||
|
||||
aud_to_host_rdptr += datalength;
|
||||
fillLevel -= datalength;
|
||||
|
||||
if (aud_to_host_rdptr >= aud_to_host_fifo_end)
|
||||
{
|
||||
aud_to_host_rdptr = aud_to_host_fifo_start;
|
||||
}
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, aud_to_host_rdptr);
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_fill_level, fillLevel);
|
||||
|
||||
/* Check for read pointer hitting write pointer - underflow */
|
||||
if (aud_to_host_rdptr != aud_to_host_wrptr)
|
||||
if (fillLevel != 0)
|
||||
{
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, aud_to_host_rdptr);
|
||||
aud_to_host_buffer = aud_to_host_rdptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(aud_to_host_rdptr == aud_to_host_wrptr);
|
||||
inUnderflow = 1;
|
||||
SET_SHARED_GLOBAL(g_aud_to_host_buffer, g_aud_to_host_zeros);
|
||||
aud_to_host_buffer = aud_to_host_zeros;
|
||||
}
|
||||
}
|
||||
|
||||
/* Request to send packet */
|
||||
{
|
||||
int p, len;
|
||||
GET_SHARED_GLOBAL(p, g_aud_to_host_buffer);
|
||||
asm volatile("ldw %0, %1[0]":"=r"(len):"r"(p));
|
||||
XUD_SetReady_InPtr(aud_to_host_usb_ep, p+4, len);
|
||||
int len;
|
||||
asm volatile("ldw %0, %1[0]":"=r"(len):"r"(aud_to_host_buffer));
|
||||
XUD_SetReady_InPtr(aud_to_host_usb_ep, aud_to_host_buffer+4, len);
|
||||
}
|
||||
|
||||
ENABLE_INTERRUPTS();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,8 @@
|
||||
|
||||
//int ksp_enter, ksp_exit, r11_store;
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
#define ISSUE_MODE_SINGLE ".issue_mode single\n"
|
||||
#define ISSUE_MODE_DUAL ".issue_mode dual\n"
|
||||
#else
|
||||
#define ISSUE_MODE_SINGLE
|
||||
#define ISSUE_MODE_DUAL
|
||||
#endif
|
||||
|
||||
#define do_interrupt_handler(f,args) \
|
||||
asm(ISSUE_MODE_SINGLE\
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include "xua.h"
|
||||
#if XUA_USB_EN
|
||||
#include <xs1.h>
|
||||
#include <print.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef MIDI
|
||||
#include "usb_midi.h"
|
||||
#endif
|
||||
#ifdef IAP
|
||||
#include "iap.h"
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
#include "iap2_ea_nativetransport.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "xc_ptr.h"
|
||||
#include "xua_commands.h"
|
||||
#include "xud.h"
|
||||
#include "testct_byref.h"
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "xua_hid_report.h"
|
||||
#include "user_hid.h"
|
||||
unsigned char g_hidData[HID_DATA_BYTES] = {0};
|
||||
#include "xua_hid.h"
|
||||
unsigned char g_hidData[HID_MAX_DATA_BYTES] = {0U};
|
||||
#endif
|
||||
|
||||
void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
||||
@@ -44,7 +36,7 @@ unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FRE
|
||||
unsigned g_freqChange = 0;
|
||||
unsigned feedbackValid = 0;
|
||||
|
||||
#if defined (SPDIF_RX) || defined (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* When digital Rx enabled we enable an interrupt EP to inform host about changes in clock validity */
|
||||
/* Interrupt EP report data */
|
||||
unsigned char g_intData[8] =
|
||||
@@ -89,46 +81,36 @@ unsigned int fb_clocks[4];
|
||||
#define FB_TOLERANCE 0x100
|
||||
|
||||
void XUA_Buffer(
|
||||
register chanend c_aud_out,
|
||||
register chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
register chanend c_aud_in,
|
||||
register chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
chanend c_aud_fb,
|
||||
chanend c_aud_fb,
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
#ifdef IAP_INT_EP
|
||||
chanend c_iap_to_host_int,
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
chanend ?c_ep_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
chanend c_iap_ea_native_out,
|
||||
chanend c_iap_ea_native_in,
|
||||
chanend c_iap_ea_native_ctrl,
|
||||
chanend c_iap_ea_native_data,
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if (HID_CONTROLS )
|
||||
, chanend c_hid
|
||||
#endif
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
chanend ?c_ep_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
, chanend c_hid
|
||||
#endif
|
||||
, chanend c_aud
|
||||
)
|
||||
{
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
#warning Using channel to control buffering - this may reduce performance but improve power consumption
|
||||
chan c_buff_ctrl;
|
||||
#endif
|
||||
|
||||
@@ -146,21 +128,7 @@ void XUA_Buffer(
|
||||
c_midi_to_host, /* MIDI In */ // 4
|
||||
c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
c_iap_from_host, /* iAP Out */
|
||||
c_iap_to_host, /* iAP In */
|
||||
#ifdef IAP_INT_EP
|
||||
c_iap_to_host_int, /* iAP Interrupt In */
|
||||
#endif
|
||||
c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
c_iap_ea_native_out,
|
||||
c_iap_ea_native_in,
|
||||
c_EANativeTransport_ctrl,
|
||||
c_ea_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* Audio Interrupt - only used for interrupts on external clock change */
|
||||
c_ep_int,
|
||||
c_clk_int,
|
||||
@@ -171,6 +139,9 @@ void XUA_Buffer(
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, c_buff_ctrl
|
||||
#endif
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, i_pll_ref
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -194,46 +165,35 @@ unsafe{volatile unsigned * unsafe masterClockFreq_ptr;}
|
||||
* @param c_aud_fb chanend for feeback to xud
|
||||
* @return void
|
||||
*/
|
||||
void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
register chanend c_aud_in,
|
||||
register chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
chanend c_aud_fb,
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
#ifdef IAP_INT_EP
|
||||
chanend c_iap_to_host_int,
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
chanend ?c_ep_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
chanend c_iap_ea_native_out,
|
||||
chanend c_iap_ea_native_in,
|
||||
chanend c_iap_ea_native_ctrl,
|
||||
chanend c_iap_ea_native_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
chanend ?c_ep_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
, chanend c_hid
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if(HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, chanend c_buff_ctrl
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
)
|
||||
#if XUA_SYNCMODE == XUA_SYNCMODE_SYNC
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
)
|
||||
{
|
||||
XUD_ep ep_aud_out = XUD_InitEp(c_aud_out);
|
||||
|
||||
@@ -260,7 +220,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
XUD_ep ep_iap_ea_native_in = XUD_InitEp(c_iap_ea_native_in);
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
XUD_ep ep_int = XUD_InitEp(c_ep_int);
|
||||
#endif
|
||||
|
||||
@@ -270,8 +230,11 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
unsigned u_tmp;
|
||||
unsigned sampleFreq = DEFAULT_FREQ;
|
||||
unsigned masterClockFreq = DEFAULT_MCLK_FREQ;
|
||||
unsigned lastClock = 0;
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
unsigned lastClock = 0;
|
||||
unsigned freqChange = 0;
|
||||
#endif
|
||||
unsafe{masterClockFreq_ptr = &masterClockFreq;}
|
||||
|
||||
unsigned clocks = 0;
|
||||
@@ -285,7 +248,6 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
unsigned bufferIn = 1;
|
||||
#endif
|
||||
unsigned sofCount = 0;
|
||||
unsigned freqChange = 0;
|
||||
|
||||
unsigned mod_from_last_time = 0;
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
@@ -371,7 +333,14 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
||||
|
||||
while (!hidIsReportDescriptorPrepared())
|
||||
;
|
||||
|
||||
UserHIDInit();
|
||||
unsigned hid_ready_flag = 0U;
|
||||
unsigned hid_ready_id = 0U;
|
||||
|
||||
#endif
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
@@ -381,6 +350,21 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
#ifndef LOCAL_CLOCK_INCREMENT
|
||||
#define LOCAL_CLOCK_INCREMENT (100000) /* 500Hz */
|
||||
#endif
|
||||
#ifndef LOCAL_CLOCK_MARGIN
|
||||
#define LOCAL_CLOCK_MARGIN (1000)
|
||||
#endif
|
||||
timer t_sofCheck;
|
||||
unsigned timeLastEdge;
|
||||
unsigned timeNextEdge;
|
||||
t_sofCheck :> timeLastEdge;
|
||||
timeNextEdge + LOCAL_CLOCK_INCREMENT;
|
||||
i_pll_ref.toggle();
|
||||
#endif
|
||||
|
||||
while(1)
|
||||
{
|
||||
XUD_Result_t result;
|
||||
@@ -389,7 +373,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
/* Wait for response from XUD and service relevant EP */
|
||||
select
|
||||
{
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* Clocking thread wants to produce an interrupt... */
|
||||
case inuint_byref(c_clk_int, u_tmp):
|
||||
chkct(c_clk_int, XS1_CT_END);
|
||||
@@ -437,9 +421,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
if(receivedSampleFreq != AUDIO_STOP_FOR_DFU)
|
||||
{
|
||||
sampleFreq = receivedSampleFreq;
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
expected_fb = ((sampleFreq * 0x2000) / frameTime);
|
||||
#endif
|
||||
#endif
|
||||
/* Reset FB */
|
||||
/* Note, Endpoint 0 will hold off host for a sufficient period to allow our feedback
|
||||
* to stabilise (i.e. sofCount == 128 to fire) */
|
||||
@@ -524,6 +508,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
case t_sofCheck when timerafter(timeNextEdge) :> void:
|
||||
i_pll_ref.toggle();
|
||||
timeLastEdge = timeNextEdge;
|
||||
timeNextEdge += LOCAL_CLOCK_INCREMENT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#define MASK_16_13 (7) /* Bits that should not be transmitted as part of feedback */
|
||||
#define MASK_16_10 (127) /* For Audio 1.0 we use a mask 1 bit longer than expected to avoid Windows LSB issues */
|
||||
@@ -531,6 +522,30 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
|
||||
/* SOF notification from XUD_Manager() */
|
||||
case inuint_byref(c_sof, u_tmp):
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
/* This really could (should) be done in decouple. However, for a quick demo this is okay
|
||||
* Decouple expects a 16:16 number in fixed point stored in the global g_speed */
|
||||
unsigned usbSpeed;
|
||||
int framesPerSec;
|
||||
GET_SHARED_GLOBAL(usbSpeed, g_curUsbSpeed);
|
||||
static int sofCount = 0;
|
||||
|
||||
framesPerSec = (usbSpeed == XUD_SPEED_HS) ? 8000 : 1000;
|
||||
|
||||
clocks = ((int64_t) sampleFreq << 16) / framesPerSec;
|
||||
|
||||
asm volatile("stw %0, dp[g_speed]"::"r"(clocks));
|
||||
|
||||
sofCount += 1000;
|
||||
if (sofCount == framesPerSec)
|
||||
{
|
||||
/* Port is accessed via interface to allow flexibilty with location */
|
||||
i_pll_ref.toggle();
|
||||
t_sofCheck :> timeLastEdge;
|
||||
sofCount = 0;
|
||||
timeNextEdge = timeLastEdge + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
||||
}
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
|
||||
/* NOTE our feedback will be wrong for a couple of SOF's after a SF change due to
|
||||
* lastClock being incorrect */
|
||||
@@ -555,7 +570,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
unsigned usb_speed;
|
||||
GET_SHARED_GLOBAL(usb_speed, g_curUsbSpeed);
|
||||
|
||||
|
||||
#if FB_USE_REF_CLOCK
|
||||
unsigned long long feedbackMul = 64ULL;
|
||||
|
||||
@@ -631,7 +646,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
clockcounter = 0;
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
/* Assuming 48kHz from a 24.576 master clock (0.0407uS period)
|
||||
* MCLK ticks per SOF = 125uS / 0.0407 = 3072 MCLK ticks per SOF.
|
||||
* expected Feedback is 48000/8000 = 6 samples. so 0x60000 in 16:16 format.
|
||||
@@ -700,6 +715,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
sofCount++;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
@@ -708,12 +724,12 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
/* Inform stream that buffer sent */
|
||||
SET_SHARED_GLOBAL0(g_aud_to_host_flag, bufferIn+1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (NUM_USB_CHAN_OUT > 0)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
/* Feedback Pipe */
|
||||
case XUD_SetData_Select(c_aud_fb, ep_aud_fb, result):
|
||||
{
|
||||
@@ -729,8 +745,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
XUD_SetReady_In(ep_aud_fb, (fb_clocks, unsigned char[]), 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
/* Received Audio packet HOST -> DEVICE. Datalength written to length */
|
||||
case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result):
|
||||
@@ -741,164 +757,166 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
|
||||
/* Sync with decouple thread */
|
||||
SET_SHARED_GLOBAL0(g_aud_from_host_flag, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result):
|
||||
case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result):
|
||||
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
/* Get buffer data from host - MIDI OUT from host always into a single buffer */
|
||||
midi_data_remaining_to_device = length;
|
||||
|
||||
midi_from_host_rdptr = midi_from_host_buffer;
|
||||
|
||||
if (midi_data_remaining_to_device)
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
/* Get buffer data from host - MIDI OUT from host always into a single buffer */
|
||||
midi_data_remaining_to_device = length;
|
||||
|
||||
midi_from_host_rdptr = midi_from_host_buffer;
|
||||
|
||||
if (midi_data_remaining_to_device)
|
||||
{
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
/* MIDI IN to host */
|
||||
case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result):
|
||||
/* MIDI IN to host */
|
||||
case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result):
|
||||
|
||||
/* The buffer has been sent to the host, so we can ack the midi thread */
|
||||
if (midi_data_collected_from_device != 0)
|
||||
{
|
||||
/* Swap the collecting and sending buffer */
|
||||
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||
/* The buffer has been sent to the host, so we can ack the midi thread */
|
||||
if (midi_data_collected_from_device != 0)
|
||||
{
|
||||
/* Swap the collecting and sending buffer */
|
||||
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||
|
||||
/* Request to send packet */
|
||||
XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device);
|
||||
/* Request to send packet */
|
||||
XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device);
|
||||
|
||||
/* Mark as waiting for host to poll us */
|
||||
midi_waiting_on_send_to_host = 1;
|
||||
/* Reset the collected data count */
|
||||
midi_data_collected_from_device = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
midi_waiting_on_send_to_host = 0;
|
||||
}
|
||||
break;
|
||||
/* Mark as waiting for host to poll us */
|
||||
midi_waiting_on_send_to_host = 1;
|
||||
/* Reset the collected data count */
|
||||
midi_data_collected_from_device = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
midi_waiting_on_send_to_host = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef IAP
|
||||
/* IAP OUT from host. Datalength writen to tmp */
|
||||
case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result):
|
||||
/* IAP OUT from host. Datalength writen to tmp */
|
||||
case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result):
|
||||
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
iap_data_remaining_to_device = length;
|
||||
|
||||
if(iap_data_remaining_to_device)
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
// Send length first so iAP thread knows how much data to expect
|
||||
// Don't expect ack from this to make it simpler
|
||||
outuint(c_iap, iap_data_remaining_to_device);
|
||||
iap_data_remaining_to_device = length;
|
||||
|
||||
/* Send out first byte in buffer */
|
||||
datum_iap = iap_from_host_buffer[0];
|
||||
outuint(c_iap, datum_iap);
|
||||
if(iap_data_remaining_to_device)
|
||||
{
|
||||
// Send length first so iAP thread knows how much data to expect
|
||||
// Don't expect ack from this to make it simpler
|
||||
outuint(c_iap, iap_data_remaining_to_device);
|
||||
|
||||
/* Set read ptr to next byte in buffer */
|
||||
iap_from_host_rdptr = 1;
|
||||
iap_data_remaining_to_device -= 1;
|
||||
/* Send out first byte in buffer */
|
||||
datum_iap = iap_from_host_buffer[0];
|
||||
outuint(c_iap, datum_iap);
|
||||
|
||||
/* Set read ptr to next byte in buffer */
|
||||
iap_from_host_rdptr = 1;
|
||||
iap_data_remaining_to_device -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
/* IAP IN to host */
|
||||
case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result):
|
||||
/* IAP IN to host */
|
||||
case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result):
|
||||
|
||||
if(result == XUD_RES_RST)
|
||||
{
|
||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||
if(result == XUD_RES_RST)
|
||||
{
|
||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||
#ifdef IAP_INT_EP
|
||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||
#endif
|
||||
iap_send_reset(c_iap);
|
||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||
iap_data_collected_from_device = 0;
|
||||
iap_data_remaining_to_device = -1;
|
||||
iap_expected_data_length = 0;
|
||||
iap_from_host_rdptr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/
|
||||
iap_send_ack(c_iap);
|
||||
}
|
||||
break; /* IAP IN to host */
|
||||
iap_send_reset(c_iap);
|
||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||
iap_data_collected_from_device = 0;
|
||||
iap_data_remaining_to_device = -1;
|
||||
iap_expected_data_length = 0;
|
||||
iap_from_host_rdptr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/
|
||||
iap_send_ack(c_iap);
|
||||
}
|
||||
break; /* IAP IN to host */
|
||||
|
||||
#ifdef IAP_INT_EP
|
||||
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result):
|
||||
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result):
|
||||
|
||||
/* Do nothing.. */
|
||||
/* Note, could get a reset notification here, but deal with it in the case above */
|
||||
break;
|
||||
/* Do nothing.. */
|
||||
/* Note, could get a reset notification here, but deal with it in the case above */
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
/* iAP EA Native Transport OUT from host */
|
||||
case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result):
|
||||
if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0)
|
||||
{
|
||||
// Notify EA Protocol user code we have iOS app data from XUD
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA);
|
||||
}
|
||||
break;
|
||||
/* iAP EA Native Transport OUT from host */
|
||||
case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result):
|
||||
if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0)
|
||||
{
|
||||
// Notify EA Protocol user code we have iOS app data from XUD
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA);
|
||||
}
|
||||
break;
|
||||
|
||||
/* iAP EA Native Transport IN to host */
|
||||
case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result):
|
||||
switch (result)
|
||||
{
|
||||
case XUD_RES_RST:
|
||||
XUD_ResetEndpoint(ep_iap_ea_native_in, null);
|
||||
// Notify user code of USB reset to allow any state to be cleared
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_RESET;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
/* iAP EA Native Transport IN to host */
|
||||
case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result):
|
||||
switch (result)
|
||||
{
|
||||
case XUD_RES_RST:
|
||||
XUD_ResetEndpoint(ep_iap_ea_native_in, null);
|
||||
// Notify user code of USB reset to allow any state to be cleared
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_RESET;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
|
||||
case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD
|
||||
// Notify user code
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_DATA_SENT;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//::
|
||||
case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD
|
||||
// Notify user code
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_DATA_SENT;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//::
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
/* HID Report Data */
|
||||
/* HID Report Data */
|
||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||
{
|
||||
g_hidData[0]=0;
|
||||
UserHIDGetData(g_hidData);
|
||||
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
||||
}
|
||||
break;
|
||||
hid_ready_flag = 0U;
|
||||
unsigned reportTime;
|
||||
timer tmr;
|
||||
tmr :> reportTime;
|
||||
hidCaptureReportTime(hid_ready_id, reportTime);
|
||||
hidCalcNextReportTime(hid_ready_id);
|
||||
hidClearChangePending(hid_ready_id);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
/* Received word from MIDI thread - Check for ACK or Data */
|
||||
/* Received word from MIDI thread - Check for ACK or Data */
|
||||
case midi_get_ack_or_data(c_midi, is_ack, datum):
|
||||
if (is_ack)
|
||||
{
|
||||
/* An ack from the midi/uart thread means it has accepted some data we sent it
|
||||
* we are okay to send another word */
|
||||
* we are okay to send another word */
|
||||
if (midi_data_remaining_to_device <= 0)
|
||||
{
|
||||
/* We have read an entire packet - Mark ready to receive another */
|
||||
@@ -963,7 +981,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
if (is_ack_iap)
|
||||
{
|
||||
/* An ack from the iap/uart thread means it has accepted some data we sent it
|
||||
* we are okay to send another word */
|
||||
* we are okay to send another word */
|
||||
if (iap_data_remaining_to_device == 0)
|
||||
{
|
||||
/* We have read an entire packet - Mark ready to receive another */
|
||||
@@ -996,7 +1014,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
}
|
||||
else
|
||||
{
|
||||
// Too many events from device - drop
|
||||
// Too many events from device - drop
|
||||
}
|
||||
|
||||
/* Once we have the whole message, sent it to host */
|
||||
@@ -1034,7 +1052,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
}
|
||||
break;
|
||||
|
||||
# if IAP_EA_NATIVE_TRANS
|
||||
# if IAP_EA_NATIVE_TRANS
|
||||
/* Change of EA Native Transport interface setting */
|
||||
case inuint_byref(c_iap_ea_native_ctrl, iap_ea_native_interface_alt_setting):
|
||||
/* Handshake */
|
||||
@@ -1092,14 +1110,33 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//::
|
||||
#endif
|
||||
#endif // if IAP_EA_NATIVE_TRANS
|
||||
|
||||
#endif // ifdef IAP
|
||||
|
||||
default:
|
||||
#if ( 0 < HID_CONTROLS )
|
||||
if (!hid_ready_flag)
|
||||
{
|
||||
for (unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); id++)
|
||||
{
|
||||
if ( hidIsChangePending(id) || !HidIsSetIdleSilenced(id) )
|
||||
{
|
||||
int hidDataLength = (int) UserHIDGetData(id, g_hidData);
|
||||
XUD_SetReady_In(ep_hid, g_hidData, hidDataLength);
|
||||
|
||||
hid_ready_id = id;
|
||||
hid_ready_flag = 1U;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
//::
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include <xs1.h>
|
||||
@@ -7,19 +7,20 @@
|
||||
|
||||
#include "xua.h"
|
||||
#include "xua_commands.h"
|
||||
#include "xua_clocking.h"
|
||||
|
||||
#if (SPDIF_RX)
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
|
||||
#define LOCAL_CLOCK_INCREMENT 166667
|
||||
#define LOCAL_CLOCK_MARGIN 1666
|
||||
#define LOCAL_CLOCK_INCREMENT (166667)
|
||||
#define LOCAL_CLOCK_MARGIN (1666)
|
||||
|
||||
#define MAX_SAMPLES 64 /* Must be power of 2 */
|
||||
#define MAX_SAMPLES (64) /* Must be power of 2 */
|
||||
#define MAX_SPDIF_SAMPLES (2 * MAX_SAMPLES) /* Must be power of 2 */
|
||||
#define MAX_ADAT_SAMPLES (8 * MAX_SAMPLES) /* Must be power of 2 */
|
||||
|
||||
#define SPDIF_FRAME_ERRORS_THRESH 40
|
||||
#define SPDIF_FRAME_ERRORS_THRESH (40)
|
||||
|
||||
unsigned g_digData[10];
|
||||
|
||||
@@ -38,8 +39,49 @@ static int clockValid[NUM_CLOCKS]; /* Store current val
|
||||
static int clockInt[NUM_CLOCKS]; /* Interupt flag for clocks */
|
||||
static int clockId[NUM_CLOCKS];
|
||||
|
||||
[[distributable]]
|
||||
void PllRefPinTask(server interface pll_ref_if i_pll_ref, out port p_pll_ref)
|
||||
{
|
||||
static unsigned pinVal= 0;
|
||||
static unsigned short pinTime = 0;
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
while(1)
|
||||
{
|
||||
select
|
||||
{
|
||||
case i_pll_ref.toggle():
|
||||
pinVal = ~pinVal;
|
||||
p_pll_ref <: pinVal;
|
||||
break;
|
||||
|
||||
case i_pll_ref.init():
|
||||
p_pll_ref <: pinVal @ pinTime;
|
||||
pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2));
|
||||
p_pll_ref @ pinTime <: pinVal;
|
||||
break;
|
||||
|
||||
case i_pll_ref.toggle_timed(int relative):
|
||||
|
||||
if (!relative)
|
||||
{
|
||||
pinTime += (short) LOCAL_CLOCK_INCREMENT;
|
||||
pinVal = !pinVal;
|
||||
p_pll_ref @ pinTime <: pinVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_pll_ref <: pinVal @ pinTime;
|
||||
pinTime += (short) LOCAL_CLOCK_INCREMENT;
|
||||
pinVal = !pinVal;
|
||||
p_pll_ref @ pinTime <: pinVal;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
static int abs(int x)
|
||||
{
|
||||
if (x < 0) return -x;
|
||||
@@ -74,7 +116,7 @@ static void outInterrupt(chanend c_interruptControl, int value)
|
||||
void VendorClockValidity(int valid);
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
static inline void setClockValidity(chanend c_interruptControl, int clkIndex, int valid, int currentClkMode)
|
||||
{
|
||||
if (clockValid[clkIndex] != valid)
|
||||
@@ -83,13 +125,13 @@ static inline void setClockValidity(chanend c_interruptControl, int clkIndex, in
|
||||
outInterrupt(c_interruptControl, clockId[clkIndex]);
|
||||
|
||||
#ifdef CLOCK_VALIDITY_CALL
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
if (currentClkMode == CLOCK_ADAT && clkIndex == CLOCK_ADAT_INDEX)
|
||||
{
|
||||
VendorClockValidity(valid);
|
||||
}
|
||||
#endif
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
if (currentClkMode == CLOCK_SPDIF && clkIndex == CLOCK_SPDIF_INDEX)
|
||||
{
|
||||
VendorClockValidity(valid);
|
||||
@@ -177,7 +219,7 @@ static inline int validSamples(Counter &counter, int clockIndex)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
//:badParity
|
||||
/* Returns 1 for bad parity, else 0 */
|
||||
static inline int badParity(unsigned x)
|
||||
@@ -199,12 +241,10 @@ extern int samples_to_host_inputs_buff[NUM_USB_CHAN_IN];
|
||||
int VendorAudCoreReqs(unsigned cmd, chanend c);
|
||||
|
||||
#pragma unsafe arrays
|
||||
void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int)
|
||||
void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface pll_ref_if i_pll_ref, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int)
|
||||
{
|
||||
timer t_local;
|
||||
unsigned timeNextEdge, timeLastEdge, timeNextClockDetection;
|
||||
unsigned pinVal = 0;
|
||||
unsigned short pinTime;
|
||||
unsigned clkMode = CLOCK_INTERNAL; /* Current clocking mode in operation */
|
||||
unsigned tmp;
|
||||
|
||||
@@ -216,11 +256,11 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
unsigned levelTime;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
timer t_external;
|
||||
#endif
|
||||
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
/* S/PDIF buffer state */
|
||||
int spdifSamples[MAX_SPDIF_SAMPLES]; /* S/PDIF sample buffer */
|
||||
int spdifWr = 0; /* Write index */
|
||||
@@ -234,7 +274,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
unsigned spdifLeft = 0;
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
/* ADAT buffer state */
|
||||
int adatSamples[MAX_ADAT_SAMPLES];
|
||||
int adatWr = 0;
|
||||
@@ -256,7 +296,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
}
|
||||
|
||||
/* Init clock unit state */
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
clockFreq[CLOCK_SPDIF_INDEX] = 0;
|
||||
clockValid[CLOCK_SPDIF_INDEX] = 0;
|
||||
clockInt[CLOCK_SPDIF_INDEX] = 0;
|
||||
@@ -266,13 +306,13 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
clockId[CLOCK_INTERNAL_INDEX] = ID_CLKSRC_INT;
|
||||
clockValid[CLOCK_INTERNAL_INDEX] = 0;
|
||||
clockInt[CLOCK_INTERNAL_INDEX] = 0;
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
clockFreq[CLOCK_ADAT_INDEX] = 0;
|
||||
clockInt[CLOCK_ADAT_INDEX] = 0;
|
||||
clockValid[CLOCK_ADAT_INDEX] = 0;
|
||||
clockId[CLOCK_ADAT_INDEX] = ID_CLKSRC_ADAT;
|
||||
#endif
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
spdifCounters.receivedSamples = 0;
|
||||
spdifCounters.samples = 0;
|
||||
spdifCounters.savedSamples = 0;
|
||||
@@ -281,7 +321,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
spdifCounters.samplesPerTick = 0;
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
adatCounters.receivedSamples = 0;
|
||||
adatCounters.samples = 0;
|
||||
adatCounters.savedSamples = 0;
|
||||
@@ -301,15 +341,13 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
levelTime+= LEVEL_UPDATE_RATE;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
/* Fill channel */
|
||||
outuint(c_dig_rx, 1);
|
||||
#endif
|
||||
|
||||
/* Initial ref clock output and get timestamp */
|
||||
p <: pinVal @ pinTime;
|
||||
pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2));
|
||||
p @ pinTime <: pinVal;
|
||||
i_pll_ref.init();
|
||||
|
||||
while(1)
|
||||
{
|
||||
@@ -380,12 +418,12 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
case CLOCK_INTERNAL:
|
||||
VendorClockValidity(1);
|
||||
break;
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
case CLOCK_ADAT:
|
||||
VendorClockValidity(clockValid[CLOCK_ADAT_INDEX]);
|
||||
break;
|
||||
#endif
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
case CLOCK_SPDIF:
|
||||
VendorClockValidity(clockValid[CLOCK_SPDIF_INDEX]);
|
||||
break;
|
||||
@@ -411,7 +449,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
|
||||
case SET_SMUX:
|
||||
smux = inuint(c_clk_ctl);
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
adatRd = 0; /* Reset adat FIFO */
|
||||
adatWr = 0;
|
||||
adatSamps = 0;
|
||||
@@ -432,11 +470,8 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
/* Generate local clock from timer */
|
||||
case t_local when timerafter(timeNextEdge) :> void:
|
||||
|
||||
|
||||
/* Setup next local clock edge */
|
||||
pinTime += (short) LOCAL_CLOCK_INCREMENT;
|
||||
pinVal = !pinVal;
|
||||
p @ pinTime <: pinVal;
|
||||
i_pll_ref.toggle_timed(0);
|
||||
|
||||
/* Record time of edge */
|
||||
timeLastEdge = timeNextEdge;
|
||||
@@ -445,20 +480,14 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
timeNextClockDetection = timeNextEdge + (LOCAL_CLOCK_INCREMENT/2);
|
||||
timeNextEdge += LOCAL_CLOCK_INCREMENT;
|
||||
|
||||
/* If we are in an external clock mode and this fire, then clock invalid */
|
||||
|
||||
#if SPDIF_RX
|
||||
// if(clkMode == CLOCK_SPDIF)
|
||||
{
|
||||
/* We must have lost valid S/PDIF stream, reset counters, so we dont produce a double edge */
|
||||
spdifCounters.receivedSamples = 0;
|
||||
}
|
||||
/* If we are in an external clock mode and this fire, then clock invalid
|
||||
* reset counters in case we are moved to digital clock - we want a well timed
|
||||
* first edge */
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
spdifCounters.receivedSamples = 0;
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
//if(clkMode == CLOCK_ADAT)
|
||||
{
|
||||
adatCounters.receivedSamples = 0;
|
||||
}
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
adatCounters.receivedSamples = 0;
|
||||
#endif
|
||||
|
||||
#ifdef CLOCK_VALIDITY_CALL
|
||||
@@ -471,18 +500,18 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
break;
|
||||
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
case t_external when timerafter(timeNextClockDetection) :> void:
|
||||
|
||||
timeNextClockDetection += (LOCAL_CLOCK_INCREMENT);
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
tmp = spdifCounters.samplesPerTick;
|
||||
|
||||
/* Returns 1 if valid clock found */
|
||||
tmp = validSamples(spdifCounters, CLOCK_SPDIF_INDEX);
|
||||
setClockValidity(c_clk_int, CLOCK_SPDIF_INDEX, tmp, clkMode);
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
tmp = validSamples(adatCounters, CLOCK_ADAT_INDEX);
|
||||
setClockValidity(c_clk_int, CLOCK_ADAT_INDEX, tmp, clkMode);
|
||||
#endif
|
||||
@@ -491,7 +520,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
|
||||
#endif
|
||||
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
/* Receive sample from S/PDIF RX thread (steaming chan) */
|
||||
case c_spdif_rx :> tmp:
|
||||
|
||||
@@ -566,10 +595,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
timeNextEdge = spdifReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
||||
|
||||
/* Toggle edge */
|
||||
p <: pinVal @ pinTime;
|
||||
pinTime += (short) LOCAL_CLOCK_INCREMENT;
|
||||
pinVal = !pinVal;
|
||||
p @ pinTime <: pinVal;
|
||||
i_pll_ref.toggle_timed(1);
|
||||
|
||||
/* Reset counters */
|
||||
spdifCounters.receivedSamples = 0;
|
||||
@@ -578,7 +604,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
/* receive sample from ADAT rx thread (streaming channel with CT_END) */
|
||||
case inuint_byref(c_adat_rx, tmp):
|
||||
/* record time of sample */
|
||||
@@ -665,7 +691,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
/* Inspect for if we need to produce an edge */
|
||||
if ((adatCounters.receivedSamples >= adatCounters.samplesPerTick))
|
||||
{
|
||||
/* Check edge is about right... S/PDIF may have changed freq... */
|
||||
/* Check edge is about right... ADAT may have changed freq... */
|
||||
if (timeafter(adatReceivedTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
||||
{
|
||||
/* Record edge time */
|
||||
@@ -675,10 +701,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
timeNextEdge = adatReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
||||
|
||||
/* Toggle edge */
|
||||
p <: pinVal @ pinTime;
|
||||
pinTime += LOCAL_CLOCK_INCREMENT;
|
||||
pinVal = !pinVal;
|
||||
p @ pinTime <: pinVal;
|
||||
i_pll_ref.toggle_timed(1);
|
||||
|
||||
/* Reset counters */
|
||||
adatCounters.receivedSamples = 0;
|
||||
@@ -694,10 +717,10 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
#endif
|
||||
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
/* Mixer requests data */
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* AudioHub requests data */
|
||||
case inuint_byref(c_dig_rx, tmp):
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
if(spdifUnderflow)
|
||||
{
|
||||
/* S/PDIF underflowing, send out zero samples */
|
||||
@@ -735,7 +758,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
}
|
||||
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
if (adatUnderflow)
|
||||
{
|
||||
/* ADAT underflowing, send out zero samples */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# Copyright 2015-2022 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ def genstrings(outputChanCount, chanString, portString, structureString, adc_dac
|
||||
|
||||
for i in range(1,outputChanCount):
|
||||
|
||||
print "#if (NUM_USB_CHAN_{c} > {i}-1)\n\
|
||||
print("#if (NUM_USB_CHAN_{c} > {i}-1)\n\
|
||||
.{s}ChanStr_{i} = \"\"\n\
|
||||
#if ({i} < I2S_CHANS_{adcdac}+1)\n\
|
||||
\"Analogue {i}\"\n\
|
||||
@@ -21,38 +21,38 @@ def genstrings(outputChanCount, chanString, portString, structureString, adc_dac
|
||||
\"SPDIF 2\"\n\
|
||||
#endif\n\
|
||||
#endif\n\
|
||||
#if (({i} < ADAT_{p}_INDEX+8+1) && ({i} > ADAT_{p}_INDEX)) && defined(ADAT_{p})\n\
|
||||
#if (({i} < ADAT_{p}_INDEX+8+1) && ({i} > ADAT_{p}_INDEX)) && (XUA_ADAT_{p}_EN)\n\
|
||||
#if (({i} < SPDIF_{p}_INDEX+2+1) && ({i} > SPDIF_{p}_INDEX)) && (XUA_SPDIF_{p}_EN) || ({i} < I2S_CHANS_{adcdac}+1)\n\
|
||||
\"/\"\n\
|
||||
#endif\n\
|
||||
#if({i} - ADAT_TX_INDEX == 1)\n\
|
||||
#if({i} - ADAT_{p}_INDEX == 1)\n\
|
||||
\"ADAT 1\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 2)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 2)\n\
|
||||
\"ADAT 2\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 3)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 3)\n\
|
||||
\"ADAT 3\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 4)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 4)\n\
|
||||
\"ADAT 4\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 5)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 5)\n\
|
||||
\"ADAT 5\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 6)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 6)\n\
|
||||
\"ADAT 6\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 7)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 7)\n\
|
||||
\"ADAT 7\"\n\
|
||||
#elif({i} - ADAT_TX_INDEX == 8)\n\
|
||||
#elif({i} - ADAT_{p}_INDEX == 8)\n\
|
||||
\"ADAT 8\"\n\
|
||||
#endif\n\
|
||||
#endif\n\
|
||||
,\n#endif\n".format(i=i, c=chanString, p=portString, s=structureString, adcdac=adc_dac);
|
||||
,\n#endif\n".format(i=i, c=chanString, p=portString, s=structureString, adcdac=adc_dac));
|
||||
return;
|
||||
|
||||
print "/* AUTOGENERATED using chanstringgen.py */\n"
|
||||
print "/* Not very nice looking but the standard preprocessor is not very powerful\n and we save some memory over doing this all at runtime */"
|
||||
print("/* AUTOGENERATED using chanstringgen.py */\n")
|
||||
print("/* Not very nice looking but the standard preprocessor is not very powerful\n and we save some memory over doing this all at runtime */")
|
||||
|
||||
print "/* Output Strings */\n\n"
|
||||
print("/* Output Strings */\n\n")
|
||||
|
||||
genstrings(33, "OUT", "TX", "output", "DAC");
|
||||
|
||||
print "/* Input Strings */\n\n"
|
||||
print("/* Input Strings */\n\n")
|
||||
|
||||
genstrings(33, "IN", "RX", "input", "ADC");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// Copyright 2015-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/* AUTOGENERATED using chanstringgen.py */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((1 < ADAT_TX_INDEX+8+1) && (1 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((1 < ADAT_TX_INDEX+8+1) && (1 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((1 < SPDIF_TX_INDEX+2+1) && (1 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (1 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -62,7 +62,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((2 < ADAT_TX_INDEX+8+1) && (2 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((2 < ADAT_TX_INDEX+8+1) && (2 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((2 < SPDIF_TX_INDEX+2+1) && (2 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (2 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -102,7 +102,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((3 < ADAT_TX_INDEX+8+1) && (3 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((3 < ADAT_TX_INDEX+8+1) && (3 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((3 < SPDIF_TX_INDEX+2+1) && (3 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (3 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -142,7 +142,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((4 < ADAT_TX_INDEX+8+1) && (4 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((4 < ADAT_TX_INDEX+8+1) && (4 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((4 < SPDIF_TX_INDEX+2+1) && (4 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (4 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -182,7 +182,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((5 < ADAT_TX_INDEX+8+1) && (5 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((5 < ADAT_TX_INDEX+8+1) && (5 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((5 < SPDIF_TX_INDEX+2+1) && (5 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (5 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -222,7 +222,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((6 < ADAT_TX_INDEX+8+1) && (6 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((6 < ADAT_TX_INDEX+8+1) && (6 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((6 < SPDIF_TX_INDEX+2+1) && (6 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (6 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -262,7 +262,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((7 < ADAT_TX_INDEX+8+1) && (7 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((7 < ADAT_TX_INDEX+8+1) && (7 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((7 < SPDIF_TX_INDEX+2+1) && (7 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (7 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -302,7 +302,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((8 < ADAT_TX_INDEX+8+1) && (8 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((8 < ADAT_TX_INDEX+8+1) && (8 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((8 < SPDIF_TX_INDEX+2+1) && (8 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (8 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -342,7 +342,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((9 < ADAT_TX_INDEX+8+1) && (9 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((9 < ADAT_TX_INDEX+8+1) && (9 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((9 < SPDIF_TX_INDEX+2+1) && (9 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (9 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -382,7 +382,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((10 < ADAT_TX_INDEX+8+1) && (10 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((10 < ADAT_TX_INDEX+8+1) && (10 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((10 < SPDIF_TX_INDEX+2+1) && (10 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (10 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -422,7 +422,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((11 < ADAT_TX_INDEX+8+1) && (11 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((11 < ADAT_TX_INDEX+8+1) && (11 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((11 < SPDIF_TX_INDEX+2+1) && (11 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (11 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -462,7 +462,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((12 < ADAT_TX_INDEX+8+1) && (12 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((12 < ADAT_TX_INDEX+8+1) && (12 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((12 < SPDIF_TX_INDEX+2+1) && (12 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (12 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -502,7 +502,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((13 < ADAT_TX_INDEX+8+1) && (13 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((13 < ADAT_TX_INDEX+8+1) && (13 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((13 < SPDIF_TX_INDEX+2+1) && (13 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (13 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -542,7 +542,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((14 < ADAT_TX_INDEX+8+1) && (14 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((14 < ADAT_TX_INDEX+8+1) && (14 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((14 < SPDIF_TX_INDEX+2+1) && (14 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (14 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -582,7 +582,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((15 < ADAT_TX_INDEX+8+1) && (15 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((15 < ADAT_TX_INDEX+8+1) && (15 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((15 < SPDIF_TX_INDEX+2+1) && (15 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (15 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -622,7 +622,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((16 < ADAT_TX_INDEX+8+1) && (16 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((16 < ADAT_TX_INDEX+8+1) && (16 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((16 < SPDIF_TX_INDEX+2+1) && (16 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (16 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -662,7 +662,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((17 < ADAT_TX_INDEX+8+1) && (17 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((17 < ADAT_TX_INDEX+8+1) && (17 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((17 < SPDIF_TX_INDEX+2+1) && (17 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (17 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -702,7 +702,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((18 < ADAT_TX_INDEX+8+1) && (18 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((18 < ADAT_TX_INDEX+8+1) && (18 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((18 < SPDIF_TX_INDEX+2+1) && (18 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (18 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -742,7 +742,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((19 < ADAT_TX_INDEX+8+1) && (19 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((19 < ADAT_TX_INDEX+8+1) && (19 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((19 < SPDIF_TX_INDEX+2+1) && (19 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (19 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -782,7 +782,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((20 < ADAT_TX_INDEX+8+1) && (20 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((20 < ADAT_TX_INDEX+8+1) && (20 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((20 < SPDIF_TX_INDEX+2+1) && (20 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (20 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -822,7 +822,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((21 < ADAT_TX_INDEX+8+1) && (21 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((21 < ADAT_TX_INDEX+8+1) && (21 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((21 < SPDIF_TX_INDEX+2+1) && (21 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (21 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -862,7 +862,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((22 < ADAT_TX_INDEX+8+1) && (22 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((22 < ADAT_TX_INDEX+8+1) && (22 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((22 < SPDIF_TX_INDEX+2+1) && (22 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (22 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -902,7 +902,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((23 < ADAT_TX_INDEX+8+1) && (23 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((23 < ADAT_TX_INDEX+8+1) && (23 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((23 < SPDIF_TX_INDEX+2+1) && (23 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (23 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -942,7 +942,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((24 < ADAT_TX_INDEX+8+1) && (24 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((24 < ADAT_TX_INDEX+8+1) && (24 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((24 < SPDIF_TX_INDEX+2+1) && (24 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (24 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -982,7 +982,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((25 < ADAT_TX_INDEX+8+1) && (25 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((25 < ADAT_TX_INDEX+8+1) && (25 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((25 < SPDIF_TX_INDEX+2+1) && (25 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (25 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1022,7 +1022,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((26 < ADAT_TX_INDEX+8+1) && (26 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((26 < ADAT_TX_INDEX+8+1) && (26 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((26 < SPDIF_TX_INDEX+2+1) && (26 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (26 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1062,7 +1062,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((27 < ADAT_TX_INDEX+8+1) && (27 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((27 < ADAT_TX_INDEX+8+1) && (27 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((27 < SPDIF_TX_INDEX+2+1) && (27 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (27 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1102,7 +1102,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((28 < ADAT_TX_INDEX+8+1) && (28 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((28 < ADAT_TX_INDEX+8+1) && (28 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((28 < SPDIF_TX_INDEX+2+1) && (28 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (28 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1142,7 +1142,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((29 < ADAT_TX_INDEX+8+1) && (29 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((29 < ADAT_TX_INDEX+8+1) && (29 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((29 < SPDIF_TX_INDEX+2+1) && (29 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (29 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1182,7 +1182,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((30 < ADAT_TX_INDEX+8+1) && (30 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((30 < ADAT_TX_INDEX+8+1) && (30 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((30 < SPDIF_TX_INDEX+2+1) && (30 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (30 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1222,7 +1222,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((31 < ADAT_TX_INDEX+8+1) && (31 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((31 < ADAT_TX_INDEX+8+1) && (31 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((31 < SPDIF_TX_INDEX+2+1) && (31 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (31 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1262,7 +1262,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((32 < ADAT_TX_INDEX+8+1) && (32 > ADAT_TX_INDEX)) && defined(ADAT_TX)
|
||||
#if ((32 < ADAT_TX_INDEX+8+1) && (32 > ADAT_TX_INDEX)) && (XUA_ADAT_TX_EN)
|
||||
#if ((32 < SPDIF_TX_INDEX+2+1) && (32 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (32 < I2S_CHANS_DAC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1305,7 +1305,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((1 < ADAT_RX_INDEX+8+1) && (1 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((1 < ADAT_RX_INDEX+8+1) && (1 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((1 < SPDIF_RX_INDEX+2+1) && (1 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (1 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1345,7 +1345,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((2 < ADAT_RX_INDEX+8+1) && (2 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((2 < ADAT_RX_INDEX+8+1) && (2 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((2 < SPDIF_RX_INDEX+2+1) && (2 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (2 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1385,7 +1385,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((3 < ADAT_RX_INDEX+8+1) && (3 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((3 < ADAT_RX_INDEX+8+1) && (3 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((3 < SPDIF_RX_INDEX+2+1) && (3 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (3 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1425,7 +1425,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((4 < ADAT_RX_INDEX+8+1) && (4 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((4 < ADAT_RX_INDEX+8+1) && (4 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((4 < SPDIF_RX_INDEX+2+1) && (4 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (4 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1465,7 +1465,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((5 < ADAT_RX_INDEX+8+1) && (5 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((5 < ADAT_RX_INDEX+8+1) && (5 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((5 < SPDIF_RX_INDEX+2+1) && (5 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (5 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1505,7 +1505,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((6 < ADAT_RX_INDEX+8+1) && (6 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((6 < ADAT_RX_INDEX+8+1) && (6 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((6 < SPDIF_RX_INDEX+2+1) && (6 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (6 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1545,7 +1545,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((7 < ADAT_RX_INDEX+8+1) && (7 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((7 < ADAT_RX_INDEX+8+1) && (7 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((7 < SPDIF_RX_INDEX+2+1) && (7 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (7 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1585,7 +1585,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((8 < ADAT_RX_INDEX+8+1) && (8 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((8 < ADAT_RX_INDEX+8+1) && (8 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((8 < SPDIF_RX_INDEX+2+1) && (8 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (8 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1625,7 +1625,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((9 < ADAT_RX_INDEX+8+1) && (9 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((9 < ADAT_RX_INDEX+8+1) && (9 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((9 < SPDIF_RX_INDEX+2+1) && (9 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (9 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1665,7 +1665,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((10 < ADAT_RX_INDEX+8+1) && (10 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((10 < ADAT_RX_INDEX+8+1) && (10 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((10 < SPDIF_RX_INDEX+2+1) && (10 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (10 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1705,7 +1705,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((11 < ADAT_RX_INDEX+8+1) && (11 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((11 < ADAT_RX_INDEX+8+1) && (11 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((11 < SPDIF_RX_INDEX+2+1) && (11 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (11 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1745,7 +1745,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((12 < ADAT_RX_INDEX+8+1) && (12 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((12 < ADAT_RX_INDEX+8+1) && (12 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((12 < SPDIF_RX_INDEX+2+1) && (12 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (12 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1785,7 +1785,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((13 < ADAT_RX_INDEX+8+1) && (13 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((13 < ADAT_RX_INDEX+8+1) && (13 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((13 < SPDIF_RX_INDEX+2+1) && (13 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (13 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1825,7 +1825,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((14 < ADAT_RX_INDEX+8+1) && (14 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((14 < ADAT_RX_INDEX+8+1) && (14 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((14 < SPDIF_RX_INDEX+2+1) && (14 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (14 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1865,7 +1865,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((15 < ADAT_RX_INDEX+8+1) && (15 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((15 < ADAT_RX_INDEX+8+1) && (15 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((15 < SPDIF_RX_INDEX+2+1) && (15 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (15 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1905,7 +1905,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((16 < ADAT_RX_INDEX+8+1) && (16 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((16 < ADAT_RX_INDEX+8+1) && (16 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((16 < SPDIF_RX_INDEX+2+1) && (16 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (16 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1945,7 +1945,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((17 < ADAT_RX_INDEX+8+1) && (17 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((17 < ADAT_RX_INDEX+8+1) && (17 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((17 < SPDIF_RX_INDEX+2+1) && (17 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (17 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -1985,7 +1985,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((18 < ADAT_RX_INDEX+8+1) && (18 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((18 < ADAT_RX_INDEX+8+1) && (18 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((18 < SPDIF_RX_INDEX+2+1) && (18 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (18 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2025,7 +2025,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((19 < ADAT_RX_INDEX+8+1) && (19 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((19 < ADAT_RX_INDEX+8+1) && (19 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((19 < SPDIF_RX_INDEX+2+1) && (19 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (19 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2065,7 +2065,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((20 < ADAT_RX_INDEX+8+1) && (20 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((20 < ADAT_RX_INDEX+8+1) && (20 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((20 < SPDIF_RX_INDEX+2+1) && (20 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (20 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2105,7 +2105,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((21 < ADAT_RX_INDEX+8+1) && (21 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((21 < ADAT_RX_INDEX+8+1) && (21 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((21 < SPDIF_RX_INDEX+2+1) && (21 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (21 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2145,7 +2145,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((22 < ADAT_RX_INDEX+8+1) && (22 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((22 < ADAT_RX_INDEX+8+1) && (22 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((22 < SPDIF_RX_INDEX+2+1) && (22 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (22 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2185,7 +2185,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((23 < ADAT_RX_INDEX+8+1) && (23 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((23 < ADAT_RX_INDEX+8+1) && (23 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((23 < SPDIF_RX_INDEX+2+1) && (23 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (23 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2225,7 +2225,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((24 < ADAT_RX_INDEX+8+1) && (24 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((24 < ADAT_RX_INDEX+8+1) && (24 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((24 < SPDIF_RX_INDEX+2+1) && (24 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (24 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2265,7 +2265,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((25 < ADAT_RX_INDEX+8+1) && (25 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((25 < ADAT_RX_INDEX+8+1) && (25 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((25 < SPDIF_RX_INDEX+2+1) && (25 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (25 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2305,7 +2305,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((26 < ADAT_RX_INDEX+8+1) && (26 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((26 < ADAT_RX_INDEX+8+1) && (26 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((26 < SPDIF_RX_INDEX+2+1) && (26 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (26 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2345,7 +2345,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((27 < ADAT_RX_INDEX+8+1) && (27 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((27 < ADAT_RX_INDEX+8+1) && (27 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((27 < SPDIF_RX_INDEX+2+1) && (27 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (27 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2385,7 +2385,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((28 < ADAT_RX_INDEX+8+1) && (28 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((28 < ADAT_RX_INDEX+8+1) && (28 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((28 < SPDIF_RX_INDEX+2+1) && (28 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (28 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2425,7 +2425,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((29 < ADAT_RX_INDEX+8+1) && (29 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((29 < ADAT_RX_INDEX+8+1) && (29 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((29 < SPDIF_RX_INDEX+2+1) && (29 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (29 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2465,7 +2465,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((30 < ADAT_RX_INDEX+8+1) && (30 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((30 < ADAT_RX_INDEX+8+1) && (30 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((30 < SPDIF_RX_INDEX+2+1) && (30 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (30 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2505,7 +2505,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((31 < ADAT_RX_INDEX+8+1) && (31 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((31 < ADAT_RX_INDEX+8+1) && (31 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((31 < SPDIF_RX_INDEX+2+1) && (31 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (31 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
@@ -2545,7 +2545,7 @@
|
||||
"SPDIF 2"
|
||||
#endif
|
||||
#endif
|
||||
#if ((32 < ADAT_RX_INDEX+8+1) && (32 > ADAT_RX_INDEX)) && defined(ADAT_RX)
|
||||
#if ((32 < ADAT_RX_INDEX+8+1) && (32 > ADAT_RX_INDEX)) && (XUA_ADAT_RX_EN)
|
||||
#if ((32 < SPDIF_RX_INDEX+2+1) && (32 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (32 < I2S_CHANS_ADC+1)
|
||||
"/"
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ enum USBInterfaceNumber
|
||||
INTERFACE_COUNT /* End marker */
|
||||
};
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#ifndef ENDPOINT_INT_INTERVAL_IN_HID
|
||||
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include "vendorrequests.h"
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL)) __attribute__ ((weak));
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL))
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/**
|
||||
* @brief Implements endpoint zero for an USB Audio 1.0/2.0 device
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <xclib.h>
|
||||
#include <xassert.h>
|
||||
#include "xua.h"
|
||||
|
||||
#if XUA_USB_EN
|
||||
@@ -23,18 +25,24 @@
|
||||
#include "vendorrequests.h"
|
||||
#include "xc_ptr.h"
|
||||
#include "xua_ep0_uacreqs.h"
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "hid.h"
|
||||
#include "xua_hid.h"
|
||||
#include "xua_hid_report.h"
|
||||
#endif
|
||||
|
||||
#if DSD_CHANS_DAC > 0
|
||||
#include "dsd_support.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_UNIT XUA_EP0
|
||||
|
||||
#ifndef DEBUG_PRINT_ENABLE_XUA_EP0
|
||||
#define DEBUG_PRINT_ENABLE_XUA_EP0 0
|
||||
#endif // DEBUG_PRINT_ENABLE_XUA_EP0
|
||||
#include "debug_print.h"
|
||||
|
||||
#include "debug_print.h"
|
||||
#include "xua_usb_params_funcs.h"
|
||||
|
||||
#ifndef __XC__
|
||||
@@ -51,7 +59,7 @@
|
||||
#if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK)) && defined(DFU)
|
||||
#warning DFU will not be enabled in AUDIO 1.0 mode due to Windows requesting driver
|
||||
#endif
|
||||
#endif
|
||||
#endif // FORCE_UAC1_DFU
|
||||
|
||||
/* MIDI not supported in Audio 1.0 mode */
|
||||
#if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK)) && defined(MIDI)
|
||||
@@ -85,9 +93,6 @@ extern void device_reboot(void);
|
||||
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "xua_hid.h"
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
@@ -101,13 +106,17 @@ unsigned int mutesOut[NUM_USB_CHAN_OUT + 1];
|
||||
int volsIn[NUM_USB_CHAN_IN + 1];
|
||||
unsigned int mutesIn[NUM_USB_CHAN_IN + 1];
|
||||
|
||||
#ifdef MIXER
|
||||
unsigned char mixer1Crossbar[18];
|
||||
short mixer1Weights[18*8];
|
||||
#if (MIXER)
|
||||
short mixer1Weights[MIX_INPUTS * MAX_MIX_COUNT];
|
||||
|
||||
unsigned char channelMap[NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT];
|
||||
//unsigned char channelMap[NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT];
|
||||
/* Mapping of channels to output audio interfaces */
|
||||
unsigned char channelMapAud[NUM_USB_CHAN_OUT];
|
||||
|
||||
/* Mapping of channels to USB host */
|
||||
unsigned char channelMapUsb[NUM_USB_CHAN_IN];
|
||||
|
||||
/* Mapping of channels to Mixer(s) */
|
||||
unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
|
||||
#endif
|
||||
|
||||
@@ -125,7 +134,11 @@ unsigned g_curStreamAlt_Out = 0;
|
||||
unsigned g_curStreamAlt_In = 0;
|
||||
|
||||
/* Global variable for current USB bus speed (i.e. FS/HS) */
|
||||
XUD_BusSpeed_t g_curUsbSpeed = 0;
|
||||
#if (AUDIO_CLASS == 2)
|
||||
XUD_BusSpeed_t g_curUsbSpeed = XUD_SPEED_HS;
|
||||
#else
|
||||
XUD_BusSpeed_t g_curUsbSpeed = XUD_SPEED_FS;
|
||||
#endif
|
||||
|
||||
/* Global variables for current USB Vendor and Product strings */
|
||||
char g_vendor_str[XUA_MAX_STR_LEN] = VENDOR_STR;
|
||||
@@ -253,9 +266,47 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) {
|
||||
#endif // AUDIO_CLASS == 1}
|
||||
}
|
||||
|
||||
#if (MIXER)
|
||||
void InitLocalMixerState()
|
||||
{
|
||||
for (int i = 0; i < MIX_INPUTS * MAX_MIX_COUNT; i++)
|
||||
{
|
||||
mixer1Weights[i] = 0x8001; //-inf
|
||||
}
|
||||
|
||||
/* Configure default connections */
|
||||
for (int i = 0; i < MAX_MIX_COUNT; i++)
|
||||
{
|
||||
mixer1Weights[(i * MAX_MIX_COUNT) + i] = 0;
|
||||
}
|
||||
|
||||
#if NUM_USB_CHAN_OUT > 0
|
||||
/* Setup up audio output channel mapping */
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
channelMapAud[i] = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NUM_USB_CHAN_IN > 0
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
|
||||
{
|
||||
channelMapUsb[i] = i + NUM_USB_CHAN_OUT;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Init mixer inputs */
|
||||
for(int j = 0; j < MAX_MIX_COUNT; j++)
|
||||
for(int i = 0; i < MIX_INPUTS; i++)
|
||||
{
|
||||
mixSel[j][i] = i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) {
|
||||
debug_printf("concatenateAndCopyStrings() for \"%s\" and \"%s\"\n", string1, string2);
|
||||
|
||||
debug_printf("concatenateAndCopyStrings() for \"%s\" and \"%s\"\n", string1, string2);
|
||||
|
||||
memset(string_buffer, '\0', strlen(string_buffer));
|
||||
|
||||
uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1);
|
||||
@@ -279,10 +330,10 @@ void XUA_Endpoint0_setStrTable() {
|
||||
concatenateAndCopyStrings(g_vendor_str, " Clock Selector", g_strTable.clockSelectorStr);
|
||||
concatenateAndCopyStrings(g_vendor_str, " Internal Clock", g_strTable.internalClockSourceStr);
|
||||
#endif
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
concatenateAndCopyStrings(g_vendor_str, " S/PDIF Clock", g_strTable.spdifClockSourceStr);
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
concatenateAndCopyStrings(g_vendor_str, " ADAT Clock", g_strTable.adatClockSourceStr);
|
||||
#endif
|
||||
#if (XUA_DFU_EN == 1)
|
||||
@@ -309,7 +360,7 @@ void XUA_Endpoint0_setStrTable() {
|
||||
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2);
|
||||
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2);
|
||||
#endif
|
||||
|
||||
|
||||
// update Serial strings
|
||||
concatenateAndCopyStrings(g_serial_str, "", g_strTable.serialStr);
|
||||
}
|
||||
@@ -391,7 +442,7 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcd) {
|
||||
#endif // AUDIO_CLASS == 1}
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
ep0_out = XUD_InitEp(c_ep0_out);
|
||||
@@ -399,75 +450,11 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
|
||||
|
||||
XUA_Endpoint0_setStrTable();
|
||||
|
||||
#if 0
|
||||
/* Dont need to init globals.. */
|
||||
/* Init tables for volumes (+ 1 for master) */
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT + 1; i++)
|
||||
{
|
||||
volsOut[i] = 0;
|
||||
mutesOut[i] = 0;
|
||||
}
|
||||
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN + 1; i++)
|
||||
{
|
||||
volsIn[i] = 0;
|
||||
mutesIn[i] = 0;
|
||||
}
|
||||
#endif
|
||||
VendorRequests_Init(VENDOR_REQUESTS_PARAMS);
|
||||
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
/* Set up mixer default state */
|
||||
for (int i = 0; i < 18*8; i++)
|
||||
{
|
||||
mixer1Weights[i] = 0x8001; //-inf
|
||||
}
|
||||
|
||||
/* Configure default connections */
|
||||
mixer1Weights[0] = 0;
|
||||
mixer1Weights[9] = 0;
|
||||
mixer1Weights[18] = 0;
|
||||
mixer1Weights[27] = 0;
|
||||
mixer1Weights[36] = 0;
|
||||
mixer1Weights[45] = 0;
|
||||
mixer1Weights[54] = 0;
|
||||
mixer1Weights[63] = 0;
|
||||
|
||||
#if NUM_USB_CHAN_OUT > 0
|
||||
/* Setup up audio output channel mapping */
|
||||
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
channelMapAud[i] = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NUM_USB_CHAN_IN > 0
|
||||
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
|
||||
{
|
||||
channelMapUsb[i] = i + NUM_USB_CHAN_OUT;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set up channel mapping default */
|
||||
for (int i = 0; i < NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN; i++)
|
||||
{
|
||||
channelMap[i] = i;
|
||||
}
|
||||
|
||||
#if MAX_MIX_COUNT > 0
|
||||
/* Mixer outputs mapping defaults */
|
||||
for (int i = 0; i < MAX_MIX_COUNT; i++)
|
||||
{
|
||||
channelMap[NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + i] = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Init mixer inputs */
|
||||
for(int j = 0; j < MAX_MIX_COUNT; j++)
|
||||
for(int i = 0; i < MIX_INPUTS; i++)
|
||||
{
|
||||
mixSel[j][i] = i;
|
||||
}
|
||||
InitLocalMixerState();
|
||||
#endif
|
||||
|
||||
#ifdef VENDOR_AUDIO_REQS
|
||||
@@ -478,6 +465,8 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
|
||||
/* Check if device has started in DFU mode */
|
||||
if (DFUReportResetState(null))
|
||||
{
|
||||
assert(((unsigned)c_audioControl != 0) && msg("DFU not supported when c_audioControl is null"));
|
||||
|
||||
/* Stop audio */
|
||||
outuint(c_audioControl, SET_SAMPLE_FREQ);
|
||||
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);
|
||||
@@ -486,41 +475,64 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here
|
||||
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here
|
||||
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution
|
||||
const int num_of_usb_descriptor_freq = 3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution
|
||||
#if( 0 < NUM_USB_CHAN_IN )
|
||||
|
||||
const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
|
||||
int i=0;
|
||||
for(i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution
|
||||
|
||||
for(int i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
{
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_device_to_usb_rate() & 0xff;
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_device_to_usb_rate() & 0xff00)>> 8;
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_device_to_usb_rate() & 0xff0000)>> 16;
|
||||
}
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size
|
||||
|
||||
for(i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
#endif // NUM_USB_CHAN_IN
|
||||
|
||||
#if( 0 < NUM_USB_CHAN_OUT )
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution
|
||||
|
||||
for(int i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
{
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_usb_to_device_rate() & 0xff;
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_usb_to_device_rate() & 0xff00)>> 8;
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_usb_to_device_rate() & 0xff0000)>> 16;
|
||||
}
|
||||
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size
|
||||
#endif // NUM_USB_CHAN_OUT
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size
|
||||
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
hidReportInit();
|
||||
hidPrepareReportDescriptor();
|
||||
|
||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
||||
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
||||
|
||||
#if( AUDIO_CLASS == 1 )
|
||||
cfgDesc_Audio1[USB_HID_DESCRIPTOR_OFFSET + HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||
cfgDesc_Audio1[USB_HID_DESCRIPTOR_OFFSET + HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||
#endif
|
||||
|
||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||
#endif // 0 < HID_CONTROLS
|
||||
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
if (result == XUD_RES_OKAY)
|
||||
@@ -547,6 +559,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
/* Only send change if we need to */
|
||||
if((sp.wValue > 0) && (g_curStreamAlt_Out != sp.wValue))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("Format change not supported when c_audioControl is null"));
|
||||
g_curStreamAlt_Out = sp.wValue;
|
||||
|
||||
/* Send format of data onto buffering */
|
||||
@@ -582,6 +595,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
/* Only send change if we need to */
|
||||
if((sp.wValue > 0) && (g_curStreamAlt_In != sp.wValue))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("Format change not supported when c_audioControl is null"));
|
||||
g_curStreamAlt_In = sp.wValue;
|
||||
|
||||
/* Send format of data onto buffering */
|
||||
@@ -729,15 +743,22 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
switch (descriptorType)
|
||||
{
|
||||
case HID_HID:
|
||||
/* Return HID Descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||
sizeof(hidDescriptor), sp.wLength);
|
||||
{
|
||||
/* Return HID Descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||
sizeof(hidDescriptor), sp.wLength);
|
||||
}
|
||||
break;
|
||||
case HID_REPORT:
|
||||
/* Return HID report descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptor,
|
||||
sizeof(hidReportDescriptor), sp.wLength);
|
||||
break;
|
||||
{
|
||||
/* Return HID report descriptor */
|
||||
unsigned char* hidReportDescriptorPtr;
|
||||
hidReportDescriptorPtr = hidGetReportDescriptor();
|
||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
||||
hidReportDescriptorLength, sp.wLength);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -819,6 +840,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
if ((DFU_IF == INTERFACE_NUMBER_DFU) && (sp.bRequest != XMOS_DFU_SAVESTATE) &&
|
||||
(sp.bRequest != XMOS_DFU_RESTORESTATE))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("DFU not supported when c_audioControl is null"));
|
||||
// Stop audio
|
||||
outuint(c_audioControl, SET_SAMPLE_FREQ);
|
||||
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);
|
||||
@@ -1061,7 +1083,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
}
|
||||
|
||||
/* Endpoint 0 function. Handles all requests to the device */
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
USB_SetupPacket_t sp;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/**
|
||||
* @file xua_ep0_descriptors.h
|
||||
@@ -10,16 +10,13 @@
|
||||
#define _DEVICE_DESCRIPTORS_
|
||||
|
||||
#include <stddef.h>
|
||||
#include "xua.h" /* Device specific define */
|
||||
#include "xua.h" /* Device specific define */
|
||||
#include "descriptor_defs.h"
|
||||
#include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */
|
||||
#include "usbaudiocommon.h"
|
||||
#include "xud_device.h"
|
||||
#include "xua_hid_descriptor.h"
|
||||
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
#include "iap2.h" /* Defines iAP EA Native Transport protocol name */
|
||||
#endif
|
||||
#include "xud.h"
|
||||
|
||||
#define APPEND_VENDOR_STR(x) VENDOR_STR" "#x
|
||||
|
||||
@@ -46,14 +43,25 @@
|
||||
// The value below must match the length of XUA_DESCR_EMPTY_STRING.
|
||||
#define XUA_MAX_STR_LEN (32)
|
||||
|
||||
#define ISO_EP_ATTRIBUTES_ASYNCH 0x05 //ISO, ASYNCH, DATA EP
|
||||
#define ISO_EP_ATTRIBUTES_ADAPTIVE 0x09 //ISO, ADAPTIVE, DATA EP
|
||||
#define ISO_EP_IMPL_ATTRIBUTES_ASYNCH 0x25 //ISO, ASYNCH, IMPLICIT FB DATA EP
|
||||
#define ISO_EP_IMPL_ATTRIBUTES_ADAPTIVE 0x29 //ISO, ADAPTIVE, IMPLICIT FB DATA EP
|
||||
#define ISO_EP_ATTRIBUTES_ASYNC ((USB_ENDPOINT_TRANSTYPE_ISO << USB_ENDPOINT_TRANSTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_SYNCTYPE_ASYNC << USB_ENDPOINT_SYNCTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_USAGETYPE_DATA << USB_ENDPOINT_USAGETYPE_SHIFT))
|
||||
|
||||
#if (defined(XUA_ADAPTIVE) && (XUA_ADAPTIVE == 0))
|
||||
#undef XUA_ADAPTIVE
|
||||
#endif
|
||||
#define ISO_EP_ATTRIBUTES_ADAPTIVE ((USB_ENDPOINT_TRANSTYPE_ISO << USB_ENDPOINT_TRANSTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_SYNCTYPE_ADAPT << USB_ENDPOINT_SYNCTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_USAGETYPE_DATA << USB_ENDPOINT_USAGETYPE_SHIFT))
|
||||
|
||||
#define ISO_EP_ATTRIBUTES_SYNC ((USB_ENDPOINT_TRANSTYPE_ISO << USB_ENDPOINT_TRANSTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_SYNCTYPE_SYNC << USB_ENDPOINT_SYNCTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_USAGETYPE_DATA << USB_ENDPOINT_USAGETYPE_SHIFT))
|
||||
|
||||
#define ISO_EP_IMPL_ATTRIBUTES_ASYNC ((USB_ENDPOINT_TRANSTYPE_ISO << USB_ENDPOINT_TRANSTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_SYNCTYPE_ASYNC << USB_ENDPOINT_SYNCTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_USAGETYPE_IMPLICIT << USB_ENDPOINT_USAGETYPE_SHIFT))
|
||||
|
||||
#define ISO_EP_IMPL_ATTRIBUTES_ADAPT ((USB_ENDPOINT_TRANSTYPE_ISO << USB_ENDPOINT_TRANSTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_SYNCTYPE_ADAPT << USB_ENDPOINT_SYNCTYPE_SHIFT)\
|
||||
| (USB_ENDPOINT_USAGETYPE_IMPLICIT << USB_ENDPOINT_USAGETYPE_SHIFT))
|
||||
|
||||
#if __STDC__
|
||||
typedef struct
|
||||
@@ -81,10 +89,10 @@ typedef struct
|
||||
#if (AUDIO_CLASS == 2)
|
||||
STR_TABLE_ENTRY(clockSelectorStr); /* iClockSel */
|
||||
STR_TABLE_ENTRY(internalClockSourceStr); /* iClockSource for internal clock */
|
||||
#if SPDIF_RX
|
||||
#if XUA_SPDIF_RX_EN
|
||||
STR_TABLE_ENTRY(spdifClockSourceStr); /* iClockSource for external S/PDIF clock */
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
STR_TABLE_ENTRY(adatClockSourceStr); /* iClockSource for external S/PDIF clock */
|
||||
#endif
|
||||
#endif // AUDIO_CLASS == 2
|
||||
@@ -300,28 +308,28 @@ typedef struct
|
||||
#error NUM_USB_CHAN > 32
|
||||
#endif
|
||||
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
STR_TABLE_ENTRY(mixOutStr_1);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 1)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 1)
|
||||
STR_TABLE_ENTRY(mixOutStr_2);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 2)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 2)
|
||||
STR_TABLE_ENTRY(mixOutStr_3);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 3)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 3)
|
||||
STR_TABLE_ENTRY(mixOutStr_4);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 4)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 4)
|
||||
STR_TABLE_ENTRY(mixOutStr_5);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 5)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 5)
|
||||
STR_TABLE_ENTRY(mixOutStr_6);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 6)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 6)
|
||||
STR_TABLE_ENTRY(mixOutStr_7);
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 7)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 7)
|
||||
STR_TABLE_ENTRY(mixOutStr_8);
|
||||
#endif
|
||||
#ifdef IAP
|
||||
@@ -355,10 +363,10 @@ StringDescTable_t g_strTable =
|
||||
#if (AUDIO_CLASS == 2)
|
||||
.clockSelectorStr = XUA_CLOCK_SELECTOR_EMPTY_STRING,
|
||||
.internalClockSourceStr = XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING,
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
.spdifClockSourceStr = XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING,
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
.adatClockSourceStr = XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING,
|
||||
#endif
|
||||
#endif // AUDIO_CLASS == 2
|
||||
@@ -383,31 +391,31 @@ StringDescTable_t g_strTable =
|
||||
#error NUM_USB_CHAN_IN > 32
|
||||
#endif
|
||||
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
.mixOutStr_1 = "Mix 1",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 1)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 1)
|
||||
.mixOutStr_2 = "Mix 2",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 2)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 2)
|
||||
.mixOutStr_3 = "Mix 3",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 3)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 3)
|
||||
.mixOutStr_4 = "Mix 4",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 4)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 4)
|
||||
.mixOutStr_5 = "Mix 5",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 5)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 5)
|
||||
.mixOutStr_6 = "Mix 6",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 6)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 6)
|
||||
.mixOutStr_7 = "Mix 7",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 7)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 7)
|
||||
.mixOutStr_8 = "Mix 8",
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 8)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 8)
|
||||
#error
|
||||
#endif
|
||||
#ifdef IAP
|
||||
@@ -550,7 +558,7 @@ unsigned char devQualDesc_Null[] =
|
||||
};
|
||||
|
||||
|
||||
#if defined(MIXER) && !defined(AUDIO_PATH_XUS) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && !defined(AUDIO_PATH_XUS) && (MAX_MIX_COUNT > 0)
|
||||
//#warning Extension units on the audio path are required for mixer. Enabling them now.
|
||||
#define AUDIO_PATH_XUS
|
||||
#endif
|
||||
@@ -567,7 +575,7 @@ unsigned char devQualDesc_Null[] =
|
||||
#define DFU_LENGTH (0)
|
||||
#endif
|
||||
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
#define MIX_BMCONTROLS_LEN_TMP ((MAX_MIX_COUNT * MIX_INPUTS) / 8)
|
||||
|
||||
#if ((MAX_MIX_COUNT * MIX_INPUTS)%8)==0
|
||||
@@ -580,33 +588,6 @@ unsigned char devQualDesc_Null[] =
|
||||
#define MIXER_LENGTH (0)
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x01, /* Usage Page (Generic Desktop) */
|
||||
0x09, 0x06, /* Usage (Keyboard) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x04, /* Report Count (4) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x00, /* Logical Maximum (0) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x95, 0x01, /* Report Count (1) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x05, 0x0C, /* Usage Page (Consumer) */
|
||||
0x0a, 0x21, 0x02, /* Usage (AC Search) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x0a, 0x26, 0x02, /* Usage (AC Stop) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x05, 0x07, /* Usage Page (Key Codes) */
|
||||
0x19, 0x72, /* Usage Minimum (Keyboard F23) */
|
||||
0x29, 0x73, /* Usage Maximum (Keyboard F24) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0xc0 /* End collection (Application) */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Max packet sizes:
|
||||
* Samples per channel. e.g (192000+7999/8000) = 24
|
||||
* Must allow 1 sample extra per chan (24 + 1) = 25
|
||||
@@ -675,17 +656,17 @@ typedef struct
|
||||
/* Class Specific Audio Control Interface Header Descriptor */
|
||||
UAC_Descriptor_Interface_AC_t Audio_ClassControlInterface;
|
||||
USB_Descriptor_Audio_ClockSource_t Audio_ClockSource;
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
USB_Descriptor_Audio_ClockSource_t Audio_ClockSource_SPDIF;
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
USB_Descriptor_Audio_ClockSource_t Audio_ClockSource_ADAT;
|
||||
#endif
|
||||
USB_Descriptor_Audio_ClockSelector_t Audio_ClockSelector;
|
||||
#if (NUM_USB_CHAN_OUT > 0)
|
||||
/* Output path */
|
||||
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
USB_Descriptor_Audio_ExtensionUnit_t Audio_Out_ExtensionUnit;
|
||||
#endif
|
||||
#if(OUTPUT_VOLUME_CONTROL == 1)
|
||||
@@ -696,7 +677,7 @@ typedef struct
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
/* Input path */
|
||||
USB_Descriptor_Audio_InputTerminal_t Audio_In_InputTerminal;
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
USB_Descriptor_Audio_ExtensionUnit_t Audio_In_ExtensionUnit;
|
||||
#endif
|
||||
#if(INPUT_VOLUME_CONTROL == 1)
|
||||
@@ -704,13 +685,13 @@ typedef struct
|
||||
#endif
|
||||
USB_Descriptor_Audio_OutputTerminal_t Audio_In_OutputTerminal;
|
||||
#endif
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
USB_Descriptor_Audio_ExtensionUnit2_t Audio_Mix_ExtensionUnit;
|
||||
// Currently no struct for mixer unit
|
||||
// USB_Descriptor_Audio_MixerUnit_t Audio_MixerUnit;
|
||||
unsigned char configDesc_MixerUnit[MIXER_LENGTH];
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
/* Interrupt EP */
|
||||
USB_Descriptor_Endpoint_t Audio_Int_Endpoint;
|
||||
#endif
|
||||
@@ -734,7 +715,7 @@ typedef struct
|
||||
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format;
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Endpoint;
|
||||
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint;
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint;
|
||||
#endif
|
||||
#if (OUTPUT_FORMAT_COUNT > 1)
|
||||
@@ -743,7 +724,7 @@ typedef struct
|
||||
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_2;
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Endpoint_2;
|
||||
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_2;
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_2;
|
||||
#endif
|
||||
#endif // OUTPUT_FORMAT_COUNT > 1
|
||||
@@ -753,7 +734,7 @@ typedef struct
|
||||
USB_Descriptor_Audio_Format_Type1_t Audio_Out_Format_3;
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Endpoint_3;
|
||||
USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_Out_ClassEndpoint_3;
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_3;
|
||||
#endif
|
||||
#endif // OUTPUT_FORMAT_COUNT > 2
|
||||
@@ -825,12 +806,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bNumInterfaces = INTERFACE_COUNT,
|
||||
.bConfigurationValue = 0x01,
|
||||
.iConfiguration = 0x00,
|
||||
#ifdef SELF_POWERED
|
||||
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
|
||||
.bmAttributes = 192,
|
||||
#else
|
||||
.bmAttributes = 128,
|
||||
#endif
|
||||
.bMaxPower = BMAX_POWER,
|
||||
.bMaxPower = _XUA_BMAX_POWER,
|
||||
},
|
||||
|
||||
.Audio_InterfaceAssociation =
|
||||
@@ -852,7 +833,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bDescriptorType = USB_DESCTYPE_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NUMBER_AUDIO_CONTROL,
|
||||
.bAlternateSetting = 0x00, /* Must be 0 */
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
.bNumEndpoints = 0x01, /* 0 or 1 if optional interrupt endpoint is present */
|
||||
#else
|
||||
.bNumEndpoints = 0x00,
|
||||
@@ -899,7 +880,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.iClockSource = offsetof(StringDescTable_t, internalClockSourceStr)/sizeof(char *),
|
||||
},
|
||||
|
||||
#if SPDIF_RX
|
||||
#if XUA_SPDIF_RX_EN
|
||||
/* Clock Source Descriptor (4.7.2.1) */
|
||||
.Audio_ClockSource_SPDIF =
|
||||
{
|
||||
@@ -923,7 +904,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
},
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
/* Clock Source Descriptor (4.7.2.1) */
|
||||
.Audio_ClockSource_ADAT =
|
||||
{
|
||||
@@ -957,11 +938,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bClockID = ID_CLKSEL,
|
||||
.bNrPins = NUM_CLOCKS,
|
||||
.baCSourceId[0] = ID_CLKSRC_INT, /* baCSourceID */
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
ID_CLKSRC_SPDIF, /* baCSourceID */
|
||||
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
ID_CLKSRC_ADAT, /* baCSourceID */
|
||||
#endif
|
||||
.bmControl = 0x03,
|
||||
@@ -1187,7 +1168,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: CS_INTERFACE */
|
||||
UAC_CS_AC_INTERFACE_SUBTYPE_FEATURE_UNIT, /* 2 bDescriptorSubType: FEATURE_UNIT */
|
||||
FU_USBIN, /* 3 bUnitID */
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
ID_XU_IN, /* 4 bSourceID */
|
||||
#else
|
||||
ID_IT_AUD, /* 4 bSourceID */
|
||||
@@ -1311,7 +1292,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bSourceID = FU_USBIN, /* 7 bSourceID Connect to analog input feature unit*/
|
||||
#else
|
||||
|
||||
.bSourceID = ID_IT_USB,/* 7 bSourceID Connect to analog input term */
|
||||
.bSourceID = ID_IT_AUD,/* 7 bSourceID Connect to analog input term */
|
||||
#endif
|
||||
.bCSourceID = ID_CLKSEL,
|
||||
.bmControls = 0x0000,
|
||||
@@ -1319,7 +1300,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
},
|
||||
#endif /* (NUM_USB_CHAN_IN > 0) */
|
||||
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
/* Extension Unit Descriptor (4.7.2.12) */
|
||||
.Audio_Mix_ExtensionUnit =
|
||||
{
|
||||
@@ -1411,9 +1392,9 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
0x00, /* bmControls */
|
||||
0 /* Mixer unit string descriptor index */
|
||||
},
|
||||
#endif /* defined(MIXER) && (MAX_MIX_COUNT > 0) */
|
||||
#endif /* (MIXER) && (MAX_MIX_COUNT > 0) */
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN)
|
||||
/* Standard AS Interrupt Endpoint Descriptor (4.8.2.1): */
|
||||
.Audio_Int_Endpoint =
|
||||
{
|
||||
@@ -1451,7 +1432,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
|
||||
1, /* 3 bAlternateSetting */
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
2, /* 4 bNumEndpoints */
|
||||
#else
|
||||
1, /* 4 bNumEndpoints */
|
||||
@@ -1494,14 +1475,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#else
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC,
|
||||
#else
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
|
||||
.bInterval = 1,
|
||||
@@ -1519,7 +1504,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
0x0008, /* 6:7 bLockDelay */
|
||||
},
|
||||
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
.Audio_Out_Fb_Endpoint =
|
||||
{
|
||||
.bLength = 0x07,
|
||||
@@ -1538,7 +1523,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
|
||||
2, /* 3 bAlternateSetting */
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
2, /* 4 bNumEndpoints */
|
||||
#else
|
||||
1, /* 4 bNumEndpoints */
|
||||
@@ -1580,14 +1565,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, Async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC, /* Iso, Sync, data endpoint */
|
||||
#else
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
#endif
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE,
|
||||
.bInterval = 1,
|
||||
@@ -1605,7 +1594,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
0x0008, /* 6:7 bLockDelay */
|
||||
},
|
||||
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
.Audio_Out_Fb_Endpoint_2 =
|
||||
{
|
||||
0x07, /* 0 bLength: 7 */
|
||||
@@ -1625,7 +1614,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
USB_DESCTYPE_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||
INTERFACE_NUMBER_AUDIO_OUTPUT, /* 2 bInterfaceNumber: Number of interface */
|
||||
3, /* 3 bAlternateSetting */
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
2, /* 4 bNumEndpoints */
|
||||
#else
|
||||
1, /* 4 bNumEndpoints */
|
||||
@@ -1668,14 +1657,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = 0x07,
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, Async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC, /* Iso, Sync, data endpoint */
|
||||
#else
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
#endif
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE,
|
||||
.bInterval = 1,
|
||||
@@ -1693,7 +1686,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.wLockDelay = 0x0008,
|
||||
},
|
||||
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
.Audio_Out_Fb_Endpoint_3 =
|
||||
{
|
||||
.bLength = 0x07,
|
||||
@@ -1769,14 +1762,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = 0x07,
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, Async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC, /* Iso, Sync, data endpoint */
|
||||
#else
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
#endif
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE,
|
||||
.bInterval = 0x01,
|
||||
@@ -1841,14 +1838,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = 0x07,
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, Async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC, /* Iso, Sync, data endpoint */
|
||||
#else
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
#endif
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE,
|
||||
.bInterval = 0x01,
|
||||
@@ -1914,14 +1915,18 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.bLength = 0x07,
|
||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO,
|
||||
#ifdef XUA_ADAPTIVE
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNC, /* Iso, Async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_SYNC, /* Iso, Sync, data endpoint */
|
||||
#else
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
.bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
#else
|
||||
.bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
#endif
|
||||
#error "Bad XUA_SYNCMODE"
|
||||
#endif
|
||||
.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE,
|
||||
.bInterval = 0x01,
|
||||
@@ -2234,12 +2239,12 @@ unsigned char cfgDesc_Null[] =
|
||||
0x01, /* 4 bNumInterface: Number of interfaces*/
|
||||
0x01, /* 5 bConfigurationValue */
|
||||
0x00, /* 6 iConfiguration */
|
||||
#ifdef SELF_POWERED
|
||||
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
|
||||
192, /* 7 bmAttributes */
|
||||
#else
|
||||
128,
|
||||
#endif
|
||||
BMAX_POWER, /* 8 bMaxPower */
|
||||
_XUA_BMAX_POWER, /* 8 bMaxPower */
|
||||
|
||||
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
||||
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
|
||||
@@ -2352,15 +2357,16 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
||||
/* Note, this is different that INTERFACE_COUNT since we dont support items such as MIDI, iAP etc in UAC1 mode */
|
||||
#define NUM_INTERFACES_A1 (1 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1 + NUM_CONTROL_USB_INTERFACES + DFU_INTERFACES_A1 + HID_INTERFACES_A1)
|
||||
|
||||
#if ((NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP))
|
||||
#if ((NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
|
||||
#else
|
||||
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
|
||||
#endif
|
||||
|
||||
#define INTERFACE_DESCRIPTOR_BYTES (9)
|
||||
|
||||
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
||||
#define AS_INTERFACE_BYTES (7)
|
||||
#define INTERFACE_DESCRIPTOR_BYTES (9)
|
||||
#define AS_FORMAT_TYPE_BYTES (17)
|
||||
#define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5)
|
||||
#define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5)
|
||||
@@ -2373,6 +2379,10 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
||||
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
||||
#endif
|
||||
|
||||
#define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16)
|
||||
|
||||
#if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000)
|
||||
@@ -2389,12 +2399,12 @@ unsigned char cfgDesc_Audio1[] =
|
||||
NUM_INTERFACES_A1, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/
|
||||
0x01, /* ID of this configuration */
|
||||
0x00, /* Unused */
|
||||
#ifdef SELF_POWERED
|
||||
#if (XUA_POWERMODE == XUA_POWERMODE_SELF)
|
||||
192, /* 7 bmAttributes */
|
||||
#else
|
||||
128, /* 7 bmAttributes */
|
||||
#endif
|
||||
BMAX_POWER, /* 8 bMaxPower */
|
||||
_XUA_BMAX_POWER, /* 8 bMaxPower */
|
||||
|
||||
/* Standard AC interface descriptor */
|
||||
0x09,
|
||||
@@ -2579,7 +2589,7 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x04, /* INTERFACE */
|
||||
0x01, /* bInterfaceNumber */
|
||||
0x01, /* bAlternateSetting */
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
0x02, /* bNumEndpoints 2: audio EP and feedback EP */
|
||||
#else
|
||||
0x01, /* bNumEndpoints */
|
||||
@@ -2662,27 +2672,31 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x09,
|
||||
0x05, /* ENDPOINT */
|
||||
ENDPOINT_ADDRESS_OUT_AUDIO, /* endpointAddress - D7, direction (0 OUT, 1 IN). D6..4 reserved (0). D3..0 endpoint no. */
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#else
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
ISO_EP_ATTRIBUTES_ASYNC, /* Iso, async, data endpoint */
|
||||
#else
|
||||
ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
ISO_EP_ATTRIBUTES_SYNC, /* Iso, sync, data endpoint */
|
||||
#else
|
||||
#error "Unsupported XUA_SYNCMODE"
|
||||
#endif
|
||||
(FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff), /* 4 wMaxPacketSize (Typically 294 bytes)*/
|
||||
(FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */
|
||||
0x01, /* bInterval */
|
||||
0x00, /* bRefresh */
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
ENDPOINT_ADDRESS_IN_FEEDBACK, /* bSynchAdddress - address of EP used to communicate sync info */
|
||||
#else /* Bi-directional in/out device */
|
||||
#ifdef XUA_ADAPTIVE
|
||||
0, /* OUT */
|
||||
#else
|
||||
ENDPOINT_ADDRESS_IN_AUDIO,
|
||||
#endif
|
||||
#else /* Bi-directional in/out device */
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
ENDPOINT_ADDRESS_IN_AUDIO,
|
||||
#else
|
||||
0, /* Unused */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* CS_Endpoint Descriptor ?? */
|
||||
@@ -2691,13 +2705,13 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x01, /* subtype - GENERAL */
|
||||
0x01, /* attributes. D[0]: sample freq ctrl. */
|
||||
0x02, /* bLockDelayUnits */
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
0x08, 0x00, /* bLockDelay */
|
||||
#else
|
||||
0x00, 0x00, /* Not used */
|
||||
#endif
|
||||
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) && (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
/* Feedback EP */
|
||||
0x09,
|
||||
0x05, /* bDescriptorType: ENDPOINT */
|
||||
@@ -2806,14 +2820,18 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x09,
|
||||
0x05, /* ENDPOINT */
|
||||
ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
ISO_EP_ATTRIBUTES_ADAPTIVE,
|
||||
#else
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_ASYNC)
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
|
||||
ISO_EP_ATTRIBUTES_ASYNC, /* Iso, async, data endpoint */
|
||||
#else
|
||||
ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
|
||||
ISO_EP_IMPL_ATTRIBUTES_ASYNC, /* Feedback data endpoint */
|
||||
#endif
|
||||
#elif (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
ISO_EP_ATTRIBUTES_SYNC, /* Iso, sync, data endpoint */
|
||||
#else
|
||||
#error "Unsupported XUA_SYNCMODE"
|
||||
#endif
|
||||
FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/
|
||||
(FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */
|
||||
@@ -2826,13 +2844,13 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x25, /* CS_ENDPOINT */
|
||||
0x01, /* Subtype - GENERAL */
|
||||
0x01, /* Attributes. D[0]: sample freq ctrl. */
|
||||
#ifdef XUA_ADAPTIVE
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_ADAPT)
|
||||
0x02, /* Lock Delay units PCM samples*/
|
||||
0x08, 0x00, /* No lock delay */
|
||||
#else
|
||||
0x00, /* Undefined */
|
||||
0x00, 0x00, /* Not used */
|
||||
#endif // XUA_ADAPTIVE
|
||||
#endif
|
||||
#endif // NUM_USB_CHAN_IN > 0
|
||||
|
||||
#if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/**
|
||||
* @brief Implements relevant requests from the USB Audio 2.0 Specification
|
||||
@@ -14,29 +14,29 @@
|
||||
#include "usbaudio10.h"
|
||||
#include "dbcalc.h"
|
||||
#include "xua_commands.h"
|
||||
#include "xc_ptr.h"
|
||||
#ifdef MIXER
|
||||
#include "mixer.h"
|
||||
#endif
|
||||
|
||||
#define CS_XU_MIXSEL (0x06)
|
||||
|
||||
/* From decouple.xc */
|
||||
#if (OUT_VOLUME_IN_MIXER == 0) && (OUTPUT_VOLUME_CONTROL == 1)
|
||||
extern unsigned int multOut[NUM_USB_CHAN_OUT + 1];
|
||||
#endif
|
||||
#if (IN_VOLUME_IN_MIXER == 0) && (INPUT_VOLUME_CONTROL == 1)
|
||||
extern unsigned int multIn[NUM_USB_CHAN_IN + 1];
|
||||
#endif
|
||||
|
||||
extern int interfaceAlt[];
|
||||
|
||||
/* Global volume and mute tables */
|
||||
/* Global volume and mute tables - from xua_endpoint0.c */
|
||||
extern int volsOut[];
|
||||
extern unsigned int mutesOut[];
|
||||
|
||||
extern int volsIn[];
|
||||
extern unsigned int mutesIn[];
|
||||
|
||||
/* Mixer settings */
|
||||
#ifdef MIXER
|
||||
extern unsigned char mixer1Crossbar[];
|
||||
extern short mixer1Weights[];
|
||||
#if (MIXER)
|
||||
/* Mixer weights */
|
||||
extern short mixer1Weights[MIX_INPUTS * MAX_MIX_COUNT];
|
||||
|
||||
/* Device channel mapping */
|
||||
extern unsigned char channelMapAud[NUM_USB_CHAN_OUT];
|
||||
@@ -105,20 +105,6 @@ void FeedbackStabilityDelay()
|
||||
t when timerafter(time + delay):> void;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Original feedback implementation */
|
||||
unsafe
|
||||
{
|
||||
unsigned * unsafe curSamFreqMultiplier = &g_curSamFreqMultiplier;
|
||||
|
||||
static void setG_curSamFreqMultiplier(unsigned x)
|
||||
{
|
||||
// asm(" stw %0, dp[g_curSamFreqMultiplier]" :: "r"(x));
|
||||
*curSamFreqMultiplier = x;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (OUTPUT_VOLUME_CONTROL == 1) || (INPUT_VOLUME_CONTROL == 1)
|
||||
static unsigned longMul(unsigned a, unsigned b, int prec)
|
||||
{
|
||||
@@ -133,16 +119,9 @@ static unsigned longMul(unsigned a, unsigned b, int prec)
|
||||
}
|
||||
|
||||
/* Update master volume i.e. i.e update weights for all channels */
|
||||
static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
||||
static void updateMasterVol(int unitID, chanend ?c_mix_ctl)
|
||||
{
|
||||
int x;
|
||||
#ifndef OUT_VOLUME_IN_MIXER
|
||||
xc_ptr p_multOut = array_to_xc_ptr(multOut);
|
||||
#endif
|
||||
#ifndef IN_VOLUME_IN_MIXER
|
||||
xc_ptr p_multIn = array_to_xc_ptr(multIn);
|
||||
#endif
|
||||
switch( unitID)
|
||||
switch(unitID)
|
||||
{
|
||||
case FU_USBOUT:
|
||||
{
|
||||
@@ -154,18 +133,24 @@ static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
||||
/* 0x8000 is a special value representing -inf (i.e. mute) */
|
||||
unsigned vol = volsOut[i] == 0x8000 ? 0 : db_to_mult(volsOut[i], 8, 29);
|
||||
|
||||
x = longMul(master_vol, vol, 29) * !mutesOut[0] * !mutesOut[i];
|
||||
int x = longMul(master_vol, vol, 29) * !mutesOut[0] * !mutesOut[i];
|
||||
|
||||
#ifdef OUT_VOLUME_IN_MIXER
|
||||
#if (OUT_VOLUME_IN_MIXER)
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_OUT_VOL);
|
||||
outuint(c_mix_ctl, i-1);
|
||||
outuint(c_mix_ctl, x);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
#else
|
||||
asm("stw %0, %1[%2]"::"r"(x),"r"(p_multOut),"r"(i-1));
|
||||
#else
|
||||
unsafe
|
||||
{
|
||||
unsigned int * unsafe multOutPtr = multOut;
|
||||
multOutPtr[i-1] = x;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -180,18 +165,24 @@ static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
||||
/* 0x8000 is a special value representing -inf (i.e. mute) */
|
||||
unsigned vol = volsIn[i] == 0x8000 ? 0 : db_to_mult(volsIn[i], 8, 29);
|
||||
|
||||
x = longMul(master_vol, vol, 29) * !mutesIn[0] * !mutesIn[i];
|
||||
int x = longMul(master_vol, vol, 29) * !mutesIn[0] * !mutesIn[i];
|
||||
|
||||
#ifdef IN_VOLUME_IN_MIXER
|
||||
#if (IN_VOLUME_IN_MIXER)
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_IN_VOL);
|
||||
outuint(c_mix_ctl, i-1);
|
||||
outuint(c_mix_ctl, x);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
#else
|
||||
asm("stw %0, %1[%2]"::"r"(x),"r"(p_multIn),"r"(i-1));
|
||||
unsafe
|
||||
{
|
||||
unsigned int * unsafe multInPtr = multIn;
|
||||
multInPtr[i-1] = x;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -205,12 +196,6 @@ static void updateMasterVol( int unitID, chanend ?c_mix_ctl)
|
||||
static void updateVol(int unitID, int channel, chanend ?c_mix_ctl)
|
||||
{
|
||||
int x;
|
||||
#ifndef OUT_VOLUME_IN_MIXER
|
||||
xc_ptr p_multOut = array_to_xc_ptr(multOut);
|
||||
#endif
|
||||
#ifndef IN_VOLUME_IN_MIXER
|
||||
xc_ptr p_multIn = array_to_xc_ptr(multIn);
|
||||
#endif
|
||||
/* Check for master volume update */
|
||||
if (channel == 0)
|
||||
{
|
||||
@@ -229,16 +214,22 @@ static void updateVol(int unitID, int channel, chanend ?c_mix_ctl)
|
||||
|
||||
x = longMul(master_vol, vol, 29) * !mutesOut[0] * !mutesOut[channel];
|
||||
|
||||
#ifdef OUT_VOLUME_IN_MIXER
|
||||
#if (OUT_VOLUME_IN_MIXER)
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_OUT_VOL);
|
||||
outuint(c_mix_ctl, channel-1);
|
||||
outuint(c_mix_ctl, x);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
#else
|
||||
asm("stw %0, %1[%2]"::"r"(x),"r"(p_multOut),"r"(channel-1));
|
||||
unsafe
|
||||
{
|
||||
unsigned int * unsafe multOutPtr = multOut;
|
||||
multOutPtr[channel-1] = x;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -247,20 +238,26 @@ static void updateVol(int unitID, int channel, chanend ?c_mix_ctl)
|
||||
/* Calc multipliers with 29 fractional bits from a db value with 8 fractional bits */
|
||||
/* 0x8000 is a special value representing -inf (i.e. mute) */
|
||||
unsigned master_vol = volsIn[0] == 0x8000 ? 0 : db_to_mult(volsIn[0], 8, 29);
|
||||
unsigned vol = volsIn[channel] == 0x8000 ? 0 : db_to_mult(volsIn[channel], 8, 29);
|
||||
unsigned vol = volsIn[channel] == 0x8000 ? 0 : db_to_mult(volsIn[channel], 8, 29);
|
||||
|
||||
x = longMul(master_vol, vol, 29) * !mutesIn[0] * !mutesIn[channel];
|
||||
|
||||
#ifdef IN_VOLUME_IN_MIXER
|
||||
#if (IN_VOLUME_IN_MIXER)
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_IN_VOL);
|
||||
outuint(c_mix_ctl, channel-1);
|
||||
outuint(c_mix_ctl, x);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
#else
|
||||
asm("stw %0, %1[%2]"::"r"(x),"r"(p_multIn),"r"(channel-1));
|
||||
unsafe
|
||||
{
|
||||
unsigned int * unsafe multInPtr = multIn;
|
||||
multInPtr[channel-1] = x;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -269,6 +266,38 @@ static void updateVol(int unitID, int channel, chanend ?c_mix_ctl)
|
||||
}
|
||||
#endif
|
||||
|
||||
void UpdateMixerOutputRouting(chanend c_mix_ctl, unsigned map, unsigned dst, unsigned src)
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, map);
|
||||
outuint(c_mix_ctl, dst);
|
||||
outuint(c_mix_ctl, src);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
|
||||
void UpdateMixMap(chanend c_mix_ctl, int mix, int input, int src)
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_MAP);
|
||||
outuint(c_mix_ctl, mix); /* Mix bus */
|
||||
outuint(c_mix_ctl, input); /* Mixer input (cn) */
|
||||
outuint(c_mix_ctl, src); /* Source (mixSel[cn]) */
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
|
||||
void UpdateMixerWeight(chanend c_mix_ctl, int mix, int index, unsigned mult)
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, SET_MIX_MULT);
|
||||
outuint(c_mix_ctl, mix);
|
||||
outuint(c_mix_ctl, index);
|
||||
outuint(c_mix_ctl, mult);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
|
||||
/* Handles the audio class specific requests
|
||||
* returns: XUD_RES_OKAY if request dealt with successfully without error,
|
||||
* XUD_RES_RST for device reset
|
||||
@@ -285,7 +314,6 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
/* Inspect request, NOTE: these are class specific requests */
|
||||
switch( sp.bRequest )
|
||||
{
|
||||
|
||||
/* CUR Request*/
|
||||
case CUR:
|
||||
{
|
||||
@@ -341,7 +369,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
|
||||
setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512));
|
||||
#endif
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
/* Configure ADAT SMUX based on sample rate */
|
||||
outuint(c_clk_ctl, SET_SMUX);
|
||||
if(g_curSamFreq < 88200)
|
||||
@@ -374,7 +402,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
}
|
||||
#endif /* MAX_FREQ != MIN_FREQ */
|
||||
/* Send 0 Length as status stage */
|
||||
XUD_DoSetRequestStatus(ep0_in);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
/* Direction: Device-to-host: Send Current Sample Freq */
|
||||
else
|
||||
@@ -540,7 +568,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
if ((sp.wValue & 0xff) <= NUM_USB_CHAN_OUT)
|
||||
{
|
||||
volsOut[ sp.wValue&0xff ] = (buffer, unsigned char[])[0] | (((int) (signed char) (buffer, unsigned char[])[1]) << 8);
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
}
|
||||
@@ -549,7 +577,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
if ((sp.wValue & 0xff) <= NUM_USB_CHAN_IN)
|
||||
{
|
||||
volsIn[ sp.wValue&0xff ] = (buffer, unsigned char[])[0] | (((int) (signed char) (buffer, unsigned char[])[1]) << 8);
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
}
|
||||
@@ -635,85 +663,76 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
break; /* FU_USBIN */
|
||||
#endif
|
||||
|
||||
#if defined(MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if ((MIXER) && (MAX_MIX_COUNT > 0))
|
||||
case ID_XU_OUT:
|
||||
{
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
unsigned volume = 0;
|
||||
int c = sp.wValue & 0xff;
|
||||
int dst = sp.wValue & 0xff;
|
||||
|
||||
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
channelMapAud[c] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
if (c < NUM_USB_CHAN_OUT)
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
{
|
||||
outuint(c_mix_ctl, SET_SAMPLES_TO_DEVICE_MAP);
|
||||
outuint(c_mix_ctl, c);
|
||||
outuint(c_mix_ctl, channelMapAud[c]);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
/* Send 0 Length as status stage */
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (dst < NUM_USB_CHAN_OUT)
|
||||
{
|
||||
channelMapAud[dst] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_DEVICE_MAP, dst, channelMapAud[dst]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send 0 Length as status stage */
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
(buffer, unsigned char[])[0] = channelMapAud[dst];
|
||||
(buffer, unsigned char[])[1] = 0;
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
(buffer, unsigned char[])[0] = channelMapAud[sp.wValue & 0xff];
|
||||
(buffer, unsigned char[])[1] = 0;
|
||||
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_XU_IN:
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
unsigned volume = 0;
|
||||
int c = sp.wValue & 0xff;
|
||||
int dst = sp.wValue & 0xff;
|
||||
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
channelMapUsb[c] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
|
||||
if (c < NUM_USB_CHAN_IN)
|
||||
{
|
||||
if (!isnull(c_mix_ctl))
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
{
|
||||
outuint(c_mix_ctl, SET_SAMPLES_TO_HOST_MAP);
|
||||
outuint(c_mix_ctl, c);
|
||||
outuint(c_mix_ctl, channelMapUsb[c]);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (dst < NUM_USB_CHAN_IN)
|
||||
{
|
||||
channelMapUsb[dst] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_HOST_MAP, dst, channelMapUsb[dst]);
|
||||
}
|
||||
}
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Direction: Device-to-host */
|
||||
(buffer, unsigned char[])[0] = channelMapUsb[dst];
|
||||
(buffer, unsigned char[])[1] = 0;
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Direction: Device-to-host */
|
||||
(buffer, unsigned char[])[0] = channelMapUsb[sp.wValue & 0xff];
|
||||
(buffer, unsigned char[])[1] = 0;
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_XU_MIXSEL:
|
||||
{
|
||||
int cs = sp.wValue >> 8; /* Control Selector */
|
||||
int cn = sp.wValue & 0xff; /* Channel number */
|
||||
int cn = sp.wValue & 0xff; /* Channel Number */
|
||||
|
||||
/* Check for Get or Set */
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D)
|
||||
@@ -726,21 +745,19 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
|
||||
if(datalength > 0)
|
||||
{
|
||||
/* cn bounds check for safety..*/
|
||||
/* CN bounds check for safety..*/
|
||||
if(cn < MIX_INPUTS)
|
||||
{
|
||||
//if(cs == CS_XU_MIXSEL)
|
||||
/* cs now contains mix number */
|
||||
if(cs < (MAX_MIX_COUNT + 1))
|
||||
{
|
||||
int source = (buffer, unsigned char[])[0];
|
||||
|
||||
/* Check for "off" - update local state */
|
||||
if((buffer, unsigned char[])[0] == 0xFF)
|
||||
if(source == 0xFF)
|
||||
{
|
||||
mixSel[cs][cn] = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
|
||||
}
|
||||
else
|
||||
{
|
||||
mixSel[cs][cn] = (buffer, unsigned char[])[0];
|
||||
source = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
|
||||
}
|
||||
|
||||
if(cs == 0)
|
||||
@@ -748,21 +765,17 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
/* Update all mix maps */
|
||||
for (int i = 0; i < MAX_MIX_COUNT; i++)
|
||||
{
|
||||
outuint(c_mix_ctl, SET_MIX_MAP);
|
||||
outuint(c_mix_ctl, i); /* Mix bus */
|
||||
outuint(c_mix_ctl, cn); /* Mixer input */
|
||||
outuint(c_mix_ctl, (int) mixSel[cn]); /* Source */
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
/* i : Mix bus */
|
||||
/* cn: Mixer input */
|
||||
mixSel[i][cn] = source;
|
||||
UpdateMixMap(c_mix_ctl, i, cn, mixSel[i][cn]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Update relevant mix map */
|
||||
outuint(c_mix_ctl, SET_MIX_MAP); /* Command */
|
||||
outuint(c_mix_ctl, (cs-1)); /* Mix bus */
|
||||
outuint(c_mix_ctl, cn); /* Mixer input */
|
||||
outuint(c_mix_ctl, (int) mixSel[cs][cn]); /* Source */
|
||||
outct(c_mix_ctl, XS1_CT_END); /* Wait for handshake back */
|
||||
mixSel[cs-1][cn] = source;
|
||||
UpdateMixMap(c_mix_ctl, cs-1, cn, mixSel[cs-1][cn]);
|
||||
}
|
||||
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
@@ -783,7 +796,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
if((cs > 0) && (cs < (MAX_MIX_COUNT+1)))
|
||||
{
|
||||
(buffer, unsigned char[])[0] = mixSel[cs-1][cn];
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, 1 );
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -791,49 +804,53 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
}
|
||||
|
||||
case ID_MIXER_1:
|
||||
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
unsigned volume = 0;
|
||||
int cs = sp.wValue >> 8; /* Control Selector - currently unused */
|
||||
int cn = sp.wValue & 0xff; /* Channel number - used for mixer node index */
|
||||
|
||||
/* Expect OUT here with mute */
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||
{
|
||||
return result;
|
||||
}
|
||||
unsigned weightMult = 0;
|
||||
|
||||
mixer1Weights[sp.wValue & 0xff] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
/* Expect OUT here with weight */
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if (mixer1Weights[sp.wValue & 0xff] == 0x8000)
|
||||
{
|
||||
volume = 0;
|
||||
if(cn < sizeof(mixer1Weights)/sizeof(mixer1Weights[0]))
|
||||
{
|
||||
mixer1Weights[cn] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||
|
||||
if (mixer1Weights[cn] != 0x8000)
|
||||
{
|
||||
weightMult = db_to_mult(mixer1Weights[cn], XUA_MIXER_DB_FRAC_BITS, XUA_MIXER_MULT_FRAC_BITS);
|
||||
}
|
||||
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
UpdateMixerWeight(c_mix_ctl, (cn) % 8, (cn) / 8, weightMult);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send 0 Length as status stage */
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
volume = db_to_mult(mixer1Weights[sp.wValue & 0xff], 8, 25);
|
||||
}
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outuint(c_mix_ctl, SET_MIX_MULT);
|
||||
outuint(c_mix_ctl, (sp.wValue & 0xff) % 8);
|
||||
outuint(c_mix_ctl, (sp.wValue & 0xff) / 8);
|
||||
outuint(c_mix_ctl, volume);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
}
|
||||
short weight = 0x8000;
|
||||
|
||||
/* Send 0 Length as status stage */
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
short weight = mixer1Weights[sp.wValue & 0xff];
|
||||
(buffer, unsigned char[])[0] = weight & 0xff;
|
||||
(buffer, unsigned char[])[1] = (weight >> 8) & 0xff;
|
||||
if(cn < sizeof(mixer1Weights)/sizeof(mixer1Weights[0]))
|
||||
{
|
||||
weight = mixer1Weights[cn];
|
||||
}
|
||||
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
storeShort((buffer, unsigned char[]), 0, weight);
|
||||
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
/* We dont have a unit with this ID! */
|
||||
@@ -922,7 +939,6 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
num_freqs++;
|
||||
}
|
||||
#endif
|
||||
|
||||
storeShort((buffer, unsigned char[]), 0, num_freqs);
|
||||
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), i, sp.wLength);
|
||||
@@ -960,7 +976,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
/* Mixer Unit */
|
||||
case ID_MIXER_1:
|
||||
storeShort((buffer, unsigned char[]), 0, 1);
|
||||
@@ -970,7 +986,6 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* Unknown Unit ID in Range Request selector for FU */
|
||||
break;
|
||||
@@ -980,7 +995,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
break; /* case: RANGE */
|
||||
}
|
||||
|
||||
#if defined (MIXER) && (MAX_MIX_COUNT > 0)
|
||||
#if ((MIXER) && (MAX_MIX_COUNT > 0))
|
||||
case MEM: /* Memory Requests (5.2.7.1) */
|
||||
|
||||
unitID = sp.wIndex >> 8;
|
||||
@@ -1006,6 +1021,8 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
{
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, GET_STREAM_LEVELS);
|
||||
outuint(c_mix_ctl, i);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
@@ -1021,6 +1038,8 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
{
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, GET_INPUT_LEVELS);
|
||||
outuint(c_mix_ctl, (i - NUM_USB_CHAN_OUT));
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
@@ -1043,6 +1062,8 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
||||
{
|
||||
if (!isnull(c_mix_ctl))
|
||||
{
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
inct(c_mix_ctl);
|
||||
outuint(c_mix_ctl, GET_OUTPUT_LEVELS);
|
||||
outuint(c_mix_ctl, i);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
@@ -1095,7 +1116,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp
|
||||
/* Check Control Selector */
|
||||
unsigned short controlSelector = sp.wValue>>8;
|
||||
|
||||
if((result != XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), length)) != XUD_RES_OKAY)
|
||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), length)) != XUD_RES_OKAY)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -1110,13 +1131,10 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp
|
||||
|
||||
if(newSampleRate != g_curSamFreq)
|
||||
{
|
||||
int curSamFreq44100Family;
|
||||
int curSamFreq48000Family;
|
||||
|
||||
/* Windows Audio Class driver has a nice habbit of sending invalid SF's (e.g. 48001Hz)
|
||||
* when under stress. Lets double check it here and ignore if not valid. */
|
||||
curSamFreq48000Family = MCLK_48 % newSampleRate == 0;
|
||||
curSamFreq44100Family = MCLK_441 % newSampleRate == 0;
|
||||
int curSamFreq48000Family = MCLK_48 % newSampleRate == 0;
|
||||
int curSamFreq44100Family = MCLK_441 % newSampleRate == 0;
|
||||
|
||||
if(curSamFreq48000Family || curSamFreq44100Family)
|
||||
{
|
||||
@@ -1131,7 +1149,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp
|
||||
|
||||
/* Allow time for the change - feedback to stabilise */
|
||||
FeedbackStabilityDelay();
|
||||
}
|
||||
}
|
||||
}
|
||||
return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0);
|
||||
}
|
||||
@@ -1193,12 +1211,12 @@ XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket
|
||||
{
|
||||
case FU_USBOUT:
|
||||
volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
|
||||
case FU_USBIN:
|
||||
volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
}
|
||||
@@ -1212,12 +1230,12 @@ XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket
|
||||
{
|
||||
case FU_USBOUT:
|
||||
mutesOut[ sp.wValue & 0xff ] = buffer[0];
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
|
||||
case FU_USBIN:
|
||||
mutesIn[ sp.wValue & 0xff ] = buffer[0];
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
|
||||
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl);
|
||||
return XUD_DoSetRequestStatus(ep0_in);
|
||||
}
|
||||
}
|
||||
@@ -1280,9 +1298,12 @@ XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket
|
||||
buffer[0] = (VOLUME_RES_MIXER & 0xff);
|
||||
buffer[1] = (VOLUME_RES_MIXER >> 8);
|
||||
return XUD_DoGetRequest(ep0_out, ep0_in, buffer, 2, sp.wLength);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return XUD_RES_ERR;
|
||||
}
|
||||
#endif
|
||||
#endif /* NO_USB */
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2012-2021 XMOS LIMITED.
|
||||
// Copyright 2012-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include "xua.h" /* Device specific defines */
|
||||
@@ -24,29 +24,20 @@
|
||||
#endif
|
||||
|
||||
#include "uac_hwresources.h"
|
||||
#ifdef MIDI
|
||||
#include "usb_midi.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAP
|
||||
#include "i2c_shared.h"
|
||||
#include "iap.h"
|
||||
#endif
|
||||
|
||||
#ifdef MIXER
|
||||
#include "mixer.h"
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX == 1)
|
||||
#include "SpdifReceive.h"
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
#include "adat_rx.h"
|
||||
#endif
|
||||
|
||||
#include "clocking.h"
|
||||
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
#include "xua_pdm_mic.h"
|
||||
#endif
|
||||
@@ -134,29 +125,29 @@ on tile[AUDIO_IO_TILE] : buffered out port:32 p_bclk = PORT_I2S_BCLK;
|
||||
|
||||
on tile[AUDIO_IO_TILE] : in port p_mclk_in = PORT_MCLK_IN;
|
||||
|
||||
#if XUA_USB_EN
|
||||
#if XUA_USB_EN
|
||||
on tile[XUD_TILE] : in port p_for_mclk_count = PORT_MCLK_COUNT;
|
||||
#endif
|
||||
|
||||
#if (XUA_SPDIF_TX_EN == 1)
|
||||
#if (XUA_SPDIF_TX_EN)
|
||||
on tile[SPDIF_TX_TILE] : buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT;
|
||||
#endif
|
||||
|
||||
#ifdef ADAT_TX
|
||||
#if (XUA_ADAT_TX_EN)
|
||||
on stdcore[AUDIO_IO_TILE] : buffered out port:32 p_adat_tx = PORT_ADAT_OUT;
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
on stdcore[XUD_TILE] : buffered in port:32 p_adat_rx = PORT_ADAT_IN;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX == 1)
|
||||
on tile[XUD_TILE] : buffered in port:4 p_spdif_rx = PORT_SPDIF_IN;
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
on tile[XUD_TILE] : in port p_spdif_rx = PORT_SPDIF_IN;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX == 1) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN) || (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
/* Reference to external clock multiplier */
|
||||
on tile[AUDIO_IO_TILE] : out port p_pll_clk = PORT_PLL_REF;
|
||||
on tile[PLL_REF_TILE] : out port p_pll_ref = PORT_PLL_REF;
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
@@ -178,32 +169,24 @@ clock clk_pdm = on tile[PDM_TILE]:
|
||||
on tile[MIDI_TILE] : clock clk_midi = CLKBLK_MIDI;
|
||||
#endif
|
||||
|
||||
#if XUA_SPDIF_TX_EN || defined(ADAT_TX)
|
||||
#if (XUA_SPDIF_TX_EN || XUA_ADAT_TX_EN)
|
||||
on tile[SPDIF_TX_TILE] : clock clk_mst_spd = CLKBLK_SPDIF_TX;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX == 1)
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
on tile[XUD_TILE] : clock clk_spd_rx = CLKBLK_SPDIF_RX;
|
||||
#endif
|
||||
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
in port p_pdm_clk = PORT_PDM_CLK;
|
||||
in port p_pdm_clk = PORT_PDM_CLK;
|
||||
|
||||
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
|
||||
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
|
||||
#if (PDM_TILE != AUDIO_IO_TILE)
|
||||
/* If Mics and I2S are not the same tile we need a separate MCLK port */
|
||||
in port p_pdm_mclk = PORT_PDM_MCLK;
|
||||
in port p_pdm_mclk = PORT_PDM_MCLK;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if(XUD_SERIES_SUPPORT == XUD_L_SERIES) && (ADAT_RX)
|
||||
/* Cannot use default clock (CLKBLK_REF) for ADAT RX since it is tied to the
|
||||
60MHz USB clock on G/L series parts. */
|
||||
on tile[XUD_TILE] : clock clk_adat_rx = CLKBLK_ADAT_RX;
|
||||
#endif
|
||||
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_mclk = CLKBLK_MCLK; /* Master clock */
|
||||
|
||||
#if(AUDIO_IO_TILE != XUD_TILE) && XUA_USB_EN
|
||||
@@ -212,17 +195,7 @@ on tile[XUD_TILE] : clock clk_audio_mclk_usb = CLKBLK_MCLK;
|
||||
on tile[XUD_TILE] : in port p_mclk_in_usb = PORT_MCLK_IN_USB;
|
||||
#endif
|
||||
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */
|
||||
|
||||
|
||||
/* L/G Series needs a port to use for USB reset */
|
||||
#if (XUD_SERIES_SUPPORT != XUD_U_SERIES) && defined(PORT_USB_RESET)
|
||||
/* This define is checked since it could be on a shift reg or similar */
|
||||
on tile[XUD_TILE] : out port p_usb_rst = PORT_USB_RESET;
|
||||
#else
|
||||
/* Reset port not required for U series due to built in Phy */
|
||||
#define p_usb_rst null
|
||||
#endif
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */
|
||||
|
||||
#ifdef IAP
|
||||
/* I2C ports - in a struct for use with module_i2c_shared & module_i2c_simple/module_i2c_single_port */
|
||||
@@ -254,8 +227,8 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||
XUD_EPTYPE_ISO, /* Async feedback endpoint */
|
||||
#endif
|
||||
#if (SPDIF_RX == 1) || (ADAT_RX)
|
||||
XUD_EPTYPE_BUL,
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
XUD_EPTYPE_INT,
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
XUD_EPTYPE_BUL,
|
||||
@@ -298,20 +271,17 @@ void xscope_user_init()
|
||||
/* 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
|
||||
, chanend c_midi
|
||||
, chanend c_midi
|
||||
#endif
|
||||
#ifdef IAP
|
||||
, chanend c_iap
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
, chanend c_ea_data
|
||||
#if (MIXER)
|
||||
, chanend c_mix_ctl
|
||||
#endif
|
||||
, chanend ?c_clk_int
|
||||
, chanend ?c_clk_ctl
|
||||
, client interface i_dfu ?dfuInterface
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
#ifdef MIXER
|
||||
, chanend c_mix_ctl
|
||||
#endif
|
||||
, chanend ?c_clk_int
|
||||
, chanend ?c_clk_ctl
|
||||
, client interface i_dfu ?dfuInterface
|
||||
VENDOR_REQUESTS_PARAMS_DEC_
|
||||
)
|
||||
{
|
||||
@@ -319,12 +289,8 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
|
||||
chan c_xud_in[ENDPOINT_COUNT_IN];
|
||||
chan c_aud_ctl;
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
#warning Using channel to control buffering - this may reduce performance but improve power consumption
|
||||
chan c_buff_ctrl;
|
||||
#endif
|
||||
|
||||
#ifndef MIXER
|
||||
#if (!MIXER)
|
||||
#define c_mix_ctl null
|
||||
#endif
|
||||
|
||||
@@ -344,13 +310,13 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
|
||||
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
|
||||
|
||||
/* USB Interface Core */
|
||||
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
|
||||
|
||||
/* USB interface core */
|
||||
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
||||
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
|
||||
null, 0, usbSpeed, XUD_PWR_CFG);
|
||||
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
|
||||
}
|
||||
|
||||
/* USB Packet buffering Core */
|
||||
{
|
||||
unsigned x;
|
||||
thread_speed();
|
||||
@@ -367,7 +333,7 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
asm("ldw %0, dp[clk_audio_mclk]":"=r"(x));
|
||||
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
|
||||
#endif
|
||||
//:buffer
|
||||
/* Endpoint & audio buffering cores */
|
||||
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
|
||||
@@ -381,33 +347,19 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
|
||||
c_midi,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
c_xud_out[ENDPOINT_NUMBER_OUT_IAP], /* iAP Out */
|
||||
c_xud_in[ENDPOINT_NUMBER_IN_IAP], /* iAP In */
|
||||
#ifdef IAP_INT_EP
|
||||
c_xud_in[ENDPOINT_NUMBER_IN_IAP_INT], /* iAP Interrupt In */
|
||||
#endif
|
||||
c_iap,
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
c_xud_out[ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS],
|
||||
c_xud_in[ENDPOINT_NUMBER_IN_IAP_EA_NATIVE_TRANS],
|
||||
c_EANativeTransport_ctrl,
|
||||
c_ea_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
/* Audio Interrupt - only used for interrupts on external clock change */
|
||||
c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT],
|
||||
c_clk_int,
|
||||
#endif
|
||||
c_sof, c_aud_ctl, p_for_mclk_count
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#if (HID_CONTROLS)
|
||||
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, c_buff_ctrl
|
||||
#endif
|
||||
, c_mix_out
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, i_pll_ref
|
||||
#endif
|
||||
);
|
||||
//:
|
||||
}
|
||||
@@ -445,11 +397,11 @@ void SpdifTxWrapper(chanend c_spdif_tx)
|
||||
}
|
||||
#endif
|
||||
|
||||
void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
void usb_audio_io(chanend ?c_aud_in,
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
chanend c_spdif_tx,
|
||||
#endif
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
chanend c_mix_ctl,
|
||||
#endif
|
||||
streaming chanend ?c_spdif_rx,
|
||||
@@ -465,13 +417,16 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
#endif
|
||||
, chanend c_pdm_pcm
|
||||
#endif
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
, client interface pll_ref_if i_pll_ref
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
chan c_mix_out;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
chan c_dig_rx;
|
||||
#else
|
||||
#define c_dig_rx null
|
||||
@@ -491,7 +446,7 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
|
||||
par
|
||||
{
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
/* Mixer cores(s) */
|
||||
{
|
||||
thread_speed();
|
||||
@@ -506,10 +461,10 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio I/O Core (pars additional S/PDIF TX Core) */
|
||||
/* Audio I/O core (pars additional S/PDIF TX Core) */
|
||||
{
|
||||
thread_speed();
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
#define AUDIO_CHANNEL c_mix_out
|
||||
#else
|
||||
#define AUDIO_CHANNEL c_aud_in
|
||||
@@ -518,7 +473,7 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
#if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
, c_spdif_tx
|
||||
#endif
|
||||
#if (SPDIF_RX) ||(ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
, c_dig_rx
|
||||
#endif
|
||||
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
|
||||
@@ -534,11 +489,13 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
xua_pdm_mic(c_ds_output, p_pdm_mics);
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
{
|
||||
/* ClockGen must currently run on same tile as AudioHub due to shared memory buffer
|
||||
* However, due to the use of an interface the pll reference signal port can be on another tile
|
||||
*/
|
||||
thread_speed();
|
||||
|
||||
clockGen(c_spdif_rx, c_adat_rx, p_pll_clk, c_dig_rx, c_clk_ctl, c_clk_int);
|
||||
clockGen(c_spdif_rx, c_adat_rx, i_pll_ref, c_dig_rx, c_clk_ctl, c_clk_int);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -573,23 +530,18 @@ int main()
|
||||
chan c_ea_data;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SU1_ADC_ENABLE
|
||||
chan c_adc;
|
||||
#else
|
||||
#define c_adc null
|
||||
#endif
|
||||
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
chan c_mix_ctl;
|
||||
#endif
|
||||
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
streaming chan c_spdif_rx;
|
||||
#else
|
||||
#define c_spdif_rx null
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
chan c_adat_rx;
|
||||
#else
|
||||
#define c_adat_rx null
|
||||
@@ -599,8 +551,7 @@ int main()
|
||||
chan c_spdif_tx;
|
||||
#endif
|
||||
|
||||
|
||||
#if ((SPDIF_RX) || (ADAT_RX))
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
chan c_clk_ctl;
|
||||
chan c_clk_int;
|
||||
#else
|
||||
@@ -622,12 +573,19 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
interface pll_ref_if i_pll_ref;
|
||||
#endif
|
||||
|
||||
USER_MAIN_DECLARATIONS
|
||||
|
||||
par
|
||||
{
|
||||
USER_MAIN_CORES
|
||||
|
||||
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
on tile[PLL_REF_TILE]: PllRefPinTask(i_pll_ref, p_pll_ref);
|
||||
#endif
|
||||
on tile[XUD_TILE]:
|
||||
par
|
||||
{
|
||||
@@ -639,6 +597,7 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
#if XUA_USB_EN
|
||||
/* Core USB audio task, buffering, USB etc */
|
||||
usb_audio_core(c_mix_out
|
||||
#ifdef MIDI
|
||||
, c_midi
|
||||
@@ -649,23 +608,27 @@ int main()
|
||||
, c_ea_data
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
, c_mix_ctl
|
||||
#endif
|
||||
, c_clk_int, c_clk_ctl, dfuInterface
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, i_pll_ref
|
||||
#endif
|
||||
VENDOR_REQUESTS_PARAMS_
|
||||
|
||||
);
|
||||
#endif /* XUA_USB_EN */
|
||||
}
|
||||
|
||||
on tile[AUDIO_IO_TILE]:
|
||||
on tile[AUDIO_IO_TILE]:
|
||||
{
|
||||
usb_audio_io(c_mix_out, c_adc
|
||||
/* Audio I/O task, includes mixing etc */
|
||||
usb_audio_io(c_mix_out
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
, c_spdif_tx
|
||||
#endif
|
||||
#ifdef MIXER
|
||||
#if (MIXER)
|
||||
, c_mix_ctl
|
||||
#endif
|
||||
, c_spdif_rx, c_adat_rx, c_clk_ctl, c_clk_int
|
||||
@@ -677,9 +640,13 @@ int main()
|
||||
, c_ds_output
|
||||
#endif
|
||||
, c_pdm_pcm
|
||||
#endif
|
||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||
, i_pll_ref
|
||||
#endif
|
||||
);
|
||||
}
|
||||
//:
|
||||
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
on tile[SPDIF_TX_TILE]:
|
||||
@@ -702,7 +669,7 @@ int main()
|
||||
on tile[MIDI_TILE]:
|
||||
{
|
||||
thread_speed();
|
||||
usb_midi(p_midi_rx, p_midi_tx, clk_midi, c_midi, 0, null, null, null, null);
|
||||
usb_midi(p_midi_rx, p_midi_tx, clk_midi, c_midi, 0);
|
||||
}
|
||||
#endif
|
||||
#if defined(IAP)
|
||||
@@ -714,24 +681,19 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SPDIF_RX
|
||||
#if (XUA_SPDIF_RX_EN)
|
||||
on tile[XUD_TILE]:
|
||||
{
|
||||
thread_speed();
|
||||
SpdifReceive(p_spdif_rx, c_spdif_rx, 1, clk_spd_rx);
|
||||
spdif_rx(c_spdif_rx,p_spdif_rx,clk_spd_rx,192000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (ADAT_RX)
|
||||
#if (XUA_ADAT_RX_EN)
|
||||
on stdcore[XUD_TILE] :
|
||||
{
|
||||
set_thread_fast_mode_on();
|
||||
|
||||
#if(XUD_SERIES_SUPPORT == XUD_L_SERIES)
|
||||
/* Can't use REF clock on L-series as this is usb clock */
|
||||
set_port_clock(p_adat_rx, clk_adat_rx);
|
||||
start_clock(clk_adat_rx);
|
||||
#endif
|
||||
while (1)
|
||||
{
|
||||
adatReceiver48000(p_adat_rx, c_adat_rx);
|
||||
@@ -744,17 +706,17 @@ int main()
|
||||
#if XUA_USB_EN
|
||||
#if (XUD_TILE != 0 ) && (AUDIO_IO_TILE != 0) && (XUA_DFU_EN == 1)
|
||||
/* Run flash code on its own - hope it gets combined */
|
||||
//#warning Running DFU flash code on its own
|
||||
//#warning Running DFU flash code on its own
|
||||
on stdcore[0]: DFUHandler(dfuInterface, null);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PDM_RECORD
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
#if (PDM_TILE != AUDIO_IO_TILE)
|
||||
/* PDM Mics running on a separate to AudioHub */
|
||||
on stdcore[PDM_TILE]:
|
||||
{
|
||||
{
|
||||
xua_pdm_mic_config(p_pdm_mclk, p_pdm_clk, p_pdm_mics, clk_pdm);
|
||||
xua_pdm_mic(c_ds_output, p_pdm_mics);
|
||||
}
|
||||
@@ -767,11 +729,6 @@ int main()
|
||||
#endif /*MIC_PROCESSING_USE_INTERFACE*/
|
||||
#endif /*XUA_NUM_PDM_MICS > 0*/
|
||||
#endif /*PDM_RECORD*/
|
||||
|
||||
|
||||
#ifdef SU1_ADC_ENABLE
|
||||
xs1_su_adc_service(c_adc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// Copyright 2018-2021 XMOS LIMITED.
|
||||
// Copyright 2018-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
//#include "devicedefines.h"
|
||||
|
||||
#define MAX_MIX_COUNT 8
|
||||
#define MIX_INPUTS 18
|
||||
#include "xua.h"
|
||||
|
||||
#ifndef MAX_MIX_COUNT
|
||||
#error
|
||||
#endif
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
#ifndef MIX_INPUTS
|
||||
#error
|
||||
#endif
|
||||
|
||||
#if (MAX_MIX_COUNT > 0)
|
||||
|
||||
#define DOMIX_TOP(i) \
|
||||
.cc_top doMix##i.function,doMix##i; \
|
||||
.align 4 ;\
|
||||
.align 16 ;\
|
||||
.globl doMix##i ;\
|
||||
.type doMix##i, @function ;\
|
||||
.globl doMix##i##.nstackwords ;\
|
||||
@@ -50,52 +55,6 @@ doMix##i##: ;\
|
||||
.size doMix##i, .-doMix##i; \
|
||||
.cc_bottom doMix##i##.function;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#define DOMIX_TOP(i) \
|
||||
.cc_top doMix##i.function,doMix##i; \
|
||||
.align 4 ;\
|
||||
.globl doMix##i ;\
|
||||
.type doMix##i, @function ;\
|
||||
.globl doMix##i##.nstackwords ;\
|
||||
.globl doMix##i##.maxthreads ; \
|
||||
.globl doMix##i##.maxtimers ; \
|
||||
.globl doMix##i##.maxchanends ; \
|
||||
.globl doMix##i##.maxsync ;\
|
||||
.linkset doMix##i##.locnoside, 1; \
|
||||
.linkset doMix##i##.locnochandec, 1;\
|
||||
.linkset doMix##i##.nstackwords, 0 ;\
|
||||
.linkset doMix##i##.maxchanends, 0 ;\
|
||||
.linkset doMix##i##.maxtimers, 0 ;\
|
||||
.linkset doMix##i##.maxthreads, 1; \
|
||||
doMix##i##: ;\
|
||||
set cp, r0; \
|
||||
set dp, r1; \
|
||||
lsub r0, r1, r0, r0, r0;\
|
||||
.label_##i##:
|
||||
|
||||
#define DOMIX_BOT(i) \
|
||||
ldap r11, _dp; \
|
||||
set dp, r11;\
|
||||
ldap r11, _cp;\
|
||||
set cp, r11;\
|
||||
\
|
||||
mov r0, r1;\
|
||||
ldc r2, 0x19;\
|
||||
sext r0, r2;\
|
||||
eq r0, r0, r1;\
|
||||
bf r0, .L20; \
|
||||
\
|
||||
shl r0, r1, 0x7;\
|
||||
retsp 0x0;\
|
||||
\
|
||||
\
|
||||
.size doMix##i, .-doMix##i; \
|
||||
.cc_bottom doMix##i##.function;
|
||||
|
||||
#endif
|
||||
|
||||
#define N MIX_INPUTS
|
||||
#define BODY(i) \
|
||||
ldw r2,cp[i]; \
|
||||
@@ -115,8 +74,6 @@ doMix##i##: ;\
|
||||
retsp 0x0; \
|
||||
|
||||
|
||||
|
||||
|
||||
#if(MAX_MIX_COUNT > 0)
|
||||
DOMIX_TOP(0)
|
||||
#include "repeat.h"
|
||||
@@ -176,7 +133,7 @@ DOMIX_BOT(7)
|
||||
#undef BODY
|
||||
#define N MAX_MIX_COUNT
|
||||
.cc_top setPtr.function,setPtr;
|
||||
.align 4 ;
|
||||
.align 16 ;
|
||||
.globl setPtr;
|
||||
.type setPtr, @function
|
||||
.globl setPtr.nstackwords;
|
||||
@@ -225,5 +182,5 @@ setPtr_go:
|
||||
#undef N
|
||||
#undef BODY
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// Copyright 2015-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include "xua.h"
|
||||
@@ -22,7 +22,7 @@
|
||||
#define MAX_DECIMATION_FACTOR (96000/(MIN_FREQ/AUD_TO_MICS_RATIO))
|
||||
|
||||
/* Build time sized microphone delay line */
|
||||
#ifndef MIC_BUFFER_DEPTH
|
||||
#ifndef MIC_BUFFER_DEPTH
|
||||
#define MIC_BUFFER_DEPTH 1
|
||||
#endif
|
||||
|
||||
@@ -229,7 +229,7 @@ void xua_pdm_mic_config(in port p_pdm_mclk, in port p_pdm_clk, buffered in port:
|
||||
unsigned micDiv = MCLK_48/3072000;
|
||||
|
||||
configure_clock_src_divide(clk_pdm, p_pdm_mclk, micDiv/2);
|
||||
|
||||
|
||||
configure_port_clock_output(p_pdm_clk, clk_pdm);
|
||||
configure_in_port(p_pdm_mics, clk_pdm);
|
||||
start_clock(clk_pdm);
|
||||
@@ -243,7 +243,7 @@ void xua_pdm_mic(streaming chanend c_ds_output[2], buffered in port:32 p_pdm_mic
|
||||
#else
|
||||
#define c_4x_pdm_mic_1 null
|
||||
#endif
|
||||
|
||||
|
||||
par
|
||||
{
|
||||
mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// Copyright 2013-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include <xs1.h>
|
||||
@@ -6,21 +6,20 @@
|
||||
#include <platform.h>
|
||||
#undef __ASSEMBLER__
|
||||
#include "audioports.h"
|
||||
#include <xccompat.h>
|
||||
#include "xua.h"
|
||||
|
||||
/* 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_DSD_DAC0,
|
||||
#endif
|
||||
#if DSD_CHANS_DAC > 1
|
||||
#if (DSD_CHANS_DAC > 1)
|
||||
PORT_DSD_DAC1,
|
||||
#endif
|
||||
#if DSD_CHANS_DAC > 2
|
||||
#if (DSD_CHANS_DAC > 2)
|
||||
#error > 2 DSD chans currently not supported
|
||||
#endif
|
||||
#if DSD_CHANS_DAC > 0
|
||||
#if (DSD_CHANS_DAC > 0)
|
||||
};
|
||||
port p_dsd_clk = PORT_DSD_CLK;
|
||||
#endif
|
||||
@@ -46,7 +45,7 @@ void ConfigAudioPortsWrapper(
|
||||
port p_lrclk,
|
||||
port p_bclk,
|
||||
#endif
|
||||
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode)
|
||||
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq)
|
||||
{
|
||||
ConfigAudioPorts(
|
||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||
@@ -61,6 +60,6 @@ unsigned int divide, unsigned curSamFreq, unsigned int dsdMode)
|
||||
p_lrclk,
|
||||
p_bclk,
|
||||
#endif
|
||||
divide, curSamFreq);
|
||||
p_mclk_in, clk_audio_bclk, divide, curSamFreq);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef _AUDIOPORTS_H_
|
||||
#define _AUDIOPORTS_H_
|
||||
|
||||
#include <xccompat.h>
|
||||
#ifdef __STDC__
|
||||
typedef unsigned clock;
|
||||
#endif
|
||||
#include "xua.h"
|
||||
|
||||
#ifdef __XC__
|
||||
@@ -28,7 +31,7 @@ void ConfigAudioPorts(
|
||||
in port p_bclk,
|
||||
#endif
|
||||
#endif
|
||||
unsigned int divide, unsigned int curSamFreq);
|
||||
in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned int curSamFreq);
|
||||
#else
|
||||
|
||||
void ConfigAudioPorts(
|
||||
@@ -51,7 +54,7 @@ void ConfigAudioPorts(
|
||||
port p_bclk,
|
||||
#endif
|
||||
#endif
|
||||
unsigned int divide, unsigned int curSamFreq);
|
||||
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned int curSamFreq);
|
||||
|
||||
|
||||
#endif /* __XC__*/
|
||||
@@ -76,7 +79,7 @@ void ConfigAudioPortsWrapper(
|
||||
buffered in port:32 p_bclk,
|
||||
#endif
|
||||
#endif
|
||||
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
|
||||
in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq);
|
||||
#else
|
||||
|
||||
void ConfigAudioPortsWrapper(
|
||||
@@ -92,7 +95,7 @@ void ConfigAudioPortsWrapper(
|
||||
port p_lrclk,
|
||||
port p_bclk,
|
||||
#endif
|
||||
unsigned int divide, unsigned curSamFreq, unsigned int dsdMode);
|
||||
port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq);
|
||||
|
||||
|
||||
#endif /* __XC__*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
@@ -6,11 +6,7 @@
|
||||
#include "xua.h"
|
||||
#include "audioports.h"
|
||||
|
||||
|
||||
|
||||
extern in port p_mclk_in;
|
||||
extern clock clk_audio_mclk;
|
||||
extern clock clk_audio_bclk;
|
||||
|
||||
void ConfigAudioPorts(
|
||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||
@@ -32,16 +28,21 @@ void ConfigAudioPorts(
|
||||
in port p_bclk,
|
||||
#endif
|
||||
#endif
|
||||
unsigned int divide, unsigned curSamFreq)
|
||||
in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq)
|
||||
{
|
||||
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
|
||||
|
||||
#if (CODEC_MASTER == 0)
|
||||
#ifdef __XS3A__
|
||||
/* Increase drive strength of clock ports to 8mA */
|
||||
asm volatile ("setc res[%0], %1" :: "r" (p_bclk), "r" (0x200006));
|
||||
asm volatile ("setc res[%0], %1" :: "r" (p_lrclk), "r" (0x200006));
|
||||
#endif
|
||||
|
||||
/* 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))
|
||||
{
|
||||
clearbuf(p_lrclk);
|
||||
@@ -55,44 +56,19 @@ unsigned int divide, unsigned curSamFreq)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (I2S_CHANS_DAC != 0)
|
||||
#if (I2S_CHANS_DAC != 0)|| (DSD_CHANS_DAC != 0)
|
||||
for(int i = 0; i < numPortsDac; i++)
|
||||
{
|
||||
clearbuf(p_i2s_dac[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
unsafe
|
||||
{
|
||||
/* Clock bitclock clock block from master clock pin (divided) */
|
||||
configure_clock_src_divide(clk_audio_bclk, (port) p_mclk_in, (divide/2));
|
||||
configure_port_clock_output(p_bclk, clk_audio_bclk);
|
||||
}
|
||||
#else
|
||||
#error XS1 no longer supported in audio core
|
||||
/* For a divide of one (i.e. bitclock == master-clock) BClk is set to clock_output mode.
|
||||
* In this mode it outputs an edge clock on every tick of itsassociated clock_block.
|
||||
*
|
||||
* For all other divides, BClk is clocked by the master clock and data
|
||||
* will be output to p_bclk to generate the bit clock.
|
||||
*/
|
||||
if (divide == 1) /* e.g. 176.4KHz from 11.2896 */
|
||||
{
|
||||
configure_port_clock_output(p_bclk, clk_audio_mclk);
|
||||
|
||||
/* Generate bit clock block straight from mclk */
|
||||
configure_clock_src(clk_audio_bclk, p_mclk_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* bit clock port from master clock clock-clock block */
|
||||
configure_out_port_no_ready(p_bclk, clk_audio_mclk, 0);
|
||||
|
||||
/* Generate bit clock block from pin */
|
||||
configure_clock_src(clk_audio_bclk, p_bclk);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!isnull(p_lrclk))
|
||||
{
|
||||
@@ -100,8 +76,41 @@ unsigned int divide, unsigned curSamFreq)
|
||||
configure_out_port_no_ready(p_lrclk, clk_audio_bclk, 0);
|
||||
}
|
||||
|
||||
#if (I2S_CHANS_DAC != 0)
|
||||
/* Clock I2S output data ports from clock block */
|
||||
#if (I2S_CHANS_ADC != 0)
|
||||
/* Some adustments for timing. Sample ADC lines on negative edge and add some delay */
|
||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||
{
|
||||
for(int i = 0; i < numPortsAdc; i++)
|
||||
{
|
||||
set_port_sample_delay(p_i2s_adc[i]);
|
||||
set_pad_delay(p_i2s_adc[i], 4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif (CODEC_MASTER)
|
||||
/* Stop bit and master clock blocks */
|
||||
stop_clock(clk_audio_bclk);
|
||||
|
||||
/* Clock bclk clock-block from bclk pin */
|
||||
configure_clock_src(clk_audio_bclk, p_bclk);
|
||||
|
||||
configure_in_port_no_ready(p_lrclk, clk_audio_bclk);
|
||||
|
||||
/* Do some clocking shifting to get data in the valid window */
|
||||
/* E.g. Only shift when running at 88.2+ kHz TDM slave */
|
||||
int bClkDelay_fall = 0;
|
||||
if(curSamFreq * I2S_CHANS_PER_FRAME * 32 >= 20000000)
|
||||
{
|
||||
/* 18 * 2ns = 36ns. This results in a -4ns (36 - 40) shift at 96KHz and -8ns (36 - 44) at 88.4KHz */
|
||||
bClkDelay_fall = 18;
|
||||
}
|
||||
|
||||
set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall);
|
||||
#endif
|
||||
|
||||
#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0)
|
||||
/* Clock I2S/DSD output data ports from b-clock clock block */
|
||||
for(int i = 0; i < numPortsDac; i++)
|
||||
{
|
||||
configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0);
|
||||
@@ -119,46 +128,6 @@ unsigned int divide, unsigned curSamFreq)
|
||||
/* Start clock blocks ticking */
|
||||
start_clock(clk_audio_bclk);
|
||||
|
||||
#else /* CODEC_MASTER */
|
||||
|
||||
/* Stop bit and master clock blocks */
|
||||
stop_clock(clk_audio_bclk);
|
||||
|
||||
/* Clock bclk clock-block from bclk pin */
|
||||
configure_clock_src(clk_audio_bclk, p_bclk);
|
||||
|
||||
|
||||
/* Do some clocking shifting to get data in the valid window */
|
||||
/* E.g. Only shift when running at 88.2+ kHz TDM slave */
|
||||
int bClkDelay_fall = 0;
|
||||
if(curSamFreq * I2S_CHANS_PER_FRAME * 32 >= 20000000)
|
||||
{
|
||||
/* 18 * 2ns = 36ns. This results in a -4ns (36 - 40) shift at 96KHz and -8ns (36 - 44) at 88.4KHz */
|
||||
bClkDelay_fall = 18;
|
||||
}
|
||||
|
||||
set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall);
|
||||
|
||||
#if (I2S_CHANS_DAC != 0)
|
||||
/* Clock I2S output data ports from b-clock clock block */
|
||||
for(int i = 0; i < I2S_WIRES_DAC; i++)
|
||||
{
|
||||
configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (I2S_CHANS_ADC != 0)
|
||||
/* Clock I2S input data ports from clock block */
|
||||
for(int i = 0; i < I2S_WIRES_ADC; i++)
|
||||
{
|
||||
configure_in_port_no_ready(p_i2s_adc[i], clk_audio_bclk);
|
||||
}
|
||||
#endif
|
||||
|
||||
configure_in_port_no_ready(p_lrclk, clk_audio_bclk);
|
||||
|
||||
start_clock(clk_audio_bclk);
|
||||
#endif
|
||||
#endif
|
||||
#endif //#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef ARCH_U_POWER_SAVING_
|
||||
#define ARCH_U_POWER_SAVING_
|
||||
|
||||
/* Sets the voltage down by VOLTAGE_REDUCTION_mV (voltage is set to 10 * X + 600 mV),
|
||||
* and adjusts other features to save power
|
||||
*/
|
||||
void archU_powerSaving();
|
||||
|
||||
#endif /*ARCH_U_POWER_SAVING_*/
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#if (XUD_SERIES_SUPPORT==1)
|
||||
#include "archU_powerSaving.h"
|
||||
#include <xs1.h>
|
||||
#include <xs1_l_registers.h>
|
||||
#include <xs1_su_registers.h>
|
||||
#include <platform.h>
|
||||
|
||||
#if (XCC_MAJOR_VERSION >= 1300)
|
||||
#include <hwtimer.h>
|
||||
#else
|
||||
#define hwtimer_t timer
|
||||
#endif
|
||||
|
||||
#ifndef VOLTAGE_REDUCTION_mV
|
||||
#define VOLTAGE_REDUCTION_mV 20
|
||||
#endif
|
||||
|
||||
unsigned get_tile_id(tileref t); // Required for use with 12.0 tools. get_tile_id() available in xs1.h with 13.0 tools.
|
||||
|
||||
#define ARCH_U_VOLTAGE_FIRST_STEP 39 // First step down from 1V
|
||||
#define ARCH_U_SSWITCH_PRESCALER 8 // Sswitch down to 1/8 clk freq
|
||||
|
||||
void archU_powerSaving()
|
||||
{
|
||||
if (get_local_tile_id() == get_tile_id(tile[0]))
|
||||
{
|
||||
unsigned writeval[1];
|
||||
unsigned char writevalc[1];
|
||||
|
||||
// Reduce the VDDCORE voltage level
|
||||
for (unsigned count=0; count < (VOLTAGE_REDUCTION_mV/10); count++)
|
||||
{
|
||||
hwtimer_t t;
|
||||
int time;
|
||||
|
||||
writeval[0] = (ARCH_U_VOLTAGE_FIRST_STEP - count);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_VOUT1_LVL_NUM, 1, writeval);
|
||||
|
||||
t :> time;
|
||||
time += (1 * PLATFORM_REFERENCE_MHZ); // Wait 1us per step
|
||||
t when timerafter(time) :> void;
|
||||
}
|
||||
|
||||
// Set switch prescaler down
|
||||
write_node_config_reg(tile[0], XS1_SSWITCH_CLK_DIVIDER_NUM, (ARCH_U_SSWITCH_PRESCALER - 1)); // PLL clk will be divided by value + 1
|
||||
|
||||
// Both DC-DCs in PWM mode, I/O and PLL supply on, Analogue & core on
|
||||
writeval[0] = XS1_SU_PWR_VOUT1_EN_SET(0, 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT2_EN_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT5_EN_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT6_EN_SET(writeval[0], 1);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_STATE_AWAKE_NUM, 1, writeval);
|
||||
|
||||
// USB suspend off, voltage adjustable, sleep clock 32KHz
|
||||
writeval[0] = XS1_SU_PWR_USB_PD_EN_SET(0, 1);
|
||||
writeval[0] = XS1_SU_PWR_RST_VOUT_LVL_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_LD_AWAKE_SET(writeval[0], 1);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_MISC_CTRL_NUM, 1, writeval);
|
||||
|
||||
// Turn off on-chip silicon oscillator (20MHz or 32KHz)
|
||||
writevalc[0] = XS1_SU_ON_SI_OSC_EN_SET(0, 1);
|
||||
writevalc[0] = XS1_SU_ON_SI_OSC_SLOW_SET(writevalc[0], 1);
|
||||
write_periph_8(usb_tile, XS1_SU_PER_OSC_CHANEND_NUM, XS1_SU_PER_OSC_ON_SI_CTRL_NUM, 1, writevalc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
#include <print.h>
|
||||
#include <xs1_su.h>
|
||||
|
||||
#define XS1_SU_PERIPH_USB_ID 0x1
|
||||
|
||||
//Normally we would enumerate the XUD_SERIES_SUPPORT possibilities using defines in
|
||||
//xud.h but we have hard coded them to remove dependancy of sc_xud
|
||||
|
||||
#if (XUD_SERIES_SUPPORT == 4)
|
||||
#include "xs2_su_registers.h"
|
||||
#define XS2_SU_PERIPH_USB_ID 0x1
|
||||
#define PLL_MASK 0x3FFFFFFF
|
||||
#else
|
||||
#define PLL_MASK 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
/* Note, this function is prototyped in xs1.h only from 13 tools onwards */
|
||||
unsigned get_tile_id(tileref);
|
||||
@@ -31,29 +22,19 @@ static void reset_tile(unsigned const tileId)
|
||||
read_sswitch_reg(tileId, 6, pllVal);
|
||||
pllVal &= PLL_MASK;
|
||||
write_sswitch_reg_no_ack(tileId, 6, pllVal);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reboots XMOS device by writing to the PLL config register
|
||||
* Note - resetting is per *node* not tile
|
||||
*/
|
||||
void device_reboot(void)
|
||||
{
|
||||
#if (XUD_SERIES_SUPPORT == 1)
|
||||
/* Disconnect from bus */
|
||||
unsigned data[] = {4};
|
||||
write_periph_32(usb_tile, XS1_SU_PERIPH_USB_ID, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 1, data);
|
||||
|
||||
/* Ideally we would reset SU1 here but then we loose power to the xcore and therefore the DFU flag */
|
||||
/* Disable USB and issue reset to xcore only - not analogue chip */
|
||||
write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM,0b10);
|
||||
#else
|
||||
|
||||
unsigned int localTileId = get_local_tile_id();
|
||||
unsigned int tileId;
|
||||
unsigned int tileArrayLength;
|
||||
unsigned int localTileNum;
|
||||
|
||||
#if (XUD_SERIES_SUPPORT == 4)
|
||||
#if defined(__XS2A__)
|
||||
/* Disconnect from bus */
|
||||
unsigned data[] = {4};
|
||||
write_periph_32(usb_tile, XS2_SU_PERIPH_USB_ID, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 1, data);
|
||||
@@ -61,12 +42,12 @@ void device_reboot(void)
|
||||
|
||||
tileArrayLength = sizeof(tile)/sizeof(tileref);
|
||||
|
||||
/* Note - we could be in trouble if this doesn't return 0/1 since
|
||||
/* Note - we could be in trouble if this doesn't return 0/1 since
|
||||
* this code doesn't properly handle any network topology other than a
|
||||
* simple line
|
||||
* simple line
|
||||
*/
|
||||
/* Find tile index of the local tile ID */
|
||||
for(int tileNum = 0; tileNum<tileArrayLength; tileNum++)
|
||||
for(int tileNum = 0; tileNum<tileArrayLength; tileNum++)
|
||||
{
|
||||
if (get_tile_id(tile[tileNum]) == localTileId)
|
||||
{
|
||||
@@ -75,24 +56,14 @@ void device_reboot(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
/* Reset all even tiles, starting from the remote ones */
|
||||
for(int tileNum = tileArrayLength-2; tileNum>=0; tileNum-=2)
|
||||
#else
|
||||
/* Reset all tiles, starting from the remote ones */
|
||||
for(int tileNum = tileArrayLength-1; tileNum>=0; tileNum--)
|
||||
#endif
|
||||
{
|
||||
/* Cannot cast tileref to unsigned! */
|
||||
tileId = get_tile_id(tile[tileNum]);
|
||||
|
||||
/* Do not reboot local tile (or tiles residing on the same node) yet */
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
if((localTileNum | 1) != (tileNum | 1))
|
||||
|
||||
#else
|
||||
if(localTileNum != tileNum)
|
||||
#endif
|
||||
{
|
||||
reset_tile(tileId);
|
||||
}
|
||||
@@ -100,7 +71,6 @@ void device_reboot(void)
|
||||
|
||||
/* Finally reboot the node this tile resides on */
|
||||
reset_tile(localTileId);
|
||||
#endif
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -1,49 +1,15 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// Copyright 2015-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _UAC_HWRESOURCES_H_
|
||||
#define _UAC_HWRESOURCES_H_
|
||||
|
||||
#if XUA_USB_EN
|
||||
#include "xud.h" /* XMOS USB Device Layer defines and functions */
|
||||
#endif
|
||||
|
||||
#if ((XUD_SERIES_SUPPORT != XUD_U_SERIES) && (XUD_SERIES_SUPPORT != XUD_X200_SERIES))
|
||||
|
||||
/* XUD_L_SERIES and XUD_G_SERIES */
|
||||
|
||||
#if (AUDIO_IO_TILE == XUD_TILE)
|
||||
/* Note: L series ref clocked clocked from USB clock when USB enabled - use another clockblock for MIDI
|
||||
* if MIDI and XUD on same tile. See XUD documentation.
|
||||
*
|
||||
* This is a clash with S/PDIF Tx but simultaneous S/PDIF and MIDI not currently supported on single tile device
|
||||
*
|
||||
*/
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_1;
|
||||
#else
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_REF;
|
||||
#endif
|
||||
|
||||
#define CLKBLK_SPDIF_TX XS1_CLKBLK_1
|
||||
#define CLKBLK_SPDIF_RX XS1_CLKBLK_1
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */
|
||||
#define CLKBLK_ADAT_RX XS1_CLKBLK_3
|
||||
#define CLKBLK_USB_RST XS1_CLKBLK_4 /* Clock block passed into L/G series XUD */
|
||||
#define CLKBLK_FLASHLIB XS1_CLKBLK_5 /* Clock block for use by flash lib */
|
||||
|
||||
#define CLKBLK_I2S_BIT XS1_CLKBLK_3
|
||||
|
||||
#else
|
||||
|
||||
/* XUD_U_SERIES, XUD_X200_SERIES */
|
||||
/* Note, U-series XUD uses clock blocks 4 and 5 - see XUD_Ports.xc */
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_REF;
|
||||
#define CLKBLK_SPDIF_TX XS1_CLKBLK_1
|
||||
#define CLKBLK_SPDIF_RX XS1_CLKBLK_1
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2
|
||||
#define CLKBLK_FLASHLIB XS1_CLKBLK_3 /* Clock block for use by flash lib */
|
||||
#define CLKBLK_ADAT_RX XS1_CLKBLK_REF /* Use REF for ADAT_RX on U/x200 series */
|
||||
#define CLKBLK_ADAT_RX XS1_CLKBLK_REF /* Use REF for ADAT_RX on x200/AI series */
|
||||
#define CLKBLK_I2S_BIT XS1_CLKBLK_3
|
||||
#endif
|
||||
|
||||
#endif /* _UAC_HWRESOURCES_H_ */
|
||||
|
||||
@@ -1,66 +1,60 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) API
|
||||
*
|
||||
* This file defines the Application Programming Interface (API) used to record HID
|
||||
* events and retrieve a HID Report for sending to a host.
|
||||
* The using application has the responsibility to fulfill this API.
|
||||
* Document section numbers refer to the HID Device Class Definition, version 1.11.
|
||||
*/
|
||||
|
||||
#ifndef __USER_HID_H__
|
||||
#define __USER_HID_H__
|
||||
|
||||
/**
|
||||
* \brief HID event identifiers
|
||||
*
|
||||
* This enumeration defines a constant value for each HID event.
|
||||
* It defines one value for each of the four GPI pins supported in the standard voice products.
|
||||
* It defines a further 28 values for generic events.
|
||||
*/
|
||||
typedef enum hidEventId_t {
|
||||
HID_EVENT_ID_GPI0 = 0,
|
||||
HID_EVENT_ID_GPI1,
|
||||
HID_EVENT_ID_GPI2,
|
||||
HID_EVENT_ID_GPI3,
|
||||
HID_EVENT_ID_EVT0,
|
||||
HID_EVENT_ID_EVT1,
|
||||
HID_EVENT_ID_EVT2,
|
||||
HID_EVENT_ID_EVT3,
|
||||
HID_EVENT_ID_EVT4,
|
||||
HID_EVENT_ID_EVT5,
|
||||
HID_EVENT_ID_EVT6,
|
||||
HID_EVENT_ID_EVT7,
|
||||
HID_EVENT_ID_EVT8,
|
||||
HID_EVENT_ID_EVT9,
|
||||
HID_EVENT_ID_EVT10,
|
||||
HID_EVENT_ID_EVT11,
|
||||
HID_EVENT_ID_EVT12,
|
||||
HID_EVENT_ID_EVT13,
|
||||
HID_EVENT_ID_EVT14,
|
||||
HID_EVENT_ID_EVT15,
|
||||
HID_EVENT_ID_EVT16,
|
||||
HID_EVENT_ID_EVT17,
|
||||
HID_EVENT_ID_EVT18,
|
||||
HID_EVENT_ID_EVT19,
|
||||
HID_EVENT_ID_EVT20,
|
||||
HID_EVENT_ID_EVT21,
|
||||
HID_EVENT_ID_EVT22,
|
||||
HID_EVENT_ID_EVT23,
|
||||
HID_EVENT_ID_EVT24,
|
||||
HID_EVENT_ID_EVT25,
|
||||
HID_EVENT_ID_EVT26,
|
||||
HID_EVENT_ID_EVT27,
|
||||
HID_EVENT_ID_INVALID = 0xffffffff,
|
||||
} hidEventId_t;
|
||||
#include <stddef.h>
|
||||
|
||||
#define HID_DATA_BYTES 4
|
||||
/**
|
||||
* \brief HID event
|
||||
*
|
||||
* This struct identifies:
|
||||
* - the HID Report that reports an event, i.e., the ID,
|
||||
* - the location within the HID Report for the event, i.e., the byte and bit, and
|
||||
* - the value to report for that location (typically interpreted as a Boolean).
|
||||
* It assumes only single bit flags within the HID Report.
|
||||
*/
|
||||
typedef struct hidEvent_t {
|
||||
unsigned bit;
|
||||
unsigned byte;
|
||||
unsigned id;
|
||||
unsigned value;
|
||||
} hidEvent_t;
|
||||
|
||||
#define HID_MAX_DATA_BYTES ( 4 )
|
||||
#define HID_EVENT_INVALID_ID ( 0x100 )
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
|
||||
/**
|
||||
* \brief Get the data for the next HID report
|
||||
* \brief Get the data for the next HID Report
|
||||
*
|
||||
* \note This function returns the HID data as a list of unsigned char because the
|
||||
* \c XUD_SetReady_In() accepts data for transmission to the USB Host using
|
||||
* this type.
|
||||
*
|
||||
* \param{out} hidData The HID data
|
||||
* \param[in] id The HID Report ID (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* Set to zero if the application provides only one HID Report
|
||||
* which does not include a Report ID
|
||||
* \param[out] hidData The HID data
|
||||
* If using Report IDs, this function places the Report ID in
|
||||
* the first element; otherwise the first element holds the
|
||||
* first byte of HID event data.
|
||||
*
|
||||
* \returns The length of the HID Report in the \a hidData argument
|
||||
* \retval Zero means no new HID event data has been recorded for the given \a id
|
||||
*/
|
||||
void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]);
|
||||
size_t UserHIDGetData( const unsigned id, unsigned char hidData[ HID_MAX_DATA_BYTES ]);
|
||||
|
||||
/**
|
||||
* \brief Initialize HID processing
|
||||
@@ -70,17 +64,18 @@ void UserHIDInit( void );
|
||||
/**
|
||||
* \brief Record that a HID event has occurred
|
||||
*
|
||||
* \param{in} hidEventId The identifier of an event which has occurred
|
||||
* \param{in} hidEventData A list of data associated with the event
|
||||
* \param{in} hidEventDataSize The length of the event data list
|
||||
* \param[in] hidEvent A list of events which have occurred.
|
||||
* Each element specifies a HID Report ID, a bit and byte
|
||||
* within the HID Report and the value for it.
|
||||
* Set the Report ID to zero if not using Report IDs
|
||||
* (see 5.6, 6.2.2.7, 8.1 and 8.2).
|
||||
* \param[in] hidEventCnt The length of the \a hidEvent list.
|
||||
*
|
||||
* \note At present, this function only takes a single element of event data, i.e.
|
||||
* hidEventDataSize must equal 1.
|
||||
*
|
||||
* \note At present, this function treats the event data as a Boolean flag.
|
||||
* Zero means False; all other values mean True.
|
||||
* \returns The index of the first unrecorded event in \a hidEvent
|
||||
* \retval Zero indicates no events were recorded
|
||||
* \retval \a hidEventCnt indicates all events were recorded
|
||||
*/
|
||||
void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize );
|
||||
size_t UserHIDRecordEvent( const hidEvent_t hidEvent[], const size_t hidEventCnt );
|
||||
|
||||
#endif /* ( 0 < HID_CONTROLS ) */
|
||||
#endif /* __USER_HID_H__ */
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// Copyright 2013-2023 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#if XUA_USB_EN
|
||||
#include "xua.h"
|
||||
#if XUA_USB_EN
|
||||
#include "hostactive.h"
|
||||
#include "audiostream.h"
|
||||
|
||||
/* Implementations over-riding empty versions in lib_xud/sec/core/XUD_User.c */
|
||||
|
||||
void XUD_UserSuspend(void) __attribute__ ((weak));
|
||||
void XUD_UserSuspend(void)
|
||||
{
|
||||
|
||||
@@ -5,19 +5,18 @@
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
|
||||
#ifndef NO_USB
|
||||
#if XUA_USB_EN
|
||||
#include "xud_device.h"
|
||||
#include "dfu_types.h"
|
||||
#include "flash_interface.h"
|
||||
#include "dfu_interface.h"
|
||||
|
||||
#if (XUD_SERIES_SUPPORT==4)
|
||||
/* xCORE-200 */
|
||||
#if defined(__XS2A__)
|
||||
/* Note range 0x7FFC8 - 0x7FFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0x7ffcc
|
||||
#else
|
||||
/* Note range 0x1FFC8 - 0x1FFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0x1ffcc
|
||||
/* Note range 0xFFFC8 - 0xFFFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0xfffcc
|
||||
#endif
|
||||
|
||||
/* Store Flag to fixed address */
|
||||
@@ -581,6 +580,6 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, ch
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
#endif /* NO_USB */
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -90,9 +90,9 @@ int flash_cmd_enable_ports()
|
||||
|
||||
#ifdef DFU_FLASH_DEVICE
|
||||
#ifdef QUAD_SPI_FLASH
|
||||
result = fl_connectToDevice(&p_qflash, flash_devices, 1);
|
||||
result = fl_connectToDevice(&p_qflash, flash_devices, sizeof(flash_devices) / sizeof(fl_QuadDeviceSpec));
|
||||
#else
|
||||
result = fl_connectToDevice(&p_flash, flash_devices, 1);
|
||||
result = fl_connectToDevice(&p_flash, flash_devices, sizeof(flash_devices) / sizeof(fl_DeviceSpec));
|
||||
#endif
|
||||
#else
|
||||
/* Use default flash list */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user