Update RISCC-V-RV32-SiFive_HiFive1_FreedomStudio project to latest tools and metal library versions.
parent
cfa83672ef
commit
4b943b35e0
@ -1,88 +1,174 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" 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.206163480" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1023181676" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1119183919" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="cdt.managedbuild.builder.gnu.cross.1388532167" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.compiler.1469975065" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.440219377" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.1721555429" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.dialect.std.1648189865" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.1720192082" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/full_demo/Common_Demo_Tasks/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-metal}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/install/include}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.misc.other.257964774" 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" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.warnings.extrawarn.1802410957" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1079251302" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.420742449" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.1056760450" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.52506316" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.linker.558060359" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<option id="gnu.c.link.option.ldflags.46965227" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-Xlinker --gc-sections -Wl,-Map,RTOSDemo.map -T../bsp/metal.default.lds -march=rv32imac -mabi=ilp32 -mcmodel=medlow -Wl,--start-group -lc -lgcc -Wl,--end-group --specs=nano.specs" valueType="string"/>
|
||||
<option id="gnu.c.link.option.nostart.1038463237" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.link.option.nostdlibs.934043026" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.link.option.nodeflibs.1095611620" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.549526426" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.2105463183" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.424513814" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.assembler.825438707" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<option id="gnu.both.asm.option.flags.1946908814" 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"/>
|
||||
<option id="gnu.both.asm.option.include.paths.1448234506" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1723023894" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="RTOSDemo.cdt.managedbuild.target.gnu.cross.exe.1669036252" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.206163480;cdt.managedbuild.config.gnu.cross.exe.debug.206163480.;cdt.managedbuild.tool.gnu.cross.c.compiler.1469975065;cdt.managedbuild.tool.gnu.c.compiler.input.1079251302">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480">
|
||||
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
|
||||
<externalSettings/>
|
||||
|
||||
<extensions>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
|
||||
</extensions>
|
||||
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
||||
<configuration artifactName="${ProjName}" 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.206163480" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
|
||||
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480." name="/" resourcePath="">
|
||||
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1023181676" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1119183919" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
|
||||
<builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="cdt.managedbuild.builder.gnu.cross.1388532167" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.compiler.1469975065" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.440219377" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||
|
||||
<option id="gnu.c.compiler.option.debugging.level.1721555429" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
|
||||
<option id="gnu.c.compiler.option.dialect.std.1648189865" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
||||
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1720192082" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/include}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/full_demo/Common_Demo_Tasks/include}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/include}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freedom-metal}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/install/include}""/>
|
||||
|
||||
</option>
|
||||
|
||||
<option id="gnu.c.compiler.option.misc.other.257964774" 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 -Wno-unused-parameter" valueType="string"/>
|
||||
|
||||
<option id="gnu.c.compiler.option.warnings.extrawarn.1802410957" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1079251302" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
|
||||
</tool>
|
||||
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.420742449" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.1056760450" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.52506316" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
|
||||
</tool>
|
||||
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.c.linker.558060359" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
|
||||
<option id="gnu.c.link.option.ldflags.46965227" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-Xlinker --gc-sections -Wl,-Map,RTOSDemo.map -T../bsp/metal.default.lds -march=rv32imac -mabi=ilp32 -mcmodel=medlow -Wl,--start-group -lc -lgcc -Wl,--end-group --specs=nano.specs" valueType="string"/>
|
||||
|
||||
<option id="gnu.c.link.option.nostart.1038463237" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<option id="gnu.c.link.option.nostdlibs.934043026" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
|
||||
<option id="gnu.c.link.option.nodeflibs.1095611620" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.549526426" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
|
||||
</inputType>
|
||||
|
||||
</tool>
|
||||
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.2105463183" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.424513814" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
|
||||
<tool command="riscv64-unknown-elf-gcc.exe" id="cdt.managedbuild.tool.gnu.cross.assembler.825438707" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
|
||||
<option id="gnu.both.asm.option.flags.1946908814" 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"/>
|
||||
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1448234506" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions}""/>
|
||||
|
||||
</option>
|
||||
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1723023894" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
|
||||
</tool>
|
||||
|
||||
</toolChain>
|
||||
|
||||
</folderInfo>
|
||||
|
||||
<sourceEntries>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
|
||||
</sourceEntries>
|
||||
|
||||
</configuration>
|
||||
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
|
||||
</cconfiguration>
|
||||
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
||||
<project id="RTOSDemo.cdt.managedbuild.target.gnu.cross.exe.1669036252" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.206163480;cdt.managedbuild.config.gnu.cross.exe.debug.206163480.;cdt.managedbuild.tool.gnu.cross.c.compiler.1469975065;cdt.managedbuild.tool.gnu.c.compiler.input.1079251302">
|
||||
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
|
||||
</scannerConfigBuildInfo>
|
||||
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
|
||||
<configuration configurationName="Debug">
|
||||
|
||||
<resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>
|
||||
|
||||
</configuration>
|
||||
|
||||
</storageModule>
|
||||
|
||||
</cproject>
|
||||
|
@ -1,14 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480" name="Debug">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="166385301954473" 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">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
|
||||
<configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.206163480" name="Debug">
|
||||
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-316647897902857" 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">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
|
||||
</provider>
|
||||
|
||||
</extension>
|
||||
|
||||
</configuration>
|
||||
|
||||
</project>
|
||||
|
@ -0,0 +1,23 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__DRIVERS__SIFIVE_CCACHE0_H
|
||||
#define METAL__DRIVERS__SIFIVE_CCACHE0_H
|
||||
|
||||
#include <metal/cache.h>
|
||||
#include <metal/compiler.h>
|
||||
|
||||
struct __metal_driver_vtable_sifive_ccache0 {
|
||||
struct __metal_cache_vtable cache;
|
||||
};
|
||||
|
||||
struct __metal_driver_sifive_ccache0;
|
||||
|
||||
__METAL_DECLARE_VTABLE(__metal_driver_vtable_sifive_ccache0)
|
||||
|
||||
struct __metal_driver_sifive_ccache0 {
|
||||
struct metal_cache cache;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__DRIVERS__SIFIVE_FE310_G000_LFROSC_H
|
||||
#define METAL__DRIVERS__SIFIVE_FE310_G000_LFROSC_H
|
||||
|
||||
#include <metal/compiler.h>
|
||||
#include <metal/clock.h>
|
||||
#include <metal/io.h>
|
||||
|
||||
struct __metal_driver_vtable_sifive_fe310_g000_lfrosc {
|
||||
struct __metal_clock_vtable clock;
|
||||
};
|
||||
|
||||
__METAL_DECLARE_VTABLE(__metal_driver_vtable_sifive_fe310_g000_lfrosc)
|
||||
|
||||
struct __metal_driver_sifive_fe310_g000_lfrosc {
|
||||
struct metal_clock clock;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__DRIVERS__SIFIVE_RTC0_H
|
||||
#define METAL__DRIVERS__SIFIVE_RTC0_H
|
||||
|
||||
#include <metal/io.h>
|
||||
#include <metal/compiler.h>
|
||||
|
||||
#include <metal/clock.h>
|
||||
#include <metal/interrupt.h>
|
||||
#include <metal/rtc.h>
|
||||
|
||||
struct __metal_driver_vtable_sifive_rtc0 {
|
||||
const struct metal_rtc_vtable rtc;
|
||||
};
|
||||
|
||||
struct __metal_driver_sifive_rtc0;
|
||||
|
||||
__METAL_DECLARE_VTABLE(__metal_driver_vtable_sifive_rtc0)
|
||||
|
||||
struct __metal_driver_sifive_rtc0 {
|
||||
const struct metal_rtc rtc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,23 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__DRIVERS__SIFIVE_TRACE_H
|
||||
#define METAL__DRIVERS__SIFIVE_TRACE_H
|
||||
|
||||
#include <metal/compiler.h>
|
||||
#include <metal/io.h>
|
||||
#include <metal/uart.h>
|
||||
|
||||
struct __metal_driver_vtable_sifive_trace {
|
||||
const struct metal_uart_vtable uart;
|
||||
};
|
||||
|
||||
struct __metal_driver_sifive_trace;
|
||||
|
||||
__METAL_DECLARE_VTABLE(__metal_driver_vtable_sifive_trace)
|
||||
|
||||
struct __metal_driver_sifive_trace {
|
||||
struct metal_uart uart;
|
||||
};
|
||||
|
||||
#endif /* METAL__DRIVERS__SIFIVE_TRACE_H */
|
@ -0,0 +1,26 @@
|
||||
/* Copyright 2018 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__DRIVERS__SIFIVE_WDOG0_H
|
||||
#define METAL__DRIVERS__SIFIVE_WDOG0_H
|
||||
|
||||
#include <metal/io.h>
|
||||
#include <metal/compiler.h>
|
||||
|
||||
#include <metal/watchdog.h>
|
||||
#include <metal/clock.h>
|
||||
#include <metal/interrupt.h>
|
||||
|
||||
struct __metal_driver_vtable_sifive_wdog0 {
|
||||
const struct metal_watchdog_vtable watchdog;
|
||||
};
|
||||
|
||||
struct __metal_driver_sifive_wdog0;
|
||||
|
||||
__METAL_DECLARE_VTABLE(__metal_driver_vtable_sifive_wdog0)
|
||||
|
||||
struct __metal_driver_sifive_wdog0 {
|
||||
const struct metal_watchdog watchdog;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,127 @@
|
||||
/* Copyright 2019 SiFive, Inc. */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__RTC_H
|
||||
#define METAL__RTC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*!
|
||||
* @file rtc.h
|
||||
* @brief API for Real-Time Clocks
|
||||
*/
|
||||
|
||||
struct metal_rtc;
|
||||
|
||||
/*!
|
||||
* @brief List of RTC run behaviors
|
||||
*/
|
||||
enum metal_rtc_run_option {
|
||||
METAL_RTC_STOP = 0,
|
||||
METAL_RTC_RUN,
|
||||
};
|
||||
|
||||
struct metal_rtc_vtable {
|
||||
uint64_t (*get_rate)(const struct metal_rtc *const rtc);
|
||||
uint64_t (*set_rate)(const struct metal_rtc *const rtc, const uint64_t rate);
|
||||
uint64_t (*get_compare)(const struct metal_rtc *const rtc);
|
||||
uint64_t (*set_compare)(const struct metal_rtc *const rtc, const uint64_t compare);
|
||||
uint64_t (*get_count)(const struct metal_rtc *const rtc);
|
||||
uint64_t (*set_count)(const struct metal_rtc *const rtc, const uint64_t count);
|
||||
int (*run)(const struct metal_rtc *const rtc, const enum metal_rtc_run_option option);
|
||||
struct metal_interrupt *(*get_interrupt)(const struct metal_rtc *const rtc);
|
||||
int (*get_interrupt_id)(const struct metal_rtc *const rtc);
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Handle for a Real-Time Clock
|
||||
*/
|
||||
struct metal_rtc {
|
||||
const struct metal_rtc_vtable *vtable;
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Get the rate of the RTC
|
||||
* @return The rate in Hz
|
||||
*/
|
||||
inline uint64_t metal_rtc_get_rate(const struct metal_rtc *const rtc) {
|
||||
return rtc->vtable->get_rate(rtc);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set (if possible) the rate of the RTC
|
||||
* @return The new rate of the RTC (not guaranteed to be the same as requested)
|
||||
*/
|
||||
inline uint64_t metal_rtc_set_rate(const struct metal_rtc *const rtc, const uint64_t rate) {
|
||||
return rtc->vtable->set_rate(rtc, rate);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the compare value of the RTC
|
||||
* @return The compare value
|
||||
*/
|
||||
inline uint64_t metal_rtc_get_compare(const struct metal_rtc *const rtc) {
|
||||
return rtc->vtable->get_compare(rtc);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the compare value of the RTC
|
||||
* @return The set compare value (not guaranteed to be exactly the requested value)
|
||||
*
|
||||
* The RTC device might impose limits on the maximum compare value or the granularity
|
||||
* of the compare value.
|
||||
*/
|
||||
inline uint64_t metal_rtc_set_compare(const struct metal_rtc *const rtc, const uint64_t compare) {
|
||||
return rtc->vtable->set_compare(rtc, compare);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the current count of the RTC
|
||||
* @return The count
|
||||
*/
|
||||
inline uint64_t metal_rtc_get_count(const struct metal_rtc *const rtc) {
|
||||
return rtc->vtable->get_count(rtc);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the current count of the RTC
|
||||
* @return The set value of the count (not guaranteed to be exactly the requested value)
|
||||
*
|
||||
* The RTC device might impose limits on the maximum value of the count
|
||||
*/
|
||||
inline uint64_t metal_rtc_set_count(const struct metal_rtc *const rtc, const uint64_t count) {
|
||||
return rtc->vtable->set_count(rtc, count);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Start or stop the RTC
|
||||
* @return 0 if the RTC was successfully started/stopped
|
||||
*/
|
||||
inline int metal_rtc_run(const struct metal_rtc *const rtc, const enum metal_rtc_run_option option) {
|
||||
return rtc->vtable->run(rtc, option);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the interrupt handle for the RTC compare
|
||||
* @return The interrupt handle
|
||||
*/
|
||||
inline struct metal_interrupt *metal_rtc_get_interrupt(const struct metal_rtc *const rtc) {
|
||||
return rtc->vtable->get_interrupt(rtc);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the interrupt ID for the RTC compare
|
||||
* @return The interrupt ID
|
||||
*/
|
||||
inline int metal_rtc_get_interrupt_id(const struct metal_rtc *const rtc) {
|
||||
return rtc->vtable->get_interrupt_id(rtc);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the handle for an RTC by index
|
||||
* @return The RTC handle, or NULL if none is available at that index
|
||||
*/
|
||||
struct metal_rtc *metal_rtc_get_device(int index);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,18 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__TIME_H
|
||||
#define METAL__TIME_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/*!
|
||||
* @file time.h
|
||||
* @brief API for dealing with time
|
||||
*/
|
||||
|
||||
int metal_gettimeofday(struct timeval *tp, void *tzp);
|
||||
|
||||
time_t metal_time(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,163 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifndef METAL__WATCHDOG_H
|
||||
#define METAL__WATCHDOG_H
|
||||
|
||||
/*!
|
||||
* @file watchdog.h
|
||||
*
|
||||
* @brief API for configuring watchdog timers
|
||||
*/
|
||||
|
||||
#include <metal/interrupt.h>
|
||||
|
||||
struct metal_watchdog;
|
||||
|
||||
/*!
|
||||
* @brief List of watchdog timer count behaviors
|
||||
*/
|
||||
enum metal_watchdog_run_option {
|
||||
METAL_WATCHDOG_STOP = 0, /*!< Stop the watchdog */
|
||||
METAL_WATCHDOG_RUN_ALWAYS, /*!< Run the watchdog continuously, even during sleep */
|
||||
METAL_WATCHDOG_RUN_AWAKE, /*!< Run the watchdog only while the CPU is awake */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief List of behaviors when a watchdog triggers
|
||||
*/
|
||||
enum metal_watchdog_result {
|
||||
METAL_WATCHDOG_NO_RESULT = 0, /*!< When the watchdog triggers, do nothing */
|
||||
METAL_WATCHDOG_INTERRUPT, /*!< When the watchdog triggers, fire an interrupt */
|
||||
METAL_WATCHDOG_FULL_RESET, /*!< When the watchdog triggers, cause a full system reset */
|
||||
};
|
||||
|
||||
|
||||
struct metal_watchdog_vtable {
|
||||
int (*feed)(const struct metal_watchdog *const wdog);
|
||||
long int (*get_rate)(const struct metal_watchdog *const wdog);
|
||||
long int (*set_rate)(const struct metal_watchdog *const wdog, const long int rate);
|
||||
long int (*get_timeout)(const struct metal_watchdog *const wdog);
|
||||
long int (*set_timeout)(const struct metal_watchdog *const wdog, const long int timeout);
|
||||
int (*set_result)(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_result result);
|
||||
int (*run)(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_run_option option);
|
||||
struct metal_interrupt *(*get_interrupt)(const struct metal_watchdog *const wdog);
|
||||
int (*get_interrupt_id)(const struct metal_watchdog *const wdog);
|
||||
int (*clear_interrupt)(const struct metal_watchdog *const wdog);
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Handle for a Watchdog Timer
|
||||
*/
|
||||
struct metal_watchdog {
|
||||
const struct metal_watchdog_vtable *vtable;
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Feed the watchdog timer
|
||||
*/
|
||||
inline int metal_watchdog_feed(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->feed(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the rate of the watchdog timer in Hz
|
||||
*
|
||||
* @return the rate of the watchdog timer
|
||||
*/
|
||||
inline long int metal_watchdog_get_rate(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->get_rate(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the rate of the watchdog timer in Hz
|
||||
*
|
||||
* There is no guarantee that the new rate will match the requested rate.
|
||||
*
|
||||
* @return the new rate of the watchdog timer
|
||||
*/
|
||||
inline long int metal_watchdog_set_rate(const struct metal_watchdog *const wdog, const long int rate)
|
||||
{
|
||||
return wdog->vtable->set_rate(wdog, rate);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the timeout of the watchdog timer
|
||||
*
|
||||
* @return the watchdog timeout value
|
||||
*/
|
||||
inline long int metal_watchdog_get_timeout(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->get_timeout(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the timeout of the watchdog timer
|
||||
*
|
||||
* The set rate will be the minimimum of the requested and maximum supported rates.
|
||||
*
|
||||
* @return the new watchdog timeout value
|
||||
*/
|
||||
inline long int metal_watchdog_set_timeout(const struct metal_watchdog *const wdog, const long int timeout)
|
||||
{
|
||||
return wdog->vtable->set_timeout(wdog, timeout);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Sets the result behavior of a watchdog timer timeout
|
||||
*
|
||||
* @return 0 if the requested result behavior is supported
|
||||
*/
|
||||
inline int metal_watchdog_set_result(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_result result)
|
||||
{
|
||||
return wdog->vtable->set_result(wdog, result);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the run behavior of the watchdog
|
||||
*
|
||||
* Used to enable/disable the watchdog timer
|
||||
*
|
||||
* @return 0 if the watchdog was successfully started/stopped
|
||||
*/
|
||||
inline int metal_watchdog_run(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_run_option option)
|
||||
{
|
||||
return wdog->vtable->run(wdog, option);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the interrupt controller for the watchdog interrupt
|
||||
*/
|
||||
inline struct metal_interrupt *metal_watchdog_get_interrupt(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->get_interrupt(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @Brief Get the interrupt id for the watchdog interrupt
|
||||
*/
|
||||
inline int metal_watchdog_get_interrupt_id(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->get_interrupt_id(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Clear the watchdog interrupt
|
||||
*/
|
||||
inline int metal_watchdog_clear_interrupt(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return wdog->vtable->clear_interrupt(wdog);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get a watchdog handle
|
||||
*/
|
||||
struct metal_watchdog *metal_watchdog_get_device(const int index);
|
||||
|
||||
#endif /* METAL__WATCHDOG_H */
|
@ -0,0 +1,84 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine/platform.h>
|
||||
|
||||
#ifdef METAL_SIFIVE_CCACHE0
|
||||
|
||||
#include <stdint.h>
|
||||
#include <metal/io.h>
|
||||
#include <metal/drivers/sifive_ccache0.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
#define L2_CONFIG_WAYS_SHIFT 8
|
||||
#define L2_CONFIG_WAYS_MASK (0xFF << L2_CONFIG_WAYS_SHIFT)
|
||||
|
||||
void __metal_driver_sifive_ccache0_init(struct metal_cache *l2, int ways);
|
||||
|
||||
static void metal_driver_sifive_ccache0_init(void) __attribute__((constructor));
|
||||
static void metal_driver_sifive_ccache0_init(void)
|
||||
{
|
||||
#ifdef __METAL_DT_SIFIVE_CCACHE0_HANDLE
|
||||
/* Get the handle for the L2 cache controller */
|
||||
struct metal_cache *l2 = __METAL_DT_SIFIVE_CCACHE0_HANDLE;
|
||||
if(!l2) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the number of available ways per bank */
|
||||
unsigned long control_base = __metal_driver_sifive_ccache0_control_base(l2);
|
||||
uint32_t ways = __METAL_ACCESS_ONCE((__metal_io_u32 *)(control_base + METAL_SIFIVE_CCACHE0_CONFIG));
|
||||
ways = ((ways & L2_CONFIG_WAYS_MASK) >> L2_CONFIG_WAYS_SHIFT);
|
||||
|
||||
/* Enable all the ways */
|
||||
__metal_driver_sifive_ccache0_init(l2, ways);
|
||||
#endif
|
||||
}
|
||||
|
||||
void __metal_driver_sifive_ccache0_init(struct metal_cache *l2, int ways)
|
||||
{
|
||||
metal_cache_set_enabled_ways(l2, ways);
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_ccache0_get_enabled_ways(struct metal_cache *cache)
|
||||
{
|
||||
unsigned long control_base = __metal_driver_sifive_ccache0_control_base(cache);
|
||||
|
||||
uint32_t way_enable = __METAL_ACCESS_ONCE((__metal_io_u32 *)(control_base + METAL_SIFIVE_CCACHE0_WAYENABLE));
|
||||
|
||||
/* The stored number is the index, so add one */
|
||||
return (0xFF & way_enable) + 1;
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_ccache0_set_enabled_ways(struct metal_cache *cache, int ways)
|
||||
{
|
||||
unsigned long control_base = __metal_driver_sifive_ccache0_control_base(cache);
|
||||
|
||||
/* We can't decrease the number of enabled ways */
|
||||
if(metal_cache_get_enabled_ways(cache) > ways) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* The stored value is the index, so subtract one */
|
||||
uint32_t value = 0xFF & (ways - 1);
|
||||
|
||||
/* Set the number of enabled ways */
|
||||
__METAL_ACCESS_ONCE((__metal_io_u32 *)(control_base + METAL_SIFIVE_CCACHE0_WAYENABLE)) = value;
|
||||
|
||||
/* Make sure the number of ways was set correctly */
|
||||
if(metal_cache_get_enabled_ways(cache) != ways) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_ccache0) = {
|
||||
.cache.init = __metal_driver_sifive_ccache0_init,
|
||||
.cache.get_enabled_ways = __metal_driver_sifive_ccache0_get_enabled_ways,
|
||||
.cache.set_enabled_ways = __metal_driver_sifive_ccache0_set_enabled_ways,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
typedef int no_empty_translation_units;
|
@ -0,0 +1,53 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine/platform.h>
|
||||
|
||||
#ifdef METAL_SIFIVE_FE310_G000_LFROSC
|
||||
|
||||
#include <metal/drivers/sifive_fe310-g000_lfrosc.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
/* LFROSCCFG */
|
||||
#define METAL_LFROSCCFG_DIV_MASK 0x3F
|
||||
#define METAL_LFROSCCFG_TRIM_SHIFT 16
|
||||
#define METAL_LFROSCCFG_TRIM_MASK (0x1F << METAL_LFROSCCFG_TRIM_SHIFT)
|
||||
#define METAL_LFROSCCFG_EN (1 << 30)
|
||||
#define METAL_LFROSCCFG_RDY (1 << 31)
|
||||
|
||||
/* LFCLKMUX */
|
||||
#define METAL_LFCLKMUX_SEL 1
|
||||
#define METAL_LFCLKMUX_EXT_MUX_STATUS (1 << 31)
|
||||
|
||||
#define LFROSC_REGW(addr) (__METAL_ACCESS_ONCE((__metal_io_u32 *)addr))
|
||||
|
||||
long __metal_driver_sifive_fe310_g000_lfrosc_get_rate_hz(const struct metal_clock *clock)
|
||||
{
|
||||
struct metal_clock *internal_ref = __metal_driver_sifive_fe310_g000_lfrosc_lfrosc(clock);
|
||||
struct metal_clock *external_ref = __metal_driver_sifive_fe310_g000_lfrosc_psdlfaltclk(clock);
|
||||
|
||||
unsigned long int cfg_reg = __metal_driver_sifive_fe310_g000_lfrosc_config_reg(clock);
|
||||
unsigned long int mux_reg = __metal_driver_sifive_fe310_g000_lfrosc_mux_reg(clock);
|
||||
|
||||
if(LFROSC_REGW(mux_reg) & METAL_LFCLKMUX_EXT_MUX_STATUS) {
|
||||
return metal_clock_get_rate_hz(external_ref);
|
||||
}
|
||||
|
||||
const unsigned long int div = (LFROSC_REGW(cfg_reg) & METAL_LFROSCCFG_DIV_MASK) + 1;
|
||||
|
||||
return metal_clock_get_rate_hz(internal_ref) / div;
|
||||
}
|
||||
|
||||
long __metal_driver_sifive_fe310_g000_lfrosc_set_rate_hz(struct metal_clock *clock, long rate)
|
||||
{
|
||||
return __metal_driver_sifive_fe310_g000_lfrosc_get_rate_hz(clock);
|
||||
}
|
||||
|
||||
__METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_fe310_g000_lfrosc) = {
|
||||
.clock.get_rate_hz = &__metal_driver_sifive_fe310_g000_lfrosc_get_rate_hz,
|
||||
.clock.set_rate_hz = &__metal_driver_sifive_fe310_g000_lfrosc_set_rate_hz,
|
||||
};
|
||||
#endif /* METAL_SIFIVE_FE310_G000_LFROSC */
|
||||
|
||||
typedef int no_empty_translation_units;
|
||||
|
@ -0,0 +1,121 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine/platform.h>
|
||||
|
||||
#ifdef METAL_SIFIVE_RTC0
|
||||
|
||||
#include <metal/drivers/sifive_rtc0.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* RTCCFG */
|
||||
#define METAL_RTCCFG_RTCSCALE_MASK 0xF
|
||||
#define METAL_RTCCFG_ENALWAYS (1 << 12)
|
||||
#define METAL_RTCCFG_IP0 (1 << 28)
|
||||
|
||||
/* RTCCMP0 */
|
||||
#define METAL_RTCCMP0_MAX UINT32_MAX
|
||||
|
||||
#define RTC_REG(base, offset) (((unsigned long)base + offset))
|
||||
#define RTC_REGW(base, offset) (__METAL_ACCESS_ONCE((__metal_io_u32 *)RTC_REG(base, offset)))
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_get_rate(const struct metal_rtc *const rtc) {
|
||||
const struct metal_clock *const clock = __metal_driver_sifive_rtc0_clock(rtc);
|
||||
return metal_clock_get_rate_hz(clock);
|
||||
}
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_set_rate(const struct metal_rtc *const rtc, const uint64_t rate) {
|
||||
const struct metal_clock *const clock = __metal_driver_sifive_rtc0_clock(rtc);
|
||||
return metal_clock_get_rate_hz(clock);
|
||||
}
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_get_compare(const struct metal_rtc *const rtc) {
|
||||
const uint64_t base = __metal_driver_sifive_rtc0_control_base(rtc);
|
||||
|
||||
const uint32_t shift = RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCFG) & METAL_RTCCFG_RTCSCALE_MASK;
|
||||
|
||||
return ((uint64_t)RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCMP0) << shift);
|
||||
}
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_set_compare(const struct metal_rtc *const rtc, const uint64_t compare) {
|
||||
const uint64_t base = __metal_driver_sifive_rtc0_control_base(rtc);
|
||||
|
||||
/* Determine the bit shift and shifted value to store in rtccmp0/rtccfg.scale */
|
||||
uint32_t shift = 0;
|
||||
uint64_t comp_shifted = compare;
|
||||
while (comp_shifted > METAL_RTCCMP0_MAX) {
|
||||
shift += 1;
|
||||
comp_shifted = comp_shifted >> shift;
|
||||
}
|
||||
|
||||
/* Set the value of rtccfg.scale */
|
||||
uint32_t cfg = RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCFG);
|
||||
cfg &= ~(METAL_RTCCFG_RTCSCALE_MASK);
|
||||
cfg |= (METAL_RTCCFG_RTCSCALE_MASK & shift);
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCFG) = cfg;
|
||||
|
||||
/* Set the value of rtccmp0 */
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCMP0) = (uint32_t) comp_shifted;
|
||||
|
||||
return __metal_driver_sifive_rtc0_get_compare(rtc);
|
||||
}
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_get_count(const struct metal_rtc *const rtc) {
|
||||
const uint64_t base = __metal_driver_sifive_rtc0_control_base(rtc);
|
||||
|
||||
uint64_t count = RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCOUNTHI);
|
||||
count <<= 32;
|
||||
count |= RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCOUNTLO);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
uint64_t __metal_driver_sifive_rtc0_set_count(const struct metal_rtc *const rtc, const uint64_t count) {
|
||||
const uint64_t base = __metal_driver_sifive_rtc0_control_base(rtc);
|
||||
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCOUNTHI) = (UINT_MAX & (count >> 32));
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCOUNTLO) = (UINT_MAX & count);
|
||||
|
||||
return __metal_driver_sifive_rtc0_get_count(rtc);
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_rtc0_run(const struct metal_rtc *const rtc, const enum metal_rtc_run_option option) {
|
||||
const uint64_t base = __metal_driver_sifive_rtc0_control_base(rtc);
|
||||
|
||||
switch (option) {
|
||||
default:
|
||||
case METAL_RTC_STOP:
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCFG) &= ~(METAL_RTCCFG_ENALWAYS);
|
||||
break;
|
||||
case METAL_RTC_RUN:
|
||||
RTC_REGW(base, METAL_SIFIVE_RTC0_RTCCFG) |= METAL_RTCCFG_ENALWAYS;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct metal_interrupt *__metal_driver_sifive_rtc0_get_interrupt(const struct metal_rtc *const rtc) {
|
||||
return __metal_driver_sifive_rtc0_interrupt_parent(rtc);
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_rtc0_get_interrupt_id(const struct metal_rtc *const rtc) {
|
||||
return __metal_driver_sifive_rtc0_interrupt_line(rtc);
|
||||
}
|
||||
|
||||
__METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_rtc0) = {
|
||||
.rtc.get_rate = __metal_driver_sifive_rtc0_get_rate,
|
||||
.rtc.set_rate = __metal_driver_sifive_rtc0_set_rate,
|
||||
.rtc.get_compare = __metal_driver_sifive_rtc0_get_compare,
|
||||
.rtc.set_compare = __metal_driver_sifive_rtc0_set_compare,
|
||||
.rtc.get_count = __metal_driver_sifive_rtc0_get_count,
|
||||
.rtc.set_count = __metal_driver_sifive_rtc0_set_count,
|
||||
.rtc.run = __metal_driver_sifive_rtc0_run,
|
||||
.rtc.get_interrupt = __metal_driver_sifive_rtc0_get_interrupt,
|
||||
.rtc.get_interrupt_id = __metal_driver_sifive_rtc0_get_interrupt_id,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,95 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine/platform.h>
|
||||
|
||||
#ifdef METAL_SIFIVE_TRACE
|
||||
|
||||
#include <metal/drivers/sifive_trace.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
#define TRACE_REG(offset) (((unsigned long)base + (offset)))
|
||||
#define TRACE_REG8(offset) \
|
||||
(__METAL_ACCESS_ONCE((__metal_io_u8 *)TRACE_REG(offset)))
|
||||
#define TRACE_REG16(offset) \
|
||||
(__METAL_ACCESS_ONCE((__metal_io_u16 *)TRACE_REG(offset)))
|
||||
#define TRACE_REG32(offset) \
|
||||
(__METAL_ACCESS_ONCE((__metal_io_u32 *)TRACE_REG(offset)))
|
||||
|
||||
static void write_itc_uint32(struct metal_uart *trace, uint32_t data) {
|
||||
long base = __metal_driver_sifive_trace_base(trace);
|
||||
|
||||
TRACE_REG32(METAL_SIFIVE_TRACE_ITCSTIMULUS) = data;
|
||||
}
|
||||
|
||||
static void write_itc_uint16(struct metal_uart *trace, uint16_t data) {
|
||||
long base = __metal_driver_sifive_trace_base(trace);
|
||||
|
||||
TRACE_REG16(METAL_SIFIVE_TRACE_ITCSTIMULUS + 2) = data;
|
||||
}
|
||||
|
||||
static void write_itc_uint8(struct metal_uart *trace, uint8_t data) {
|
||||
long base = __metal_driver_sifive_trace_base(trace);
|
||||
|
||||
TRACE_REG8(METAL_SIFIVE_TRACE_ITCSTIMULUS + 3) = data;
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_trace_putc(struct metal_uart *trace,
|
||||
unsigned char c) {
|
||||
static uint32_t buffer = 0;
|
||||
static int bytes_in_buffer = 0;
|
||||
|
||||
buffer |= (((uint32_t)c) << (bytes_in_buffer * 8));
|
||||
|
||||
bytes_in_buffer += 1;
|
||||
|
||||
if (bytes_in_buffer >= 4) {
|
||||
write_itc_uint32(trace, buffer);
|
||||
|
||||
buffer = 0;
|
||||
bytes_in_buffer = 0;
|
||||
} else if ((c == '\n') || (c == '\r')) { // partial write
|
||||
switch (bytes_in_buffer) {
|
||||
case 3: // do a full word write
|
||||
write_itc_uint16(trace, (uint16_t)(buffer));
|
||||
write_itc_uint8(trace, (uint8_t)(buffer >> 16));
|
||||
break;
|
||||
case 2: // do a 16 bit write
|
||||
write_itc_uint16(trace, (uint16_t)buffer);
|
||||
break;
|
||||
case 1: // do a 1 byte write
|
||||
write_itc_uint8(trace, (uint8_t)buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
buffer = 0;
|
||||
bytes_in_buffer = 0;
|
||||
}
|
||||
|
||||
return (int)c;
|
||||
}
|
||||
|
||||
void __metal_driver_sifive_trace_init(struct metal_uart *trace, int baud_rate) {
|
||||
// The only init we do here is to make sure ITC 0 is enabled. It is up to
|
||||
// Freedom Studio or other mechanisms to make sure tracing is enabled. If we
|
||||
// try to enable tracing here, it will likely conflict with Freedom Studio,
|
||||
// and they will just fight with each other.
|
||||
|
||||
long base = __metal_driver_sifive_trace_base(trace);
|
||||
|
||||
TRACE_REG32(METAL_SIFIVE_TRACE_ITCTRACEENABLE) |= 0x00000001;
|
||||
}
|
||||
|
||||
__METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_trace) = {
|
||||
.uart.init = __metal_driver_sifive_trace_init,
|
||||
.uart.putc = __metal_driver_sifive_trace_putc,
|
||||
.uart.getc = NULL,
|
||||
|
||||
.uart.get_baud_rate = NULL,
|
||||
.uart.set_baud_rate = NULL,
|
||||
|
||||
.uart.controller_interrupt = NULL,
|
||||
.uart.get_interrupt_id = NULL,
|
||||
};
|
||||
|
||||
#endif /* METAL_SIFIVE_TRACE */
|
@ -0,0 +1,213 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine/platform.h>
|
||||
|
||||
#ifdef METAL_SIFIVE_WDOG0
|
||||
|
||||
#include <metal/drivers/sifive_uart0.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* WDOGCFG */
|
||||
#define METAL_WDOGCFG_SCALE_MASK 7
|
||||
#define METAL_WDOGCFG_RSTEN (1 << 8)
|
||||
#define METAL_WDOGCFG_ZEROCMP (1 << 9)
|
||||
#define METAL_WDOGCFG_ENALWAYS (1 << 12)
|
||||
#define METAL_WDOGCFG_COREAWAKE (1 << 13)
|
||||
#define METAL_WDOGCFG_IP (1 << 28)
|
||||
|
||||
/* WDOGCMP */
|
||||
#define METAL_WDOGCMP_MASK 0xFFFF
|
||||
|
||||
#define WDOG_REG(base, offset) (((unsigned long)base + offset))
|
||||
#define WDOG_REGB(base, offset) (__METAL_ACCESS_ONCE((__metal_io_u8 *)WDOG_REG(base, offset)))
|
||||
#define WDOG_REGW(base, offset) (__METAL_ACCESS_ONCE((__metal_io_u32 *)WDOG_REG(base, offset)))
|
||||
|
||||
/* All writes to watchdog registers must be precedded by a write of
|
||||
* a magic number to WDOGKEY */
|
||||
#define WDOG_UNLOCK(base) (WDOG_REGW(base, METAL_SIFIVE_WDOG0_WDOGKEY) = METAL_SIFIVE_WDOG0_MAGIC_KEY)
|
||||
|
||||
/* Unlock the watchdog and then perform a register access */
|
||||
#define WDOG_UNLOCK_REGW(base, offset) \
|
||||
WDOG_UNLOCK(base);\
|
||||
WDOG_REGW(base, offset)
|
||||
|
||||
int __metal_driver_sifive_wdog0_feed(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGFEED) = METAL_SIFIVE_WDOG0_MAGIC_FOOD;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int __metal_driver_sifive_wdog0_get_rate(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
const struct metal_clock *const clock = __metal_driver_sifive_wdog0_clock(wdog);
|
||||
|
||||
const long int clock_rate = metal_clock_get_rate_hz(clock);
|
||||
|
||||
if (clock_rate == 0)
|
||||
return -1;
|
||||
|
||||
const unsigned int scale = (WDOG_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) & METAL_WDOGCFG_SCALE_MASK);
|
||||
|
||||
return clock_rate / (1 << scale);
|
||||
}
|
||||
|
||||
long int __metal_driver_sifive_wdog0_set_rate(const struct metal_watchdog *const wdog, const long int rate)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
const struct metal_clock *const clock = __metal_driver_sifive_wdog0_clock(wdog);
|
||||
|
||||
const long int clock_rate = metal_clock_get_rate_hz(clock);
|
||||
|
||||
if (rate >= clock_rate) {
|
||||
/* We can't scale the rate above the driving clock. Clear the scale
|
||||
* field and return the driving clock rate */
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) &= ~(METAL_WDOGCFG_SCALE_MASK);
|
||||
return clock_rate;
|
||||
}
|
||||
|
||||
/* Look for the closest scale value */
|
||||
long min_diff = LONG_MAX;
|
||||
unsigned int min_scale = 0;
|
||||
for (int i = 0; i < METAL_WDOGCFG_SCALE_MASK; i++) {
|
||||
const long int new_rate = clock_rate / (1 << i);
|
||||
|
||||
long int diff = rate - new_rate;
|
||||
if (diff < 0)
|
||||
diff *= -1;
|
||||
|
||||
if (diff < min_diff) {
|
||||
min_diff = diff;
|
||||
min_scale = i;
|
||||
}
|
||||
}
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) &= ~(METAL_WDOGCFG_SCALE_MASK);
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) |= (METAL_WDOGCFG_SCALE_MASK & min_scale);
|
||||
|
||||
return clock_rate / (1 << min_scale);
|
||||
}
|
||||
|
||||
long int __metal_driver_sifive_wdog0_get_timeout(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
return (WDOG_REGW(base, METAL_SIFIVE_WDOG0_WDOGCMP) & METAL_WDOGCMP_MASK);
|
||||
}
|
||||
|
||||
long int __metal_driver_sifive_wdog0_set_timeout(const struct metal_watchdog *const wdog, const long int timeout)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
/* Cap the timeout at the max value */
|
||||
const long int set_timeout = timeout > METAL_WDOGCMP_MASK ? METAL_WDOGCMP_MASK : timeout;
|
||||
|
||||
/* If we edit the timeout value in-place by masking the compare value to 0 and
|
||||
* then writing it, we cause a spurious interrupt because the compare value
|
||||
* is temporarily 0. Instead, read the value into a local variable, modify it
|
||||
* there, and then write the whole register back */
|
||||
uint32_t wdogcmp = WDOG_REGW(base, METAL_SIFIVE_WDOG0_WDOGCMP);
|
||||
|
||||
wdogcmp &= ~(METAL_WDOGCMP_MASK);
|
||||
wdogcmp |= set_timeout;
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCMP) = wdogcmp;
|
||||
|
||||
return set_timeout;
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_wdog0_set_result(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_result result)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
/* Turn off reset enable and counter reset */
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) &= ~(METAL_WDOGCFG_RSTEN | METAL_WDOGCFG_ZEROCMP);
|
||||
|
||||
switch (result) {
|
||||
default:
|
||||
case METAL_WATCHDOG_NO_RESULT:
|
||||
break;
|
||||
case METAL_WATCHDOG_INTERRUPT:
|
||||
/* Reset counter to zero after match */
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) |= METAL_WDOGCFG_ZEROCMP;
|
||||
break;
|
||||
case METAL_WATCHDOG_FULL_RESET:
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) |= METAL_WDOGCFG_RSTEN;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_wdog0_run(const struct metal_watchdog *const wdog,
|
||||
const enum metal_watchdog_run_option option)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) &= ~(METAL_WDOGCFG_ENALWAYS | METAL_WDOGCFG_COREAWAKE);
|
||||
|
||||
switch (option) {
|
||||
default:
|
||||
case METAL_WATCHDOG_STOP:
|
||||
break;
|
||||
case METAL_WATCHDOG_RUN_ALWAYS:
|
||||
/* Feed the watchdog before starting to reset counter */
|
||||
__metal_driver_sifive_wdog0_feed(wdog);
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) |= METAL_WDOGCFG_ENALWAYS;
|
||||
break;
|
||||
case METAL_WATCHDOG_RUN_AWAKE:
|
||||
/* Feed the watchdog before starting to reset counter */
|
||||
__metal_driver_sifive_wdog0_feed(wdog);
|
||||
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) |= METAL_WDOGCFG_COREAWAKE;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct metal_interrupt *__metal_driver_sifive_wdog0_get_interrupt(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return __metal_driver_sifive_wdog0_interrupt_parent(wdog);
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_wdog0_get_interrupt_id(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
return __metal_driver_sifive_wdog0_interrupt_line(wdog);
|
||||
}
|
||||
|
||||
int __metal_driver_sifive_wdog0_clear_interrupt(const struct metal_watchdog *const wdog)
|
||||
{
|
||||
const uintptr_t base = (uintptr_t)__metal_driver_sifive_wdog0_control_base(wdog);
|
||||
|
||||
/* Clear the interrupt pending bit */
|
||||
WDOG_UNLOCK_REGW(base, METAL_SIFIVE_WDOG0_WDOGCFG) &= ~(METAL_WDOGCFG_IP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_wdog0) = {
|
||||
.watchdog.feed = __metal_driver_sifive_wdog0_feed,
|
||||
.watchdog.get_rate = __metal_driver_sifive_wdog0_get_rate,
|
||||
.watchdog.set_rate = __metal_driver_sifive_wdog0_set_rate,
|
||||
.watchdog.get_timeout = __metal_driver_sifive_wdog0_get_timeout,
|
||||
.watchdog.set_timeout = __metal_driver_sifive_wdog0_set_timeout,
|
||||
.watchdog.set_result = __metal_driver_sifive_wdog0_set_result,
|
||||
.watchdog.run = __metal_driver_sifive_wdog0_run,
|
||||
.watchdog.get_interrupt = __metal_driver_sifive_wdog0_get_interrupt,
|
||||
.watchdog.get_interrupt_id = __metal_driver_sifive_wdog0_get_interrupt_id,
|
||||
.watchdog.clear_interrupt = __metal_driver_sifive_wdog0_clear_interrupt,
|
||||
};
|
||||
|
||||
#endif /* METAL_SIFIVE_WDOG0 */
|
||||
|
||||
typedef int no_empty_translation_units;
|
||||
|
@ -1,24 +1,82 @@
|
||||
/* Copyright 2018 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <string.h>
|
||||
#include <metal/interrupt.h>
|
||||
#include <metal/machine.h>
|
||||
|
||||
extern inline void metal_interrupt_init(struct metal_interrupt *controller);
|
||||
struct metal_interrupt* metal_interrupt_get_controller (metal_intr_cntrl_type cntrl,
|
||||
int id)
|
||||
{
|
||||
switch (cntrl) {
|
||||
case METAL_CPU_CONTROLLER:
|
||||
break;
|
||||
case METAL_CLINT_CONTROLLER:
|
||||
#ifdef __METAL_DT_RISCV_CLINT0_HANDLE
|
||||
return __METAL_DT_RISCV_CLINT0_HANDLE;
|
||||
#endif
|
||||
break;
|
||||
case METAL_CLIC_CONTROLLER:
|
||||
#ifdef __METAL_DT_SIFIVE_CLIC0_HANDLE
|
||||
return __METAL_DT_SIFIVE_CLIC0_HANDLE;
|
||||
#endif
|
||||
break;
|
||||
case METAL_PLIC_CONTROLLER:
|
||||
#ifdef __METAL_DT_RISCV_PLIC0_HANDLE
|
||||
return __METAL_DT_RISCV_PLIC0_HANDLE;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern inline int metal_interrupt_register_handler(struct metal_interrupt *controller,
|
||||
extern __inline__ void metal_interrupt_init(struct metal_interrupt *controller);
|
||||
|
||||
extern __inline__ int metal_interrupt_set_vector_mode(struct metal_interrupt *controller,
|
||||
metal_vector_mode mode);
|
||||
extern __inline__ metal_vector_mode metal_interrupt_get_vector_mode(struct metal_interrupt *controller);
|
||||
|
||||
extern __inline__ int metal_interrupt_set_privilege(struct metal_interrupt *controller,
|
||||
metal_intr_priv_mode mode);
|
||||
extern __inline__ metal_intr_priv_mode metal_interrupt_get_privilege(struct metal_interrupt *controller);
|
||||
|
||||
extern __inline__ int metal_interrupt_set_threshold(struct metal_interrupt *controller,
|
||||
unsigned int level);
|
||||
extern __inline__ unsigned int metal_interrupt_get_threshold(struct metal_interrupt *controller);
|
||||
|
||||
extern __inline__ unsigned int metal_interrupt_get_priority(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern __inline__ int metal_interrupt_set_priority(struct metal_interrupt *controller, int id, unsigned int priority);
|
||||
|
||||
extern __inline__ int metal_interrupt_clear(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern __inline__ int metal_interrupt_set(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern __inline__ int metal_interrupt_register_handler(struct metal_interrupt *controller,
|
||||
int id,
|
||||
metal_interrupt_handler_t handler,
|
||||
void *priv);
|
||||
|
||||
extern inline int metal_interrupt_enable(struct metal_interrupt *controller, int id);
|
||||
extern __inline__ int metal_interrupt_register_vector_handler(struct metal_interrupt *controller,
|
||||
int id,
|
||||
metal_interrupt_vector_handler_t handler,
|
||||
void *priv_data);
|
||||
|
||||
extern __inline__ int metal_interrupt_enable(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern __inline__ int metal_interrupt_disable(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern __inline__ unsigned int metal_interrupt_get_threshold(struct metal_interrupt *controller);
|
||||
|
||||
extern __inline__ int metal_interrupt_set_threshold(struct metal_interrupt *controller, unsigned int threshold);
|
||||
|
||||
extern __inline__ unsigned int metal_interrupt_get_priority(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern inline int metal_interrupt_disable(struct metal_interrupt *controller, int id);
|
||||
extern __inline__ int metal_interrupt_set_priority(struct metal_interrupt *controller, int id, unsigned int priority);
|
||||
|
||||
extern inline int metal_interrupt_vector_enable(struct metal_interrupt *controller,
|
||||
int id, metal_vector_mode mode);
|
||||
extern __inline__ int metal_interrupt_vector_enable(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern inline int metal_interrupt_vector_disable(struct metal_interrupt *controller, int id);
|
||||
extern __inline__ int metal_interrupt_vector_disable(struct metal_interrupt *controller, int id);
|
||||
|
||||
extern inline int _metal_interrupt_command_request(struct metal_interrupt *controller,
|
||||
extern __inline__ int _metal_interrupt_command_request(struct metal_interrupt *controller,
|
||||
int cmd, void *data);
|
||||
|
@ -0,0 +1,27 @@
|
||||
/* Copyright 2019 SiFive, Inc. */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine.h>
|
||||
#include <metal/rtc.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern inline uint64_t metal_rtc_get_rate(const struct metal_rtc *const rtc);
|
||||
extern inline uint64_t metal_rtc_set_rate(const struct metal_rtc *const rtc, const uint64_t rate);
|
||||
extern inline uint64_t metal_rtc_get_compare(const struct metal_rtc *const rtc);
|
||||
extern inline uint64_t metal_rtc_set_compare(const struct metal_rtc *const rtc, const uint64_t compare);
|
||||
extern inline uint64_t metal_rtc_get_count(const struct metal_rtc *const rtc);
|
||||
extern inline uint64_t metal_rtc_set_count(const struct metal_rtc *const rtc, const uint64_t count);
|
||||
extern inline int metal_rtc_run(const struct metal_rtc *const rtc, const enum metal_rtc_run_option option);
|
||||
extern inline struct metal_interrupt *metal_rtc_get_interrupt(const struct metal_rtc *const rtc);
|
||||
extern inline int metal_rtc_get_interrupt_id(const struct metal_rtc *const rtc);
|
||||
|
||||
struct metal_rtc *metal_rtc_get_device(int index) {
|
||||
#ifdef __METAL_DT_MAX_RTCS
|
||||
if (index < __METAL_DT_MAX_RTCS) {
|
||||
return (struct metal_rtc *) __metal_rtc_table[index];
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/machine.h>
|
||||
#include <metal/machine/platform.h>
|
||||
#include <metal/io.h>
|
||||
#include <metal/cpu.h>
|
||||
|
||||
#define METAL_REG(base, offset) (((unsigned long)(base) + (offset)))
|
||||
#define METAL_REGW(base, offset) (__METAL_ACCESS_ONCE((__metal_io_u32 *)METAL_REG((base), (offset))))
|
||||
#define METAL_MSIP(base, hart) (METAL_REGW((base),4*(hart)))
|
||||
|
||||
/*
|
||||
* _synchronize_harts() is called by crt0.S to cause harts > 0 to wait for
|
||||
* hart 0 to finish copying the datat section, zeroing the BSS, and running
|
||||
* the libc contstructors.
|
||||
*/
|
||||
__attribute__((section(".init")))
|
||||
void __metal_synchronize_harts() {
|
||||
#if __METAL_DT_MAX_HARTS > 1
|
||||
|
||||
int hart;
|
||||
__asm__ volatile("csrr %0, mhartid" : "=r" (hart) ::);
|
||||
|
||||
uintptr_t msip_base = 0;
|
||||
|
||||
/* Get the base address of the MSIP registers */
|
||||
#ifdef __METAL_DT_RISCV_CLINT0_HANDLE
|
||||
msip_base = __metal_driver_sifive_clint0_control_base(__METAL_DT_RISCV_CLINT0_HANDLE);
|
||||
msip_base += METAL_RISCV_CLINT0_MSIP_BASE;
|
||||
#elif __METAL_DT_RISCV_CLIC0_HANDLE
|
||||
msip_base = __metal_driver_sifive_clic0_control_base(__METAL_DT_RISCV_CLIC0_HANDLE);
|
||||
msip_base += METAL_RISCV_CLIC0_MSIP_BASE;
|
||||
#else
|
||||
#pragma message(No handle for CLINT or CLIC found, harts may be unsynchronized after init!)
|
||||
#endif
|
||||
|
||||
/* Disable machine interrupts as a precaution */
|
||||
__asm__ volatile("csrc mstatus, %0" :: "r" (METAL_MSTATUS_MIE));
|
||||
|
||||
if (hart == 0) {
|
||||
/* Hart 0 waits for all harts to set their MSIP bit */
|
||||
for (int i = 1 ; i < __METAL_DT_MAX_HARTS; i++) {
|
||||
while (METAL_MSIP(msip_base, i) == 0) ;
|
||||
}
|
||||
|
||||
/* Hart 0 clears everyone's MSIP bit */
|
||||
for (int i = 1 ; i < __METAL_DT_MAX_HARTS; i++) {
|
||||
METAL_MSIP(msip_base, i) = 0;
|
||||
}
|
||||
} else {
|
||||
/* Other harts set their MSIP bit to indicate they're ready */
|
||||
METAL_MSIP(msip_base, hart) = 1;
|
||||
__asm__ volatile ("fence w,rw");
|
||||
|
||||
/* Wait for hart 0 to clear the MSIP bit */
|
||||
while (METAL_MSIP(msip_base, hart) == 1) ;
|
||||
}
|
||||
|
||||
#endif /* __METAL_DT_MAX_HARTS > 1 */
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#include <metal/time.h>
|
||||
#include <metal/timer.h>
|
||||
|
||||
int metal_gettimeofday(struct timeval *tp, void *tzp)
|
||||
{
|
||||
int rv;
|
||||
unsigned long long mcc, timebase;
|
||||
if ((rv = metal_timer_get_cyclecount(0, &mcc))) {
|
||||
return -1;
|
||||
}
|
||||
if ((rv = metal_timer_get_timebase_frequency(0, &timebase))) {
|
||||
return -1;
|
||||
}
|
||||
tp->tv_sec = mcc / timebase;
|
||||
tp->tv_usec = mcc % timebase * 1000000 / timebase;
|
||||
return 0;
|
||||
}
|
||||
|
||||
time_t metal_time (void)
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
if (metal_gettimeofday(&now, NULL) < 0)
|
||||
now.tv_sec = (time_t) -1;
|
||||
|
||||
return now.tv_sec;
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
/* Copyright 2019 SiFive, Inc */
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
/*
|
||||
* Jump table for CLINT vectored mode
|
||||
*/
|
||||
.weak metal_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_interrupt_vector_handler
|
||||
|
||||
.weak metal_software_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_software_interrupt_vector_handler
|
||||
|
||||
.weak metal_timer_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_timer_interrupt_vector_handler
|
||||
|
||||
.weak metal_external_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_external_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc0_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc0_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc1_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc1_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc2_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc2_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc3_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc3_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc4_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc4_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc5_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc5_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc6_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc6_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc7_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc7_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc8_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc8_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc9_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc9_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc10_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc10_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc11_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc11_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc12_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc12_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc13_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc13_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc14_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc14_interrupt_vector_handler
|
||||
|
||||
.weak metal_lc15_interrupt_vector_handler
|
||||
.balign 4, 0
|
||||
.global metal_lc15_interrupt_vector_handler
|
||||
|
||||
#if __riscv_xlen == 32
|
||||
.balign 128, 0
|
||||
#else
|
||||
.balign 256, 0
|
||||
#endif
|
||||
.option norvc
|
||||
.global __metal_vector_table
|
||||
__metal_vector_table:
|
||||
IRQ_0:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_1:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_2:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_3:
|
||||
j metal_software_interrupt_vector_handler
|
||||
IRQ_4:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_5:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_6:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_7:
|
||||
j metal_timer_interrupt_vector_handler
|
||||
IRQ_8:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_9:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_10:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_11:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_12:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_13:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_14:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_15:
|
||||
j metal_interrupt_vector_handler
|
||||
IRQ_LC0:
|
||||
j metal_lc0_interrupt_vector_handler
|
||||
IRQ_LC1:
|
||||
j metal_lc1_interrupt_vector_handler
|
||||
IRQ_LC2:
|
||||
j metal_lc2_interrupt_vector_handler
|
||||
IRQ_LC3:
|
||||
j metal_lc3_interrupt_vector_handler
|
||||
IRQ_LC4:
|
||||
j metal_lc4_interrupt_vector_handler
|
||||
IRQ_LC5:
|
||||
j metal_lc5_interrupt_vector_handler
|
||||
IRQ_LC6:
|
||||
j metal_lc6_interrupt_vector_handler
|
||||
IRQ_LC7:
|
||||
j metal_lc7_interrupt_vector_handler
|
||||
IRQ_LC8:
|
||||
j metal_lc8_interrupt_vector_handler
|
||||
IRQ_LC9:
|
||||
j metal_lc9_interrupt_vector_handler
|
||||
IRQ_LC10:
|
||||
j metal_lc10_interrupt_vector_handler
|
||||
IRQ_LC11:
|
||||
j metal_lc11_interrupt_vector_handler
|
||||
IRQ_LC12:
|
||||
j metal_lc12_interrupt_vector_handler
|
||||
IRQ_LC13:
|
||||
j metal_lc13_interrupt_vector_handler
|
||||
IRQ_LC14:
|
||||
j metal_lc14_interrupt_vector_handler
|
||||
IRQ_LC15:
|
||||
j metal_lc15_interrupt_vector_handler
|
||||
|
||||
|
Loading…
Reference in New Issue