--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">\r
+ <storageModule moduleId="org.eclipse.cdt.core.settings">\r
+ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252">\r
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" moduleId="org.eclipse.cdt.core.settings" name="Debug">\r
+ <externalSettings/>\r
+ <extensions>\r
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>\r
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ </extensions>\r
+ </storageModule>\r
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
+ <configuration artifactName="${ProjName}.elf" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="cdt.managedbuild.config.gnu.cross.exe.debug">\r
+ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252." name="/" resourcePath="">\r
+ <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.789129042" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">\r
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2002050800" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>\r
+ <builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="cdt.managedbuild.builder.gnu.cross.948905772" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>\r
+ <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.compiler.533761585" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">\r
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1982035836" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
+ <option defaultValue="gnu.c.debugging.level.max" id="gnu.c.compiler.option.debugging.level.100403442" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
+ <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1552631522" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/full_demo/standard_demo_tasks/include}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/env}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/include}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/env/freedom-e300-hifive1}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/include}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V}""/>\r
+ </option>\r
+ <option id="gnu.c.compiler.option.misc.other.1598749994" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections --specs=nano.specs -fno-builtin-printf" valueType="string"/>\r
+ <option id="gnu.c.compiler.option.warnings.extrawarn.527816261" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
+ <option id="gnu.c.compiler.option.dialect.std.1770102192" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>\r
+ <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.252676358" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">\r
+ <listOptionValue builtIn="false" value="DONT_USE_PLIC"/>\r
+ <listOptionValue builtIn="false" value="DONT_USE_M_TIME"/>\r
+ </option>\r
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1494581004" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>\r
+ </tool>\r
+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.421489488" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">\r
+ <option id="gnu.cpp.compiler.option.optimization.level.468217435" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>\r
+ <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="gnu.cpp.compiler.option.debugging.level.1238097403" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
+ </tool>\r
+ <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.linker.25704515" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">\r
+ <option id="gnu.c.link.option.nostart.547444896" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
+ <option id="gnu.c.link.option.ldflags.385740302" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="--specs=nano.specs -Xlinker --gc-sections -Wl,-Map,RTOSDemo.map -T../freedom-e-sdk/env/freedom-e300-hifive1/flash.lds -march=rv32imac -mabi=ilp32 -mcmodel=medlow -Xlinker --defsym=__stack_size=400 -Wl,--start-group -Wl,--end-group -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=open -Wl,--wrap=lseek -Wl,--wrap=read -Wl,--wrap=write -Wl,--wrap=fstat -Wl,--wrap=stat -Wl,--wrap=close -Wl,--wrap=link -Wl,--wrap=unlink -Wl,--wrap=execve -Wl,--wrap=fork -Wl,--wrap=getpid -Wl,--wrap=kill -Wl,--wrap=wait -Wl,--wrap=isatty -Wl,--wrap=times -Wl,--wrap=sbrk -Wl,--wrap=_exit -Wl,--wrap=puts -Wl,--wrap=_malloc -Wl,--wrap=_free -Wl,--wrap=_open -Wl,--wrap=_lseek -Wl,--wrap=_read -Wl,--wrap=_write -Wl,--wrap=_fstat -Wl,--wrap=_stat -Wl,--wrap=_close -Wl,--wrap=_link -Wl,--wrap=_unlink -Wl,--wrap=_execve -Wl,--wrap=_fork -Wl,--wrap=_getpid -Wl,--wrap=_kill -Wl,--wrap=_wait -Wl,--wrap=_isatty -Wl,--wrap=_times -Wl,--wrap=_sbrk -Wl,--wrap=__exit -Wl,--wrap=_puts" valueType="string"/>\r
+ <option id="gnu.c.link.option.nostdlibs.1587538414" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>\r
+ <option id="gnu.c.link.option.nodeflibs.49453984" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>\r
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1563926647" superClass="cdt.managedbuild.tool.gnu.c.linker.input">\r
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>\r
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>\r
+ </inputType>\r
+ </tool>\r
+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1074348850" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>\r
+ <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1004176495" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>\r
+ <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.assembler.1968317442" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">\r
+ <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1729858113" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions}""/>\r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/include}""/>\r
+ </option>\r
+ <option id="gnu.both.asm.option.flags.1595900562" name="Assembler flags" superClass="gnu.both.asm.option.flags" useByScannerDiscovery="false" value="-march=rv32imac -mabi=ilp32 -mcmodel=medlow -c -DportasmHANDLE_INTERRUPT=handle_trap -g3" valueType="string"/>\r
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1322122265" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>\r
+ </tool>\r
+ </toolChain>\r
+ </folderInfo>\r
+ <sourceEntries>\r
+ <entry excluding="freedom-e-sdk/drivers" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
+ </sourceEntries>\r
+ </configuration>\r
+ </storageModule>\r
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>\r
+ </cconfiguration>\r
+ </storageModule>\r
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
+ <project id="RTOSDemo.cdt.managedbuild.target.gnu.cross.exe.103083601" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>\r
+ </storageModule>\r
+ <storageModule moduleId="scannerConfiguration">\r
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>\r
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.244253252;cdt.managedbuild.config.gnu.cross.exe.debug.244253252.;cdt.managedbuild.tool.gnu.cross.c.compiler.533761585;cdt.managedbuild.tool.gnu.c.compiler.input.1494581004">\r
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>\r
+ </scannerConfigBuildInfo>\r
+ </storageModule>\r
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>\r
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>\r
+ <storageModule moduleId="refreshScope" versionNumber="2">\r
+ <configuration configurationName="Debug">\r
+ <resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>\r
+ </configuration>\r
+ </storageModule>\r
+</cproject>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>RTOSDemo</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>\r
+ <triggers>clean,full,incremental,</triggers>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>\r
+ <triggers>full,incremental,</triggers>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.cdt.core.cnature</nature>\r
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>\r
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>\r
+ </natures>\r
+ <linkedResources>\r
+ <link>\r
+ <name>freertos_source</name>\r
+ <type>2</type>\r
+ <locationURI>virtual:/virtual</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/event_groups.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/event_groups.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/include</name>\r
+ <type>2</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/include</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/list.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/list.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/portable</name>\r
+ <type>2</type>\r
+ <locationURI>virtual:/virtual</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/queue.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/queue.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/stream_buffer.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/stream_buffer.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/tasks.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/tasks.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/timers.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/timers.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks</name>\r
+ <type>2</type>\r
+ <locationURI>virtual:/virtual</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/portable/GCC</name>\r
+ <type>2</type>\r
+ <locationURI>virtual:/virtual</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/portable/MemMang</name>\r
+ <type>2</type>\r
+ <locationURI>virtual:/virtual</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/EventGroupsDemo.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/GenQTest.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/GenQTest.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/TaskNotify.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TaskNotify.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/TimerDemo.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TimerDemo.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/blocktim.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/blocktim.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/dynamic.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/dynamic.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/include</name>\r
+ <type>2</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/include</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>full_demo/standard_demo_tasks/recmutex.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/recmutex.c</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/portable/GCC/RISC-V</name>\r
+ <type>2</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/portable/GCC/RISC-V</locationURI>\r
+ </link>\r
+ <link>\r
+ <name>freertos_source/portable/MemMang/heap_4.c</name>\r
+ <type>1</type>\r
+ <locationURI>FREERTOS_ROOT/FreeRTOS/Source/portable/MemMang/heap_4.c</locationURI>\r
+ </link>\r
+ </linkedResources>\r
+ <filteredResources>\r
+ <filter>\r
+ <id>1571146760235</id>\r
+ <name>freertos_source/portable/GCC/RISC-V/chip_specific_extensions</name>\r
+ <type>9</type>\r
+ <matcher>\r
+ <id>org.eclipse.ui.ide.multiFilter</id>\r
+ <arguments>1.0-name-matches-false-false-RV32I_CLINT_no_extensions</arguments>\r
+ </matcher>\r
+ </filter>\r
+ </filteredResources>\r
+ <variableList>\r
+ <variable>\r
+ <name>FREERTOS_ROOT</name>\r
+ <value>$%7BPARENT-3-PROJECT_LOC%7D</value>\r
+ </variable>\r
+ </variableList>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<project>\r
+ <configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" name="Debug">\r
+ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">\r
+ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>\r
+ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>\r
+ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
+ <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-564276645149001" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">\r
+ <language-scope id="org.eclipse.cdt.core.gcc"/>\r
+ <language-scope id="org.eclipse.cdt.core.g++"/>\r
+ </provider>\r
+ </extension>\r
+ </configuration>\r
+</project>\r
--- /dev/null
+[{000214A0-0000-0000-C000-000000000046}]\r
+Prop3=19,11\r
+[InternetShortcut]\r
+IDList=\r
+URL=https://freertos.org/RTOS-RISC-V-FreedomStudio-QMEU.html\r
--- /dev/null
+/*\r
+ FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+#ifndef FREERTOS_CONFIG_H\r
+#define FREERTOS_CONFIG_H\r
+\r
+#include "platform.h"\r
+\r
+/*\r
+ * For some reason the standard demo timer demo/test tasks fail when executing\r
+ * in QEMU, although they pass on other RISC-V platforms. This requires\r
+ * further investigation, but for now, defining _WINDOWS_ has the effect of\r
+ * using the wider timer test thresholds that are normally only used when the\r
+ * tests are used with the FreeRTOS Windows port (which is not deterministic\r
+ * and therefore requires wider margins).\r
+ */\r
+#define _WINDOWS_\r
+\r
+/*-----------------------------------------------------------\r
+ * Application specific definitions.\r
+ *\r
+ * These definitions should be adjusted for your particular hardware and\r
+ * application requirements.\r
+ *\r
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
+ *\r
+ * See http://www.freertos.org/a00110.html.\r
+ *----------------------------------------------------------*/\r
+\r
+#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR\r
+#define configUSE_PREEMPTION 1\r
+#define configUSE_IDLE_HOOK 0\r
+#define configUSE_TICK_HOOK 1\r
+#define configCPU_CLOCK_HZ ( 10000000 ) /*QEMU*/\r
+#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )\r
+#define configMAX_PRIORITIES ( 7 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) 14500 )\r
+#define configMAX_TASK_NAME_LEN ( 16 )\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 0\r
+#define configUSE_MUTEXES 1\r
+#define configQUEUE_REGISTRY_SIZE 8\r
+#define configCHECK_FOR_STACK_OVERFLOW 2\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
+#define configUSE_MALLOC_FAILED_HOOK 1\r
+#define configUSE_APPLICATION_TASK_TAG 0\r
+#define configUSE_COUNTING_SEMAPHORES 1\r
+#define configGENERATE_RUN_TIME_STATS 0\r
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
+\r
+/* Co-routine definitions. */\r
+#define configUSE_CO_ROUTINES 0\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+\r
+/* Software timer definitions. */\r
+#define configUSE_TIMERS 1\r
+#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
+#define configTIMER_QUEUE_LENGTH 4\r
+#define configTIMER_TASK_STACK_DEPTH ( 120 )\r
+\r
+/* Task priorities. Allow these to be overridden. */\r
+#ifndef uartPRIMARY_PRIORITY\r
+ #define uartPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )\r
+#endif\r
+\r
+/* Set the following definitions to 1 to include the API function, or zero\r
+to exclude the API function. */\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 1\r
+#define INCLUDE_vTaskCleanUpResources 1\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+#define INCLUDE_eTaskGetState 1\r
+#define INCLUDE_xTimerPendFunctionCall 1\r
+#define INCLUDE_xTaskAbortDelay 1\r
+#define INCLUDE_xTaskGetHandle 1\r
+#define INCLUDE_xSemaphoreGetMutexHolder 1\r
+\r
+/* Normal assert() semantics without relying on the provision of an assert.h\r
+header file. */\r
+void vAssertCalled( void );\r
+#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()\r
+\r
+/* Overwrite some of the stack sizes allocated to various test and demo tasks.\r
+Like all task stack sizes, the value is the number of words, not bytes. */\r
+#define bktBLOCK_TIME_TASK_STACK_SIZE 100\r
+#define notifyNOTIFIED_TASK_STACK_SIZE 120\r
+#define priSUSPENDED_RX_TASK_STACK_SIZE 90\r
+#define tmrTIMER_TEST_TASK_STACK_SIZE 100\r
+#define ebRENDESVOUS_TEST_TASK_STACK_SIZE 100\r
+#define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE 115\r
+#define genqMUTEX_TEST_TASK_STACK_SIZE 90\r
+#define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE 100\r
+#define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE 90\r
+\r
+#endif /* FREERTOS_CONFIG_H */\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">\r
+<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="false"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>\r
+<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="1234"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>\r
+<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>\r
+<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>\r
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="riscv64-unknown-elf-gdb.exe -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off""/>\r
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_ENABLED" value="false"/>\r
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_VALUE" value=""/>\r
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>\r
+<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>\r
+<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>\r
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>\r
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\RTOSDemo.elf"/>\r
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTOSDemo"/>\r
+<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>\r
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>\r
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">\r
+<listEntry value="/RTOSDemo"/>\r
+</listAttribute>\r
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">\r
+<listEntry value="4"/>\r
+</listAttribute>\r
+<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"> <gdbmemoryBlockExpression address="2147486760" label="0x80000c28"/> </memoryBlockExpressionList> "/>\r
+<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>\r
+</launchConfiguration>\r
--- /dev/null
+/*\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
+\r
+/******************************************************************************\r
+ * NOTE 1: This project provides two demo applications. A simple blinky\r
+ * style project, and a more comprehensive test and demo application. The\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
+ * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
+ * in main.c. This file implements the simply blinky style version.\r
+ *\r
+ * NOTE 2: This file only contains the source code that is specific to the\r
+ * basic demo. Generic functions, such FreeRTOS hook functions, and functions\r
+ * required to configure the hardware are defined in main.c.\r
+ ******************************************************************************\r
+ *\r
+ * main_blinky() creates one queue, and two tasks. It then starts the\r
+ * scheduler.\r
+ *\r
+ * The Queue Send Task:\r
+ * The queue send task is implemented by the prvQueueSendTask() function in\r
+ * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly\r
+ * block for 1000 milliseconds, before sending the value 100 to the queue that\r
+ * was created within main_blinky(). Once the value is sent, the task loops\r
+ * back around to block for another 1000 milliseconds...and so on.\r
+ *\r
+ * The Queue Receive Task:\r
+ * The queue receive task is implemented by the prvQueueReceiveTask() function\r
+ * in this file. prvQueueReceiveTask() sits in a loop where it repeatedly\r
+ * blocks on attempts to read data from the queue that was created within\r
+ * main_blinky(). When data is received, the task checks the value of the\r
+ * data, and if the value equals the expected 100, writes 'Blink' to the UART\r
+ * (the UART is used in place of the LED to allow easy execution in QEMU). The\r
+ * 'block time' parameter passed to the queue receive function specifies that\r
+ * the task should be held in the Blocked state indefinitely to wait for data to\r
+ * be available on the queue. The queue receive task will only leave the\r
+ * Blocked state when the queue send task writes to the queue. As the queue\r
+ * send task writes to the queue every 1000 milliseconds, the queue receive\r
+ * task leaves the Blocked state every 1000 milliseconds, and therefore toggles\r
+ * the LED every 200 milliseconds.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <unistd.h>\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "queue.h"\r
+\r
+/* Priorities used by the tasks. */\r
+#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+\r
+/* The rate at which data is sent to the queue. The 200ms value is converted\r
+to ticks using the pdMS_TO_TICKS() macro. */\r
+#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 )\r
+\r
+/* The maximum number items the queue can hold. The priority of the receiving\r
+task is above the priority of the sending task, so the receiving task will\r
+preempt the sending task and remove the queue items each time the sending task\r
+writes to the queue. Therefore the queue will never have more than one item in\r
+it at any time, and even with a queue length of 1, the sending task will never\r
+find the queue full. */\r
+#define mainQUEUE_LENGTH ( 1 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in\r
+ * main.c.\r
+ */\r
+void main_blinky( void );\r
+\r
+/*\r
+ * The tasks as described in the comments at the top of this file.\r
+ */\r
+static void prvQueueReceiveTask( void *pvParameters );\r
+static void prvQueueSendTask( void *pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The queue used by both tasks. */\r
+static QueueHandle_t xQueue = NULL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main_blinky( void )\r
+{\r
+ /* Create the queue. */\r
+ xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
+\r
+ if( xQueue != NULL )\r
+ {\r
+ /* Start the two tasks as described in the comments at the top of this\r
+ file. */\r
+ xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */\r
+ "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */\r
+ configMINIMAL_STACK_SIZE * 2U, /* The size of the stack to allocate to the task. */\r
+ NULL, /* The parameter passed to the task - not used in this case. */\r
+ mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */\r
+ NULL ); /* The task handle is not required, so NULL is passed. */\r
+\r
+ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );\r
+\r
+ /* Start the tasks and timer running. */\r
+ vTaskStartScheduler();\r
+ }\r
+\r
+ /* If all is well, the scheduler will now be running, and the following\r
+ line will never be reached. If the following line does execute, then\r
+ there was insufficient FreeRTOS heap memory available for the Idle and/or\r
+ timer tasks to be created. See the memory management section on the\r
+ FreeRTOS web site for more details on the FreeRTOS heap\r
+ http://www.freertos.org/a00111.html. */\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvQueueSendTask( void *pvParameters )\r
+{\r
+TickType_t xNextWakeTime;\r
+const unsigned long ulValueToSend = 100UL;\r
+BaseType_t xReturned;\r
+\r
+ /* Remove compiler warning about unused parameter. */\r
+ ( void ) pvParameters;\r
+\r
+ /* Initialise xNextWakeTime - this only needs to be done once. */\r
+ xNextWakeTime = xTaskGetTickCount();\r
+\r
+ for( ;; )\r
+ {\r
+ /* Place this task in the blocked state until it is time to run again. */\r
+ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
+\r
+ /* Send to the queue - causing the queue receive task to unblock and\r
+ toggle the LED. 0 is used as the block time so the sending operation\r
+ will not block - it shouldn't need to block as the queue should always\r
+ be empty at this point in the code. */\r
+ xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );\r
+ configASSERT( xReturned == pdPASS );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvQueueReceiveTask( void *pvParameters )\r
+{\r
+unsigned long ulReceivedValue;\r
+const unsigned long ulExpectedValue = 100UL;\r
+const char * const pcPassMessage = "Blink\r\n";\r
+const char * const pcFailMessage = "Unexpected value received\r\n";\r
+extern void vSendString( const char * pcString );\r
+\r
+ /* Remove compiler warning about unused parameter. */\r
+ ( void ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+ /* Wait until something arrives in the queue - this task will block\r
+ indefinitely provided INCLUDE_vTaskSuspend is set to 1 in\r
+ FreeRTOSConfig.h. */\r
+ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );\r
+\r
+ /* To get here something must have been received from the queue, but\r
+ is it the expected value? If it is, toggle the LED. */\r
+ if( ulReceivedValue == ulExpectedValue )\r
+ {\r
+ vSendString( pcPassMessage );\r
+ ulReceivedValue = 0U;\r
+ }\r
+ else\r
+ {\r
+ vSendString( pcFailMessage );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
--- /dev/null
+{\r
+ "schemaVersion": "0.2.4",\r
+ "contentVersion": "0.2.0",\r
+ "headerVersion": "0.2.0",\r
+ "device": {\r
+ "fe310": {\r
+ "displayName": "Freedom E310-G000",\r
+ "description": "The FE310-G000 is the first Freedom E300 SoC, and is the industry's first commercially available RISC-V SoC. The FE310-G000 is built around the E31 Core Complex instantiated in the Freedom E300 platform.",\r
+ "supplier": {\r
+ "name": "sifive",\r
+ "id": "1",\r
+ "displayName": "SiFive",\r
+ "fullName": "SiFive, Inc.",\r
+ "contact": "info@sifive.com"\r
+ },\r
+ "busWidth": "32",\r
+ "resetMask": "all",\r
+ "resetValue": "0x00000000",\r
+ "access": "rw",\r
+ "headerGuardPrefix": "SIFIVE_DEVICES_FE310_",\r
+ "headerTypePrefix": "sifive_fe310_",\r
+ "headerInterruptPrefix": "sifive_fe310_interrupt_global_",\r
+ "headerInterruptEnumPrefix": "riscv_interrupts_global_",\r
+ "revision": "r0p0",\r
+ "numInterrupts": "51",\r
+ "priorityBits": "3",\r
+ "regWidth": "32",\r
+ "cores": {\r
+ "e31": {\r
+ "harts": "1",\r
+ "isa": "RV32IMAC",\r
+ "isaVersion": "2.2",\r
+ "mpu": "pmp",\r
+ "mmu": "none",\r
+ "localInterrupts": {\r
+ "machine_software": {\r
+ "description": "Machine Software Interrupt",\r
+ "value": "3"\r
+ },\r
+ "machine_timer": {\r
+ "description": "Machine Timer Interrupt",\r
+ "value": "7"\r
+ },\r
+ "machine_ext": {\r
+ "description": "Machine External Interrupt",\r
+ "value": "11"\r
+ }\r
+ },\r
+ "numLocalInterrupts": "0"\r
+ }\r
+ },\r
+ "peripherals": {\r
+ "clint": {\r
+ "description": "Core Complex Local Interruptor (CLINT) Peripheral",\r
+ "baseAddress": "0x02000000",\r
+ "size": "0x10000",\r
+ "registers": {\r
+ "msip": {\r
+ "description": "MSIP (Machine-mode Software Interrupts) Register per Hart",\r
+ "addressOffset": "0x0000",\r
+ "arraySize": "1"\r
+ }\r
+ },\r
+ "clusters": {\r
+ "mtimecmp": {\r
+ "description": "Machine Time Compare Registers per Hart",\r
+ "addressOffset": "0x4000",\r
+ "arraySize": "1",\r
+ "registers": {\r
+ "low": {\r
+ "description": "Machine Compare Register Low",\r
+ "addressOffset": "0x0000"\r
+ },\r
+ "high": {\r
+ "description": "Machine Compare Register High",\r
+ "addressOffset": "0x0004"\r
+ }\r
+ }\r
+ },\r
+ "mtime": {\r
+ "description": "Machine Time Register",\r
+ "addressOffset": "0xBFF8",\r
+ "access": "r",\r
+ "registers": {\r
+ "low": {\r
+ "description": "Machine Time Register Low",\r
+ "addressOffset": "0x0000"\r
+ },\r
+ "high": {\r
+ "description": "Machine Time Register High",\r
+ "addressOffset": "0x0004"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "plic": {\r
+ "description": "Platform-Level Interrupt Controller (PLIC) Peripheral",\r
+ "baseAddress": "0x0C000000",\r
+ "size": "0x4000000",\r
+ "registers": {\r
+ "priorities": {\r
+ "arraySize": "52",\r
+ "description": "Interrupt Priorities Registers; 0 is reserved.",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "value": {\r
+ "description": "The priority for a given global interrupt",\r
+ "bitOffset": "0",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "pendings": {\r
+ "arraySize": "2",\r
+ "description": "Interrupt Pending Bits Registers",\r
+ "addressOffset": "0x1000",\r
+ "access": "r"\r
+ }\r
+ },\r
+ "clusters": {\r
+ "enablestarget0": {\r
+ "description": "Hart 0 Interrupt Enable Bits",\r
+ "addressOffset": "0x00002000",\r
+ "clusters": {\r
+ "m": {\r
+ "addressOffset": "0x0000",\r
+ "description": "Hart 0 M-mode Interrupt Enable Bits",\r
+ "registers": {\r
+ "enables": {\r
+ "arraySize": "2",\r
+ "description": "Interrupt Enable Bits Registers",\r
+ "addressOffset": "0x0000"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "target0": {\r
+ "description": "Hart 0 Interrupt Thresholds",\r
+ "addressOffset": "0x00200000",\r
+ "clusters": {\r
+ "m": {\r
+ "addressOffset": "0x0000",\r
+ "description": "Hart 0 M-Mode Interrupt Threshold",\r
+ "registers": {\r
+ "threshold": {\r
+ "description": "The Priority Threshold Register",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "value": {\r
+ "description": "The priority threshold value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "claimcomplete": {\r
+ "description": "The Interrupt Claim/Completion Register",\r
+ "addressOffset": "0x0004"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "wdog": {\r
+ "description": "Watchdog Timer (WDT), part of Always-On Domain",\r
+ "baseAddress": "0x10000000",\r
+ "size": "0x0040",\r
+ "resetMask": "none",\r
+ "registers": {\r
+ "cfg": {\r
+ "description": "Watchdog Configuration Register",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "Watchdog counter scale",\r
+ "bitOffset": "0",\r
+ "bitWidth": "4"\r
+ },\r
+ "rsten": {\r
+ "description": "Watchdog full reset enable",\r
+ "bitOffset": "8",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "zerocmp": {\r
+ "description": "Watchdog zero on comparator",\r
+ "bitOffset": "9",\r
+ "bitWidth": "1"\r
+ },\r
+ "enalways": {\r
+ "description": "Watchdog enable counter always",\r
+ "bitOffset": "12",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "encoreawake": {\r
+ "description": "Watchdog counter only when awake",\r
+ "bitOffset": "13",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmpip": {\r
+ "description": "Watchdog interrupt pending",\r
+ "bitOffset": "28",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "count": {\r
+ "description": "Watchdog Count Register",\r
+ "addressOffset": "0x0008"\r
+ },\r
+ "scale": {\r
+ "description": "Watchdog Scale Register",\r
+ "addressOffset": "0x0010",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Watchdog scale value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16"\r
+ }\r
+ }\r
+ },\r
+ "feed": {\r
+ "description": "Watchdog Feed Address Register",\r
+ "addressOffset": "0x0018"\r
+ },\r
+ "key": {\r
+ "description": "Watchdog Key Register",\r
+ "addressOffset": "0x001C"\r
+ },\r
+ "cmp": {\r
+ "description": "Watchdog Compare Register",\r
+ "addressOffset": "0x0020",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Watchdog compare value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "wdogcmp": {\r
+ "description": "Watchdog Compare Interrupt",\r
+ "value": "1"\r
+ }\r
+ }\r
+ },\r
+ "rtc": {\r
+ "description": "Real-Time Clock (RTC), part of Always-On Domain",\r
+ "baseAddress": "0x10000040",\r
+ "size": "0x0030",\r
+ "resetMask": "none",\r
+ "registers": {\r
+ "cfg": {\r
+ "description": "RTC Configuration Register",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "RTC clock rate scale",\r
+ "bitOffset": "0",\r
+ "bitWidth": "4"\r
+ },\r
+ "enalways": {\r
+ "description": "RTC counter enable",\r
+ "bitOffset": "12",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmpip": {\r
+ "description": "RTC comparator interrupt pending",\r
+ "bitOffset": "28",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "low": {\r
+ "description": "RTC Counter Register Low",\r
+ "addressOffset": "0x0008"\r
+ },\r
+ "high": {\r
+ "description": "RTC Counter Register High",\r
+ "addressOffset": "0x000C",\r
+ "fields": {\r
+ "value": {\r
+ "description": "RTC counter register, high bits",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16"\r
+ }\r
+ }\r
+ },\r
+ "scale": {\r
+ "description": "RTC Scale Register",\r
+ "addressOffset": "0x0010"\r
+ },\r
+ "cmp": {\r
+ "description": "RTC Compare Register",\r
+ "addressOffset": "0x0020"\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "rtccmp": {\r
+ "description": "RTC Compare Interrupt",\r
+ "value": "2"\r
+ }\r
+ }\r
+ },\r
+ "pmu": {\r
+ "description": "Power-Management Unit (PMU), part of Always-On Domain",\r
+ "baseAddress": "0x10000100",\r
+ "size": "0x0050",\r
+ "resetMask": "none",\r
+ "registers": {\r
+ "wakeupi": {\r
+ "description": "Wakeup program instruction Registers",\r
+ "addressOffset": "0x0000",\r
+ "arraySize": "8"\r
+ },\r
+ "sleepi": {\r
+ "description": "Sleep Program Instruction Registers",\r
+ "addressOffset": "0x0020",\r
+ "arraySize": "8"\r
+ },\r
+ "ie": {\r
+ "description": "PMU Interrupt Enables Register",\r
+ "addressOffset": "0x0040",\r
+ "fields": {\r
+ "rtc": {\r
+ "description": "RTC Comparator active",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1"\r
+ },\r
+ "dwakeup": {\r
+ "description": "dwakeup_n pin active",\r
+ "bitOffset": "2",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "cause": {\r
+ "description": "PMU Wakeup Cause Register",\r
+ "addressOffset": "0x0044",\r
+ "fields": {\r
+ "wakeupcause": {\r
+ "description": "Wakeup cause",\r
+ "bitOffset": "0",\r
+ "bitWidth": "2",\r
+ "access": "r",\r
+ "enumerations": {\r
+ "wakeupcause-enum": {\r
+ "description": "Wakeup Cause Values Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "reset",\r
+ "description": "Reset Wakeup"\r
+ },\r
+ "1": {\r
+ "displayName": "rtc",\r
+ "description": "RTC Wakeup"\r
+ },\r
+ "2": {\r
+ "displayName": "dwakeup",\r
+ "description": "Digital input Wakeup"\r
+ },\r
+ "*": {\r
+ "displayName": "undefined"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "resetcause": {\r
+ "description": "Reset cause",\r
+ "bitOffset": "8",\r
+ "bitWidth": "2",\r
+ "access": "r",\r
+ "enumerations": {\r
+ "resetcause-enum": {\r
+ "description": "Reset Cause Values Enumeration",\r
+ "values": {\r
+ "1": {\r
+ "displayName": "external",\r
+ "description": "External reset"\r
+ },\r
+ "2": {\r
+ "displayName": "watchdog",\r
+ "description": "Watchdog timer reset"\r
+ },\r
+ "*": {\r
+ "displayName": "undefined"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "sleep": {\r
+ "description": "PMU Initiate Sleep Sequence Register",\r
+ "addressOffset": "0x0048"\r
+ },\r
+ "key": {\r
+ "description": "PMU Key Register",\r
+ "addressOffset": "0x004C"\r
+ }\r
+ }\r
+ },\r
+ "aon": {\r
+ "description": "Always-On (AON) Domain",\r
+ "baseAddress": "0x10000070",\r
+ "size": "0x0090",\r
+ "resetMask": "none",\r
+ "registers": {\r
+ "lfrosccfg": {\r
+ "description": "Internal Programmable Low-Frequency Ring Oscillator Register",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "div": {\r
+ "description": "LFROSC divider",\r
+ "bitOffset": "0",\r
+ "bitWidth": "6",\r
+ "resetMask": "all",\r
+ "resetValue": "0x04"\r
+ },\r
+ "trim": {\r
+ "description": "LFROSC trim value",\r
+ "bitOffset": "16",\r
+ "bitWidth": "5",\r
+ "resetMask": "all",\r
+ "resetValue": "0x10"\r
+ },\r
+ "en": {\r
+ "description": "LFROSC enable",\r
+ "bitOffset": "30",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "rdy": {\r
+ "description": "LFROSC ready",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "backup": {\r
+ "description": "Backup Registers",\r
+ "addressOffset": "0x0010",\r
+ "arraySize": "32"\r
+ }\r
+ }\r
+ },\r
+ "prci": {\r
+ "description": "Power, Reset, Clock, Interrupt (PRCI) Peripheral",\r
+ "baseAddress": "0x10008000",\r
+ "size": "0x8000",\r
+ "registers": {\r
+ "hfrosccfg": {\r
+ "description": "Internal Trimmable Programmable 72 MHz Oscillator Register",\r
+ "addressOffset": "0x0000",\r
+ "fields": {\r
+ "div": {\r
+ "description": "HFROSC divider",\r
+ "bitOffset": "0",\r
+ "bitWidth": "6",\r
+ "resetMask": "all",\r
+ "resetValue": "0x04"\r
+ },\r
+ "trim": {\r
+ "description": "HFROSC trim value",\r
+ "bitOffset": "16",\r
+ "bitWidth": "5",\r
+ "resetMask": "all",\r
+ "resetValue": "0x10"\r
+ },\r
+ "en": {\r
+ "description": "HFROSC enable",\r
+ "bitOffset": "30",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "rdy": {\r
+ "description": "HFROSC ready",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "hfxosccfg": {\r
+ "description": "External 16 MHz Crystal Oscillator Register",\r
+ "addressOffset": "0x0004",\r
+ "fields": {\r
+ "en": {\r
+ "description": "HFXOSC enable",\r
+ "bitOffset": "30",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "rdy": {\r
+ "description": "HFXOSC ready",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "pllcfg": {\r
+ "description": "Internal High-Frequency PLL (HFPLL) Register",\r
+ "addressOffset": "0x0008",\r
+ "fields": {\r
+ "r": {\r
+ "description": "PLL R input divider value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1",\r
+ "enumerations": {\r
+ "pllr-enum": {\r
+ "description": "Reference Clock R Divide Ratio Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "/1",\r
+ "headerName": "div1",\r
+ "description": "Unchanged"\r
+ },\r
+ "1": {\r
+ "displayName": "/2",\r
+ "headerName": "div2",\r
+ "description": "Divided by 2"\r
+ },\r
+ "2": {\r
+ "displayName": "/3",\r
+ "headerName": "div3",\r
+ "description": "Divided by 3"\r
+ },\r
+ "3": {\r
+ "displayName": "/4",\r
+ "headerName": "div4",\r
+ "description": "Divided by 4"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "f": {\r
+ "description": "PLL F multiplier value",\r
+ "bitOffset": "4",\r
+ "bitWidth": "6",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1F",\r
+ "enumerations": {\r
+ "pllf-enum": {\r
+ "description": "Reference Clock F Multiplier Ratio Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "*2",\r
+ "headerName": "mul2",\r
+ "description": "Multiplied by 2"\r
+ },\r
+ "1": {\r
+ "displayName": "*4",\r
+ "headerName": "mul4",\r
+ "description": "Multiplied by 4"\r
+ },\r
+ "2": {\r
+ "displayName": "*6",\r
+ "headerName": "mul6",\r
+ "description": "Multiplied by 6"\r
+ },\r
+ "3": {\r
+ "displayName": "*8",\r
+ "headerName": "mul8",\r
+ "description": "Multiplied by 8"\r
+ },\r
+ "4": {\r
+ "displayName": "*10",\r
+ "headerName": "mul10",\r
+ "description": "Multiplied by 10"\r
+ },\r
+ "5": {\r
+ "displayName": "*12",\r
+ "headerName": "mul12",\r
+ "description": "Multiplied by 12"\r
+ },\r
+ "6": {\r
+ "displayName": "*14",\r
+ "headerName": "mul14",\r
+ "description": "Multiplied by 14"\r
+ },\r
+ "7": {\r
+ "displayName": "*16",\r
+ "headerName": "mul16",\r
+ "description": "Multiplied by 16"\r
+ },\r
+ "8": {\r
+ "displayName": "*18",\r
+ "headerName": "mul18",\r
+ "description": "Multiplied by 18"\r
+ },\r
+ "9": {\r
+ "displayName": "*20",\r
+ "headerName": "mul20",\r
+ "description": "Multiplied by 20"\r
+ },\r
+ "10": {\r
+ "displayName": "*22",\r
+ "headerName": "mul22",\r
+ "description": "Multiplied by 22"\r
+ },\r
+ "11": {\r
+ "displayName": "*24",\r
+ "headerName": "mul24",\r
+ "description": "Multiplied by 24"\r
+ },\r
+ "12": {\r
+ "displayName": "*26",\r
+ "headerName": "mul26",\r
+ "description": "Multiplied by 26"\r
+ },\r
+ "13": {\r
+ "displayName": "*28",\r
+ "headerName": "mul28",\r
+ "description": "Multiplied by 28"\r
+ },\r
+ "14": {\r
+ "displayName": "*30",\r
+ "headerName": "mul30",\r
+ "description": "Multiplied by 30"\r
+ },\r
+ "15": {\r
+ "displayName": "*32",\r
+ "headerName": "mul32",\r
+ "description": "Multiplied by 32"\r
+ },\r
+ "16": {\r
+ "displayName": "*34",\r
+ "headerName": "mul34",\r
+ "description": "Multiplied by 34"\r
+ },\r
+ "17": {\r
+ "displayName": "*36",\r
+ "headerName": "mul36",\r
+ "description": "Multiplied by 36"\r
+ },\r
+ "18": {\r
+ "displayName": "*38",\r
+ "headerName": "mul38",\r
+ "description": "Multiplied by 38"\r
+ },\r
+ "19": {\r
+ "displayName": "*40",\r
+ "headerName": "mul40",\r
+ "description": "Multiplied by 40"\r
+ },\r
+ "20": {\r
+ "displayName": "*42",\r
+ "headerName": "mul42",\r
+ "description": "Multiplied by 42"\r
+ },\r
+ "21": {\r
+ "displayName": "*44",\r
+ "headerName": "mul44",\r
+ "description": "Multiplied by 44"\r
+ },\r
+ "22": {\r
+ "displayName": "*46",\r
+ "headerName": "mul46",\r
+ "description": "Multiplied by 46"\r
+ },\r
+ "23": {\r
+ "displayName": "*48",\r
+ "headerName": "mul48",\r
+ "description": "Multiplied by 48"\r
+ },\r
+ "24": {\r
+ "displayName": "*50",\r
+ "headerName": "mul50",\r
+ "description": "Multiplied by 50"\r
+ },\r
+ "25": {\r
+ "displayName": "*52",\r
+ "headerName": "mul52",\r
+ "description": "Multiplied by 52"\r
+ },\r
+ "26": {\r
+ "displayName": "*54",\r
+ "headerName": "mul54",\r
+ "description": "Multiplied by 54"\r
+ },\r
+ "27": {\r
+ "displayName": "*56",\r
+ "headerName": "mul56",\r
+ "description": "Multiplied by 56"\r
+ },\r
+ "28": {\r
+ "displayName": "*58",\r
+ "headerName": "mul58",\r
+ "description": "Multiplied by 58"\r
+ },\r
+ "29": {\r
+ "displayName": "*60",\r
+ "headerName": "mul60",\r
+ "description": "Multiplied by 60"\r
+ },\r
+ "30": {\r
+ "displayName": "*62",\r
+ "headerName": "mul62",\r
+ "description": "Multiplied by 62"\r
+ },\r
+ "31": {\r
+ "displayName": "*64",\r
+ "headerName": "mul64",\r
+ "description": "Multiplied by 64"\r
+ },\r
+ "32": {\r
+ "displayName": "*66",\r
+ "headerName": "mul66",\r
+ "description": "Multiplied by 66"\r
+ },\r
+ "33": {\r
+ "displayName": "*68",\r
+ "headerName": "mul68",\r
+ "description": "Multiplied by 68"\r
+ },\r
+ "34": {\r
+ "displayName": "*70",\r
+ "headerName": "mul70",\r
+ "description": "Multiplied by 70"\r
+ },\r
+ "35": {\r
+ "displayName": "*72",\r
+ "headerName": "mul72",\r
+ "description": "Multiplied by 72"\r
+ },\r
+ "36": {\r
+ "displayName": "*74",\r
+ "headerName": "mul74",\r
+ "description": "Multiplied by 74"\r
+ },\r
+ "37": {\r
+ "displayName": "*76",\r
+ "headerName": "mul76",\r
+ "description": "Multiplied by 76"\r
+ },\r
+ "38": {\r
+ "displayName": "*78",\r
+ "headerName": "mul78",\r
+ "description": "Multiplied by 78"\r
+ },\r
+ "39": {\r
+ "displayName": "*80",\r
+ "headerName": "mul80",\r
+ "description": "Multiplied by 80"\r
+ },\r
+ "40": {\r
+ "displayName": "*82",\r
+ "headerName": "mul82",\r
+ "description": "Multiplied by 82"\r
+ },\r
+ "41": {\r
+ "displayName": "*84",\r
+ "headerName": "mul84",\r
+ "description": "Multiplied by 84"\r
+ },\r
+ "42": {\r
+ "displayName": "*86",\r
+ "headerName": "mul86",\r
+ "description": "Multiplied by 86"\r
+ },\r
+ "43": {\r
+ "displayName": "*88",\r
+ "headerName": "mul88",\r
+ "description": "Multiplied by 88"\r
+ },\r
+ "44": {\r
+ "displayName": "*90",\r
+ "headerName": "mul90",\r
+ "description": "Multiplied by 90"\r
+ },\r
+ "45": {\r
+ "displayName": "*92",\r
+ "headerName": "mul92",\r
+ "description": "Multiplied by 92"\r
+ },\r
+ "46": {\r
+ "displayName": "*94",\r
+ "headerName": "mul94",\r
+ "description": "Multiplied by 94"\r
+ },\r
+ "47": {\r
+ "displayName": "*96",\r
+ "headerName": "mul96",\r
+ "description": "Multiplied by 96"\r
+ },\r
+ "48": {\r
+ "displayName": "*98",\r
+ "headerName": "mul98",\r
+ "description": "Multiplied by 98"\r
+ },\r
+ "49": {\r
+ "displayName": "*100",\r
+ "headerName": "mul100",\r
+ "description": "Multiplied by 100"\r
+ },\r
+ "50": {\r
+ "displayName": "*102",\r
+ "headerName": "mul102",\r
+ "description": "Multiplied by 102"\r
+ },\r
+ "51": {\r
+ "displayName": "*104",\r
+ "headerName": "mul104",\r
+ "description": "Multiplied by 104"\r
+ },\r
+ "52": {\r
+ "displayName": "*106",\r
+ "headerName": "mul106",\r
+ "description": "Multiplied by 106"\r
+ },\r
+ "53": {\r
+ "displayName": "*108",\r
+ "headerName": "mul108",\r
+ "description": "Multiplied by 108"\r
+ },\r
+ "54": {\r
+ "displayName": "*110",\r
+ "headerName": "mul110",\r
+ "description": "Multiplied by 110"\r
+ },\r
+ "55": {\r
+ "displayName": "*112",\r
+ "headerName": "mul112",\r
+ "description": "Multiplied by 112"\r
+ },\r
+ "56": {\r
+ "displayName": "*114",\r
+ "headerName": "mul114",\r
+ "description": "Multiplied by 114"\r
+ },\r
+ "57": {\r
+ "displayName": "*116",\r
+ "headerName": "mul116",\r
+ "description": "Multiplied by 116"\r
+ },\r
+ "58": {\r
+ "displayName": "*118",\r
+ "headerName": "mul118",\r
+ "description": "Multiplied by 118"\r
+ },\r
+ "59": {\r
+ "displayName": "*120",\r
+ "headerName": "mul120",\r
+ "description": "Multiplied by 120"\r
+ },\r
+ "60": {\r
+ "displayName": "*122",\r
+ "headerName": "mul122",\r
+ "description": "Multiplied by 122"\r
+ },\r
+ "61": {\r
+ "displayName": "*124",\r
+ "headerName": "mul124",\r
+ "description": "Multiplied by 124"\r
+ },\r
+ "62": {\r
+ "displayName": "*126",\r
+ "headerName": "mul126",\r
+ "description": "Multiplied by 126"\r
+ },\r
+ "63": {\r
+ "displayName": "*128",\r
+ "headerName": "mul128",\r
+ "description": "Multiplied by 128"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "q": {\r
+ "description": "PLL Q output divider value",\r
+ "bitOffset": "10",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x3",\r
+ "enumerations": {\r
+ "pllq-enum": {\r
+ "description": "Reference Clock Q Divide Ratio Enumeration",\r
+ "values": {\r
+ "*": {\r
+ "displayName": "n/a",\r
+ "description": "Not supported"\r
+ },\r
+ "1": {\r
+ "displayName": "/2",\r
+ "headerName": "div2",\r
+ "description": "Divided by 2"\r
+ },\r
+ "2": {\r
+ "displayName": "/4",\r
+ "headerName": "div4",\r
+ "description": "Divided by 4"\r
+ },\r
+ "3": {\r
+ "displayName": "/8",\r
+ "headerName": "div8",\r
+ "description": "Divided by 8"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "sel": {\r
+ "description": "PLL select",\r
+ "bitOffset": "16",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "refsel": {\r
+ "description": "PLL reference select",\r
+ "bitOffset": "17",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "bypass": {\r
+ "description": "PLL bypass",\r
+ "bitOffset": "18",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "lock": {\r
+ "description": "PLL lock indicator",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "plloutdiv": {\r
+ "description": "PLL Output Divider",\r
+ "addressOffset": "0x000C"\r
+ }\r
+ }\r
+ },\r
+ "otp": {\r
+ "description": "One-Time Programmable Memory (OTP) Peripheral",\r
+ "baseAddress": "0x10010000",\r
+ "size": "0x1000",\r
+ "registers": {\r
+ "lock": {\r
+ "description": "Programmed-I/O Lock Register",\r
+ "addressOffset": "0x0000"\r
+ },\r
+ "ck": {\r
+ "description": "Device Clock Signal Register",\r
+ "addressOffset": "0x0004"\r
+ },\r
+ "oe": {\r
+ "description": "Device Output-Enable Signal Register",\r
+ "addressOffset": "0x0008"\r
+ },\r
+ "sel": {\r
+ "description": "Device Chip-Select Signal Register",\r
+ "addressOffset": "0x000C"\r
+ },\r
+ "we": {\r
+ "description": "Device Write-Enable Signal Register",\r
+ "addressOffset": "0x0010"\r
+ },\r
+ "mr": {\r
+ "description": "Device Mode Register",\r
+ "addressOffset": "0x0014"\r
+ },\r
+ "mrr": {\r
+ "description": "Read-Voltage Regulator Control Register",\r
+ "addressOffset": "0x0018"\r
+ },\r
+ "mpp": {\r
+ "description": "Write-Voltage Charge Pump Control Register",\r
+ "addressOffset": "0x001C"\r
+ },\r
+ "vrren": {\r
+ "description": "Read-Voltage Enable Register",\r
+ "addressOffset": "0x0020"\r
+ },\r
+ "vppen": {\r
+ "description": "Write-Voltage Enable Register",\r
+ "addressOffset": "0x0024"\r
+ },\r
+ "a": {\r
+ "description": "Device Address Register",\r
+ "addressOffset": "0x0028"\r
+ },\r
+ "d": {\r
+ "description": "Device Data Input Register",\r
+ "addressOffset": "0x002C"\r
+ },\r
+ "q": {\r
+ "description": "Device Data Output Register",\r
+ "addressOffset": "0x0030"\r
+ },\r
+ "rsctrl": {\r
+ "description": "Read Sequencer Control Register",\r
+ "addressOffset": "0x0034",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "OTP timescale",\r
+ "bitOffset": "0",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "tas": {\r
+ "description": "Address setup time",\r
+ "bitOffset": "3",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "trp": {\r
+ "description": "Read pulse time",\r
+ "bitOffset": "4",\r
+ "bitWidth": "1"\r
+ },\r
+ "tracc": {\r
+ "description": "Read access time",\r
+ "bitOffset": "5",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "gpio": {\r
+ "description": "General Purpose Input/Output Controller (GPIO) Peripheral",\r
+ "baseAddress": "0x10012000",\r
+ "size": "0x1000",\r
+ "registers": {\r
+ "value": {\r
+ "description": "Pin Value Register",\r
+ "addressOffset": "0x000",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Value Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "inputen": {\r
+ "description": "Pin Input Enable Register",\r
+ "addressOffset": "0x004",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Pin Input Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "outputen": {\r
+ "description": "Pin Output Enable Register",\r
+ "addressOffset": "0x008",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Pin Output Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "port": {\r
+ "description": "Output Port Value Register",\r
+ "addressOffset": "0x00C",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Output Port Value Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "pue": {\r
+ "description": "Internal Pull-up Enable Register",\r
+ "addressOffset": "0x010",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Internal Pull-up Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "ds": {\r
+ "description": "Pin Drive Strength Register",\r
+ "addressOffset": "0x014",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Pin Drive Strength Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "riseie": {\r
+ "description": "Rise Interrupt Enable Register",\r
+ "addressOffset": "0x018",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Rise Interrupt Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "riseip": {\r
+ "description": "Rise Interrupt Pending Register",\r
+ "addressOffset": "0x01C",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Rise Interrupt Pending Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "fallie": {\r
+ "description": "Fall Interrupt Enable Register",\r
+ "addressOffset": "0x020",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Fall Interrupt Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "fallip": {\r
+ "description": "Fall Interrupt Pending Register",\r
+ "addressOffset": "0x024",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Fall Interrupt Pending Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "highie": {\r
+ "description": "High Interrupt Enable Register",\r
+ "addressOffset": "0x028",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "High Interrupt Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "highip": {\r
+ "description": "High Interrupt Pending Register",\r
+ "addressOffset": "0x02C",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "High Interrupt Pending Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "lowie": {\r
+ "description": "Low Interrupt Enable Register",\r
+ "addressOffset": "0x030",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Low Interrupt Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "lowip": {\r
+ "description": "Low Interrupt Pending Register",\r
+ "addressOffset": "0x034",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Low Interrupt Pending Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "iofen": {\r
+ "description": "HW I/O Function Enable Register",\r
+ "addressOffset": "0x038",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "HW I/O Function Enable Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "iofsel": {\r
+ "description": "HW I/O Function Select Register",\r
+ "addressOffset": "0x03C",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "HW I/O Function Select Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ },\r
+ "outxor": {\r
+ "description": "Output XOR (invert) Register",\r
+ "addressOffset": "0x040",\r
+ "fields": {\r
+ "bit": {\r
+ "repeatGenerator": "0-31",\r
+ "description": "Output XOR Bit Field",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "headerName": ""\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "gpio0": {\r
+ "description": "GPIO0 Interrupt",\r
+ "value": "8"\r
+ },\r
+ "gpio1": {\r
+ "description": "GPIO1 Interrupt",\r
+ "value": "9"\r
+ },\r
+ "gpio2": {\r
+ "description": "GPIO2 Interrupt",\r
+ "value": "10"\r
+ },\r
+ "gpio3": {\r
+ "description": "GPIO3 Interrupt",\r
+ "value": "11"\r
+ },\r
+ "gpio4": {\r
+ "description": "GPIO4 Interrupt",\r
+ "value": "12"\r
+ },\r
+ "gpio5": {\r
+ "description": "GPIO5 Interrupt",\r
+ "value": "13"\r
+ },\r
+ "gpio6": {\r
+ "description": "GPIO6 Interrupt",\r
+ "value": "14"\r
+ },\r
+ "gpio7": {\r
+ "description": "GPIO7 Interrupt",\r
+ "value": "15"\r
+ },\r
+ "gpio8": {\r
+ "description": "GPIO8 Interrupt",\r
+ "value": "16"\r
+ },\r
+ "gpio9": {\r
+ "description": "GPIO9 Interrupt",\r
+ "value": "17"\r
+ },\r
+ "gpio10": {\r
+ "description": "GPIO10 Interrupt",\r
+ "value": "18"\r
+ },\r
+ "gpio11": {\r
+ "description": "GPIO11 Interrupt",\r
+ "value": "19"\r
+ },\r
+ "gpio12": {\r
+ "description": "GPIO12 Interrupt",\r
+ "value": "20"\r
+ },\r
+ "gpio13": {\r
+ "description": "GPIO13 Interrupt",\r
+ "value": "21"\r
+ },\r
+ "gpio14": {\r
+ "description": "GPIO14 Interrupt",\r
+ "value": "22"\r
+ },\r
+ "gpio15": {\r
+ "description": "GPIO15 Interrupt",\r
+ "value": "23"\r
+ },\r
+ "gpio16": {\r
+ "description": "GPIO16 Interrupt",\r
+ "value": "24"\r
+ },\r
+ "gpio17": {\r
+ "description": "GPIO17 Interrupt",\r
+ "value": "25"\r
+ },\r
+ "gpio18": {\r
+ "description": "GPIO18 Interrupt",\r
+ "value": "26"\r
+ },\r
+ "gpio19": {\r
+ "description": "GPIO19 Interrupt",\r
+ "value": "27"\r
+ },\r
+ "gpio20": {\r
+ "description": "GPIO20 Interrupt",\r
+ "value": "28"\r
+ },\r
+ "gpio21": {\r
+ "description": "GPIO21 Interrupt",\r
+ "value": "29"\r
+ },\r
+ "gpio22": {\r
+ "description": "GPIO22 Interrupt",\r
+ "value": "30"\r
+ },\r
+ "gpio23": {\r
+ "description": "GPIO23 Interrupt",\r
+ "value": "31"\r
+ },\r
+ "gpio24": {\r
+ "description": "GPIO24 Interrupt",\r
+ "value": "32"\r
+ },\r
+ "gpio25": {\r
+ "description": "GPIO25 Interrupt",\r
+ "value": "33"\r
+ },\r
+ "gpio26": {\r
+ "description": "GPIO26 Interrupt",\r
+ "value": "34"\r
+ },\r
+ "gpio27": {\r
+ "description": "GPIO27 Interrupt",\r
+ "value": "35"\r
+ },\r
+ "gpio28": {\r
+ "description": "GPIO28 Interrupt",\r
+ "value": "36"\r
+ },\r
+ "gpio29": {\r
+ "description": "GPIO29 Interrupt",\r
+ "value": "37"\r
+ },\r
+ "gpio30": {\r
+ "description": "GPIO30 Interrupt",\r
+ "value": "38"\r
+ },\r
+ "gpio31": {\r
+ "description": "GPIO31 Interrupt",\r
+ "value": "39"\r
+ }\r
+ }\r
+ },\r
+ "uart0": {\r
+ "description": "Universal Asynchronous Receiver/Transmitter (UART) Peripheral",\r
+ "baseAddress": "0x10013000",\r
+ "size": "0x1000",\r
+ "resetMask": "none",\r
+ "groupName": "uart",\r
+ "registers": {\r
+ "txdata": {\r
+ "description": "Transmit Data Register",\r
+ "addressOffset": "0x000",\r
+ "fields": {\r
+ "data": {\r
+ "description": "Transmit data",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8"\r
+ },\r
+ "full": {\r
+ "description": "Transmit FIFO full",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "rxdata": {\r
+ "description": "Receive Data Register",\r
+ "addressOffset": "0x004",\r
+ "resetMask": "none",\r
+ "fields": {\r
+ "data": {\r
+ "description": "Received data",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8",\r
+ "access": "r"\r
+ },\r
+ "empty": {\r
+ "description": "Receive FIFO empty",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "txctrl": {\r
+ "description": "Transmit Control Register ",\r
+ "addressOffset": "0x008",\r
+ "fields": {\r
+ "txen": {\r
+ "description": "Transmit enable",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "nstop": {\r
+ "description": "Number of stop bits",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "txcnt": {\r
+ "description": "Transmit watermark level",\r
+ "bitOffset": "16",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "rxctrl": {\r
+ "description": "Receive Control Register",\r
+ "addressOffset": "0x00C",\r
+ "fields": {\r
+ "rxen": {\r
+ "description": "Receive enable",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "rxcnt": {\r
+ "description": "Receive watermark level",\r
+ "bitOffset": "16",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "ie": {\r
+ "description": "Interrupt Enable Register",\r
+ "addressOffset": "0x010",\r
+ "fields": {\r
+ "txwm": {\r
+ "description": "Transmit watermark interrupt enable",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "rxwm": {\r
+ "description": "Receive watermark interrupt enable",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "ip": {\r
+ "description": "Interrupt Pending Register",\r
+ "addressOffset": "0x014",\r
+ "access": "r",\r
+ "fields": {\r
+ "txwm": {\r
+ "description": "Transmit watermark interrupt pending",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1"\r
+ },\r
+ "rxwm": {\r
+ "description": "Receive watermark interrupt pending",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "div": {\r
+ "description": "Baud Rate Divisor Register",\r
+ "addressOffset": "0x018",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Baud rate divisor",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0000FFFF"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "uart0": {\r
+ "description": "UART0 Interrupt",\r
+ "value": "3"\r
+ }\r
+ }\r
+ },\r
+ "spi0": {\r
+ "description": "Serial Peripheral Interface (SPI) Peripheral",\r
+ "baseAddress": "0x10014000",\r
+ "size": "0x1000",\r
+ "resetMask": "none",\r
+ "groupName": "spi",\r
+ "registers": {\r
+ "sckdiv": {\r
+ "description": "Serial clock divisor Register",\r
+ "addressOffset": "0x000",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "Divisor for serial clock",\r
+ "bitOffset": "0",\r
+ "bitWidth": "12",\r
+ "resetMask": "all",\r
+ "resetValue": "0x003"\r
+ }\r
+ }\r
+ },\r
+ "sckmode": {\r
+ "description": "Serial Clock Mode Register",\r
+ "addressOffset": "0x004",\r
+ "fields": {\r
+ "pha": {\r
+ "description": "Serial clock phase",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "pol": {\r
+ "description": "Serial clock polarity",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "csid": {\r
+ "description": "Chip Select ID Register",\r
+ "addressOffset": "0x010",\r
+ "resetMask": "all",\r
+ "resetValue": "0x00000000"\r
+ },\r
+ "csdef": {\r
+ "description": "Chip Select Default Register",\r
+ "addressOffset": "0x014",\r
+ "resetMask": "all",\r
+ "resetValue": "0x00000001"\r
+ },\r
+ "csmode": {\r
+ "description": "Chip Select Mode Register",\r
+ "addressOffset": "0x018",\r
+ "fields": {\r
+ "mode": {\r
+ "description": "Chip select mode",\r
+ "bitOffset": "0",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0",\r
+ "enumerations": {\r
+ "csmode-enum": {\r
+ "description": "Chip Select Modes Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "auto",\r
+ "description": "Assert/de-assert CS at the beginning/end of each frame"\r
+ },\r
+ "*": {\r
+ "displayName": "reserved"\r
+ },\r
+ "2": {\r
+ "displayName": "hold",\r
+ "description": "Keep CS continuously asserted after the initial frame"\r
+ },\r
+ "3": {\r
+ "displayName": "off",\r
+ "description": "Disable hardware control of the CS pin"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "delay0": {\r
+ "description": "Delay Control 0 Register",\r
+ "addressOffset": "0x028",\r
+ "fields": {\r
+ "cssck": {\r
+ "description": "CS to SCK Delay",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x01"\r
+ },\r
+ "sckcs": {\r
+ "description": "SCK to CS Delay",\r
+ "bitOffset": "16",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x01"\r
+ }\r
+ }\r
+ },\r
+ "delay1": {\r
+ "description": "Delay Control 1 Register",\r
+ "addressOffset": "0x02C",\r
+ "fields": {\r
+ "intercs": {\r
+ "description": "Minimum CS inactive time",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x01"\r
+ },\r
+ "interxfr": {\r
+ "description": "Maximum interframe delay",\r
+ "bitOffset": "16",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x01"\r
+ }\r
+ }\r
+ },\r
+ "fmt": {\r
+ "description": "Frame Format Register",\r
+ "addressOffset": "0x040",\r
+ "fields": {\r
+ "proto": {\r
+ "description": "SPI Protocol",\r
+ "bitOffset": "0",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0",\r
+ "enumerations": {\r
+ "proto-enum": {\r
+ "description": "SPI Protocol Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "single",\r
+ "description": "DQ0 (MOSI), DQ1 (MISO)"\r
+ },\r
+ "1": {\r
+ "displayName": "dual",\r
+ "description": "DQ0, DQ1"\r
+ },\r
+ "2": {\r
+ "displayName": "quad",\r
+ "description": "DQ0, DQ1, DQ2, DQ3"\r
+ },\r
+ "*": {\r
+ "displayName": "reserved"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "endian": {\r
+ "description": "SPI endianness",\r
+ "bitOffset": "2",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0",\r
+ "enumerations": {\r
+ "endian-enum": {\r
+ "description": "SPI Endianness Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "msb",\r
+ "description": "Transmit most-significant bit (MSB) first"\r
+ },\r
+ "1": {\r
+ "displayName": "lsb",\r
+ "description": "Transmit least-significant bit (LSB) first"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "dir": {\r
+ "description": "SPI I/O Direction",\r
+ "bitOffset": "3",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1",\r
+ "enumerations": {\r
+ "dir-enum": {\r
+ "description": "SPI I/O Direction Enumeration",\r
+ "values": {\r
+ "0": {\r
+ "displayName": "rx",\r
+ "description": "For dual and quad protocols, the DQ pins are tri-stated. For the single protocol, the DQ0 pin is driven with the transmit data as normal."\r
+ },\r
+ "1": {\r
+ "displayName": "tx",\r
+ "description": "The receive FIFO is not populated."\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "len": {\r
+ "description": "Number of bits per frame",\r
+ "bitOffset": "16",\r
+ "bitWidth": "4",\r
+ "resetMask": "all",\r
+ "resetValue": "0x8"\r
+ }\r
+ }\r
+ },\r
+ "txdata": {\r
+ "description": "Tx FIFO Data Register",\r
+ "addressOffset": "0x048",\r
+ "fields": {\r
+ "data": {\r
+ "description": "Transmit data",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x00"\r
+ },\r
+ "full": {\r
+ "description": "FIFO full flag",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ },\r
+ "rxdata": {\r
+ "description": "Rx FIFO Data Register",\r
+ "addressOffset": "0x04C",\r
+ "resetMask": "none",\r
+ "access": "r",\r
+ "fields": {\r
+ "data": {\r
+ "description": "Received data",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8"\r
+ },\r
+ "empty": {\r
+ "description": "FIFO empty flag",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "txmark": {\r
+ "description": "Tx FIFO Watermark Register",\r
+ "addressOffset": "0x050",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Transmit watermark",\r
+ "bitOffset": "0",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ }\r
+ }\r
+ },\r
+ "rxmark": {\r
+ "description": "Rx FIFO Watermark Register",\r
+ "addressOffset": "0x054",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Receive watermark",\r
+ "bitOffset": "0",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "fctrl": {\r
+ "description": "Flash Interface Control Register",\r
+ "addressOffset": "0x060",\r
+ "fields": {\r
+ "en": {\r
+ "description": "SPI Flash Mode Select",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ }\r
+ }\r
+ },\r
+ "ffmt": {\r
+ "description": "Flash Instruction Format Register",\r
+ "addressOffset": "0x064",\r
+ "fields": {\r
+ "cmden": {\r
+ "description": "Enable sending of command",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x1"\r
+ },\r
+ "addrlen": {\r
+ "description": "Number of address bytes(0 to 4)",\r
+ "bitOffset": "1",\r
+ "bitWidth": "3",\r
+ "resetMask": "all",\r
+ "resetValue": "0x3"\r
+ },\r
+ "padcnt": {\r
+ "description": "Number of dummy cycles",\r
+ "bitOffset": "4",\r
+ "bitWidth": "4",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmdproto": {\r
+ "description": "Protocol for transmitting command",\r
+ "bitOffset": "8",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "addrproto": {\r
+ "description": "Protocol for transmitting address and padding",\r
+ "bitOffset": "10",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "dataproto": {\r
+ "description": "Protocol for receiving data bytes",\r
+ "bitOffset": "12",\r
+ "bitWidth": "2",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmdcode": {\r
+ "description": "Value of command byte",\r
+ "bitOffset": "16",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x03"\r
+ },\r
+ "padcode": {\r
+ "description": "First 8 bits to transmit during dummy cycles",\r
+ "bitOffset": "24",\r
+ "bitWidth": "8",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "ie": {\r
+ "description": "Interrupt Enable Register",\r
+ "addressOffset": "0x070",\r
+ "fields": {\r
+ "txwm": {\r
+ "description": "Transmit watermark enable",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "access": "r",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "rxwm": {\r
+ "description": "Receive watermark enable",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1",\r
+ "access": "r",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ }\r
+ }\r
+ },\r
+ "ip": {\r
+ "description": "Interrupt Pending Register",\r
+ "addressOffset": "0x074",\r
+ "fields": {\r
+ "txwm": {\r
+ "description": "Transmit watermark pending",\r
+ "bitOffset": "0",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ },\r
+ "rxwm": {\r
+ "description": "Receive watermark pending",\r
+ "bitOffset": "1",\r
+ "bitWidth": "1",\r
+ "access": "r"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "spi0": {\r
+ "description": "SPI0 Interrupt",\r
+ "value": "5"\r
+ }\r
+ }\r
+ },\r
+ "pwm0": {\r
+ "description": "Pulse-Width Modulation (PWM) Peripheral",\r
+ "baseAddress": "0x10015000",\r
+ "size": "0x1000",\r
+ "resetMask": "none",\r
+ "registers": {\r
+ "cfg": {\r
+ "description": "Configuration Register",\r
+ "addressOffset": "0x000",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "Counter scale",\r
+ "bitOffset": "0",\r
+ "bitWidth": "4"\r
+ },\r
+ "sticky": {\r
+ "description": "Sticky - disallow clearing pwmcmpXip bits",\r
+ "bitOffset": "8",\r
+ "bitWidth": "1"\r
+ },\r
+ "zerocmp": {\r
+ "description": "Zero - counter resets to zero after match",\r
+ "bitOffset": "9",\r
+ "bitWidth": "1"\r
+ },\r
+ "deglitch": {\r
+ "description": "Deglitch - latch pwmcmpXip within same cycle",\r
+ "bitOffset": "10",\r
+ "bitWidth": "1"\r
+ },\r
+ "enalways": {\r
+ "description": "Enable always - run continuously",\r
+ "bitOffset": "12",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "enoneshot": {\r
+ "description": "enable one shot - run one cycle",\r
+ "bitOffset": "13",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmp0center": {\r
+ "description": "PWM0 Compare Center",\r
+ "bitOffset": "16",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1center": {\r
+ "description": "PWM1 Compare Center",\r
+ "bitOffset": "17",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2center": {\r
+ "description": "PWM2 Compare Center",\r
+ "bitOffset": "18",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3center": {\r
+ "description": "PWM3 Compare Center",\r
+ "bitOffset": "19",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp0gang": {\r
+ "description": "PWM0/PWM1 Compare Gang",\r
+ "bitOffset": "24",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1gang": {\r
+ "description": "PWM1/PWM2 Compare Gang",\r
+ "bitOffset": "25",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2gang": {\r
+ "description": "PWM2/PWM3 Compare Gang",\r
+ "bitOffset": "26",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3gang": {\r
+ "description": "PWM3/PWM0 Compare Gang",\r
+ "bitOffset": "27",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp0ip": {\r
+ "description": "PWM0 Interrupt Pending",\r
+ "bitOffset": "28",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1ip": {\r
+ "description": "PWM1 Interrupt Pending",\r
+ "bitOffset": "29",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2ip": {\r
+ "description": "PWM2 Interrupt Pending",\r
+ "bitOffset": "30",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3ip": {\r
+ "description": "PWM3 Interrupt Pending",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "count": {\r
+ "description": "Configuration Register",\r
+ "addressOffset": "0x008"\r
+ },\r
+ "scale": {\r
+ "description": "Scale Register",\r
+ "addressOffset": "0x010",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Compare value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8"\r
+ }\r
+ }\r
+ },\r
+ "cmp": {\r
+ "arraySize": "4",\r
+ "description": "Compare Registers",\r
+ "addressOffset": "0x020",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Compare value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "8"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "pwm0cmp0": {\r
+ "description": "PWM0 Compare 0 Interrupt",\r
+ "value": "40"\r
+ },\r
+ "pwm0cmp1": {\r
+ "description": "PWM0 Compare 1 Interrupt",\r
+ "value": "41"\r
+ },\r
+ "pwm0cmp2": {\r
+ "description": "PWM0 Compare 2 Interrupt",\r
+ "value": "42"\r
+ },\r
+ "pwm0cmp3": {\r
+ "description": "PWM0 Compare 3 Interrupt",\r
+ "value": "43"\r
+ }\r
+ }\r
+ },\r
+ "uart1": {\r
+ "baseAddress": "0x10023000",\r
+ "derivedFrom": "uart0",\r
+ "groupName": "uart",\r
+ "interrupts": {\r
+ "uart1": {\r
+ "description": "UART1 Interrupt",\r
+ "value": "4"\r
+ }\r
+ }\r
+ },\r
+ "spi1": {\r
+ "baseAddress": "0x10024000",\r
+ "derivedFrom": "spi0",\r
+ "groupName": "spi",\r
+ "interrupts": {\r
+ "spi1": {\r
+ "description": "SPI1 Interrupt",\r
+ "value": "6"\r
+ }\r
+ }\r
+ },\r
+ "pwm1": {\r
+ "description": "Pulse-Width Modulation (PWM) Peripheral",\r
+ "baseAddress": "0x10025000",\r
+ "groupName": "pwm",\r
+ "size": "0x1000",\r
+ "resetMask": "none",\r
+ "groupName": "pwm",\r
+ "registers": {\r
+ "cfg": {\r
+ "description": "Configuration Register",\r
+ "addressOffset": "0x000",\r
+ "fields": {\r
+ "scale": {\r
+ "description": "Counter scale",\r
+ "bitOffset": "0",\r
+ "bitWidth": "4"\r
+ },\r
+ "sticky": {\r
+ "description": "Sticky - disallow clearing pwmcmpXip bits",\r
+ "bitOffset": "8",\r
+ "bitWidth": "1"\r
+ },\r
+ "zerocmp": {\r
+ "description": "Zero - counter resets to zero after match",\r
+ "bitOffset": "9",\r
+ "bitWidth": "1"\r
+ },\r
+ "deglitch": {\r
+ "description": "Deglitch - latch pwmcmpXip within same cycle",\r
+ "bitOffset": "10",\r
+ "bitWidth": "1"\r
+ },\r
+ "enalways": {\r
+ "description": "Enable always - run continuously",\r
+ "bitOffset": "12",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "enoneshot": {\r
+ "description": "enable one shot - run one cycle",\r
+ "bitOffset": "13",\r
+ "bitWidth": "1",\r
+ "resetMask": "all",\r
+ "resetValue": "0x0"\r
+ },\r
+ "cmp0center": {\r
+ "description": "PWM0 Compare Center",\r
+ "bitOffset": "16",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1center": {\r
+ "description": "PWM1 Compare Center",\r
+ "bitOffset": "17",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2center": {\r
+ "description": "PWM2 Compare Center",\r
+ "bitOffset": "18",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3center": {\r
+ "description": "PWM3 Compare Center",\r
+ "bitOffset": "19",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp0gang": {\r
+ "description": "PWM0/PWM1 Compare Gang",\r
+ "bitOffset": "24",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1gang": {\r
+ "description": "PWM1/PWM2 Compare Gang",\r
+ "bitOffset": "25",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2gang": {\r
+ "description": "PWM2/PWM3 Compare Gang",\r
+ "bitOffset": "26",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3gang": {\r
+ "description": "PWM3/PWM0 Compare Gang",\r
+ "bitOffset": "27",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp0ip": {\r
+ "description": "PWM0 Interrupt Pending",\r
+ "bitOffset": "28",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp1ip": {\r
+ "description": "PWM1 Interrupt Pending",\r
+ "bitOffset": "29",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp2ip": {\r
+ "description": "PWM2 Interrupt Pending",\r
+ "bitOffset": "30",\r
+ "bitWidth": "1"\r
+ },\r
+ "cmp3ip": {\r
+ "description": "PWM3 Interrupt Pending",\r
+ "bitOffset": "31",\r
+ "bitWidth": "1"\r
+ }\r
+ }\r
+ },\r
+ "count": {\r
+ "description": "Configuration Register",\r
+ "addressOffset": "0x008"\r
+ },\r
+ "scale": {\r
+ "description": "Scale Register",\r
+ "addressOffset": "0x010",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Compare value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16"\r
+ }\r
+ }\r
+ },\r
+ "cmp": {\r
+ "arraySize": "4",\r
+ "description": "Compare Registers",\r
+ "addressOffset": "0x020",\r
+ "fields": {\r
+ "value": {\r
+ "description": "Compare value",\r
+ "bitOffset": "0",\r
+ "bitWidth": "16"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "interrupts": {\r
+ "pwm1cmp0": {\r
+ "description": "PWM1 Compare 0 Interrupt",\r
+ "value": "44"\r
+ },\r
+ "pwm1cmp1": {\r
+ "description": "PWM1 Compare 1 Interrupt",\r
+ "value": "45"\r
+ },\r
+ "pwm1cmp2": {\r
+ "description": "PWM1 Compare 2 Interrupt",\r
+ "value": "46"\r
+ },\r
+ "pwm1cmp3": {\r
+ "description": "PWM1 Compare 3 Interrupt",\r
+ "value": "47"\r
+ }\r
+ }\r
+ },\r
+ "spi2": {\r
+ "baseAddress": "0x10034000",\r
+ "derivedFrom": "spi0",\r
+ "groupName": "spi",\r
+ "interrupts": {\r
+ "spi2": {\r
+ "description": "SPI2 Interrupt",\r
+ "value": "7"\r
+ }\r
+ }\r
+ },\r
+ "pwm2": {\r
+ "baseAddress": "0x10035000",\r
+ "derivedFrom": "pwm1",\r
+ "groupName": "pwm",\r
+ "interrupts": {\r
+ "pwm2cmp0": {\r
+ "description": "PWM2 Compare 0 Interrupt",\r
+ "value": "48"\r
+ },\r
+ "pwm2cmp1": {\r
+ "description": "PWM2 Compare 1 Interrupt",\r
+ "value": "49"\r
+ },\r
+ "pwm2cmp2": {\r
+ "description": "PWM2 Compare 2 Interrupt",\r
+ "value": "50"\r
+ },\r
+ "pwm2cmp3": {\r
+ "description": "PWM2 Compare 3 Interrupt",\r
+ "value": "51"\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+
+This software, except as otherwise noted in subrepositories,
+is licensed under the Apache 2 license, quoted below.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2016 SiFive, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef RISCV_CSR_ENCODING_H\r
+#define RISCV_CSR_ENCODING_H\r
+\r
+#define MSTATUS_UIE 0x00000001\r
+#define MSTATUS_SIE 0x00000002\r
+#define MSTATUS_HIE 0x00000004\r
+#define MSTATUS_MIE 0x00000008\r
+#define MSTATUS_UPIE 0x00000010\r
+#define MSTATUS_SPIE 0x00000020\r
+#define MSTATUS_HPIE 0x00000040\r
+#define MSTATUS_MPIE 0x00000080\r
+#define MSTATUS_SPP 0x00000100\r
+#define MSTATUS_HPP 0x00000600\r
+#define MSTATUS_MPP 0x00001800\r
+#define MSTATUS_FS 0x00006000\r
+#define MSTATUS_XS 0x00018000\r
+#define MSTATUS_MPRV 0x00020000\r
+#define MSTATUS_PUM 0x00040000\r
+#define MSTATUS_MXR 0x00080000\r
+#define MSTATUS_VM 0x1F000000\r
+#define MSTATUS32_SD 0x80000000\r
+#define MSTATUS64_SD 0x8000000000000000\r
+\r
+#define SSTATUS_UIE 0x00000001\r
+#define SSTATUS_SIE 0x00000002\r
+#define SSTATUS_UPIE 0x00000010\r
+#define SSTATUS_SPIE 0x00000020\r
+#define SSTATUS_SPP 0x00000100\r
+#define SSTATUS_FS 0x00006000\r
+#define SSTATUS_XS 0x00018000\r
+#define SSTATUS_PUM 0x00040000\r
+#define SSTATUS32_SD 0x80000000\r
+#define SSTATUS64_SD 0x8000000000000000\r
+\r
+#define DCSR_XDEBUGVER (3U<<30)\r
+#define DCSR_NDRESET (1<<29)\r
+#define DCSR_FULLRESET (1<<28)\r
+#define DCSR_EBREAKM (1<<15)\r
+#define DCSR_EBREAKH (1<<14)\r
+#define DCSR_EBREAKS (1<<13)\r
+#define DCSR_EBREAKU (1<<12)\r
+#define DCSR_STOPCYCLE (1<<10)\r
+#define DCSR_STOPTIME (1<<9)\r
+#define DCSR_CAUSE (7<<6)\r
+#define DCSR_DEBUGINT (1<<5)\r
+#define DCSR_HALT (1<<3)\r
+#define DCSR_STEP (1<<2)\r
+#define DCSR_PRV (3<<0)\r
+\r
+#define DCSR_CAUSE_NONE 0\r
+#define DCSR_CAUSE_SWBP 1\r
+#define DCSR_CAUSE_HWBP 2\r
+#define DCSR_CAUSE_DEBUGINT 3\r
+#define DCSR_CAUSE_STEP 4\r
+#define DCSR_CAUSE_HALT 5\r
+\r
+#define MCONTROL_TYPE(xlen) (0xfULL<<((xlen)-4))\r
+#define MCONTROL_DMODE(xlen) (1ULL<<((xlen)-5))\r
+#define MCONTROL_MASKMAX(xlen) (0x3fULL<<((xlen)-11))\r
+\r
+#define MCONTROL_SELECT (1<<19)\r
+#define MCONTROL_TIMING (1<<18)\r
+#define MCONTROL_ACTION (0x3f<<12)\r
+#define MCONTROL_CHAIN (1<<11)\r
+#define MCONTROL_MATCH (0xf<<7)\r
+#define MCONTROL_M (1<<6)\r
+#define MCONTROL_H (1<<5)\r
+#define MCONTROL_S (1<<4)\r
+#define MCONTROL_U (1<<3)\r
+#define MCONTROL_EXECUTE (1<<2)\r
+#define MCONTROL_STORE (1<<1)\r
+#define MCONTROL_LOAD (1<<0)\r
+\r
+#define MCONTROL_TYPE_NONE 0\r
+#define MCONTROL_TYPE_MATCH 2\r
+\r
+#define MCONTROL_ACTION_DEBUG_EXCEPTION 0\r
+#define MCONTROL_ACTION_DEBUG_MODE 1\r
+#define MCONTROL_ACTION_TRACE_START 2\r
+#define MCONTROL_ACTION_TRACE_STOP 3\r
+#define MCONTROL_ACTION_TRACE_EMIT 4\r
+\r
+#define MCONTROL_MATCH_EQUAL 0\r
+#define MCONTROL_MATCH_NAPOT 1\r
+#define MCONTROL_MATCH_GE 2\r
+#define MCONTROL_MATCH_LT 3\r
+#define MCONTROL_MATCH_MASK_LOW 4\r
+#define MCONTROL_MATCH_MASK_HIGH 5\r
+\r
+#define MIP_SSIP (1 << IRQ_S_SOFT)\r
+#define MIP_HSIP (1 << IRQ_H_SOFT)\r
+#define MIP_MSIP (1 << IRQ_M_SOFT)\r
+#define MIP_STIP (1 << IRQ_S_TIMER)\r
+#define MIP_HTIP (1 << IRQ_H_TIMER)\r
+#define MIP_MTIP (1 << IRQ_M_TIMER)\r
+#define MIP_SEIP (1 << IRQ_S_EXT)\r
+#define MIP_HEIP (1 << IRQ_H_EXT)\r
+#define MIP_MEIP (1 << IRQ_M_EXT)\r
+\r
+#define SIP_SSIP MIP_SSIP\r
+#define SIP_STIP MIP_STIP\r
+\r
+#define PRV_U 0\r
+#define PRV_S 1\r
+#define PRV_H 2\r
+#define PRV_M 3\r
+\r
+#define VM_MBARE 0\r
+#define VM_MBB 1\r
+#define VM_MBBID 2\r
+#define VM_SV32 8\r
+#define VM_SV39 9\r
+#define VM_SV48 10\r
+\r
+#define IRQ_S_SOFT 1\r
+#define IRQ_H_SOFT 2\r
+#define IRQ_M_SOFT 3\r
+#define IRQ_S_TIMER 5\r
+#define IRQ_H_TIMER 6\r
+#define IRQ_M_TIMER 7\r
+#define IRQ_S_EXT 9\r
+#define IRQ_H_EXT 10\r
+#define IRQ_M_EXT 11\r
+#define IRQ_COP 12\r
+#define IRQ_HOST 13\r
+\r
+#define DEFAULT_RSTVEC 0x00001000\r
+#define DEFAULT_NMIVEC 0x00001004\r
+#define DEFAULT_MTVEC 0x00001010\r
+#define CONFIG_STRING_ADDR 0x0000100C\r
+#define EXT_IO_BASE 0x40000000\r
+#define DRAM_BASE 0x80000000\r
+\r
+// page table entry (PTE) fields\r
+#define PTE_V 0x001 // Valid\r
+#define PTE_R 0x002 // Read\r
+#define PTE_W 0x004 // Write\r
+#define PTE_X 0x008 // Execute\r
+#define PTE_U 0x010 // User\r
+#define PTE_G 0x020 // Global\r
+#define PTE_A 0x040 // Accessed\r
+#define PTE_D 0x080 // Dirty\r
+#define PTE_SOFT 0x300 // Reserved for Software\r
+\r
+#define PTE_PPN_SHIFT 10\r
+\r
+#define PTE_TABLE(PTE) (((PTE) & (PTE_V | PTE_R | PTE_W | PTE_X)) == PTE_V)\r
+\r
+#ifdef __riscv\r
+\r
+#ifdef __riscv64\r
+# define MSTATUS_SD MSTATUS64_SD\r
+# define SSTATUS_SD SSTATUS64_SD\r
+# define RISCV_PGLEVEL_BITS 9\r
+#else\r
+# define MSTATUS_SD MSTATUS32_SD\r
+# define SSTATUS_SD SSTATUS32_SD\r
+# define RISCV_PGLEVEL_BITS 10\r
+#endif\r
+#define RISCV_PGSHIFT 12\r
+#define RISCV_PGSIZE (1 << RISCV_PGSHIFT)\r
+\r
+#ifndef __ASSEMBLER__\r
+\r
+#ifdef __GNUC__\r
+\r
+#define read_csr(reg) ({ unsigned long __tmp; \\r
+ asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \\r
+ __tmp; })\r
+\r
+#define write_csr(reg, val) ({ \\r
+ if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \\r
+ asm volatile ("csrw " #reg ", %0" :: "i"(val)); \\r
+ else \\r
+ asm volatile ("csrw " #reg ", %0" :: "r"(val)); })\r
+\r
+#define swap_csr(reg, val) ({ unsigned long __tmp; \\r
+ if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \\r
+ asm volatile ("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "i"(val)); \\r
+ else \\r
+ asm volatile ("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "r"(val)); \\r
+ __tmp; })\r
+\r
+#define set_csr(reg, bit) ({ unsigned long __tmp; \\r
+ if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \\r
+ asm volatile ("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \\r
+ else \\r
+ asm volatile ("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \\r
+ __tmp; })\r
+\r
+#define clear_csr(reg, bit) ({ unsigned long __tmp; \\r
+ if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \\r
+ asm volatile ("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \\r
+ else \\r
+ asm volatile ("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \\r
+ __tmp; })\r
+\r
+#define rdtime() read_csr(time)\r
+#define rdcycle() read_csr(cycle)\r
+#define rdinstret() read_csr(instret)\r
+\r
+#endif\r
+\r
+#endif\r
+\r
+#endif\r
+\r
+#endif\r
+/* Automatically generated by parse-opcodes */\r
+#ifndef RISCV_ENCODING_H\r
+#define RISCV_ENCODING_H\r
+#define MATCH_BEQ 0x63\r
+#define MASK_BEQ 0x707f\r
+#define MATCH_BNE 0x1063\r
+#define MASK_BNE 0x707f\r
+#define MATCH_BLT 0x4063\r
+#define MASK_BLT 0x707f\r
+#define MATCH_BGE 0x5063\r
+#define MASK_BGE 0x707f\r
+#define MATCH_BLTU 0x6063\r
+#define MASK_BLTU 0x707f\r
+#define MATCH_BGEU 0x7063\r
+#define MASK_BGEU 0x707f\r
+#define MATCH_JALR 0x67\r
+#define MASK_JALR 0x707f\r
+#define MATCH_JAL 0x6f\r
+#define MASK_JAL 0x7f\r
+#define MATCH_LUI 0x37\r
+#define MASK_LUI 0x7f\r
+#define MATCH_AUIPC 0x17\r
+#define MASK_AUIPC 0x7f\r
+#define MATCH_ADDI 0x13\r
+#define MASK_ADDI 0x707f\r
+#define MATCH_SLLI 0x1013\r
+#define MASK_SLLI 0xfc00707f\r
+#define MATCH_SLTI 0x2013\r
+#define MASK_SLTI 0x707f\r
+#define MATCH_SLTIU 0x3013\r
+#define MASK_SLTIU 0x707f\r
+#define MATCH_XORI 0x4013\r
+#define MASK_XORI 0x707f\r
+#define MATCH_SRLI 0x5013\r
+#define MASK_SRLI 0xfc00707f\r
+#define MATCH_SRAI 0x40005013\r
+#define MASK_SRAI 0xfc00707f\r
+#define MATCH_ORI 0x6013\r
+#define MASK_ORI 0x707f\r
+#define MATCH_ANDI 0x7013\r
+#define MASK_ANDI 0x707f\r
+#define MATCH_ADD 0x33\r
+#define MASK_ADD 0xfe00707f\r
+#define MATCH_SUB 0x40000033\r
+#define MASK_SUB 0xfe00707f\r
+#define MATCH_SLL 0x1033\r
+#define MASK_SLL 0xfe00707f\r
+#define MATCH_SLT 0x2033\r
+#define MASK_SLT 0xfe00707f\r
+#define MATCH_SLTU 0x3033\r
+#define MASK_SLTU 0xfe00707f\r
+#define MATCH_XOR 0x4033\r
+#define MASK_XOR 0xfe00707f\r
+#define MATCH_SRL 0x5033\r
+#define MASK_SRL 0xfe00707f\r
+#define MATCH_SRA 0x40005033\r
+#define MASK_SRA 0xfe00707f\r
+#define MATCH_OR 0x6033\r
+#define MASK_OR 0xfe00707f\r
+#define MATCH_AND 0x7033\r
+#define MASK_AND 0xfe00707f\r
+#define MATCH_ADDIW 0x1b\r
+#define MASK_ADDIW 0x707f\r
+#define MATCH_SLLIW 0x101b\r
+#define MASK_SLLIW 0xfe00707f\r
+#define MATCH_SRLIW 0x501b\r
+#define MASK_SRLIW 0xfe00707f\r
+#define MATCH_SRAIW 0x4000501b\r
+#define MASK_SRAIW 0xfe00707f\r
+#define MATCH_ADDW 0x3b\r
+#define MASK_ADDW 0xfe00707f\r
+#define MATCH_SUBW 0x4000003b\r
+#define MASK_SUBW 0xfe00707f\r
+#define MATCH_SLLW 0x103b\r
+#define MASK_SLLW 0xfe00707f\r
+#define MATCH_SRLW 0x503b\r
+#define MASK_SRLW 0xfe00707f\r
+#define MATCH_SRAW 0x4000503b\r
+#define MASK_SRAW 0xfe00707f\r
+#define MATCH_LB 0x3\r
+#define MASK_LB 0x707f\r
+#define MATCH_LH 0x1003\r
+#define MASK_LH 0x707f\r
+#define MATCH_LW 0x2003\r
+#define MASK_LW 0x707f\r
+#define MATCH_LD 0x3003\r
+#define MASK_LD 0x707f\r
+#define MATCH_LBU 0x4003\r
+#define MASK_LBU 0x707f\r
+#define MATCH_LHU 0x5003\r
+#define MASK_LHU 0x707f\r
+#define MATCH_LWU 0x6003\r
+#define MASK_LWU 0x707f\r
+#define MATCH_SB 0x23\r
+#define MASK_SB 0x707f\r
+#define MATCH_SH 0x1023\r
+#define MASK_SH 0x707f\r
+#define MATCH_SW 0x2023\r
+#define MASK_SW 0x707f\r
+#define MATCH_SD 0x3023\r
+#define MASK_SD 0x707f\r
+#define MATCH_FENCE 0xf\r
+#define MASK_FENCE 0x707f\r
+#define MATCH_FENCE_I 0x100f\r
+#define MASK_FENCE_I 0x707f\r
+#define MATCH_MUL 0x2000033\r
+#define MASK_MUL 0xfe00707f\r
+#define MATCH_MULH 0x2001033\r
+#define MASK_MULH 0xfe00707f\r
+#define MATCH_MULHSU 0x2002033\r
+#define MASK_MULHSU 0xfe00707f\r
+#define MATCH_MULHU 0x2003033\r
+#define MASK_MULHU 0xfe00707f\r
+#define MATCH_DIV 0x2004033\r
+#define MASK_DIV 0xfe00707f\r
+#define MATCH_DIVU 0x2005033\r
+#define MASK_DIVU 0xfe00707f\r
+#define MATCH_REM 0x2006033\r
+#define MASK_REM 0xfe00707f\r
+#define MATCH_REMU 0x2007033\r
+#define MASK_REMU 0xfe00707f\r
+#define MATCH_MULW 0x200003b\r
+#define MASK_MULW 0xfe00707f\r
+#define MATCH_DIVW 0x200403b\r
+#define MASK_DIVW 0xfe00707f\r
+#define MATCH_DIVUW 0x200503b\r
+#define MASK_DIVUW 0xfe00707f\r
+#define MATCH_REMW 0x200603b\r
+#define MASK_REMW 0xfe00707f\r
+#define MATCH_REMUW 0x200703b\r
+#define MASK_REMUW 0xfe00707f\r
+#define MATCH_AMOADD_W 0x202f\r
+#define MASK_AMOADD_W 0xf800707f\r
+#define MATCH_AMOXOR_W 0x2000202f\r
+#define MASK_AMOXOR_W 0xf800707f\r
+#define MATCH_AMOOR_W 0x4000202f\r
+#define MASK_AMOOR_W 0xf800707f\r
+#define MATCH_AMOAND_W 0x6000202f\r
+#define MASK_AMOAND_W 0xf800707f\r
+#define MATCH_AMOMIN_W 0x8000202f\r
+#define MASK_AMOMIN_W 0xf800707f\r
+#define MATCH_AMOMAX_W 0xa000202f\r
+#define MASK_AMOMAX_W 0xf800707f\r
+#define MATCH_AMOMINU_W 0xc000202f\r
+#define MASK_AMOMINU_W 0xf800707f\r
+#define MATCH_AMOMAXU_W 0xe000202f\r
+#define MASK_AMOMAXU_W 0xf800707f\r
+#define MATCH_AMOSWAP_W 0x800202f\r
+#define MASK_AMOSWAP_W 0xf800707f\r
+#define MATCH_LR_W 0x1000202f\r
+#define MASK_LR_W 0xf9f0707f\r
+#define MATCH_SC_W 0x1800202f\r
+#define MASK_SC_W 0xf800707f\r
+#define MATCH_AMOADD_D 0x302f\r
+#define MASK_AMOADD_D 0xf800707f\r
+#define MATCH_AMOXOR_D 0x2000302f\r
+#define MASK_AMOXOR_D 0xf800707f\r
+#define MATCH_AMOOR_D 0x4000302f\r
+#define MASK_AMOOR_D 0xf800707f\r
+#define MATCH_AMOAND_D 0x6000302f\r
+#define MASK_AMOAND_D 0xf800707f\r
+#define MATCH_AMOMIN_D 0x8000302f\r
+#define MASK_AMOMIN_D 0xf800707f\r
+#define MATCH_AMOMAX_D 0xa000302f\r
+#define MASK_AMOMAX_D 0xf800707f\r
+#define MATCH_AMOMINU_D 0xc000302f\r
+#define MASK_AMOMINU_D 0xf800707f\r
+#define MATCH_AMOMAXU_D 0xe000302f\r
+#define MASK_AMOMAXU_D 0xf800707f\r
+#define MATCH_AMOSWAP_D 0x800302f\r
+#define MASK_AMOSWAP_D 0xf800707f\r
+#define MATCH_LR_D 0x1000302f\r
+#define MASK_LR_D 0xf9f0707f\r
+#define MATCH_SC_D 0x1800302f\r
+#define MASK_SC_D 0xf800707f\r
+#define MATCH_ECALL 0x73\r
+#define MASK_ECALL 0xffffffff\r
+#define MATCH_EBREAK 0x100073\r
+#define MASK_EBREAK 0xffffffff\r
+#define MATCH_URET 0x200073\r
+#define MASK_URET 0xffffffff\r
+#define MATCH_SRET 0x10200073\r
+#define MASK_SRET 0xffffffff\r
+#define MATCH_HRET 0x20200073\r
+#define MASK_HRET 0xffffffff\r
+#define MATCH_MRET 0x30200073\r
+#define MASK_MRET 0xffffffff\r
+#define MATCH_DRET 0x7b200073\r
+#define MASK_DRET 0xffffffff\r
+#define MATCH_SFENCE_VM 0x10400073\r
+#define MASK_SFENCE_VM 0xfff07fff\r
+#define MATCH_WFI 0x10500073\r
+#define MASK_WFI 0xffffffff\r
+#define MATCH_CSRRW 0x1073\r
+#define MASK_CSRRW 0x707f\r
+#define MATCH_CSRRS 0x2073\r
+#define MASK_CSRRS 0x707f\r
+#define MATCH_CSRRC 0x3073\r
+#define MASK_CSRRC 0x707f\r
+#define MATCH_CSRRWI 0x5073\r
+#define MASK_CSRRWI 0x707f\r
+#define MATCH_CSRRSI 0x6073\r
+#define MASK_CSRRSI 0x707f\r
+#define MATCH_CSRRCI 0x7073\r
+#define MASK_CSRRCI 0x707f\r
+#define MATCH_FADD_S 0x53\r
+#define MASK_FADD_S 0xfe00007f\r
+#define MATCH_FSUB_S 0x8000053\r
+#define MASK_FSUB_S 0xfe00007f\r
+#define MATCH_FMUL_S 0x10000053\r
+#define MASK_FMUL_S 0xfe00007f\r
+#define MATCH_FDIV_S 0x18000053\r
+#define MASK_FDIV_S 0xfe00007f\r
+#define MATCH_FSGNJ_S 0x20000053\r
+#define MASK_FSGNJ_S 0xfe00707f\r
+#define MATCH_FSGNJN_S 0x20001053\r
+#define MASK_FSGNJN_S 0xfe00707f\r
+#define MATCH_FSGNJX_S 0x20002053\r
+#define MASK_FSGNJX_S 0xfe00707f\r
+#define MATCH_FMIN_S 0x28000053\r
+#define MASK_FMIN_S 0xfe00707f\r
+#define MATCH_FMAX_S 0x28001053\r
+#define MASK_FMAX_S 0xfe00707f\r
+#define MATCH_FSQRT_S 0x58000053\r
+#define MASK_FSQRT_S 0xfff0007f\r
+#define MATCH_FADD_D 0x2000053\r
+#define MASK_FADD_D 0xfe00007f\r
+#define MATCH_FSUB_D 0xa000053\r
+#define MASK_FSUB_D 0xfe00007f\r
+#define MATCH_FMUL_D 0x12000053\r
+#define MASK_FMUL_D 0xfe00007f\r
+#define MATCH_FDIV_D 0x1a000053\r
+#define MASK_FDIV_D 0xfe00007f\r
+#define MATCH_FSGNJ_D 0x22000053\r
+#define MASK_FSGNJ_D 0xfe00707f\r
+#define MATCH_FSGNJN_D 0x22001053\r
+#define MASK_FSGNJN_D 0xfe00707f\r
+#define MATCH_FSGNJX_D 0x22002053\r
+#define MASK_FSGNJX_D 0xfe00707f\r
+#define MATCH_FMIN_D 0x2a000053\r
+#define MASK_FMIN_D 0xfe00707f\r
+#define MATCH_FMAX_D 0x2a001053\r
+#define MASK_FMAX_D 0xfe00707f\r
+#define MATCH_FCVT_S_D 0x40100053\r
+#define MASK_FCVT_S_D 0xfff0007f\r
+#define MATCH_FCVT_D_S 0x42000053\r
+#define MASK_FCVT_D_S 0xfff0007f\r
+#define MATCH_FSQRT_D 0x5a000053\r
+#define MASK_FSQRT_D 0xfff0007f\r
+#define MATCH_FLE_S 0xa0000053\r
+#define MASK_FLE_S 0xfe00707f\r
+#define MATCH_FLT_S 0xa0001053\r
+#define MASK_FLT_S 0xfe00707f\r
+#define MATCH_FEQ_S 0xa0002053\r
+#define MASK_FEQ_S 0xfe00707f\r
+#define MATCH_FLE_D 0xa2000053\r
+#define MASK_FLE_D 0xfe00707f\r
+#define MATCH_FLT_D 0xa2001053\r
+#define MASK_FLT_D 0xfe00707f\r
+#define MATCH_FEQ_D 0xa2002053\r
+#define MASK_FEQ_D 0xfe00707f\r
+#define MATCH_FCVT_W_S 0xc0000053\r
+#define MASK_FCVT_W_S 0xfff0007f\r
+#define MATCH_FCVT_WU_S 0xc0100053\r
+#define MASK_FCVT_WU_S 0xfff0007f\r
+#define MATCH_FCVT_L_S 0xc0200053\r
+#define MASK_FCVT_L_S 0xfff0007f\r
+#define MATCH_FCVT_LU_S 0xc0300053\r
+#define MASK_FCVT_LU_S 0xfff0007f\r
+#define MATCH_FMV_X_S 0xe0000053\r
+#define MASK_FMV_X_S 0xfff0707f\r
+#define MATCH_FCLASS_S 0xe0001053\r
+#define MASK_FCLASS_S 0xfff0707f\r
+#define MATCH_FCVT_W_D 0xc2000053\r
+#define MASK_FCVT_W_D 0xfff0007f\r
+#define MATCH_FCVT_WU_D 0xc2100053\r
+#define MASK_FCVT_WU_D 0xfff0007f\r
+#define MATCH_FCVT_L_D 0xc2200053\r
+#define MASK_FCVT_L_D 0xfff0007f\r
+#define MATCH_FCVT_LU_D 0xc2300053\r
+#define MASK_FCVT_LU_D 0xfff0007f\r
+#define MATCH_FMV_X_D 0xe2000053\r
+#define MASK_FMV_X_D 0xfff0707f\r
+#define MATCH_FCLASS_D 0xe2001053\r
+#define MASK_FCLASS_D 0xfff0707f\r
+#define MATCH_FCVT_S_W 0xd0000053\r
+#define MASK_FCVT_S_W 0xfff0007f\r
+#define MATCH_FCVT_S_WU 0xd0100053\r
+#define MASK_FCVT_S_WU 0xfff0007f\r
+#define MATCH_FCVT_S_L 0xd0200053\r
+#define MASK_FCVT_S_L 0xfff0007f\r
+#define MATCH_FCVT_S_LU 0xd0300053\r
+#define MASK_FCVT_S_LU 0xfff0007f\r
+#define MATCH_FMV_S_X 0xf0000053\r
+#define MASK_FMV_S_X 0xfff0707f\r
+#define MATCH_FCVT_D_W 0xd2000053\r
+#define MASK_FCVT_D_W 0xfff0007f\r
+#define MATCH_FCVT_D_WU 0xd2100053\r
+#define MASK_FCVT_D_WU 0xfff0007f\r
+#define MATCH_FCVT_D_L 0xd2200053\r
+#define MASK_FCVT_D_L 0xfff0007f\r
+#define MATCH_FCVT_D_LU 0xd2300053\r
+#define MASK_FCVT_D_LU 0xfff0007f\r
+#define MATCH_FMV_D_X 0xf2000053\r
+#define MASK_FMV_D_X 0xfff0707f\r
+#define MATCH_FLW 0x2007\r
+#define MASK_FLW 0x707f\r
+#define MATCH_FLD 0x3007\r
+#define MASK_FLD 0x707f\r
+#define MATCH_FSW 0x2027\r
+#define MASK_FSW 0x707f\r
+#define MATCH_FSD 0x3027\r
+#define MASK_FSD 0x707f\r
+#define MATCH_FMADD_S 0x43\r
+#define MASK_FMADD_S 0x600007f\r
+#define MATCH_FMSUB_S 0x47\r
+#define MASK_FMSUB_S 0x600007f\r
+#define MATCH_FNMSUB_S 0x4b\r
+#define MASK_FNMSUB_S 0x600007f\r
+#define MATCH_FNMADD_S 0x4f\r
+#define MASK_FNMADD_S 0x600007f\r
+#define MATCH_FMADD_D 0x2000043\r
+#define MASK_FMADD_D 0x600007f\r
+#define MATCH_FMSUB_D 0x2000047\r
+#define MASK_FMSUB_D 0x600007f\r
+#define MATCH_FNMSUB_D 0x200004b\r
+#define MASK_FNMSUB_D 0x600007f\r
+#define MATCH_FNMADD_D 0x200004f\r
+#define MASK_FNMADD_D 0x600007f\r
+#define MATCH_C_NOP 0x1\r
+#define MASK_C_NOP 0xffff\r
+#define MATCH_C_ADDI16SP 0x6101\r
+#define MASK_C_ADDI16SP 0xef83\r
+#define MATCH_C_JR 0x8002\r
+#define MASK_C_JR 0xf07f\r
+#define MATCH_C_JALR 0x9002\r
+#define MASK_C_JALR 0xf07f\r
+#define MATCH_C_EBREAK 0x9002\r
+#define MASK_C_EBREAK 0xffff\r
+#define MATCH_C_LD 0x6000\r
+#define MASK_C_LD 0xe003\r
+#define MATCH_C_SD 0xe000\r
+#define MASK_C_SD 0xe003\r
+#define MATCH_C_ADDIW 0x2001\r
+#define MASK_C_ADDIW 0xe003\r
+#define MATCH_C_LDSP 0x6002\r
+#define MASK_C_LDSP 0xe003\r
+#define MATCH_C_SDSP 0xe002\r
+#define MASK_C_SDSP 0xe003\r
+#define MATCH_C_ADDI4SPN 0x0\r
+#define MASK_C_ADDI4SPN 0xe003\r
+#define MATCH_C_FLD 0x2000\r
+#define MASK_C_FLD 0xe003\r
+#define MATCH_C_LW 0x4000\r
+#define MASK_C_LW 0xe003\r
+#define MATCH_C_FLW 0x6000\r
+#define MASK_C_FLW 0xe003\r
+#define MATCH_C_FSD 0xa000\r
+#define MASK_C_FSD 0xe003\r
+#define MATCH_C_SW 0xc000\r
+#define MASK_C_SW 0xe003\r
+#define MATCH_C_FSW 0xe000\r
+#define MASK_C_FSW 0xe003\r
+#define MATCH_C_ADDI 0x1\r
+#define MASK_C_ADDI 0xe003\r
+#define MATCH_C_JAL 0x2001\r
+#define MASK_C_JAL 0xe003\r
+#define MATCH_C_LI 0x4001\r
+#define MASK_C_LI 0xe003\r
+#define MATCH_C_LUI 0x6001\r
+#define MASK_C_LUI 0xe003\r
+#define MATCH_C_SRLI 0x8001\r
+#define MASK_C_SRLI 0xec03\r
+#define MATCH_C_SRAI 0x8401\r
+#define MASK_C_SRAI 0xec03\r
+#define MATCH_C_ANDI 0x8801\r
+#define MASK_C_ANDI 0xec03\r
+#define MATCH_C_SUB 0x8c01\r
+#define MASK_C_SUB 0xfc63\r
+#define MATCH_C_XOR 0x8c21\r
+#define MASK_C_XOR 0xfc63\r
+#define MATCH_C_OR 0x8c41\r
+#define MASK_C_OR 0xfc63\r
+#define MATCH_C_AND 0x8c61\r
+#define MASK_C_AND 0xfc63\r
+#define MATCH_C_SUBW 0x9c01\r
+#define MASK_C_SUBW 0xfc63\r
+#define MATCH_C_ADDW 0x9c21\r
+#define MASK_C_ADDW 0xfc63\r
+#define MATCH_C_J 0xa001\r
+#define MASK_C_J 0xe003\r
+#define MATCH_C_BEQZ 0xc001\r
+#define MASK_C_BEQZ 0xe003\r
+#define MATCH_C_BNEZ 0xe001\r
+#define MASK_C_BNEZ 0xe003\r
+#define MATCH_C_SLLI 0x2\r
+#define MASK_C_SLLI 0xe003\r
+#define MATCH_C_FLDSP 0x2002\r
+#define MASK_C_FLDSP 0xe003\r
+#define MATCH_C_LWSP 0x4002\r
+#define MASK_C_LWSP 0xe003\r
+#define MATCH_C_FLWSP 0x6002\r
+#define MASK_C_FLWSP 0xe003\r
+#define MATCH_C_MV 0x8002\r
+#define MASK_C_MV 0xf003\r
+#define MATCH_C_ADD 0x9002\r
+#define MASK_C_ADD 0xf003\r
+#define MATCH_C_FSDSP 0xa002\r
+#define MASK_C_FSDSP 0xe003\r
+#define MATCH_C_SWSP 0xc002\r
+#define MASK_C_SWSP 0xe003\r
+#define MATCH_C_FSWSP 0xe002\r
+#define MASK_C_FSWSP 0xe003\r
+#define MATCH_CUSTOM0 0xb\r
+#define MASK_CUSTOM0 0x707f\r
+#define MATCH_CUSTOM0_RS1 0x200b\r
+#define MASK_CUSTOM0_RS1 0x707f\r
+#define MATCH_CUSTOM0_RS1_RS2 0x300b\r
+#define MASK_CUSTOM0_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM0_RD 0x400b\r
+#define MASK_CUSTOM0_RD 0x707f\r
+#define MATCH_CUSTOM0_RD_RS1 0x600b\r
+#define MASK_CUSTOM0_RD_RS1 0x707f\r
+#define MATCH_CUSTOM0_RD_RS1_RS2 0x700b\r
+#define MASK_CUSTOM0_RD_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM1 0x2b\r
+#define MASK_CUSTOM1 0x707f\r
+#define MATCH_CUSTOM1_RS1 0x202b\r
+#define MASK_CUSTOM1_RS1 0x707f\r
+#define MATCH_CUSTOM1_RS1_RS2 0x302b\r
+#define MASK_CUSTOM1_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM1_RD 0x402b\r
+#define MASK_CUSTOM1_RD 0x707f\r
+#define MATCH_CUSTOM1_RD_RS1 0x602b\r
+#define MASK_CUSTOM1_RD_RS1 0x707f\r
+#define MATCH_CUSTOM1_RD_RS1_RS2 0x702b\r
+#define MASK_CUSTOM1_RD_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM2 0x5b\r
+#define MASK_CUSTOM2 0x707f\r
+#define MATCH_CUSTOM2_RS1 0x205b\r
+#define MASK_CUSTOM2_RS1 0x707f\r
+#define MATCH_CUSTOM2_RS1_RS2 0x305b\r
+#define MASK_CUSTOM2_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM2_RD 0x405b\r
+#define MASK_CUSTOM2_RD 0x707f\r
+#define MATCH_CUSTOM2_RD_RS1 0x605b\r
+#define MASK_CUSTOM2_RD_RS1 0x707f\r
+#define MATCH_CUSTOM2_RD_RS1_RS2 0x705b\r
+#define MASK_CUSTOM2_RD_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM3 0x7b\r
+#define MASK_CUSTOM3 0x707f\r
+#define MATCH_CUSTOM3_RS1 0x207b\r
+#define MASK_CUSTOM3_RS1 0x707f\r
+#define MATCH_CUSTOM3_RS1_RS2 0x307b\r
+#define MASK_CUSTOM3_RS1_RS2 0x707f\r
+#define MATCH_CUSTOM3_RD 0x407b\r
+#define MASK_CUSTOM3_RD 0x707f\r
+#define MATCH_CUSTOM3_RD_RS1 0x607b\r
+#define MASK_CUSTOM3_RD_RS1 0x707f\r
+#define MATCH_CUSTOM3_RD_RS1_RS2 0x707b\r
+#define MASK_CUSTOM3_RD_RS1_RS2 0x707f\r
+#define CSR_FFLAGS 0x1\r
+#define CSR_FRM 0x2\r
+#define CSR_FCSR 0x3\r
+#define CSR_CYCLE 0xc00\r
+#define CSR_TIME 0xc01\r
+#define CSR_INSTRET 0xc02\r
+#define CSR_HPMCOUNTER3 0xc03\r
+#define CSR_HPMCOUNTER4 0xc04\r
+#define CSR_HPMCOUNTER5 0xc05\r
+#define CSR_HPMCOUNTER6 0xc06\r
+#define CSR_HPMCOUNTER7 0xc07\r
+#define CSR_HPMCOUNTER8 0xc08\r
+#define CSR_HPMCOUNTER9 0xc09\r
+#define CSR_HPMCOUNTER10 0xc0a\r
+#define CSR_HPMCOUNTER11 0xc0b\r
+#define CSR_HPMCOUNTER12 0xc0c\r
+#define CSR_HPMCOUNTER13 0xc0d\r
+#define CSR_HPMCOUNTER14 0xc0e\r
+#define CSR_HPMCOUNTER15 0xc0f\r
+#define CSR_HPMCOUNTER16 0xc10\r
+#define CSR_HPMCOUNTER17 0xc11\r
+#define CSR_HPMCOUNTER18 0xc12\r
+#define CSR_HPMCOUNTER19 0xc13\r
+#define CSR_HPMCOUNTER20 0xc14\r
+#define CSR_HPMCOUNTER21 0xc15\r
+#define CSR_HPMCOUNTER22 0xc16\r
+#define CSR_HPMCOUNTER23 0xc17\r
+#define CSR_HPMCOUNTER24 0xc18\r
+#define CSR_HPMCOUNTER25 0xc19\r
+#define CSR_HPMCOUNTER26 0xc1a\r
+#define CSR_HPMCOUNTER27 0xc1b\r
+#define CSR_HPMCOUNTER28 0xc1c\r
+#define CSR_HPMCOUNTER29 0xc1d\r
+#define CSR_HPMCOUNTER30 0xc1e\r
+#define CSR_HPMCOUNTER31 0xc1f\r
+#define CSR_SSTATUS 0x100\r
+#define CSR_SIE 0x104\r
+#define CSR_STVEC 0x105\r
+#define CSR_SSCRATCH 0x140\r
+#define CSR_SEPC 0x141\r
+#define CSR_SCAUSE 0x142\r
+#define CSR_SBADADDR 0x143\r
+#define CSR_SIP 0x144\r
+#define CSR_SPTBR 0x180\r
+#define CSR_MSTATUS 0x300\r
+#define CSR_MISA 0x301\r
+#define CSR_MEDELEG 0x302\r
+#define CSR_MIDELEG 0x303\r
+#define CSR_MIE 0x304\r
+#define CSR_MTVEC 0x305\r
+#define CSR_MSCRATCH 0x340\r
+#define CSR_MEPC 0x341\r
+#define CSR_MCAUSE 0x342\r
+#define CSR_MBADADDR 0x343\r
+#define CSR_MIP 0x344\r
+#define CSR_TSELECT 0x7a0\r
+#define CSR_TDATA1 0x7a1\r
+#define CSR_TDATA2 0x7a2\r
+#define CSR_TDATA3 0x7a3\r
+#define CSR_DCSR 0x7b0\r
+#define CSR_DPC 0x7b1\r
+#define CSR_DSCRATCH 0x7b2\r
+#define CSR_MCYCLE 0xb00\r
+#define CSR_MINSTRET 0xb02\r
+#define CSR_MHPMCOUNTER3 0xb03\r
+#define CSR_MHPMCOUNTER4 0xb04\r
+#define CSR_MHPMCOUNTER5 0xb05\r
+#define CSR_MHPMCOUNTER6 0xb06\r
+#define CSR_MHPMCOUNTER7 0xb07\r
+#define CSR_MHPMCOUNTER8 0xb08\r
+#define CSR_MHPMCOUNTER9 0xb09\r
+#define CSR_MHPMCOUNTER10 0xb0a\r
+#define CSR_MHPMCOUNTER11 0xb0b\r
+#define CSR_MHPMCOUNTER12 0xb0c\r
+#define CSR_MHPMCOUNTER13 0xb0d\r
+#define CSR_MHPMCOUNTER14 0xb0e\r
+#define CSR_MHPMCOUNTER15 0xb0f\r
+#define CSR_MHPMCOUNTER16 0xb10\r
+#define CSR_MHPMCOUNTER17 0xb11\r
+#define CSR_MHPMCOUNTER18 0xb12\r
+#define CSR_MHPMCOUNTER19 0xb13\r
+#define CSR_MHPMCOUNTER20 0xb14\r
+#define CSR_MHPMCOUNTER21 0xb15\r
+#define CSR_MHPMCOUNTER22 0xb16\r
+#define CSR_MHPMCOUNTER23 0xb17\r
+#define CSR_MHPMCOUNTER24 0xb18\r
+#define CSR_MHPMCOUNTER25 0xb19\r
+#define CSR_MHPMCOUNTER26 0xb1a\r
+#define CSR_MHPMCOUNTER27 0xb1b\r
+#define CSR_MHPMCOUNTER28 0xb1c\r
+#define CSR_MHPMCOUNTER29 0xb1d\r
+#define CSR_MHPMCOUNTER30 0xb1e\r
+#define CSR_MHPMCOUNTER31 0xb1f\r
+#define CSR_MUCOUNTEREN 0x320\r
+#define CSR_MSCOUNTEREN 0x321\r
+#define CSR_MHPMEVENT3 0x323\r
+#define CSR_MHPMEVENT4 0x324\r
+#define CSR_MHPMEVENT5 0x325\r
+#define CSR_MHPMEVENT6 0x326\r
+#define CSR_MHPMEVENT7 0x327\r
+#define CSR_MHPMEVENT8 0x328\r
+#define CSR_MHPMEVENT9 0x329\r
+#define CSR_MHPMEVENT10 0x32a\r
+#define CSR_MHPMEVENT11 0x32b\r
+#define CSR_MHPMEVENT12 0x32c\r
+#define CSR_MHPMEVENT13 0x32d\r
+#define CSR_MHPMEVENT14 0x32e\r
+#define CSR_MHPMEVENT15 0x32f\r
+#define CSR_MHPMEVENT16 0x330\r
+#define CSR_MHPMEVENT17 0x331\r
+#define CSR_MHPMEVENT18 0x332\r
+#define CSR_MHPMEVENT19 0x333\r
+#define CSR_MHPMEVENT20 0x334\r
+#define CSR_MHPMEVENT21 0x335\r
+#define CSR_MHPMEVENT22 0x336\r
+#define CSR_MHPMEVENT23 0x337\r
+#define CSR_MHPMEVENT24 0x338\r
+#define CSR_MHPMEVENT25 0x339\r
+#define CSR_MHPMEVENT26 0x33a\r
+#define CSR_MHPMEVENT27 0x33b\r
+#define CSR_MHPMEVENT28 0x33c\r
+#define CSR_MHPMEVENT29 0x33d\r
+#define CSR_MHPMEVENT30 0x33e\r
+#define CSR_MHPMEVENT31 0x33f\r
+#define CSR_MVENDORID 0xf11\r
+#define CSR_MARCHID 0xf12\r
+#define CSR_MIMPID 0xf13\r
+#define CSR_MHARTID 0xf14\r
+#define CSR_CYCLEH 0xc80\r
+#define CSR_TIMEH 0xc81\r
+#define CSR_INSTRETH 0xc82\r
+#define CSR_HPMCOUNTER3H 0xc83\r
+#define CSR_HPMCOUNTER4H 0xc84\r
+#define CSR_HPMCOUNTER5H 0xc85\r
+#define CSR_HPMCOUNTER6H 0xc86\r
+#define CSR_HPMCOUNTER7H 0xc87\r
+#define CSR_HPMCOUNTER8H 0xc88\r
+#define CSR_HPMCOUNTER9H 0xc89\r
+#define CSR_HPMCOUNTER10H 0xc8a\r
+#define CSR_HPMCOUNTER11H 0xc8b\r
+#define CSR_HPMCOUNTER12H 0xc8c\r
+#define CSR_HPMCOUNTER13H 0xc8d\r
+#define CSR_HPMCOUNTER14H 0xc8e\r
+#define CSR_HPMCOUNTER15H 0xc8f\r
+#define CSR_HPMCOUNTER16H 0xc90\r
+#define CSR_HPMCOUNTER17H 0xc91\r
+#define CSR_HPMCOUNTER18H 0xc92\r
+#define CSR_HPMCOUNTER19H 0xc93\r
+#define CSR_HPMCOUNTER20H 0xc94\r
+#define CSR_HPMCOUNTER21H 0xc95\r
+#define CSR_HPMCOUNTER22H 0xc96\r
+#define CSR_HPMCOUNTER23H 0xc97\r
+#define CSR_HPMCOUNTER24H 0xc98\r
+#define CSR_HPMCOUNTER25H 0xc99\r
+#define CSR_HPMCOUNTER26H 0xc9a\r
+#define CSR_HPMCOUNTER27H 0xc9b\r
+#define CSR_HPMCOUNTER28H 0xc9c\r
+#define CSR_HPMCOUNTER29H 0xc9d\r
+#define CSR_HPMCOUNTER30H 0xc9e\r
+#define CSR_HPMCOUNTER31H 0xc9f\r
+#define CSR_MCYCLEH 0xb80\r
+#define CSR_MINSTRETH 0xb82\r
+#define CSR_MHPMCOUNTER3H 0xb83\r
+#define CSR_MHPMCOUNTER4H 0xb84\r
+#define CSR_MHPMCOUNTER5H 0xb85\r
+#define CSR_MHPMCOUNTER6H 0xb86\r
+#define CSR_MHPMCOUNTER7H 0xb87\r
+#define CSR_MHPMCOUNTER8H 0xb88\r
+#define CSR_MHPMCOUNTER9H 0xb89\r
+#define CSR_MHPMCOUNTER10H 0xb8a\r
+#define CSR_MHPMCOUNTER11H 0xb8b\r
+#define CSR_MHPMCOUNTER12H 0xb8c\r
+#define CSR_MHPMCOUNTER13H 0xb8d\r
+#define CSR_MHPMCOUNTER14H 0xb8e\r
+#define CSR_MHPMCOUNTER15H 0xb8f\r
+#define CSR_MHPMCOUNTER16H 0xb90\r
+#define CSR_MHPMCOUNTER17H 0xb91\r
+#define CSR_MHPMCOUNTER18H 0xb92\r
+#define CSR_MHPMCOUNTER19H 0xb93\r
+#define CSR_MHPMCOUNTER20H 0xb94\r
+#define CSR_MHPMCOUNTER21H 0xb95\r
+#define CSR_MHPMCOUNTER22H 0xb96\r
+#define CSR_MHPMCOUNTER23H 0xb97\r
+#define CSR_MHPMCOUNTER24H 0xb98\r
+#define CSR_MHPMCOUNTER25H 0xb99\r
+#define CSR_MHPMCOUNTER26H 0xb9a\r
+#define CSR_MHPMCOUNTER27H 0xb9b\r
+#define CSR_MHPMCOUNTER28H 0xb9c\r
+#define CSR_MHPMCOUNTER29H 0xb9d\r
+#define CSR_MHPMCOUNTER30H 0xb9e\r
+#define CSR_MHPMCOUNTER31H 0xb9f\r
+#define CAUSE_MISALIGNED_FETCH 0x0\r
+#define CAUSE_FAULT_FETCH 0x1\r
+#define CAUSE_ILLEGAL_INSTRUCTION 0x2\r
+#define CAUSE_BREAKPOINT 0x3\r
+#define CAUSE_MISALIGNED_LOAD 0x4\r
+#define CAUSE_FAULT_LOAD 0x5\r
+#define CAUSE_MISALIGNED_STORE 0x6\r
+#define CAUSE_FAULT_STORE 0x7\r
+#define CAUSE_USER_ECALL 0x8\r
+#define CAUSE_SUPERVISOR_ECALL 0x9\r
+#define CAUSE_HYPERVISOR_ECALL 0xa\r
+#define CAUSE_MACHINE_ECALL 0xb\r
+#endif\r
+#ifdef DECLARE_INSN\r
+DECLARE_INSN(beq, MATCH_BEQ, MASK_BEQ)\r
+DECLARE_INSN(bne, MATCH_BNE, MASK_BNE)\r
+DECLARE_INSN(blt, MATCH_BLT, MASK_BLT)\r
+DECLARE_INSN(bge, MATCH_BGE, MASK_BGE)\r
+DECLARE_INSN(bltu, MATCH_BLTU, MASK_BLTU)\r
+DECLARE_INSN(bgeu, MATCH_BGEU, MASK_BGEU)\r
+DECLARE_INSN(jalr, MATCH_JALR, MASK_JALR)\r
+DECLARE_INSN(jal, MATCH_JAL, MASK_JAL)\r
+DECLARE_INSN(lui, MATCH_LUI, MASK_LUI)\r
+DECLARE_INSN(auipc, MATCH_AUIPC, MASK_AUIPC)\r
+DECLARE_INSN(addi, MATCH_ADDI, MASK_ADDI)\r
+DECLARE_INSN(slli, MATCH_SLLI, MASK_SLLI)\r
+DECLARE_INSN(slti, MATCH_SLTI, MASK_SLTI)\r
+DECLARE_INSN(sltiu, MATCH_SLTIU, MASK_SLTIU)\r
+DECLARE_INSN(xori, MATCH_XORI, MASK_XORI)\r
+DECLARE_INSN(srli, MATCH_SRLI, MASK_SRLI)\r
+DECLARE_INSN(srai, MATCH_SRAI, MASK_SRAI)\r
+DECLARE_INSN(ori, MATCH_ORI, MASK_ORI)\r
+DECLARE_INSN(andi, MATCH_ANDI, MASK_ANDI)\r
+DECLARE_INSN(add, MATCH_ADD, MASK_ADD)\r
+DECLARE_INSN(sub, MATCH_SUB, MASK_SUB)\r
+DECLARE_INSN(sll, MATCH_SLL, MASK_SLL)\r
+DECLARE_INSN(slt, MATCH_SLT, MASK_SLT)\r
+DECLARE_INSN(sltu, MATCH_SLTU, MASK_SLTU)\r
+DECLARE_INSN(xor, MATCH_XOR, MASK_XOR)\r
+DECLARE_INSN(srl, MATCH_SRL, MASK_SRL)\r
+DECLARE_INSN(sra, MATCH_SRA, MASK_SRA)\r
+DECLARE_INSN(or, MATCH_OR, MASK_OR)\r
+DECLARE_INSN(and, MATCH_AND, MASK_AND)\r
+DECLARE_INSN(addiw, MATCH_ADDIW, MASK_ADDIW)\r
+DECLARE_INSN(slliw, MATCH_SLLIW, MASK_SLLIW)\r
+DECLARE_INSN(srliw, MATCH_SRLIW, MASK_SRLIW)\r
+DECLARE_INSN(sraiw, MATCH_SRAIW, MASK_SRAIW)\r
+DECLARE_INSN(addw, MATCH_ADDW, MASK_ADDW)\r
+DECLARE_INSN(subw, MATCH_SUBW, MASK_SUBW)\r
+DECLARE_INSN(sllw, MATCH_SLLW, MASK_SLLW)\r
+DECLARE_INSN(srlw, MATCH_SRLW, MASK_SRLW)\r
+DECLARE_INSN(sraw, MATCH_SRAW, MASK_SRAW)\r
+DECLARE_INSN(lb, MATCH_LB, MASK_LB)\r
+DECLARE_INSN(lh, MATCH_LH, MASK_LH)\r
+DECLARE_INSN(lw, MATCH_LW, MASK_LW)\r
+DECLARE_INSN(ld, MATCH_LD, MASK_LD)\r
+DECLARE_INSN(lbu, MATCH_LBU, MASK_LBU)\r
+DECLARE_INSN(lhu, MATCH_LHU, MASK_LHU)\r
+DECLARE_INSN(lwu, MATCH_LWU, MASK_LWU)\r
+DECLARE_INSN(sb, MATCH_SB, MASK_SB)\r
+DECLARE_INSN(sh, MATCH_SH, MASK_SH)\r
+DECLARE_INSN(sw, MATCH_SW, MASK_SW)\r
+DECLARE_INSN(sd, MATCH_SD, MASK_SD)\r
+DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE)\r
+DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I)\r
+DECLARE_INSN(mul, MATCH_MUL, MASK_MUL)\r
+DECLARE_INSN(mulh, MATCH_MULH, MASK_MULH)\r
+DECLARE_INSN(mulhsu, MATCH_MULHSU, MASK_MULHSU)\r
+DECLARE_INSN(mulhu, MATCH_MULHU, MASK_MULHU)\r
+DECLARE_INSN(div, MATCH_DIV, MASK_DIV)\r
+DECLARE_INSN(divu, MATCH_DIVU, MASK_DIVU)\r
+DECLARE_INSN(rem, MATCH_REM, MASK_REM)\r
+DECLARE_INSN(remu, MATCH_REMU, MASK_REMU)\r
+DECLARE_INSN(mulw, MATCH_MULW, MASK_MULW)\r
+DECLARE_INSN(divw, MATCH_DIVW, MASK_DIVW)\r
+DECLARE_INSN(divuw, MATCH_DIVUW, MASK_DIVUW)\r
+DECLARE_INSN(remw, MATCH_REMW, MASK_REMW)\r
+DECLARE_INSN(remuw, MATCH_REMUW, MASK_REMUW)\r
+DECLARE_INSN(amoadd_w, MATCH_AMOADD_W, MASK_AMOADD_W)\r
+DECLARE_INSN(amoxor_w, MATCH_AMOXOR_W, MASK_AMOXOR_W)\r
+DECLARE_INSN(amoor_w, MATCH_AMOOR_W, MASK_AMOOR_W)\r
+DECLARE_INSN(amoand_w, MATCH_AMOAND_W, MASK_AMOAND_W)\r
+DECLARE_INSN(amomin_w, MATCH_AMOMIN_W, MASK_AMOMIN_W)\r
+DECLARE_INSN(amomax_w, MATCH_AMOMAX_W, MASK_AMOMAX_W)\r
+DECLARE_INSN(amominu_w, MATCH_AMOMINU_W, MASK_AMOMINU_W)\r
+DECLARE_INSN(amomaxu_w, MATCH_AMOMAXU_W, MASK_AMOMAXU_W)\r
+DECLARE_INSN(amoswap_w, MATCH_AMOSWAP_W, MASK_AMOSWAP_W)\r
+DECLARE_INSN(lr_w, MATCH_LR_W, MASK_LR_W)\r
+DECLARE_INSN(sc_w, MATCH_SC_W, MASK_SC_W)\r
+DECLARE_INSN(amoadd_d, MATCH_AMOADD_D, MASK_AMOADD_D)\r
+DECLARE_INSN(amoxor_d, MATCH_AMOXOR_D, MASK_AMOXOR_D)\r
+DECLARE_INSN(amoor_d, MATCH_AMOOR_D, MASK_AMOOR_D)\r
+DECLARE_INSN(amoand_d, MATCH_AMOAND_D, MASK_AMOAND_D)\r
+DECLARE_INSN(amomin_d, MATCH_AMOMIN_D, MASK_AMOMIN_D)\r
+DECLARE_INSN(amomax_d, MATCH_AMOMAX_D, MASK_AMOMAX_D)\r
+DECLARE_INSN(amominu_d, MATCH_AMOMINU_D, MASK_AMOMINU_D)\r
+DECLARE_INSN(amomaxu_d, MATCH_AMOMAXU_D, MASK_AMOMAXU_D)\r
+DECLARE_INSN(amoswap_d, MATCH_AMOSWAP_D, MASK_AMOSWAP_D)\r
+DECLARE_INSN(lr_d, MATCH_LR_D, MASK_LR_D)\r
+DECLARE_INSN(sc_d, MATCH_SC_D, MASK_SC_D)\r
+DECLARE_INSN(ecall, MATCH_ECALL, MASK_ECALL)\r
+DECLARE_INSN(ebreak, MATCH_EBREAK, MASK_EBREAK)\r
+DECLARE_INSN(uret, MATCH_URET, MASK_URET)\r
+DECLARE_INSN(sret, MATCH_SRET, MASK_SRET)\r
+DECLARE_INSN(hret, MATCH_HRET, MASK_HRET)\r
+DECLARE_INSN(mret, MATCH_MRET, MASK_MRET)\r
+DECLARE_INSN(dret, MATCH_DRET, MASK_DRET)\r
+DECLARE_INSN(sfence_vm, MATCH_SFENCE_VM, MASK_SFENCE_VM)\r
+DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI)\r
+DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW)\r
+DECLARE_INSN(csrrs, MATCH_CSRRS, MASK_CSRRS)\r
+DECLARE_INSN(csrrc, MATCH_CSRRC, MASK_CSRRC)\r
+DECLARE_INSN(csrrwi, MATCH_CSRRWI, MASK_CSRRWI)\r
+DECLARE_INSN(csrrsi, MATCH_CSRRSI, MASK_CSRRSI)\r
+DECLARE_INSN(csrrci, MATCH_CSRRCI, MASK_CSRRCI)\r
+DECLARE_INSN(fadd_s, MATCH_FADD_S, MASK_FADD_S)\r
+DECLARE_INSN(fsub_s, MATCH_FSUB_S, MASK_FSUB_S)\r
+DECLARE_INSN(fmul_s, MATCH_FMUL_S, MASK_FMUL_S)\r
+DECLARE_INSN(fdiv_s, MATCH_FDIV_S, MASK_FDIV_S)\r
+DECLARE_INSN(fsgnj_s, MATCH_FSGNJ_S, MASK_FSGNJ_S)\r
+DECLARE_INSN(fsgnjn_s, MATCH_FSGNJN_S, MASK_FSGNJN_S)\r
+DECLARE_INSN(fsgnjx_s, MATCH_FSGNJX_S, MASK_FSGNJX_S)\r
+DECLARE_INSN(fmin_s, MATCH_FMIN_S, MASK_FMIN_S)\r
+DECLARE_INSN(fmax_s, MATCH_FMAX_S, MASK_FMAX_S)\r
+DECLARE_INSN(fsqrt_s, MATCH_FSQRT_S, MASK_FSQRT_S)\r
+DECLARE_INSN(fadd_d, MATCH_FADD_D, MASK_FADD_D)\r
+DECLARE_INSN(fsub_d, MATCH_FSUB_D, MASK_FSUB_D)\r
+DECLARE_INSN(fmul_d, MATCH_FMUL_D, MASK_FMUL_D)\r
+DECLARE_INSN(fdiv_d, MATCH_FDIV_D, MASK_FDIV_D)\r
+DECLARE_INSN(fsgnj_d, MATCH_FSGNJ_D, MASK_FSGNJ_D)\r
+DECLARE_INSN(fsgnjn_d, MATCH_FSGNJN_D, MASK_FSGNJN_D)\r
+DECLARE_INSN(fsgnjx_d, MATCH_FSGNJX_D, MASK_FSGNJX_D)\r
+DECLARE_INSN(fmin_d, MATCH_FMIN_D, MASK_FMIN_D)\r
+DECLARE_INSN(fmax_d, MATCH_FMAX_D, MASK_FMAX_D)\r
+DECLARE_INSN(fcvt_s_d, MATCH_FCVT_S_D, MASK_FCVT_S_D)\r
+DECLARE_INSN(fcvt_d_s, MATCH_FCVT_D_S, MASK_FCVT_D_S)\r
+DECLARE_INSN(fsqrt_d, MATCH_FSQRT_D, MASK_FSQRT_D)\r
+DECLARE_INSN(fle_s, MATCH_FLE_S, MASK_FLE_S)\r
+DECLARE_INSN(flt_s, MATCH_FLT_S, MASK_FLT_S)\r
+DECLARE_INSN(feq_s, MATCH_FEQ_S, MASK_FEQ_S)\r
+DECLARE_INSN(fle_d, MATCH_FLE_D, MASK_FLE_D)\r
+DECLARE_INSN(flt_d, MATCH_FLT_D, MASK_FLT_D)\r
+DECLARE_INSN(feq_d, MATCH_FEQ_D, MASK_FEQ_D)\r
+DECLARE_INSN(fcvt_w_s, MATCH_FCVT_W_S, MASK_FCVT_W_S)\r
+DECLARE_INSN(fcvt_wu_s, MATCH_FCVT_WU_S, MASK_FCVT_WU_S)\r
+DECLARE_INSN(fcvt_l_s, MATCH_FCVT_L_S, MASK_FCVT_L_S)\r
+DECLARE_INSN(fcvt_lu_s, MATCH_FCVT_LU_S, MASK_FCVT_LU_S)\r
+DECLARE_INSN(fmv_x_s, MATCH_FMV_X_S, MASK_FMV_X_S)\r
+DECLARE_INSN(fclass_s, MATCH_FCLASS_S, MASK_FCLASS_S)\r
+DECLARE_INSN(fcvt_w_d, MATCH_FCVT_W_D, MASK_FCVT_W_D)\r
+DECLARE_INSN(fcvt_wu_d, MATCH_FCVT_WU_D, MASK_FCVT_WU_D)\r
+DECLARE_INSN(fcvt_l_d, MATCH_FCVT_L_D, MASK_FCVT_L_D)\r
+DECLARE_INSN(fcvt_lu_d, MATCH_FCVT_LU_D, MASK_FCVT_LU_D)\r
+DECLARE_INSN(fmv_x_d, MATCH_FMV_X_D, MASK_FMV_X_D)\r
+DECLARE_INSN(fclass_d, MATCH_FCLASS_D, MASK_FCLASS_D)\r
+DECLARE_INSN(fcvt_s_w, MATCH_FCVT_S_W, MASK_FCVT_S_W)\r
+DECLARE_INSN(fcvt_s_wu, MATCH_FCVT_S_WU, MASK_FCVT_S_WU)\r
+DECLARE_INSN(fcvt_s_l, MATCH_FCVT_S_L, MASK_FCVT_S_L)\r
+DECLARE_INSN(fcvt_s_lu, MATCH_FCVT_S_LU, MASK_FCVT_S_LU)\r
+DECLARE_INSN(fmv_s_x, MATCH_FMV_S_X, MASK_FMV_S_X)\r
+DECLARE_INSN(fcvt_d_w, MATCH_FCVT_D_W, MASK_FCVT_D_W)\r
+DECLARE_INSN(fcvt_d_wu, MATCH_FCVT_D_WU, MASK_FCVT_D_WU)\r
+DECLARE_INSN(fcvt_d_l, MATCH_FCVT_D_L, MASK_FCVT_D_L)\r
+DECLARE_INSN(fcvt_d_lu, MATCH_FCVT_D_LU, MASK_FCVT_D_LU)\r
+DECLARE_INSN(fmv_d_x, MATCH_FMV_D_X, MASK_FMV_D_X)\r
+DECLARE_INSN(flw, MATCH_FLW, MASK_FLW)\r
+DECLARE_INSN(fld, MATCH_FLD, MASK_FLD)\r
+DECLARE_INSN(fsw, MATCH_FSW, MASK_FSW)\r
+DECLARE_INSN(fsd, MATCH_FSD, MASK_FSD)\r
+DECLARE_INSN(fmadd_s, MATCH_FMADD_S, MASK_FMADD_S)\r
+DECLARE_INSN(fmsub_s, MATCH_FMSUB_S, MASK_FMSUB_S)\r
+DECLARE_INSN(fnmsub_s, MATCH_FNMSUB_S, MASK_FNMSUB_S)\r
+DECLARE_INSN(fnmadd_s, MATCH_FNMADD_S, MASK_FNMADD_S)\r
+DECLARE_INSN(fmadd_d, MATCH_FMADD_D, MASK_FMADD_D)\r
+DECLARE_INSN(fmsub_d, MATCH_FMSUB_D, MASK_FMSUB_D)\r
+DECLARE_INSN(fnmsub_d, MATCH_FNMSUB_D, MASK_FNMSUB_D)\r
+DECLARE_INSN(fnmadd_d, MATCH_FNMADD_D, MASK_FNMADD_D)\r
+DECLARE_INSN(c_nop, MATCH_C_NOP, MASK_C_NOP)\r
+DECLARE_INSN(c_addi16sp, MATCH_C_ADDI16SP, MASK_C_ADDI16SP)\r
+DECLARE_INSN(c_jr, MATCH_C_JR, MASK_C_JR)\r
+DECLARE_INSN(c_jalr, MATCH_C_JALR, MASK_C_JALR)\r
+DECLARE_INSN(c_ebreak, MATCH_C_EBREAK, MASK_C_EBREAK)\r
+DECLARE_INSN(c_ld, MATCH_C_LD, MASK_C_LD)\r
+DECLARE_INSN(c_sd, MATCH_C_SD, MASK_C_SD)\r
+DECLARE_INSN(c_addiw, MATCH_C_ADDIW, MASK_C_ADDIW)\r
+DECLARE_INSN(c_ldsp, MATCH_C_LDSP, MASK_C_LDSP)\r
+DECLARE_INSN(c_sdsp, MATCH_C_SDSP, MASK_C_SDSP)\r
+DECLARE_INSN(c_addi4spn, MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN)\r
+DECLARE_INSN(c_fld, MATCH_C_FLD, MASK_C_FLD)\r
+DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW)\r
+DECLARE_INSN(c_flw, MATCH_C_FLW, MASK_C_FLW)\r
+DECLARE_INSN(c_fsd, MATCH_C_FSD, MASK_C_FSD)\r
+DECLARE_INSN(c_sw, MATCH_C_SW, MASK_C_SW)\r
+DECLARE_INSN(c_fsw, MATCH_C_FSW, MASK_C_FSW)\r
+DECLARE_INSN(c_addi, MATCH_C_ADDI, MASK_C_ADDI)\r
+DECLARE_INSN(c_jal, MATCH_C_JAL, MASK_C_JAL)\r
+DECLARE_INSN(c_li, MATCH_C_LI, MASK_C_LI)\r
+DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI)\r
+DECLARE_INSN(c_srli, MATCH_C_SRLI, MASK_C_SRLI)\r
+DECLARE_INSN(c_srai, MATCH_C_SRAI, MASK_C_SRAI)\r
+DECLARE_INSN(c_andi, MATCH_C_ANDI, MASK_C_ANDI)\r
+DECLARE_INSN(c_sub, MATCH_C_SUB, MASK_C_SUB)\r
+DECLARE_INSN(c_xor, MATCH_C_XOR, MASK_C_XOR)\r
+DECLARE_INSN(c_or, MATCH_C_OR, MASK_C_OR)\r
+DECLARE_INSN(c_and, MATCH_C_AND, MASK_C_AND)\r
+DECLARE_INSN(c_subw, MATCH_C_SUBW, MASK_C_SUBW)\r
+DECLARE_INSN(c_addw, MATCH_C_ADDW, MASK_C_ADDW)\r
+DECLARE_INSN(c_j, MATCH_C_J, MASK_C_J)\r
+DECLARE_INSN(c_beqz, MATCH_C_BEQZ, MASK_C_BEQZ)\r
+DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ)\r
+DECLARE_INSN(c_slli, MATCH_C_SLLI, MASK_C_SLLI)\r
+DECLARE_INSN(c_fldsp, MATCH_C_FLDSP, MASK_C_FLDSP)\r
+DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP)\r
+DECLARE_INSN(c_flwsp, MATCH_C_FLWSP, MASK_C_FLWSP)\r
+DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV)\r
+DECLARE_INSN(c_add, MATCH_C_ADD, MASK_C_ADD)\r
+DECLARE_INSN(c_fsdsp, MATCH_C_FSDSP, MASK_C_FSDSP)\r
+DECLARE_INSN(c_swsp, MATCH_C_SWSP, MASK_C_SWSP)\r
+DECLARE_INSN(c_fswsp, MATCH_C_FSWSP, MASK_C_FSWSP)\r
+DECLARE_INSN(custom0, MATCH_CUSTOM0, MASK_CUSTOM0)\r
+DECLARE_INSN(custom0_rs1, MATCH_CUSTOM0_RS1, MASK_CUSTOM0_RS1)\r
+DECLARE_INSN(custom0_rs1_rs2, MATCH_CUSTOM0_RS1_RS2, MASK_CUSTOM0_RS1_RS2)\r
+DECLARE_INSN(custom0_rd, MATCH_CUSTOM0_RD, MASK_CUSTOM0_RD)\r
+DECLARE_INSN(custom0_rd_rs1, MATCH_CUSTOM0_RD_RS1, MASK_CUSTOM0_RD_RS1)\r
+DECLARE_INSN(custom0_rd_rs1_rs2, MATCH_CUSTOM0_RD_RS1_RS2, MASK_CUSTOM0_RD_RS1_RS2)\r
+DECLARE_INSN(custom1, MATCH_CUSTOM1, MASK_CUSTOM1)\r
+DECLARE_INSN(custom1_rs1, MATCH_CUSTOM1_RS1, MASK_CUSTOM1_RS1)\r
+DECLARE_INSN(custom1_rs1_rs2, MATCH_CUSTOM1_RS1_RS2, MASK_CUSTOM1_RS1_RS2)\r
+DECLARE_INSN(custom1_rd, MATCH_CUSTOM1_RD, MASK_CUSTOM1_RD)\r
+DECLARE_INSN(custom1_rd_rs1, MATCH_CUSTOM1_RD_RS1, MASK_CUSTOM1_RD_RS1)\r
+DECLARE_INSN(custom1_rd_rs1_rs2, MATCH_CUSTOM1_RD_RS1_RS2, MASK_CUSTOM1_RD_RS1_RS2)\r
+DECLARE_INSN(custom2, MATCH_CUSTOM2, MASK_CUSTOM2)\r
+DECLARE_INSN(custom2_rs1, MATCH_CUSTOM2_RS1, MASK_CUSTOM2_RS1)\r
+DECLARE_INSN(custom2_rs1_rs2, MATCH_CUSTOM2_RS1_RS2, MASK_CUSTOM2_RS1_RS2)\r
+DECLARE_INSN(custom2_rd, MATCH_CUSTOM2_RD, MASK_CUSTOM2_RD)\r
+DECLARE_INSN(custom2_rd_rs1, MATCH_CUSTOM2_RD_RS1, MASK_CUSTOM2_RD_RS1)\r
+DECLARE_INSN(custom2_rd_rs1_rs2, MATCH_CUSTOM2_RD_RS1_RS2, MASK_CUSTOM2_RD_RS1_RS2)\r
+DECLARE_INSN(custom3, MATCH_CUSTOM3, MASK_CUSTOM3)\r
+DECLARE_INSN(custom3_rs1, MATCH_CUSTOM3_RS1, MASK_CUSTOM3_RS1)\r
+DECLARE_INSN(custom3_rs1_rs2, MATCH_CUSTOM3_RS1_RS2, MASK_CUSTOM3_RS1_RS2)\r
+DECLARE_INSN(custom3_rd, MATCH_CUSTOM3_RD, MASK_CUSTOM3_RD)\r
+DECLARE_INSN(custom3_rd_rs1, MATCH_CUSTOM3_RD_RS1, MASK_CUSTOM3_RD_RS1)\r
+DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2)\r
+#endif\r
+#ifdef DECLARE_CSR\r
+DECLARE_CSR(fflags, CSR_FFLAGS)\r
+DECLARE_CSR(frm, CSR_FRM)\r
+DECLARE_CSR(fcsr, CSR_FCSR)\r
+DECLARE_CSR(cycle, CSR_CYCLE)\r
+DECLARE_CSR(time, CSR_TIME)\r
+DECLARE_CSR(instret, CSR_INSTRET)\r
+DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3)\r
+DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4)\r
+DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5)\r
+DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6)\r
+DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7)\r
+DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8)\r
+DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9)\r
+DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10)\r
+DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11)\r
+DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12)\r
+DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13)\r
+DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14)\r
+DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15)\r
+DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16)\r
+DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17)\r
+DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18)\r
+DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19)\r
+DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20)\r
+DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21)\r
+DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22)\r
+DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23)\r
+DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24)\r
+DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25)\r
+DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26)\r
+DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27)\r
+DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28)\r
+DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29)\r
+DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30)\r
+DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31)\r
+DECLARE_CSR(sstatus, CSR_SSTATUS)\r
+DECLARE_CSR(sie, CSR_SIE)\r
+DECLARE_CSR(stvec, CSR_STVEC)\r
+DECLARE_CSR(sscratch, CSR_SSCRATCH)\r
+DECLARE_CSR(sepc, CSR_SEPC)\r
+DECLARE_CSR(scause, CSR_SCAUSE)\r
+DECLARE_CSR(sbadaddr, CSR_SBADADDR)\r
+DECLARE_CSR(sip, CSR_SIP)\r
+DECLARE_CSR(sptbr, CSR_SPTBR)\r
+DECLARE_CSR(mstatus, CSR_MSTATUS)\r
+DECLARE_CSR(misa, CSR_MISA)\r
+DECLARE_CSR(medeleg, CSR_MEDELEG)\r
+DECLARE_CSR(mideleg, CSR_MIDELEG)\r
+DECLARE_CSR(mie, CSR_MIE)\r
+DECLARE_CSR(mtvec, CSR_MTVEC)\r
+DECLARE_CSR(mscratch, CSR_MSCRATCH)\r
+DECLARE_CSR(mepc, CSR_MEPC)\r
+DECLARE_CSR(mcause, CSR_MCAUSE)\r
+DECLARE_CSR(mbadaddr, CSR_MBADADDR)\r
+DECLARE_CSR(mip, CSR_MIP)\r
+DECLARE_CSR(tselect, CSR_TSELECT)\r
+DECLARE_CSR(tdata1, CSR_TDATA1)\r
+DECLARE_CSR(tdata2, CSR_TDATA2)\r
+DECLARE_CSR(tdata3, CSR_TDATA3)\r
+DECLARE_CSR(dcsr, CSR_DCSR)\r
+DECLARE_CSR(dpc, CSR_DPC)\r
+DECLARE_CSR(dscratch, CSR_DSCRATCH)\r
+DECLARE_CSR(mcycle, CSR_MCYCLE)\r
+DECLARE_CSR(minstret, CSR_MINSTRET)\r
+DECLARE_CSR(mhpmcounter3, CSR_MHPMCOUNTER3)\r
+DECLARE_CSR(mhpmcounter4, CSR_MHPMCOUNTER4)\r
+DECLARE_CSR(mhpmcounter5, CSR_MHPMCOUNTER5)\r
+DECLARE_CSR(mhpmcounter6, CSR_MHPMCOUNTER6)\r
+DECLARE_CSR(mhpmcounter7, CSR_MHPMCOUNTER7)\r
+DECLARE_CSR(mhpmcounter8, CSR_MHPMCOUNTER8)\r
+DECLARE_CSR(mhpmcounter9, CSR_MHPMCOUNTER9)\r
+DECLARE_CSR(mhpmcounter10, CSR_MHPMCOUNTER10)\r
+DECLARE_CSR(mhpmcounter11, CSR_MHPMCOUNTER11)\r
+DECLARE_CSR(mhpmcounter12, CSR_MHPMCOUNTER12)\r
+DECLARE_CSR(mhpmcounter13, CSR_MHPMCOUNTER13)\r
+DECLARE_CSR(mhpmcounter14, CSR_MHPMCOUNTER14)\r
+DECLARE_CSR(mhpmcounter15, CSR_MHPMCOUNTER15)\r
+DECLARE_CSR(mhpmcounter16, CSR_MHPMCOUNTER16)\r
+DECLARE_CSR(mhpmcounter17, CSR_MHPMCOUNTER17)\r
+DECLARE_CSR(mhpmcounter18, CSR_MHPMCOUNTER18)\r
+DECLARE_CSR(mhpmcounter19, CSR_MHPMCOUNTER19)\r
+DECLARE_CSR(mhpmcounter20, CSR_MHPMCOUNTER20)\r
+DECLARE_CSR(mhpmcounter21, CSR_MHPMCOUNTER21)\r
+DECLARE_CSR(mhpmcounter22, CSR_MHPMCOUNTER22)\r
+DECLARE_CSR(mhpmcounter23, CSR_MHPMCOUNTER23)\r
+DECLARE_CSR(mhpmcounter24, CSR_MHPMCOUNTER24)\r
+DECLARE_CSR(mhpmcounter25, CSR_MHPMCOUNTER25)\r
+DECLARE_CSR(mhpmcounter26, CSR_MHPMCOUNTER26)\r
+DECLARE_CSR(mhpmcounter27, CSR_MHPMCOUNTER27)\r
+DECLARE_CSR(mhpmcounter28, CSR_MHPMCOUNTER28)\r
+DECLARE_CSR(mhpmcounter29, CSR_MHPMCOUNTER29)\r
+DECLARE_CSR(mhpmcounter30, CSR_MHPMCOUNTER30)\r
+DECLARE_CSR(mhpmcounter31, CSR_MHPMCOUNTER31)\r
+DECLARE_CSR(mucounteren, CSR_MUCOUNTEREN)\r
+DECLARE_CSR(mscounteren, CSR_MSCOUNTEREN)\r
+DECLARE_CSR(mhpmevent3, CSR_MHPMEVENT3)\r
+DECLARE_CSR(mhpmevent4, CSR_MHPMEVENT4)\r
+DECLARE_CSR(mhpmevent5, CSR_MHPMEVENT5)\r
+DECLARE_CSR(mhpmevent6, CSR_MHPMEVENT6)\r
+DECLARE_CSR(mhpmevent7, CSR_MHPMEVENT7)\r
+DECLARE_CSR(mhpmevent8, CSR_MHPMEVENT8)\r
+DECLARE_CSR(mhpmevent9, CSR_MHPMEVENT9)\r
+DECLARE_CSR(mhpmevent10, CSR_MHPMEVENT10)\r
+DECLARE_CSR(mhpmevent11, CSR_MHPMEVENT11)\r
+DECLARE_CSR(mhpmevent12, CSR_MHPMEVENT12)\r
+DECLARE_CSR(mhpmevent13, CSR_MHPMEVENT13)\r
+DECLARE_CSR(mhpmevent14, CSR_MHPMEVENT14)\r
+DECLARE_CSR(mhpmevent15, CSR_MHPMEVENT15)\r
+DECLARE_CSR(mhpmevent16, CSR_MHPMEVENT16)\r
+DECLARE_CSR(mhpmevent17, CSR_MHPMEVENT17)\r
+DECLARE_CSR(mhpmevent18, CSR_MHPMEVENT18)\r
+DECLARE_CSR(mhpmevent19, CSR_MHPMEVENT19)\r
+DECLARE_CSR(mhpmevent20, CSR_MHPMEVENT20)\r
+DECLARE_CSR(mhpmevent21, CSR_MHPMEVENT21)\r
+DECLARE_CSR(mhpmevent22, CSR_MHPMEVENT22)\r
+DECLARE_CSR(mhpmevent23, CSR_MHPMEVENT23)\r
+DECLARE_CSR(mhpmevent24, CSR_MHPMEVENT24)\r
+DECLARE_CSR(mhpmevent25, CSR_MHPMEVENT25)\r
+DECLARE_CSR(mhpmevent26, CSR_MHPMEVENT26)\r
+DECLARE_CSR(mhpmevent27, CSR_MHPMEVENT27)\r
+DECLARE_CSR(mhpmevent28, CSR_MHPMEVENT28)\r
+DECLARE_CSR(mhpmevent29, CSR_MHPMEVENT29)\r
+DECLARE_CSR(mhpmevent30, CSR_MHPMEVENT30)\r
+DECLARE_CSR(mhpmevent31, CSR_MHPMEVENT31)\r
+DECLARE_CSR(mvendorid, CSR_MVENDORID)\r
+DECLARE_CSR(marchid, CSR_MARCHID)\r
+DECLARE_CSR(mimpid, CSR_MIMPID)\r
+DECLARE_CSR(mhartid, CSR_MHARTID)\r
+DECLARE_CSR(cycleh, CSR_CYCLEH)\r
+DECLARE_CSR(timeh, CSR_TIMEH)\r
+DECLARE_CSR(instreth, CSR_INSTRETH)\r
+DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H)\r
+DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H)\r
+DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H)\r
+DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H)\r
+DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H)\r
+DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H)\r
+DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H)\r
+DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H)\r
+DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H)\r
+DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H)\r
+DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H)\r
+DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H)\r
+DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H)\r
+DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H)\r
+DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H)\r
+DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H)\r
+DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H)\r
+DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H)\r
+DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H)\r
+DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H)\r
+DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H)\r
+DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H)\r
+DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H)\r
+DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H)\r
+DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H)\r
+DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H)\r
+DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H)\r
+DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H)\r
+DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H)\r
+DECLARE_CSR(mcycleh, CSR_MCYCLEH)\r
+DECLARE_CSR(minstreth, CSR_MINSTRETH)\r
+DECLARE_CSR(mhpmcounter3h, CSR_MHPMCOUNTER3H)\r
+DECLARE_CSR(mhpmcounter4h, CSR_MHPMCOUNTER4H)\r
+DECLARE_CSR(mhpmcounter5h, CSR_MHPMCOUNTER5H)\r
+DECLARE_CSR(mhpmcounter6h, CSR_MHPMCOUNTER6H)\r
+DECLARE_CSR(mhpmcounter7h, CSR_MHPMCOUNTER7H)\r
+DECLARE_CSR(mhpmcounter8h, CSR_MHPMCOUNTER8H)\r
+DECLARE_CSR(mhpmcounter9h, CSR_MHPMCOUNTER9H)\r
+DECLARE_CSR(mhpmcounter10h, CSR_MHPMCOUNTER10H)\r
+DECLARE_CSR(mhpmcounter11h, CSR_MHPMCOUNTER11H)\r
+DECLARE_CSR(mhpmcounter12h, CSR_MHPMCOUNTER12H)\r
+DECLARE_CSR(mhpmcounter13h, CSR_MHPMCOUNTER13H)\r
+DECLARE_CSR(mhpmcounter14h, CSR_MHPMCOUNTER14H)\r
+DECLARE_CSR(mhpmcounter15h, CSR_MHPMCOUNTER15H)\r
+DECLARE_CSR(mhpmcounter16h, CSR_MHPMCOUNTER16H)\r
+DECLARE_CSR(mhpmcounter17h, CSR_MHPMCOUNTER17H)\r
+DECLARE_CSR(mhpmcounter18h, CSR_MHPMCOUNTER18H)\r
+DECLARE_CSR(mhpmcounter19h, CSR_MHPMCOUNTER19H)\r
+DECLARE_CSR(mhpmcounter20h, CSR_MHPMCOUNTER20H)\r
+DECLARE_CSR(mhpmcounter21h, CSR_MHPMCOUNTER21H)\r
+DECLARE_CSR(mhpmcounter22h, CSR_MHPMCOUNTER22H)\r
+DECLARE_CSR(mhpmcounter23h, CSR_MHPMCOUNTER23H)\r
+DECLARE_CSR(mhpmcounter24h, CSR_MHPMCOUNTER24H)\r
+DECLARE_CSR(mhpmcounter25h, CSR_MHPMCOUNTER25H)\r
+DECLARE_CSR(mhpmcounter26h, CSR_MHPMCOUNTER26H)\r
+DECLARE_CSR(mhpmcounter27h, CSR_MHPMCOUNTER27H)\r
+DECLARE_CSR(mhpmcounter28h, CSR_MHPMCOUNTER28H)\r
+DECLARE_CSR(mhpmcounter29h, CSR_MHPMCOUNTER29H)\r
+DECLARE_CSR(mhpmcounter30h, CSR_MHPMCOUNTER30H)\r
+DECLARE_CSR(mhpmcounter31h, CSR_MHPMCOUNTER31H)\r
+#endif\r
+#ifdef DECLARE_CAUSE\r
+DECLARE_CAUSE("misaligned fetch", CAUSE_MISALIGNED_FETCH)\r
+DECLARE_CAUSE("fault fetch", CAUSE_FAULT_FETCH)\r
+DECLARE_CAUSE("illegal instruction", CAUSE_ILLEGAL_INSTRUCTION)\r
+DECLARE_CAUSE("breakpoint", CAUSE_BREAKPOINT)\r
+DECLARE_CAUSE("misaligned load", CAUSE_MISALIGNED_LOAD)\r
+DECLARE_CAUSE("fault load", CAUSE_FAULT_LOAD)\r
+DECLARE_CAUSE("misaligned store", CAUSE_MISALIGNED_STORE)\r
+DECLARE_CAUSE("fault store", CAUSE_FAULT_STORE)\r
+DECLARE_CAUSE("user_ecall", CAUSE_USER_ECALL)\r
+DECLARE_CAUSE("supervisor_ecall", CAUSE_SUPERVISOR_ECALL)\r
+DECLARE_CAUSE("hypervisor_ecall", CAUSE_HYPERVISOR_ECALL)\r
+DECLARE_CAUSE("machine_ecall", CAUSE_MACHINE_ECALL)\r
+#endif\r
--- /dev/null
+// See LICENSE for license details\r
+\r
+#ifndef ENTRY_S\r
+#define ENTRY_S\r
+\r
+#include "encoding.h"\r
+#include "sifive/bits.h"\r
+\r
+ .section .text.entry \r
+ .align 2\r
+ .weak trap_entry\r
+ .global trap_entry\r
+trap_entry:\r
+ addi sp, sp, -32*REGBYTES\r
+\r
+ STORE x1, 1*REGBYTES(sp)\r
+ STORE x2, 2*REGBYTES(sp)\r
+ STORE x3, 3*REGBYTES(sp)\r
+ STORE x4, 4*REGBYTES(sp)\r
+ STORE x5, 5*REGBYTES(sp)\r
+ STORE x6, 6*REGBYTES(sp)\r
+ STORE x7, 7*REGBYTES(sp)\r
+ STORE x8, 8*REGBYTES(sp)\r
+ STORE x9, 9*REGBYTES(sp)\r
+ STORE x10, 10*REGBYTES(sp)\r
+ STORE x11, 11*REGBYTES(sp)\r
+ STORE x12, 12*REGBYTES(sp)\r
+ STORE x13, 13*REGBYTES(sp)\r
+ STORE x14, 14*REGBYTES(sp)\r
+ STORE x15, 15*REGBYTES(sp)\r
+ STORE x16, 16*REGBYTES(sp)\r
+ STORE x17, 17*REGBYTES(sp)\r
+ STORE x18, 18*REGBYTES(sp)\r
+ STORE x19, 19*REGBYTES(sp)\r
+ STORE x20, 20*REGBYTES(sp)\r
+ STORE x21, 21*REGBYTES(sp)\r
+ STORE x22, 22*REGBYTES(sp)\r
+ STORE x23, 23*REGBYTES(sp)\r
+ STORE x24, 24*REGBYTES(sp)\r
+ STORE x25, 25*REGBYTES(sp)\r
+ STORE x26, 26*REGBYTES(sp)\r
+ STORE x27, 27*REGBYTES(sp)\r
+ STORE x28, 28*REGBYTES(sp)\r
+ STORE x29, 29*REGBYTES(sp)\r
+ STORE x30, 30*REGBYTES(sp)\r
+ STORE x31, 31*REGBYTES(sp)\r
+\r
+ csrr a0, mcause\r
+ csrr a1, mepc\r
+ mv a2, sp\r
+ call handle_trap\r
+ csrw mepc, a0\r
+\r
+ # Remain in M-mode after mret\r
+ li t0, MSTATUS_MPP\r
+ csrs mstatus, t0\r
+\r
+ LOAD x1, 1*REGBYTES(sp)\r
+ LOAD x2, 2*REGBYTES(sp)\r
+ LOAD x3, 3*REGBYTES(sp)\r
+ LOAD x4, 4*REGBYTES(sp)\r
+ LOAD x5, 5*REGBYTES(sp)\r
+ LOAD x6, 6*REGBYTES(sp)\r
+ LOAD x7, 7*REGBYTES(sp)\r
+ LOAD x8, 8*REGBYTES(sp)\r
+ LOAD x9, 9*REGBYTES(sp)\r
+ LOAD x10, 10*REGBYTES(sp)\r
+ LOAD x11, 11*REGBYTES(sp)\r
+ LOAD x12, 12*REGBYTES(sp)\r
+ LOAD x13, 13*REGBYTES(sp)\r
+ LOAD x14, 14*REGBYTES(sp)\r
+ LOAD x15, 15*REGBYTES(sp)\r
+ LOAD x16, 16*REGBYTES(sp)\r
+ LOAD x17, 17*REGBYTES(sp)\r
+ LOAD x18, 18*REGBYTES(sp)\r
+ LOAD x19, 19*REGBYTES(sp)\r
+ LOAD x20, 20*REGBYTES(sp)\r
+ LOAD x21, 21*REGBYTES(sp)\r
+ LOAD x22, 22*REGBYTES(sp)\r
+ LOAD x23, 23*REGBYTES(sp)\r
+ LOAD x24, 24*REGBYTES(sp)\r
+ LOAD x25, 25*REGBYTES(sp)\r
+ LOAD x26, 26*REGBYTES(sp)\r
+ LOAD x27, 27*REGBYTES(sp)\r
+ LOAD x28, 28*REGBYTES(sp)\r
+ LOAD x29, 29*REGBYTES(sp)\r
+ LOAD x30, 30*REGBYTES(sp)\r
+ LOAD x31, 31*REGBYTES(sp)\r
+\r
+ addi sp, sp, 32*REGBYTES\r
+ mret\r
+\r
+.weak handle_trap\r
+handle_trap:\r
+1:\r
+ j 1b\r
+ \r
+#endif\r
--- /dev/null
+OUTPUT_ARCH( "riscv" )\r
+\r
+ENTRY( _start )\r
+\r
+MEMORY\r
+{\r
+ flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M\r
+ ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K\r
+}\r
+\r
+PHDRS\r
+{\r
+ flash PT_LOAD;\r
+ ram_init PT_LOAD;\r
+ ram PT_NULL;\r
+}\r
+\r
+SECTIONS\r
+{\r
+ __stack_size = DEFINED(__stack_size) ? __stack_size : 1K;\r
+\r
+ .init :\r
+ {\r
+ KEEP (*(SORT_NONE(.init)))\r
+ } >flash AT>flash :flash\r
+\r
+ .text :\r
+ {\r
+ *(.text.unlikely .text.unlikely.*)\r
+ *(.text.startup .text.startup.*)\r
+ *(.text .text.*)\r
+ *(.gnu.linkonce.t.*)\r
+ } >flash AT>flash :flash\r
+\r
+ .fini :\r
+ {\r
+ KEEP (*(SORT_NONE(.fini)))\r
+ } >flash AT>flash :flash\r
+\r
+ PROVIDE (__etext = .);\r
+ PROVIDE (_etext = .);\r
+ PROVIDE (etext = .);\r
+\r
+ . = ALIGN(4);\r
+\r
+ .preinit_array :\r
+ {\r
+ PROVIDE_HIDDEN (__preinit_array_start = .);\r
+ KEEP (*(.preinit_array))\r
+ PROVIDE_HIDDEN (__preinit_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .init_array :\r
+ {\r
+ PROVIDE_HIDDEN (__init_array_start = .);\r
+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))\r
+ KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))\r
+ PROVIDE_HIDDEN (__init_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .fini_array :\r
+ {\r
+ PROVIDE_HIDDEN (__fini_array_start = .);\r
+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))\r
+ KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))\r
+ PROVIDE_HIDDEN (__fini_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .ctors :\r
+ {\r
+ /* gcc uses crtbegin.o to find the start of\r
+ the constructors, so we make sure it is\r
+ first. Because this is a wildcard, it\r
+ doesn't matter if the user does not\r
+ actually link against crtbegin.o; the\r
+ linker won't look for a file to match a\r
+ wildcard. The wildcard also means that it\r
+ doesn't matter which directory crtbegin.o\r
+ is in. */\r
+ KEEP (*crtbegin.o(.ctors))\r
+ KEEP (*crtbegin?.o(.ctors))\r
+ /* We don't want to include the .ctor section from\r
+ the crtend.o file until after the sorted ctors.\r
+ The .ctor section from the crtend file contains the\r
+ end of ctors marker and it must be last */\r
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))\r
+ KEEP (*(SORT(.ctors.*)))\r
+ KEEP (*(.ctors))\r
+ } >flash AT>flash :flash\r
+\r
+ .dtors :\r
+ {\r
+ KEEP (*crtbegin.o(.dtors))\r
+ KEEP (*crtbegin?.o(.dtors))\r
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))\r
+ KEEP (*(SORT(.dtors.*)))\r
+ KEEP (*(.dtors))\r
+ } >flash AT>flash :flash\r
+\r
+ .lalign :\r
+ {\r
+ . = ALIGN(4);\r
+ PROVIDE( _data_lma = . );\r
+ } >flash AT>flash :flash\r
+\r
+ .dalign :\r
+ {\r
+ . = ALIGN(4);\r
+ PROVIDE( _data = . );\r
+ } >ram AT>flash :ram_init\r
+\r
+ .data :\r
+ {\r
+ *(.rdata)\r
+ *(.rodata .rodata.*)\r
+ *(.gnu.linkonce.r.*)\r
+ *(.data .data.*)\r
+ *(.gnu.linkonce.d.*)\r
+ . = ALIGN(8);\r
+ PROVIDE( __global_pointer$ = . + 0x800 );\r
+ *(.sdata .sdata.*)\r
+ *(.gnu.linkonce.s.*)\r
+ . = ALIGN(8);\r
+ *(.srodata.cst16)\r
+ *(.srodata.cst8)\r
+ *(.srodata.cst4)\r
+ *(.srodata.cst2)\r
+ *(.srodata .srodata.*)\r
+ } >ram AT>flash :ram_init\r
+\r
+ . = ALIGN(4);\r
+ PROVIDE( _edata = . );\r
+ PROVIDE( edata = . );\r
+\r
+ PROVIDE( _fbss = . );\r
+ PROVIDE( __bss_start = . );\r
+ .bss :\r
+ {\r
+ *(.sbss*)\r
+ *(.gnu.linkonce.sb.*)\r
+ *(.bss .bss.*)\r
+ *(.gnu.linkonce.b.*)\r
+ *(COMMON)\r
+ . = ALIGN(4);\r
+ } >ram AT>ram :ram\r
+\r
+ . = ALIGN(8);\r
+ PROVIDE( _end = . );\r
+ PROVIDE( end = . );\r
+\r
+ .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :\r
+ {\r
+ PROVIDE( _heap_end = . );\r
+ . = __stack_size;\r
+ PROVIDE( _sp = . );\r
+ } >ram AT>ram :ram\r
+}\r
--- /dev/null
+OUTPUT_ARCH( "riscv" )\r
+\r
+ENTRY( _start )\r
+\r
+MEMORY\r
+{\r
+ flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M\r
+ ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K\r
+}\r
+\r
+PHDRS\r
+{\r
+ flash PT_LOAD;\r
+ ram_init PT_LOAD;\r
+ ram PT_NULL;\r
+}\r
+\r
+SECTIONS\r
+{\r
+ __stack_size = DEFINED(__stack_size) ? __stack_size : 400;\r
+\r
+ .init :\r
+ {\r
+ KEEP (*(SORT_NONE(.init)))\r
+ } >flash AT>flash :flash\r
+\r
+ .text :\r
+ {\r
+ *(.text.unlikely .text.unlikely.*)\r
+ *(.text.startup .text.startup.*)\r
+ *(.text .text.*)\r
+ *(.gnu.linkonce.t.*)\r
+ } >flash AT>flash :flash\r
+\r
+ .fini :\r
+ {\r
+ KEEP (*(SORT_NONE(.fini)))\r
+ } >flash AT>flash :flash\r
+\r
+ PROVIDE (__etext = .);\r
+ PROVIDE (_etext = .);\r
+ PROVIDE (etext = .);\r
+\r
+ .rodata :\r
+ {\r
+ *(.rdata)\r
+ *(.rodata .rodata.*)\r
+ *(.gnu.linkonce.r.*)\r
+ } >flash AT>flash :flash\r
+\r
+ . = ALIGN(4);\r
+\r
+ .preinit_array :\r
+ {\r
+ PROVIDE_HIDDEN (__preinit_array_start = .);\r
+ KEEP (*(.preinit_array))\r
+ PROVIDE_HIDDEN (__preinit_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .init_array :\r
+ {\r
+ PROVIDE_HIDDEN (__init_array_start = .);\r
+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))\r
+ KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))\r
+ PROVIDE_HIDDEN (__init_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .fini_array :\r
+ {\r
+ PROVIDE_HIDDEN (__fini_array_start = .);\r
+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))\r
+ KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))\r
+ PROVIDE_HIDDEN (__fini_array_end = .);\r
+ } >flash AT>flash :flash\r
+\r
+ .ctors :\r
+ {\r
+ /* gcc uses crtbegin.o to find the start of\r
+ the constructors, so we make sure it is\r
+ first. Because this is a wildcard, it\r
+ doesn't matter if the user does not\r
+ actually link against crtbegin.o; the\r
+ linker won't look for a file to match a\r
+ wildcard. The wildcard also means that it\r
+ doesn't matter which directory crtbegin.o\r
+ is in. */\r
+ KEEP (*crtbegin.o(.ctors))\r
+ KEEP (*crtbegin?.o(.ctors))\r
+ /* We don't want to include the .ctor section from\r
+ the crtend.o file until after the sorted ctors.\r
+ The .ctor section from the crtend file contains the\r
+ end of ctors marker and it must be last */\r
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))\r
+ KEEP (*(SORT(.ctors.*)))\r
+ KEEP (*(.ctors))\r
+ } >flash AT>flash :flash\r
+\r
+ .dtors :\r
+ {\r
+ KEEP (*crtbegin.o(.dtors))\r
+ KEEP (*crtbegin?.o(.dtors))\r
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))\r
+ KEEP (*(SORT(.dtors.*)))\r
+ KEEP (*(.dtors))\r
+ } >flash AT>flash :flash\r
+\r
+ .lalign :\r
+ {\r
+ . = ALIGN(4);\r
+ PROVIDE( _data_lma = . );\r
+ } >flash AT>flash :flash\r
+\r
+ .dalign :\r
+ {\r
+ . = ALIGN(4);\r
+ PROVIDE( _data = . );\r
+ } >ram AT>flash :ram_init\r
+\r
+ .data :\r
+ {\r
+ *(.data .data.*)\r
+ *(.gnu.linkonce.d.*)\r
+ . = ALIGN(8);\r
+ PROVIDE( __global_pointer$ = . + 0x800 );\r
+ *(.sdata .sdata.*)\r
+ *(.gnu.linkonce.s.*)\r
+ . = ALIGN(8);\r
+ *(.srodata.cst16)\r
+ *(.srodata.cst8)\r
+ *(.srodata.cst4)\r
+ *(.srodata.cst2)\r
+ *(.srodata .srodata.*)\r
+ } >ram AT>flash :ram_init\r
+\r
+ . = ALIGN(4);\r
+ PROVIDE( _edata = . );\r
+ PROVIDE( edata = . );\r
+\r
+ PROVIDE( _fbss = . );\r
+ PROVIDE( __bss_start = . );\r
+ .bss :\r
+ {\r
+ *(.sbss*)\r
+ *(.gnu.linkonce.sb.*)\r
+ *(.bss .bss.*)\r
+ *(.gnu.linkonce.b.*)\r
+ *(COMMON)\r
+ . = ALIGN(4);\r
+ } >ram AT>ram :ram\r
+\r
+ . = ALIGN(8);\r
+ PROVIDE( _end = . );\r
+ PROVIDE( end = . );\r
+\r
+ .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :\r
+ {\r
+ PROVIDE( _heap_end = . );\r
+ . = __stack_size;\r
+ PROVIDE( _sp = . );\r
+ __freertos_irq_stack_top = .;\r
+ } >ram AT>ram :ram\r
+}\r
--- /dev/null
+#include <stdint.h>\r
+#include <stdio.h>\r
+#include <unistd.h>\r
+\r
+#include "platform.h"\r
+#include "encoding.h"\r
+\r
+extern int main(int argc, char** argv);\r
+extern void trap_entry();\r
+\r
+static unsigned long mtime_lo(void)\r
+{\r
+ return *(volatile unsigned long *)(CLINT_CTRL_ADDR + CLINT_MTIME);\r
+}\r
+\r
+#ifdef __riscv32\r
+\r
+static uint32_t mtime_hi(void)\r
+{\r
+ return *(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIME + 4);\r
+}\r
+\r
+uint64_t get_timer_value()\r
+{\r
+ while (1) {\r
+ uint32_t hi = mtime_hi();\r
+ uint32_t lo = mtime_lo();\r
+ if (hi == mtime_hi())\r
+ return ((uint64_t)hi << 32) | lo;\r
+ }\r
+}\r
+\r
+#else /* __riscv32 */\r
+\r
+uint64_t get_timer_value()\r
+{\r
+ return mtime_lo();\r
+}\r
+\r
+#endif\r
+\r
+unsigned long get_timer_freq()\r
+{\r
+ return 32768;\r
+}\r
+\r
+static void use_hfrosc(int div, int trim)\r
+{\r
+ // Make sure the HFROSC is running at its default setting\r
+ PRCI_REG(PRCI_HFROSCCFG) = (ROSC_DIV(div) | ROSC_TRIM(trim) | ROSC_EN(1));\r
+ while ((PRCI_REG(PRCI_HFROSCCFG) & ROSC_RDY(1)) == 0) ;\r
+ PRCI_REG(PRCI_PLLCFG) &= ~PLL_SEL(1);\r
+}\r
+\r
+static void use_pll(int refsel, int bypass, int r, int f, int q)\r
+{\r
+ // Ensure that we aren't running off the PLL before we mess with it.\r
+ if (PRCI_REG(PRCI_PLLCFG) & PLL_SEL(1)) {\r
+ // Make sure the HFROSC is running at its default setting\r
+ use_hfrosc(4, 16);\r
+ }\r
+\r
+ // Set PLL Source to be HFXOSC if available.\r
+ uint32_t config_value = 0;\r
+\r
+ config_value |= PLL_REFSEL(refsel);\r
+\r
+ if (bypass) {\r
+ // Bypass\r
+ config_value |= PLL_BYPASS(1);\r
+\r
+ PRCI_REG(PRCI_PLLCFG) = config_value;\r
+\r
+ // If we don't have an HFXTAL, this doesn't really matter.\r
+ // Set our Final output divide to divide-by-1:\r
+ PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));\r
+ } else {\r
+ // In case we are executing from QSPI,\r
+ // (which is quite likely) we need to\r
+ // set the QSPI clock divider appropriately\r
+ // before boosting the clock frequency.\r
+\r
+ // Div = f_sck/2\r
+ SPI0_REG(SPI_REG_SCKDIV) = 8;\r
+\r
+ // Set DIV Settings for PLL\r
+ // Both HFROSC and HFXOSC are modeled as ideal\r
+ // 16MHz sources (assuming dividers are set properly for\r
+ // HFROSC).\r
+ // (Legal values of f_REF are 6-48MHz)\r
+\r
+ // Set DIVR to divide-by-2 to get 8MHz frequency\r
+ // (legal values of f_R are 6-12 MHz)\r
+\r
+ config_value |= PLL_BYPASS(1);\r
+ config_value |= PLL_R(r);\r
+\r
+ // Set DIVF to get 512Mhz frequncy\r
+ // There is an implied multiply-by-2, 16Mhz.\r
+ // So need to write 32-1\r
+ // (legal values of f_F are 384-768 MHz)\r
+ config_value |= PLL_F(f);\r
+\r
+ // Set DIVQ to divide-by-2 to get 256 MHz frequency\r
+ // (legal values of f_Q are 50-400Mhz)\r
+ config_value |= PLL_Q(q);\r
+\r
+ // Set our Final output divide to divide-by-1:\r
+ PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));\r
+\r
+ PRCI_REG(PRCI_PLLCFG) = config_value;\r
+\r
+ // Un-Bypass the PLL.\r
+ PRCI_REG(PRCI_PLLCFG) &= ~PLL_BYPASS(1);\r
+\r
+ // Wait for PLL Lock\r
+ // Note that the Lock signal can be glitchy.\r
+ // Need to wait 100 us\r
+ // RTC is running at 32kHz.\r
+ // So wait 4 ticks of RTC.\r
+ uint32_t now = mtime_lo();\r
+ while (mtime_lo() - now < 4) ;\r
+\r
+ // Now it is safe to check for PLL Lock\r
+ while ((PRCI_REG(PRCI_PLLCFG) & PLL_LOCK(1)) == 0) ;\r
+ }\r
+\r
+ // Switch over to PLL Clock source\r
+ PRCI_REG(PRCI_PLLCFG) |= PLL_SEL(1);\r
+}\r
+\r
+static void use_default_clocks()\r
+{\r
+ // Turn off the LFROSC\r
+ AON_REG(AON_LFROSC) &= ~ROSC_EN(1);\r
+\r
+ // Use HFROSC\r
+ use_hfrosc(4, 16);\r
+}\r
+\r
+static unsigned long __attribute__((noinline)) measure_cpu_freq(size_t n)\r
+{\r
+ unsigned long start_mtime, delta_mtime;\r
+ unsigned long mtime_freq = get_timer_freq();\r
+\r
+ // Don't start measuruing until we see an mtime tick\r
+ unsigned long tmp = mtime_lo();\r
+ do {\r
+ start_mtime = mtime_lo();\r
+ } while (start_mtime == tmp);\r
+\r
+ unsigned long start_mcycle = read_csr(mcycle);\r
+\r
+ do {\r
+ delta_mtime = mtime_lo() - start_mtime;\r
+ } while (delta_mtime < n);\r
+\r
+ unsigned long delta_mcycle = read_csr(mcycle) - start_mcycle;\r
+\r
+ return (delta_mcycle / delta_mtime) * mtime_freq\r
+ + ((delta_mcycle % delta_mtime) * mtime_freq) / delta_mtime;\r
+}\r
+\r
+unsigned long get_cpu_freq()\r
+{\r
+ static uint32_t cpu_freq;\r
+\r
+ if (!cpu_freq) {\r
+ // warm up I$\r
+ measure_cpu_freq(1);\r
+ // measure for real\r
+ cpu_freq = measure_cpu_freq(10);\r
+ }\r
+\r
+ return cpu_freq;\r
+}\r
+\r
+static void uart_init(size_t baud_rate)\r
+{\r
+ GPIO_REG(GPIO_IOF_SEL) &= ~IOF0_UART0_MASK;\r
+ GPIO_REG(GPIO_IOF_EN) |= IOF0_UART0_MASK;\r
+ UART0_REG(UART_REG_DIV) = get_cpu_freq() / baud_rate - 1;\r
+ UART0_REG(UART_REG_TXCTRL) |= UART_TXEN;\r
+}\r
+\r
+\r
+\r
+#ifdef USE_PLIC\r
+extern void handle_m_ext_interrupt();\r
+#endif\r
+\r
+#ifdef USE_M_TIME\r
+extern void handle_m_time_interrupt();\r
+#endif\r
+\r
+uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc)\r
+{\r
+ if (0){\r
+#ifdef USE_PLIC\r
+ // External Machine-Level interrupt from PLIC\r
+ } else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) {\r
+ handle_m_ext_interrupt();\r
+#endif\r
+#ifdef USE_M_TIME\r
+ // External Machine-Level interrupt from PLIC\r
+ } else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){\r
+ handle_m_time_interrupt();\r
+#endif\r
+ }\r
+ else {\r
+ write(1, "trap\n", 5);\r
+ _exit(1 + mcause);\r
+ }\r
+ return epc;\r
+}\r
+\r
+void _init()\r
+{\r
+ \r
+ #ifndef NO_INIT\r
+ use_default_clocks();\r
+ use_pll(0, 0, 1, 31, 1);\r
+ uart_init(115200);\r
+\r
+ write_csr(mtvec, &trap_entry);\r
+ if (read_csr(misa) & (1 << ('F' - 'A'))) { // if F extension is present\r
+ write_csr(mstatus, MSTATUS_FS); // allow FPU instructions without trapping\r
+ write_csr(fcsr, 0); // initialize rounding mode, undefined at reset\r
+ }\r
+ #endif\r
+ \r
+}\r
+\r
+void _fini()\r
+{\r
+}\r
--- /dev/null
+adapter_khz 10000\r
+\r
+interface ftdi\r
+ftdi_device_desc "Dual RS232-HS"\r
+ftdi_vid_pid 0x0403 0x6010\r
+\r
+ftdi_layout_init 0x0008 0x001b\r
+ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020\r
+\r
+#Reset Stretcher logic on FE310 is ~1 second long\r
+#This doesn't apply if you use\r
+# ftdi_set_signal, but still good to document\r
+#adapter_nsrst_delay 1500\r
+\r
+set _CHIPNAME riscv\r
+jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913\r
+\r
+set _TARGETNAME $_CHIPNAME.cpu\r
+target create $_TARGETNAME riscv -chain-position $_TARGETNAME\r
+$_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1\r
+\r
+flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME\r
+init\r
+#reset -- This type of reset is not implemented yet\r
+if {[ info exists pulse_srst]} {\r
+ ftdi_set_signal nSRST 0\r
+ ftdi_set_signal nSRST z\r
+ #Wait for the reset stretcher\r
+ #It will work without this, but\r
+ #will incur lots of delays for later commands.\r
+ sleep 1500\r
+} \r
+halt\r
+#flash protect 0 64 last off\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_PLATFORM_H\r
+#define _SIFIVE_PLATFORM_H\r
+\r
+// Some things missing from the official encoding.h\r
+#define MCAUSE_INT 0x80000000\r
+#define MCAUSE_CAUSE 0x7FFFFFFF\r
+\r
+#include "sifive/const.h"\r
+#include "sifive/devices/aon.h"\r
+#include "sifive/devices/clint.h"\r
+#include "sifive/devices/gpio.h"\r
+#include "sifive/devices/otp.h"\r
+#include "sifive/devices/plic.h"\r
+#include "sifive/devices/prci.h"\r
+#include "sifive/devices/pwm.h"\r
+#include "sifive/devices/spi.h"\r
+#include "sifive/devices/uart.h"\r
+\r
+/****************************************************************************\r
+ * Platform definitions\r
+ *****************************************************************************/\r
+\r
+// Memory map\r
+#define MASKROM_MEM_ADDR _AC(0x00001000,UL)\r
+#define TRAPVEC_TABLE_CTRL_ADDR _AC(0x00001010,UL)\r
+#define OTP_MEM_ADDR _AC(0x00020000,UL)\r
+#define CLINT_CTRL_ADDR _AC(0x02000000,UL)\r
+#define PLIC_CTRL_ADDR _AC(0x0C000000,UL)\r
+#define AON_CTRL_ADDR _AC(0x10000000,UL)\r
+#define PRCI_CTRL_ADDR _AC(0x10008000,UL)\r
+#define OTP_CTRL_ADDR _AC(0x10010000,UL)\r
+#define GPIO_CTRL_ADDR _AC(0x10012000,UL)\r
+#define UART0_CTRL_ADDR _AC(0x10013000,UL)\r
+#define SPI0_CTRL_ADDR _AC(0x10014000,UL)\r
+#define PWM0_CTRL_ADDR _AC(0x10015000,UL)\r
+#define UART1_CTRL_ADDR _AC(0x10023000,UL)\r
+#define SPI1_CTRL_ADDR _AC(0x10024000,UL)\r
+#define PWM1_CTRL_ADDR _AC(0x10025000,UL)\r
+#define SPI2_CTRL_ADDR _AC(0x10034000,UL)\r
+#define PWM2_CTRL_ADDR _AC(0x10035000,UL)\r
+#define SPI0_MEM_ADDR _AC(0x20000000,UL)\r
+#define MEM_CTRL_ADDR _AC(0x80000000,UL)\r
+\r
+// IOF masks\r
+#define IOF0_SPI1_MASK _AC(0x000007FC,UL)\r
+#define SPI11_NUM_SS (4)\r
+#define IOF_SPI1_SS0 (2u)\r
+#define IOF_SPI1_SS1 (8u)\r
+#define IOF_SPI1_SS2 (9u)\r
+#define IOF_SPI1_SS3 (10u)\r
+#define IOF_SPI1_MOSI (3u)\r
+#define IOF_SPI1_MISO (4u)\r
+#define IOF_SPI1_SCK (5u)\r
+#define IOF_SPI1_DQ0 (3u)\r
+#define IOF_SPI1_DQ1 (4u)\r
+#define IOF_SPI1_DQ2 (6u)\r
+#define IOF_SPI1_DQ3 (7u)\r
+\r
+#define IOF0_SPI2_MASK _AC(0xFC000000,UL)\r
+#define SPI2_NUM_SS (1)\r
+#define IOF_SPI2_SS0 (26u)\r
+#define IOF_SPI2_MOSI (27u)\r
+#define IOF_SPI2_MISO (28u)\r
+#define IOF_SPI2_SCK (29u)\r
+#define IOF_SPI2_DQ0 (27u)\r
+#define IOF_SPI2_DQ1 (28u)\r
+#define IOF_SPI2_DQ2 (30u)\r
+#define IOF_SPI2_DQ3 (31u)\r
+\r
+//#define IOF0_I2C_MASK _AC(0x00003000,UL)\r
+\r
+#define IOF0_UART0_MASK _AC(0x00030000, UL)\r
+#define IOF_UART0_RX (16u)\r
+#define IOF_UART0_TX (17u)\r
+\r
+#define IOF0_UART1_MASK _AC(0x03000000, UL)\r
+#define IOF_UART1_RX (24u)\r
+#define IOF_UART1_TX (25u)\r
+\r
+#define IOF1_PWM0_MASK _AC(0x0000000F, UL)\r
+#define IOF1_PWM1_MASK _AC(0x00780000, UL)\r
+#define IOF1_PWM2_MASK _AC(0x00003C00, UL)\r
+\r
+// Interrupt numbers\r
+#define INT_RESERVED 0\r
+#define INT_WDOGCMP 1\r
+#define INT_RTCCMP 2\r
+#define INT_UART0_BASE 3\r
+#define INT_UART1_BASE 4\r
+#define INT_SPI0_BASE 5\r
+#define INT_SPI1_BASE 6\r
+#define INT_SPI2_BASE 7\r
+#define INT_GPIO_BASE 8\r
+#define INT_PWM0_BASE 40\r
+#define INT_PWM1_BASE 44\r
+#define INT_PWM2_BASE 48\r
+\r
+// Helper functions\r
+#define _REG32(p, i) (*(volatile uint32_t *) ((p) + (i)))\r
+#define _REG32P(p, i) ((volatile uint32_t *) ((p) + (i)))\r
+#define AON_REG(offset) _REG32(AON_CTRL_ADDR, offset)\r
+#define CLINT_REG(offset) _REG32(CLINT_CTRL_ADDR, offset)\r
+#define GPIO_REG(offset) _REG32(GPIO_CTRL_ADDR, offset)\r
+#define OTP_REG(offset) _REG32(OTP_CTRL_ADDR, offset)\r
+#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)\r
+#define PRCI_REG(offset) _REG32(PRCI_CTRL_ADDR, offset)\r
+#define PWM0_REG(offset) _REG32(PWM0_CTRL_ADDR, offset)\r
+#define PWM1_REG(offset) _REG32(PWM1_CTRL_ADDR, offset)\r
+#define PWM2_REG(offset) _REG32(PWM2_CTRL_ADDR, offset)\r
+#define SPI0_REG(offset) _REG32(SPI0_CTRL_ADDR, offset)\r
+#define SPI1_REG(offset) _REG32(SPI1_CTRL_ADDR, offset)\r
+#define SPI2_REG(offset) _REG32(SPI2_CTRL_ADDR, offset)\r
+#define UART0_REG(offset) _REG32(UART0_CTRL_ADDR, offset)\r
+#define UART1_REG(offset) _REG32(UART1_CTRL_ADDR, offset)\r
+\r
+// Misc\r
+\r
+#include <stdint.h>\r
+\r
+#define NUM_GPIO 32\r
+\r
+#define PLIC_NUM_INTERRUPTS 52\r
+#define PLIC_NUM_PRIORITIES 7\r
+\r
+#include "hifive1.h"\r
+\r
+unsigned long get_cpu_freq(void);\r
+unsigned long get_timer_freq(void);\r
+uint64_t get_timer_value(void);\r
+\r
+#endif /* _SIFIVE_PLATFORM_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_HIFIVE1_H\r
+#define _SIFIVE_HIFIVE1_H\r
+\r
+#include <stdint.h>\r
+\r
+/****************************************************************************\r
+ * GPIO Connections\r
+ *****************************************************************************/\r
+\r
+// These are the GPIO bit offsets for the RGB LED on HiFive1 Board.\r
+// These are also mapped to RGB LEDs on the Freedom E300 Arty\r
+// FPGA\r
+// Dev Kit.\r
+\r
+#define RED_LED_OFFSET 22\r
+#define GREEN_LED_OFFSET 19\r
+#define BLUE_LED_OFFSET 21\r
+\r
+// These are the GPIO bit offsets for the differen digital pins\r
+// on the headers for both the HiFive1 Board and the Freedom E300 Arty FPGA Dev Kit.\r
+#define PIN_0_OFFSET 16\r
+#define PIN_1_OFFSET 17\r
+#define PIN_2_OFFSET 18\r
+#define PIN_3_OFFSET 19\r
+#define PIN_4_OFFSET 20\r
+#define PIN_5_OFFSET 21\r
+#define PIN_6_OFFSET 22\r
+#define PIN_7_OFFSET 23\r
+#define PIN_8_OFFSET 0\r
+#define PIN_9_OFFSET 1\r
+#define PIN_10_OFFSET 2\r
+#define PIN_11_OFFSET 3\r
+#define PIN_12_OFFSET 4\r
+#define PIN_13_OFFSET 5\r
+//#define PIN_14_OFFSET 8 //This pin is not connected on either board.\r
+#define PIN_15_OFFSET 9\r
+#define PIN_16_OFFSET 10\r
+#define PIN_17_OFFSET 11\r
+#define PIN_18_OFFSET 12\r
+#define PIN_19_OFFSET 13\r
+\r
+// These are *PIN* numbers, not\r
+// GPIO Offset Numbers.\r
+#define PIN_SPI1_SCK (13u)\r
+#define PIN_SPI1_MISO (12u)\r
+#define PIN_SPI1_MOSI (11u)\r
+#define PIN_SPI1_SS0 (10u)\r
+#define PIN_SPI1_SS1 (14u) \r
+#define PIN_SPI1_SS2 (15u)\r
+#define PIN_SPI1_SS3 (16u)\r
+\r
+#define SS_PIN_TO_CS_ID(x) \\r
+ ((x==PIN_SPI1_SS0 ? 0 : \\r
+ (x==PIN_SPI1_SS1 ? 1 : \\r
+ (x==PIN_SPI1_SS2 ? 2 : \\r
+ (x==PIN_SPI1_SS3 ? 3 : \\r
+ -1))))) \r
+\r
+\r
+// These buttons are present only on the Freedom E300 Arty Dev Kit.\r
+#ifdef HAS_BOARD_BUTTONS\r
+#define BUTTON_0_OFFSET 15\r
+#define BUTTON_1_OFFSET 30\r
+#define BUTTON_2_OFFSET 31\r
+\r
+#define INT_DEVICE_BUTTON_0 (INT_GPIO_BASE + BUTTON_0_OFFSET)\r
+#define INT_DEVICE_BUTTON_1 (INT_GPIO_BASE + BUTTON_1_OFFSET)\r
+#define INT_DEVICE_BUTTON_2 (INT_GPIO_BASE + BUTTON_2_OFFSET)\r
+\r
+#endif\r
+\r
+#define HAS_HFXOSC 1\r
+#define HAS_LFROSC_BYPASS 1\r
+\r
+#define RTC_FREQ 32768\r
+\r
+void write_hex(int fd, unsigned long int hex);\r
+\r
+#endif /* _SIFIVE_HIFIVE1_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+/* This is defined in sifive/platform.h, but that can't be included from\r
+ * assembly. */\r
+#define CLINT_CTRL_ADDR 0x02000000\r
+\r
+ .section .init\r
+ .globl _start\r
+ .type _start,@function\r
+\r
+_start:\r
+ .cfi_startproc\r
+ .cfi_undefined ra\r
+.option push\r
+.option norelax\r
+ la gp, __global_pointer$\r
+.option pop\r
+ la sp, _sp\r
+\r
+#if defined(ENABLE_SMP)\r
+ smp_pause(t0, t1)\r
+#endif\r
+\r
+ /* Load data section */\r
+ la a0, _data_lma\r
+ la a1, _data\r
+ la a2, _edata\r
+ bgeu a1, a2, 2f\r
+1:\r
+ lw t0, (a0)\r
+ sw t0, (a1)\r
+ addi a0, a0, 4\r
+ addi a1, a1, 4\r
+ bltu a1, a2, 1b\r
+2:\r
+\r
+ /* Clear bss section */\r
+ la a0, __bss_start\r
+ la a1, _end\r
+ bgeu a0, a1, 2f\r
+1:\r
+ sw zero, (a0)\r
+ addi a0, a0, 4\r
+ bltu a0, a1, 1b\r
+2:\r
+\r
+ /* Call global constructors */\r
+ la a0, __libc_fini_array\r
+ call atexit\r
+ call __libc_init_array\r
+\r
+#ifndef __riscv_float_abi_soft\r
+ /* Enable FPU */\r
+ li t0, MSTATUS_FS\r
+ csrs mstatus, t0\r
+ csrr t1, mstatus\r
+ and t1, t1, t0\r
+ beqz t1, 1f\r
+ fssr x0\r
+1:\r
+#endif\r
+\r
+#if defined(ENABLE_SMP)\r
+ smp_resume(t0, t1)\r
+\r
+ csrr a0, mhartid\r
+ bnez a0, 2f\r
+#endif\r
+\r
+ auipc ra, 0\r
+ addi sp, sp, -16\r
+#if __riscv_xlen == 32\r
+ sw ra, 8(sp)\r
+#else\r
+ sd ra, 8(sp)\r
+#endif\r
+\r
+ /* argc = argv = 0 */\r
+ li a0, 0\r
+ li a1, 0\r
+ call main\r
+ tail exit\r
+1:\r
+ j 1b\r
+\r
+#if defined(ENABLE_SMP)\r
+2:\r
+ la t0, trap_entry\r
+ csrw mtvec, t0\r
+\r
+ csrr a0, mhartid\r
+ la t1, _sp\r
+ slli t0, a0, 10\r
+ sub sp, t1, t0\r
+\r
+ auipc ra, 0\r
+ addi sp, sp, -16\r
+#if __riscv_xlen == 32\r
+ sw ra, 8(sp)\r
+#else\r
+ sd ra, 8(sp)\r
+#endif\r
+\r
+ call secondary_main\r
+ tail exit\r
+\r
+1:\r
+ j 1b\r
+#endif\r
+ .cfi_endproc\r
--- /dev/null
+// See LICENSE for license details.\r
+#ifndef _RISCV_BITS_H\r
+#define _RISCV_BITS_H\r
+\r
+#define likely(x) __builtin_expect((x), 1)\r
+#define unlikely(x) __builtin_expect((x), 0)\r
+\r
+#define ROUNDUP(a, b) ((((a)-1)/(b)+1)*(b))\r
+#define ROUNDDOWN(a, b) ((a)/(b)*(b))\r
+\r
+#define MAX(a, b) ((a) > (b) ? (a) : (b))\r
+#define MIN(a, b) ((a) < (b) ? (a) : (b))\r
+#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi)\r
+\r
+#define EXTRACT_FIELD(val, which) (((val) & (which)) / ((which) & ~((which)-1)))\r
+#define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))\r
+\r
+#define STR(x) XSTR(x)\r
+#define XSTR(x) #x\r
+\r
+#if __riscv_xlen == 64\r
+# define SLL32 sllw\r
+# define STORE sd\r
+# define LOAD ld\r
+# define LWU lwu\r
+# define LOG_REGBYTES 3\r
+#else\r
+# define SLL32 sll\r
+# define STORE sw\r
+# define LOAD lw\r
+# define LWU lw\r
+# define LOG_REGBYTES 2\r
+#endif\r
+#define REGBYTES (1 << LOG_REGBYTES)\r
+\r
+#endif\r
--- /dev/null
+// See LICENSE for license details.\r
+/* Derived from <linux/const.h> */\r
+\r
+#ifndef _SIFIVE_CONST_H\r
+#define _SIFIVE_CONST_H\r
+\r
+#ifdef __ASSEMBLER__\r
+#define _AC(X,Y) X\r
+#define _AT(T,X) X\r
+#else\r
+#define _AC(X,Y) (X##Y)\r
+#define _AT(T,X) ((T)(X))\r
+#endif /* !__ASSEMBLER__*/\r
+\r
+#define _BITUL(x) (_AC(1,UL) << (x))\r
+#define _BITULL(x) (_AC(1,ULL) << (x))\r
+\r
+#endif /* _SIFIVE_CONST_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_AON_H\r
+#define _SIFIVE_AON_H\r
+\r
+/* Register offsets */\r
+\r
+#define AON_WDOGCFG 0x000\r
+#define AON_WDOGCOUNT 0x008\r
+#define AON_WDOGS 0x010\r
+#define AON_WDOGFEED 0x018\r
+#define AON_WDOGKEY 0x01C\r
+#define AON_WDOGCMP 0x020\r
+\r
+#define AON_RTCCFG 0x040\r
+#define AON_RTCLO 0x048\r
+#define AON_RTCHI 0x04C\r
+#define AON_RTCS 0x050\r
+#define AON_RTCCMP 0x060\r
+\r
+#define AON_BACKUP0 0x080\r
+#define AON_BACKUP1 0x084\r
+#define AON_BACKUP2 0x088\r
+#define AON_BACKUP3 0x08C\r
+#define AON_BACKUP4 0x090\r
+#define AON_BACKUP5 0x094\r
+#define AON_BACKUP6 0x098\r
+#define AON_BACKUP7 0x09C\r
+#define AON_BACKUP8 0x0A0\r
+#define AON_BACKUP9 0x0A4\r
+#define AON_BACKUP10 0x0A8\r
+#define AON_BACKUP11 0x0AC\r
+#define AON_BACKUP12 0x0B0\r
+#define AON_BACKUP13 0x0B4\r
+#define AON_BACKUP14 0x0B8\r
+#define AON_BACKUP15 0x0BC\r
+\r
+#define AON_PMUWAKEUPI0 0x100\r
+#define AON_PMUWAKEUPI1 0x104\r
+#define AON_PMUWAKEUPI2 0x108\r
+#define AON_PMUWAKEUPI3 0x10C\r
+#define AON_PMUWAKEUPI4 0x110\r
+#define AON_PMUWAKEUPI5 0x114\r
+#define AON_PMUWAKEUPI6 0x118\r
+#define AON_PMUWAKEUPI7 0x11C\r
+#define AON_PMUSLEEPI0 0x120\r
+#define AON_PMUSLEEPI1 0x124\r
+#define AON_PMUSLEEPI2 0x128\r
+#define AON_PMUSLEEPI3 0x12C\r
+#define AON_PMUSLEEPI4 0x130\r
+#define AON_PMUSLEEPI5 0x134\r
+#define AON_PMUSLEEPI6 0x138\r
+#define AON_PMUSLEEPI7 0x13C\r
+#define AON_PMUIE 0x140\r
+#define AON_PMUCAUSE 0x144\r
+#define AON_PMUSLEEP 0x148\r
+#define AON_PMUKEY 0x14C\r
+\r
+#define AON_LFROSC 0x070\r
+/* Constants */\r
+\r
+#define AON_WDOGKEY_VALUE 0x51F15E\r
+#define AON_WDOGFEED_VALUE 0xD09F00D\r
+\r
+#define AON_WDOGCFG_SCALE 0x0000000F\r
+#define AON_WDOGCFG_RSTEN 0x00000100\r
+#define AON_WDOGCFG_ZEROCMP 0x00000200\r
+#define AON_WDOGCFG_ENALWAYS 0x00001000\r
+#define AON_WDOGCFG_ENCOREAWAKE 0x00002000\r
+#define AON_WDOGCFG_CMPIP 0x10000000\r
+\r
+#define AON_RTCCFG_SCALE 0x0000000F\r
+#define AON_RTCCFG_ENALWAYS 0x00001000\r
+#define AON_RTCCFG_CMPIP 0x10000000\r
+\r
+#define AON_WAKEUPCAUSE_RESET 0x00\r
+#define AON_WAKEUPCAUSE_RTC 0x01\r
+#define AON_WAKEUPCAUSE_DWAKEUP 0x02\r
+#define AON_WAKEUPCAUSE_AWAKEUP 0x03\r
+\r
+#define AON_RESETCAUSE_POWERON 0x0000\r
+#define AON_RESETCAUSE_EXTERNAL 0x0100\r
+#define AON_RESETCAUSE_WATCHDOG 0x0200\r
+\r
+#define AON_PMUCAUSE_WAKEUPCAUSE 0x00FF\r
+#define AON_PMUCAUSE_RESETCAUSE 0xFF00\r
+\r
+#endif /* _SIFIVE_AON_H */\r
--- /dev/null
+// See LICENSE for license details\r
+\r
+#ifndef _SIFIVE_CLINT_H\r
+#define _SIFIVE_CLINT_H\r
+\r
+\r
+#define CLINT_MSIP 0x0000\r
+#define CLINT_MSIP_size 0x4\r
+#define CLINT_MTIMECMP 0x4000\r
+#define CLINT_MTIMECMP_size 0x8\r
+#define CLINT_MTIME 0xBFF8\r
+#define CLINT_MTIME_size 0x8\r
+\r
+#endif /* _SIFIVE_CLINT_H */ \r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_GPIO_H\r
+#define _SIFIVE_GPIO_H\r
+\r
+#define GPIO_INPUT_VAL (0x00)\r
+#define GPIO_INPUT_EN (0x04)\r
+#define GPIO_OUTPUT_EN (0x08)\r
+#define GPIO_OUTPUT_VAL (0x0C)\r
+#define GPIO_PULLUP_EN (0x10)\r
+#define GPIO_DRIVE (0x14)\r
+#define GPIO_RISE_IE (0x18)\r
+#define GPIO_RISE_IP (0x1C)\r
+#define GPIO_FALL_IE (0x20)\r
+#define GPIO_FALL_IP (0x24)\r
+#define GPIO_HIGH_IE (0x28)\r
+#define GPIO_HIGH_IP (0x2C)\r
+#define GPIO_LOW_IE (0x30)\r
+#define GPIO_LOW_IP (0x34)\r
+#define GPIO_IOF_EN (0x38)\r
+#define GPIO_IOF_SEL (0x3C)\r
+#define GPIO_OUTPUT_XOR (0x40)\r
+\r
+#endif /* _SIFIVE_GPIO_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_OTP_H\r
+#define _SIFIVE_OTP_H\r
+\r
+/* Register offsets */\r
+\r
+#define OTP_LOCK 0x00\r
+#define OTP_CK 0x04\r
+#define OTP_OE 0x08\r
+#define OTP_SEL 0x0C\r
+#define OTP_WE 0x10\r
+#define OTP_MR 0x14\r
+#define OTP_MRR 0x18\r
+#define OTP_MPP 0x1C\r
+#define OTP_VRREN 0x20\r
+#define OTP_VPPEN 0x24\r
+#define OTP_A 0x28\r
+#define OTP_D 0x2C\r
+#define OTP_Q 0x30\r
+#define OTP_READ_TIMINGS 0x34\r
+\r
+#endif\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef PLIC_H\r
+#define PLIC_H\r
+\r
+#include <sifive/const.h>\r
+\r
+// 32 bits per source\r
+#define PLIC_PRIORITY_OFFSET _AC(0x0000,UL)\r
+#define PLIC_PRIORITY_SHIFT_PER_SOURCE 2\r
+// 1 bit per source (1 address)\r
+#define PLIC_PENDING_OFFSET _AC(0x1000,UL)\r
+#define PLIC_PENDING_SHIFT_PER_SOURCE 0\r
+\r
+//0x80 per target\r
+#define PLIC_ENABLE_OFFSET _AC(0x2000,UL)\r
+#define PLIC_ENABLE_SHIFT_PER_TARGET 7\r
+\r
+\r
+#define PLIC_THRESHOLD_OFFSET _AC(0x200000,UL)\r
+#define PLIC_CLAIM_OFFSET _AC(0x200004,UL)\r
+#define PLIC_THRESHOLD_SHIFT_PER_TARGET 12\r
+#define PLIC_CLAIM_SHIFT_PER_TARGET 12\r
+\r
+#define PLIC_MAX_SOURCE 1023\r
+#define PLIC_SOURCE_MASK 0x3FF\r
+\r
+#define PLIC_MAX_TARGET 15871\r
+#define PLIC_TARGET_MASK 0x3FFF\r
+\r
+#endif /* PLIC_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_PRCI_H\r
+#define _SIFIVE_PRCI_H\r
+\r
+/* Register offsets */\r
+\r
+#define PRCI_HFROSCCFG (0x0000)\r
+#define PRCI_HFXOSCCFG (0x0004)\r
+#define PRCI_PLLCFG (0x0008)\r
+#define PRCI_PLLDIV (0x000C)\r
+#define PRCI_PROCMONCFG (0x00F0)\r
+\r
+/* Fields */\r
+#define ROSC_DIV(x) (((x) & 0x2F) << 0 ) \r
+#define ROSC_TRIM(x) (((x) & 0x1F) << 16)\r
+#define ROSC_EN(x) (((x) & 0x1 ) << 30) \r
+#define ROSC_RDY(x) (((x) & 0x1 ) << 31)\r
+\r
+#define XOSC_EN(x) (((x) & 0x1) << 30)\r
+#define XOSC_RDY(x) (((x) & 0x1) << 31)\r
+\r
+#define PLL_R(x) (((x) & 0x7) << 0)\r
+// single reserved bit for F LSB.\r
+#define PLL_F(x) (((x) & 0x3F) << 4)\r
+#define PLL_Q(x) (((x) & 0x3) << 10)\r
+#define PLL_SEL(x) (((x) & 0x1) << 16)\r
+#define PLL_REFSEL(x) (((x) & 0x1) << 17)\r
+#define PLL_BYPASS(x) (((x) & 0x1) << 18)\r
+#define PLL_LOCK(x) (((x) & 0x1) << 31)\r
+\r
+#define PLL_R_default 0x1\r
+#define PLL_F_default 0x1F\r
+#define PLL_Q_default 0x3\r
+\r
+#define PLL_REFSEL_HFROSC 0x0\r
+#define PLL_REFSEL_HFXOSC 0x1\r
+\r
+#define PLL_SEL_HFROSC 0x0\r
+#define PLL_SEL_PLL 0x1\r
+\r
+#define PLL_FINAL_DIV(x) (((x) & 0x3F) << 0)\r
+#define PLL_FINAL_DIV_BY_1(x) (((x) & 0x1 ) << 8)\r
+\r
+#define PROCMON_DIV(x) (((x) & 0x1F) << 0)\r
+#define PROCMON_TRIM(x) (((x) & 0x1F) << 8)\r
+#define PROCMON_EN(x) (((x) & 0x1) << 16)\r
+#define PROCMON_SEL(x) (((x) & 0x3) << 24)\r
+#define PROCMON_NT_EN(x) (((x) & 0x1) << 28)\r
+\r
+#define PROCMON_SEL_HFCLK 0\r
+#define PROCMON_SEL_HFXOSCIN 1\r
+#define PROCMON_SEL_PLLOUTDIV 2\r
+#define PROCMON_SEL_PROCMON 3\r
+\r
+#endif // _SIFIVE_PRCI_H\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_PWM_H\r
+#define _SIFIVE_PWM_H\r
+\r
+/* Register offsets */\r
+\r
+#define PWM_CFG 0x00\r
+#define PWM_COUNT 0x08\r
+#define PWM_S 0x10\r
+#define PWM_CMP0 0x20\r
+#define PWM_CMP1 0x24\r
+#define PWM_CMP2 0x28\r
+#define PWM_CMP3 0x2C\r
+\r
+/* Constants */\r
+\r
+#define PWM_CFG_SCALE 0x0000000F\r
+#define PWM_CFG_STICKY 0x00000100\r
+#define PWM_CFG_ZEROCMP 0x00000200\r
+#define PWM_CFG_DEGLITCH 0x00000400\r
+#define PWM_CFG_ENALWAYS 0x00001000\r
+#define PWM_CFG_ONESHOT 0x00002000\r
+#define PWM_CFG_CMP0CENTER 0x00010000\r
+#define PWM_CFG_CMP1CENTER 0x00020000\r
+#define PWM_CFG_CMP2CENTER 0x00040000\r
+#define PWM_CFG_CMP3CENTER 0x00080000\r
+#define PWM_CFG_CMP0GANG 0x01000000\r
+#define PWM_CFG_CMP1GANG 0x02000000\r
+#define PWM_CFG_CMP2GANG 0x04000000\r
+#define PWM_CFG_CMP3GANG 0x08000000\r
+#define PWM_CFG_CMP0IP 0x10000000\r
+#define PWM_CFG_CMP1IP 0x20000000\r
+#define PWM_CFG_CMP2IP 0x40000000\r
+#define PWM_CFG_CMP3IP 0x80000000\r
+\r
+#endif /* _SIFIVE_PWM_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_SPI_H\r
+#define _SIFIVE_SPI_H\r
+\r
+/* Register offsets */\r
+\r
+#define SPI_REG_SCKDIV 0x00\r
+#define SPI_REG_SCKMODE 0x04\r
+#define SPI_REG_CSID 0x10\r
+#define SPI_REG_CSDEF 0x14\r
+#define SPI_REG_CSMODE 0x18\r
+\r
+#define SPI_REG_DCSSCK 0x28\r
+#define SPI_REG_DSCKCS 0x2a\r
+#define SPI_REG_DINTERCS 0x2c\r
+#define SPI_REG_DINTERXFR 0x2e\r
+\r
+#define SPI_REG_FMT 0x40\r
+#define SPI_REG_TXFIFO 0x48\r
+#define SPI_REG_RXFIFO 0x4c\r
+#define SPI_REG_TXCTRL 0x50\r
+#define SPI_REG_RXCTRL 0x54\r
+\r
+#define SPI_REG_FCTRL 0x60\r
+#define SPI_REG_FFMT 0x64\r
+\r
+#define SPI_REG_IE 0x70\r
+#define SPI_REG_IP 0x74\r
+\r
+/* Fields */\r
+\r
+#define SPI_SCK_PHA 0x1\r
+#define SPI_SCK_POL 0x2\r
+\r
+#define SPI_FMT_PROTO(x) ((x) & 0x3)\r
+#define SPI_FMT_ENDIAN(x) (((x) & 0x1) << 2)\r
+#define SPI_FMT_DIR(x) (((x) & 0x1) << 3)\r
+#define SPI_FMT_LEN(x) (((x) & 0xf) << 16)\r
+\r
+/* TXCTRL register */\r
+#define SPI_TXWM(x) ((x) & 0xffff)\r
+/* RXCTRL register */\r
+#define SPI_RXWM(x) ((x) & 0xffff)\r
+\r
+#define SPI_IP_TXWM 0x1\r
+#define SPI_IP_RXWM 0x2\r
+\r
+#define SPI_FCTRL_EN 0x1\r
+\r
+#define SPI_INSN_CMD_EN 0x1\r
+#define SPI_INSN_ADDR_LEN(x) (((x) & 0x7) << 1)\r
+#define SPI_INSN_PAD_CNT(x) (((x) & 0xf) << 4)\r
+#define SPI_INSN_CMD_PROTO(x) (((x) & 0x3) << 8)\r
+#define SPI_INSN_ADDR_PROTO(x) (((x) & 0x3) << 10)\r
+#define SPI_INSN_DATA_PROTO(x) (((x) & 0x3) << 12)\r
+#define SPI_INSN_CMD_CODE(x) (((x) & 0xff) << 16)\r
+#define SPI_INSN_PAD_CODE(x) (((x) & 0xff) << 24)\r
+\r
+#define SPI_TXFIFO_FULL (1 << 31) \r
+#define SPI_RXFIFO_EMPTY (1 << 31) \r
+\r
+/* Values */\r
+\r
+#define SPI_CSMODE_AUTO 0\r
+#define SPI_CSMODE_HOLD 2\r
+#define SPI_CSMODE_OFF 3\r
+\r
+#define SPI_DIR_RX 0\r
+#define SPI_DIR_TX 1\r
+\r
+#define SPI_PROTO_S 0\r
+#define SPI_PROTO_D 1\r
+#define SPI_PROTO_Q 2\r
+\r
+#define SPI_ENDIAN_MSB 0\r
+#define SPI_ENDIAN_LSB 1\r
+\r
+\r
+#endif /* _SIFIVE_SPI_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+\r
+#ifndef _SIFIVE_UART_H\r
+#define _SIFIVE_UART_H\r
+\r
+/* Register offsets */\r
+#define UART_REG_TXFIFO 0x00\r
+#define UART_REG_RXFIFO 0x04\r
+#define UART_REG_TXCTRL 0x08\r
+#define UART_REG_RXCTRL 0x0c\r
+#define UART_REG_IE 0x10\r
+#define UART_REG_IP 0x14\r
+#define UART_REG_DIV 0x18\r
+\r
+/* TXCTRL register */\r
+#define UART_TXEN 0x1\r
+#define UART_TXWM(x) (((x) & 0xffff) << 16)\r
+\r
+/* RXCTRL register */\r
+#define UART_RXEN 0x1\r
+#define UART_RXWM(x) (((x) & 0xffff) << 16)\r
+\r
+/* IP register */\r
+#define UART_IP_TXWM 0x1\r
+#define UART_IP_RXWM 0x2\r
+\r
+#endif /* _SIFIVE_UART_H */\r
--- /dev/null
+// See LICENSE for license details.\r
+#ifndef _SECTIONS_H\r
+#define _SECTIONS_H\r
+\r
+extern unsigned char _rom[];\r
+extern unsigned char _rom_end[];\r
+\r
+extern unsigned char _ram[];\r
+extern unsigned char _ram_end[];\r
+\r
+extern unsigned char _ftext[];\r
+extern unsigned char _etext[];\r
+extern unsigned char _fbss[];\r
+extern unsigned char _ebss[];\r
+extern unsigned char _end[];\r
+\r
+#endif /* _SECTIONS_H */\r
--- /dev/null
+#ifndef SIFIVE_SMP\r
+#define SIFIVE_SMP\r
+\r
+// The maximum number of HARTs this code supports\r
+#ifndef MAX_HARTS\r
+#define MAX_HARTS 32\r
+#endif\r
+#define CLINT_END_HART_IPI CLINT_CTRL_ADDR + (MAX_HARTS*4)\r
+\r
+// The hart that non-SMP tests should run on\r
+#ifndef NONSMP_HART\r
+#define NONSMP_HART 0\r
+#endif\r
+\r
+/* If your test cannot handle multiple-threads, use this: \r
+ * smp_disable(reg1)\r
+ */\r
+#define smp_disable(reg1, reg2) \\r
+ csrr reg1, mhartid ;\\r
+ li reg2, NONSMP_HART ;\\r
+ beq reg1, reg2, hart0_entry ;\\r
+42: ;\\r
+ wfi ;\\r
+ j 42b ;\\r
+hart0_entry:\r
+\r
+/* If your test needs to temporarily block multiple-threads, do this:\r
+ * smp_pause(reg1, reg2)\r
+ * ... single-threaded work ...\r
+ * smp_resume(reg1, reg2)\r
+ * ... multi-threaded work ...\r
+ */\r
+\r
+#define smp_pause(reg1, reg2) \\r
+ li reg2, 0x8 ;\\r
+ csrw mie, reg2 ;\\r
+ csrr reg2, mhartid ;\\r
+ bnez reg2, 42f\r
+\r
+#define smp_resume(reg1, reg2) \\r
+ li reg1, CLINT_CTRL_ADDR ;\\r
+41: ;\\r
+ li reg2, 1 ;\\r
+ sw reg2, 0(reg1) ;\\r
+ addi reg1, reg1, 4 ;\\r
+ li reg2, CLINT_END_HART_IPI ;\\r
+ blt reg1, reg2, 41b ;\\r
+42: ;\\r
+ wfi ;\\r
+ csrr reg2, mip ;\\r
+ andi reg2, reg2, 0x8 ;\\r
+ beqz reg2, 42b ;\\r
+ li reg1, CLINT_CTRL_ADDR ;\\r
+ csrr reg2, mhartid ;\\r
+ slli reg2, reg2, 2 ;\\r
+ add reg2, reg2, reg1 ;\\r
+ sw zero, 0(reg2) ;\\r
+41: ;\\r
+ lw reg2, 0(reg1) ;\\r
+ bnez reg2, 41b ;\\r
+ addi reg1, reg1, 4 ;\\r
+ li reg2, CLINT_END_HART_IPI ;\\r
+ blt reg1, reg2, 41b\r
+\r
+#endif\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <stdint.h>\r
+#include <unistd.h>\r
+#include "platform.h"\r
+\r
+void write_hex(int fd, unsigned long int hex)\r
+{\r
+ uint8_t ii;\r
+ uint8_t jj;\r
+ char towrite;\r
+ write(fd , "0x", 2);\r
+ for (ii = sizeof(unsigned long int) * 2 ; ii > 0; ii--) {\r
+ jj = ii - 1;\r
+ uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4));\r
+ towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));\r
+ write(fd, &towrite, 1);\r
+ }\r
+}\r
--- /dev/null
+/* See LICENSE for license details. */\r
+\r
+/* These functions are intended for embedded RV32 systems and are\r
+ obviously incorrect in general. */\r
+\r
+void* __wrap_malloc(unsigned long sz)\r
+{\r
+ extern void* sbrk(long);\r
+ void* res = sbrk(sz);\r
+ if ((long)res == -1)\r
+ return 0;\r
+ return res;\r
+}\r
+\r
+void __wrap_free(void* ptr)\r
+{\r
+}\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <unistd.h>\r
+#include "platform.h"\r
+#include "weak_under_alias.h"\r
+\r
+void __wrap_exit(int code)\r
+{\r
+ const char message[] = "\nProgam has exited with code:";\r
+\r
+ write(STDERR_FILENO, message, sizeof(message) - 1);\r
+ write_hex(STDERR_FILENO, code);\r
+ write(STDERR_FILENO, "\n", 1);\r
+\r
+ for (;;);\r
+}\r
+weak_under_alias(exit);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_close(int fd)\r
+{\r
+ return _stub(EBADF);\r
+}\r
+weak_under_alias(close);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_execve(const char* name, char* const argv[], char* const env[])\r
+{\r
+ return _stub(ENOMEM);\r
+}\r
+weak_under_alias(execve);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+\r
+int fork(void)\r
+{\r
+ return _stub(EAGAIN);\r
+}\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include <unistd.h>\r
+#include <sys/stat.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_fstat(int fd, struct stat* st)\r
+{\r
+ if (isatty(fd)) {\r
+ st->st_mode = S_IFCHR;\r
+ return 0;\r
+ }\r
+\r
+ return _stub(EBADF);\r
+}\r
+weak_under_alias(fstat);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_getpid(void)\r
+{\r
+ return 1;\r
+}\r
+weak_under_alias(getpid);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <unistd.h>\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_isatty(int fd)\r
+{\r
+ if (fd == STDOUT_FILENO || fd == STDERR_FILENO)\r
+ return 1;\r
+\r
+ return 0;\r
+}\r
+weak_under_alias(isatty);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_kill(int pid, int sig)\r
+{\r
+ return _stub(EINVAL);\r
+}\r
+weak_under_alias(kill);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_link(const char *old_name, const char *new_name)\r
+{\r
+ return _stub(EMLINK);\r
+}\r
+weak_under_alias(link);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include <unistd.h>\r
+#include <sys/types.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+off_t __wrap_lseek(int fd, off_t ptr, int dir)\r
+{\r
+ if (isatty(fd))\r
+ return 0;\r
+\r
+ return _stub(EBADF);\r
+}\r
+weak_under_alias(lseek);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_open(const char* name, int flags, int mode)\r
+{\r
+ return _stub(ENOENT);\r
+}\r
+weak_under_alias(open);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_openat(int dirfd, const char* name, int flags, int mode)\r
+{\r
+ return _stub(ENOENT);\r
+}\r
+weak_under_alias(openat);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <stdint.h>\r
+#include <errno.h>\r
+#include <unistd.h>\r
+#include <sys/types.h>\r
+\r
+#include "platform.h"\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_puts(const char *s)\r
+{\r
+ while (*s != '\0') {\r
+ while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
+ UART0_REG(UART_REG_TXFIFO) = *s;\r
+\r
+ if (*s == '\n') {\r
+ while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
+ UART0_REG(UART_REG_TXFIFO) = '\r';\r
+ }\r
+\r
+ ++s;\r
+ }\r
+\r
+ return 0;\r
+}\r
+weak_under_alias(puts);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <stdint.h>\r
+#include <errno.h>\r
+#include <unistd.h>\r
+#include <sys/types.h>\r
+\r
+#include "platform.h"\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+ssize_t __wrap_read(int fd, void* ptr, size_t len)\r
+{\r
+ uint8_t * current = (uint8_t *)ptr;\r
+ volatile uint32_t * uart_rx = (uint32_t *)(UART0_CTRL_ADDR + UART_REG_RXFIFO);\r
+ volatile uint8_t * uart_rx_cnt = (uint8_t *)(UART0_CTRL_ADDR + UART_REG_RXCTRL + 2);\r
+\r
+ ssize_t result = 0;\r
+\r
+ if (isatty(fd)) {\r
+ for (current = (uint8_t *)ptr;\r
+ (current < ((uint8_t *)ptr) + len) && (*uart_rx_cnt > 0);\r
+ current ++) {\r
+ *current = *uart_rx;\r
+ result++;\r
+ }\r
+ return result;\r
+ }\r
+\r
+ return _stub(EBADF);\r
+}\r
+weak_under_alias(read);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <stddef.h>\r
+#include "weak_under_alias.h"\r
+\r
+void *__wrap_sbrk(ptrdiff_t incr)\r
+{\r
+ extern char _end[];\r
+ extern char _heap_end[];\r
+ static char *curbrk = _end;\r
+\r
+ if ((curbrk + incr < _end) || (curbrk + incr > _heap_end))\r
+ return NULL - 1;\r
+\r
+ curbrk += incr;\r
+ return curbrk - incr;\r
+}\r
+weak_under_alias(sbrk);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include <sys/stat.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_stat(const char* file, struct stat* st)\r
+{\r
+ return _stub(EACCES);\r
+}\r
+weak_under_alias(stat);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+#ifndef _SIFIVE_SYS_STUB_H\r
+#define _SIFIVE_SYS_STUB_H\r
+\r
+static inline int _stub(int err)\r
+{\r
+ return -1;\r
+}\r
+\r
+#endif /* _SIFIVE_SYS_STUB_H */\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include <sys/times.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+clock_t __wrap_times(struct tms* buf)\r
+{\r
+ return _stub(EACCES);\r
+}\r
+weak_under_alias(times);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+int __wrap_unlink(const char* name)\r
+{\r
+ return _stub(ENOENT);\r
+}\r
+weak_under_alias(unlink);\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <errno.h>\r
+#include "stub.h"\r
+\r
+int wait(int* status)\r
+{\r
+ return _stub(ECHILD);\r
+}\r
--- /dev/null
+#ifndef _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H\r
+#define _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H\r
+\r
+#define weak_under_alias(name) \\r
+ extern __typeof (__wrap_##name) __wrap__##name __attribute__ ((weak, alias ("__wrap_"#name)))\r
+\r
+#endif\r
--- /dev/null
+/* See LICENSE of license details. */\r
+\r
+#include <stdint.h>\r
+#include <errno.h>\r
+#include <unistd.h>\r
+#include <sys/types.h>\r
+\r
+#include "platform.h"\r
+#include "stub.h"\r
+#include "weak_under_alias.h"\r
+\r
+ssize_t __wrap_write(int fd, const void* ptr, size_t len)\r
+{\r
+ const uint8_t * current = (const uint8_t *)ptr;\r
+\r
+ if (isatty(fd)) {\r
+ for (size_t jj = 0; jj < len; jj++) {\r
+ while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
+ UART0_REG(UART_REG_TXFIFO) = current[jj];\r
+\r
+ if (current[jj] == '\n') {\r
+ while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
+ UART0_REG(UART_REG_TXFIFO) = '\r';\r
+ }\r
+ }\r
+ return len;\r
+ }\r
+\r
+ return _stub(EBADF);\r
+}\r
+weak_under_alias(write);\r
--- /dev/null
+/*\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
+\r
+ .extern ulRegTest1LoopCounter\r
+ .extern ulRegTest2LoopCounter\r
+\r
+ .global vRegTest1Implementation\r
+ .global vRegTest2Implementation\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The register check tasks are described in the comments at the top of\r
+ * main_full.c.\r
+ */\r
+\r
+.align( 8 )\r
+vRegTest1Implementation:\r
+\r
+ /* Fill the core registers with known values. */\r
+ li x5, 0x5\r
+ li x6, 0x6\r
+ li x7, 0x7\r
+ li x8, 0x8\r
+ li x9, 0x9\r
+ li x10, 0xa\r
+ li x11, 0xb\r
+ li x12, 0xc\r
+ li x13, 0xd\r
+ li x14, 0xe\r
+ li x15, 0xf\r
+ li x16, 0x10\r
+ li x17, 0x11\r
+ li x18, 0x12\r
+ li x19, 0x13\r
+ li x20, 0x14\r
+ li x21, 0x15\r
+ li x22, 0x16\r
+ li x23, 0x17\r
+ li x24, 0x18\r
+ li x25, 0x19\r
+ li x26, 0x1a\r
+ li x27, 0x1b\r
+ li x28, 0x1c\r
+ li x29, 0x1d\r
+ li x30, 0x1e\r
+\r
+reg1_loop:\r
+\r
+ /* Check each register still contains the expected known value.\r
+ vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation\r
+ uses x5 as the temporary. */\r
+ li x31, 0x5\r
+ bne x31, x5, reg1_error_loop\r
+ li x31, 0x6\r
+ bne x31, x6, reg1_error_loop\r
+ li x31, 0x7\r
+ bne x31, x7, reg1_error_loop\r
+ li x31, 0x8\r
+ bne x31, x8, reg1_error_loop\r
+ li x31, 0x9\r
+ bne x31, x9, reg1_error_loop\r
+ li x31, 0xa\r
+ bne x31, x10, reg1_error_loop\r
+ li x31, 0xb\r
+ bne x31, x11, reg1_error_loop\r
+ li x31, 0xc\r
+ bne x31, x12, reg1_error_loop\r
+ li x31, 0xd\r
+ bne x31, x13, reg1_error_loop\r
+ li x31, 0xe\r
+ bne x31, x14, reg1_error_loop\r
+ li x31, 0xf\r
+ bne x31, x15, reg1_error_loop\r
+ li x31, 0x10\r
+ bne x31, x16, reg1_error_loop\r
+ li x31, 0x11\r
+ bne x31, x17, reg1_error_loop\r
+ li x31, 0x12\r
+ bne x31, x18, reg1_error_loop\r
+ li x31, 0x13\r
+ bne x31, x19, reg1_error_loop\r
+ li x31, 0x14\r
+ bne x31, x20, reg1_error_loop\r
+ li x31, 0x15\r
+ bne x31, x21, reg1_error_loop\r
+ li x31, 0x16\r
+ bne x31, x22, reg1_error_loop\r
+ li x31, 0x17\r
+ bne x31, x23, reg1_error_loop\r
+ li x31, 0x18\r
+ bne x31, x24, reg1_error_loop\r
+ li x31, 0x19\r
+ bne x31, x25, reg1_error_loop\r
+ li x31, 0x1a\r
+ bne x31, x26, reg1_error_loop\r
+ li x31, 0x1b\r
+ bne x31, x27, reg1_error_loop\r
+ li x31, 0x1c\r
+ bne x31, x28, reg1_error_loop\r
+ li x31, 0x1d\r
+ bne x31, x29, reg1_error_loop\r
+ li x31, 0x1e\r
+ bne x31, x30, reg1_error_loop\r
+\r
+ /* Everything passed, increment the loop counter. */\r
+ lw x31, ulRegTest1LoopCounterConst\r
+ lw x30, 0(x31)\r
+ addi x30, x30, 1\r
+ sw x30, 0(x31)\r
+\r
+ /* Restore clobbered register reading for next loop. */\r
+ li x30, 0x1e\r
+\r
+ /* Yield to increase code coverage. */\r
+ ecall\r
+\r
+ /* Start again. */\r
+ jal reg1_loop\r
+\r
+reg1_error_loop:\r
+ /* Jump here if a register contains an uxpected value. This stops the loop\r
+ counter being incremented so the check task knows an error was found. */\r
+ ebreak\r
+ jal reg1_error_loop\r
+\r
+.align( 16 )\r
+ulRegTest1LoopCounterConst: .word ulRegTest1LoopCounter\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+.align( 8 )\r
+vRegTest2Implementation:\r
+\r
+ /* Fill the core registers with known values. */\r
+ li x6, 0x61\r
+ li x7, 0x71\r
+ li x8, 0x81\r
+ li x9, 0x91\r
+ li x10, 0xa1\r
+ li x11, 0xb1\r
+ li x12, 0xc1\r
+ li x13, 0xd1\r
+ li x14, 0xe1\r
+ li x15, 0xf1\r
+ li x16, 0x20\r
+ li x17, 0x21\r
+ li x18, 0x22\r
+ li x19, 0x23\r
+ li x20, 0x24\r
+ li x21, 0x25\r
+ li x22, 0x26\r
+ li x23, 0x27\r
+ li x24, 0x28\r
+ li x25, 0x29\r
+ li x26, 0x2a\r
+ li x27, 0x2b\r
+ li x28, 0x2c\r
+ li x29, 0x2d\r
+ li x30, 0x2e\r
+ li x31, 0x2f\r
+\r
+Reg2_loop:\r
+\r
+ /* Check each register still contains the expected known value.\r
+ vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation\r
+ uses x31 as the temporary. */\r
+ li x5, 0x61\r
+ bne x5, x6, reg2_error_loop\r
+ li x5, 0x71\r
+ bne x5, x7, reg2_error_loop\r
+ li x5, 0x81\r
+ bne x5, x8, reg2_error_loop\r
+ li x5, 0x91\r
+ bne x5, x9, reg2_error_loop\r
+ li x5, 0xa1\r
+ bne x5, x10, reg2_error_loop\r
+ li x5, 0xb1\r
+ bne x5, x11, reg2_error_loop\r
+ li x5, 0xc1\r
+ bne x5, x12, reg2_error_loop\r
+ li x5, 0xd1\r
+ bne x5, x13, reg2_error_loop\r
+ li x5, 0xe1\r
+ bne x5, x14, reg2_error_loop\r
+ li x5, 0xf1\r
+ bne x5, x15, reg2_error_loop\r
+ li x5, 0x20\r
+ bne x5, x16, reg2_error_loop\r
+ li x5, 0x21\r
+ bne x5, x17, reg2_error_loop\r
+ li x5, 0x22\r
+ bne x5, x18, reg2_error_loop\r
+ li x5, 0x23\r
+ bne x5, x19, reg2_error_loop\r
+ li x5, 0x24\r
+ bne x5, x20, reg2_error_loop\r
+ li x5, 0x25\r
+ bne x5, x21, reg2_error_loop\r
+ li x5, 0x26\r
+ bne x5, x22, reg2_error_loop\r
+ li x5, 0x27\r
+ bne x5, x23, reg2_error_loop\r
+ li x5, 0x28\r
+ bne x5, x24, reg2_error_loop\r
+ li x5, 0x29\r
+ bne x5, x25, reg2_error_loop\r
+ li x5, 0x2a\r
+ bne x5, x26, reg2_error_loop\r
+ li x5, 0x2b\r
+ bne x5, x27, reg2_error_loop\r
+ li x5, 0x2c\r
+ bne x5, x28, reg2_error_loop\r
+ li x5, 0x2d\r
+ bne x5, x29, reg2_error_loop\r
+ li x5, 0x2e\r
+ bne x5, x30, reg2_error_loop\r
+ li x5, 0x2f\r
+ bne x5, x31, reg2_error_loop\r
+\r
+ /* Everything passed, increment the loop counter. */\r
+ lw x5, ulRegTest2LoopCounterConst\r
+ lw x6, 0(x5)\r
+ addi x6, x6, 1\r
+ sw x6, 0(x5)\r
+\r
+ /* Restore clobbered register reading for next loop. */\r
+ li x6, 0x61\r
+\r
+ /* Start again. */\r
+ jal Reg2_loop\r
+\r
+reg2_error_loop:\r
+ /* Jump here if a register contains an uxpected value. This stops the loop\r
+ counter being incremented so the check task knows an error was found. */\r
+ ebreak\r
+ jal reg2_error_loop\r
+\r
+.align( 16 )\r
+ulRegTest2LoopCounterConst: .word ulRegTest2LoopCounter\r
+\r
+\r
--- /dev/null
+/*\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
+\r
+/******************************************************************************\r
+ * NOTE 1: This project provides two demo applications. A simple blinky style\r
+ * project, and a more comprehensive test and demo application. The\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
+ * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
+ * in main.c. This file implements the comprehensive test and demo version.\r
+ *\r
+ * NOTE 2: This file only contains the source code that is specific to the\r
+ * full demo. Generic functions, such FreeRTOS hook functions, and functions\r
+ * required to configure the hardware, are defined in main.c.\r
+ *\r
+ ******************************************************************************\r
+ *\r
+ * main_full() creates all the demo application tasks and software timers, then\r
+ * starts the scheduler. The web documentation provides more details of the\r
+ * standard demo application tasks, which provide no particular functionality,\r
+ * but do provide a good example of how to use the FreeRTOS API.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks and tests are\r
+ * defined and/or created within this file:\r
+ *\r
+ * "Reg test" tasks - These fill both the core registers with known values, then\r
+ * check that each register maintains its expected value for the lifetime of the\r
+ * task. Each task uses a different set of values. The reg test tasks execute\r
+ * with a very low priority, so get preempted very frequently. A register\r
+ * containing an unexpected value is indicative of an error in the context\r
+ * switching mechanism.\r
+ *\r
+ * "Check" task - The check executes every five seconds. It checks that all\r
+ * the standard demo tasks, and the register check tasks, are not only still\r
+ * executing, but are executing without reporting any errors. If the check task\r
+ * discovers that a task has either stalled, or reported an error, then it\r
+ * prints an error message to the UART, otherwise it prints "Pass" followed\r
+ * by an additional period (".") after each successful loop of its implementing\r
+ * function.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "timers.h"\r
+#include "semphr.h"\r
+\r
+/* Standard demo application includes. */\r
+#include "dynamic.h"\r
+#include "blocktim.h"\r
+#include "GenQTest.h"\r
+#include "recmutex.h"\r
+#include "TimerDemo.h"\r
+#include "EventGroupsDemo.h"\r
+#include "TaskNotify.h"\r
+\r
+/* SiFive includes. */\r
+#include "platform.h"\r
+#include "encoding.h"\r
+#include "unistd.h"\r
+\r
+/* Priorities for the demo application tasks. */\r
+#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
+\r
+/* The period of the check task, in ms, converted to ticks using the\r
+pdMS_TO_TICKS() macro. */\r
+#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 5000UL )\r
+\r
+/* Parameters that are passed into the register check tasks solely for the\r
+purpose of ensuring parameters are passed into tasks correctl5. */\r
+#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )\r
+#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )\r
+\r
+/* The base period used by the timer test tasks. */\r
+#define mainTIMER_TEST_PERIOD ( 50 )\r
+\r
+/* The size of the stack allocated to the check task (as described in the\r
+comments at the top of this file. */\r
+#define mainCHECK_TASK_STACK_SIZE_WORDS 85\r
+\r
+/* Size of the stacks to allocated for the register check tasks. */\r
+#define mainREG_TEST_STACK_SIZE_WORDS 50\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Called by main() to run the full demo (as opposed to the blinky demo) when\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
+ */\r
+void main_full( void );\r
+\r
+/*\r
+ * The check task, as described at the top of this file.\r
+ */\r
+static void prvCheckTask( void *pvParameters );\r
+\r
+/*\r
+ * Register check tasks as described at the top of this file. The nature of\r
+ * these files necessitates that they are written in an assembly file, but the\r
+ * entry points are kept in the C file for the convenience of checking the task\r
+ * parameter.\r
+ */\r
+static void prvRegTestTaskEntry1( void *pvParameters );\r
+extern void vRegTest1Implementation( void );\r
+static void prvRegTestTaskEntry2( void *pvParameters );\r
+extern void vRegTest2Implementation( void );\r
+\r
+/*\r
+ * Tick hook used by the full demo, which includes code that interacts with\r
+ * some of the tests.\r
+ */\r
+void vFullDemoTickHook( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The following two variables are used to communicate the status of the\r
+register check tasks to the check task. If the variables keep incrementing,\r
+then the register check tasks have not discovered any errors. If a variable\r
+stops incrementing, then an error has been found. */\r
+volatile uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main_full( void )\r
+{\r
+ /* Create the register check tasks, as described at the top of this file.\r
+ Use xTaskCreateStatic() to create a task using only statically allocated\r
+ memory. */\r
+ xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */\r
+ "Reg1", /* The name of the task. */\r
+ mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */\r
+ mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */\r
+ tskIDLE_PRIORITY, /* Priority of the task. */\r
+ NULL ); /* Can be used to pass out a handle to the created task. */\r
+ xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+\r
+ /* Start all the other standard demo/test tasks. They have no particular\r
+ functionality, but do demonstrate how to use the FreeRTOS API and test the\r
+ kernel port. */\r
+ vStartDynamicPriorityTasks();\r
+ vCreateBlockTimeTasks();\r
+ vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
+ vStartRecursiveMutexTasks();\r
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+ vStartEventGroupTasks();\r
+ vStartTaskNotifyTask();\r
+\r
+ /* Create the task that performs the 'check' functionality, as described at\r
+ the top of this file. */\r
+ xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+ /* Start the scheduler. */\r
+ vTaskStartScheduler();\r
+\r
+ /* If all is well, the scheduler will now be running, and the following\r
+ line will never be reached. If the following line does execute, then\r
+ there was insufficient FreeRTOS heap memory available for the Idle and/or\r
+ timer tasks to be created. See the memory management section on the\r
+ FreeRTOS web site for more details on the FreeRTOS heap\r
+ http://www.freertos.org/a00111.html. */\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCheckTask( void *pvParameters )\r
+{\r
+const TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
+TickType_t xLastExecutionTime;\r
+static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
+const char * const pcPassMessage = "Pass";\r
+const char * pcStatusMessage = ".";\r
+extern void vSendString( const char * pcString );\r
+\r
+ /* Just to stop compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
+ works correctly. */\r
+ xLastExecutionTime = xTaskGetTickCount();\r
+\r
+ /* Cycle for ever, delaying then checking all the other tasks are still\r
+ operating without error. The onboard LED is toggled on each iteration.\r
+ If an error is detected then the delay period is decreased from\r
+ mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the\r
+ effect of increasing the rate at which the onboard LED toggles, and in so\r
+ doing gives visual feedback of the system status. */\r
+ for( ;; )\r
+ {\r
+ /* Delay until it is time to execute again. */\r
+ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
+\r
+ /* Check all the demo tasks (other than the flash tasks) to ensure\r
+ that they are all still running, and that none have detected an error. */\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n";\r
+ }\r
+\r
+ if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "ERROR: Block time demo/tests.\r\n";\r
+ }\r
+\r
+ if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n";\r
+ }\r
+\r
+ if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n";\r
+ }\r
+\r
+ if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )\r
+ {\r
+ pcStatusMessage = "ERROR: Timer demo/tests.\r\n";\r
+ }\r
+\r
+ if( xAreEventGroupTasksStillRunning() != pdPASS )\r
+ {\r
+ pcStatusMessage = "ERROR: Event group demo/tests.\r\n";\r
+ }\r
+\r
+ if( xAreTaskNotificationTasksStillRunning() != pdPASS )\r
+ {\r
+ pcStatusMessage = "ERROR: Task notification demo/tests.\r\n";\r
+ }\r
+\r
+ /* Check that the register test 1 task is still running. */\r
+ if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
+ {\r
+ pcStatusMessage = "ERROR: Register test 1.\r\n";\r
+ }\r
+ ulLastRegTest1Value = ulRegTest1LoopCounter;\r
+\r
+ /* Check that the register test 2 task is still running. */\r
+ if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
+ {\r
+ pcStatusMessage = "ERROR: Register test 2.\r\n";\r
+ }\r
+ ulLastRegTest2Value = ulRegTest2LoopCounter;\r
+\r
+ /* Write the status message to the UART. */\r
+ vSendString( pcStatusMessage );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry1( void *pvParameters )\r
+{\r
+ /* Although the regtest task is written in assembler, its entry point is\r
+ written in C for convenience of checking the task parameter is being passed\r
+ in correctly. */\r
+ if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )\r
+ {\r
+ /* Start the part of the test that is written in assembler. */\r
+ vRegTest1Implementation();\r
+ }\r
+\r
+ /* The following line will only execute if the task parameter is found to\r
+ be incorrect. The check task will detect that the regtest loop counter is\r
+ not being incremented and flag an error. */\r
+ vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry2( void *pvParameters )\r
+{\r
+ /* Although the regtest task is written in assembler, its entry point is\r
+ written in C for convenience of checking the task parameter is being passed\r
+ in correctly. */\r
+ if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )\r
+ {\r
+ /* Start the part of the test that is written in assembler. */\r
+ vRegTest2Implementation();\r
+ }\r
+\r
+ /* The following line will only execute if the task parameter is found to\r
+ be incorrect. The check task will detect that the regtest loop counter is\r
+ not being incremented and flag an error. */\r
+ vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vFullDemoTickHook( void )\r
+{\r
+ /* Called from vApplicationTickHook() when the project is configured to\r
+ build the full demo. */\r
+ vTimerPeriodicISRTests();\r
+ vPeriodicEventGroupsProcessing();\r
+ xNotifyTaskFromISR();\r
+}\r
--- /dev/null
+/*\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
+\r
+/* FreeRTOS kernel includes. */\r
+#include <FreeRTOS.h>\r
+#include <task.h>\r
+\r
+/******************************************************************************\r
+ * This project provides two demo applications. A simple blinky style project,\r
+ * and a more comprehensive test and demo application. The\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to\r
+ * select between the two. The simply blinky demo is implemented and described\r
+ * in main_blinky.c. The more comprehensive test and demo application is\r
+ * implemented and described in main_full.c.\r
+ *\r
+ * This file implements the code that is not demo specific, including the\r
+ * hardware setup and standard FreeRTOS hook functions.\r
+ *\r
+ * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
+ * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
+ * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!\r
+ *\r
+ *\r
+ * NOTE 1:\r
+ *\r
+ * This project has only been tested in the QEMU emulation of the HiFive board\r
+ * from SiFive.\r
+ *\r
+ * Start QEMU using the following command line:\r
+ *\r
+ * [your_path_1]\qemu-system-riscv32 -kernel [your_path_2]\FreeRTOS\Demo\RISC-V-Qemu-sifive_e-FreedomStudio\Debug\RTOSDemo.elf -S -s -machine sifive_e\r
+ *\r
+ * Where [your_path_1] must be replaced with the correct path to your QEMU\r
+ * installation and the elf file generated by this project respectively.\r
+ *\r
+ *\r
+ * NOTE 2:\r
+ *\r
+ * Start GDB using the following command line (this can be entered in the\r
+ * Eclipse Debug Launch Configuration dialogue):\r
+ *\r
+ * riscv64-unknown-elf-gdb.exe -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off"\r
+ *\r
+ *\r
+ * Note 3:\r
+ *\r
+ * Status information is sent to the QEMU serial console.\r
+ */\r
+\r
+/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
+or 0 to run the more comprehensive test and demo application. */\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
+\r
+/*\r
+ * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
+ * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
+ */\r
+#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
+ extern void main_blinky( void );\r
+#else\r
+ extern void main_full( void );\r
+#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
+\r
+/*\r
+ * Prototypes for the standard FreeRTOS callback/hook functions implemented\r
+ * within this file. See https://www.freertos.org/a00016.html\r
+ */\r
+void vApplicationMallocFailedHook( void );\r
+void vApplicationIdleHook( void );\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
+void vApplicationTickHook( void );\r
+\r
+/*\r
+ * Very simply polling write to the UART. The full demo only writes single\r
+ * characters at a time so as not to disrupt the timing of the test and demo\r
+ * tasks.\r
+ */\r
+void vSendString( const char * pcString );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+int main( void )\r
+{\r
+ vSendString( "Starting" );\r
+\r
+ /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top\r
+ of this file. */\r
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
+ {\r
+ main_blinky();\r
+ }\r
+ #else\r
+ {\r
+ main_full();\r
+ }\r
+ #endif\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationMallocFailedHook( void )\r
+{\r
+ /* vApplicationMallocFailedHook() will only be called if\r
+ configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook\r
+ function that will get called if a call to pvPortMalloc() fails.\r
+ pvPortMalloc() is called internally by the kernel whenever a task, queue,\r
+ timer or semaphore is created. It is also called by various parts of the\r
+ demo application. If heap_1.c or heap_2.c are used, then the size of the\r
+ heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in\r
+ FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
+ to query the size of free heap space that remains (although it does not\r
+ provide information on how the remaining heap might be fragmented). */\r
+ taskDISABLE_INTERRUPTS();\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationIdleHook( void )\r
+{\r
+ /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set\r
+ to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle\r
+ task. It is essential that code added to this hook function never attempts\r
+ to block in any way (for example, call xQueueReceive() with a block time\r
+ specified, or call vTaskDelay()). If the application makes use of the\r
+ vTaskDelete() API function (as this demo application does) then it is also\r
+ important that vApplicationIdleHook() is permitted to return to its calling\r
+ function, because it is the responsibility of the idle task to clean up\r
+ memory allocated by the kernel to any task that has since been deleted. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
+{\r
+ ( void ) pcTaskName;\r
+ ( void ) pxTask;\r
+\r
+ /* Run time stack overflow checking is performed if\r
+ configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
+ function is called if a stack overflow is detected. */\r
+ taskDISABLE_INTERRUPTS();\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationTickHook( void )\r
+{\r
+ /* The tests in the full demo expect some interaction with interrupts. */\r
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )\r
+ {\r
+ extern void vFullDemoTickHook( void );\r
+ vFullDemoTickHook();\r
+ }\r
+ #endif\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vAssertCalled( void )\r
+{\r
+volatile uint32_t ulSetTo1ToExitFunction = 0;\r
+\r
+ taskDISABLE_INTERRUPTS();\r
+ while( ulSetTo1ToExitFunction != 1 )\r
+ {\r
+ __asm volatile( "NOP" );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSendString( const char * pcString )\r
+{\r
+ while( *pcString != 0x00 )\r
+ {\r
+ while( UART0_REG( UART_REG_TXFIFO ) & 0x80000000 );\r
+ UART0_REG( UART_REG_TXFIFO ) = *pcString;\r
+ *pcString++;\r
+ }\r
+}\r
+\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">\r
- <storageModule moduleId="org.eclipse.cdt.core.settings">\r
- <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252">\r
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" moduleId="org.eclipse.cdt.core.settings" name="Debug">\r
- <externalSettings/>\r
- <extensions>\r
- <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>\r
- <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
- <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
- <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
- <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>\r
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
- </extensions>\r
- </storageModule>\r
- <storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
- <configuration artifactName="${ProjName}.elf" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="cdt.managedbuild.config.gnu.cross.exe.debug">\r
- <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252." name="/" resourcePath="">\r
- <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.789129042" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">\r
- <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2002050800" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>\r
- <builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="cdt.managedbuild.builder.gnu.cross.948905772" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>\r
- <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.compiler.533761585" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">\r
- <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1982035836" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
- <option defaultValue="gnu.c.debugging.level.max" id="gnu.c.compiler.option.debugging.level.100403442" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
- <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1552631522" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/full_demo/standard_demo_tasks/include}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/env}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/include}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/env/freedom-e300-hifive1}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/include}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V}""/>\r
- </option>\r
- <option id="gnu.c.compiler.option.misc.other.1598749994" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections --specs=nano.specs -fno-builtin-printf" valueType="string"/>\r
- <option id="gnu.c.compiler.option.warnings.extrawarn.527816261" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
- <option id="gnu.c.compiler.option.dialect.std.1770102192" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>\r
- <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.252676358" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">\r
- <listOptionValue builtIn="false" value="DONT_USE_PLIC"/>\r
- <listOptionValue builtIn="false" value="DONT_USE_M_TIME"/>\r
- </option>\r
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1494581004" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>\r
- </tool>\r
- <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.421489488" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">\r
- <option id="gnu.cpp.compiler.option.optimization.level.468217435" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>\r
- <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="gnu.cpp.compiler.option.debugging.level.1238097403" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" valueType="enumerated"/>\r
- </tool>\r
- <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.linker.25704515" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">\r
- <option id="gnu.c.link.option.nostart.547444896" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
- <option id="gnu.c.link.option.ldflags.385740302" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="--specs=nano.specs -Xlinker --gc-sections -Wl,-Map,RTOSDemo.map -T../freedom-e-sdk/env/freedom-e300-hifive1/flash.lds -march=rv32imac -mabi=ilp32 -mcmodel=medlow -Xlinker --defsym=__stack_size=400 -Wl,--start-group -Wl,--end-group -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=open -Wl,--wrap=lseek -Wl,--wrap=read -Wl,--wrap=write -Wl,--wrap=fstat -Wl,--wrap=stat -Wl,--wrap=close -Wl,--wrap=link -Wl,--wrap=unlink -Wl,--wrap=execve -Wl,--wrap=fork -Wl,--wrap=getpid -Wl,--wrap=kill -Wl,--wrap=wait -Wl,--wrap=isatty -Wl,--wrap=times -Wl,--wrap=sbrk -Wl,--wrap=_exit -Wl,--wrap=puts -Wl,--wrap=_malloc -Wl,--wrap=_free -Wl,--wrap=_open -Wl,--wrap=_lseek -Wl,--wrap=_read -Wl,--wrap=_write -Wl,--wrap=_fstat -Wl,--wrap=_stat -Wl,--wrap=_close -Wl,--wrap=_link -Wl,--wrap=_unlink -Wl,--wrap=_execve -Wl,--wrap=_fork -Wl,--wrap=_getpid -Wl,--wrap=_kill -Wl,--wrap=_wait -Wl,--wrap=_isatty -Wl,--wrap=_times -Wl,--wrap=_sbrk -Wl,--wrap=__exit -Wl,--wrap=_puts" valueType="string"/>\r
- <option id="gnu.c.link.option.nostdlibs.1587538414" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>\r
- <option id="gnu.c.link.option.nodeflibs.49453984" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>\r
- <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1563926647" superClass="cdt.managedbuild.tool.gnu.c.linker.input">\r
- <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>\r
- <additionalInput kind="additionalinput" paths="$(LIBS)"/>\r
- </inputType>\r
- </tool>\r
- <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1074348850" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>\r
- <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1004176495" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>\r
- <tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.assembler.1968317442" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">\r
- <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1729858113" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions}""/>\r
- <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-e-sdk/include}""/>\r
- </option>\r
- <option id="gnu.both.asm.option.flags.1595900562" name="Assembler flags" superClass="gnu.both.asm.option.flags" useByScannerDiscovery="false" value="-march=rv32imac -mabi=ilp32 -mcmodel=medlow -c -DportasmHANDLE_INTERRUPT=handle_trap -g3" valueType="string"/>\r
- <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1322122265" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>\r
- </tool>\r
- </toolChain>\r
- </folderInfo>\r
- <sourceEntries>\r
- <entry excluding="freedom-e-sdk/drivers" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
- </sourceEntries>\r
- </configuration>\r
- </storageModule>\r
- <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>\r
- </cconfiguration>\r
- </storageModule>\r
- <storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
- <project id="RTOSDemo.cdt.managedbuild.target.gnu.cross.exe.103083601" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>\r
- </storageModule>\r
- <storageModule moduleId="scannerConfiguration">\r
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>\r
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.244253252;cdt.managedbuild.config.gnu.cross.exe.debug.244253252.;cdt.managedbuild.tool.gnu.cross.c.compiler.533761585;cdt.managedbuild.tool.gnu.c.compiler.input.1494581004">\r
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>\r
- </scannerConfigBuildInfo>\r
- </storageModule>\r
- <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>\r
- <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>\r
- <storageModule moduleId="refreshScope" versionNumber="2">\r
- <configuration configurationName="Debug">\r
- <resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>\r
- </configuration>\r
- </storageModule>\r
-</cproject>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
- <name>RTOSDemo</name>\r
- <comment></comment>\r
- <projects>\r
- </projects>\r
- <buildSpec>\r
- <buildCommand>\r
- <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>\r
- <triggers>clean,full,incremental,</triggers>\r
- <arguments>\r
- </arguments>\r
- </buildCommand>\r
- <buildCommand>\r
- <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>\r
- <triggers>full,incremental,</triggers>\r
- <arguments>\r
- </arguments>\r
- </buildCommand>\r
- </buildSpec>\r
- <natures>\r
- <nature>org.eclipse.cdt.core.cnature</nature>\r
- <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>\r
- <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>\r
- </natures>\r
- <linkedResources>\r
- <link>\r
- <name>freertos_source</name>\r
- <type>2</type>\r
- <locationURI>virtual:/virtual</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/event_groups.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/event_groups.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/include</name>\r
- <type>2</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/include</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/list.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/list.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/portable</name>\r
- <type>2</type>\r
- <locationURI>virtual:/virtual</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/queue.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/queue.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/stream_buffer.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/stream_buffer.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/tasks.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/tasks.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/timers.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/timers.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks</name>\r
- <type>2</type>\r
- <locationURI>virtual:/virtual</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/portable/GCC</name>\r
- <type>2</type>\r
- <locationURI>virtual:/virtual</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/portable/MemMang</name>\r
- <type>2</type>\r
- <locationURI>virtual:/virtual</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/EventGroupsDemo.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/GenQTest.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/GenQTest.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/TaskNotify.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TaskNotify.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/TimerDemo.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TimerDemo.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/blocktim.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/blocktim.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/dynamic.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/dynamic.c</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/include</name>\r
- <type>2</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/include</locationURI>\r
- </link>\r
- <link>\r
- <name>full_demo/standard_demo_tasks/recmutex.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/recmutex.c</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/portable/GCC/RISC-V</name>\r
- <type>2</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/portable/GCC/RISC-V</locationURI>\r
- </link>\r
- <link>\r
- <name>freertos_source/portable/MemMang/heap_4.c</name>\r
- <type>1</type>\r
- <locationURI>FREERTOS_ROOT/FreeRTOS/Source/portable/MemMang/heap_4.c</locationURI>\r
- </link>\r
- </linkedResources>\r
- <filteredResources>\r
- <filter>\r
- <id>1571146760235</id>\r
- <name>freertos_source/portable/GCC/RISC-V/chip_specific_extensions</name>\r
- <type>9</type>\r
- <matcher>\r
- <id>org.eclipse.ui.ide.multiFilter</id>\r
- <arguments>1.0-name-matches-false-false-RV32I_CLINT_no_extensions</arguments>\r
- </matcher>\r
- </filter>\r
- </filteredResources>\r
- <variableList>\r
- <variable>\r
- <name>FREERTOS_ROOT</name>\r
- <value>$%7BPARENT-3-PROJECT_LOC%7D</value>\r
- </variable>\r
- </variableList>\r
-</projectDescription>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<project>\r
- <configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.244253252" name="Debug">\r
- <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">\r
- <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>\r
- <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>\r
- <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
- <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-564276645149001" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">\r
- <language-scope id="org.eclipse.cdt.core.gcc"/>\r
- <language-scope id="org.eclipse.cdt.core.g++"/>\r
- </provider>\r
- </extension>\r
- </configuration>\r
-</project>\r
+++ /dev/null
-[{000214A0-0000-0000-C000-000000000046}]\r
-Prop3=19,11\r
-[InternetShortcut]\r
-IDList=\r
-URL=https://freertos.org/RTOS-RISC-V-FreedomStudio-QMEU.html\r
+++ /dev/null
-/*\r
- FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
- All rights reserved\r
-\r
- VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
-\r
- This file is part of the FreeRTOS distribution.\r
-\r
- FreeRTOS is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License (version 2) as published by the\r
- Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
-\r
- ***************************************************************************\r
- >>! NOTE: The modification to the GPL is included to allow you to !<<\r
- >>! distribute a combined work that includes FreeRTOS without being !<<\r
- >>! obliged to provide the source code for proprietary components !<<\r
- >>! outside of the FreeRTOS kernel. !<<\r
- ***************************************************************************\r
-\r
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
- link: http://www.freertos.org/a00114.html\r
-\r
- ***************************************************************************\r
- * *\r
- * FreeRTOS provides completely free yet professionally developed, *\r
- * robust, strictly quality controlled, supported, and cross *\r
- * platform software that is more than just the market leader, it *\r
- * is the industry's de facto standard. *\r
- * *\r
- * Help yourself get started quickly while simultaneously helping *\r
- * to support the FreeRTOS project by purchasing a FreeRTOS *\r
- * tutorial book, reference manual, or both: *\r
- * http://www.FreeRTOS.org/Documentation *\r
- * *\r
- ***************************************************************************\r
-\r
- http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
- the FAQ page "My application does not run, what could be wrong?". Have you\r
- defined configASSERT()?\r
-\r
- http://www.FreeRTOS.org/support - In return for receiving this top quality\r
- embedded software for free we request you assist our global community by\r
- participating in the support forum.\r
-\r
- http://www.FreeRTOS.org/training - Investing in training allows your team to\r
- be as productive as possible as early as possible. Now you can receive\r
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
- Ltd, and the world's leading authority on the world's leading RTOS.\r
-\r
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
- including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
- compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
-\r
- http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
- Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
-\r
- http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
- Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
- licenses offer ticketed support, indemnification and commercial middleware.\r
-\r
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
- engineered and independently SIL3 certified version for use in safety and\r
- mission critical applications that require provable dependability.\r
-\r
- 1 tab == 4 spaces!\r
-*/\r
-\r
-\r
-#ifndef FREERTOS_CONFIG_H\r
-#define FREERTOS_CONFIG_H\r
-\r
-#include "platform.h"\r
-\r
-/*\r
- * For some reason the standard demo timer demo/test tasks fail when executing\r
- * in QEMU, although they pass on other RISC-V platforms. This requires\r
- * further investigation, but for now, defining _WINDOWS_ has the effect of\r
- * using the wider timer test thresholds that are normally only used when the\r
- * tests are used with the FreeRTOS Windows port (which is not deterministic\r
- * and therefore requires wider margins).\r
- */\r
-#define _WINDOWS_\r
-\r
-/*-----------------------------------------------------------\r
- * Application specific definitions.\r
- *\r
- * These definitions should be adjusted for your particular hardware and\r
- * application requirements.\r
- *\r
- * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
- *\r
- * See http://www.freertos.org/a00110.html.\r
- *----------------------------------------------------------*/\r
-\r
-#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR\r
-#define configUSE_PREEMPTION 1\r
-#define configUSE_IDLE_HOOK 0\r
-#define configUSE_TICK_HOOK 1\r
-#define configCPU_CLOCK_HZ ( 10000000 ) /*QEMU*/\r
-#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )\r
-#define configMAX_PRIORITIES ( 7 )\r
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) 14500 )\r
-#define configMAX_TASK_NAME_LEN ( 16 )\r
-#define configUSE_TRACE_FACILITY 0\r
-#define configUSE_16_BIT_TICKS 0\r
-#define configIDLE_SHOULD_YIELD 0\r
-#define configUSE_MUTEXES 1\r
-#define configQUEUE_REGISTRY_SIZE 8\r
-#define configCHECK_FOR_STACK_OVERFLOW 2\r
-#define configUSE_RECURSIVE_MUTEXES 1\r
-#define configUSE_MALLOC_FAILED_HOOK 1\r
-#define configUSE_APPLICATION_TASK_TAG 0\r
-#define configUSE_COUNTING_SEMAPHORES 1\r
-#define configGENERATE_RUN_TIME_STATS 0\r
-#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
-\r
-/* Co-routine definitions. */\r
-#define configUSE_CO_ROUTINES 0\r
-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
-\r
-/* Software timer definitions. */\r
-#define configUSE_TIMERS 1\r
-#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
-#define configTIMER_QUEUE_LENGTH 4\r
-#define configTIMER_TASK_STACK_DEPTH ( 120 )\r
-\r
-/* Task priorities. Allow these to be overridden. */\r
-#ifndef uartPRIMARY_PRIORITY\r
- #define uartPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )\r
-#endif\r
-\r
-/* Set the following definitions to 1 to include the API function, or zero\r
-to exclude the API function. */\r
-#define INCLUDE_vTaskPrioritySet 1\r
-#define INCLUDE_uxTaskPriorityGet 1\r
-#define INCLUDE_vTaskDelete 1\r
-#define INCLUDE_vTaskCleanUpResources 1\r
-#define INCLUDE_vTaskSuspend 1\r
-#define INCLUDE_vTaskDelayUntil 1\r
-#define INCLUDE_vTaskDelay 1\r
-#define INCLUDE_eTaskGetState 1\r
-#define INCLUDE_xTimerPendFunctionCall 1\r
-#define INCLUDE_xTaskAbortDelay 1\r
-#define INCLUDE_xTaskGetHandle 1\r
-#define INCLUDE_xSemaphoreGetMutexHolder 1\r
-\r
-/* Normal assert() semantics without relying on the provision of an assert.h\r
-header file. */\r
-void vAssertCalled( void );\r
-#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()\r
-\r
-/* Overwrite some of the stack sizes allocated to various test and demo tasks.\r
-Like all task stack sizes, the value is the number of words, not bytes. */\r
-#define bktBLOCK_TIME_TASK_STACK_SIZE 100\r
-#define notifyNOTIFIED_TASK_STACK_SIZE 120\r
-#define priSUSPENDED_RX_TASK_STACK_SIZE 90\r
-#define tmrTIMER_TEST_TASK_STACK_SIZE 100\r
-#define ebRENDESVOUS_TEST_TASK_STACK_SIZE 100\r
-#define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE 115\r
-#define genqMUTEX_TEST_TASK_STACK_SIZE 90\r
-#define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE 100\r
-#define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE 90\r
-\r
-#endif /* FREERTOS_CONFIG_H */\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">\r
-<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="false"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>\r
-<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="1234"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>\r
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>\r
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>\r
-<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="riscv64-unknown-elf-gdb.exe -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off""/>\r
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_ENABLED" value="false"/>\r
-<stringAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_VALUE" value=""/>\r
-<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>\r
-<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>\r
-<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>\r
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>\r
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\RTOSDemo.elf"/>\r
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTOSDemo"/>\r
-<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>\r
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">\r
-<listEntry value="/RTOSDemo"/>\r
-</listAttribute>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">\r
-<listEntry value="4"/>\r
-</listAttribute>\r
-<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"> <gdbmemoryBlockExpression address="2147486760" label="0x80000c28"/> </memoryBlockExpressionList> "/>\r
-<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>\r
-</launchConfiguration>\r
+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.2.1\r
- * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
-/******************************************************************************\r
- * NOTE 1: This project provides two demo applications. A simple blinky\r
- * style project, and a more comprehensive test and demo application. The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
- * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
- * in main.c. This file implements the simply blinky style version.\r
- *\r
- * NOTE 2: This file only contains the source code that is specific to the\r
- * basic demo. Generic functions, such FreeRTOS hook functions, and functions\r
- * required to configure the hardware are defined in main.c.\r
- ******************************************************************************\r
- *\r
- * main_blinky() creates one queue, and two tasks. It then starts the\r
- * scheduler.\r
- *\r
- * The Queue Send Task:\r
- * The queue send task is implemented by the prvQueueSendTask() function in\r
- * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly\r
- * block for 1000 milliseconds, before sending the value 100 to the queue that\r
- * was created within main_blinky(). Once the value is sent, the task loops\r
- * back around to block for another 1000 milliseconds...and so on.\r
- *\r
- * The Queue Receive Task:\r
- * The queue receive task is implemented by the prvQueueReceiveTask() function\r
- * in this file. prvQueueReceiveTask() sits in a loop where it repeatedly\r
- * blocks on attempts to read data from the queue that was created within\r
- * main_blinky(). When data is received, the task checks the value of the\r
- * data, and if the value equals the expected 100, writes 'Blink' to the UART\r
- * (the UART is used in place of the LED to allow easy execution in QEMU). The\r
- * 'block time' parameter passed to the queue receive function specifies that\r
- * the task should be held in the Blocked state indefinitely to wait for data to\r
- * be available on the queue. The queue receive task will only leave the\r
- * Blocked state when the queue send task writes to the queue. As the queue\r
- * send task writes to the queue every 1000 milliseconds, the queue receive\r
- * task leaves the Blocked state every 1000 milliseconds, and therefore toggles\r
- * the LED every 200 milliseconds.\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <unistd.h>\r
-\r
-/* Kernel includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "queue.h"\r
-\r
-/* Priorities used by the tasks. */\r
-#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
-#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-\r
-/* The rate at which data is sent to the queue. The 200ms value is converted\r
-to ticks using the pdMS_TO_TICKS() macro. */\r
-#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 )\r
-\r
-/* The maximum number items the queue can hold. The priority of the receiving\r
-task is above the priority of the sending task, so the receiving task will\r
-preempt the sending task and remove the queue items each time the sending task\r
-writes to the queue. Therefore the queue will never have more than one item in\r
-it at any time, and even with a queue length of 1, the sending task will never\r
-find the queue full. */\r
-#define mainQUEUE_LENGTH ( 1 )\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in\r
- * main.c.\r
- */\r
-void main_blinky( void );\r
-\r
-/*\r
- * The tasks as described in the comments at the top of this file.\r
- */\r
-static void prvQueueReceiveTask( void *pvParameters );\r
-static void prvQueueSendTask( void *pvParameters );\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/* The queue used by both tasks. */\r
-static QueueHandle_t xQueue = NULL;\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void main_blinky( void )\r
-{\r
- /* Create the queue. */\r
- xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
-\r
- if( xQueue != NULL )\r
- {\r
- /* Start the two tasks as described in the comments at the top of this\r
- file. */\r
- xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */\r
- "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */\r
- configMINIMAL_STACK_SIZE * 2U, /* The size of the stack to allocate to the task. */\r
- NULL, /* The parameter passed to the task - not used in this case. */\r
- mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */\r
- NULL ); /* The task handle is not required, so NULL is passed. */\r
-\r
- xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );\r
-\r
- /* Start the tasks and timer running. */\r
- vTaskStartScheduler();\r
- }\r
-\r
- /* If all is well, the scheduler will now be running, and the following\r
- line will never be reached. If the following line does execute, then\r
- there was insufficient FreeRTOS heap memory available for the Idle and/or\r
- timer tasks to be created. See the memory management section on the\r
- FreeRTOS web site for more details on the FreeRTOS heap\r
- http://www.freertos.org/a00111.html. */\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvQueueSendTask( void *pvParameters )\r
-{\r
-TickType_t xNextWakeTime;\r
-const unsigned long ulValueToSend = 100UL;\r
-BaseType_t xReturned;\r
-\r
- /* Remove compiler warning about unused parameter. */\r
- ( void ) pvParameters;\r
-\r
- /* Initialise xNextWakeTime - this only needs to be done once. */\r
- xNextWakeTime = xTaskGetTickCount();\r
-\r
- for( ;; )\r
- {\r
- /* Place this task in the blocked state until it is time to run again. */\r
- vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
-\r
- /* Send to the queue - causing the queue receive task to unblock and\r
- toggle the LED. 0 is used as the block time so the sending operation\r
- will not block - it shouldn't need to block as the queue should always\r
- be empty at this point in the code. */\r
- xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );\r
- configASSERT( xReturned == pdPASS );\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvQueueReceiveTask( void *pvParameters )\r
-{\r
-unsigned long ulReceivedValue;\r
-const unsigned long ulExpectedValue = 100UL;\r
-const char * const pcPassMessage = "Blink\r\n";\r
-const char * const pcFailMessage = "Unexpected value received\r\n";\r
-extern void vSendString( const char * pcString );\r
-\r
- /* Remove compiler warning about unused parameter. */\r
- ( void ) pvParameters;\r
-\r
- for( ;; )\r
- {\r
- /* Wait until something arrives in the queue - this task will block\r
- indefinitely provided INCLUDE_vTaskSuspend is set to 1 in\r
- FreeRTOSConfig.h. */\r
- xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );\r
-\r
- /* To get here something must have been received from the queue, but\r
- is it the expected value? If it is, toggle the LED. */\r
- if( ulReceivedValue == ulExpectedValue )\r
- {\r
- vSendString( pcPassMessage );\r
- ulReceivedValue = 0U;\r
- }\r
- else\r
- {\r
- vSendString( pcFailMessage );\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
+++ /dev/null
-{\r
- "schemaVersion": "0.2.4",\r
- "contentVersion": "0.2.0",\r
- "headerVersion": "0.2.0",\r
- "device": {\r
- "fe310": {\r
- "displayName": "Freedom E310-G000",\r
- "description": "The FE310-G000 is the first Freedom E300 SoC, and is the industry's first commercially available RISC-V SoC. The FE310-G000 is built around the E31 Core Complex instantiated in the Freedom E300 platform.",\r
- "supplier": {\r
- "name": "sifive",\r
- "id": "1",\r
- "displayName": "SiFive",\r
- "fullName": "SiFive, Inc.",\r
- "contact": "info@sifive.com"\r
- },\r
- "busWidth": "32",\r
- "resetMask": "all",\r
- "resetValue": "0x00000000",\r
- "access": "rw",\r
- "headerGuardPrefix": "SIFIVE_DEVICES_FE310_",\r
- "headerTypePrefix": "sifive_fe310_",\r
- "headerInterruptPrefix": "sifive_fe310_interrupt_global_",\r
- "headerInterruptEnumPrefix": "riscv_interrupts_global_",\r
- "revision": "r0p0",\r
- "numInterrupts": "51",\r
- "priorityBits": "3",\r
- "regWidth": "32",\r
- "cores": {\r
- "e31": {\r
- "harts": "1",\r
- "isa": "RV32IMAC",\r
- "isaVersion": "2.2",\r
- "mpu": "pmp",\r
- "mmu": "none",\r
- "localInterrupts": {\r
- "machine_software": {\r
- "description": "Machine Software Interrupt",\r
- "value": "3"\r
- },\r
- "machine_timer": {\r
- "description": "Machine Timer Interrupt",\r
- "value": "7"\r
- },\r
- "machine_ext": {\r
- "description": "Machine External Interrupt",\r
- "value": "11"\r
- }\r
- },\r
- "numLocalInterrupts": "0"\r
- }\r
- },\r
- "peripherals": {\r
- "clint": {\r
- "description": "Core Complex Local Interruptor (CLINT) Peripheral",\r
- "baseAddress": "0x02000000",\r
- "size": "0x10000",\r
- "registers": {\r
- "msip": {\r
- "description": "MSIP (Machine-mode Software Interrupts) Register per Hart",\r
- "addressOffset": "0x0000",\r
- "arraySize": "1"\r
- }\r
- },\r
- "clusters": {\r
- "mtimecmp": {\r
- "description": "Machine Time Compare Registers per Hart",\r
- "addressOffset": "0x4000",\r
- "arraySize": "1",\r
- "registers": {\r
- "low": {\r
- "description": "Machine Compare Register Low",\r
- "addressOffset": "0x0000"\r
- },\r
- "high": {\r
- "description": "Machine Compare Register High",\r
- "addressOffset": "0x0004"\r
- }\r
- }\r
- },\r
- "mtime": {\r
- "description": "Machine Time Register",\r
- "addressOffset": "0xBFF8",\r
- "access": "r",\r
- "registers": {\r
- "low": {\r
- "description": "Machine Time Register Low",\r
- "addressOffset": "0x0000"\r
- },\r
- "high": {\r
- "description": "Machine Time Register High",\r
- "addressOffset": "0x0004"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "plic": {\r
- "description": "Platform-Level Interrupt Controller (PLIC) Peripheral",\r
- "baseAddress": "0x0C000000",\r
- "size": "0x4000000",\r
- "registers": {\r
- "priorities": {\r
- "arraySize": "52",\r
- "description": "Interrupt Priorities Registers; 0 is reserved.",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "value": {\r
- "description": "The priority for a given global interrupt",\r
- "bitOffset": "0",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "pendings": {\r
- "arraySize": "2",\r
- "description": "Interrupt Pending Bits Registers",\r
- "addressOffset": "0x1000",\r
- "access": "r"\r
- }\r
- },\r
- "clusters": {\r
- "enablestarget0": {\r
- "description": "Hart 0 Interrupt Enable Bits",\r
- "addressOffset": "0x00002000",\r
- "clusters": {\r
- "m": {\r
- "addressOffset": "0x0000",\r
- "description": "Hart 0 M-mode Interrupt Enable Bits",\r
- "registers": {\r
- "enables": {\r
- "arraySize": "2",\r
- "description": "Interrupt Enable Bits Registers",\r
- "addressOffset": "0x0000"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "target0": {\r
- "description": "Hart 0 Interrupt Thresholds",\r
- "addressOffset": "0x00200000",\r
- "clusters": {\r
- "m": {\r
- "addressOffset": "0x0000",\r
- "description": "Hart 0 M-Mode Interrupt Threshold",\r
- "registers": {\r
- "threshold": {\r
- "description": "The Priority Threshold Register",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "value": {\r
- "description": "The priority threshold value",\r
- "bitOffset": "0",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "claimcomplete": {\r
- "description": "The Interrupt Claim/Completion Register",\r
- "addressOffset": "0x0004"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "wdog": {\r
- "description": "Watchdog Timer (WDT), part of Always-On Domain",\r
- "baseAddress": "0x10000000",\r
- "size": "0x0040",\r
- "resetMask": "none",\r
- "registers": {\r
- "cfg": {\r
- "description": "Watchdog Configuration Register",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "scale": {\r
- "description": "Watchdog counter scale",\r
- "bitOffset": "0",\r
- "bitWidth": "4"\r
- },\r
- "rsten": {\r
- "description": "Watchdog full reset enable",\r
- "bitOffset": "8",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "zerocmp": {\r
- "description": "Watchdog zero on comparator",\r
- "bitOffset": "9",\r
- "bitWidth": "1"\r
- },\r
- "enalways": {\r
- "description": "Watchdog enable counter always",\r
- "bitOffset": "12",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "encoreawake": {\r
- "description": "Watchdog counter only when awake",\r
- "bitOffset": "13",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmpip": {\r
- "description": "Watchdog interrupt pending",\r
- "bitOffset": "28",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "count": {\r
- "description": "Watchdog Count Register",\r
- "addressOffset": "0x0008"\r
- },\r
- "scale": {\r
- "description": "Watchdog Scale Register",\r
- "addressOffset": "0x0010",\r
- "fields": {\r
- "value": {\r
- "description": "Watchdog scale value",\r
- "bitOffset": "0",\r
- "bitWidth": "16"\r
- }\r
- }\r
- },\r
- "feed": {\r
- "description": "Watchdog Feed Address Register",\r
- "addressOffset": "0x0018"\r
- },\r
- "key": {\r
- "description": "Watchdog Key Register",\r
- "addressOffset": "0x001C"\r
- },\r
- "cmp": {\r
- "description": "Watchdog Compare Register",\r
- "addressOffset": "0x0020",\r
- "fields": {\r
- "value": {\r
- "description": "Watchdog compare value",\r
- "bitOffset": "0",\r
- "bitWidth": "16"\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "wdogcmp": {\r
- "description": "Watchdog Compare Interrupt",\r
- "value": "1"\r
- }\r
- }\r
- },\r
- "rtc": {\r
- "description": "Real-Time Clock (RTC), part of Always-On Domain",\r
- "baseAddress": "0x10000040",\r
- "size": "0x0030",\r
- "resetMask": "none",\r
- "registers": {\r
- "cfg": {\r
- "description": "RTC Configuration Register",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "scale": {\r
- "description": "RTC clock rate scale",\r
- "bitOffset": "0",\r
- "bitWidth": "4"\r
- },\r
- "enalways": {\r
- "description": "RTC counter enable",\r
- "bitOffset": "12",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmpip": {\r
- "description": "RTC comparator interrupt pending",\r
- "bitOffset": "28",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "low": {\r
- "description": "RTC Counter Register Low",\r
- "addressOffset": "0x0008"\r
- },\r
- "high": {\r
- "description": "RTC Counter Register High",\r
- "addressOffset": "0x000C",\r
- "fields": {\r
- "value": {\r
- "description": "RTC counter register, high bits",\r
- "bitOffset": "0",\r
- "bitWidth": "16"\r
- }\r
- }\r
- },\r
- "scale": {\r
- "description": "RTC Scale Register",\r
- "addressOffset": "0x0010"\r
- },\r
- "cmp": {\r
- "description": "RTC Compare Register",\r
- "addressOffset": "0x0020"\r
- }\r
- },\r
- "interrupts": {\r
- "rtccmp": {\r
- "description": "RTC Compare Interrupt",\r
- "value": "2"\r
- }\r
- }\r
- },\r
- "pmu": {\r
- "description": "Power-Management Unit (PMU), part of Always-On Domain",\r
- "baseAddress": "0x10000100",\r
- "size": "0x0050",\r
- "resetMask": "none",\r
- "registers": {\r
- "wakeupi": {\r
- "description": "Wakeup program instruction Registers",\r
- "addressOffset": "0x0000",\r
- "arraySize": "8"\r
- },\r
- "sleepi": {\r
- "description": "Sleep Program Instruction Registers",\r
- "addressOffset": "0x0020",\r
- "arraySize": "8"\r
- },\r
- "ie": {\r
- "description": "PMU Interrupt Enables Register",\r
- "addressOffset": "0x0040",\r
- "fields": {\r
- "rtc": {\r
- "description": "RTC Comparator active",\r
- "bitOffset": "1",\r
- "bitWidth": "1"\r
- },\r
- "dwakeup": {\r
- "description": "dwakeup_n pin active",\r
- "bitOffset": "2",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "cause": {\r
- "description": "PMU Wakeup Cause Register",\r
- "addressOffset": "0x0044",\r
- "fields": {\r
- "wakeupcause": {\r
- "description": "Wakeup cause",\r
- "bitOffset": "0",\r
- "bitWidth": "2",\r
- "access": "r",\r
- "enumerations": {\r
- "wakeupcause-enum": {\r
- "description": "Wakeup Cause Values Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "reset",\r
- "description": "Reset Wakeup"\r
- },\r
- "1": {\r
- "displayName": "rtc",\r
- "description": "RTC Wakeup"\r
- },\r
- "2": {\r
- "displayName": "dwakeup",\r
- "description": "Digital input Wakeup"\r
- },\r
- "*": {\r
- "displayName": "undefined"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "resetcause": {\r
- "description": "Reset cause",\r
- "bitOffset": "8",\r
- "bitWidth": "2",\r
- "access": "r",\r
- "enumerations": {\r
- "resetcause-enum": {\r
- "description": "Reset Cause Values Enumeration",\r
- "values": {\r
- "1": {\r
- "displayName": "external",\r
- "description": "External reset"\r
- },\r
- "2": {\r
- "displayName": "watchdog",\r
- "description": "Watchdog timer reset"\r
- },\r
- "*": {\r
- "displayName": "undefined"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "sleep": {\r
- "description": "PMU Initiate Sleep Sequence Register",\r
- "addressOffset": "0x0048"\r
- },\r
- "key": {\r
- "description": "PMU Key Register",\r
- "addressOffset": "0x004C"\r
- }\r
- }\r
- },\r
- "aon": {\r
- "description": "Always-On (AON) Domain",\r
- "baseAddress": "0x10000070",\r
- "size": "0x0090",\r
- "resetMask": "none",\r
- "registers": {\r
- "lfrosccfg": {\r
- "description": "Internal Programmable Low-Frequency Ring Oscillator Register",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "div": {\r
- "description": "LFROSC divider",\r
- "bitOffset": "0",\r
- "bitWidth": "6",\r
- "resetMask": "all",\r
- "resetValue": "0x04"\r
- },\r
- "trim": {\r
- "description": "LFROSC trim value",\r
- "bitOffset": "16",\r
- "bitWidth": "5",\r
- "resetMask": "all",\r
- "resetValue": "0x10"\r
- },\r
- "en": {\r
- "description": "LFROSC enable",\r
- "bitOffset": "30",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "rdy": {\r
- "description": "LFROSC ready",\r
- "bitOffset": "31",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "backup": {\r
- "description": "Backup Registers",\r
- "addressOffset": "0x0010",\r
- "arraySize": "32"\r
- }\r
- }\r
- },\r
- "prci": {\r
- "description": "Power, Reset, Clock, Interrupt (PRCI) Peripheral",\r
- "baseAddress": "0x10008000",\r
- "size": "0x8000",\r
- "registers": {\r
- "hfrosccfg": {\r
- "description": "Internal Trimmable Programmable 72 MHz Oscillator Register",\r
- "addressOffset": "0x0000",\r
- "fields": {\r
- "div": {\r
- "description": "HFROSC divider",\r
- "bitOffset": "0",\r
- "bitWidth": "6",\r
- "resetMask": "all",\r
- "resetValue": "0x04"\r
- },\r
- "trim": {\r
- "description": "HFROSC trim value",\r
- "bitOffset": "16",\r
- "bitWidth": "5",\r
- "resetMask": "all",\r
- "resetValue": "0x10"\r
- },\r
- "en": {\r
- "description": "HFROSC enable",\r
- "bitOffset": "30",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "rdy": {\r
- "description": "HFROSC ready",\r
- "bitOffset": "31",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "hfxosccfg": {\r
- "description": "External 16 MHz Crystal Oscillator Register",\r
- "addressOffset": "0x0004",\r
- "fields": {\r
- "en": {\r
- "description": "HFXOSC enable",\r
- "bitOffset": "30",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "rdy": {\r
- "description": "HFXOSC ready",\r
- "bitOffset": "31",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "pllcfg": {\r
- "description": "Internal High-Frequency PLL (HFPLL) Register",\r
- "addressOffset": "0x0008",\r
- "fields": {\r
- "r": {\r
- "description": "PLL R input divider value",\r
- "bitOffset": "0",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x1",\r
- "enumerations": {\r
- "pllr-enum": {\r
- "description": "Reference Clock R Divide Ratio Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "/1",\r
- "headerName": "div1",\r
- "description": "Unchanged"\r
- },\r
- "1": {\r
- "displayName": "/2",\r
- "headerName": "div2",\r
- "description": "Divided by 2"\r
- },\r
- "2": {\r
- "displayName": "/3",\r
- "headerName": "div3",\r
- "description": "Divided by 3"\r
- },\r
- "3": {\r
- "displayName": "/4",\r
- "headerName": "div4",\r
- "description": "Divided by 4"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "f": {\r
- "description": "PLL F multiplier value",\r
- "bitOffset": "4",\r
- "bitWidth": "6",\r
- "resetMask": "all",\r
- "resetValue": "0x1F",\r
- "enumerations": {\r
- "pllf-enum": {\r
- "description": "Reference Clock F Multiplier Ratio Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "*2",\r
- "headerName": "mul2",\r
- "description": "Multiplied by 2"\r
- },\r
- "1": {\r
- "displayName": "*4",\r
- "headerName": "mul4",\r
- "description": "Multiplied by 4"\r
- },\r
- "2": {\r
- "displayName": "*6",\r
- "headerName": "mul6",\r
- "description": "Multiplied by 6"\r
- },\r
- "3": {\r
- "displayName": "*8",\r
- "headerName": "mul8",\r
- "description": "Multiplied by 8"\r
- },\r
- "4": {\r
- "displayName": "*10",\r
- "headerName": "mul10",\r
- "description": "Multiplied by 10"\r
- },\r
- "5": {\r
- "displayName": "*12",\r
- "headerName": "mul12",\r
- "description": "Multiplied by 12"\r
- },\r
- "6": {\r
- "displayName": "*14",\r
- "headerName": "mul14",\r
- "description": "Multiplied by 14"\r
- },\r
- "7": {\r
- "displayName": "*16",\r
- "headerName": "mul16",\r
- "description": "Multiplied by 16"\r
- },\r
- "8": {\r
- "displayName": "*18",\r
- "headerName": "mul18",\r
- "description": "Multiplied by 18"\r
- },\r
- "9": {\r
- "displayName": "*20",\r
- "headerName": "mul20",\r
- "description": "Multiplied by 20"\r
- },\r
- "10": {\r
- "displayName": "*22",\r
- "headerName": "mul22",\r
- "description": "Multiplied by 22"\r
- },\r
- "11": {\r
- "displayName": "*24",\r
- "headerName": "mul24",\r
- "description": "Multiplied by 24"\r
- },\r
- "12": {\r
- "displayName": "*26",\r
- "headerName": "mul26",\r
- "description": "Multiplied by 26"\r
- },\r
- "13": {\r
- "displayName": "*28",\r
- "headerName": "mul28",\r
- "description": "Multiplied by 28"\r
- },\r
- "14": {\r
- "displayName": "*30",\r
- "headerName": "mul30",\r
- "description": "Multiplied by 30"\r
- },\r
- "15": {\r
- "displayName": "*32",\r
- "headerName": "mul32",\r
- "description": "Multiplied by 32"\r
- },\r
- "16": {\r
- "displayName": "*34",\r
- "headerName": "mul34",\r
- "description": "Multiplied by 34"\r
- },\r
- "17": {\r
- "displayName": "*36",\r
- "headerName": "mul36",\r
- "description": "Multiplied by 36"\r
- },\r
- "18": {\r
- "displayName": "*38",\r
- "headerName": "mul38",\r
- "description": "Multiplied by 38"\r
- },\r
- "19": {\r
- "displayName": "*40",\r
- "headerName": "mul40",\r
- "description": "Multiplied by 40"\r
- },\r
- "20": {\r
- "displayName": "*42",\r
- "headerName": "mul42",\r
- "description": "Multiplied by 42"\r
- },\r
- "21": {\r
- "displayName": "*44",\r
- "headerName": "mul44",\r
- "description": "Multiplied by 44"\r
- },\r
- "22": {\r
- "displayName": "*46",\r
- "headerName": "mul46",\r
- "description": "Multiplied by 46"\r
- },\r
- "23": {\r
- "displayName": "*48",\r
- "headerName": "mul48",\r
- "description": "Multiplied by 48"\r
- },\r
- "24": {\r
- "displayName": "*50",\r
- "headerName": "mul50",\r
- "description": "Multiplied by 50"\r
- },\r
- "25": {\r
- "displayName": "*52",\r
- "headerName": "mul52",\r
- "description": "Multiplied by 52"\r
- },\r
- "26": {\r
- "displayName": "*54",\r
- "headerName": "mul54",\r
- "description": "Multiplied by 54"\r
- },\r
- "27": {\r
- "displayName": "*56",\r
- "headerName": "mul56",\r
- "description": "Multiplied by 56"\r
- },\r
- "28": {\r
- "displayName": "*58",\r
- "headerName": "mul58",\r
- "description": "Multiplied by 58"\r
- },\r
- "29": {\r
- "displayName": "*60",\r
- "headerName": "mul60",\r
- "description": "Multiplied by 60"\r
- },\r
- "30": {\r
- "displayName": "*62",\r
- "headerName": "mul62",\r
- "description": "Multiplied by 62"\r
- },\r
- "31": {\r
- "displayName": "*64",\r
- "headerName": "mul64",\r
- "description": "Multiplied by 64"\r
- },\r
- "32": {\r
- "displayName": "*66",\r
- "headerName": "mul66",\r
- "description": "Multiplied by 66"\r
- },\r
- "33": {\r
- "displayName": "*68",\r
- "headerName": "mul68",\r
- "description": "Multiplied by 68"\r
- },\r
- "34": {\r
- "displayName": "*70",\r
- "headerName": "mul70",\r
- "description": "Multiplied by 70"\r
- },\r
- "35": {\r
- "displayName": "*72",\r
- "headerName": "mul72",\r
- "description": "Multiplied by 72"\r
- },\r
- "36": {\r
- "displayName": "*74",\r
- "headerName": "mul74",\r
- "description": "Multiplied by 74"\r
- },\r
- "37": {\r
- "displayName": "*76",\r
- "headerName": "mul76",\r
- "description": "Multiplied by 76"\r
- },\r
- "38": {\r
- "displayName": "*78",\r
- "headerName": "mul78",\r
- "description": "Multiplied by 78"\r
- },\r
- "39": {\r
- "displayName": "*80",\r
- "headerName": "mul80",\r
- "description": "Multiplied by 80"\r
- },\r
- "40": {\r
- "displayName": "*82",\r
- "headerName": "mul82",\r
- "description": "Multiplied by 82"\r
- },\r
- "41": {\r
- "displayName": "*84",\r
- "headerName": "mul84",\r
- "description": "Multiplied by 84"\r
- },\r
- "42": {\r
- "displayName": "*86",\r
- "headerName": "mul86",\r
- "description": "Multiplied by 86"\r
- },\r
- "43": {\r
- "displayName": "*88",\r
- "headerName": "mul88",\r
- "description": "Multiplied by 88"\r
- },\r
- "44": {\r
- "displayName": "*90",\r
- "headerName": "mul90",\r
- "description": "Multiplied by 90"\r
- },\r
- "45": {\r
- "displayName": "*92",\r
- "headerName": "mul92",\r
- "description": "Multiplied by 92"\r
- },\r
- "46": {\r
- "displayName": "*94",\r
- "headerName": "mul94",\r
- "description": "Multiplied by 94"\r
- },\r
- "47": {\r
- "displayName": "*96",\r
- "headerName": "mul96",\r
- "description": "Multiplied by 96"\r
- },\r
- "48": {\r
- "displayName": "*98",\r
- "headerName": "mul98",\r
- "description": "Multiplied by 98"\r
- },\r
- "49": {\r
- "displayName": "*100",\r
- "headerName": "mul100",\r
- "description": "Multiplied by 100"\r
- },\r
- "50": {\r
- "displayName": "*102",\r
- "headerName": "mul102",\r
- "description": "Multiplied by 102"\r
- },\r
- "51": {\r
- "displayName": "*104",\r
- "headerName": "mul104",\r
- "description": "Multiplied by 104"\r
- },\r
- "52": {\r
- "displayName": "*106",\r
- "headerName": "mul106",\r
- "description": "Multiplied by 106"\r
- },\r
- "53": {\r
- "displayName": "*108",\r
- "headerName": "mul108",\r
- "description": "Multiplied by 108"\r
- },\r
- "54": {\r
- "displayName": "*110",\r
- "headerName": "mul110",\r
- "description": "Multiplied by 110"\r
- },\r
- "55": {\r
- "displayName": "*112",\r
- "headerName": "mul112",\r
- "description": "Multiplied by 112"\r
- },\r
- "56": {\r
- "displayName": "*114",\r
- "headerName": "mul114",\r
- "description": "Multiplied by 114"\r
- },\r
- "57": {\r
- "displayName": "*116",\r
- "headerName": "mul116",\r
- "description": "Multiplied by 116"\r
- },\r
- "58": {\r
- "displayName": "*118",\r
- "headerName": "mul118",\r
- "description": "Multiplied by 118"\r
- },\r
- "59": {\r
- "displayName": "*120",\r
- "headerName": "mul120",\r
- "description": "Multiplied by 120"\r
- },\r
- "60": {\r
- "displayName": "*122",\r
- "headerName": "mul122",\r
- "description": "Multiplied by 122"\r
- },\r
- "61": {\r
- "displayName": "*124",\r
- "headerName": "mul124",\r
- "description": "Multiplied by 124"\r
- },\r
- "62": {\r
- "displayName": "*126",\r
- "headerName": "mul126",\r
- "description": "Multiplied by 126"\r
- },\r
- "63": {\r
- "displayName": "*128",\r
- "headerName": "mul128",\r
- "description": "Multiplied by 128"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "q": {\r
- "description": "PLL Q output divider value",\r
- "bitOffset": "10",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x3",\r
- "enumerations": {\r
- "pllq-enum": {\r
- "description": "Reference Clock Q Divide Ratio Enumeration",\r
- "values": {\r
- "*": {\r
- "displayName": "n/a",\r
- "description": "Not supported"\r
- },\r
- "1": {\r
- "displayName": "/2",\r
- "headerName": "div2",\r
- "description": "Divided by 2"\r
- },\r
- "2": {\r
- "displayName": "/4",\r
- "headerName": "div4",\r
- "description": "Divided by 4"\r
- },\r
- "3": {\r
- "displayName": "/8",\r
- "headerName": "div8",\r
- "description": "Divided by 8"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "sel": {\r
- "description": "PLL select",\r
- "bitOffset": "16",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "refsel": {\r
- "description": "PLL reference select",\r
- "bitOffset": "17",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "bypass": {\r
- "description": "PLL bypass",\r
- "bitOffset": "18",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "lock": {\r
- "description": "PLL lock indicator",\r
- "bitOffset": "31",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "plloutdiv": {\r
- "description": "PLL Output Divider",\r
- "addressOffset": "0x000C"\r
- }\r
- }\r
- },\r
- "otp": {\r
- "description": "One-Time Programmable Memory (OTP) Peripheral",\r
- "baseAddress": "0x10010000",\r
- "size": "0x1000",\r
- "registers": {\r
- "lock": {\r
- "description": "Programmed-I/O Lock Register",\r
- "addressOffset": "0x0000"\r
- },\r
- "ck": {\r
- "description": "Device Clock Signal Register",\r
- "addressOffset": "0x0004"\r
- },\r
- "oe": {\r
- "description": "Device Output-Enable Signal Register",\r
- "addressOffset": "0x0008"\r
- },\r
- "sel": {\r
- "description": "Device Chip-Select Signal Register",\r
- "addressOffset": "0x000C"\r
- },\r
- "we": {\r
- "description": "Device Write-Enable Signal Register",\r
- "addressOffset": "0x0010"\r
- },\r
- "mr": {\r
- "description": "Device Mode Register",\r
- "addressOffset": "0x0014"\r
- },\r
- "mrr": {\r
- "description": "Read-Voltage Regulator Control Register",\r
- "addressOffset": "0x0018"\r
- },\r
- "mpp": {\r
- "description": "Write-Voltage Charge Pump Control Register",\r
- "addressOffset": "0x001C"\r
- },\r
- "vrren": {\r
- "description": "Read-Voltage Enable Register",\r
- "addressOffset": "0x0020"\r
- },\r
- "vppen": {\r
- "description": "Write-Voltage Enable Register",\r
- "addressOffset": "0x0024"\r
- },\r
- "a": {\r
- "description": "Device Address Register",\r
- "addressOffset": "0x0028"\r
- },\r
- "d": {\r
- "description": "Device Data Input Register",\r
- "addressOffset": "0x002C"\r
- },\r
- "q": {\r
- "description": "Device Data Output Register",\r
- "addressOffset": "0x0030"\r
- },\r
- "rsctrl": {\r
- "description": "Read Sequencer Control Register",\r
- "addressOffset": "0x0034",\r
- "fields": {\r
- "scale": {\r
- "description": "OTP timescale",\r
- "bitOffset": "0",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "tas": {\r
- "description": "Address setup time",\r
- "bitOffset": "3",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "trp": {\r
- "description": "Read pulse time",\r
- "bitOffset": "4",\r
- "bitWidth": "1"\r
- },\r
- "tracc": {\r
- "description": "Read access time",\r
- "bitOffset": "5",\r
- "bitWidth": "1"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "gpio": {\r
- "description": "General Purpose Input/Output Controller (GPIO) Peripheral",\r
- "baseAddress": "0x10012000",\r
- "size": "0x1000",\r
- "registers": {\r
- "value": {\r
- "description": "Pin Value Register",\r
- "addressOffset": "0x000",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Value Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "inputen": {\r
- "description": "Pin Input Enable Register",\r
- "addressOffset": "0x004",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Pin Input Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "outputen": {\r
- "description": "Pin Output Enable Register",\r
- "addressOffset": "0x008",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Pin Output Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "port": {\r
- "description": "Output Port Value Register",\r
- "addressOffset": "0x00C",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Output Port Value Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "pue": {\r
- "description": "Internal Pull-up Enable Register",\r
- "addressOffset": "0x010",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Internal Pull-up Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "ds": {\r
- "description": "Pin Drive Strength Register",\r
- "addressOffset": "0x014",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Pin Drive Strength Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "riseie": {\r
- "description": "Rise Interrupt Enable Register",\r
- "addressOffset": "0x018",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Rise Interrupt Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "riseip": {\r
- "description": "Rise Interrupt Pending Register",\r
- "addressOffset": "0x01C",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Rise Interrupt Pending Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "fallie": {\r
- "description": "Fall Interrupt Enable Register",\r
- "addressOffset": "0x020",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Fall Interrupt Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "fallip": {\r
- "description": "Fall Interrupt Pending Register",\r
- "addressOffset": "0x024",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Fall Interrupt Pending Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "highie": {\r
- "description": "High Interrupt Enable Register",\r
- "addressOffset": "0x028",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "High Interrupt Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "highip": {\r
- "description": "High Interrupt Pending Register",\r
- "addressOffset": "0x02C",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "High Interrupt Pending Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "lowie": {\r
- "description": "Low Interrupt Enable Register",\r
- "addressOffset": "0x030",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Low Interrupt Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "lowip": {\r
- "description": "Low Interrupt Pending Register",\r
- "addressOffset": "0x034",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Low Interrupt Pending Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "iofen": {\r
- "description": "HW I/O Function Enable Register",\r
- "addressOffset": "0x038",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "HW I/O Function Enable Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "iofsel": {\r
- "description": "HW I/O Function Select Register",\r
- "addressOffset": "0x03C",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "HW I/O Function Select Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- },\r
- "outxor": {\r
- "description": "Output XOR (invert) Register",\r
- "addressOffset": "0x040",\r
- "fields": {\r
- "bit": {\r
- "repeatGenerator": "0-31",\r
- "description": "Output XOR Bit Field",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "headerName": ""\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "gpio0": {\r
- "description": "GPIO0 Interrupt",\r
- "value": "8"\r
- },\r
- "gpio1": {\r
- "description": "GPIO1 Interrupt",\r
- "value": "9"\r
- },\r
- "gpio2": {\r
- "description": "GPIO2 Interrupt",\r
- "value": "10"\r
- },\r
- "gpio3": {\r
- "description": "GPIO3 Interrupt",\r
- "value": "11"\r
- },\r
- "gpio4": {\r
- "description": "GPIO4 Interrupt",\r
- "value": "12"\r
- },\r
- "gpio5": {\r
- "description": "GPIO5 Interrupt",\r
- "value": "13"\r
- },\r
- "gpio6": {\r
- "description": "GPIO6 Interrupt",\r
- "value": "14"\r
- },\r
- "gpio7": {\r
- "description": "GPIO7 Interrupt",\r
- "value": "15"\r
- },\r
- "gpio8": {\r
- "description": "GPIO8 Interrupt",\r
- "value": "16"\r
- },\r
- "gpio9": {\r
- "description": "GPIO9 Interrupt",\r
- "value": "17"\r
- },\r
- "gpio10": {\r
- "description": "GPIO10 Interrupt",\r
- "value": "18"\r
- },\r
- "gpio11": {\r
- "description": "GPIO11 Interrupt",\r
- "value": "19"\r
- },\r
- "gpio12": {\r
- "description": "GPIO12 Interrupt",\r
- "value": "20"\r
- },\r
- "gpio13": {\r
- "description": "GPIO13 Interrupt",\r
- "value": "21"\r
- },\r
- "gpio14": {\r
- "description": "GPIO14 Interrupt",\r
- "value": "22"\r
- },\r
- "gpio15": {\r
- "description": "GPIO15 Interrupt",\r
- "value": "23"\r
- },\r
- "gpio16": {\r
- "description": "GPIO16 Interrupt",\r
- "value": "24"\r
- },\r
- "gpio17": {\r
- "description": "GPIO17 Interrupt",\r
- "value": "25"\r
- },\r
- "gpio18": {\r
- "description": "GPIO18 Interrupt",\r
- "value": "26"\r
- },\r
- "gpio19": {\r
- "description": "GPIO19 Interrupt",\r
- "value": "27"\r
- },\r
- "gpio20": {\r
- "description": "GPIO20 Interrupt",\r
- "value": "28"\r
- },\r
- "gpio21": {\r
- "description": "GPIO21 Interrupt",\r
- "value": "29"\r
- },\r
- "gpio22": {\r
- "description": "GPIO22 Interrupt",\r
- "value": "30"\r
- },\r
- "gpio23": {\r
- "description": "GPIO23 Interrupt",\r
- "value": "31"\r
- },\r
- "gpio24": {\r
- "description": "GPIO24 Interrupt",\r
- "value": "32"\r
- },\r
- "gpio25": {\r
- "description": "GPIO25 Interrupt",\r
- "value": "33"\r
- },\r
- "gpio26": {\r
- "description": "GPIO26 Interrupt",\r
- "value": "34"\r
- },\r
- "gpio27": {\r
- "description": "GPIO27 Interrupt",\r
- "value": "35"\r
- },\r
- "gpio28": {\r
- "description": "GPIO28 Interrupt",\r
- "value": "36"\r
- },\r
- "gpio29": {\r
- "description": "GPIO29 Interrupt",\r
- "value": "37"\r
- },\r
- "gpio30": {\r
- "description": "GPIO30 Interrupt",\r
- "value": "38"\r
- },\r
- "gpio31": {\r
- "description": "GPIO31 Interrupt",\r
- "value": "39"\r
- }\r
- }\r
- },\r
- "uart0": {\r
- "description": "Universal Asynchronous Receiver/Transmitter (UART) Peripheral",\r
- "baseAddress": "0x10013000",\r
- "size": "0x1000",\r
- "resetMask": "none",\r
- "groupName": "uart",\r
- "registers": {\r
- "txdata": {\r
- "description": "Transmit Data Register",\r
- "addressOffset": "0x000",\r
- "fields": {\r
- "data": {\r
- "description": "Transmit data",\r
- "bitOffset": "0",\r
- "bitWidth": "8"\r
- },\r
- "full": {\r
- "description": "Transmit FIFO full",\r
- "bitOffset": "31",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "rxdata": {\r
- "description": "Receive Data Register",\r
- "addressOffset": "0x004",\r
- "resetMask": "none",\r
- "fields": {\r
- "data": {\r
- "description": "Received data",\r
- "bitOffset": "0",\r
- "bitWidth": "8",\r
- "access": "r"\r
- },\r
- "empty": {\r
- "description": "Receive FIFO empty",\r
- "bitOffset": "31",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "txctrl": {\r
- "description": "Transmit Control Register ",\r
- "addressOffset": "0x008",\r
- "fields": {\r
- "txen": {\r
- "description": "Transmit enable",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "nstop": {\r
- "description": "Number of stop bits",\r
- "bitOffset": "1",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "txcnt": {\r
- "description": "Transmit watermark level",\r
- "bitOffset": "16",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "rxctrl": {\r
- "description": "Receive Control Register",\r
- "addressOffset": "0x00C",\r
- "fields": {\r
- "rxen": {\r
- "description": "Receive enable",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "rxcnt": {\r
- "description": "Receive watermark level",\r
- "bitOffset": "16",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "ie": {\r
- "description": "Interrupt Enable Register",\r
- "addressOffset": "0x010",\r
- "fields": {\r
- "txwm": {\r
- "description": "Transmit watermark interrupt enable",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "rxwm": {\r
- "description": "Receive watermark interrupt enable",\r
- "bitOffset": "1",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "ip": {\r
- "description": "Interrupt Pending Register",\r
- "addressOffset": "0x014",\r
- "access": "r",\r
- "fields": {\r
- "txwm": {\r
- "description": "Transmit watermark interrupt pending",\r
- "bitOffset": "0",\r
- "bitWidth": "1"\r
- },\r
- "rxwm": {\r
- "description": "Receive watermark interrupt pending",\r
- "bitOffset": "1",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "div": {\r
- "description": "Baud Rate Divisor Register",\r
- "addressOffset": "0x018",\r
- "fields": {\r
- "value": {\r
- "description": "Baud rate divisor",\r
- "bitOffset": "0",\r
- "bitWidth": "16",\r
- "resetMask": "all",\r
- "resetValue": "0x0000FFFF"\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "uart0": {\r
- "description": "UART0 Interrupt",\r
- "value": "3"\r
- }\r
- }\r
- },\r
- "spi0": {\r
- "description": "Serial Peripheral Interface (SPI) Peripheral",\r
- "baseAddress": "0x10014000",\r
- "size": "0x1000",\r
- "resetMask": "none",\r
- "groupName": "spi",\r
- "registers": {\r
- "sckdiv": {\r
- "description": "Serial clock divisor Register",\r
- "addressOffset": "0x000",\r
- "fields": {\r
- "scale": {\r
- "description": "Divisor for serial clock",\r
- "bitOffset": "0",\r
- "bitWidth": "12",\r
- "resetMask": "all",\r
- "resetValue": "0x003"\r
- }\r
- }\r
- },\r
- "sckmode": {\r
- "description": "Serial Clock Mode Register",\r
- "addressOffset": "0x004",\r
- "fields": {\r
- "pha": {\r
- "description": "Serial clock phase",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "pol": {\r
- "description": "Serial clock polarity",\r
- "bitOffset": "1",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "csid": {\r
- "description": "Chip Select ID Register",\r
- "addressOffset": "0x010",\r
- "resetMask": "all",\r
- "resetValue": "0x00000000"\r
- },\r
- "csdef": {\r
- "description": "Chip Select Default Register",\r
- "addressOffset": "0x014",\r
- "resetMask": "all",\r
- "resetValue": "0x00000001"\r
- },\r
- "csmode": {\r
- "description": "Chip Select Mode Register",\r
- "addressOffset": "0x018",\r
- "fields": {\r
- "mode": {\r
- "description": "Chip select mode",\r
- "bitOffset": "0",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x0",\r
- "enumerations": {\r
- "csmode-enum": {\r
- "description": "Chip Select Modes Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "auto",\r
- "description": "Assert/de-assert CS at the beginning/end of each frame"\r
- },\r
- "*": {\r
- "displayName": "reserved"\r
- },\r
- "2": {\r
- "displayName": "hold",\r
- "description": "Keep CS continuously asserted after the initial frame"\r
- },\r
- "3": {\r
- "displayName": "off",\r
- "description": "Disable hardware control of the CS pin"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "delay0": {\r
- "description": "Delay Control 0 Register",\r
- "addressOffset": "0x028",\r
- "fields": {\r
- "cssck": {\r
- "description": "CS to SCK Delay",\r
- "bitOffset": "0",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x01"\r
- },\r
- "sckcs": {\r
- "description": "SCK to CS Delay",\r
- "bitOffset": "16",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x01"\r
- }\r
- }\r
- },\r
- "delay1": {\r
- "description": "Delay Control 1 Register",\r
- "addressOffset": "0x02C",\r
- "fields": {\r
- "intercs": {\r
- "description": "Minimum CS inactive time",\r
- "bitOffset": "0",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x01"\r
- },\r
- "interxfr": {\r
- "description": "Maximum interframe delay",\r
- "bitOffset": "16",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x01"\r
- }\r
- }\r
- },\r
- "fmt": {\r
- "description": "Frame Format Register",\r
- "addressOffset": "0x040",\r
- "fields": {\r
- "proto": {\r
- "description": "SPI Protocol",\r
- "bitOffset": "0",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x0",\r
- "enumerations": {\r
- "proto-enum": {\r
- "description": "SPI Protocol Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "single",\r
- "description": "DQ0 (MOSI), DQ1 (MISO)"\r
- },\r
- "1": {\r
- "displayName": "dual",\r
- "description": "DQ0, DQ1"\r
- },\r
- "2": {\r
- "displayName": "quad",\r
- "description": "DQ0, DQ1, DQ2, DQ3"\r
- },\r
- "*": {\r
- "displayName": "reserved"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "endian": {\r
- "description": "SPI endianness",\r
- "bitOffset": "2",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0",\r
- "enumerations": {\r
- "endian-enum": {\r
- "description": "SPI Endianness Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "msb",\r
- "description": "Transmit most-significant bit (MSB) first"\r
- },\r
- "1": {\r
- "displayName": "lsb",\r
- "description": "Transmit least-significant bit (LSB) first"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "dir": {\r
- "description": "SPI I/O Direction",\r
- "bitOffset": "3",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1",\r
- "enumerations": {\r
- "dir-enum": {\r
- "description": "SPI I/O Direction Enumeration",\r
- "values": {\r
- "0": {\r
- "displayName": "rx",\r
- "description": "For dual and quad protocols, the DQ pins are tri-stated. For the single protocol, the DQ0 pin is driven with the transmit data as normal."\r
- },\r
- "1": {\r
- "displayName": "tx",\r
- "description": "The receive FIFO is not populated."\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "len": {\r
- "description": "Number of bits per frame",\r
- "bitOffset": "16",\r
- "bitWidth": "4",\r
- "resetMask": "all",\r
- "resetValue": "0x8"\r
- }\r
- }\r
- },\r
- "txdata": {\r
- "description": "Tx FIFO Data Register",\r
- "addressOffset": "0x048",\r
- "fields": {\r
- "data": {\r
- "description": "Transmit data",\r
- "bitOffset": "0",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x00"\r
- },\r
- "full": {\r
- "description": "FIFO full flag",\r
- "bitOffset": "31",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- },\r
- "rxdata": {\r
- "description": "Rx FIFO Data Register",\r
- "addressOffset": "0x04C",\r
- "resetMask": "none",\r
- "access": "r",\r
- "fields": {\r
- "data": {\r
- "description": "Received data",\r
- "bitOffset": "0",\r
- "bitWidth": "8"\r
- },\r
- "empty": {\r
- "description": "FIFO empty flag",\r
- "bitOffset": "31",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "txmark": {\r
- "description": "Tx FIFO Watermark Register",\r
- "addressOffset": "0x050",\r
- "fields": {\r
- "value": {\r
- "description": "Transmit watermark",\r
- "bitOffset": "0",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- }\r
- }\r
- },\r
- "rxmark": {\r
- "description": "Rx FIFO Watermark Register",\r
- "addressOffset": "0x054",\r
- "fields": {\r
- "value": {\r
- "description": "Receive watermark",\r
- "bitOffset": "0",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "fctrl": {\r
- "description": "Flash Interface Control Register",\r
- "addressOffset": "0x060",\r
- "fields": {\r
- "en": {\r
- "description": "SPI Flash Mode Select",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- }\r
- }\r
- },\r
- "ffmt": {\r
- "description": "Flash Instruction Format Register",\r
- "addressOffset": "0x064",\r
- "fields": {\r
- "cmden": {\r
- "description": "Enable sending of command",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x1"\r
- },\r
- "addrlen": {\r
- "description": "Number of address bytes(0 to 4)",\r
- "bitOffset": "1",\r
- "bitWidth": "3",\r
- "resetMask": "all",\r
- "resetValue": "0x3"\r
- },\r
- "padcnt": {\r
- "description": "Number of dummy cycles",\r
- "bitOffset": "4",\r
- "bitWidth": "4",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmdproto": {\r
- "description": "Protocol for transmitting command",\r
- "bitOffset": "8",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "addrproto": {\r
- "description": "Protocol for transmitting address and padding",\r
- "bitOffset": "10",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "dataproto": {\r
- "description": "Protocol for receiving data bytes",\r
- "bitOffset": "12",\r
- "bitWidth": "2",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmdcode": {\r
- "description": "Value of command byte",\r
- "bitOffset": "16",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x03"\r
- },\r
- "padcode": {\r
- "description": "First 8 bits to transmit during dummy cycles",\r
- "bitOffset": "24",\r
- "bitWidth": "8",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "ie": {\r
- "description": "Interrupt Enable Register",\r
- "addressOffset": "0x070",\r
- "fields": {\r
- "txwm": {\r
- "description": "Transmit watermark enable",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "access": "r",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "rxwm": {\r
- "description": "Receive watermark enable",\r
- "bitOffset": "1",\r
- "bitWidth": "1",\r
- "access": "r",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- }\r
- }\r
- },\r
- "ip": {\r
- "description": "Interrupt Pending Register",\r
- "addressOffset": "0x074",\r
- "fields": {\r
- "txwm": {\r
- "description": "Transmit watermark pending",\r
- "bitOffset": "0",\r
- "bitWidth": "1",\r
- "access": "r"\r
- },\r
- "rxwm": {\r
- "description": "Receive watermark pending",\r
- "bitOffset": "1",\r
- "bitWidth": "1",\r
- "access": "r"\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "spi0": {\r
- "description": "SPI0 Interrupt",\r
- "value": "5"\r
- }\r
- }\r
- },\r
- "pwm0": {\r
- "description": "Pulse-Width Modulation (PWM) Peripheral",\r
- "baseAddress": "0x10015000",\r
- "size": "0x1000",\r
- "resetMask": "none",\r
- "registers": {\r
- "cfg": {\r
- "description": "Configuration Register",\r
- "addressOffset": "0x000",\r
- "fields": {\r
- "scale": {\r
- "description": "Counter scale",\r
- "bitOffset": "0",\r
- "bitWidth": "4"\r
- },\r
- "sticky": {\r
- "description": "Sticky - disallow clearing pwmcmpXip bits",\r
- "bitOffset": "8",\r
- "bitWidth": "1"\r
- },\r
- "zerocmp": {\r
- "description": "Zero - counter resets to zero after match",\r
- "bitOffset": "9",\r
- "bitWidth": "1"\r
- },\r
- "deglitch": {\r
- "description": "Deglitch - latch pwmcmpXip within same cycle",\r
- "bitOffset": "10",\r
- "bitWidth": "1"\r
- },\r
- "enalways": {\r
- "description": "Enable always - run continuously",\r
- "bitOffset": "12",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "enoneshot": {\r
- "description": "enable one shot - run one cycle",\r
- "bitOffset": "13",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmp0center": {\r
- "description": "PWM0 Compare Center",\r
- "bitOffset": "16",\r
- "bitWidth": "1"\r
- },\r
- "cmp1center": {\r
- "description": "PWM1 Compare Center",\r
- "bitOffset": "17",\r
- "bitWidth": "1"\r
- },\r
- "cmp2center": {\r
- "description": "PWM2 Compare Center",\r
- "bitOffset": "18",\r
- "bitWidth": "1"\r
- },\r
- "cmp3center": {\r
- "description": "PWM3 Compare Center",\r
- "bitOffset": "19",\r
- "bitWidth": "1"\r
- },\r
- "cmp0gang": {\r
- "description": "PWM0/PWM1 Compare Gang",\r
- "bitOffset": "24",\r
- "bitWidth": "1"\r
- },\r
- "cmp1gang": {\r
- "description": "PWM1/PWM2 Compare Gang",\r
- "bitOffset": "25",\r
- "bitWidth": "1"\r
- },\r
- "cmp2gang": {\r
- "description": "PWM2/PWM3 Compare Gang",\r
- "bitOffset": "26",\r
- "bitWidth": "1"\r
- },\r
- "cmp3gang": {\r
- "description": "PWM3/PWM0 Compare Gang",\r
- "bitOffset": "27",\r
- "bitWidth": "1"\r
- },\r
- "cmp0ip": {\r
- "description": "PWM0 Interrupt Pending",\r
- "bitOffset": "28",\r
- "bitWidth": "1"\r
- },\r
- "cmp1ip": {\r
- "description": "PWM1 Interrupt Pending",\r
- "bitOffset": "29",\r
- "bitWidth": "1"\r
- },\r
- "cmp2ip": {\r
- "description": "PWM2 Interrupt Pending",\r
- "bitOffset": "30",\r
- "bitWidth": "1"\r
- },\r
- "cmp3ip": {\r
- "description": "PWM3 Interrupt Pending",\r
- "bitOffset": "31",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "count": {\r
- "description": "Configuration Register",\r
- "addressOffset": "0x008"\r
- },\r
- "scale": {\r
- "description": "Scale Register",\r
- "addressOffset": "0x010",\r
- "fields": {\r
- "value": {\r
- "description": "Compare value",\r
- "bitOffset": "0",\r
- "bitWidth": "8"\r
- }\r
- }\r
- },\r
- "cmp": {\r
- "arraySize": "4",\r
- "description": "Compare Registers",\r
- "addressOffset": "0x020",\r
- "fields": {\r
- "value": {\r
- "description": "Compare value",\r
- "bitOffset": "0",\r
- "bitWidth": "8"\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "pwm0cmp0": {\r
- "description": "PWM0 Compare 0 Interrupt",\r
- "value": "40"\r
- },\r
- "pwm0cmp1": {\r
- "description": "PWM0 Compare 1 Interrupt",\r
- "value": "41"\r
- },\r
- "pwm0cmp2": {\r
- "description": "PWM0 Compare 2 Interrupt",\r
- "value": "42"\r
- },\r
- "pwm0cmp3": {\r
- "description": "PWM0 Compare 3 Interrupt",\r
- "value": "43"\r
- }\r
- }\r
- },\r
- "uart1": {\r
- "baseAddress": "0x10023000",\r
- "derivedFrom": "uart0",\r
- "groupName": "uart",\r
- "interrupts": {\r
- "uart1": {\r
- "description": "UART1 Interrupt",\r
- "value": "4"\r
- }\r
- }\r
- },\r
- "spi1": {\r
- "baseAddress": "0x10024000",\r
- "derivedFrom": "spi0",\r
- "groupName": "spi",\r
- "interrupts": {\r
- "spi1": {\r
- "description": "SPI1 Interrupt",\r
- "value": "6"\r
- }\r
- }\r
- },\r
- "pwm1": {\r
- "description": "Pulse-Width Modulation (PWM) Peripheral",\r
- "baseAddress": "0x10025000",\r
- "groupName": "pwm",\r
- "size": "0x1000",\r
- "resetMask": "none",\r
- "groupName": "pwm",\r
- "registers": {\r
- "cfg": {\r
- "description": "Configuration Register",\r
- "addressOffset": "0x000",\r
- "fields": {\r
- "scale": {\r
- "description": "Counter scale",\r
- "bitOffset": "0",\r
- "bitWidth": "4"\r
- },\r
- "sticky": {\r
- "description": "Sticky - disallow clearing pwmcmpXip bits",\r
- "bitOffset": "8",\r
- "bitWidth": "1"\r
- },\r
- "zerocmp": {\r
- "description": "Zero - counter resets to zero after match",\r
- "bitOffset": "9",\r
- "bitWidth": "1"\r
- },\r
- "deglitch": {\r
- "description": "Deglitch - latch pwmcmpXip within same cycle",\r
- "bitOffset": "10",\r
- "bitWidth": "1"\r
- },\r
- "enalways": {\r
- "description": "Enable always - run continuously",\r
- "bitOffset": "12",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "enoneshot": {\r
- "description": "enable one shot - run one cycle",\r
- "bitOffset": "13",\r
- "bitWidth": "1",\r
- "resetMask": "all",\r
- "resetValue": "0x0"\r
- },\r
- "cmp0center": {\r
- "description": "PWM0 Compare Center",\r
- "bitOffset": "16",\r
- "bitWidth": "1"\r
- },\r
- "cmp1center": {\r
- "description": "PWM1 Compare Center",\r
- "bitOffset": "17",\r
- "bitWidth": "1"\r
- },\r
- "cmp2center": {\r
- "description": "PWM2 Compare Center",\r
- "bitOffset": "18",\r
- "bitWidth": "1"\r
- },\r
- "cmp3center": {\r
- "description": "PWM3 Compare Center",\r
- "bitOffset": "19",\r
- "bitWidth": "1"\r
- },\r
- "cmp0gang": {\r
- "description": "PWM0/PWM1 Compare Gang",\r
- "bitOffset": "24",\r
- "bitWidth": "1"\r
- },\r
- "cmp1gang": {\r
- "description": "PWM1/PWM2 Compare Gang",\r
- "bitOffset": "25",\r
- "bitWidth": "1"\r
- },\r
- "cmp2gang": {\r
- "description": "PWM2/PWM3 Compare Gang",\r
- "bitOffset": "26",\r
- "bitWidth": "1"\r
- },\r
- "cmp3gang": {\r
- "description": "PWM3/PWM0 Compare Gang",\r
- "bitOffset": "27",\r
- "bitWidth": "1"\r
- },\r
- "cmp0ip": {\r
- "description": "PWM0 Interrupt Pending",\r
- "bitOffset": "28",\r
- "bitWidth": "1"\r
- },\r
- "cmp1ip": {\r
- "description": "PWM1 Interrupt Pending",\r
- "bitOffset": "29",\r
- "bitWidth": "1"\r
- },\r
- "cmp2ip": {\r
- "description": "PWM2 Interrupt Pending",\r
- "bitOffset": "30",\r
- "bitWidth": "1"\r
- },\r
- "cmp3ip": {\r
- "description": "PWM3 Interrupt Pending",\r
- "bitOffset": "31",\r
- "bitWidth": "1"\r
- }\r
- }\r
- },\r
- "count": {\r
- "description": "Configuration Register",\r
- "addressOffset": "0x008"\r
- },\r
- "scale": {\r
- "description": "Scale Register",\r
- "addressOffset": "0x010",\r
- "fields": {\r
- "value": {\r
- "description": "Compare value",\r
- "bitOffset": "0",\r
- "bitWidth": "16"\r
- }\r
- }\r
- },\r
- "cmp": {\r
- "arraySize": "4",\r
- "description": "Compare Registers",\r
- "addressOffset": "0x020",\r
- "fields": {\r
- "value": {\r
- "description": "Compare value",\r
- "bitOffset": "0",\r
- "bitWidth": "16"\r
- }\r
- }\r
- }\r
- },\r
- "interrupts": {\r
- "pwm1cmp0": {\r
- "description": "PWM1 Compare 0 Interrupt",\r
- "value": "44"\r
- },\r
- "pwm1cmp1": {\r
- "description": "PWM1 Compare 1 Interrupt",\r
- "value": "45"\r
- },\r
- "pwm1cmp2": {\r
- "description": "PWM1 Compare 2 Interrupt",\r
- "value": "46"\r
- },\r
- "pwm1cmp3": {\r
- "description": "PWM1 Compare 3 Interrupt",\r
- "value": "47"\r
- }\r
- }\r
- },\r
- "spi2": {\r
- "baseAddress": "0x10034000",\r
- "derivedFrom": "spi0",\r
- "groupName": "spi",\r
- "interrupts": {\r
- "spi2": {\r
- "description": "SPI2 Interrupt",\r
- "value": "7"\r
- }\r
- }\r
- },\r
- "pwm2": {\r
- "baseAddress": "0x10035000",\r
- "derivedFrom": "pwm1",\r
- "groupName": "pwm",\r
- "interrupts": {\r
- "pwm2cmp0": {\r
- "description": "PWM2 Compare 0 Interrupt",\r
- "value": "48"\r
- },\r
- "pwm2cmp1": {\r
- "description": "PWM2 Compare 1 Interrupt",\r
- "value": "49"\r
- },\r
- "pwm2cmp2": {\r
- "description": "PWM2 Compare 2 Interrupt",\r
- "value": "50"\r
- },\r
- "pwm2cmp3": {\r
- "description": "PWM2 Compare 3 Interrupt",\r
- "value": "51"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-
-This software, except as otherwise noted in subrepositories,
-is licensed under the Apache 2 license, quoted below.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016 SiFive, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef RISCV_CSR_ENCODING_H\r
-#define RISCV_CSR_ENCODING_H\r
-\r
-#define MSTATUS_UIE 0x00000001\r
-#define MSTATUS_SIE 0x00000002\r
-#define MSTATUS_HIE 0x00000004\r
-#define MSTATUS_MIE 0x00000008\r
-#define MSTATUS_UPIE 0x00000010\r
-#define MSTATUS_SPIE 0x00000020\r
-#define MSTATUS_HPIE 0x00000040\r
-#define MSTATUS_MPIE 0x00000080\r
-#define MSTATUS_SPP 0x00000100\r
-#define MSTATUS_HPP 0x00000600\r
-#define MSTATUS_MPP 0x00001800\r
-#define MSTATUS_FS 0x00006000\r
-#define MSTATUS_XS 0x00018000\r
-#define MSTATUS_MPRV 0x00020000\r
-#define MSTATUS_PUM 0x00040000\r
-#define MSTATUS_MXR 0x00080000\r
-#define MSTATUS_VM 0x1F000000\r
-#define MSTATUS32_SD 0x80000000\r
-#define MSTATUS64_SD 0x8000000000000000\r
-\r
-#define SSTATUS_UIE 0x00000001\r
-#define SSTATUS_SIE 0x00000002\r
-#define SSTATUS_UPIE 0x00000010\r
-#define SSTATUS_SPIE 0x00000020\r
-#define SSTATUS_SPP 0x00000100\r
-#define SSTATUS_FS 0x00006000\r
-#define SSTATUS_XS 0x00018000\r
-#define SSTATUS_PUM 0x00040000\r
-#define SSTATUS32_SD 0x80000000\r
-#define SSTATUS64_SD 0x8000000000000000\r
-\r
-#define DCSR_XDEBUGVER (3U<<30)\r
-#define DCSR_NDRESET (1<<29)\r
-#define DCSR_FULLRESET (1<<28)\r
-#define DCSR_EBREAKM (1<<15)\r
-#define DCSR_EBREAKH (1<<14)\r
-#define DCSR_EBREAKS (1<<13)\r
-#define DCSR_EBREAKU (1<<12)\r
-#define DCSR_STOPCYCLE (1<<10)\r
-#define DCSR_STOPTIME (1<<9)\r
-#define DCSR_CAUSE (7<<6)\r
-#define DCSR_DEBUGINT (1<<5)\r
-#define DCSR_HALT (1<<3)\r
-#define DCSR_STEP (1<<2)\r
-#define DCSR_PRV (3<<0)\r
-\r
-#define DCSR_CAUSE_NONE 0\r
-#define DCSR_CAUSE_SWBP 1\r
-#define DCSR_CAUSE_HWBP 2\r
-#define DCSR_CAUSE_DEBUGINT 3\r
-#define DCSR_CAUSE_STEP 4\r
-#define DCSR_CAUSE_HALT 5\r
-\r
-#define MCONTROL_TYPE(xlen) (0xfULL<<((xlen)-4))\r
-#define MCONTROL_DMODE(xlen) (1ULL<<((xlen)-5))\r
-#define MCONTROL_MASKMAX(xlen) (0x3fULL<<((xlen)-11))\r
-\r
-#define MCONTROL_SELECT (1<<19)\r
-#define MCONTROL_TIMING (1<<18)\r
-#define MCONTROL_ACTION (0x3f<<12)\r
-#define MCONTROL_CHAIN (1<<11)\r
-#define MCONTROL_MATCH (0xf<<7)\r
-#define MCONTROL_M (1<<6)\r
-#define MCONTROL_H (1<<5)\r
-#define MCONTROL_S (1<<4)\r
-#define MCONTROL_U (1<<3)\r
-#define MCONTROL_EXECUTE (1<<2)\r
-#define MCONTROL_STORE (1<<1)\r
-#define MCONTROL_LOAD (1<<0)\r
-\r
-#define MCONTROL_TYPE_NONE 0\r
-#define MCONTROL_TYPE_MATCH 2\r
-\r
-#define MCONTROL_ACTION_DEBUG_EXCEPTION 0\r
-#define MCONTROL_ACTION_DEBUG_MODE 1\r
-#define MCONTROL_ACTION_TRACE_START 2\r
-#define MCONTROL_ACTION_TRACE_STOP 3\r
-#define MCONTROL_ACTION_TRACE_EMIT 4\r
-\r
-#define MCONTROL_MATCH_EQUAL 0\r
-#define MCONTROL_MATCH_NAPOT 1\r
-#define MCONTROL_MATCH_GE 2\r
-#define MCONTROL_MATCH_LT 3\r
-#define MCONTROL_MATCH_MASK_LOW 4\r
-#define MCONTROL_MATCH_MASK_HIGH 5\r
-\r
-#define MIP_SSIP (1 << IRQ_S_SOFT)\r
-#define MIP_HSIP (1 << IRQ_H_SOFT)\r
-#define MIP_MSIP (1 << IRQ_M_SOFT)\r
-#define MIP_STIP (1 << IRQ_S_TIMER)\r
-#define MIP_HTIP (1 << IRQ_H_TIMER)\r
-#define MIP_MTIP (1 << IRQ_M_TIMER)\r
-#define MIP_SEIP (1 << IRQ_S_EXT)\r
-#define MIP_HEIP (1 << IRQ_H_EXT)\r
-#define MIP_MEIP (1 << IRQ_M_EXT)\r
-\r
-#define SIP_SSIP MIP_SSIP\r
-#define SIP_STIP MIP_STIP\r
-\r
-#define PRV_U 0\r
-#define PRV_S 1\r
-#define PRV_H 2\r
-#define PRV_M 3\r
-\r
-#define VM_MBARE 0\r
-#define VM_MBB 1\r
-#define VM_MBBID 2\r
-#define VM_SV32 8\r
-#define VM_SV39 9\r
-#define VM_SV48 10\r
-\r
-#define IRQ_S_SOFT 1\r
-#define IRQ_H_SOFT 2\r
-#define IRQ_M_SOFT 3\r
-#define IRQ_S_TIMER 5\r
-#define IRQ_H_TIMER 6\r
-#define IRQ_M_TIMER 7\r
-#define IRQ_S_EXT 9\r
-#define IRQ_H_EXT 10\r
-#define IRQ_M_EXT 11\r
-#define IRQ_COP 12\r
-#define IRQ_HOST 13\r
-\r
-#define DEFAULT_RSTVEC 0x00001000\r
-#define DEFAULT_NMIVEC 0x00001004\r
-#define DEFAULT_MTVEC 0x00001010\r
-#define CONFIG_STRING_ADDR 0x0000100C\r
-#define EXT_IO_BASE 0x40000000\r
-#define DRAM_BASE 0x80000000\r
-\r
-// page table entry (PTE) fields\r
-#define PTE_V 0x001 // Valid\r
-#define PTE_R 0x002 // Read\r
-#define PTE_W 0x004 // Write\r
-#define PTE_X 0x008 // Execute\r
-#define PTE_U 0x010 // User\r
-#define PTE_G 0x020 // Global\r
-#define PTE_A 0x040 // Accessed\r
-#define PTE_D 0x080 // Dirty\r
-#define PTE_SOFT 0x300 // Reserved for Software\r
-\r
-#define PTE_PPN_SHIFT 10\r
-\r
-#define PTE_TABLE(PTE) (((PTE) & (PTE_V | PTE_R | PTE_W | PTE_X)) == PTE_V)\r
-\r
-#ifdef __riscv\r
-\r
-#ifdef __riscv64\r
-# define MSTATUS_SD MSTATUS64_SD\r
-# define SSTATUS_SD SSTATUS64_SD\r
-# define RISCV_PGLEVEL_BITS 9\r
-#else\r
-# define MSTATUS_SD MSTATUS32_SD\r
-# define SSTATUS_SD SSTATUS32_SD\r
-# define RISCV_PGLEVEL_BITS 10\r
-#endif\r
-#define RISCV_PGSHIFT 12\r
-#define RISCV_PGSIZE (1 << RISCV_PGSHIFT)\r
-\r
-#ifndef __ASSEMBLER__\r
-\r
-#ifdef __GNUC__\r
-\r
-#define read_csr(reg) ({ unsigned long __tmp; \\r
- asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \\r
- __tmp; })\r
-\r
-#define write_csr(reg, val) ({ \\r
- if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \\r
- asm volatile ("csrw " #reg ", %0" :: "i"(val)); \\r
- else \\r
- asm volatile ("csrw " #reg ", %0" :: "r"(val)); })\r
-\r
-#define swap_csr(reg, val) ({ unsigned long __tmp; \\r
- if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \\r
- asm volatile ("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "i"(val)); \\r
- else \\r
- asm volatile ("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "r"(val)); \\r
- __tmp; })\r
-\r
-#define set_csr(reg, bit) ({ unsigned long __tmp; \\r
- if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \\r
- asm volatile ("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \\r
- else \\r
- asm volatile ("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \\r
- __tmp; })\r
-\r
-#define clear_csr(reg, bit) ({ unsigned long __tmp; \\r
- if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \\r
- asm volatile ("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \\r
- else \\r
- asm volatile ("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \\r
- __tmp; })\r
-\r
-#define rdtime() read_csr(time)\r
-#define rdcycle() read_csr(cycle)\r
-#define rdinstret() read_csr(instret)\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-#endif\r
-/* Automatically generated by parse-opcodes */\r
-#ifndef RISCV_ENCODING_H\r
-#define RISCV_ENCODING_H\r
-#define MATCH_BEQ 0x63\r
-#define MASK_BEQ 0x707f\r
-#define MATCH_BNE 0x1063\r
-#define MASK_BNE 0x707f\r
-#define MATCH_BLT 0x4063\r
-#define MASK_BLT 0x707f\r
-#define MATCH_BGE 0x5063\r
-#define MASK_BGE 0x707f\r
-#define MATCH_BLTU 0x6063\r
-#define MASK_BLTU 0x707f\r
-#define MATCH_BGEU 0x7063\r
-#define MASK_BGEU 0x707f\r
-#define MATCH_JALR 0x67\r
-#define MASK_JALR 0x707f\r
-#define MATCH_JAL 0x6f\r
-#define MASK_JAL 0x7f\r
-#define MATCH_LUI 0x37\r
-#define MASK_LUI 0x7f\r
-#define MATCH_AUIPC 0x17\r
-#define MASK_AUIPC 0x7f\r
-#define MATCH_ADDI 0x13\r
-#define MASK_ADDI 0x707f\r
-#define MATCH_SLLI 0x1013\r
-#define MASK_SLLI 0xfc00707f\r
-#define MATCH_SLTI 0x2013\r
-#define MASK_SLTI 0x707f\r
-#define MATCH_SLTIU 0x3013\r
-#define MASK_SLTIU 0x707f\r
-#define MATCH_XORI 0x4013\r
-#define MASK_XORI 0x707f\r
-#define MATCH_SRLI 0x5013\r
-#define MASK_SRLI 0xfc00707f\r
-#define MATCH_SRAI 0x40005013\r
-#define MASK_SRAI 0xfc00707f\r
-#define MATCH_ORI 0x6013\r
-#define MASK_ORI 0x707f\r
-#define MATCH_ANDI 0x7013\r
-#define MASK_ANDI 0x707f\r
-#define MATCH_ADD 0x33\r
-#define MASK_ADD 0xfe00707f\r
-#define MATCH_SUB 0x40000033\r
-#define MASK_SUB 0xfe00707f\r
-#define MATCH_SLL 0x1033\r
-#define MASK_SLL 0xfe00707f\r
-#define MATCH_SLT 0x2033\r
-#define MASK_SLT 0xfe00707f\r
-#define MATCH_SLTU 0x3033\r
-#define MASK_SLTU 0xfe00707f\r
-#define MATCH_XOR 0x4033\r
-#define MASK_XOR 0xfe00707f\r
-#define MATCH_SRL 0x5033\r
-#define MASK_SRL 0xfe00707f\r
-#define MATCH_SRA 0x40005033\r
-#define MASK_SRA 0xfe00707f\r
-#define MATCH_OR 0x6033\r
-#define MASK_OR 0xfe00707f\r
-#define MATCH_AND 0x7033\r
-#define MASK_AND 0xfe00707f\r
-#define MATCH_ADDIW 0x1b\r
-#define MASK_ADDIW 0x707f\r
-#define MATCH_SLLIW 0x101b\r
-#define MASK_SLLIW 0xfe00707f\r
-#define MATCH_SRLIW 0x501b\r
-#define MASK_SRLIW 0xfe00707f\r
-#define MATCH_SRAIW 0x4000501b\r
-#define MASK_SRAIW 0xfe00707f\r
-#define MATCH_ADDW 0x3b\r
-#define MASK_ADDW 0xfe00707f\r
-#define MATCH_SUBW 0x4000003b\r
-#define MASK_SUBW 0xfe00707f\r
-#define MATCH_SLLW 0x103b\r
-#define MASK_SLLW 0xfe00707f\r
-#define MATCH_SRLW 0x503b\r
-#define MASK_SRLW 0xfe00707f\r
-#define MATCH_SRAW 0x4000503b\r
-#define MASK_SRAW 0xfe00707f\r
-#define MATCH_LB 0x3\r
-#define MASK_LB 0x707f\r
-#define MATCH_LH 0x1003\r
-#define MASK_LH 0x707f\r
-#define MATCH_LW 0x2003\r
-#define MASK_LW 0x707f\r
-#define MATCH_LD 0x3003\r
-#define MASK_LD 0x707f\r
-#define MATCH_LBU 0x4003\r
-#define MASK_LBU 0x707f\r
-#define MATCH_LHU 0x5003\r
-#define MASK_LHU 0x707f\r
-#define MATCH_LWU 0x6003\r
-#define MASK_LWU 0x707f\r
-#define MATCH_SB 0x23\r
-#define MASK_SB 0x707f\r
-#define MATCH_SH 0x1023\r
-#define MASK_SH 0x707f\r
-#define MATCH_SW 0x2023\r
-#define MASK_SW 0x707f\r
-#define MATCH_SD 0x3023\r
-#define MASK_SD 0x707f\r
-#define MATCH_FENCE 0xf\r
-#define MASK_FENCE 0x707f\r
-#define MATCH_FENCE_I 0x100f\r
-#define MASK_FENCE_I 0x707f\r
-#define MATCH_MUL 0x2000033\r
-#define MASK_MUL 0xfe00707f\r
-#define MATCH_MULH 0x2001033\r
-#define MASK_MULH 0xfe00707f\r
-#define MATCH_MULHSU 0x2002033\r
-#define MASK_MULHSU 0xfe00707f\r
-#define MATCH_MULHU 0x2003033\r
-#define MASK_MULHU 0xfe00707f\r
-#define MATCH_DIV 0x2004033\r
-#define MASK_DIV 0xfe00707f\r
-#define MATCH_DIVU 0x2005033\r
-#define MASK_DIVU 0xfe00707f\r
-#define MATCH_REM 0x2006033\r
-#define MASK_REM 0xfe00707f\r
-#define MATCH_REMU 0x2007033\r
-#define MASK_REMU 0xfe00707f\r
-#define MATCH_MULW 0x200003b\r
-#define MASK_MULW 0xfe00707f\r
-#define MATCH_DIVW 0x200403b\r
-#define MASK_DIVW 0xfe00707f\r
-#define MATCH_DIVUW 0x200503b\r
-#define MASK_DIVUW 0xfe00707f\r
-#define MATCH_REMW 0x200603b\r
-#define MASK_REMW 0xfe00707f\r
-#define MATCH_REMUW 0x200703b\r
-#define MASK_REMUW 0xfe00707f\r
-#define MATCH_AMOADD_W 0x202f\r
-#define MASK_AMOADD_W 0xf800707f\r
-#define MATCH_AMOXOR_W 0x2000202f\r
-#define MASK_AMOXOR_W 0xf800707f\r
-#define MATCH_AMOOR_W 0x4000202f\r
-#define MASK_AMOOR_W 0xf800707f\r
-#define MATCH_AMOAND_W 0x6000202f\r
-#define MASK_AMOAND_W 0xf800707f\r
-#define MATCH_AMOMIN_W 0x8000202f\r
-#define MASK_AMOMIN_W 0xf800707f\r
-#define MATCH_AMOMAX_W 0xa000202f\r
-#define MASK_AMOMAX_W 0xf800707f\r
-#define MATCH_AMOMINU_W 0xc000202f\r
-#define MASK_AMOMINU_W 0xf800707f\r
-#define MATCH_AMOMAXU_W 0xe000202f\r
-#define MASK_AMOMAXU_W 0xf800707f\r
-#define MATCH_AMOSWAP_W 0x800202f\r
-#define MASK_AMOSWAP_W 0xf800707f\r
-#define MATCH_LR_W 0x1000202f\r
-#define MASK_LR_W 0xf9f0707f\r
-#define MATCH_SC_W 0x1800202f\r
-#define MASK_SC_W 0xf800707f\r
-#define MATCH_AMOADD_D 0x302f\r
-#define MASK_AMOADD_D 0xf800707f\r
-#define MATCH_AMOXOR_D 0x2000302f\r
-#define MASK_AMOXOR_D 0xf800707f\r
-#define MATCH_AMOOR_D 0x4000302f\r
-#define MASK_AMOOR_D 0xf800707f\r
-#define MATCH_AMOAND_D 0x6000302f\r
-#define MASK_AMOAND_D 0xf800707f\r
-#define MATCH_AMOMIN_D 0x8000302f\r
-#define MASK_AMOMIN_D 0xf800707f\r
-#define MATCH_AMOMAX_D 0xa000302f\r
-#define MASK_AMOMAX_D 0xf800707f\r
-#define MATCH_AMOMINU_D 0xc000302f\r
-#define MASK_AMOMINU_D 0xf800707f\r
-#define MATCH_AMOMAXU_D 0xe000302f\r
-#define MASK_AMOMAXU_D 0xf800707f\r
-#define MATCH_AMOSWAP_D 0x800302f\r
-#define MASK_AMOSWAP_D 0xf800707f\r
-#define MATCH_LR_D 0x1000302f\r
-#define MASK_LR_D 0xf9f0707f\r
-#define MATCH_SC_D 0x1800302f\r
-#define MASK_SC_D 0xf800707f\r
-#define MATCH_ECALL 0x73\r
-#define MASK_ECALL 0xffffffff\r
-#define MATCH_EBREAK 0x100073\r
-#define MASK_EBREAK 0xffffffff\r
-#define MATCH_URET 0x200073\r
-#define MASK_URET 0xffffffff\r
-#define MATCH_SRET 0x10200073\r
-#define MASK_SRET 0xffffffff\r
-#define MATCH_HRET 0x20200073\r
-#define MASK_HRET 0xffffffff\r
-#define MATCH_MRET 0x30200073\r
-#define MASK_MRET 0xffffffff\r
-#define MATCH_DRET 0x7b200073\r
-#define MASK_DRET 0xffffffff\r
-#define MATCH_SFENCE_VM 0x10400073\r
-#define MASK_SFENCE_VM 0xfff07fff\r
-#define MATCH_WFI 0x10500073\r
-#define MASK_WFI 0xffffffff\r
-#define MATCH_CSRRW 0x1073\r
-#define MASK_CSRRW 0x707f\r
-#define MATCH_CSRRS 0x2073\r
-#define MASK_CSRRS 0x707f\r
-#define MATCH_CSRRC 0x3073\r
-#define MASK_CSRRC 0x707f\r
-#define MATCH_CSRRWI 0x5073\r
-#define MASK_CSRRWI 0x707f\r
-#define MATCH_CSRRSI 0x6073\r
-#define MASK_CSRRSI 0x707f\r
-#define MATCH_CSRRCI 0x7073\r
-#define MASK_CSRRCI 0x707f\r
-#define MATCH_FADD_S 0x53\r
-#define MASK_FADD_S 0xfe00007f\r
-#define MATCH_FSUB_S 0x8000053\r
-#define MASK_FSUB_S 0xfe00007f\r
-#define MATCH_FMUL_S 0x10000053\r
-#define MASK_FMUL_S 0xfe00007f\r
-#define MATCH_FDIV_S 0x18000053\r
-#define MASK_FDIV_S 0xfe00007f\r
-#define MATCH_FSGNJ_S 0x20000053\r
-#define MASK_FSGNJ_S 0xfe00707f\r
-#define MATCH_FSGNJN_S 0x20001053\r
-#define MASK_FSGNJN_S 0xfe00707f\r
-#define MATCH_FSGNJX_S 0x20002053\r
-#define MASK_FSGNJX_S 0xfe00707f\r
-#define MATCH_FMIN_S 0x28000053\r
-#define MASK_FMIN_S 0xfe00707f\r
-#define MATCH_FMAX_S 0x28001053\r
-#define MASK_FMAX_S 0xfe00707f\r
-#define MATCH_FSQRT_S 0x58000053\r
-#define MASK_FSQRT_S 0xfff0007f\r
-#define MATCH_FADD_D 0x2000053\r
-#define MASK_FADD_D 0xfe00007f\r
-#define MATCH_FSUB_D 0xa000053\r
-#define MASK_FSUB_D 0xfe00007f\r
-#define MATCH_FMUL_D 0x12000053\r
-#define MASK_FMUL_D 0xfe00007f\r
-#define MATCH_FDIV_D 0x1a000053\r
-#define MASK_FDIV_D 0xfe00007f\r
-#define MATCH_FSGNJ_D 0x22000053\r
-#define MASK_FSGNJ_D 0xfe00707f\r
-#define MATCH_FSGNJN_D 0x22001053\r
-#define MASK_FSGNJN_D 0xfe00707f\r
-#define MATCH_FSGNJX_D 0x22002053\r
-#define MASK_FSGNJX_D 0xfe00707f\r
-#define MATCH_FMIN_D 0x2a000053\r
-#define MASK_FMIN_D 0xfe00707f\r
-#define MATCH_FMAX_D 0x2a001053\r
-#define MASK_FMAX_D 0xfe00707f\r
-#define MATCH_FCVT_S_D 0x40100053\r
-#define MASK_FCVT_S_D 0xfff0007f\r
-#define MATCH_FCVT_D_S 0x42000053\r
-#define MASK_FCVT_D_S 0xfff0007f\r
-#define MATCH_FSQRT_D 0x5a000053\r
-#define MASK_FSQRT_D 0xfff0007f\r
-#define MATCH_FLE_S 0xa0000053\r
-#define MASK_FLE_S 0xfe00707f\r
-#define MATCH_FLT_S 0xa0001053\r
-#define MASK_FLT_S 0xfe00707f\r
-#define MATCH_FEQ_S 0xa0002053\r
-#define MASK_FEQ_S 0xfe00707f\r
-#define MATCH_FLE_D 0xa2000053\r
-#define MASK_FLE_D 0xfe00707f\r
-#define MATCH_FLT_D 0xa2001053\r
-#define MASK_FLT_D 0xfe00707f\r
-#define MATCH_FEQ_D 0xa2002053\r
-#define MASK_FEQ_D 0xfe00707f\r
-#define MATCH_FCVT_W_S 0xc0000053\r
-#define MASK_FCVT_W_S 0xfff0007f\r
-#define MATCH_FCVT_WU_S 0xc0100053\r
-#define MASK_FCVT_WU_S 0xfff0007f\r
-#define MATCH_FCVT_L_S 0xc0200053\r
-#define MASK_FCVT_L_S 0xfff0007f\r
-#define MATCH_FCVT_LU_S 0xc0300053\r
-#define MASK_FCVT_LU_S 0xfff0007f\r
-#define MATCH_FMV_X_S 0xe0000053\r
-#define MASK_FMV_X_S 0xfff0707f\r
-#define MATCH_FCLASS_S 0xe0001053\r
-#define MASK_FCLASS_S 0xfff0707f\r
-#define MATCH_FCVT_W_D 0xc2000053\r
-#define MASK_FCVT_W_D 0xfff0007f\r
-#define MATCH_FCVT_WU_D 0xc2100053\r
-#define MASK_FCVT_WU_D 0xfff0007f\r
-#define MATCH_FCVT_L_D 0xc2200053\r
-#define MASK_FCVT_L_D 0xfff0007f\r
-#define MATCH_FCVT_LU_D 0xc2300053\r
-#define MASK_FCVT_LU_D 0xfff0007f\r
-#define MATCH_FMV_X_D 0xe2000053\r
-#define MASK_FMV_X_D 0xfff0707f\r
-#define MATCH_FCLASS_D 0xe2001053\r
-#define MASK_FCLASS_D 0xfff0707f\r
-#define MATCH_FCVT_S_W 0xd0000053\r
-#define MASK_FCVT_S_W 0xfff0007f\r
-#define MATCH_FCVT_S_WU 0xd0100053\r
-#define MASK_FCVT_S_WU 0xfff0007f\r
-#define MATCH_FCVT_S_L 0xd0200053\r
-#define MASK_FCVT_S_L 0xfff0007f\r
-#define MATCH_FCVT_S_LU 0xd0300053\r
-#define MASK_FCVT_S_LU 0xfff0007f\r
-#define MATCH_FMV_S_X 0xf0000053\r
-#define MASK_FMV_S_X 0xfff0707f\r
-#define MATCH_FCVT_D_W 0xd2000053\r
-#define MASK_FCVT_D_W 0xfff0007f\r
-#define MATCH_FCVT_D_WU 0xd2100053\r
-#define MASK_FCVT_D_WU 0xfff0007f\r
-#define MATCH_FCVT_D_L 0xd2200053\r
-#define MASK_FCVT_D_L 0xfff0007f\r
-#define MATCH_FCVT_D_LU 0xd2300053\r
-#define MASK_FCVT_D_LU 0xfff0007f\r
-#define MATCH_FMV_D_X 0xf2000053\r
-#define MASK_FMV_D_X 0xfff0707f\r
-#define MATCH_FLW 0x2007\r
-#define MASK_FLW 0x707f\r
-#define MATCH_FLD 0x3007\r
-#define MASK_FLD 0x707f\r
-#define MATCH_FSW 0x2027\r
-#define MASK_FSW 0x707f\r
-#define MATCH_FSD 0x3027\r
-#define MASK_FSD 0x707f\r
-#define MATCH_FMADD_S 0x43\r
-#define MASK_FMADD_S 0x600007f\r
-#define MATCH_FMSUB_S 0x47\r
-#define MASK_FMSUB_S 0x600007f\r
-#define MATCH_FNMSUB_S 0x4b\r
-#define MASK_FNMSUB_S 0x600007f\r
-#define MATCH_FNMADD_S 0x4f\r
-#define MASK_FNMADD_S 0x600007f\r
-#define MATCH_FMADD_D 0x2000043\r
-#define MASK_FMADD_D 0x600007f\r
-#define MATCH_FMSUB_D 0x2000047\r
-#define MASK_FMSUB_D 0x600007f\r
-#define MATCH_FNMSUB_D 0x200004b\r
-#define MASK_FNMSUB_D 0x600007f\r
-#define MATCH_FNMADD_D 0x200004f\r
-#define MASK_FNMADD_D 0x600007f\r
-#define MATCH_C_NOP 0x1\r
-#define MASK_C_NOP 0xffff\r
-#define MATCH_C_ADDI16SP 0x6101\r
-#define MASK_C_ADDI16SP 0xef83\r
-#define MATCH_C_JR 0x8002\r
-#define MASK_C_JR 0xf07f\r
-#define MATCH_C_JALR 0x9002\r
-#define MASK_C_JALR 0xf07f\r
-#define MATCH_C_EBREAK 0x9002\r
-#define MASK_C_EBREAK 0xffff\r
-#define MATCH_C_LD 0x6000\r
-#define MASK_C_LD 0xe003\r
-#define MATCH_C_SD 0xe000\r
-#define MASK_C_SD 0xe003\r
-#define MATCH_C_ADDIW 0x2001\r
-#define MASK_C_ADDIW 0xe003\r
-#define MATCH_C_LDSP 0x6002\r
-#define MASK_C_LDSP 0xe003\r
-#define MATCH_C_SDSP 0xe002\r
-#define MASK_C_SDSP 0xe003\r
-#define MATCH_C_ADDI4SPN 0x0\r
-#define MASK_C_ADDI4SPN 0xe003\r
-#define MATCH_C_FLD 0x2000\r
-#define MASK_C_FLD 0xe003\r
-#define MATCH_C_LW 0x4000\r
-#define MASK_C_LW 0xe003\r
-#define MATCH_C_FLW 0x6000\r
-#define MASK_C_FLW 0xe003\r
-#define MATCH_C_FSD 0xa000\r
-#define MASK_C_FSD 0xe003\r
-#define MATCH_C_SW 0xc000\r
-#define MASK_C_SW 0xe003\r
-#define MATCH_C_FSW 0xe000\r
-#define MASK_C_FSW 0xe003\r
-#define MATCH_C_ADDI 0x1\r
-#define MASK_C_ADDI 0xe003\r
-#define MATCH_C_JAL 0x2001\r
-#define MASK_C_JAL 0xe003\r
-#define MATCH_C_LI 0x4001\r
-#define MASK_C_LI 0xe003\r
-#define MATCH_C_LUI 0x6001\r
-#define MASK_C_LUI 0xe003\r
-#define MATCH_C_SRLI 0x8001\r
-#define MASK_C_SRLI 0xec03\r
-#define MATCH_C_SRAI 0x8401\r
-#define MASK_C_SRAI 0xec03\r
-#define MATCH_C_ANDI 0x8801\r
-#define MASK_C_ANDI 0xec03\r
-#define MATCH_C_SUB 0x8c01\r
-#define MASK_C_SUB 0xfc63\r
-#define MATCH_C_XOR 0x8c21\r
-#define MASK_C_XOR 0xfc63\r
-#define MATCH_C_OR 0x8c41\r
-#define MASK_C_OR 0xfc63\r
-#define MATCH_C_AND 0x8c61\r
-#define MASK_C_AND 0xfc63\r
-#define MATCH_C_SUBW 0x9c01\r
-#define MASK_C_SUBW 0xfc63\r
-#define MATCH_C_ADDW 0x9c21\r
-#define MASK_C_ADDW 0xfc63\r
-#define MATCH_C_J 0xa001\r
-#define MASK_C_J 0xe003\r
-#define MATCH_C_BEQZ 0xc001\r
-#define MASK_C_BEQZ 0xe003\r
-#define MATCH_C_BNEZ 0xe001\r
-#define MASK_C_BNEZ 0xe003\r
-#define MATCH_C_SLLI 0x2\r
-#define MASK_C_SLLI 0xe003\r
-#define MATCH_C_FLDSP 0x2002\r
-#define MASK_C_FLDSP 0xe003\r
-#define MATCH_C_LWSP 0x4002\r
-#define MASK_C_LWSP 0xe003\r
-#define MATCH_C_FLWSP 0x6002\r
-#define MASK_C_FLWSP 0xe003\r
-#define MATCH_C_MV 0x8002\r
-#define MASK_C_MV 0xf003\r
-#define MATCH_C_ADD 0x9002\r
-#define MASK_C_ADD 0xf003\r
-#define MATCH_C_FSDSP 0xa002\r
-#define MASK_C_FSDSP 0xe003\r
-#define MATCH_C_SWSP 0xc002\r
-#define MASK_C_SWSP 0xe003\r
-#define MATCH_C_FSWSP 0xe002\r
-#define MASK_C_FSWSP 0xe003\r
-#define MATCH_CUSTOM0 0xb\r
-#define MASK_CUSTOM0 0x707f\r
-#define MATCH_CUSTOM0_RS1 0x200b\r
-#define MASK_CUSTOM0_RS1 0x707f\r
-#define MATCH_CUSTOM0_RS1_RS2 0x300b\r
-#define MASK_CUSTOM0_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM0_RD 0x400b\r
-#define MASK_CUSTOM0_RD 0x707f\r
-#define MATCH_CUSTOM0_RD_RS1 0x600b\r
-#define MASK_CUSTOM0_RD_RS1 0x707f\r
-#define MATCH_CUSTOM0_RD_RS1_RS2 0x700b\r
-#define MASK_CUSTOM0_RD_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM1 0x2b\r
-#define MASK_CUSTOM1 0x707f\r
-#define MATCH_CUSTOM1_RS1 0x202b\r
-#define MASK_CUSTOM1_RS1 0x707f\r
-#define MATCH_CUSTOM1_RS1_RS2 0x302b\r
-#define MASK_CUSTOM1_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM1_RD 0x402b\r
-#define MASK_CUSTOM1_RD 0x707f\r
-#define MATCH_CUSTOM1_RD_RS1 0x602b\r
-#define MASK_CUSTOM1_RD_RS1 0x707f\r
-#define MATCH_CUSTOM1_RD_RS1_RS2 0x702b\r
-#define MASK_CUSTOM1_RD_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM2 0x5b\r
-#define MASK_CUSTOM2 0x707f\r
-#define MATCH_CUSTOM2_RS1 0x205b\r
-#define MASK_CUSTOM2_RS1 0x707f\r
-#define MATCH_CUSTOM2_RS1_RS2 0x305b\r
-#define MASK_CUSTOM2_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM2_RD 0x405b\r
-#define MASK_CUSTOM2_RD 0x707f\r
-#define MATCH_CUSTOM2_RD_RS1 0x605b\r
-#define MASK_CUSTOM2_RD_RS1 0x707f\r
-#define MATCH_CUSTOM2_RD_RS1_RS2 0x705b\r
-#define MASK_CUSTOM2_RD_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM3 0x7b\r
-#define MASK_CUSTOM3 0x707f\r
-#define MATCH_CUSTOM3_RS1 0x207b\r
-#define MASK_CUSTOM3_RS1 0x707f\r
-#define MATCH_CUSTOM3_RS1_RS2 0x307b\r
-#define MASK_CUSTOM3_RS1_RS2 0x707f\r
-#define MATCH_CUSTOM3_RD 0x407b\r
-#define MASK_CUSTOM3_RD 0x707f\r
-#define MATCH_CUSTOM3_RD_RS1 0x607b\r
-#define MASK_CUSTOM3_RD_RS1 0x707f\r
-#define MATCH_CUSTOM3_RD_RS1_RS2 0x707b\r
-#define MASK_CUSTOM3_RD_RS1_RS2 0x707f\r
-#define CSR_FFLAGS 0x1\r
-#define CSR_FRM 0x2\r
-#define CSR_FCSR 0x3\r
-#define CSR_CYCLE 0xc00\r
-#define CSR_TIME 0xc01\r
-#define CSR_INSTRET 0xc02\r
-#define CSR_HPMCOUNTER3 0xc03\r
-#define CSR_HPMCOUNTER4 0xc04\r
-#define CSR_HPMCOUNTER5 0xc05\r
-#define CSR_HPMCOUNTER6 0xc06\r
-#define CSR_HPMCOUNTER7 0xc07\r
-#define CSR_HPMCOUNTER8 0xc08\r
-#define CSR_HPMCOUNTER9 0xc09\r
-#define CSR_HPMCOUNTER10 0xc0a\r
-#define CSR_HPMCOUNTER11 0xc0b\r
-#define CSR_HPMCOUNTER12 0xc0c\r
-#define CSR_HPMCOUNTER13 0xc0d\r
-#define CSR_HPMCOUNTER14 0xc0e\r
-#define CSR_HPMCOUNTER15 0xc0f\r
-#define CSR_HPMCOUNTER16 0xc10\r
-#define CSR_HPMCOUNTER17 0xc11\r
-#define CSR_HPMCOUNTER18 0xc12\r
-#define CSR_HPMCOUNTER19 0xc13\r
-#define CSR_HPMCOUNTER20 0xc14\r
-#define CSR_HPMCOUNTER21 0xc15\r
-#define CSR_HPMCOUNTER22 0xc16\r
-#define CSR_HPMCOUNTER23 0xc17\r
-#define CSR_HPMCOUNTER24 0xc18\r
-#define CSR_HPMCOUNTER25 0xc19\r
-#define CSR_HPMCOUNTER26 0xc1a\r
-#define CSR_HPMCOUNTER27 0xc1b\r
-#define CSR_HPMCOUNTER28 0xc1c\r
-#define CSR_HPMCOUNTER29 0xc1d\r
-#define CSR_HPMCOUNTER30 0xc1e\r
-#define CSR_HPMCOUNTER31 0xc1f\r
-#define CSR_SSTATUS 0x100\r
-#define CSR_SIE 0x104\r
-#define CSR_STVEC 0x105\r
-#define CSR_SSCRATCH 0x140\r
-#define CSR_SEPC 0x141\r
-#define CSR_SCAUSE 0x142\r
-#define CSR_SBADADDR 0x143\r
-#define CSR_SIP 0x144\r
-#define CSR_SPTBR 0x180\r
-#define CSR_MSTATUS 0x300\r
-#define CSR_MISA 0x301\r
-#define CSR_MEDELEG 0x302\r
-#define CSR_MIDELEG 0x303\r
-#define CSR_MIE 0x304\r
-#define CSR_MTVEC 0x305\r
-#define CSR_MSCRATCH 0x340\r
-#define CSR_MEPC 0x341\r
-#define CSR_MCAUSE 0x342\r
-#define CSR_MBADADDR 0x343\r
-#define CSR_MIP 0x344\r
-#define CSR_TSELECT 0x7a0\r
-#define CSR_TDATA1 0x7a1\r
-#define CSR_TDATA2 0x7a2\r
-#define CSR_TDATA3 0x7a3\r
-#define CSR_DCSR 0x7b0\r
-#define CSR_DPC 0x7b1\r
-#define CSR_DSCRATCH 0x7b2\r
-#define CSR_MCYCLE 0xb00\r
-#define CSR_MINSTRET 0xb02\r
-#define CSR_MHPMCOUNTER3 0xb03\r
-#define CSR_MHPMCOUNTER4 0xb04\r
-#define CSR_MHPMCOUNTER5 0xb05\r
-#define CSR_MHPMCOUNTER6 0xb06\r
-#define CSR_MHPMCOUNTER7 0xb07\r
-#define CSR_MHPMCOUNTER8 0xb08\r
-#define CSR_MHPMCOUNTER9 0xb09\r
-#define CSR_MHPMCOUNTER10 0xb0a\r
-#define CSR_MHPMCOUNTER11 0xb0b\r
-#define CSR_MHPMCOUNTER12 0xb0c\r
-#define CSR_MHPMCOUNTER13 0xb0d\r
-#define CSR_MHPMCOUNTER14 0xb0e\r
-#define CSR_MHPMCOUNTER15 0xb0f\r
-#define CSR_MHPMCOUNTER16 0xb10\r
-#define CSR_MHPMCOUNTER17 0xb11\r
-#define CSR_MHPMCOUNTER18 0xb12\r
-#define CSR_MHPMCOUNTER19 0xb13\r
-#define CSR_MHPMCOUNTER20 0xb14\r
-#define CSR_MHPMCOUNTER21 0xb15\r
-#define CSR_MHPMCOUNTER22 0xb16\r
-#define CSR_MHPMCOUNTER23 0xb17\r
-#define CSR_MHPMCOUNTER24 0xb18\r
-#define CSR_MHPMCOUNTER25 0xb19\r
-#define CSR_MHPMCOUNTER26 0xb1a\r
-#define CSR_MHPMCOUNTER27 0xb1b\r
-#define CSR_MHPMCOUNTER28 0xb1c\r
-#define CSR_MHPMCOUNTER29 0xb1d\r
-#define CSR_MHPMCOUNTER30 0xb1e\r
-#define CSR_MHPMCOUNTER31 0xb1f\r
-#define CSR_MUCOUNTEREN 0x320\r
-#define CSR_MSCOUNTEREN 0x321\r
-#define CSR_MHPMEVENT3 0x323\r
-#define CSR_MHPMEVENT4 0x324\r
-#define CSR_MHPMEVENT5 0x325\r
-#define CSR_MHPMEVENT6 0x326\r
-#define CSR_MHPMEVENT7 0x327\r
-#define CSR_MHPMEVENT8 0x328\r
-#define CSR_MHPMEVENT9 0x329\r
-#define CSR_MHPMEVENT10 0x32a\r
-#define CSR_MHPMEVENT11 0x32b\r
-#define CSR_MHPMEVENT12 0x32c\r
-#define CSR_MHPMEVENT13 0x32d\r
-#define CSR_MHPMEVENT14 0x32e\r
-#define CSR_MHPMEVENT15 0x32f\r
-#define CSR_MHPMEVENT16 0x330\r
-#define CSR_MHPMEVENT17 0x331\r
-#define CSR_MHPMEVENT18 0x332\r
-#define CSR_MHPMEVENT19 0x333\r
-#define CSR_MHPMEVENT20 0x334\r
-#define CSR_MHPMEVENT21 0x335\r
-#define CSR_MHPMEVENT22 0x336\r
-#define CSR_MHPMEVENT23 0x337\r
-#define CSR_MHPMEVENT24 0x338\r
-#define CSR_MHPMEVENT25 0x339\r
-#define CSR_MHPMEVENT26 0x33a\r
-#define CSR_MHPMEVENT27 0x33b\r
-#define CSR_MHPMEVENT28 0x33c\r
-#define CSR_MHPMEVENT29 0x33d\r
-#define CSR_MHPMEVENT30 0x33e\r
-#define CSR_MHPMEVENT31 0x33f\r
-#define CSR_MVENDORID 0xf11\r
-#define CSR_MARCHID 0xf12\r
-#define CSR_MIMPID 0xf13\r
-#define CSR_MHARTID 0xf14\r
-#define CSR_CYCLEH 0xc80\r
-#define CSR_TIMEH 0xc81\r
-#define CSR_INSTRETH 0xc82\r
-#define CSR_HPMCOUNTER3H 0xc83\r
-#define CSR_HPMCOUNTER4H 0xc84\r
-#define CSR_HPMCOUNTER5H 0xc85\r
-#define CSR_HPMCOUNTER6H 0xc86\r
-#define CSR_HPMCOUNTER7H 0xc87\r
-#define CSR_HPMCOUNTER8H 0xc88\r
-#define CSR_HPMCOUNTER9H 0xc89\r
-#define CSR_HPMCOUNTER10H 0xc8a\r
-#define CSR_HPMCOUNTER11H 0xc8b\r
-#define CSR_HPMCOUNTER12H 0xc8c\r
-#define CSR_HPMCOUNTER13H 0xc8d\r
-#define CSR_HPMCOUNTER14H 0xc8e\r
-#define CSR_HPMCOUNTER15H 0xc8f\r
-#define CSR_HPMCOUNTER16H 0xc90\r
-#define CSR_HPMCOUNTER17H 0xc91\r
-#define CSR_HPMCOUNTER18H 0xc92\r
-#define CSR_HPMCOUNTER19H 0xc93\r
-#define CSR_HPMCOUNTER20H 0xc94\r
-#define CSR_HPMCOUNTER21H 0xc95\r
-#define CSR_HPMCOUNTER22H 0xc96\r
-#define CSR_HPMCOUNTER23H 0xc97\r
-#define CSR_HPMCOUNTER24H 0xc98\r
-#define CSR_HPMCOUNTER25H 0xc99\r
-#define CSR_HPMCOUNTER26H 0xc9a\r
-#define CSR_HPMCOUNTER27H 0xc9b\r
-#define CSR_HPMCOUNTER28H 0xc9c\r
-#define CSR_HPMCOUNTER29H 0xc9d\r
-#define CSR_HPMCOUNTER30H 0xc9e\r
-#define CSR_HPMCOUNTER31H 0xc9f\r
-#define CSR_MCYCLEH 0xb80\r
-#define CSR_MINSTRETH 0xb82\r
-#define CSR_MHPMCOUNTER3H 0xb83\r
-#define CSR_MHPMCOUNTER4H 0xb84\r
-#define CSR_MHPMCOUNTER5H 0xb85\r
-#define CSR_MHPMCOUNTER6H 0xb86\r
-#define CSR_MHPMCOUNTER7H 0xb87\r
-#define CSR_MHPMCOUNTER8H 0xb88\r
-#define CSR_MHPMCOUNTER9H 0xb89\r
-#define CSR_MHPMCOUNTER10H 0xb8a\r
-#define CSR_MHPMCOUNTER11H 0xb8b\r
-#define CSR_MHPMCOUNTER12H 0xb8c\r
-#define CSR_MHPMCOUNTER13H 0xb8d\r
-#define CSR_MHPMCOUNTER14H 0xb8e\r
-#define CSR_MHPMCOUNTER15H 0xb8f\r
-#define CSR_MHPMCOUNTER16H 0xb90\r
-#define CSR_MHPMCOUNTER17H 0xb91\r
-#define CSR_MHPMCOUNTER18H 0xb92\r
-#define CSR_MHPMCOUNTER19H 0xb93\r
-#define CSR_MHPMCOUNTER20H 0xb94\r
-#define CSR_MHPMCOUNTER21H 0xb95\r
-#define CSR_MHPMCOUNTER22H 0xb96\r
-#define CSR_MHPMCOUNTER23H 0xb97\r
-#define CSR_MHPMCOUNTER24H 0xb98\r
-#define CSR_MHPMCOUNTER25H 0xb99\r
-#define CSR_MHPMCOUNTER26H 0xb9a\r
-#define CSR_MHPMCOUNTER27H 0xb9b\r
-#define CSR_MHPMCOUNTER28H 0xb9c\r
-#define CSR_MHPMCOUNTER29H 0xb9d\r
-#define CSR_MHPMCOUNTER30H 0xb9e\r
-#define CSR_MHPMCOUNTER31H 0xb9f\r
-#define CAUSE_MISALIGNED_FETCH 0x0\r
-#define CAUSE_FAULT_FETCH 0x1\r
-#define CAUSE_ILLEGAL_INSTRUCTION 0x2\r
-#define CAUSE_BREAKPOINT 0x3\r
-#define CAUSE_MISALIGNED_LOAD 0x4\r
-#define CAUSE_FAULT_LOAD 0x5\r
-#define CAUSE_MISALIGNED_STORE 0x6\r
-#define CAUSE_FAULT_STORE 0x7\r
-#define CAUSE_USER_ECALL 0x8\r
-#define CAUSE_SUPERVISOR_ECALL 0x9\r
-#define CAUSE_HYPERVISOR_ECALL 0xa\r
-#define CAUSE_MACHINE_ECALL 0xb\r
-#endif\r
-#ifdef DECLARE_INSN\r
-DECLARE_INSN(beq, MATCH_BEQ, MASK_BEQ)\r
-DECLARE_INSN(bne, MATCH_BNE, MASK_BNE)\r
-DECLARE_INSN(blt, MATCH_BLT, MASK_BLT)\r
-DECLARE_INSN(bge, MATCH_BGE, MASK_BGE)\r
-DECLARE_INSN(bltu, MATCH_BLTU, MASK_BLTU)\r
-DECLARE_INSN(bgeu, MATCH_BGEU, MASK_BGEU)\r
-DECLARE_INSN(jalr, MATCH_JALR, MASK_JALR)\r
-DECLARE_INSN(jal, MATCH_JAL, MASK_JAL)\r
-DECLARE_INSN(lui, MATCH_LUI, MASK_LUI)\r
-DECLARE_INSN(auipc, MATCH_AUIPC, MASK_AUIPC)\r
-DECLARE_INSN(addi, MATCH_ADDI, MASK_ADDI)\r
-DECLARE_INSN(slli, MATCH_SLLI, MASK_SLLI)\r
-DECLARE_INSN(slti, MATCH_SLTI, MASK_SLTI)\r
-DECLARE_INSN(sltiu, MATCH_SLTIU, MASK_SLTIU)\r
-DECLARE_INSN(xori, MATCH_XORI, MASK_XORI)\r
-DECLARE_INSN(srli, MATCH_SRLI, MASK_SRLI)\r
-DECLARE_INSN(srai, MATCH_SRAI, MASK_SRAI)\r
-DECLARE_INSN(ori, MATCH_ORI, MASK_ORI)\r
-DECLARE_INSN(andi, MATCH_ANDI, MASK_ANDI)\r
-DECLARE_INSN(add, MATCH_ADD, MASK_ADD)\r
-DECLARE_INSN(sub, MATCH_SUB, MASK_SUB)\r
-DECLARE_INSN(sll, MATCH_SLL, MASK_SLL)\r
-DECLARE_INSN(slt, MATCH_SLT, MASK_SLT)\r
-DECLARE_INSN(sltu, MATCH_SLTU, MASK_SLTU)\r
-DECLARE_INSN(xor, MATCH_XOR, MASK_XOR)\r
-DECLARE_INSN(srl, MATCH_SRL, MASK_SRL)\r
-DECLARE_INSN(sra, MATCH_SRA, MASK_SRA)\r
-DECLARE_INSN(or, MATCH_OR, MASK_OR)\r
-DECLARE_INSN(and, MATCH_AND, MASK_AND)\r
-DECLARE_INSN(addiw, MATCH_ADDIW, MASK_ADDIW)\r
-DECLARE_INSN(slliw, MATCH_SLLIW, MASK_SLLIW)\r
-DECLARE_INSN(srliw, MATCH_SRLIW, MASK_SRLIW)\r
-DECLARE_INSN(sraiw, MATCH_SRAIW, MASK_SRAIW)\r
-DECLARE_INSN(addw, MATCH_ADDW, MASK_ADDW)\r
-DECLARE_INSN(subw, MATCH_SUBW, MASK_SUBW)\r
-DECLARE_INSN(sllw, MATCH_SLLW, MASK_SLLW)\r
-DECLARE_INSN(srlw, MATCH_SRLW, MASK_SRLW)\r
-DECLARE_INSN(sraw, MATCH_SRAW, MASK_SRAW)\r
-DECLARE_INSN(lb, MATCH_LB, MASK_LB)\r
-DECLARE_INSN(lh, MATCH_LH, MASK_LH)\r
-DECLARE_INSN(lw, MATCH_LW, MASK_LW)\r
-DECLARE_INSN(ld, MATCH_LD, MASK_LD)\r
-DECLARE_INSN(lbu, MATCH_LBU, MASK_LBU)\r
-DECLARE_INSN(lhu, MATCH_LHU, MASK_LHU)\r
-DECLARE_INSN(lwu, MATCH_LWU, MASK_LWU)\r
-DECLARE_INSN(sb, MATCH_SB, MASK_SB)\r
-DECLARE_INSN(sh, MATCH_SH, MASK_SH)\r
-DECLARE_INSN(sw, MATCH_SW, MASK_SW)\r
-DECLARE_INSN(sd, MATCH_SD, MASK_SD)\r
-DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE)\r
-DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I)\r
-DECLARE_INSN(mul, MATCH_MUL, MASK_MUL)\r
-DECLARE_INSN(mulh, MATCH_MULH, MASK_MULH)\r
-DECLARE_INSN(mulhsu, MATCH_MULHSU, MASK_MULHSU)\r
-DECLARE_INSN(mulhu, MATCH_MULHU, MASK_MULHU)\r
-DECLARE_INSN(div, MATCH_DIV, MASK_DIV)\r
-DECLARE_INSN(divu, MATCH_DIVU, MASK_DIVU)\r
-DECLARE_INSN(rem, MATCH_REM, MASK_REM)\r
-DECLARE_INSN(remu, MATCH_REMU, MASK_REMU)\r
-DECLARE_INSN(mulw, MATCH_MULW, MASK_MULW)\r
-DECLARE_INSN(divw, MATCH_DIVW, MASK_DIVW)\r
-DECLARE_INSN(divuw, MATCH_DIVUW, MASK_DIVUW)\r
-DECLARE_INSN(remw, MATCH_REMW, MASK_REMW)\r
-DECLARE_INSN(remuw, MATCH_REMUW, MASK_REMUW)\r
-DECLARE_INSN(amoadd_w, MATCH_AMOADD_W, MASK_AMOADD_W)\r
-DECLARE_INSN(amoxor_w, MATCH_AMOXOR_W, MASK_AMOXOR_W)\r
-DECLARE_INSN(amoor_w, MATCH_AMOOR_W, MASK_AMOOR_W)\r
-DECLARE_INSN(amoand_w, MATCH_AMOAND_W, MASK_AMOAND_W)\r
-DECLARE_INSN(amomin_w, MATCH_AMOMIN_W, MASK_AMOMIN_W)\r
-DECLARE_INSN(amomax_w, MATCH_AMOMAX_W, MASK_AMOMAX_W)\r
-DECLARE_INSN(amominu_w, MATCH_AMOMINU_W, MASK_AMOMINU_W)\r
-DECLARE_INSN(amomaxu_w, MATCH_AMOMAXU_W, MASK_AMOMAXU_W)\r
-DECLARE_INSN(amoswap_w, MATCH_AMOSWAP_W, MASK_AMOSWAP_W)\r
-DECLARE_INSN(lr_w, MATCH_LR_W, MASK_LR_W)\r
-DECLARE_INSN(sc_w, MATCH_SC_W, MASK_SC_W)\r
-DECLARE_INSN(amoadd_d, MATCH_AMOADD_D, MASK_AMOADD_D)\r
-DECLARE_INSN(amoxor_d, MATCH_AMOXOR_D, MASK_AMOXOR_D)\r
-DECLARE_INSN(amoor_d, MATCH_AMOOR_D, MASK_AMOOR_D)\r
-DECLARE_INSN(amoand_d, MATCH_AMOAND_D, MASK_AMOAND_D)\r
-DECLARE_INSN(amomin_d, MATCH_AMOMIN_D, MASK_AMOMIN_D)\r
-DECLARE_INSN(amomax_d, MATCH_AMOMAX_D, MASK_AMOMAX_D)\r
-DECLARE_INSN(amominu_d, MATCH_AMOMINU_D, MASK_AMOMINU_D)\r
-DECLARE_INSN(amomaxu_d, MATCH_AMOMAXU_D, MASK_AMOMAXU_D)\r
-DECLARE_INSN(amoswap_d, MATCH_AMOSWAP_D, MASK_AMOSWAP_D)\r
-DECLARE_INSN(lr_d, MATCH_LR_D, MASK_LR_D)\r
-DECLARE_INSN(sc_d, MATCH_SC_D, MASK_SC_D)\r
-DECLARE_INSN(ecall, MATCH_ECALL, MASK_ECALL)\r
-DECLARE_INSN(ebreak, MATCH_EBREAK, MASK_EBREAK)\r
-DECLARE_INSN(uret, MATCH_URET, MASK_URET)\r
-DECLARE_INSN(sret, MATCH_SRET, MASK_SRET)\r
-DECLARE_INSN(hret, MATCH_HRET, MASK_HRET)\r
-DECLARE_INSN(mret, MATCH_MRET, MASK_MRET)\r
-DECLARE_INSN(dret, MATCH_DRET, MASK_DRET)\r
-DECLARE_INSN(sfence_vm, MATCH_SFENCE_VM, MASK_SFENCE_VM)\r
-DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI)\r
-DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW)\r
-DECLARE_INSN(csrrs, MATCH_CSRRS, MASK_CSRRS)\r
-DECLARE_INSN(csrrc, MATCH_CSRRC, MASK_CSRRC)\r
-DECLARE_INSN(csrrwi, MATCH_CSRRWI, MASK_CSRRWI)\r
-DECLARE_INSN(csrrsi, MATCH_CSRRSI, MASK_CSRRSI)\r
-DECLARE_INSN(csrrci, MATCH_CSRRCI, MASK_CSRRCI)\r
-DECLARE_INSN(fadd_s, MATCH_FADD_S, MASK_FADD_S)\r
-DECLARE_INSN(fsub_s, MATCH_FSUB_S, MASK_FSUB_S)\r
-DECLARE_INSN(fmul_s, MATCH_FMUL_S, MASK_FMUL_S)\r
-DECLARE_INSN(fdiv_s, MATCH_FDIV_S, MASK_FDIV_S)\r
-DECLARE_INSN(fsgnj_s, MATCH_FSGNJ_S, MASK_FSGNJ_S)\r
-DECLARE_INSN(fsgnjn_s, MATCH_FSGNJN_S, MASK_FSGNJN_S)\r
-DECLARE_INSN(fsgnjx_s, MATCH_FSGNJX_S, MASK_FSGNJX_S)\r
-DECLARE_INSN(fmin_s, MATCH_FMIN_S, MASK_FMIN_S)\r
-DECLARE_INSN(fmax_s, MATCH_FMAX_S, MASK_FMAX_S)\r
-DECLARE_INSN(fsqrt_s, MATCH_FSQRT_S, MASK_FSQRT_S)\r
-DECLARE_INSN(fadd_d, MATCH_FADD_D, MASK_FADD_D)\r
-DECLARE_INSN(fsub_d, MATCH_FSUB_D, MASK_FSUB_D)\r
-DECLARE_INSN(fmul_d, MATCH_FMUL_D, MASK_FMUL_D)\r
-DECLARE_INSN(fdiv_d, MATCH_FDIV_D, MASK_FDIV_D)\r
-DECLARE_INSN(fsgnj_d, MATCH_FSGNJ_D, MASK_FSGNJ_D)\r
-DECLARE_INSN(fsgnjn_d, MATCH_FSGNJN_D, MASK_FSGNJN_D)\r
-DECLARE_INSN(fsgnjx_d, MATCH_FSGNJX_D, MASK_FSGNJX_D)\r
-DECLARE_INSN(fmin_d, MATCH_FMIN_D, MASK_FMIN_D)\r
-DECLARE_INSN(fmax_d, MATCH_FMAX_D, MASK_FMAX_D)\r
-DECLARE_INSN(fcvt_s_d, MATCH_FCVT_S_D, MASK_FCVT_S_D)\r
-DECLARE_INSN(fcvt_d_s, MATCH_FCVT_D_S, MASK_FCVT_D_S)\r
-DECLARE_INSN(fsqrt_d, MATCH_FSQRT_D, MASK_FSQRT_D)\r
-DECLARE_INSN(fle_s, MATCH_FLE_S, MASK_FLE_S)\r
-DECLARE_INSN(flt_s, MATCH_FLT_S, MASK_FLT_S)\r
-DECLARE_INSN(feq_s, MATCH_FEQ_S, MASK_FEQ_S)\r
-DECLARE_INSN(fle_d, MATCH_FLE_D, MASK_FLE_D)\r
-DECLARE_INSN(flt_d, MATCH_FLT_D, MASK_FLT_D)\r
-DECLARE_INSN(feq_d, MATCH_FEQ_D, MASK_FEQ_D)\r
-DECLARE_INSN(fcvt_w_s, MATCH_FCVT_W_S, MASK_FCVT_W_S)\r
-DECLARE_INSN(fcvt_wu_s, MATCH_FCVT_WU_S, MASK_FCVT_WU_S)\r
-DECLARE_INSN(fcvt_l_s, MATCH_FCVT_L_S, MASK_FCVT_L_S)\r
-DECLARE_INSN(fcvt_lu_s, MATCH_FCVT_LU_S, MASK_FCVT_LU_S)\r
-DECLARE_INSN(fmv_x_s, MATCH_FMV_X_S, MASK_FMV_X_S)\r
-DECLARE_INSN(fclass_s, MATCH_FCLASS_S, MASK_FCLASS_S)\r
-DECLARE_INSN(fcvt_w_d, MATCH_FCVT_W_D, MASK_FCVT_W_D)\r
-DECLARE_INSN(fcvt_wu_d, MATCH_FCVT_WU_D, MASK_FCVT_WU_D)\r
-DECLARE_INSN(fcvt_l_d, MATCH_FCVT_L_D, MASK_FCVT_L_D)\r
-DECLARE_INSN(fcvt_lu_d, MATCH_FCVT_LU_D, MASK_FCVT_LU_D)\r
-DECLARE_INSN(fmv_x_d, MATCH_FMV_X_D, MASK_FMV_X_D)\r
-DECLARE_INSN(fclass_d, MATCH_FCLASS_D, MASK_FCLASS_D)\r
-DECLARE_INSN(fcvt_s_w, MATCH_FCVT_S_W, MASK_FCVT_S_W)\r
-DECLARE_INSN(fcvt_s_wu, MATCH_FCVT_S_WU, MASK_FCVT_S_WU)\r
-DECLARE_INSN(fcvt_s_l, MATCH_FCVT_S_L, MASK_FCVT_S_L)\r
-DECLARE_INSN(fcvt_s_lu, MATCH_FCVT_S_LU, MASK_FCVT_S_LU)\r
-DECLARE_INSN(fmv_s_x, MATCH_FMV_S_X, MASK_FMV_S_X)\r
-DECLARE_INSN(fcvt_d_w, MATCH_FCVT_D_W, MASK_FCVT_D_W)\r
-DECLARE_INSN(fcvt_d_wu, MATCH_FCVT_D_WU, MASK_FCVT_D_WU)\r
-DECLARE_INSN(fcvt_d_l, MATCH_FCVT_D_L, MASK_FCVT_D_L)\r
-DECLARE_INSN(fcvt_d_lu, MATCH_FCVT_D_LU, MASK_FCVT_D_LU)\r
-DECLARE_INSN(fmv_d_x, MATCH_FMV_D_X, MASK_FMV_D_X)\r
-DECLARE_INSN(flw, MATCH_FLW, MASK_FLW)\r
-DECLARE_INSN(fld, MATCH_FLD, MASK_FLD)\r
-DECLARE_INSN(fsw, MATCH_FSW, MASK_FSW)\r
-DECLARE_INSN(fsd, MATCH_FSD, MASK_FSD)\r
-DECLARE_INSN(fmadd_s, MATCH_FMADD_S, MASK_FMADD_S)\r
-DECLARE_INSN(fmsub_s, MATCH_FMSUB_S, MASK_FMSUB_S)\r
-DECLARE_INSN(fnmsub_s, MATCH_FNMSUB_S, MASK_FNMSUB_S)\r
-DECLARE_INSN(fnmadd_s, MATCH_FNMADD_S, MASK_FNMADD_S)\r
-DECLARE_INSN(fmadd_d, MATCH_FMADD_D, MASK_FMADD_D)\r
-DECLARE_INSN(fmsub_d, MATCH_FMSUB_D, MASK_FMSUB_D)\r
-DECLARE_INSN(fnmsub_d, MATCH_FNMSUB_D, MASK_FNMSUB_D)\r
-DECLARE_INSN(fnmadd_d, MATCH_FNMADD_D, MASK_FNMADD_D)\r
-DECLARE_INSN(c_nop, MATCH_C_NOP, MASK_C_NOP)\r
-DECLARE_INSN(c_addi16sp, MATCH_C_ADDI16SP, MASK_C_ADDI16SP)\r
-DECLARE_INSN(c_jr, MATCH_C_JR, MASK_C_JR)\r
-DECLARE_INSN(c_jalr, MATCH_C_JALR, MASK_C_JALR)\r
-DECLARE_INSN(c_ebreak, MATCH_C_EBREAK, MASK_C_EBREAK)\r
-DECLARE_INSN(c_ld, MATCH_C_LD, MASK_C_LD)\r
-DECLARE_INSN(c_sd, MATCH_C_SD, MASK_C_SD)\r
-DECLARE_INSN(c_addiw, MATCH_C_ADDIW, MASK_C_ADDIW)\r
-DECLARE_INSN(c_ldsp, MATCH_C_LDSP, MASK_C_LDSP)\r
-DECLARE_INSN(c_sdsp, MATCH_C_SDSP, MASK_C_SDSP)\r
-DECLARE_INSN(c_addi4spn, MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN)\r
-DECLARE_INSN(c_fld, MATCH_C_FLD, MASK_C_FLD)\r
-DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW)\r
-DECLARE_INSN(c_flw, MATCH_C_FLW, MASK_C_FLW)\r
-DECLARE_INSN(c_fsd, MATCH_C_FSD, MASK_C_FSD)\r
-DECLARE_INSN(c_sw, MATCH_C_SW, MASK_C_SW)\r
-DECLARE_INSN(c_fsw, MATCH_C_FSW, MASK_C_FSW)\r
-DECLARE_INSN(c_addi, MATCH_C_ADDI, MASK_C_ADDI)\r
-DECLARE_INSN(c_jal, MATCH_C_JAL, MASK_C_JAL)\r
-DECLARE_INSN(c_li, MATCH_C_LI, MASK_C_LI)\r
-DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI)\r
-DECLARE_INSN(c_srli, MATCH_C_SRLI, MASK_C_SRLI)\r
-DECLARE_INSN(c_srai, MATCH_C_SRAI, MASK_C_SRAI)\r
-DECLARE_INSN(c_andi, MATCH_C_ANDI, MASK_C_ANDI)\r
-DECLARE_INSN(c_sub, MATCH_C_SUB, MASK_C_SUB)\r
-DECLARE_INSN(c_xor, MATCH_C_XOR, MASK_C_XOR)\r
-DECLARE_INSN(c_or, MATCH_C_OR, MASK_C_OR)\r
-DECLARE_INSN(c_and, MATCH_C_AND, MASK_C_AND)\r
-DECLARE_INSN(c_subw, MATCH_C_SUBW, MASK_C_SUBW)\r
-DECLARE_INSN(c_addw, MATCH_C_ADDW, MASK_C_ADDW)\r
-DECLARE_INSN(c_j, MATCH_C_J, MASK_C_J)\r
-DECLARE_INSN(c_beqz, MATCH_C_BEQZ, MASK_C_BEQZ)\r
-DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ)\r
-DECLARE_INSN(c_slli, MATCH_C_SLLI, MASK_C_SLLI)\r
-DECLARE_INSN(c_fldsp, MATCH_C_FLDSP, MASK_C_FLDSP)\r
-DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP)\r
-DECLARE_INSN(c_flwsp, MATCH_C_FLWSP, MASK_C_FLWSP)\r
-DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV)\r
-DECLARE_INSN(c_add, MATCH_C_ADD, MASK_C_ADD)\r
-DECLARE_INSN(c_fsdsp, MATCH_C_FSDSP, MASK_C_FSDSP)\r
-DECLARE_INSN(c_swsp, MATCH_C_SWSP, MASK_C_SWSP)\r
-DECLARE_INSN(c_fswsp, MATCH_C_FSWSP, MASK_C_FSWSP)\r
-DECLARE_INSN(custom0, MATCH_CUSTOM0, MASK_CUSTOM0)\r
-DECLARE_INSN(custom0_rs1, MATCH_CUSTOM0_RS1, MASK_CUSTOM0_RS1)\r
-DECLARE_INSN(custom0_rs1_rs2, MATCH_CUSTOM0_RS1_RS2, MASK_CUSTOM0_RS1_RS2)\r
-DECLARE_INSN(custom0_rd, MATCH_CUSTOM0_RD, MASK_CUSTOM0_RD)\r
-DECLARE_INSN(custom0_rd_rs1, MATCH_CUSTOM0_RD_RS1, MASK_CUSTOM0_RD_RS1)\r
-DECLARE_INSN(custom0_rd_rs1_rs2, MATCH_CUSTOM0_RD_RS1_RS2, MASK_CUSTOM0_RD_RS1_RS2)\r
-DECLARE_INSN(custom1, MATCH_CUSTOM1, MASK_CUSTOM1)\r
-DECLARE_INSN(custom1_rs1, MATCH_CUSTOM1_RS1, MASK_CUSTOM1_RS1)\r
-DECLARE_INSN(custom1_rs1_rs2, MATCH_CUSTOM1_RS1_RS2, MASK_CUSTOM1_RS1_RS2)\r
-DECLARE_INSN(custom1_rd, MATCH_CUSTOM1_RD, MASK_CUSTOM1_RD)\r
-DECLARE_INSN(custom1_rd_rs1, MATCH_CUSTOM1_RD_RS1, MASK_CUSTOM1_RD_RS1)\r
-DECLARE_INSN(custom1_rd_rs1_rs2, MATCH_CUSTOM1_RD_RS1_RS2, MASK_CUSTOM1_RD_RS1_RS2)\r
-DECLARE_INSN(custom2, MATCH_CUSTOM2, MASK_CUSTOM2)\r
-DECLARE_INSN(custom2_rs1, MATCH_CUSTOM2_RS1, MASK_CUSTOM2_RS1)\r
-DECLARE_INSN(custom2_rs1_rs2, MATCH_CUSTOM2_RS1_RS2, MASK_CUSTOM2_RS1_RS2)\r
-DECLARE_INSN(custom2_rd, MATCH_CUSTOM2_RD, MASK_CUSTOM2_RD)\r
-DECLARE_INSN(custom2_rd_rs1, MATCH_CUSTOM2_RD_RS1, MASK_CUSTOM2_RD_RS1)\r
-DECLARE_INSN(custom2_rd_rs1_rs2, MATCH_CUSTOM2_RD_RS1_RS2, MASK_CUSTOM2_RD_RS1_RS2)\r
-DECLARE_INSN(custom3, MATCH_CUSTOM3, MASK_CUSTOM3)\r
-DECLARE_INSN(custom3_rs1, MATCH_CUSTOM3_RS1, MASK_CUSTOM3_RS1)\r
-DECLARE_INSN(custom3_rs1_rs2, MATCH_CUSTOM3_RS1_RS2, MASK_CUSTOM3_RS1_RS2)\r
-DECLARE_INSN(custom3_rd, MATCH_CUSTOM3_RD, MASK_CUSTOM3_RD)\r
-DECLARE_INSN(custom3_rd_rs1, MATCH_CUSTOM3_RD_RS1, MASK_CUSTOM3_RD_RS1)\r
-DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2)\r
-#endif\r
-#ifdef DECLARE_CSR\r
-DECLARE_CSR(fflags, CSR_FFLAGS)\r
-DECLARE_CSR(frm, CSR_FRM)\r
-DECLARE_CSR(fcsr, CSR_FCSR)\r
-DECLARE_CSR(cycle, CSR_CYCLE)\r
-DECLARE_CSR(time, CSR_TIME)\r
-DECLARE_CSR(instret, CSR_INSTRET)\r
-DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3)\r
-DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4)\r
-DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5)\r
-DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6)\r
-DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7)\r
-DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8)\r
-DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9)\r
-DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10)\r
-DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11)\r
-DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12)\r
-DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13)\r
-DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14)\r
-DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15)\r
-DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16)\r
-DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17)\r
-DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18)\r
-DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19)\r
-DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20)\r
-DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21)\r
-DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22)\r
-DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23)\r
-DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24)\r
-DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25)\r
-DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26)\r
-DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27)\r
-DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28)\r
-DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29)\r
-DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30)\r
-DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31)\r
-DECLARE_CSR(sstatus, CSR_SSTATUS)\r
-DECLARE_CSR(sie, CSR_SIE)\r
-DECLARE_CSR(stvec, CSR_STVEC)\r
-DECLARE_CSR(sscratch, CSR_SSCRATCH)\r
-DECLARE_CSR(sepc, CSR_SEPC)\r
-DECLARE_CSR(scause, CSR_SCAUSE)\r
-DECLARE_CSR(sbadaddr, CSR_SBADADDR)\r
-DECLARE_CSR(sip, CSR_SIP)\r
-DECLARE_CSR(sptbr, CSR_SPTBR)\r
-DECLARE_CSR(mstatus, CSR_MSTATUS)\r
-DECLARE_CSR(misa, CSR_MISA)\r
-DECLARE_CSR(medeleg, CSR_MEDELEG)\r
-DECLARE_CSR(mideleg, CSR_MIDELEG)\r
-DECLARE_CSR(mie, CSR_MIE)\r
-DECLARE_CSR(mtvec, CSR_MTVEC)\r
-DECLARE_CSR(mscratch, CSR_MSCRATCH)\r
-DECLARE_CSR(mepc, CSR_MEPC)\r
-DECLARE_CSR(mcause, CSR_MCAUSE)\r
-DECLARE_CSR(mbadaddr, CSR_MBADADDR)\r
-DECLARE_CSR(mip, CSR_MIP)\r
-DECLARE_CSR(tselect, CSR_TSELECT)\r
-DECLARE_CSR(tdata1, CSR_TDATA1)\r
-DECLARE_CSR(tdata2, CSR_TDATA2)\r
-DECLARE_CSR(tdata3, CSR_TDATA3)\r
-DECLARE_CSR(dcsr, CSR_DCSR)\r
-DECLARE_CSR(dpc, CSR_DPC)\r
-DECLARE_CSR(dscratch, CSR_DSCRATCH)\r
-DECLARE_CSR(mcycle, CSR_MCYCLE)\r
-DECLARE_CSR(minstret, CSR_MINSTRET)\r
-DECLARE_CSR(mhpmcounter3, CSR_MHPMCOUNTER3)\r
-DECLARE_CSR(mhpmcounter4, CSR_MHPMCOUNTER4)\r
-DECLARE_CSR(mhpmcounter5, CSR_MHPMCOUNTER5)\r
-DECLARE_CSR(mhpmcounter6, CSR_MHPMCOUNTER6)\r
-DECLARE_CSR(mhpmcounter7, CSR_MHPMCOUNTER7)\r
-DECLARE_CSR(mhpmcounter8, CSR_MHPMCOUNTER8)\r
-DECLARE_CSR(mhpmcounter9, CSR_MHPMCOUNTER9)\r
-DECLARE_CSR(mhpmcounter10, CSR_MHPMCOUNTER10)\r
-DECLARE_CSR(mhpmcounter11, CSR_MHPMCOUNTER11)\r
-DECLARE_CSR(mhpmcounter12, CSR_MHPMCOUNTER12)\r
-DECLARE_CSR(mhpmcounter13, CSR_MHPMCOUNTER13)\r
-DECLARE_CSR(mhpmcounter14, CSR_MHPMCOUNTER14)\r
-DECLARE_CSR(mhpmcounter15, CSR_MHPMCOUNTER15)\r
-DECLARE_CSR(mhpmcounter16, CSR_MHPMCOUNTER16)\r
-DECLARE_CSR(mhpmcounter17, CSR_MHPMCOUNTER17)\r
-DECLARE_CSR(mhpmcounter18, CSR_MHPMCOUNTER18)\r
-DECLARE_CSR(mhpmcounter19, CSR_MHPMCOUNTER19)\r
-DECLARE_CSR(mhpmcounter20, CSR_MHPMCOUNTER20)\r
-DECLARE_CSR(mhpmcounter21, CSR_MHPMCOUNTER21)\r
-DECLARE_CSR(mhpmcounter22, CSR_MHPMCOUNTER22)\r
-DECLARE_CSR(mhpmcounter23, CSR_MHPMCOUNTER23)\r
-DECLARE_CSR(mhpmcounter24, CSR_MHPMCOUNTER24)\r
-DECLARE_CSR(mhpmcounter25, CSR_MHPMCOUNTER25)\r
-DECLARE_CSR(mhpmcounter26, CSR_MHPMCOUNTER26)\r
-DECLARE_CSR(mhpmcounter27, CSR_MHPMCOUNTER27)\r
-DECLARE_CSR(mhpmcounter28, CSR_MHPMCOUNTER28)\r
-DECLARE_CSR(mhpmcounter29, CSR_MHPMCOUNTER29)\r
-DECLARE_CSR(mhpmcounter30, CSR_MHPMCOUNTER30)\r
-DECLARE_CSR(mhpmcounter31, CSR_MHPMCOUNTER31)\r
-DECLARE_CSR(mucounteren, CSR_MUCOUNTEREN)\r
-DECLARE_CSR(mscounteren, CSR_MSCOUNTEREN)\r
-DECLARE_CSR(mhpmevent3, CSR_MHPMEVENT3)\r
-DECLARE_CSR(mhpmevent4, CSR_MHPMEVENT4)\r
-DECLARE_CSR(mhpmevent5, CSR_MHPMEVENT5)\r
-DECLARE_CSR(mhpmevent6, CSR_MHPMEVENT6)\r
-DECLARE_CSR(mhpmevent7, CSR_MHPMEVENT7)\r
-DECLARE_CSR(mhpmevent8, CSR_MHPMEVENT8)\r
-DECLARE_CSR(mhpmevent9, CSR_MHPMEVENT9)\r
-DECLARE_CSR(mhpmevent10, CSR_MHPMEVENT10)\r
-DECLARE_CSR(mhpmevent11, CSR_MHPMEVENT11)\r
-DECLARE_CSR(mhpmevent12, CSR_MHPMEVENT12)\r
-DECLARE_CSR(mhpmevent13, CSR_MHPMEVENT13)\r
-DECLARE_CSR(mhpmevent14, CSR_MHPMEVENT14)\r
-DECLARE_CSR(mhpmevent15, CSR_MHPMEVENT15)\r
-DECLARE_CSR(mhpmevent16, CSR_MHPMEVENT16)\r
-DECLARE_CSR(mhpmevent17, CSR_MHPMEVENT17)\r
-DECLARE_CSR(mhpmevent18, CSR_MHPMEVENT18)\r
-DECLARE_CSR(mhpmevent19, CSR_MHPMEVENT19)\r
-DECLARE_CSR(mhpmevent20, CSR_MHPMEVENT20)\r
-DECLARE_CSR(mhpmevent21, CSR_MHPMEVENT21)\r
-DECLARE_CSR(mhpmevent22, CSR_MHPMEVENT22)\r
-DECLARE_CSR(mhpmevent23, CSR_MHPMEVENT23)\r
-DECLARE_CSR(mhpmevent24, CSR_MHPMEVENT24)\r
-DECLARE_CSR(mhpmevent25, CSR_MHPMEVENT25)\r
-DECLARE_CSR(mhpmevent26, CSR_MHPMEVENT26)\r
-DECLARE_CSR(mhpmevent27, CSR_MHPMEVENT27)\r
-DECLARE_CSR(mhpmevent28, CSR_MHPMEVENT28)\r
-DECLARE_CSR(mhpmevent29, CSR_MHPMEVENT29)\r
-DECLARE_CSR(mhpmevent30, CSR_MHPMEVENT30)\r
-DECLARE_CSR(mhpmevent31, CSR_MHPMEVENT31)\r
-DECLARE_CSR(mvendorid, CSR_MVENDORID)\r
-DECLARE_CSR(marchid, CSR_MARCHID)\r
-DECLARE_CSR(mimpid, CSR_MIMPID)\r
-DECLARE_CSR(mhartid, CSR_MHARTID)\r
-DECLARE_CSR(cycleh, CSR_CYCLEH)\r
-DECLARE_CSR(timeh, CSR_TIMEH)\r
-DECLARE_CSR(instreth, CSR_INSTRETH)\r
-DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H)\r
-DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H)\r
-DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H)\r
-DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H)\r
-DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H)\r
-DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H)\r
-DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H)\r
-DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H)\r
-DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H)\r
-DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H)\r
-DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H)\r
-DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H)\r
-DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H)\r
-DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H)\r
-DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H)\r
-DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H)\r
-DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H)\r
-DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H)\r
-DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H)\r
-DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H)\r
-DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H)\r
-DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H)\r
-DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H)\r
-DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H)\r
-DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H)\r
-DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H)\r
-DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H)\r
-DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H)\r
-DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H)\r
-DECLARE_CSR(mcycleh, CSR_MCYCLEH)\r
-DECLARE_CSR(minstreth, CSR_MINSTRETH)\r
-DECLARE_CSR(mhpmcounter3h, CSR_MHPMCOUNTER3H)\r
-DECLARE_CSR(mhpmcounter4h, CSR_MHPMCOUNTER4H)\r
-DECLARE_CSR(mhpmcounter5h, CSR_MHPMCOUNTER5H)\r
-DECLARE_CSR(mhpmcounter6h, CSR_MHPMCOUNTER6H)\r
-DECLARE_CSR(mhpmcounter7h, CSR_MHPMCOUNTER7H)\r
-DECLARE_CSR(mhpmcounter8h, CSR_MHPMCOUNTER8H)\r
-DECLARE_CSR(mhpmcounter9h, CSR_MHPMCOUNTER9H)\r
-DECLARE_CSR(mhpmcounter10h, CSR_MHPMCOUNTER10H)\r
-DECLARE_CSR(mhpmcounter11h, CSR_MHPMCOUNTER11H)\r
-DECLARE_CSR(mhpmcounter12h, CSR_MHPMCOUNTER12H)\r
-DECLARE_CSR(mhpmcounter13h, CSR_MHPMCOUNTER13H)\r
-DECLARE_CSR(mhpmcounter14h, CSR_MHPMCOUNTER14H)\r
-DECLARE_CSR(mhpmcounter15h, CSR_MHPMCOUNTER15H)\r
-DECLARE_CSR(mhpmcounter16h, CSR_MHPMCOUNTER16H)\r
-DECLARE_CSR(mhpmcounter17h, CSR_MHPMCOUNTER17H)\r
-DECLARE_CSR(mhpmcounter18h, CSR_MHPMCOUNTER18H)\r
-DECLARE_CSR(mhpmcounter19h, CSR_MHPMCOUNTER19H)\r
-DECLARE_CSR(mhpmcounter20h, CSR_MHPMCOUNTER20H)\r
-DECLARE_CSR(mhpmcounter21h, CSR_MHPMCOUNTER21H)\r
-DECLARE_CSR(mhpmcounter22h, CSR_MHPMCOUNTER22H)\r
-DECLARE_CSR(mhpmcounter23h, CSR_MHPMCOUNTER23H)\r
-DECLARE_CSR(mhpmcounter24h, CSR_MHPMCOUNTER24H)\r
-DECLARE_CSR(mhpmcounter25h, CSR_MHPMCOUNTER25H)\r
-DECLARE_CSR(mhpmcounter26h, CSR_MHPMCOUNTER26H)\r
-DECLARE_CSR(mhpmcounter27h, CSR_MHPMCOUNTER27H)\r
-DECLARE_CSR(mhpmcounter28h, CSR_MHPMCOUNTER28H)\r
-DECLARE_CSR(mhpmcounter29h, CSR_MHPMCOUNTER29H)\r
-DECLARE_CSR(mhpmcounter30h, CSR_MHPMCOUNTER30H)\r
-DECLARE_CSR(mhpmcounter31h, CSR_MHPMCOUNTER31H)\r
-#endif\r
-#ifdef DECLARE_CAUSE\r
-DECLARE_CAUSE("misaligned fetch", CAUSE_MISALIGNED_FETCH)\r
-DECLARE_CAUSE("fault fetch", CAUSE_FAULT_FETCH)\r
-DECLARE_CAUSE("illegal instruction", CAUSE_ILLEGAL_INSTRUCTION)\r
-DECLARE_CAUSE("breakpoint", CAUSE_BREAKPOINT)\r
-DECLARE_CAUSE("misaligned load", CAUSE_MISALIGNED_LOAD)\r
-DECLARE_CAUSE("fault load", CAUSE_FAULT_LOAD)\r
-DECLARE_CAUSE("misaligned store", CAUSE_MISALIGNED_STORE)\r
-DECLARE_CAUSE("fault store", CAUSE_FAULT_STORE)\r
-DECLARE_CAUSE("user_ecall", CAUSE_USER_ECALL)\r
-DECLARE_CAUSE("supervisor_ecall", CAUSE_SUPERVISOR_ECALL)\r
-DECLARE_CAUSE("hypervisor_ecall", CAUSE_HYPERVISOR_ECALL)\r
-DECLARE_CAUSE("machine_ecall", CAUSE_MACHINE_ECALL)\r
-#endif\r
+++ /dev/null
-// See LICENSE for license details\r
-\r
-#ifndef ENTRY_S\r
-#define ENTRY_S\r
-\r
-#include "encoding.h"\r
-#include "sifive/bits.h"\r
-\r
- .section .text.entry \r
- .align 2\r
- .weak trap_entry\r
- .global trap_entry\r
-trap_entry:\r
- addi sp, sp, -32*REGBYTES\r
-\r
- STORE x1, 1*REGBYTES(sp)\r
- STORE x2, 2*REGBYTES(sp)\r
- STORE x3, 3*REGBYTES(sp)\r
- STORE x4, 4*REGBYTES(sp)\r
- STORE x5, 5*REGBYTES(sp)\r
- STORE x6, 6*REGBYTES(sp)\r
- STORE x7, 7*REGBYTES(sp)\r
- STORE x8, 8*REGBYTES(sp)\r
- STORE x9, 9*REGBYTES(sp)\r
- STORE x10, 10*REGBYTES(sp)\r
- STORE x11, 11*REGBYTES(sp)\r
- STORE x12, 12*REGBYTES(sp)\r
- STORE x13, 13*REGBYTES(sp)\r
- STORE x14, 14*REGBYTES(sp)\r
- STORE x15, 15*REGBYTES(sp)\r
- STORE x16, 16*REGBYTES(sp)\r
- STORE x17, 17*REGBYTES(sp)\r
- STORE x18, 18*REGBYTES(sp)\r
- STORE x19, 19*REGBYTES(sp)\r
- STORE x20, 20*REGBYTES(sp)\r
- STORE x21, 21*REGBYTES(sp)\r
- STORE x22, 22*REGBYTES(sp)\r
- STORE x23, 23*REGBYTES(sp)\r
- STORE x24, 24*REGBYTES(sp)\r
- STORE x25, 25*REGBYTES(sp)\r
- STORE x26, 26*REGBYTES(sp)\r
- STORE x27, 27*REGBYTES(sp)\r
- STORE x28, 28*REGBYTES(sp)\r
- STORE x29, 29*REGBYTES(sp)\r
- STORE x30, 30*REGBYTES(sp)\r
- STORE x31, 31*REGBYTES(sp)\r
-\r
- csrr a0, mcause\r
- csrr a1, mepc\r
- mv a2, sp\r
- call handle_trap\r
- csrw mepc, a0\r
-\r
- # Remain in M-mode after mret\r
- li t0, MSTATUS_MPP\r
- csrs mstatus, t0\r
-\r
- LOAD x1, 1*REGBYTES(sp)\r
- LOAD x2, 2*REGBYTES(sp)\r
- LOAD x3, 3*REGBYTES(sp)\r
- LOAD x4, 4*REGBYTES(sp)\r
- LOAD x5, 5*REGBYTES(sp)\r
- LOAD x6, 6*REGBYTES(sp)\r
- LOAD x7, 7*REGBYTES(sp)\r
- LOAD x8, 8*REGBYTES(sp)\r
- LOAD x9, 9*REGBYTES(sp)\r
- LOAD x10, 10*REGBYTES(sp)\r
- LOAD x11, 11*REGBYTES(sp)\r
- LOAD x12, 12*REGBYTES(sp)\r
- LOAD x13, 13*REGBYTES(sp)\r
- LOAD x14, 14*REGBYTES(sp)\r
- LOAD x15, 15*REGBYTES(sp)\r
- LOAD x16, 16*REGBYTES(sp)\r
- LOAD x17, 17*REGBYTES(sp)\r
- LOAD x18, 18*REGBYTES(sp)\r
- LOAD x19, 19*REGBYTES(sp)\r
- LOAD x20, 20*REGBYTES(sp)\r
- LOAD x21, 21*REGBYTES(sp)\r
- LOAD x22, 22*REGBYTES(sp)\r
- LOAD x23, 23*REGBYTES(sp)\r
- LOAD x24, 24*REGBYTES(sp)\r
- LOAD x25, 25*REGBYTES(sp)\r
- LOAD x26, 26*REGBYTES(sp)\r
- LOAD x27, 27*REGBYTES(sp)\r
- LOAD x28, 28*REGBYTES(sp)\r
- LOAD x29, 29*REGBYTES(sp)\r
- LOAD x30, 30*REGBYTES(sp)\r
- LOAD x31, 31*REGBYTES(sp)\r
-\r
- addi sp, sp, 32*REGBYTES\r
- mret\r
-\r
-.weak handle_trap\r
-handle_trap:\r
-1:\r
- j 1b\r
- \r
-#endif\r
+++ /dev/null
-OUTPUT_ARCH( "riscv" )\r
-\r
-ENTRY( _start )\r
-\r
-MEMORY\r
-{\r
- flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M\r
- ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K\r
-}\r
-\r
-PHDRS\r
-{\r
- flash PT_LOAD;\r
- ram_init PT_LOAD;\r
- ram PT_NULL;\r
-}\r
-\r
-SECTIONS\r
-{\r
- __stack_size = DEFINED(__stack_size) ? __stack_size : 1K;\r
-\r
- .init :\r
- {\r
- KEEP (*(SORT_NONE(.init)))\r
- } >flash AT>flash :flash\r
-\r
- .text :\r
- {\r
- *(.text.unlikely .text.unlikely.*)\r
- *(.text.startup .text.startup.*)\r
- *(.text .text.*)\r
- *(.gnu.linkonce.t.*)\r
- } >flash AT>flash :flash\r
-\r
- .fini :\r
- {\r
- KEEP (*(SORT_NONE(.fini)))\r
- } >flash AT>flash :flash\r
-\r
- PROVIDE (__etext = .);\r
- PROVIDE (_etext = .);\r
- PROVIDE (etext = .);\r
-\r
- . = ALIGN(4);\r
-\r
- .preinit_array :\r
- {\r
- PROVIDE_HIDDEN (__preinit_array_start = .);\r
- KEEP (*(.preinit_array))\r
- PROVIDE_HIDDEN (__preinit_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .init_array :\r
- {\r
- PROVIDE_HIDDEN (__init_array_start = .);\r
- KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))\r
- KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))\r
- PROVIDE_HIDDEN (__init_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .fini_array :\r
- {\r
- PROVIDE_HIDDEN (__fini_array_start = .);\r
- KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))\r
- KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))\r
- PROVIDE_HIDDEN (__fini_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .ctors :\r
- {\r
- /* gcc uses crtbegin.o to find the start of\r
- the constructors, so we make sure it is\r
- first. Because this is a wildcard, it\r
- doesn't matter if the user does not\r
- actually link against crtbegin.o; the\r
- linker won't look for a file to match a\r
- wildcard. The wildcard also means that it\r
- doesn't matter which directory crtbegin.o\r
- is in. */\r
- KEEP (*crtbegin.o(.ctors))\r
- KEEP (*crtbegin?.o(.ctors))\r
- /* We don't want to include the .ctor section from\r
- the crtend.o file until after the sorted ctors.\r
- The .ctor section from the crtend file contains the\r
- end of ctors marker and it must be last */\r
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))\r
- KEEP (*(SORT(.ctors.*)))\r
- KEEP (*(.ctors))\r
- } >flash AT>flash :flash\r
-\r
- .dtors :\r
- {\r
- KEEP (*crtbegin.o(.dtors))\r
- KEEP (*crtbegin?.o(.dtors))\r
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))\r
- KEEP (*(SORT(.dtors.*)))\r
- KEEP (*(.dtors))\r
- } >flash AT>flash :flash\r
-\r
- .lalign :\r
- {\r
- . = ALIGN(4);\r
- PROVIDE( _data_lma = . );\r
- } >flash AT>flash :flash\r
-\r
- .dalign :\r
- {\r
- . = ALIGN(4);\r
- PROVIDE( _data = . );\r
- } >ram AT>flash :ram_init\r
-\r
- .data :\r
- {\r
- *(.rdata)\r
- *(.rodata .rodata.*)\r
- *(.gnu.linkonce.r.*)\r
- *(.data .data.*)\r
- *(.gnu.linkonce.d.*)\r
- . = ALIGN(8);\r
- PROVIDE( __global_pointer$ = . + 0x800 );\r
- *(.sdata .sdata.*)\r
- *(.gnu.linkonce.s.*)\r
- . = ALIGN(8);\r
- *(.srodata.cst16)\r
- *(.srodata.cst8)\r
- *(.srodata.cst4)\r
- *(.srodata.cst2)\r
- *(.srodata .srodata.*)\r
- } >ram AT>flash :ram_init\r
-\r
- . = ALIGN(4);\r
- PROVIDE( _edata = . );\r
- PROVIDE( edata = . );\r
-\r
- PROVIDE( _fbss = . );\r
- PROVIDE( __bss_start = . );\r
- .bss :\r
- {\r
- *(.sbss*)\r
- *(.gnu.linkonce.sb.*)\r
- *(.bss .bss.*)\r
- *(.gnu.linkonce.b.*)\r
- *(COMMON)\r
- . = ALIGN(4);\r
- } >ram AT>ram :ram\r
-\r
- . = ALIGN(8);\r
- PROVIDE( _end = . );\r
- PROVIDE( end = . );\r
-\r
- .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :\r
- {\r
- PROVIDE( _heap_end = . );\r
- . = __stack_size;\r
- PROVIDE( _sp = . );\r
- } >ram AT>ram :ram\r
-}\r
+++ /dev/null
-OUTPUT_ARCH( "riscv" )\r
-\r
-ENTRY( _start )\r
-\r
-MEMORY\r
-{\r
- flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M\r
- ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K\r
-}\r
-\r
-PHDRS\r
-{\r
- flash PT_LOAD;\r
- ram_init PT_LOAD;\r
- ram PT_NULL;\r
-}\r
-\r
-SECTIONS\r
-{\r
- __stack_size = DEFINED(__stack_size) ? __stack_size : 400;\r
-\r
- .init :\r
- {\r
- KEEP (*(SORT_NONE(.init)))\r
- } >flash AT>flash :flash\r
-\r
- .text :\r
- {\r
- *(.text.unlikely .text.unlikely.*)\r
- *(.text.startup .text.startup.*)\r
- *(.text .text.*)\r
- *(.gnu.linkonce.t.*)\r
- } >flash AT>flash :flash\r
-\r
- .fini :\r
- {\r
- KEEP (*(SORT_NONE(.fini)))\r
- } >flash AT>flash :flash\r
-\r
- PROVIDE (__etext = .);\r
- PROVIDE (_etext = .);\r
- PROVIDE (etext = .);\r
-\r
- .rodata :\r
- {\r
- *(.rdata)\r
- *(.rodata .rodata.*)\r
- *(.gnu.linkonce.r.*)\r
- } >flash AT>flash :flash\r
-\r
- . = ALIGN(4);\r
-\r
- .preinit_array :\r
- {\r
- PROVIDE_HIDDEN (__preinit_array_start = .);\r
- KEEP (*(.preinit_array))\r
- PROVIDE_HIDDEN (__preinit_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .init_array :\r
- {\r
- PROVIDE_HIDDEN (__init_array_start = .);\r
- KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))\r
- KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))\r
- PROVIDE_HIDDEN (__init_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .fini_array :\r
- {\r
- PROVIDE_HIDDEN (__fini_array_start = .);\r
- KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))\r
- KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))\r
- PROVIDE_HIDDEN (__fini_array_end = .);\r
- } >flash AT>flash :flash\r
-\r
- .ctors :\r
- {\r
- /* gcc uses crtbegin.o to find the start of\r
- the constructors, so we make sure it is\r
- first. Because this is a wildcard, it\r
- doesn't matter if the user does not\r
- actually link against crtbegin.o; the\r
- linker won't look for a file to match a\r
- wildcard. The wildcard also means that it\r
- doesn't matter which directory crtbegin.o\r
- is in. */\r
- KEEP (*crtbegin.o(.ctors))\r
- KEEP (*crtbegin?.o(.ctors))\r
- /* We don't want to include the .ctor section from\r
- the crtend.o file until after the sorted ctors.\r
- The .ctor section from the crtend file contains the\r
- end of ctors marker and it must be last */\r
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))\r
- KEEP (*(SORT(.ctors.*)))\r
- KEEP (*(.ctors))\r
- } >flash AT>flash :flash\r
-\r
- .dtors :\r
- {\r
- KEEP (*crtbegin.o(.dtors))\r
- KEEP (*crtbegin?.o(.dtors))\r
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))\r
- KEEP (*(SORT(.dtors.*)))\r
- KEEP (*(.dtors))\r
- } >flash AT>flash :flash\r
-\r
- .lalign :\r
- {\r
- . = ALIGN(4);\r
- PROVIDE( _data_lma = . );\r
- } >flash AT>flash :flash\r
-\r
- .dalign :\r
- {\r
- . = ALIGN(4);\r
- PROVIDE( _data = . );\r
- } >ram AT>flash :ram_init\r
-\r
- .data :\r
- {\r
- *(.data .data.*)\r
- *(.gnu.linkonce.d.*)\r
- . = ALIGN(8);\r
- PROVIDE( __global_pointer$ = . + 0x800 );\r
- *(.sdata .sdata.*)\r
- *(.gnu.linkonce.s.*)\r
- . = ALIGN(8);\r
- *(.srodata.cst16)\r
- *(.srodata.cst8)\r
- *(.srodata.cst4)\r
- *(.srodata.cst2)\r
- *(.srodata .srodata.*)\r
- } >ram AT>flash :ram_init\r
-\r
- . = ALIGN(4);\r
- PROVIDE( _edata = . );\r
- PROVIDE( edata = . );\r
-\r
- PROVIDE( _fbss = . );\r
- PROVIDE( __bss_start = . );\r
- .bss :\r
- {\r
- *(.sbss*)\r
- *(.gnu.linkonce.sb.*)\r
- *(.bss .bss.*)\r
- *(.gnu.linkonce.b.*)\r
- *(COMMON)\r
- . = ALIGN(4);\r
- } >ram AT>ram :ram\r
-\r
- . = ALIGN(8);\r
- PROVIDE( _end = . );\r
- PROVIDE( end = . );\r
-\r
- .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :\r
- {\r
- PROVIDE( _heap_end = . );\r
- . = __stack_size;\r
- PROVIDE( _sp = . );\r
- __freertos_irq_stack_top = .;\r
- } >ram AT>ram :ram\r
-}\r
+++ /dev/null
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <unistd.h>\r
-\r
-#include "platform.h"\r
-#include "encoding.h"\r
-\r
-extern int main(int argc, char** argv);\r
-extern void trap_entry();\r
-\r
-static unsigned long mtime_lo(void)\r
-{\r
- return *(volatile unsigned long *)(CLINT_CTRL_ADDR + CLINT_MTIME);\r
-}\r
-\r
-#ifdef __riscv32\r
-\r
-static uint32_t mtime_hi(void)\r
-{\r
- return *(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIME + 4);\r
-}\r
-\r
-uint64_t get_timer_value()\r
-{\r
- while (1) {\r
- uint32_t hi = mtime_hi();\r
- uint32_t lo = mtime_lo();\r
- if (hi == mtime_hi())\r
- return ((uint64_t)hi << 32) | lo;\r
- }\r
-}\r
-\r
-#else /* __riscv32 */\r
-\r
-uint64_t get_timer_value()\r
-{\r
- return mtime_lo();\r
-}\r
-\r
-#endif\r
-\r
-unsigned long get_timer_freq()\r
-{\r
- return 32768;\r
-}\r
-\r
-static void use_hfrosc(int div, int trim)\r
-{\r
- // Make sure the HFROSC is running at its default setting\r
- PRCI_REG(PRCI_HFROSCCFG) = (ROSC_DIV(div) | ROSC_TRIM(trim) | ROSC_EN(1));\r
- while ((PRCI_REG(PRCI_HFROSCCFG) & ROSC_RDY(1)) == 0) ;\r
- PRCI_REG(PRCI_PLLCFG) &= ~PLL_SEL(1);\r
-}\r
-\r
-static void use_pll(int refsel, int bypass, int r, int f, int q)\r
-{\r
- // Ensure that we aren't running off the PLL before we mess with it.\r
- if (PRCI_REG(PRCI_PLLCFG) & PLL_SEL(1)) {\r
- // Make sure the HFROSC is running at its default setting\r
- use_hfrosc(4, 16);\r
- }\r
-\r
- // Set PLL Source to be HFXOSC if available.\r
- uint32_t config_value = 0;\r
-\r
- config_value |= PLL_REFSEL(refsel);\r
-\r
- if (bypass) {\r
- // Bypass\r
- config_value |= PLL_BYPASS(1);\r
-\r
- PRCI_REG(PRCI_PLLCFG) = config_value;\r
-\r
- // If we don't have an HFXTAL, this doesn't really matter.\r
- // Set our Final output divide to divide-by-1:\r
- PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));\r
- } else {\r
- // In case we are executing from QSPI,\r
- // (which is quite likely) we need to\r
- // set the QSPI clock divider appropriately\r
- // before boosting the clock frequency.\r
-\r
- // Div = f_sck/2\r
- SPI0_REG(SPI_REG_SCKDIV) = 8;\r
-\r
- // Set DIV Settings for PLL\r
- // Both HFROSC and HFXOSC are modeled as ideal\r
- // 16MHz sources (assuming dividers are set properly for\r
- // HFROSC).\r
- // (Legal values of f_REF are 6-48MHz)\r
-\r
- // Set DIVR to divide-by-2 to get 8MHz frequency\r
- // (legal values of f_R are 6-12 MHz)\r
-\r
- config_value |= PLL_BYPASS(1);\r
- config_value |= PLL_R(r);\r
-\r
- // Set DIVF to get 512Mhz frequncy\r
- // There is an implied multiply-by-2, 16Mhz.\r
- // So need to write 32-1\r
- // (legal values of f_F are 384-768 MHz)\r
- config_value |= PLL_F(f);\r
-\r
- // Set DIVQ to divide-by-2 to get 256 MHz frequency\r
- // (legal values of f_Q are 50-400Mhz)\r
- config_value |= PLL_Q(q);\r
-\r
- // Set our Final output divide to divide-by-1:\r
- PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));\r
-\r
- PRCI_REG(PRCI_PLLCFG) = config_value;\r
-\r
- // Un-Bypass the PLL.\r
- PRCI_REG(PRCI_PLLCFG) &= ~PLL_BYPASS(1);\r
-\r
- // Wait for PLL Lock\r
- // Note that the Lock signal can be glitchy.\r
- // Need to wait 100 us\r
- // RTC is running at 32kHz.\r
- // So wait 4 ticks of RTC.\r
- uint32_t now = mtime_lo();\r
- while (mtime_lo() - now < 4) ;\r
-\r
- // Now it is safe to check for PLL Lock\r
- while ((PRCI_REG(PRCI_PLLCFG) & PLL_LOCK(1)) == 0) ;\r
- }\r
-\r
- // Switch over to PLL Clock source\r
- PRCI_REG(PRCI_PLLCFG) |= PLL_SEL(1);\r
-}\r
-\r
-static void use_default_clocks()\r
-{\r
- // Turn off the LFROSC\r
- AON_REG(AON_LFROSC) &= ~ROSC_EN(1);\r
-\r
- // Use HFROSC\r
- use_hfrosc(4, 16);\r
-}\r
-\r
-static unsigned long __attribute__((noinline)) measure_cpu_freq(size_t n)\r
-{\r
- unsigned long start_mtime, delta_mtime;\r
- unsigned long mtime_freq = get_timer_freq();\r
-\r
- // Don't start measuruing until we see an mtime tick\r
- unsigned long tmp = mtime_lo();\r
- do {\r
- start_mtime = mtime_lo();\r
- } while (start_mtime == tmp);\r
-\r
- unsigned long start_mcycle = read_csr(mcycle);\r
-\r
- do {\r
- delta_mtime = mtime_lo() - start_mtime;\r
- } while (delta_mtime < n);\r
-\r
- unsigned long delta_mcycle = read_csr(mcycle) - start_mcycle;\r
-\r
- return (delta_mcycle / delta_mtime) * mtime_freq\r
- + ((delta_mcycle % delta_mtime) * mtime_freq) / delta_mtime;\r
-}\r
-\r
-unsigned long get_cpu_freq()\r
-{\r
- static uint32_t cpu_freq;\r
-\r
- if (!cpu_freq) {\r
- // warm up I$\r
- measure_cpu_freq(1);\r
- // measure for real\r
- cpu_freq = measure_cpu_freq(10);\r
- }\r
-\r
- return cpu_freq;\r
-}\r
-\r
-static void uart_init(size_t baud_rate)\r
-{\r
- GPIO_REG(GPIO_IOF_SEL) &= ~IOF0_UART0_MASK;\r
- GPIO_REG(GPIO_IOF_EN) |= IOF0_UART0_MASK;\r
- UART0_REG(UART_REG_DIV) = get_cpu_freq() / baud_rate - 1;\r
- UART0_REG(UART_REG_TXCTRL) |= UART_TXEN;\r
-}\r
-\r
-\r
-\r
-#ifdef USE_PLIC\r
-extern void handle_m_ext_interrupt();\r
-#endif\r
-\r
-#ifdef USE_M_TIME\r
-extern void handle_m_time_interrupt();\r
-#endif\r
-\r
-uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc)\r
-{\r
- if (0){\r
-#ifdef USE_PLIC\r
- // External Machine-Level interrupt from PLIC\r
- } else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) {\r
- handle_m_ext_interrupt();\r
-#endif\r
-#ifdef USE_M_TIME\r
- // External Machine-Level interrupt from PLIC\r
- } else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER)){\r
- handle_m_time_interrupt();\r
-#endif\r
- }\r
- else {\r
- write(1, "trap\n", 5);\r
- _exit(1 + mcause);\r
- }\r
- return epc;\r
-}\r
-\r
-void _init()\r
-{\r
- \r
- #ifndef NO_INIT\r
- use_default_clocks();\r
- use_pll(0, 0, 1, 31, 1);\r
- uart_init(115200);\r
-\r
- write_csr(mtvec, &trap_entry);\r
- if (read_csr(misa) & (1 << ('F' - 'A'))) { // if F extension is present\r
- write_csr(mstatus, MSTATUS_FS); // allow FPU instructions without trapping\r
- write_csr(fcsr, 0); // initialize rounding mode, undefined at reset\r
- }\r
- #endif\r
- \r
-}\r
-\r
-void _fini()\r
-{\r
-}\r
+++ /dev/null
-adapter_khz 10000\r
-\r
-interface ftdi\r
-ftdi_device_desc "Dual RS232-HS"\r
-ftdi_vid_pid 0x0403 0x6010\r
-\r
-ftdi_layout_init 0x0008 0x001b\r
-ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020\r
-\r
-#Reset Stretcher logic on FE310 is ~1 second long\r
-#This doesn't apply if you use\r
-# ftdi_set_signal, but still good to document\r
-#adapter_nsrst_delay 1500\r
-\r
-set _CHIPNAME riscv\r
-jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913\r
-\r
-set _TARGETNAME $_CHIPNAME.cpu\r
-target create $_TARGETNAME riscv -chain-position $_TARGETNAME\r
-$_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1\r
-\r
-flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME\r
-init\r
-#reset -- This type of reset is not implemented yet\r
-if {[ info exists pulse_srst]} {\r
- ftdi_set_signal nSRST 0\r
- ftdi_set_signal nSRST z\r
- #Wait for the reset stretcher\r
- #It will work without this, but\r
- #will incur lots of delays for later commands.\r
- sleep 1500\r
-} \r
-halt\r
-#flash protect 0 64 last off\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_PLATFORM_H\r
-#define _SIFIVE_PLATFORM_H\r
-\r
-// Some things missing from the official encoding.h\r
-#define MCAUSE_INT 0x80000000\r
-#define MCAUSE_CAUSE 0x7FFFFFFF\r
-\r
-#include "sifive/const.h"\r
-#include "sifive/devices/aon.h"\r
-#include "sifive/devices/clint.h"\r
-#include "sifive/devices/gpio.h"\r
-#include "sifive/devices/otp.h"\r
-#include "sifive/devices/plic.h"\r
-#include "sifive/devices/prci.h"\r
-#include "sifive/devices/pwm.h"\r
-#include "sifive/devices/spi.h"\r
-#include "sifive/devices/uart.h"\r
-\r
-/****************************************************************************\r
- * Platform definitions\r
- *****************************************************************************/\r
-\r
-// Memory map\r
-#define MASKROM_MEM_ADDR _AC(0x00001000,UL)\r
-#define TRAPVEC_TABLE_CTRL_ADDR _AC(0x00001010,UL)\r
-#define OTP_MEM_ADDR _AC(0x00020000,UL)\r
-#define CLINT_CTRL_ADDR _AC(0x02000000,UL)\r
-#define PLIC_CTRL_ADDR _AC(0x0C000000,UL)\r
-#define AON_CTRL_ADDR _AC(0x10000000,UL)\r
-#define PRCI_CTRL_ADDR _AC(0x10008000,UL)\r
-#define OTP_CTRL_ADDR _AC(0x10010000,UL)\r
-#define GPIO_CTRL_ADDR _AC(0x10012000,UL)\r
-#define UART0_CTRL_ADDR _AC(0x10013000,UL)\r
-#define SPI0_CTRL_ADDR _AC(0x10014000,UL)\r
-#define PWM0_CTRL_ADDR _AC(0x10015000,UL)\r
-#define UART1_CTRL_ADDR _AC(0x10023000,UL)\r
-#define SPI1_CTRL_ADDR _AC(0x10024000,UL)\r
-#define PWM1_CTRL_ADDR _AC(0x10025000,UL)\r
-#define SPI2_CTRL_ADDR _AC(0x10034000,UL)\r
-#define PWM2_CTRL_ADDR _AC(0x10035000,UL)\r
-#define SPI0_MEM_ADDR _AC(0x20000000,UL)\r
-#define MEM_CTRL_ADDR _AC(0x80000000,UL)\r
-\r
-// IOF masks\r
-#define IOF0_SPI1_MASK _AC(0x000007FC,UL)\r
-#define SPI11_NUM_SS (4)\r
-#define IOF_SPI1_SS0 (2u)\r
-#define IOF_SPI1_SS1 (8u)\r
-#define IOF_SPI1_SS2 (9u)\r
-#define IOF_SPI1_SS3 (10u)\r
-#define IOF_SPI1_MOSI (3u)\r
-#define IOF_SPI1_MISO (4u)\r
-#define IOF_SPI1_SCK (5u)\r
-#define IOF_SPI1_DQ0 (3u)\r
-#define IOF_SPI1_DQ1 (4u)\r
-#define IOF_SPI1_DQ2 (6u)\r
-#define IOF_SPI1_DQ3 (7u)\r
-\r
-#define IOF0_SPI2_MASK _AC(0xFC000000,UL)\r
-#define SPI2_NUM_SS (1)\r
-#define IOF_SPI2_SS0 (26u)\r
-#define IOF_SPI2_MOSI (27u)\r
-#define IOF_SPI2_MISO (28u)\r
-#define IOF_SPI2_SCK (29u)\r
-#define IOF_SPI2_DQ0 (27u)\r
-#define IOF_SPI2_DQ1 (28u)\r
-#define IOF_SPI2_DQ2 (30u)\r
-#define IOF_SPI2_DQ3 (31u)\r
-\r
-//#define IOF0_I2C_MASK _AC(0x00003000,UL)\r
-\r
-#define IOF0_UART0_MASK _AC(0x00030000, UL)\r
-#define IOF_UART0_RX (16u)\r
-#define IOF_UART0_TX (17u)\r
-\r
-#define IOF0_UART1_MASK _AC(0x03000000, UL)\r
-#define IOF_UART1_RX (24u)\r
-#define IOF_UART1_TX (25u)\r
-\r
-#define IOF1_PWM0_MASK _AC(0x0000000F, UL)\r
-#define IOF1_PWM1_MASK _AC(0x00780000, UL)\r
-#define IOF1_PWM2_MASK _AC(0x00003C00, UL)\r
-\r
-// Interrupt numbers\r
-#define INT_RESERVED 0\r
-#define INT_WDOGCMP 1\r
-#define INT_RTCCMP 2\r
-#define INT_UART0_BASE 3\r
-#define INT_UART1_BASE 4\r
-#define INT_SPI0_BASE 5\r
-#define INT_SPI1_BASE 6\r
-#define INT_SPI2_BASE 7\r
-#define INT_GPIO_BASE 8\r
-#define INT_PWM0_BASE 40\r
-#define INT_PWM1_BASE 44\r
-#define INT_PWM2_BASE 48\r
-\r
-// Helper functions\r
-#define _REG32(p, i) (*(volatile uint32_t *) ((p) + (i)))\r
-#define _REG32P(p, i) ((volatile uint32_t *) ((p) + (i)))\r
-#define AON_REG(offset) _REG32(AON_CTRL_ADDR, offset)\r
-#define CLINT_REG(offset) _REG32(CLINT_CTRL_ADDR, offset)\r
-#define GPIO_REG(offset) _REG32(GPIO_CTRL_ADDR, offset)\r
-#define OTP_REG(offset) _REG32(OTP_CTRL_ADDR, offset)\r
-#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)\r
-#define PRCI_REG(offset) _REG32(PRCI_CTRL_ADDR, offset)\r
-#define PWM0_REG(offset) _REG32(PWM0_CTRL_ADDR, offset)\r
-#define PWM1_REG(offset) _REG32(PWM1_CTRL_ADDR, offset)\r
-#define PWM2_REG(offset) _REG32(PWM2_CTRL_ADDR, offset)\r
-#define SPI0_REG(offset) _REG32(SPI0_CTRL_ADDR, offset)\r
-#define SPI1_REG(offset) _REG32(SPI1_CTRL_ADDR, offset)\r
-#define SPI2_REG(offset) _REG32(SPI2_CTRL_ADDR, offset)\r
-#define UART0_REG(offset) _REG32(UART0_CTRL_ADDR, offset)\r
-#define UART1_REG(offset) _REG32(UART1_CTRL_ADDR, offset)\r
-\r
-// Misc\r
-\r
-#include <stdint.h>\r
-\r
-#define NUM_GPIO 32\r
-\r
-#define PLIC_NUM_INTERRUPTS 52\r
-#define PLIC_NUM_PRIORITIES 7\r
-\r
-#include "hifive1.h"\r
-\r
-unsigned long get_cpu_freq(void);\r
-unsigned long get_timer_freq(void);\r
-uint64_t get_timer_value(void);\r
-\r
-#endif /* _SIFIVE_PLATFORM_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_HIFIVE1_H\r
-#define _SIFIVE_HIFIVE1_H\r
-\r
-#include <stdint.h>\r
-\r
-/****************************************************************************\r
- * GPIO Connections\r
- *****************************************************************************/\r
-\r
-// These are the GPIO bit offsets for the RGB LED on HiFive1 Board.\r
-// These are also mapped to RGB LEDs on the Freedom E300 Arty\r
-// FPGA\r
-// Dev Kit.\r
-\r
-#define RED_LED_OFFSET 22\r
-#define GREEN_LED_OFFSET 19\r
-#define BLUE_LED_OFFSET 21\r
-\r
-// These are the GPIO bit offsets for the differen digital pins\r
-// on the headers for both the HiFive1 Board and the Freedom E300 Arty FPGA Dev Kit.\r
-#define PIN_0_OFFSET 16\r
-#define PIN_1_OFFSET 17\r
-#define PIN_2_OFFSET 18\r
-#define PIN_3_OFFSET 19\r
-#define PIN_4_OFFSET 20\r
-#define PIN_5_OFFSET 21\r
-#define PIN_6_OFFSET 22\r
-#define PIN_7_OFFSET 23\r
-#define PIN_8_OFFSET 0\r
-#define PIN_9_OFFSET 1\r
-#define PIN_10_OFFSET 2\r
-#define PIN_11_OFFSET 3\r
-#define PIN_12_OFFSET 4\r
-#define PIN_13_OFFSET 5\r
-//#define PIN_14_OFFSET 8 //This pin is not connected on either board.\r
-#define PIN_15_OFFSET 9\r
-#define PIN_16_OFFSET 10\r
-#define PIN_17_OFFSET 11\r
-#define PIN_18_OFFSET 12\r
-#define PIN_19_OFFSET 13\r
-\r
-// These are *PIN* numbers, not\r
-// GPIO Offset Numbers.\r
-#define PIN_SPI1_SCK (13u)\r
-#define PIN_SPI1_MISO (12u)\r
-#define PIN_SPI1_MOSI (11u)\r
-#define PIN_SPI1_SS0 (10u)\r
-#define PIN_SPI1_SS1 (14u) \r
-#define PIN_SPI1_SS2 (15u)\r
-#define PIN_SPI1_SS3 (16u)\r
-\r
-#define SS_PIN_TO_CS_ID(x) \\r
- ((x==PIN_SPI1_SS0 ? 0 : \\r
- (x==PIN_SPI1_SS1 ? 1 : \\r
- (x==PIN_SPI1_SS2 ? 2 : \\r
- (x==PIN_SPI1_SS3 ? 3 : \\r
- -1))))) \r
-\r
-\r
-// These buttons are present only on the Freedom E300 Arty Dev Kit.\r
-#ifdef HAS_BOARD_BUTTONS\r
-#define BUTTON_0_OFFSET 15\r
-#define BUTTON_1_OFFSET 30\r
-#define BUTTON_2_OFFSET 31\r
-\r
-#define INT_DEVICE_BUTTON_0 (INT_GPIO_BASE + BUTTON_0_OFFSET)\r
-#define INT_DEVICE_BUTTON_1 (INT_GPIO_BASE + BUTTON_1_OFFSET)\r
-#define INT_DEVICE_BUTTON_2 (INT_GPIO_BASE + BUTTON_2_OFFSET)\r
-\r
-#endif\r
-\r
-#define HAS_HFXOSC 1\r
-#define HAS_LFROSC_BYPASS 1\r
-\r
-#define RTC_FREQ 32768\r
-\r
-void write_hex(int fd, unsigned long int hex);\r
-\r
-#endif /* _SIFIVE_HIFIVE1_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-/* This is defined in sifive/platform.h, but that can't be included from\r
- * assembly. */\r
-#define CLINT_CTRL_ADDR 0x02000000\r
-\r
- .section .init\r
- .globl _start\r
- .type _start,@function\r
-\r
-_start:\r
- .cfi_startproc\r
- .cfi_undefined ra\r
-.option push\r
-.option norelax\r
- la gp, __global_pointer$\r
-.option pop\r
- la sp, _sp\r
-\r
-#if defined(ENABLE_SMP)\r
- smp_pause(t0, t1)\r
-#endif\r
-\r
- /* Load data section */\r
- la a0, _data_lma\r
- la a1, _data\r
- la a2, _edata\r
- bgeu a1, a2, 2f\r
-1:\r
- lw t0, (a0)\r
- sw t0, (a1)\r
- addi a0, a0, 4\r
- addi a1, a1, 4\r
- bltu a1, a2, 1b\r
-2:\r
-\r
- /* Clear bss section */\r
- la a0, __bss_start\r
- la a1, _end\r
- bgeu a0, a1, 2f\r
-1:\r
- sw zero, (a0)\r
- addi a0, a0, 4\r
- bltu a0, a1, 1b\r
-2:\r
-\r
- /* Call global constructors */\r
- la a0, __libc_fini_array\r
- call atexit\r
- call __libc_init_array\r
-\r
-#ifndef __riscv_float_abi_soft\r
- /* Enable FPU */\r
- li t0, MSTATUS_FS\r
- csrs mstatus, t0\r
- csrr t1, mstatus\r
- and t1, t1, t0\r
- beqz t1, 1f\r
- fssr x0\r
-1:\r
-#endif\r
-\r
-#if defined(ENABLE_SMP)\r
- smp_resume(t0, t1)\r
-\r
- csrr a0, mhartid\r
- bnez a0, 2f\r
-#endif\r
-\r
- auipc ra, 0\r
- addi sp, sp, -16\r
-#if __riscv_xlen == 32\r
- sw ra, 8(sp)\r
-#else\r
- sd ra, 8(sp)\r
-#endif\r
-\r
- /* argc = argv = 0 */\r
- li a0, 0\r
- li a1, 0\r
- call main\r
- tail exit\r
-1:\r
- j 1b\r
-\r
-#if defined(ENABLE_SMP)\r
-2:\r
- la t0, trap_entry\r
- csrw mtvec, t0\r
-\r
- csrr a0, mhartid\r
- la t1, _sp\r
- slli t0, a0, 10\r
- sub sp, t1, t0\r
-\r
- auipc ra, 0\r
- addi sp, sp, -16\r
-#if __riscv_xlen == 32\r
- sw ra, 8(sp)\r
-#else\r
- sd ra, 8(sp)\r
-#endif\r
-\r
- call secondary_main\r
- tail exit\r
-\r
-1:\r
- j 1b\r
-#endif\r
- .cfi_endproc\r
+++ /dev/null
-// See LICENSE for license details.\r
-#ifndef _RISCV_BITS_H\r
-#define _RISCV_BITS_H\r
-\r
-#define likely(x) __builtin_expect((x), 1)\r
-#define unlikely(x) __builtin_expect((x), 0)\r
-\r
-#define ROUNDUP(a, b) ((((a)-1)/(b)+1)*(b))\r
-#define ROUNDDOWN(a, b) ((a)/(b)*(b))\r
-\r
-#define MAX(a, b) ((a) > (b) ? (a) : (b))\r
-#define MIN(a, b) ((a) < (b) ? (a) : (b))\r
-#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi)\r
-\r
-#define EXTRACT_FIELD(val, which) (((val) & (which)) / ((which) & ~((which)-1)))\r
-#define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))\r
-\r
-#define STR(x) XSTR(x)\r
-#define XSTR(x) #x\r
-\r
-#if __riscv_xlen == 64\r
-# define SLL32 sllw\r
-# define STORE sd\r
-# define LOAD ld\r
-# define LWU lwu\r
-# define LOG_REGBYTES 3\r
-#else\r
-# define SLL32 sll\r
-# define STORE sw\r
-# define LOAD lw\r
-# define LWU lw\r
-# define LOG_REGBYTES 2\r
-#endif\r
-#define REGBYTES (1 << LOG_REGBYTES)\r
-\r
-#endif\r
+++ /dev/null
-// See LICENSE for license details.\r
-/* Derived from <linux/const.h> */\r
-\r
-#ifndef _SIFIVE_CONST_H\r
-#define _SIFIVE_CONST_H\r
-\r
-#ifdef __ASSEMBLER__\r
-#define _AC(X,Y) X\r
-#define _AT(T,X) X\r
-#else\r
-#define _AC(X,Y) (X##Y)\r
-#define _AT(T,X) ((T)(X))\r
-#endif /* !__ASSEMBLER__*/\r
-\r
-#define _BITUL(x) (_AC(1,UL) << (x))\r
-#define _BITULL(x) (_AC(1,ULL) << (x))\r
-\r
-#endif /* _SIFIVE_CONST_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_AON_H\r
-#define _SIFIVE_AON_H\r
-\r
-/* Register offsets */\r
-\r
-#define AON_WDOGCFG 0x000\r
-#define AON_WDOGCOUNT 0x008\r
-#define AON_WDOGS 0x010\r
-#define AON_WDOGFEED 0x018\r
-#define AON_WDOGKEY 0x01C\r
-#define AON_WDOGCMP 0x020\r
-\r
-#define AON_RTCCFG 0x040\r
-#define AON_RTCLO 0x048\r
-#define AON_RTCHI 0x04C\r
-#define AON_RTCS 0x050\r
-#define AON_RTCCMP 0x060\r
-\r
-#define AON_BACKUP0 0x080\r
-#define AON_BACKUP1 0x084\r
-#define AON_BACKUP2 0x088\r
-#define AON_BACKUP3 0x08C\r
-#define AON_BACKUP4 0x090\r
-#define AON_BACKUP5 0x094\r
-#define AON_BACKUP6 0x098\r
-#define AON_BACKUP7 0x09C\r
-#define AON_BACKUP8 0x0A0\r
-#define AON_BACKUP9 0x0A4\r
-#define AON_BACKUP10 0x0A8\r
-#define AON_BACKUP11 0x0AC\r
-#define AON_BACKUP12 0x0B0\r
-#define AON_BACKUP13 0x0B4\r
-#define AON_BACKUP14 0x0B8\r
-#define AON_BACKUP15 0x0BC\r
-\r
-#define AON_PMUWAKEUPI0 0x100\r
-#define AON_PMUWAKEUPI1 0x104\r
-#define AON_PMUWAKEUPI2 0x108\r
-#define AON_PMUWAKEUPI3 0x10C\r
-#define AON_PMUWAKEUPI4 0x110\r
-#define AON_PMUWAKEUPI5 0x114\r
-#define AON_PMUWAKEUPI6 0x118\r
-#define AON_PMUWAKEUPI7 0x11C\r
-#define AON_PMUSLEEPI0 0x120\r
-#define AON_PMUSLEEPI1 0x124\r
-#define AON_PMUSLEEPI2 0x128\r
-#define AON_PMUSLEEPI3 0x12C\r
-#define AON_PMUSLEEPI4 0x130\r
-#define AON_PMUSLEEPI5 0x134\r
-#define AON_PMUSLEEPI6 0x138\r
-#define AON_PMUSLEEPI7 0x13C\r
-#define AON_PMUIE 0x140\r
-#define AON_PMUCAUSE 0x144\r
-#define AON_PMUSLEEP 0x148\r
-#define AON_PMUKEY 0x14C\r
-\r
-#define AON_LFROSC 0x070\r
-/* Constants */\r
-\r
-#define AON_WDOGKEY_VALUE 0x51F15E\r
-#define AON_WDOGFEED_VALUE 0xD09F00D\r
-\r
-#define AON_WDOGCFG_SCALE 0x0000000F\r
-#define AON_WDOGCFG_RSTEN 0x00000100\r
-#define AON_WDOGCFG_ZEROCMP 0x00000200\r
-#define AON_WDOGCFG_ENALWAYS 0x00001000\r
-#define AON_WDOGCFG_ENCOREAWAKE 0x00002000\r
-#define AON_WDOGCFG_CMPIP 0x10000000\r
-\r
-#define AON_RTCCFG_SCALE 0x0000000F\r
-#define AON_RTCCFG_ENALWAYS 0x00001000\r
-#define AON_RTCCFG_CMPIP 0x10000000\r
-\r
-#define AON_WAKEUPCAUSE_RESET 0x00\r
-#define AON_WAKEUPCAUSE_RTC 0x01\r
-#define AON_WAKEUPCAUSE_DWAKEUP 0x02\r
-#define AON_WAKEUPCAUSE_AWAKEUP 0x03\r
-\r
-#define AON_RESETCAUSE_POWERON 0x0000\r
-#define AON_RESETCAUSE_EXTERNAL 0x0100\r
-#define AON_RESETCAUSE_WATCHDOG 0x0200\r
-\r
-#define AON_PMUCAUSE_WAKEUPCAUSE 0x00FF\r
-#define AON_PMUCAUSE_RESETCAUSE 0xFF00\r
-\r
-#endif /* _SIFIVE_AON_H */\r
+++ /dev/null
-// See LICENSE for license details\r
-\r
-#ifndef _SIFIVE_CLINT_H\r
-#define _SIFIVE_CLINT_H\r
-\r
-\r
-#define CLINT_MSIP 0x0000\r
-#define CLINT_MSIP_size 0x4\r
-#define CLINT_MTIMECMP 0x4000\r
-#define CLINT_MTIMECMP_size 0x8\r
-#define CLINT_MTIME 0xBFF8\r
-#define CLINT_MTIME_size 0x8\r
-\r
-#endif /* _SIFIVE_CLINT_H */ \r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_GPIO_H\r
-#define _SIFIVE_GPIO_H\r
-\r
-#define GPIO_INPUT_VAL (0x00)\r
-#define GPIO_INPUT_EN (0x04)\r
-#define GPIO_OUTPUT_EN (0x08)\r
-#define GPIO_OUTPUT_VAL (0x0C)\r
-#define GPIO_PULLUP_EN (0x10)\r
-#define GPIO_DRIVE (0x14)\r
-#define GPIO_RISE_IE (0x18)\r
-#define GPIO_RISE_IP (0x1C)\r
-#define GPIO_FALL_IE (0x20)\r
-#define GPIO_FALL_IP (0x24)\r
-#define GPIO_HIGH_IE (0x28)\r
-#define GPIO_HIGH_IP (0x2C)\r
-#define GPIO_LOW_IE (0x30)\r
-#define GPIO_LOW_IP (0x34)\r
-#define GPIO_IOF_EN (0x38)\r
-#define GPIO_IOF_SEL (0x3C)\r
-#define GPIO_OUTPUT_XOR (0x40)\r
-\r
-#endif /* _SIFIVE_GPIO_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_OTP_H\r
-#define _SIFIVE_OTP_H\r
-\r
-/* Register offsets */\r
-\r
-#define OTP_LOCK 0x00\r
-#define OTP_CK 0x04\r
-#define OTP_OE 0x08\r
-#define OTP_SEL 0x0C\r
-#define OTP_WE 0x10\r
-#define OTP_MR 0x14\r
-#define OTP_MRR 0x18\r
-#define OTP_MPP 0x1C\r
-#define OTP_VRREN 0x20\r
-#define OTP_VPPEN 0x24\r
-#define OTP_A 0x28\r
-#define OTP_D 0x2C\r
-#define OTP_Q 0x30\r
-#define OTP_READ_TIMINGS 0x34\r
-\r
-#endif\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef PLIC_H\r
-#define PLIC_H\r
-\r
-#include <sifive/const.h>\r
-\r
-// 32 bits per source\r
-#define PLIC_PRIORITY_OFFSET _AC(0x0000,UL)\r
-#define PLIC_PRIORITY_SHIFT_PER_SOURCE 2\r
-// 1 bit per source (1 address)\r
-#define PLIC_PENDING_OFFSET _AC(0x1000,UL)\r
-#define PLIC_PENDING_SHIFT_PER_SOURCE 0\r
-\r
-//0x80 per target\r
-#define PLIC_ENABLE_OFFSET _AC(0x2000,UL)\r
-#define PLIC_ENABLE_SHIFT_PER_TARGET 7\r
-\r
-\r
-#define PLIC_THRESHOLD_OFFSET _AC(0x200000,UL)\r
-#define PLIC_CLAIM_OFFSET _AC(0x200004,UL)\r
-#define PLIC_THRESHOLD_SHIFT_PER_TARGET 12\r
-#define PLIC_CLAIM_SHIFT_PER_TARGET 12\r
-\r
-#define PLIC_MAX_SOURCE 1023\r
-#define PLIC_SOURCE_MASK 0x3FF\r
-\r
-#define PLIC_MAX_TARGET 15871\r
-#define PLIC_TARGET_MASK 0x3FFF\r
-\r
-#endif /* PLIC_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_PRCI_H\r
-#define _SIFIVE_PRCI_H\r
-\r
-/* Register offsets */\r
-\r
-#define PRCI_HFROSCCFG (0x0000)\r
-#define PRCI_HFXOSCCFG (0x0004)\r
-#define PRCI_PLLCFG (0x0008)\r
-#define PRCI_PLLDIV (0x000C)\r
-#define PRCI_PROCMONCFG (0x00F0)\r
-\r
-/* Fields */\r
-#define ROSC_DIV(x) (((x) & 0x2F) << 0 ) \r
-#define ROSC_TRIM(x) (((x) & 0x1F) << 16)\r
-#define ROSC_EN(x) (((x) & 0x1 ) << 30) \r
-#define ROSC_RDY(x) (((x) & 0x1 ) << 31)\r
-\r
-#define XOSC_EN(x) (((x) & 0x1) << 30)\r
-#define XOSC_RDY(x) (((x) & 0x1) << 31)\r
-\r
-#define PLL_R(x) (((x) & 0x7) << 0)\r
-// single reserved bit for F LSB.\r
-#define PLL_F(x) (((x) & 0x3F) << 4)\r
-#define PLL_Q(x) (((x) & 0x3) << 10)\r
-#define PLL_SEL(x) (((x) & 0x1) << 16)\r
-#define PLL_REFSEL(x) (((x) & 0x1) << 17)\r
-#define PLL_BYPASS(x) (((x) & 0x1) << 18)\r
-#define PLL_LOCK(x) (((x) & 0x1) << 31)\r
-\r
-#define PLL_R_default 0x1\r
-#define PLL_F_default 0x1F\r
-#define PLL_Q_default 0x3\r
-\r
-#define PLL_REFSEL_HFROSC 0x0\r
-#define PLL_REFSEL_HFXOSC 0x1\r
-\r
-#define PLL_SEL_HFROSC 0x0\r
-#define PLL_SEL_PLL 0x1\r
-\r
-#define PLL_FINAL_DIV(x) (((x) & 0x3F) << 0)\r
-#define PLL_FINAL_DIV_BY_1(x) (((x) & 0x1 ) << 8)\r
-\r
-#define PROCMON_DIV(x) (((x) & 0x1F) << 0)\r
-#define PROCMON_TRIM(x) (((x) & 0x1F) << 8)\r
-#define PROCMON_EN(x) (((x) & 0x1) << 16)\r
-#define PROCMON_SEL(x) (((x) & 0x3) << 24)\r
-#define PROCMON_NT_EN(x) (((x) & 0x1) << 28)\r
-\r
-#define PROCMON_SEL_HFCLK 0\r
-#define PROCMON_SEL_HFXOSCIN 1\r
-#define PROCMON_SEL_PLLOUTDIV 2\r
-#define PROCMON_SEL_PROCMON 3\r
-\r
-#endif // _SIFIVE_PRCI_H\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_PWM_H\r
-#define _SIFIVE_PWM_H\r
-\r
-/* Register offsets */\r
-\r
-#define PWM_CFG 0x00\r
-#define PWM_COUNT 0x08\r
-#define PWM_S 0x10\r
-#define PWM_CMP0 0x20\r
-#define PWM_CMP1 0x24\r
-#define PWM_CMP2 0x28\r
-#define PWM_CMP3 0x2C\r
-\r
-/* Constants */\r
-\r
-#define PWM_CFG_SCALE 0x0000000F\r
-#define PWM_CFG_STICKY 0x00000100\r
-#define PWM_CFG_ZEROCMP 0x00000200\r
-#define PWM_CFG_DEGLITCH 0x00000400\r
-#define PWM_CFG_ENALWAYS 0x00001000\r
-#define PWM_CFG_ONESHOT 0x00002000\r
-#define PWM_CFG_CMP0CENTER 0x00010000\r
-#define PWM_CFG_CMP1CENTER 0x00020000\r
-#define PWM_CFG_CMP2CENTER 0x00040000\r
-#define PWM_CFG_CMP3CENTER 0x00080000\r
-#define PWM_CFG_CMP0GANG 0x01000000\r
-#define PWM_CFG_CMP1GANG 0x02000000\r
-#define PWM_CFG_CMP2GANG 0x04000000\r
-#define PWM_CFG_CMP3GANG 0x08000000\r
-#define PWM_CFG_CMP0IP 0x10000000\r
-#define PWM_CFG_CMP1IP 0x20000000\r
-#define PWM_CFG_CMP2IP 0x40000000\r
-#define PWM_CFG_CMP3IP 0x80000000\r
-\r
-#endif /* _SIFIVE_PWM_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_SPI_H\r
-#define _SIFIVE_SPI_H\r
-\r
-/* Register offsets */\r
-\r
-#define SPI_REG_SCKDIV 0x00\r
-#define SPI_REG_SCKMODE 0x04\r
-#define SPI_REG_CSID 0x10\r
-#define SPI_REG_CSDEF 0x14\r
-#define SPI_REG_CSMODE 0x18\r
-\r
-#define SPI_REG_DCSSCK 0x28\r
-#define SPI_REG_DSCKCS 0x2a\r
-#define SPI_REG_DINTERCS 0x2c\r
-#define SPI_REG_DINTERXFR 0x2e\r
-\r
-#define SPI_REG_FMT 0x40\r
-#define SPI_REG_TXFIFO 0x48\r
-#define SPI_REG_RXFIFO 0x4c\r
-#define SPI_REG_TXCTRL 0x50\r
-#define SPI_REG_RXCTRL 0x54\r
-\r
-#define SPI_REG_FCTRL 0x60\r
-#define SPI_REG_FFMT 0x64\r
-\r
-#define SPI_REG_IE 0x70\r
-#define SPI_REG_IP 0x74\r
-\r
-/* Fields */\r
-\r
-#define SPI_SCK_PHA 0x1\r
-#define SPI_SCK_POL 0x2\r
-\r
-#define SPI_FMT_PROTO(x) ((x) & 0x3)\r
-#define SPI_FMT_ENDIAN(x) (((x) & 0x1) << 2)\r
-#define SPI_FMT_DIR(x) (((x) & 0x1) << 3)\r
-#define SPI_FMT_LEN(x) (((x) & 0xf) << 16)\r
-\r
-/* TXCTRL register */\r
-#define SPI_TXWM(x) ((x) & 0xffff)\r
-/* RXCTRL register */\r
-#define SPI_RXWM(x) ((x) & 0xffff)\r
-\r
-#define SPI_IP_TXWM 0x1\r
-#define SPI_IP_RXWM 0x2\r
-\r
-#define SPI_FCTRL_EN 0x1\r
-\r
-#define SPI_INSN_CMD_EN 0x1\r
-#define SPI_INSN_ADDR_LEN(x) (((x) & 0x7) << 1)\r
-#define SPI_INSN_PAD_CNT(x) (((x) & 0xf) << 4)\r
-#define SPI_INSN_CMD_PROTO(x) (((x) & 0x3) << 8)\r
-#define SPI_INSN_ADDR_PROTO(x) (((x) & 0x3) << 10)\r
-#define SPI_INSN_DATA_PROTO(x) (((x) & 0x3) << 12)\r
-#define SPI_INSN_CMD_CODE(x) (((x) & 0xff) << 16)\r
-#define SPI_INSN_PAD_CODE(x) (((x) & 0xff) << 24)\r
-\r
-#define SPI_TXFIFO_FULL (1 << 31) \r
-#define SPI_RXFIFO_EMPTY (1 << 31) \r
-\r
-/* Values */\r
-\r
-#define SPI_CSMODE_AUTO 0\r
-#define SPI_CSMODE_HOLD 2\r
-#define SPI_CSMODE_OFF 3\r
-\r
-#define SPI_DIR_RX 0\r
-#define SPI_DIR_TX 1\r
-\r
-#define SPI_PROTO_S 0\r
-#define SPI_PROTO_D 1\r
-#define SPI_PROTO_Q 2\r
-\r
-#define SPI_ENDIAN_MSB 0\r
-#define SPI_ENDIAN_LSB 1\r
-\r
-\r
-#endif /* _SIFIVE_SPI_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-\r
-#ifndef _SIFIVE_UART_H\r
-#define _SIFIVE_UART_H\r
-\r
-/* Register offsets */\r
-#define UART_REG_TXFIFO 0x00\r
-#define UART_REG_RXFIFO 0x04\r
-#define UART_REG_TXCTRL 0x08\r
-#define UART_REG_RXCTRL 0x0c\r
-#define UART_REG_IE 0x10\r
-#define UART_REG_IP 0x14\r
-#define UART_REG_DIV 0x18\r
-\r
-/* TXCTRL register */\r
-#define UART_TXEN 0x1\r
-#define UART_TXWM(x) (((x) & 0xffff) << 16)\r
-\r
-/* RXCTRL register */\r
-#define UART_RXEN 0x1\r
-#define UART_RXWM(x) (((x) & 0xffff) << 16)\r
-\r
-/* IP register */\r
-#define UART_IP_TXWM 0x1\r
-#define UART_IP_RXWM 0x2\r
-\r
-#endif /* _SIFIVE_UART_H */\r
+++ /dev/null
-// See LICENSE for license details.\r
-#ifndef _SECTIONS_H\r
-#define _SECTIONS_H\r
-\r
-extern unsigned char _rom[];\r
-extern unsigned char _rom_end[];\r
-\r
-extern unsigned char _ram[];\r
-extern unsigned char _ram_end[];\r
-\r
-extern unsigned char _ftext[];\r
-extern unsigned char _etext[];\r
-extern unsigned char _fbss[];\r
-extern unsigned char _ebss[];\r
-extern unsigned char _end[];\r
-\r
-#endif /* _SECTIONS_H */\r
+++ /dev/null
-#ifndef SIFIVE_SMP\r
-#define SIFIVE_SMP\r
-\r
-// The maximum number of HARTs this code supports\r
-#ifndef MAX_HARTS\r
-#define MAX_HARTS 32\r
-#endif\r
-#define CLINT_END_HART_IPI CLINT_CTRL_ADDR + (MAX_HARTS*4)\r
-\r
-// The hart that non-SMP tests should run on\r
-#ifndef NONSMP_HART\r
-#define NONSMP_HART 0\r
-#endif\r
-\r
-/* If your test cannot handle multiple-threads, use this: \r
- * smp_disable(reg1)\r
- */\r
-#define smp_disable(reg1, reg2) \\r
- csrr reg1, mhartid ;\\r
- li reg2, NONSMP_HART ;\\r
- beq reg1, reg2, hart0_entry ;\\r
-42: ;\\r
- wfi ;\\r
- j 42b ;\\r
-hart0_entry:\r
-\r
-/* If your test needs to temporarily block multiple-threads, do this:\r
- * smp_pause(reg1, reg2)\r
- * ... single-threaded work ...\r
- * smp_resume(reg1, reg2)\r
- * ... multi-threaded work ...\r
- */\r
-\r
-#define smp_pause(reg1, reg2) \\r
- li reg2, 0x8 ;\\r
- csrw mie, reg2 ;\\r
- csrr reg2, mhartid ;\\r
- bnez reg2, 42f\r
-\r
-#define smp_resume(reg1, reg2) \\r
- li reg1, CLINT_CTRL_ADDR ;\\r
-41: ;\\r
- li reg2, 1 ;\\r
- sw reg2, 0(reg1) ;\\r
- addi reg1, reg1, 4 ;\\r
- li reg2, CLINT_END_HART_IPI ;\\r
- blt reg1, reg2, 41b ;\\r
-42: ;\\r
- wfi ;\\r
- csrr reg2, mip ;\\r
- andi reg2, reg2, 0x8 ;\\r
- beqz reg2, 42b ;\\r
- li reg1, CLINT_CTRL_ADDR ;\\r
- csrr reg2, mhartid ;\\r
- slli reg2, reg2, 2 ;\\r
- add reg2, reg2, reg1 ;\\r
- sw zero, 0(reg2) ;\\r
-41: ;\\r
- lw reg2, 0(reg1) ;\\r
- bnez reg2, 41b ;\\r
- addi reg1, reg1, 4 ;\\r
- li reg2, CLINT_END_HART_IPI ;\\r
- blt reg1, reg2, 41b\r
-\r
-#endif\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <stdint.h>\r
-#include <unistd.h>\r
-#include "platform.h"\r
-\r
-void write_hex(int fd, unsigned long int hex)\r
-{\r
- uint8_t ii;\r
- uint8_t jj;\r
- char towrite;\r
- write(fd , "0x", 2);\r
- for (ii = sizeof(unsigned long int) * 2 ; ii > 0; ii--) {\r
- jj = ii - 1;\r
- uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4));\r
- towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));\r
- write(fd, &towrite, 1);\r
- }\r
-}\r
+++ /dev/null
-/* See LICENSE for license details. */\r
-\r
-/* These functions are intended for embedded RV32 systems and are\r
- obviously incorrect in general. */\r
-\r
-void* __wrap_malloc(unsigned long sz)\r
-{\r
- extern void* sbrk(long);\r
- void* res = sbrk(sz);\r
- if ((long)res == -1)\r
- return 0;\r
- return res;\r
-}\r
-\r
-void __wrap_free(void* ptr)\r
-{\r
-}\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <unistd.h>\r
-#include "platform.h"\r
-#include "weak_under_alias.h"\r
-\r
-void __wrap_exit(int code)\r
-{\r
- const char message[] = "\nProgam has exited with code:";\r
-\r
- write(STDERR_FILENO, message, sizeof(message) - 1);\r
- write_hex(STDERR_FILENO, code);\r
- write(STDERR_FILENO, "\n", 1);\r
-\r
- for (;;);\r
-}\r
-weak_under_alias(exit);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_close(int fd)\r
-{\r
- return _stub(EBADF);\r
-}\r
-weak_under_alias(close);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_execve(const char* name, char* const argv[], char* const env[])\r
-{\r
- return _stub(ENOMEM);\r
-}\r
-weak_under_alias(execve);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-\r
-int fork(void)\r
-{\r
- return _stub(EAGAIN);\r
-}\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include <unistd.h>\r
-#include <sys/stat.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_fstat(int fd, struct stat* st)\r
-{\r
- if (isatty(fd)) {\r
- st->st_mode = S_IFCHR;\r
- return 0;\r
- }\r
-\r
- return _stub(EBADF);\r
-}\r
-weak_under_alias(fstat);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_getpid(void)\r
-{\r
- return 1;\r
-}\r
-weak_under_alias(getpid);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <unistd.h>\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_isatty(int fd)\r
-{\r
- if (fd == STDOUT_FILENO || fd == STDERR_FILENO)\r
- return 1;\r
-\r
- return 0;\r
-}\r
-weak_under_alias(isatty);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_kill(int pid, int sig)\r
-{\r
- return _stub(EINVAL);\r
-}\r
-weak_under_alias(kill);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_link(const char *old_name, const char *new_name)\r
-{\r
- return _stub(EMLINK);\r
-}\r
-weak_under_alias(link);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-off_t __wrap_lseek(int fd, off_t ptr, int dir)\r
-{\r
- if (isatty(fd))\r
- return 0;\r
-\r
- return _stub(EBADF);\r
-}\r
-weak_under_alias(lseek);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_open(const char* name, int flags, int mode)\r
-{\r
- return _stub(ENOENT);\r
-}\r
-weak_under_alias(open);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_openat(int dirfd, const char* name, int flags, int mode)\r
-{\r
- return _stub(ENOENT);\r
-}\r
-weak_under_alias(openat);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <stdint.h>\r
-#include <errno.h>\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-\r
-#include "platform.h"\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_puts(const char *s)\r
-{\r
- while (*s != '\0') {\r
- while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
- UART0_REG(UART_REG_TXFIFO) = *s;\r
-\r
- if (*s == '\n') {\r
- while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
- UART0_REG(UART_REG_TXFIFO) = '\r';\r
- }\r
-\r
- ++s;\r
- }\r
-\r
- return 0;\r
-}\r
-weak_under_alias(puts);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <stdint.h>\r
-#include <errno.h>\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-\r
-#include "platform.h"\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-ssize_t __wrap_read(int fd, void* ptr, size_t len)\r
-{\r
- uint8_t * current = (uint8_t *)ptr;\r
- volatile uint32_t * uart_rx = (uint32_t *)(UART0_CTRL_ADDR + UART_REG_RXFIFO);\r
- volatile uint8_t * uart_rx_cnt = (uint8_t *)(UART0_CTRL_ADDR + UART_REG_RXCTRL + 2);\r
-\r
- ssize_t result = 0;\r
-\r
- if (isatty(fd)) {\r
- for (current = (uint8_t *)ptr;\r
- (current < ((uint8_t *)ptr) + len) && (*uart_rx_cnt > 0);\r
- current ++) {\r
- *current = *uart_rx;\r
- result++;\r
- }\r
- return result;\r
- }\r
-\r
- return _stub(EBADF);\r
-}\r
-weak_under_alias(read);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <stddef.h>\r
-#include "weak_under_alias.h"\r
-\r
-void *__wrap_sbrk(ptrdiff_t incr)\r
-{\r
- extern char _end[];\r
- extern char _heap_end[];\r
- static char *curbrk = _end;\r
-\r
- if ((curbrk + incr < _end) || (curbrk + incr > _heap_end))\r
- return NULL - 1;\r
-\r
- curbrk += incr;\r
- return curbrk - incr;\r
-}\r
-weak_under_alias(sbrk);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include <sys/stat.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_stat(const char* file, struct stat* st)\r
-{\r
- return _stub(EACCES);\r
-}\r
-weak_under_alias(stat);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-#ifndef _SIFIVE_SYS_STUB_H\r
-#define _SIFIVE_SYS_STUB_H\r
-\r
-static inline int _stub(int err)\r
-{\r
- return -1;\r
-}\r
-\r
-#endif /* _SIFIVE_SYS_STUB_H */\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include <sys/times.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-clock_t __wrap_times(struct tms* buf)\r
-{\r
- return _stub(EACCES);\r
-}\r
-weak_under_alias(times);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-int __wrap_unlink(const char* name)\r
-{\r
- return _stub(ENOENT);\r
-}\r
-weak_under_alias(unlink);\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <errno.h>\r
-#include "stub.h"\r
-\r
-int wait(int* status)\r
-{\r
- return _stub(ECHILD);\r
-}\r
+++ /dev/null
-#ifndef _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H\r
-#define _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H\r
-\r
-#define weak_under_alias(name) \\r
- extern __typeof (__wrap_##name) __wrap__##name __attribute__ ((weak, alias ("__wrap_"#name)))\r
-\r
-#endif\r
+++ /dev/null
-/* See LICENSE of license details. */\r
-\r
-#include <stdint.h>\r
-#include <errno.h>\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-\r
-#include "platform.h"\r
-#include "stub.h"\r
-#include "weak_under_alias.h"\r
-\r
-ssize_t __wrap_write(int fd, const void* ptr, size_t len)\r
-{\r
- const uint8_t * current = (const uint8_t *)ptr;\r
-\r
- if (isatty(fd)) {\r
- for (size_t jj = 0; jj < len; jj++) {\r
- while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
- UART0_REG(UART_REG_TXFIFO) = current[jj];\r
-\r
- if (current[jj] == '\n') {\r
- while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;\r
- UART0_REG(UART_REG_TXFIFO) = '\r';\r
- }\r
- }\r
- return len;\r
- }\r
-\r
- return _stub(EBADF);\r
-}\r
-weak_under_alias(write);\r
+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.2.1\r
- * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
- .extern ulRegTest1LoopCounter\r
- .extern ulRegTest2LoopCounter\r
-\r
- .global vRegTest1Implementation\r
- .global vRegTest2Implementation\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * The register check tasks are described in the comments at the top of\r
- * main_full.c.\r
- */\r
-\r
-.align( 8 )\r
-vRegTest1Implementation:\r
-\r
- /* Fill the core registers with known values. */\r
- li x5, 0x5\r
- li x6, 0x6\r
- li x7, 0x7\r
- li x8, 0x8\r
- li x9, 0x9\r
- li x10, 0xa\r
- li x11, 0xb\r
- li x12, 0xc\r
- li x13, 0xd\r
- li x14, 0xe\r
- li x15, 0xf\r
- li x16, 0x10\r
- li x17, 0x11\r
- li x18, 0x12\r
- li x19, 0x13\r
- li x20, 0x14\r
- li x21, 0x15\r
- li x22, 0x16\r
- li x23, 0x17\r
- li x24, 0x18\r
- li x25, 0x19\r
- li x26, 0x1a\r
- li x27, 0x1b\r
- li x28, 0x1c\r
- li x29, 0x1d\r
- li x30, 0x1e\r
-\r
-reg1_loop:\r
-\r
- /* Check each register still contains the expected known value.\r
- vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation\r
- uses x5 as the temporary. */\r
- li x31, 0x5\r
- bne x31, x5, reg1_error_loop\r
- li x31, 0x6\r
- bne x31, x6, reg1_error_loop\r
- li x31, 0x7\r
- bne x31, x7, reg1_error_loop\r
- li x31, 0x8\r
- bne x31, x8, reg1_error_loop\r
- li x31, 0x9\r
- bne x31, x9, reg1_error_loop\r
- li x31, 0xa\r
- bne x31, x10, reg1_error_loop\r
- li x31, 0xb\r
- bne x31, x11, reg1_error_loop\r
- li x31, 0xc\r
- bne x31, x12, reg1_error_loop\r
- li x31, 0xd\r
- bne x31, x13, reg1_error_loop\r
- li x31, 0xe\r
- bne x31, x14, reg1_error_loop\r
- li x31, 0xf\r
- bne x31, x15, reg1_error_loop\r
- li x31, 0x10\r
- bne x31, x16, reg1_error_loop\r
- li x31, 0x11\r
- bne x31, x17, reg1_error_loop\r
- li x31, 0x12\r
- bne x31, x18, reg1_error_loop\r
- li x31, 0x13\r
- bne x31, x19, reg1_error_loop\r
- li x31, 0x14\r
- bne x31, x20, reg1_error_loop\r
- li x31, 0x15\r
- bne x31, x21, reg1_error_loop\r
- li x31, 0x16\r
- bne x31, x22, reg1_error_loop\r
- li x31, 0x17\r
- bne x31, x23, reg1_error_loop\r
- li x31, 0x18\r
- bne x31, x24, reg1_error_loop\r
- li x31, 0x19\r
- bne x31, x25, reg1_error_loop\r
- li x31, 0x1a\r
- bne x31, x26, reg1_error_loop\r
- li x31, 0x1b\r
- bne x31, x27, reg1_error_loop\r
- li x31, 0x1c\r
- bne x31, x28, reg1_error_loop\r
- li x31, 0x1d\r
- bne x31, x29, reg1_error_loop\r
- li x31, 0x1e\r
- bne x31, x30, reg1_error_loop\r
-\r
- /* Everything passed, increment the loop counter. */\r
- lw x31, ulRegTest1LoopCounterConst\r
- lw x30, 0(x31)\r
- addi x30, x30, 1\r
- sw x30, 0(x31)\r
-\r
- /* Restore clobbered register reading for next loop. */\r
- li x30, 0x1e\r
-\r
- /* Yield to increase code coverage. */\r
- ecall\r
-\r
- /* Start again. */\r
- jal reg1_loop\r
-\r
-reg1_error_loop:\r
- /* Jump here if a register contains an uxpected value. This stops the loop\r
- counter being incremented so the check task knows an error was found. */\r
- ebreak\r
- jal reg1_error_loop\r
-\r
-.align( 16 )\r
-ulRegTest1LoopCounterConst: .word ulRegTest1LoopCounter\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-.align( 8 )\r
-vRegTest2Implementation:\r
-\r
- /* Fill the core registers with known values. */\r
- li x6, 0x61\r
- li x7, 0x71\r
- li x8, 0x81\r
- li x9, 0x91\r
- li x10, 0xa1\r
- li x11, 0xb1\r
- li x12, 0xc1\r
- li x13, 0xd1\r
- li x14, 0xe1\r
- li x15, 0xf1\r
- li x16, 0x20\r
- li x17, 0x21\r
- li x18, 0x22\r
- li x19, 0x23\r
- li x20, 0x24\r
- li x21, 0x25\r
- li x22, 0x26\r
- li x23, 0x27\r
- li x24, 0x28\r
- li x25, 0x29\r
- li x26, 0x2a\r
- li x27, 0x2b\r
- li x28, 0x2c\r
- li x29, 0x2d\r
- li x30, 0x2e\r
- li x31, 0x2f\r
-\r
-Reg2_loop:\r
-\r
- /* Check each register still contains the expected known value.\r
- vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation\r
- uses x31 as the temporary. */\r
- li x5, 0x61\r
- bne x5, x6, reg2_error_loop\r
- li x5, 0x71\r
- bne x5, x7, reg2_error_loop\r
- li x5, 0x81\r
- bne x5, x8, reg2_error_loop\r
- li x5, 0x91\r
- bne x5, x9, reg2_error_loop\r
- li x5, 0xa1\r
- bne x5, x10, reg2_error_loop\r
- li x5, 0xb1\r
- bne x5, x11, reg2_error_loop\r
- li x5, 0xc1\r
- bne x5, x12, reg2_error_loop\r
- li x5, 0xd1\r
- bne x5, x13, reg2_error_loop\r
- li x5, 0xe1\r
- bne x5, x14, reg2_error_loop\r
- li x5, 0xf1\r
- bne x5, x15, reg2_error_loop\r
- li x5, 0x20\r
- bne x5, x16, reg2_error_loop\r
- li x5, 0x21\r
- bne x5, x17, reg2_error_loop\r
- li x5, 0x22\r
- bne x5, x18, reg2_error_loop\r
- li x5, 0x23\r
- bne x5, x19, reg2_error_loop\r
- li x5, 0x24\r
- bne x5, x20, reg2_error_loop\r
- li x5, 0x25\r
- bne x5, x21, reg2_error_loop\r
- li x5, 0x26\r
- bne x5, x22, reg2_error_loop\r
- li x5, 0x27\r
- bne x5, x23, reg2_error_loop\r
- li x5, 0x28\r
- bne x5, x24, reg2_error_loop\r
- li x5, 0x29\r
- bne x5, x25, reg2_error_loop\r
- li x5, 0x2a\r
- bne x5, x26, reg2_error_loop\r
- li x5, 0x2b\r
- bne x5, x27, reg2_error_loop\r
- li x5, 0x2c\r
- bne x5, x28, reg2_error_loop\r
- li x5, 0x2d\r
- bne x5, x29, reg2_error_loop\r
- li x5, 0x2e\r
- bne x5, x30, reg2_error_loop\r
- li x5, 0x2f\r
- bne x5, x31, reg2_error_loop\r
-\r
- /* Everything passed, increment the loop counter. */\r
- lw x5, ulRegTest2LoopCounterConst\r
- lw x6, 0(x5)\r
- addi x6, x6, 1\r
- sw x6, 0(x5)\r
-\r
- /* Restore clobbered register reading for next loop. */\r
- li x6, 0x61\r
-\r
- /* Start again. */\r
- jal Reg2_loop\r
-\r
-reg2_error_loop:\r
- /* Jump here if a register contains an uxpected value. This stops the loop\r
- counter being incremented so the check task knows an error was found. */\r
- ebreak\r
- jal reg2_error_loop\r
-\r
-.align( 16 )\r
-ulRegTest2LoopCounterConst: .word ulRegTest2LoopCounter\r
-\r
-\r
+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.2.1\r
- * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
-/******************************************************************************\r
- * NOTE 1: This project provides two demo applications. A simple blinky style\r
- * project, and a more comprehensive test and demo application. The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
- * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
- * in main.c. This file implements the comprehensive test and demo version.\r
- *\r
- * NOTE 2: This file only contains the source code that is specific to the\r
- * full demo. Generic functions, such FreeRTOS hook functions, and functions\r
- * required to configure the hardware, are defined in main.c.\r
- *\r
- ******************************************************************************\r
- *\r
- * main_full() creates all the demo application tasks and software timers, then\r
- * starts the scheduler. The web documentation provides more details of the\r
- * standard demo application tasks, which provide no particular functionality,\r
- * but do provide a good example of how to use the FreeRTOS API.\r
- *\r
- * In addition to the standard demo tasks, the following tasks and tests are\r
- * defined and/or created within this file:\r
- *\r
- * "Reg test" tasks - These fill both the core registers with known values, then\r
- * check that each register maintains its expected value for the lifetime of the\r
- * task. Each task uses a different set of values. The reg test tasks execute\r
- * with a very low priority, so get preempted very frequently. A register\r
- * containing an unexpected value is indicative of an error in the context\r
- * switching mechanism.\r
- *\r
- * "Check" task - The check executes every five seconds. It checks that all\r
- * the standard demo tasks, and the register check tasks, are not only still\r
- * executing, but are executing without reporting any errors. If the check task\r
- * discovers that a task has either stalled, or reported an error, then it\r
- * prints an error message to the UART, otherwise it prints "Pass" followed\r
- * by an additional period (".") after each successful loop of its implementing\r
- * function.\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-/* Kernel includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "timers.h"\r
-#include "semphr.h"\r
-\r
-/* Standard demo application includes. */\r
-#include "dynamic.h"\r
-#include "blocktim.h"\r
-#include "GenQTest.h"\r
-#include "recmutex.h"\r
-#include "TimerDemo.h"\r
-#include "EventGroupsDemo.h"\r
-#include "TaskNotify.h"\r
-\r
-/* SiFive includes. */\r
-#include "platform.h"\r
-#include "encoding.h"\r
-#include "unistd.h"\r
-\r
-/* Priorities for the demo application tasks. */\r
-#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
-\r
-/* The period of the check task, in ms, converted to ticks using the\r
-pdMS_TO_TICKS() macro. */\r
-#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 5000UL )\r
-\r
-/* Parameters that are passed into the register check tasks solely for the\r
-purpose of ensuring parameters are passed into tasks correctl5. */\r
-#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )\r
-#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )\r
-\r
-/* The base period used by the timer test tasks. */\r
-#define mainTIMER_TEST_PERIOD ( 50 )\r
-\r
-/* The size of the stack allocated to the check task (as described in the\r
-comments at the top of this file. */\r
-#define mainCHECK_TASK_STACK_SIZE_WORDS 85\r
-\r
-/* Size of the stacks to allocated for the register check tasks. */\r
-#define mainREG_TEST_STACK_SIZE_WORDS 50\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * Called by main() to run the full demo (as opposed to the blinky demo) when\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
- */\r
-void main_full( void );\r
-\r
-/*\r
- * The check task, as described at the top of this file.\r
- */\r
-static void prvCheckTask( void *pvParameters );\r
-\r
-/*\r
- * Register check tasks as described at the top of this file. The nature of\r
- * these files necessitates that they are written in an assembly file, but the\r
- * entry points are kept in the C file for the convenience of checking the task\r
- * parameter.\r
- */\r
-static void prvRegTestTaskEntry1( void *pvParameters );\r
-extern void vRegTest1Implementation( void );\r
-static void prvRegTestTaskEntry2( void *pvParameters );\r
-extern void vRegTest2Implementation( void );\r
-\r
-/*\r
- * Tick hook used by the full demo, which includes code that interacts with\r
- * some of the tests.\r
- */\r
-void vFullDemoTickHook( void );\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/* The following two variables are used to communicate the status of the\r
-register check tasks to the check task. If the variables keep incrementing,\r
-then the register check tasks have not discovered any errors. If a variable\r
-stops incrementing, then an error has been found. */\r
-volatile uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void main_full( void )\r
-{\r
- /* Create the register check tasks, as described at the top of this file.\r
- Use xTaskCreateStatic() to create a task using only statically allocated\r
- memory. */\r
- xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */\r
- "Reg1", /* The name of the task. */\r
- mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */\r
- mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */\r
- tskIDLE_PRIORITY, /* Priority of the task. */\r
- NULL ); /* Can be used to pass out a handle to the created task. */\r
- xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
-\r
- /* Start all the other standard demo/test tasks. They have no particular\r
- functionality, but do demonstrate how to use the FreeRTOS API and test the\r
- kernel port. */\r
- vStartDynamicPriorityTasks();\r
- vCreateBlockTimeTasks();\r
- vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
- vStartRecursiveMutexTasks();\r
- vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
- vStartEventGroupTasks();\r
- vStartTaskNotifyTask();\r
-\r
- /* Create the task that performs the 'check' functionality, as described at\r
- the top of this file. */\r
- xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
-\r
- /* Start the scheduler. */\r
- vTaskStartScheduler();\r
-\r
- /* If all is well, the scheduler will now be running, and the following\r
- line will never be reached. If the following line does execute, then\r
- there was insufficient FreeRTOS heap memory available for the Idle and/or\r
- timer tasks to be created. See the memory management section on the\r
- FreeRTOS web site for more details on the FreeRTOS heap\r
- http://www.freertos.org/a00111.html. */\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvCheckTask( void *pvParameters )\r
-{\r
-const TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
-TickType_t xLastExecutionTime;\r
-static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
-const char * const pcPassMessage = "Pass";\r
-const char * pcStatusMessage = ".";\r
-extern void vSendString( const char * pcString );\r
-\r
- /* Just to stop compiler warnings. */\r
- ( void ) pvParameters;\r
-\r
- /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
- works correctly. */\r
- xLastExecutionTime = xTaskGetTickCount();\r
-\r
- /* Cycle for ever, delaying then checking all the other tasks are still\r
- operating without error. The onboard LED is toggled on each iteration.\r
- If an error is detected then the delay period is decreased from\r
- mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the\r
- effect of increasing the rate at which the onboard LED toggles, and in so\r
- doing gives visual feedback of the system status. */\r
- for( ;; )\r
- {\r
- /* Delay until it is time to execute again. */\r
- vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
-\r
- /* Check all the demo tasks (other than the flash tasks) to ensure\r
- that they are all still running, and that none have detected an error. */\r
- if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
- {\r
- pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n";\r
- }\r
-\r
- if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
- {\r
- pcStatusMessage = "ERROR: Block time demo/tests.\r\n";\r
- }\r
-\r
- if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
- {\r
- pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n";\r
- }\r
-\r
- if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
- {\r
- pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n";\r
- }\r
-\r
- if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )\r
- {\r
- pcStatusMessage = "ERROR: Timer demo/tests.\r\n";\r
- }\r
-\r
- if( xAreEventGroupTasksStillRunning() != pdPASS )\r
- {\r
- pcStatusMessage = "ERROR: Event group demo/tests.\r\n";\r
- }\r
-\r
- if( xAreTaskNotificationTasksStillRunning() != pdPASS )\r
- {\r
- pcStatusMessage = "ERROR: Task notification demo/tests.\r\n";\r
- }\r
-\r
- /* Check that the register test 1 task is still running. */\r
- if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
- {\r
- pcStatusMessage = "ERROR: Register test 1.\r\n";\r
- }\r
- ulLastRegTest1Value = ulRegTest1LoopCounter;\r
-\r
- /* Check that the register test 2 task is still running. */\r
- if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
- {\r
- pcStatusMessage = "ERROR: Register test 2.\r\n";\r
- }\r
- ulLastRegTest2Value = ulRegTest2LoopCounter;\r
-\r
- /* Write the status message to the UART. */\r
- vSendString( pcStatusMessage );\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvRegTestTaskEntry1( void *pvParameters )\r
-{\r
- /* Although the regtest task is written in assembler, its entry point is\r
- written in C for convenience of checking the task parameter is being passed\r
- in correctly. */\r
- if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )\r
- {\r
- /* Start the part of the test that is written in assembler. */\r
- vRegTest1Implementation();\r
- }\r
-\r
- /* The following line will only execute if the task parameter is found to\r
- be incorrect. The check task will detect that the regtest loop counter is\r
- not being incremented and flag an error. */\r
- vTaskDelete( NULL );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvRegTestTaskEntry2( void *pvParameters )\r
-{\r
- /* Although the regtest task is written in assembler, its entry point is\r
- written in C for convenience of checking the task parameter is being passed\r
- in correctly. */\r
- if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )\r
- {\r
- /* Start the part of the test that is written in assembler. */\r
- vRegTest2Implementation();\r
- }\r
-\r
- /* The following line will only execute if the task parameter is found to\r
- be incorrect. The check task will detect that the regtest loop counter is\r
- not being incremented and flag an error. */\r
- vTaskDelete( NULL );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vFullDemoTickHook( void )\r
-{\r
- /* Called from vApplicationTickHook() when the project is configured to\r
- build the full demo. */\r
- vTimerPeriodicISRTests();\r
- vPeriodicEventGroupsProcessing();\r
- xNotifyTaskFromISR();\r
-}\r
+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.2.1\r
- * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
-/* FreeRTOS kernel includes. */\r
-#include <FreeRTOS.h>\r
-#include <task.h>\r
-\r
-/******************************************************************************\r
- * This project provides two demo applications. A simple blinky style project,\r
- * and a more comprehensive test and demo application. The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to\r
- * select between the two. The simply blinky demo is implemented and described\r
- * in main_blinky.c. The more comprehensive test and demo application is\r
- * implemented and described in main_full.c.\r
- *\r
- * This file implements the code that is not demo specific, including the\r
- * hardware setup and standard FreeRTOS hook functions.\r
- *\r
- * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
- * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
- * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!\r
- *\r
- *\r
- * NOTE 1:\r
- *\r
- * This project has only been tested in the QEMU emulation of the HiFive board\r
- * from SiFive.\r
- *\r
- * Start QEMU using the following command line:\r
- *\r
- * [your_path_1]\qemu-system-riscv32 -kernel [your_path_2]\FreeRTOS\Demo\RISC-V-Qemu-sifive_e-FreedomStudio\Debug\RTOSDemo.elf -S -s -machine sifive_e\r
- *\r
- * Where [your_path_1] must be replaced with the correct path to your QEMU\r
- * installation and the elf file generated by this project respectively.\r
- *\r
- *\r
- * NOTE 2:\r
- *\r
- * Start GDB using the following command line (this can be entered in the\r
- * Eclipse Debug Launch Configuration dialogue):\r
- *\r
- * riscv64-unknown-elf-gdb.exe -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off"\r
- *\r
- *\r
- * Note 3:\r
- *\r
- * Status information is sent to the QEMU serial console.\r
- */\r
-\r
-/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
-or 0 to run the more comprehensive test and demo application. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
-\r
-/*\r
- * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
- * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
- */\r
-#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
- extern void main_blinky( void );\r
-#else\r
- extern void main_full( void );\r
-#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
-\r
-/*\r
- * Prototypes for the standard FreeRTOS callback/hook functions implemented\r
- * within this file. See https://www.freertos.org/a00016.html\r
- */\r
-void vApplicationMallocFailedHook( void );\r
-void vApplicationIdleHook( void );\r
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
-void vApplicationTickHook( void );\r
-\r
-/*\r
- * Very simply polling write to the UART. The full demo only writes single\r
- * characters at a time so as not to disrupt the timing of the test and demo\r
- * tasks.\r
- */\r
-void vSendString( const char * pcString );\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-int main( void )\r
-{\r
- vSendString( "Starting" );\r
-\r
- /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top\r
- of this file. */\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
- {\r
- main_blinky();\r
- }\r
- #else\r
- {\r
- main_full();\r
- }\r
- #endif\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationMallocFailedHook( void )\r
-{\r
- /* vApplicationMallocFailedHook() will only be called if\r
- configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook\r
- function that will get called if a call to pvPortMalloc() fails.\r
- pvPortMalloc() is called internally by the kernel whenever a task, queue,\r
- timer or semaphore is created. It is also called by various parts of the\r
- demo application. If heap_1.c or heap_2.c are used, then the size of the\r
- heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in\r
- FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
- to query the size of free heap space that remains (although it does not\r
- provide information on how the remaining heap might be fragmented). */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationIdleHook( void )\r
-{\r
- /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set\r
- to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle\r
- task. It is essential that code added to this hook function never attempts\r
- to block in any way (for example, call xQueueReceive() with a block time\r
- specified, or call vTaskDelay()). If the application makes use of the\r
- vTaskDelete() API function (as this demo application does) then it is also\r
- important that vApplicationIdleHook() is permitted to return to its calling\r
- function, because it is the responsibility of the idle task to clean up\r
- memory allocated by the kernel to any task that has since been deleted. */\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
-{\r
- ( void ) pcTaskName;\r
- ( void ) pxTask;\r
-\r
- /* Run time stack overflow checking is performed if\r
- configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
- function is called if a stack overflow is detected. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationTickHook( void )\r
-{\r
- /* The tests in the full demo expect some interaction with interrupts. */\r
- #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )\r
- {\r
- extern void vFullDemoTickHook( void );\r
- vFullDemoTickHook();\r
- }\r
- #endif\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vAssertCalled( void )\r
-{\r
-volatile uint32_t ulSetTo1ToExitFunction = 0;\r
-\r
- taskDISABLE_INTERRUPTS();\r
- while( ulSetTo1ToExitFunction != 1 )\r
- {\r
- __asm volatile( "NOP" );\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vSendString( const char * pcString )\r
-{\r
- while( *pcString != 0x00 )\r
- {\r
- while( UART0_REG( UART_REG_TXFIFO ) & 0x80000000 );\r
- UART0_REG( UART_REG_TXFIFO ) = *pcString;\r
- *pcString++;\r
- }\r
-}\r
-\r