This commit is contained in:
Steven Dan
2025-12-11 09:43:42 +08:00
commit d8b2974133
1822 changed files with 280037 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
# This variable should contain a space separated list of all
# the directories containing buildable applications (usually
# prefixed with the app_ prefix)
TARGET = xk-audio-316-mc.xn
BUILD_SUBDIRS = all
XMOS_MAKE_PATH ?= ../..
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.toplevel

View File

@@ -0,0 +1,23 @@
GPIO library change log
=======================
1.1.0
-----
* CHANGE: Minor documentation clarifications
* CHANGE: Update to dependency (lib_xassert moved to 3.0.0)
1.0.1
-----
* CHANGE: Update to source code license and copyright
1.0.0
-----
* Initial version
* Changes to dependencies:
- lib_xassert: Added dependency 2.0.0

View File

@@ -0,0 +1,135 @@
Software Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS GPIO Library software

View File

@@ -0,0 +1,38 @@
GPIO Library
============
Overview
--------
The XMOS GPIO library allows you to access xCORE ports as low-speed GPIO.
Although xCORE ports can be directly accessed via the xC programming
language this library allows more flexible usage. In particular, it
allows splitting a multi-pin output/input port to be able to use
the individual pins independently. It also allows accessing ports
across separate XMOS tiles or separate XMOS chips.
Features
........
* Abstract interface to GPIO functionality of XMOS ports
* Allow control of individual bits of multi-bit ports
* Allow access to ports across tiles
Operating modes
...............
* Multi-bit output for individual access to the pins of a multi-bit output port
* Multi-bit input for individual access to the pins of a multi-bit input port
* Multi-bit input for individual access to the pins of a multi-bit
input port allowing the application to react to events on those pins
Software version and dependencies
.................................
.. libdeps::
Related application notes
.........................
Currently there are none.

View File

@@ -0,0 +1,147 @@
<?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.46435934">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.xmos.cdt.toolchain.46435934" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<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"/>
<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="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="com.xmos.cdt.toolchain.46435934" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.xmos.cdt.toolchain.46435934.994461067" name="/" resourcePath="">
<toolChain id="com.xmos.cdt.toolchain.915945165" 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.1295623694" isAbstract="false" osList="linux,win32,macosx" superClass="com.xmos.cdt.core.platform"/>
<builder arguments="-f .makefile" id="com.xmos.cdt.builder.base.1923925932" 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.630334932" name="com.xmos.cdt.xc.compiler" superClass="com.xmos.cdt.xc.compiler">
<option id="com.xmos.xc.compiler.option.include.paths.212699714" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/api}&quot;"/>
</option>
<inputType id="com.xmos.cdt.xc.compiler.input.1430989123" name="XC" superClass="com.xmos.cdt.xc.compiler.input"/>
</tool>
<tool id="com.xmos.cdt.c.compiler.269094589" name="com.xmos.cdt.c.compiler" superClass="com.xmos.cdt.c.compiler">
<option id="com.xmos.c.compiler.option.include.paths.744265693" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/api}&quot;"/>
</option>
<inputType id="com.xmos.cdt.c.compiler.input.c.1750333219" name="C" superClass="com.xmos.cdt.c.compiler.input.c"/>
</tool>
<tool id="com.xmos.cdt.cxx.compiler.7310650" name="com.xmos.cdt.cxx.compiler" superClass="com.xmos.cdt.cxx.compiler">
<option id="com.xmos.cxx.compiler.option.include.paths.194336916" superClass="com.xmos.cxx.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib_xassert/api}&quot;"/>
</option>
<inputType id="com.xmos.cdt.cxx.compiler.input.cpp.1977937924" 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="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 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" 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 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" 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 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="lib_gpio.null.455119933" name="lib_gpio"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

View File

@@ -0,0 +1,8 @@
all:
@echo "** Module only - only builds as part of application **"
clean:
@echo "** Module only - only builds as part of application **"

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lib_gpio</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.xmos.cdt.core.LegacyProjectCheckerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.ModulePathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.ProjectInfoSyncBuilder</name>
<arguments>
</arguments>
</buildCommand>
<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,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<xproject><repository>lib_gpio</repository>
<version>1.1.0</version>
</xproject>

View File

@@ -0,0 +1,135 @@
Software Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS GPIO Library software

View File

@@ -0,0 +1,156 @@
// Copyright (c) 2014-2016, XMOS Ltd, All rights reserved
#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,3 @@
VERSION = 1.1.0
DEPENDENT_MODULES = lib_xassert(>=3.0.0)
MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3

View File

@@ -0,0 +1,162 @@
// Copyright (c) 2014-2016, XMOS Ltd, All rights reserved
#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;
}
}
}

View File

@@ -0,0 +1,19 @@
lib_xassert change log
======================
3.0.0
-----
* CHANGE: Renamed DEBUG_UNIT to XASSERT_UNIT to prevent conflict with
lib_logging
2.0.1
-----
* CHANGE: Update to source code license and copyright
2.0.0
-----
* CHANGE: Restructured library

View File

@@ -0,0 +1,135 @@
Software Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS Lightweight assertions library software

View File

@@ -0,0 +1,23 @@
Lightweight assertions library
==============================
Overview
--------
This library provides a lightweight and flexible replacement for the
standard C header ``assert.h``.
The assertions in this library can be be enabled/disabled
and configured as to how much information they show. This
configuration can be per "xassert unit" (i.e. for sets of files).
Features
........
* Low memory usage
* Ability to enable or disable various features via compile time defines
Software version and dependencies
.................................
.. libdeps::

View File

@@ -0,0 +1,132 @@
<?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.1173484762">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.xmos.cdt.toolchain.1173484762" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<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"/>
<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="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="com.xmos.cdt.toolchain.1173484762" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.xmos.cdt.toolchain.1173484762.88599679" name="/" resourcePath="">
<toolChain id="com.xmos.cdt.toolchain.352234306" 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.1645263691" isAbstract="false" osList="linux,win32,macosx" superClass="com.xmos.cdt.core.platform"/>
<builder arguments="-f .makefile" id="com.xmos.cdt.builder.base.1026011494" 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.2044135747" name="com.xmos.cdt.xc.compiler" superClass="com.xmos.cdt.xc.compiler">
<inputType id="com.xmos.cdt.xc.compiler.input.1602920927" name="XC" superClass="com.xmos.cdt.xc.compiler.input"/>
</tool>
<tool id="com.xmos.cdt.c.compiler.842403187" name="com.xmos.cdt.c.compiler" superClass="com.xmos.cdt.c.compiler">
<inputType id="com.xmos.cdt.c.compiler.input.c.768216315" name="C" superClass="com.xmos.cdt.c.compiler.input.c"/>
</tool>
<tool id="com.xmos.cdt.cxx.compiler.1999172263" name="com.xmos.cdt.cxx.compiler" superClass="com.xmos.cdt.cxx.compiler">
<inputType id="com.xmos.cdt.cxx.compiler.input.cpp.259271254" 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="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 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" 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 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" 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 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="lib_xassert.null.986642502" name="lib_xassert"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

View File

@@ -0,0 +1,8 @@
all:
@echo "** Module only - only builds as part of application **"
clean:
@echo "** Module only - only builds as part of application **"

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lib_xassert</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.xmos.cdt.core.LegacyProjectCheckerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.ProjectCheckerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.BuildMarkersBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.ProjectInfoSyncBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.xmos.cdt.core.IncludePathBuilder</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>
<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>-f .makefile</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,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<xproject><repository>lib_xassert</repository>
<version>3.0.0</version>
</xproject>

View File

@@ -0,0 +1,135 @@
Software Release License Agreement
Copyright (c) 2016, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
Parties:
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
(2) An individual or legal entity exercising permissions granted by this License (Customer).
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
1. Definitions
"License" means this Software License and any schedules or annexes to it.
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
Unless the context otherwise requires:
- references to XMOS and the Customer include their permitted successors and assigns;
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
- references to any gender include all genders.
Words in the singular include the plural and in the plural include the singular.
2. License
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
3. Consideration
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
4. Term
Subject to clause 12 below, this License shall be perpetual.
5. Restrictions on Use
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
6. Modifications
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
XMOS will own all intellectual property rights in the XMOS Modifications.
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
7. Support
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
8. Warranty and Disclaimer
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
9. High Risk Activities
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
10. Liability
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
11. Ownership
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
12. Termination
Either party may terminate this License at any time on written notice to the other if the other:
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
On termination for any reason:
- all rights granted to the Customer under this License shall cease;
- the Customer shall cease all activities authorised by this License;
- the Customer shall immediately pay any sums due to XMOS under this License; and
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
13. Third party rights
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
14. Confidentiality and publicity
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
15. Entire agreement
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
16. Assignment
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
17. Governing law and jurisdiction
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS Lightweight assertions library software

View File

@@ -0,0 +1,113 @@
// Copyright (c) 2014-2016, XMOS Ltd, All rights reserved
#ifndef __xassert_h__
#define __xassert_h__
#ifdef __xassert_conf_h_exists__
#include "xassert_conf.h"
#endif
#ifdef __debug_conf_h_exists__
#include "debug_conf.h"
#endif
#ifndef XASSERT_UNIT
#define XASSERT_UNIT APPLICATION
#endif
#ifndef XASSERT_ENABLE_ASSERTIONS
#define XASSERT_ENABLE_ASSERTIONS 1
#endif
#ifndef XASSERT_ENABLE_DEBUG
#define XASSERT_ENABLE_DEBUG 0
#endif
#ifndef XASSERT_ENABLE_LINE_NUMBERS
#define XASSERT_ENABLE_LINE_NUMBERS 0
#endif
#define XASSERT_JOIN0(x,y) x ## y
#define XASSERT_JOIN(x,y) XASSERT_JOIN0(x,y)
#if XASSERT_JOIN(XASSERT_ENABLE_ASSERTIONS_,XASSERT_UNIT)
# define XASSERT_ENABLE_ASSERTIONS0 1
#endif
#if XASSERT_JOIN(XASSERT_DISABLE_ASSERTIONS_,XASSERT_UNIT)
# define XASSERT_ENABLE_ASSERTIONS0 0
#endif
#if !defined(XASSERT_ENABLE_ASSERTIONS0)
# define XASSERT_ENABLE_ASSERTIONS0 XASSERT_ENABLE_ASSERTIONS
#endif
#if XASSERT_JOIN(XASSERT_ENABLE_DEBUG_,XASSERT_UNIT)
# define XASSERT_ENABLE_DEBUG0 1
#endif
#if XASSERT_JOIN(XASSERT_DISABLE_DEBUG_,XASSERT_UNIT)
# define XASSERT_ENABLE_DEBUG0 0
#endif
#if !defined(XASSERT_ENABLE_DEBUG0)
# define XASSERT_ENABLE_DEBUG0 XASSERT_ENABLE_DEBUG
#endif
#if XASSERT_ENABLE_DEBUG0
# include "print.h"
#endif
#if XASSERT_ENABLE_LINE_NUMBERS
# define xassert_print_line do { printstr(" (" __FILE__ ":"); \
printint(__LINE__); \
printstr(")\n"); \
} while(0)
#else
# define xassert_print_line do { printstr("\n"); } while(0)
#endif
#if XASSERT_ENABLE_ASSERTIONS0
# if XASSERT_ENABLE_DEBUG0
# define xassert(e) do { if (!(e)) {\
printstr(#e); xassert_print_line; \
__builtin_trap();} \
} while(0)
# else
# define xassert(e) do { if (!(e)) __builtin_trap();} while(0)
# endif
#else
# define xassert(e) // disabled
#endif
#if XASSERT_ENABLE_ASSERTIONS0
# if XASSERT_ENABLE_DEBUG0
# define unreachable(msg) do { printstr(msg); xassert_print_line; __builtin_trap();} while(0)
# else
# define unreachable(msg) do { __builtin_trap();} while(0)
# endif
#else
# define unreachable(msg) do { __builtin_unreachable();} while(0)
#endif
#if XASSERT_ENABLE_DEBUG0
# define fail(msg) do { printstr(msg); xassert_print_line; __builtin_trap();} while(0)
#else
# define fail(msg) do { __builtin_trap();} while(0)
#endif
inline int xassert_msg(const char msg[]) { return 1; }
#ifdef __XC__
#define _msg(x) xassert_msg(x)
#define msg(x) xassert_msg(x)
#else
#define _msg(x) x
#define msg(x) x
#endif
#if !defined(assert) && !XASSERT_DISABLE_ASSERT_DEF
#define assert(...) xassert(__VA_ARGS__)
#endif
#endif // __xassert_h__

View File

@@ -0,0 +1,3 @@
OPTIONAL_HEADERS += debug_conf.h xassert_conf.h
VERSION = 3.0.0

View File

@@ -0,0 +1,4 @@
// Copyright (c) 2014-2016, XMOS Ltd, All rights reserved
#include "xassert.h"
extern inline int xassert_msg(const char msg[]);

View File

@@ -0,0 +1,28 @@
TARGET = PHATEN_GS.xn
SOURCE = loader.xc
OBJS = loader.o
OUT =
CC = xcc
CFLAGS = -c -Wall -march=xs3a
LFLAGS = -lflash
all: $(OBJS)
loader.o: loader.xc
$(CC) $(TARGET) $(FLAGS) loader.xc -o $(OBJS)
$(OUT):loader.o
$(CC) loader.o $(TARGET) $(LFLAGS) -o $(OUT)
clean:
rm -f $(OBJS) $(OUT)
XMOS_MAKE_PATH ?= ../..
ifneq ($(wildcard $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common),)
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
else
include ../module_xcommon/build/Makefile.common
endif

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
<Declarations>
<Declaration>tileref tile[2]</Declaration>
<Declaration>tileref usb_tile</Declaration>
</Declarations>
<Packages>
<Package id="0" Type="XS3-UnA-1024-QF60A">
<Nodes>
<!-- Note that this clock setting is overridden by the app by writing directly to the PLL -->
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" SystemFrequency="600MHz" Oscillator="24MHz" referencefrequency="100MHz">
<Boot>
<Source Location="bootFlash"/>
</Boot>
<!-- <Extmem sizeMbit="1024" Frequency="175MHz">
<Padctrl clk="0x0" cke="0x0" cs_n="0x0" we_n="0x0" cas_n="0x0" ras_n="0x0" addr="0x0" ba="0x0" dq="0x0" dqs="0x0" dm="0x0"/>
<Lpddr lmr_opcode="0x0" emr_opcode="0x0"/>
</Extmem> -->
<Tile Number="0" Reference="tile[0]">
<!-- QSPI ports -->
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS_0"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK_0"/>
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO_0"/>
<!-- SPI ports -->
<Port Location="XS1_PORT_1A" Name="PORT_SSB"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK_0"/>
<Port Location="XS1_PORT_1D" Name="PORT_SPI_MOSI"/>
<Port Location="XS1_PORT_1P" Name="PORT_SPI_MISO"/>
<!-- I2C ports -->
<Port Location="XS1_PORT_1N" Name="PORT_I2C_SCL"/>
<Port Location="XS1_PORT_1O" Name="PORT_I2C_SDA"/>
<!-- GPIO ports -->
<Port Location="XS1_PORT_8C" Name="PORT_GPO"/>
<Port Location="XS1_PORT_8D" Name="PORT_GPI"/>
<Port Location="XS1_PORT_1P" Name="PORT_ADC_RST"/>
<!-- Used for keeping XUA happy only -->
<Port Location="XS1_PORT_1G" Name="PORT_NOT_IN_PACKAGE_0"/>
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN_USB"/>
</Tile>
<Tile Number="1" Reference="tile[1]">
<!-- MIC related ports -->
<Port Location="XS1_PORT_1G" Name="PORT_PDM_CLK"/>
<Port Location="XS1_PORT_1F" Name="PORT_PDM_DATA"/>
<!-- Audio ports -->
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN"/>
<Port Location="XS1_PORT_1C" Name="PORT_I2S_BCLK"/>
<Port Location="XS1_PORT_1B" Name="PORT_I2S_LRCLK"/>
<Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC0"/>
<Port Location="XS1_PORT_1A" Name="PORT_I2S_DAC0"/>
</Tile>
</Node>
</Nodes>
</Package>
</Packages>
<Nodes>
<Node Id="2" Type="device:" RoutingId="0x8000">
<Service Id="0" Proto="xscope_host_data(chanend c);">
<Chanend Identifier="c" end="3"/>
</Service>
</Node>
</Nodes>
<Links>
<Link Encoding="2wire" Delays="5clk" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="XL0"/>
<LinkEndpoint NodeId="2" Chanend="1"/>
</Link>
</Links>
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS_0"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK_0"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO_0"/>
</Device>
</ExternalDevices>
<JTAGChain>
<JTAGDevice NodeId="0"/>
</JTAGChain>
</Network>

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,211 @@
// Copyright (c) 2016, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <platform.h>
//port SPI_MOSI = XS1_PORT_1D; // e.g., XS1_PORT_1D
//port SPI_MISO = XS1_PORT_1A; // e.g., XS1_PORT_1A
//port SPI_CLK = XS1_PORT_1C; // e.g., XS1_PORT_1C
//port SPI_SS = XS1_PORT_1B; // e.g., XS1_PORT_1B
#if defined(__XS2A__)
/* Note range 0x7FFC8 - 0x7FFFF guarenteed to be untouched by tools */
#warning Building xCORE-200 compatible loader
#define FLAG_ADDRESS 0x7ffcc
#else
/* Note range 0xFFFC8 - 0xFFFFF guarenteed to be untouched by tools */
#warning Building xcore.ai compatible loader
#define FLAG_ADDRESS 0xfffcc
#endif
/* Store Flag to fixed address */
void SetRoleSwitchFlag(unsigned x)
{
asm volatile("stw %0, %1[0]" :: "r"(x), "r"(FLAG_ADDRESS));
}
/* Load flag from fixed address */
unsigned GetRoleSwitchFlag()
{
unsigned x;
asm volatile("ldw %0, %1[0]" : "=r"(x) : "r"(FLAG_ADDRESS));
return x;
}
void delay_cycles(int count) {
for (int i = 0; i < count; i++) {
asm volatile (""); // Prevent compiler removal.
}
}
/*
* spi_transact_32_full: Sends 32 bits out on MOSI and simultaneously reads 32 bits from MISO.
*
* Parameters:
* unsigned data - The 32-bit word to send over MOSI.
*
* Returns:
* The 32-bit word received from MISO.
*
* Assumptions:
* - The chip-select (SS) is already asserted (active low).
* - The SPI_CLK, SPI_MOSI, and SPI_MISO ports have been correctly defined in the XN file.
* - The transfer is LSB-first; adjust shifting/ordering if your device expects MSB-first.
*/
//unsigned spi_transact_32_full(unsigned data) {
// unsigned received = 0;
// for (int bit = 0; bit < 32; bit++) {
// // Drive clock low.
// SPI_CLK <: 0;
// delay_cycles(5);
//
// // Set MOSI line according to the current LSB of data.
// if (data & 0x1)
// SPI_MOSI <: 1;
// else
// SPI_MOSI <: 0;
// delay_cycles(5);
//
// // Raise clock; the rising edge clocks both the outgoing bit and makes the incoming bit valid.
// SPI_CLK <: 1;
// delay_cycles(5);
//
// // Read the corresponding MISO bit.
// int bit_val = 0;
// SPI_MISO :> bit_val;
// bit_val &= 0x1;
//
// received |= (bit_val << bit);
//
// // Prepare the next bit to be transmitted.
// data >>= 1;
// }
// // Ensure the clock ends in a low state.
// SPI_CLK <: 0;
// return received;
//}
/* Port for button on xk-audio-316 board. */
in port p_button = XS1_PORT_4E;
out port port_audio_config = XS1_PORT_8D;
/* Enum for representing button state. */
enum button_val
{
MODE_STEREO,
MODE_71_GAME,
MODE_TOTAL
};
/* Store the button position. */
int buttonPosition;
/* Enum for representing the potential interest in the image. */
enum interest
{
NOT_INTERESTED = 0,
INTERESTED = 1
};
#define SWITCH_TO_STEREO_DNR_OFF 0x01
#define SWITCH_TO_STEREO_DNR_ON 0x02
#define SWITCH_TO_71_DNR_OFF 0x03
#define SWITCH_TO_71_DNR_ON 0x04
int get_ids() {
// TODO, consider just bit bashing SPI at a low speed to just get the darn FlashIdNum!
int success;
// success = fl_connect(SPI);
// Check success
// int identifier = fl_getFlashIdNum();
// unsigned char idStr[MAX_LEN];
// success = fl_getFlashIdStr(idStr, MAX_LEN);
// Check success
// success = spi_transact_32_full(0x9F);
// success = spi_transact_32_full(0x9F);
// success = spi_transact_32_full(0x9F);
return success;
}
/* Store the version of the image in memory that will potentially be booted. */
int candidateImageVersion = -1;
/* Store the address of the image in memory that will potentially be booted. */
unsigned candidateImageAddress;
void init(void)
{
//port_audio_config <: 0b00100000;
delay_milliseconds(10);
unsigned buttonVal;
/* Read state of button. */
//buttonVal=get_ids();//p_button :> buttonVal;
buttonVal = GetRoleSwitchFlag();
if (buttonVal == 0) {
buttonPosition = MODE_TOTAL;
} else {
if ( (buttonVal == SWITCH_TO_STEREO_DNR_OFF) || (buttonVal == SWITCH_TO_STEREO_DNR_ON)) {
buttonPosition = MODE_STEREO;
} else {
buttonPosition = MODE_71_GAME;
}
}
#if 0
/* Button is up. */
if((buttonVal) > 1)
{
buttonPosition = MODE_STEREO;
}
/* Button is down. */
else
{
buttonPosition = MODE_71_GAME;
}
#endif
}
extern int checkCandidateImageVersion(int imageVersion)
{
/* If the button is up and imageVersion is even and imageVersion is higher */
/* than the last candidateImageVersion then this is a potential version */
/* for booting. */
if (buttonPosition == MODE_TOTAL) return INTERESTED;
if ((buttonPosition == MODE_71_GAME) &&
((imageVersion % 2) == 0) /*&&*/
/*(imageVersion > candidateImageVersion)*/)
{
return INTERESTED;
}
/* If the button is down and imageVersion is odd and imageVersion is higher */
/* than the last candidateImageVersion then this is a potential version */
/* for booting. */
else if ((buttonPosition == MODE_STEREO) &&
((imageVersion % 2) != 0) /*&&*/
/*(imageVersion > candidateImageVersion)*/)
{
return INTERESTED;
}
/* Not a potential firmware image in all other cases. */
return NOT_INTERESTED;
}
extern void recordCandidateImage(int imageVersion, unsigned imageAddress)
{
/* Save the imageVersion that we are interested in. */
candidateImageVersion = imageVersion;
/* Save the imageAddress of the imageVersion that we are interested in. */
candidateImageAddress = imageAddress;
}
extern unsigned reportSelectedImage(void)
{
/* Return the candidateImageAddress of the image that we are interested in. */
return candidateImageAddress;
}

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
<Declarations>
<Declaration>tileref tile[2]</Declaration>
<Declaration>tileref usb_tile</Declaration>
</Declarations>
<Packages>
<Package id="0" Type="XS3-UnA-1024-QF60A">
<Nodes>
<!-- Note that this clock setting is overridden by the app by writing directly to the PLL -->
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" SystemFrequency="800MHz" Oscillator="24MHz" referencefrequency="100MHz">
<Boot>
<Source Location="bootFlash"/>
</Boot>
<!-- <Extmem sizeMbit="1024" Frequency="175MHz">
<Padctrl clk="0x0" cke="0x0" cs_n="0x0" we_n="0x0" cas_n="0x0" ras_n="0x0" addr="0x0" ba="0x0" dq="0x0" dqs="0x0" dm="0x0"/>
<Lpddr lmr_opcode="0x0" emr_opcode="0x0"/>
</Extmem> -->
<Tile Number="0" Reference="tile[0]">
<!-- QSPI ports -->
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS_0"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK_0"/>
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO_0"/>
<!-- SPI ports -->
<Port Location="XS1_PORT_1A" Name="PORT_SSB"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK_0"/>
<Port Location="XS1_PORT_1D" Name="PORT_SPI_MOSI"/>
<Port Location="XS1_PORT_1P" Name="PORT_SPI_MISO"/>
<!-- I2C ports -->
<Port Location="XS1_PORT_1N" Name="PORT_I2C_SCL"/>
<Port Location="XS1_PORT_1O" Name="PORT_I2C_SDA"/>
<!-- GPIO ports -->
<Port Location="XS1_PORT_8C" Name="PORT_GPO"/>
<Port Location="XS1_PORT_8D" Name="PORT_GPI"/>
<Port Location="XS1_PORT_1P" Name="PORT_ADC_RST"/>
<!-- Used for keeping XUA happy only -->
<Port Location="XS1_PORT_1G" Name="PORT_NOT_IN_PACKAGE_0"/>
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN_USB"/>
</Tile>
<Tile Number="1" Reference="tile[1]">
<!-- MIC related ports -->
<Port Location="XS1_PORT_1G" Name="PORT_PDM_CLK"/>
<Port Location="XS1_PORT_1F" Name="PORT_PDM_DATA"/>
<!-- Audio ports -->
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN"/>
<Port Location="XS1_PORT_1C" Name="PORT_I2S_BCLK"/>
<Port Location="XS1_PORT_1B" Name="PORT_I2S_LRCLK"/>
<Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC0"/>
<Port Location="XS1_PORT_1A" Name="PORT_I2S_DAC0"/>
</Tile>
</Node>
</Nodes>
</Package>
</Packages>
<Nodes>
<Node Id="2" Type="device:" RoutingId="0x8000">
<Service Id="0" Proto="xscope_host_data(chanend c);">
<Chanend Identifier="c" end="3"/>
</Service>
</Node>
</Nodes>
<Links>
<Link Encoding="2wire" Delays="5clk" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="XL0"/>
<LinkEndpoint NodeId="2" Chanend="1"/>
</Link>
</Links>
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS_0"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK_0"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO_0"/>
</Device>
</ExternalDevices>
<JTAGChain>
<JTAGDevice NodeId="0"/>
</JTAGChain>
</Network>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
<Type>Board</Type>
<Name>xcore.ai MC Audio Board</Name>
<Declarations>
<Declaration>tileref tile[2]</Declaration>
</Declarations>
<Packages>
<Package id="0" Type="XS3-UnA-1024-TQ128">
<Nodes>
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
<Boot>
<Source Location="bootFlash"/>
</Boot>
<Tile Number="0" Reference="tile[0]">
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
<!-- Various ctrl signals -->
<Port Location="XS1_PORT_8D" Name="PORT_CTRL"/>
<!-- I2C -->
<Port Location="XS1_PORT_1L" Name="PORT_I2C_SCL"/>
<Port Location="XS1_PORT_1M" Name="PORT_I2C_SDA"/>
<!-- Clocking -->
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN_USB"/>
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
<!-- Audio Ports: Digital -->
<Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN"/> <!-- N: Coax O: Optical -->
<Port Location="XS1_PORT_1N" Name="PORT_SPDIF_IN"/> <!-- N: Coax O: Optical -->
</Tile>
<Tile Number="1" Reference="tile[1]">
<!-- Audio Ports: I2S -->
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN"/>
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT_2"/>
<Port Location="XS1_PORT_1B" Name="PORT_I2S_LRCLK"/>
<Port Location="XS1_PORT_1C" Name="PORT_I2S_BCLK"/>
<Port Location="XS1_PORT_1P" Name="PORT_I2S_DAC0"/>
<port Location="XS1_PORT_1O" Name="PORT_I2S_DAC1"/>
<port Location="XS1_PORT_1N" Name="PORT_I2S_DAC2"/>
<port Location="XS1_PORT_1M" Name="PORT_I2S_DAC3"/>
<Port Location="XS1_PORT_1I" Name="PORT_I2S_ADC0"/>
<Port Location="XS1_PORT_1J" Name="PORT_I2S_ADC1"/>
<Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC2"/>
<Port Location="XS1_PORT_1L" Name="PORT_I2S_ADC3"/>
<!-- Audio Ports: Digital -->
<Port Location="XS1_PORT_1G" Name="PORT_ADAT_OUT"/> <!-- A: Coax G: Optical -->
<Port Location="XS1_PORT_1A" Name="PORT_SPDIF_OUT"/> <!-- A: Coax G: Optical -->
<!-- MIDI -->
<Port Location="XS1_PORT_1F" Name="PORT_MIDI_IN"/>
<Port Location="XS1_PORT_4C" Name="PORT_MIDI_OUT"/> <!-- bit[0] -->
</Tile>
</Node>
</Nodes>
</Package>
</Packages>
<Nodes>
<Node Id="2" Type="device:" RoutingId="0x8000">
<Service Id="0" Proto="xscope_host_data(chanend c);">
<Chanend Identifier="c" end="3"/>
</Service>
</Node>
</Nodes>
<Links>
<Link Encoding="2wire" Delays="5clk" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="XL0"/>
<LinkEndpoint NodeId="2" Chanend="1"/>
</Link>
</Links>
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" PageSize="256" SectorSize="4096" NumPages="16384">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
</Device>
</ExternalDevices>
<JTAGChain>
<JTAGDevice NodeId="0"/>
</JTAGChain>
</Network>