This commit is contained in:
Steven Dan
2026-05-12 11:17:20 +08:00
parent b5b095efd0
commit b43581c2ff
473 changed files with 55278 additions and 0 deletions

492
lib_gpio/lib_gpio/.cproject Normal file
View File

@@ -0,0 +1,492 @@
<?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.57523242">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.xmos.cdt.toolchain.57523242" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings />
<extensions>
<extension id="com.xmos.cdt.core.XEBinaryParser" point="org.eclipse.cdt.core.BinaryParser" />
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<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" />
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>xmake</buildCommand>
<buildArguments> -f .makefile</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>xmake</buildCommand>
<buildArguments> -f .makefile</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="com.xmos.cdt.toolchain.57523242" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.xmos.cdt.toolchain.57523242.1127281840" name="/" resourcePath="">
<toolChain id = "com.xmos.cdt.toolchain.23600535" 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.81104918" isAbstract="false" osList="linux,win32,macosx" superClass="com.xmos.cdt.core.platform" />
<builder arguments=" -f .makefile" id = "com.xmos.cdt.builder.base.28632690" 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.25750820" name="com.xmos.cdt.xc.compiler" superClass="com.xmos.cdt.xc.compiler">
<option id = "com.xmos.xc.compiler.option.defined.symbols.70585171" name="com.xmos.xc.compiler.option.defined.symbols" superClass="com.xmos.xc.compiler.option.defined.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=11"/>
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1111"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=1"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=11"/>
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
<listOptionValue builtIn="false" value="__MCPP=2"/>
<listOptionValue builtIn="false" value="__XC__=1"/>
<listOptionValue builtIn="false" value="__XS1B__=1"/>
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
<listOptionValue builtIn="false" value="__STDC__=1"/>
<listOptionValue builtIn="false" value="__GNUC__=4"/>
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
<listOptionValue builtIn="false" value="__llvm__=1"/>
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255U"/>
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
<listOptionValue builtIn="false" value="__DEC_EVAL_METHOD__=2"/>
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DEC32_MANT_DIG__=7"/>
<listOptionValue builtIn="false" value="__DEC32_MIN_EXP__=(-95)"/>
<listOptionValue builtIn="false" value="__DEC32_MAX_EXP__=96"/>
<listOptionValue builtIn="false" value="__DEC32_MIN__=1E-95DF"/>
<listOptionValue builtIn="false" value="__DEC32_MAX__=9.999999E96DF"/>
<listOptionValue builtIn="false" value="__DEC32_EPSILON__=1E-6DF"/>
<listOptionValue builtIn="false" value="__DEC32_DEN__=0.000001E-95DF"/>
<listOptionValue builtIn="false" value="__DEC64_MANT_DIG__=16"/>
<listOptionValue builtIn="false" value="__DEC64_MIN_EXP__=(-383)"/>
<listOptionValue builtIn="false" value="__DEC64_MAX_EXP__=384"/>
<listOptionValue builtIn="false" value="__DEC64_MIN__=1E-383DD"/>
<listOptionValue builtIn="false" value="__DEC64_MAX__=9.999999999999999E384DD"/>
<listOptionValue builtIn="false" value="__DEC64_EPSILON__=1E-15DD"/>
<listOptionValue builtIn="false" value="__DEC64_DEN__=0.000000000000001E-383DD"/>
<listOptionValue builtIn="false" value="__DEC128_MANT_DIG__=34"/>
<listOptionValue builtIn="false" value="__DEC128_MIN_EXP__=(-6143)"/>
<listOptionValue builtIn="false" value="__DEC128_MAX_EXP__=6144"/>
<listOptionValue builtIn="false" value="__DEC128_MIN__=1E-6143DL"/>
<listOptionValue builtIn="false" value="__DEC128_MAX__=9.999999999999999999999999999999999E6144DL"/>
<listOptionValue builtIn="false" value="__DEC128_EPSILON__=1E-33DL"/>
<listOptionValue builtIn="false" value="__DEC128_DEN__=0.000000000000000000000000000000001E-6143DL"/>
<listOptionValue builtIn="false" value="__REGISTER_PREFIX__"/>
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__"/>
<listOptionValue builtIn="false" value="__VERSION__=&quot;4.2.1"/>
<listOptionValue builtIn="false" value="__GNUC_GNU_INLINE__=1"/>
<listOptionValue builtIn="false" value="__BLOCKS__=1"/>
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
<listOptionValue builtIn="false" value="__ELF__=1"/>
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
<listOptionValue builtIn="false" value="__cplusplus=1"/>
<listOptionValue builtIn="false" value="__GNUG__=4"/>
<listOptionValue builtIn="false" value="__GXX_WEAK__=1"/>
<listOptionValue builtIn="false" value="__DEPRECATED=1"/>
<listOptionValue builtIn="false" value="__EXCEPTIONS=1"/>
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
</option>
<option id = "com.xmos.xc.compiler.option.include.paths.81829045" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
</option>
<inputType id = "com.xmos.cdt.xc.compiler.input.79446827" name="XC" superClass="com.xmos.cdt.xc.compiler.input"/>
</tool>
<tool id = "com.xmos.cdt.c.compiler.85196426" name="com.xmos.cdt.c.compiler" superClass="com.xmos.cdt.c.compiler">
<option id = "com.xmos.c.compiler.option.defined.symbols.23867423" name="com.xmos.c.compiler.option.defined.symbols" superClass="com.xmos.c.compiler.option.defined.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__STDC__=1"/>
<listOptionValue builtIn="false" value="__STDC_VERSION__=199901L"/>
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
<listOptionValue builtIn="false" value="__GNUC__=4"/>
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
<listOptionValue builtIn="false" value="__llvm__=1"/>
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
<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__=255U"/>
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
<listOptionValue builtIn="false" value="__DEC_EVAL_METHOD__=2"/>
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DEC32_MANT_DIG__=7"/>
<listOptionValue builtIn="false" value="__DEC32_MIN_EXP__=(-95)"/>
<listOptionValue builtIn="false" value="__DEC32_MAX_EXP__=96"/>
<listOptionValue builtIn="false" value="__DEC32_MIN__=1E-95DF"/>
<listOptionValue builtIn="false" value="__DEC32_MAX__=9.999999E96DF"/>
<listOptionValue builtIn="false" value="__DEC32_EPSILON__=1E-6DF"/>
<listOptionValue builtIn="false" value="__DEC32_DEN__=0.000001E-95DF"/>
<listOptionValue builtIn="false" value="__DEC64_MANT_DIG__=16"/>
<listOptionValue builtIn="false" value="__DEC64_MIN_EXP__=(-383)"/>
<listOptionValue builtIn="false" value="__DEC64_MAX_EXP__=384"/>
<listOptionValue builtIn="false" value="__DEC64_MIN__=1E-383DD"/>
<listOptionValue builtIn="false" value="__DEC64_MAX__=9.999999999999999E384DD"/>
<listOptionValue builtIn="false" value="__DEC64_EPSILON__=1E-15DD"/>
<listOptionValue builtIn="false" value="__DEC64_DEN__=0.000000000000001E-383DD"/>
<listOptionValue builtIn="false" value="__DEC128_MANT_DIG__=34"/>
<listOptionValue builtIn="false" value="__DEC128_MIN_EXP__=(-6143)"/>
<listOptionValue builtIn="false" value="__DEC128_MAX_EXP__=6144"/>
<listOptionValue builtIn="false" value="__DEC128_MIN__=1E-6143DL"/>
<listOptionValue builtIn="false" value="__DEC128_MAX__=9.999999999999999999999999999999999E6144DL"/>
<listOptionValue builtIn="false" value="__DEC128_EPSILON__=1E-33DL"/>
<listOptionValue builtIn="false" value="__DEC128_DEN__=0.000000000000000000000000000000001E-6143DL"/>
<listOptionValue builtIn="false" value="__REGISTER_PREFIX__"/>
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__"/>
<listOptionValue builtIn="false" value="__VERSION__=&quot;4.2.1"/>
<listOptionValue builtIn="false" value="__GNUC_STDC_INLINE__=1"/>
<listOptionValue builtIn="false" value="__BLOCKS__=1"/>
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
<listOptionValue builtIn="false" value="__XS1B__=1"/>
<listOptionValue builtIn="false" value="__ELF__=1"/>
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=12"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=2"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1202"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=0"/>
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
</option>
<option id = "com.xmos.c.compiler.option.include.paths.61056721" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
</option>
<inputType id = "com.xmos.cdt.c.compiler.input.c.81398683" name="C" superClass="com.xmos.cdt.c.compiler.input.c"/>
</tool>
<tool id = "com.xmos.cdt.cxx.compiler.88494951" name="com.xmos.cdt.cxx.compiler" superClass="com.xmos.cdt.cxx.compiler">
<option id = "com.xmos.cxx.compiler.option.defined.symbols.23703551" name="com.xmos.cxx.compiler.option.defined.symbols" superClass="com.xmos.cxx.compiler.option.defined.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__STDC__=1"/>
<listOptionValue builtIn="false" value="__cplusplus=1"/>
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
<listOptionValue builtIn="false" value="__GNUC__=4"/>
<listOptionValue builtIn="false" value="__GNUG__=4"/>
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
<listOptionValue builtIn="false" value="__llvm__=1"/>
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
<listOptionValue builtIn="false" value="__GXX_WEAK__=1"/>
<listOptionValue builtIn="false" value="__DEPRECATED=1"/>
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
<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__=255U"/>
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
<listOptionValue builtIn="false" value="__DEC_EVAL_METHOD__=2"/>
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
<listOptionValue builtIn="false" value="__DEC32_MANT_DIG__=7"/>
<listOptionValue builtIn="false" value="__DEC32_MIN_EXP__=(-95)"/>
<listOptionValue builtIn="false" value="__DEC32_MAX_EXP__=96"/>
<listOptionValue builtIn="false" value="__DEC32_MIN__=1E-95DF"/>
<listOptionValue builtIn="false" value="__DEC32_MAX__=9.999999E96DF"/>
<listOptionValue builtIn="false" value="__DEC32_EPSILON__=1E-6DF"/>
<listOptionValue builtIn="false" value="__DEC32_DEN__=0.000001E-95DF"/>
<listOptionValue builtIn="false" value="__DEC64_MANT_DIG__=16"/>
<listOptionValue builtIn="false" value="__DEC64_MIN_EXP__=(-383)"/>
<listOptionValue builtIn="false" value="__DEC64_MAX_EXP__=384"/>
<listOptionValue builtIn="false" value="__DEC64_MIN__=1E-383DD"/>
<listOptionValue builtIn="false" value="__DEC64_MAX__=9.999999999999999E384DD"/>
<listOptionValue builtIn="false" value="__DEC64_EPSILON__=1E-15DD"/>
<listOptionValue builtIn="false" value="__DEC64_DEN__=0.000000000000001E-383DD"/>
<listOptionValue builtIn="false" value="__DEC128_MANT_DIG__=34"/>
<listOptionValue builtIn="false" value="__DEC128_MIN_EXP__=(-6143)"/>
<listOptionValue builtIn="false" value="__DEC128_MAX_EXP__=6144"/>
<listOptionValue builtIn="false" value="__DEC128_MIN__=1E-6143DL"/>
<listOptionValue builtIn="false" value="__DEC128_MAX__=9.999999999999999999999999999999999E6144DL"/>
<listOptionValue builtIn="false" value="__DEC128_EPSILON__=1E-33DL"/>
<listOptionValue builtIn="false" value="__DEC128_DEN__=0.000000000000000000000000000000001E-6143DL"/>
<listOptionValue builtIn="false" value="__REGISTER_PREFIX__"/>
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__"/>
<listOptionValue builtIn="false" value="__VERSION__=&quot;4.2.1"/>
<listOptionValue builtIn="false" value="__GNUC_GNU_INLINE__=1"/>
<listOptionValue builtIn="false" value="__BLOCKS__=1"/>
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
<listOptionValue builtIn="false" value="__XS1B__=1"/>
<listOptionValue builtIn="false" value="__ELF__=1"/>
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=12"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=2"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1202"/>
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=0"/>
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
</option>
<option id = "com.xmos.cxx.compiler.option.include.paths.92945822" name="com.xmos.cxx.compiler.option.include.paths" superClass="com.xmos.cxx.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/gcc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1&quot;"/>
<listOptionValue builtIn="false" value="&quot;${XMOS_TOOL_PATH}/target/include/c++/4.2.1/xcore-xmos-elf&quot;"/>
</option>
<inputType id = "com.xmos.cdt.cxx.compiler.input.cpp.45814858" 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="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="" />
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-E -P -v -dD" command="" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments='-c &apos;gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;&apos;' command="sh" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments='-c &apos;g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;&apos;' command="sh" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath="" />
<parser enabled="true" />
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments='-c &apos;gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;&apos;' command="sh" useDefault="true" />
<parser enabled="true" />
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings" />
<storageModule moduleId="org.eclipse.cdt.core.language.mapping" />
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings" />
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id = "lib_gpio.null.72009052" name="lib_gpio" />
</storageModule>
</cproject>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lib_gpio</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?children?</key>
<value>?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\||</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>CONFIG=Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>xmake</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
</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>

View File

@@ -0,0 +1,157 @@
// Copyright 2014-2021 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef __gpio_h__
#define __gpio_h__
#include <stdint.h>
#include <stddef.h>
#ifdef __XC__
typedef uint16_t gpio_time_t;
/** This interface provides access to a GPIO that can perform input
operations only. All GPIOs are single bit. */
typedef interface input_gpio_if
{
/** Perform an input on a GPIO
*
* \returns The value input from the port in the least significant bit.
* The rest of the value will be zero extended.
*/
unsigned input(void);
/** Perform an input on a GPIO and get a timestamp
*
* \param timestamp This pass-by-reference parameter will be set
* to the time the value was input. This timestamp
* is the 16-bit port timer value. The port timer is
* driven at the rate of the port clock.
*
* \returns The value input from the port in the least significant bit.
* The rest of the value will be zero extended.
*/
unsigned input_and_timestamp(gpio_time_t &timestamp);
/** Request an event when the pin is a certain value.
*
* This function will cause a notification to occur when the pins
* match the specified value.
*
* \param val The least significant bit represents the 1-bit value to match.
*/
[[clears_notification]]
void event_when_pins_eq(unsigned val);
/** A pin event has occurred.
*
* This notification will occur when a pin event has occurred.
* Events can be requested using the event_when_pins_eq() call.
*/
[[notification]]
slave void event(void);
} input_gpio_if;
/** This interface provides access to a GPIO that can perform output
operations only. All GPIOs are single bit. */
typedef interface output_gpio_if
{
/** Perform an output on a GPIO.
*
* \param data The value to be output. The least significant bit
* represents the 1-bit value to be output.
*/
void output(unsigned data);
/** Perform an output on a GPIO and get a timestamp of when the output
* occurs.
*
* \param data The value to be output. The least significant bit
* represents the 1-bit value to be output.
*
* \returns The time the value was input. This timestamp
* is the 16-bit port timer value. The port timer is driven
* at the rate of the port clock.
*/
gpio_time_t output_and_timestamp(unsigned data);
} output_gpio_if;
/** Task that splits a multi-bit port into several 1-bit GPIO interfaces.
*
* This component allows other tasks to access the individual bits of
* a multi-bit output port.
*
* \param i The array of interfaces to connect to other tasks.
* \param n The number of interfaces connected.
* \param p The output port to be split.
* \param pin_map This array maps the connected interfaces to the pin
* of the port. For example, if 3 clients are connected
* to split a 8-bit port and the array {2,5,3} is supplied.
* Then bit 2 will go to interface 0, bit 5 to inteface 1
* and bit 3 to inteface 2. If null is supplied for this
* argument then the pin map is assumed to be {0,1,2...}.
*/
[[distributable]]
void output_gpio(server output_gpio_if i[n], static const size_t n, out port p,
char (&?pin_map)[n]);
/** Task that splits a multi-bit input port into several 1-bit GPIO interfaces
* (no events).
*
* This component allows other tasks to access the individual bits of
* a multi-bit input port. It does not support events but is distributable so
* requires no specific logical core to run on. If the event_when_pins_eq()
* function is called then the component will trap.
*
* \param i The array of interfaces to connect to other tasks.
* \param n The number of interfaces connected.
* \param p The input port to be split.
* \param pin_map This array maps the connected interfaces to the pin
* of the port. For example, if 3 clients are connected
* to split a 8-bit port and the array {2,5,3} is supplied.
* Then bit 2 will go to interface 0, bit 5 to inteface 1
* and bit 3 to inteface 2. If null is supplied for this
* argument then the pin map is assumed to be {0,1,2...}.
*/
[[distributable]]
void input_gpio(server input_gpio_if i[n], static const size_t n, in port p,
char (&?pin_map)[n]);
/* Task that splits a multi-bit input port into several 1-bit GPIO interfaces
* (with events).
*
* This component allows other tasks to access the individual bits of
* a multi-bit input port. It does support events so requires a logical
* core to run on (but can be combined with other tasks on the same core).
*
* \param i The array of interfaces to connect to other tasks.
* \param n The number of interfaces connected.
* \param p The input port to be split.
* \param pin_map This array maps the connected interfaces to the pin
* of the port. For example, if 3 clients are connected
* to split a 8-bit port and the array {2,5,3} is supplied.
* Then bit 2 will go to interface 0, bit 5 to inteface 1
* and bit 3 to inteface 2. If null is supplied for this
* argument then the pin map is assumed to be {0,1,2...}.
*/
[[combinable]]
void input_gpio_with_events(server input_gpio_if i[n],
static const size_t n,
in port p,
char (&?pin_map)[n]);
/** Convert a 1-bit port to a single 1-bit GPIO interface.
*
* This component allows other tasks to access a 1-bit port as a GPIO
* interface. It is more efficient that using input_gpio_with_events() for the
* restricted case where a 1-bit port is used.
*
* \param i The interface to connect to other tasks.
* \param p The input port.
*/
[[combinable]]
void input_gpio_1bit_with_events(server input_gpio_if i, in port p);
#endif
#endif // __gpio_h__

View File

@@ -0,0 +1,19 @@
ODGS = $(wildcard *.odg)
PDFS = $(ODGS:.odg=.pdf)
all: $(PDFS)
@echo PDFs created
_uncropped:
mkdir _uncropped
_uncropped/%.pdf: %.odg | _uncropped
soffice -env:UserInstallation=file:///home/$(USER)/.libreoffice-alt --headless --convert-to pdf $< --outdir _uncropped
%.pdf: _uncropped/%.pdf
pdfcrop $< $@
clean:
-rm $(PDFS)
-rm _uncropped/*.pdf
-rmdir _uncropped

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,264 @@
.. include:: ../../../README.rst
Connecting external signals to multi-bit ports
----------------------------------------------
Multi-bit ports can be connected to independent signals in either an
all output configuration (see :ref:`lib_gpio_n_bit_output`) or an all
input configuration (see :ref:`lib_gpio_n_bit_input`). This implies
two important restrictions:
* **Bi-directional signals cannot use this library**
* **The signals on the same port must go in the same direction**
To use bi-directional signals, a dedicated 1-bit hardware port needs
to be used.
.. _lib_gpio_n_bit_input:
.. figure:: images/n_bit_input.*
Input configuration
.. _lib_gpio_n_bit_output:
.. figure:: images/n_bit_output.*
Output configuration
Performance restrictions
........................
This library allows independent access to the pins of mulit-bit ports
by multiplexing the port output or input in software. This means that
there are some performance implications, namely:
* The internal buffering, serializing and de-serializing features of
the xCORE port are not available.
* The software locking and multiplexing between individual bits of
the port limits performance. As such, toggling
pins at speed above 1Mhz, for example, is not achievable (on a
62.5Mhz logical core). The limit may be lower depending on the other
code is running on the core and how the other pins of the port are being
driven.
As such, sharing multi-bit ports is most suitable for slow I/O such as
LEDs, buttons and reset lines.
Usage
-----
Output GPIO usage
.................
Output GPIO components are instantiated as parallel tasks that run in a
``par`` statement. These components connect to the hardware ports of
the xCORE device. The application
can connect via an interface connection using an array of the ``output_gpio_if``
interface type:
.. figure:: images/output_gpio_task_diag.*
Output GPIO task diagram
For example, the following code instantiates an output GPIO component
for the first 3 pins of a port and connects to it::
port p = XS1_PORT_4C;
int main(void) {
output_gpio_if i_gpio[3];
par {
output_gpio(i_gpio, 3, p, null);
task1(i_gpio[0], i_gpio[1]);
task2(i_gpio[2]);
}
return 0;
}
Note that the connection is an array of interfaces, so several tasks
can connect to the same component instance, each controlling
different pins of the port.
The application can use the client end of the interface connection to
perform GPIO operations e.g.::
void task1(client output_gpio_if gpio1, client output_gpio_if gpio2)
{
...
gpio1.output(1);
gpio2.output(0);
delay_milliseconds(200);
gpio1.output(0);
gpio2.output(1);
...
}
More information on interfaces and tasks can be be found in
the :ref:`XMOS Programming Guide<programming_guide>`. By default the
output GPIO component does not use any logical cores of its
own. It is a *distributed* task which means it will perform its
function on the logical core of the application task connected to
it (provided the application task is on the same tile).
Input GPIO usage
................
There are two types of input GPIO component: those that support events
and those that do not support events. In both cases,
input GPIO components are instantiated as parallel tasks that run in a
``par`` statement. These components connect to the hardware ports of
the xCORE device. The application
can connect via an interface connection using an array of the ``input_gpio_if``
interface type:
.. figure:: images/input_gpio_task_diag.*
Input GPIO task diagram
For example, the following code instantiates an input GPIO component
for the first 3 pins of a port and connects to it::
port p = XS1_PORT_4C;
int main(void) {
input_gpio_if i_gpio[3];
par {
input_gpio(i_gpio, 3, p, null);
task1(i_gpio[0], i_gpio[1]);
task2(i_gpio[2]);
}
return 0;
}
Note that the connection is an array of interfaces, so several tasks
can connect to the same component instance, each controlling
different pins of the port.
|newpage|
The application can use the client end of the interface connection to
perform GPIO operations e.g.::
void task1(client input_gpio_if gpio1, client input_gpio_if gpio2)
{
...
val1 = gpio1.input();
val2 = gpio2.input();
...
...
val1 = gpio1.input();
val2 = gpio2.input();
...
}
More information on interfaces and tasks can be be found in
the :ref:`XMOS Programming Guide<programming_guide>`. By default the
output GPIO component does not use any logical cores of its
own. It is a *distributed* task which means it will perform its
function on the logical core of the application task connected to
it (provided the application task is on the same tile).
Using events
............
The :c:func:`input_gpio_with_events` and
:c:func:`input_gpio_1bit_with_events` functions support the event
based functions of the input GPIO interface::
port p = XS1_PORT_4C;
int main(void) {
input_gpio_if i_gpio[3];
par {
input_gpio_with_events(i_gpio, 3, p, null);
task1(i_gpio[0], i_gpio[1]);
task2(i_gpio[2]);
}
return 0;
}
In this case the application can request an event on a pin change and
then select on the event happening e.g.::
gpio.event_when_pins_eq(1);
select {
case gpio.event():
// This event was caused by the pin value being 1
...
break;
}
|newpage|
Pin maps
........
The GPIO tasks all take a ``pin_map`` argument. If this is ``null``
then the elements of the inteface array will correspond with the a bit
of the port based on the array element index. So the first element of
the array will control bit 0, the second with control bit 1 and so on.
Alternatively an array can be provided mapping array elements to
pins. For example, the following will map the array indices to pins 3,
2 and 7 of the port::
char pin_map[3] = {3, 2, 7};
int main() {
...
par {
output_gpio(i_gpio, 3, p, pin_map);
...
Output GPIO API
---------------
All GPIO functions can be accessed via the ``gpio.h`` header::
#include <gpio.h>
You will also have to add ``lib_gpio`` to the
``USED_MODULES`` field of your application Makefile.
Output GPIO components
......................
.. doxygenfunction:: output_gpio
|newpage|
Output GPIO interface
.....................
.. doxygeninterface:: output_gpio_if
Input GPIO API
--------------
Input GPIO components
......................
.. doxygenfunction:: input_gpio
.. doxygenfunction:: input_gpio_with_events
|newpage|
.. doxygenfunction:: input_gpio_1bit_with_events
|newpage|
Input GPIO interface
....................
.. doxygeninterface:: input_gpio_if
|appendix|
Known Issues
------------
No known issues.
.. include:: ../../../CHANGELOG.rst

View File

@@ -0,0 +1,2 @@
XMOSNEWSTYLE = 1
DOXYGEN_DIRS=../../api

View File

@@ -0,0 +1,6 @@
set(LIB_NAME lib_gpio)
set(LIB_VERSION 2.2.0)
set(LIB_INCLUDES api)
set(LIB_COMPILER_FLAGS -Os)
XMOS_REGISTER_MODULE()

View File

@@ -0,0 +1,14 @@
VERSION = 2.2.0
DEPENDENT_MODULES = lib_xassert(>=4.0.0)
MODULE_XCC_FLAGS = $(XCC_FLAGS) \
-O3
OPTIONAL_HEADERS +=
EXPORT_INCLUDE_DIRS = api
INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS)
SOURCE_DIRS = src

View File

@@ -0,0 +1,163 @@
// Copyright 2014-2021 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <xs1.h>
#include <gpio.h>
#include <xassert.h>
#include <print.h>
[[distributable]]
void input_gpio(server input_gpio_if i[n], static const size_t n,
in port p, char (&?pin_map)[n])
{
char *pmap;
char default_pmap[n];
if (!isnull(pin_map)) {
pmap = pin_map;
}
else {
pmap = default_pmap;
for (size_t i = 0; i < n; i++)
pmap[i] = i;
}
while (1) {
select {
case i[int j].input() -> unsigned result:
unsigned pos = pmap[j];
p :> result;
result = (result >> pos) & 1;
break;
case i[int j].input_and_timestamp(gpio_time_t &ts) -> unsigned result:
unsigned pos = pmap[j];
p :> result @ ts;
result = (result >> pos) & 1;
break;
case i[int j].event_when_pins_eq(unsigned value):
fail("input_gpio task does not support events.");
break;
}
}
}
#pragma unsafe arrays
[[combinable]]
void input_gpio_with_events(server input_gpio_if i[n],
static const size_t n,
in port p,
char (&?pin_map)[n])
{
char *pmap;
char default_pmap[32];
if (!isnull(pin_map)) {
pmap = pin_map;
}
else {
pmap = default_pmap;
for (size_t i = 0; i < n; i++)
pmap[i] = i;
}
unsigned pval = 0;
char test_vals[32];
unsigned waiting = 0;
for (size_t j = 0; j < n; j++)
test_vals[j] = -1;
while (1) {
select {
case i[int j].input() -> unsigned result:
unsigned pos = pmap[j];
p :> result;
result = (result >> pos) & 1;
break;
case i[int j].input_and_timestamp(gpio_time_t &ts) -> unsigned result:
unsigned pos = pmap[j];
p :> result @ ts;
result = (result >> pos) & 1;
break;
case i[int j].event_when_pins_eq(unsigned value):
unsigned val;
p :> val;
unsigned pos = pmap[j];
unsigned bit = (val >> pos) & 1;
if (bit == value)
i[j].event();
else {
if (test_vals[j] != -1)
waiting++;
test_vals[j] = value;
}
break;
case waiting => p when pinsneq(pval) :> pval:
for (size_t j = 0; j < n; j++) {
unsigned pos = pmap[j];
unsigned bit = (pval >> pos) & 1;
if (bit == test_vals[j]) {
test_vals[j] = -1;
waiting--;
i[j].event();
}
}
break;
}
}
}
[[combinable]]
void input_gpio_1bit_with_events(server input_gpio_if i, in port p)
{
unsigned test_val = -1;
while (1) {
select {
case i.input() -> unsigned result:
p :> result;
break;
case i.input_and_timestamp(gpio_time_t &ts) -> unsigned result:
p :> result @ ts;
break;
case i.event_when_pins_eq(unsigned value):
test_val = value;
break;
case (test_val != -1) => p when pinseq(test_val) :> int:
i.event();
test_val = -1;
break;
}
}
}
[[distributable]]
void output_gpio(server output_gpio_if i[n], static const size_t n, out port p,
char (&?pin_map)[n])
{
char *pmap;
char default_pmap[n];
if (!isnull(pin_map)) {
pmap = pin_map;
}
else {
pmap = default_pmap;
for (size_t i = 0; i < n; i++)
pmap[i] = i;
}
unsigned current_val = 0;
while (1) {
select {
case i[int j].output(unsigned data):
unsigned pos = pmap[j];
current_val &= ~(1 << pos);
current_val |= ((data & 1) << pos);
p <: current_val;
break;
case i[int j].output_and_timestamp(unsigned data) -> gpio_time_t ts:
unsigned pos = pmap[j];
current_val &= ~(1 << pos);
current_val |= ((data & 1) << pos);
p <: current_val @ ts;
break;
}
}
}