newer version

This commit is contained in:
rusefi 2014-04-22 20:15:29 -05:00
parent bfec788027
commit 89850a25f0
53 changed files with 3637 additions and 3533 deletions

View File

@ -1,141 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings"> <storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040"> <cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040" moduleId="org.eclipse.cdt.core.settings" name="Debug"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/> <externalSettings/>
<extensions> <extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" 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.CWDLocator" 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"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" 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.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040" name="Debug" parent="cdt.managedbuild.config.gnu.cygwin.exe.debug"> <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040" name="Debug" parent="cdt.managedbuild.config.gnu.cygwin.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug.142029168" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug"> <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug.142029168" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug.1195576766" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug"/> <targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug.1195576766" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug"/>
<builder buildPath="${workspace_loc:/unit_tests}/Debug" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug.277211349" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug"/> <builder buildPath="${workspace_loc:/unit_tests}/Debug" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug.277211349" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug.1303365167" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug"> <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug.1303365167" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.993041368" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.993041368" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool> </tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.870144749" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.870144749" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug.1825656332" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug"> <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug.1825656332" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug">
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level.598398831" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level.598398831" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level.2019038432" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> <option id="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level.2019038432" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.other.other.1220149077" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/> <option id="gnu.cpp.compiler.option.other.other.1220149077" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/>
<option id="gnu.cpp.compiler.option.include.paths.1280999160" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> <option id="gnu.cpp.compiler.option.include.paths.1280999160" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_basic_math&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_basic_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_data_structures&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_data_structures&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/engines&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/engines&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo/nmea&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo/nmea&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_trigger&quot;"/>
</option> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.1681941669" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/> </option>
</tool> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.1681941669" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.259037498" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug"> </tool>
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.cygwin.exe.debug.option.optimization.level.899787827" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.optimization.level" valueType="enumerated"/> <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.259037498" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug">
<option id="gnu.c.compiler.cygwin.exe.debug.option.debugging.level.600286923" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.cygwin.exe.debug.option.optimization.level.899787827" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.other.1016166105" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -std=gnu99 -fgnu89-inline -Werror-implicit-function-declaration" valueType="string"/> <option id="gnu.c.compiler.cygwin.exe.debug.option.debugging.level.600286923" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.811604738" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <option id="gnu.c.compiler.option.misc.other.1016166105" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -std=gnu99 -fgnu89-inline -Werror-implicit-function-declaration" valueType="string"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/&quot;"/> <option id="gnu.c.compiler.option.include.paths.811604738" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_basic_math&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_data_structures&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_basic_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/engines&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_data_structures&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo/nmea&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/engines&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo/nmea&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/ext_algo&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/>
</option> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_trigger&quot;"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1693315995" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/> <listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/>
</tool> </option>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug.1531611540" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1693315995" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug.1614744459" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug"> </tool>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1957409246" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug.1531611540" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"/>
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug.1614744459" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug">
<additionalInput kind="additionalinput" paths="$(LIBS)"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1957409246" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
</inputType> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
</tool> <additionalInput kind="additionalinput" paths="$(LIBS)"/>
</toolChain> </inputType>
</folderInfo> </tool>
</configuration> </toolChain>
</storageModule> </folderInfo>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <sourceEntries>
</cconfiguration> <entry excluding="controllers_trigger/trigger_central.c|controllers_trigger/rpm_calculator.c|controllers_trigger/main_trigger_callback.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757"> </sourceEntries>
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757" moduleId="org.eclipse.cdt.core.settings" name="Release"> </configuration>
<externalSettings/> </storageModule>
<extensions> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> </cconfiguration>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> <cconfiguration id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757">
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757" moduleId="org.eclipse.cdt.core.settings" name="Release">
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <externalSettings/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extensions>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</storageModule> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757" name="Release" parent="cdt.managedbuild.config.gnu.cygwin.exe.release"> <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757." name="/" resourcePath=""> <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.release.814666698" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.release"> </extensions>
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.release.1299449901" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.release"/> </storageModule>
<builder buildPath="${workspace_loc:/unit_tests}/Release" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.release.1095970666" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.release"/> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release.770682652" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release"> <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757" name="Release" parent="cdt.managedbuild.config.gnu.cygwin.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.775261179" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> <folderInfo id="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757." name="/" resourcePath="">
</tool> <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.exe.release.814666698" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.release">
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.101933249" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/> <targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.exe.release.1299449901" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release.2008790765" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release"> <builder buildPath="${workspace_loc:/unit_tests}/Release" id="cdt.managedbuild.target.gnu.builder.cygwin.exe.release.1095970666" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.exe.release"/>
<option id="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level.1530540669" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release.770682652" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release">
<option id="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level.1237567557" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.775261179" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.330744446" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/> </tool>
</tool> <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.101933249" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.898041114" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release"> <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release.2008790765" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.cygwin.exe.release.option.optimization.level.114808365" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.release.option.optimization.level" valueType="enumerated"/> <option id="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level.1530540669" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.c.compiler.cygwin.exe.release.option.debugging.level.715395708" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level.1237567557" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1402954999" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.330744446" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/>
</tool> </tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release.1597625643" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release"/> <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.898041114" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release">
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release.1354105539" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release"> <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.cygwin.exe.release.option.optimization.level.114808365" name="Optimization Level" superClass="gnu.c.compiler.cygwin.exe.release.option.optimization.level" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1729844263" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> <option id="gnu.c.compiler.cygwin.exe.release.option.debugging.level.715395708" name="Debug Level" superClass="gnu.c.compiler.cygwin.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1402954999" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/> </tool>
</inputType> <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release.1597625643" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release"/>
</tool> <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release.1354105539" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release">
</toolChain> <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1729844263" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
</folderInfo> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
</configuration> <additionalInput kind="additionalinput" paths="$(LIBS)"/>
</storageModule> </inputType>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> </tool>
</cconfiguration> </toolChain>
</storageModule> </folderInfo>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <sourceEntries>
<project id="unit_tests.cdt.managedbuild.target.gnu.cygwin.exe.837710263" name="Executable" projectType="cdt.managedbuild.target.gnu.cygwin.exe"/> <entry excluding="controllers_trigger/trigger_central.c|controllers_trigger/rpm_calculator.c|controllers_trigger/main_trigger_callback.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</storageModule> </sourceEntries>
<storageModule moduleId="scannerConfiguration"> </configuration>
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> </storageModule>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040;cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug.1825656332;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.1681941669"> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> </cconfiguration>
</scannerConfigBuildInfo> </storageModule>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757;cdt.managedbuild.config.gnu.cygwin.exe.release.615580757.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.898041114;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1402954999"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <project id="unit_tests.cdt.managedbuild.target.gnu.cygwin.exe.837710263" name="Executable" projectType="cdt.managedbuild.target.gnu.cygwin.exe"/>
</scannerConfigBuildInfo> </storageModule>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757;cdt.managedbuild.config.gnu.cygwin.exe.release.615580757.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release.2008790765;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.330744446"> <storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040;cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug.1825656332;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.1681941669">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040;cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.259037498;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1693315995"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> </scannerConfigBuildInfo>
</scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757;cdt.managedbuild.config.gnu.cygwin.exe.release.615580757.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release.898041114;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1402954999">
</storageModule> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> </scannerConfigBuildInfo>
<storageModule moduleId="refreshScope"/> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.release.615580757;cdt.managedbuild.config.gnu.cygwin.exe.release.615580757.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release.2008790765;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.330744446">
</cproject> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040;cdt.managedbuild.config.gnu.cygwin.exe.debug.530233040.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug.259037498;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1693315995">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/unit_tests"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/unit_tests"/>
</configuration>
</storageModule>
</cproject>

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>unit_tests</name> <name>unit_tests</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers> <triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers> <triggers>full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.cdt.core.cnature</nature> <nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature> <nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -1,221 +1,228 @@
############################################################################## ##############################################################################
# Build global options # Build global options
# NOTE: Can be overridden externally. # NOTE: Can be overridden externally.
# #
PROJECT_DIR = ../firmware PROJECT_DIR = ../firmware
#CHIBIOS = $(PROJECT_DIR)/chibios #CHIBIOS = $(PROJECT_DIR)/chibios
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
# -O2 is needed for mingw, without it there is a linking issue to isnanf?!?! # -O2 is needed for mingw, without it there is a linking issue to isnanf?!?!
#USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers #USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers
USE_OPT = -c -Wall -O2 USE_OPT = -c -Wall -O0 -ggdb -g3
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),) ifeq ($(USE_COPT),)
USE_COPT = -std=gnu99 -fgnu89-inline USE_COPT = -std=gnu99 -fgnu89-inline
endif endif
# C++ specific options here (added to USE_OPT). # C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),) ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti -fpermissive -fno-exceptions -fno-use-cxa-atexit USE_CPPOPT = -fno-rtti -fpermissive -fno-exceptions -fno-use-cxa-atexit
endif endif
# Enable this if you want the linker to remove unused code and data # Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),) ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes USE_LINK_GC = yes
endif endif
# If enabled, this option allows to compile the application in THUMB mode. # If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),) ifeq ($(USE_THUMB),)
USE_THUMB = no USE_THUMB = no
endif endif
# Enable this if you want to see the full log while compiling. # Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),) ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no USE_VERBOSE_COMPILE = no
endif endif
# #
# Build global options # Build global options
############################################################################## ##############################################################################
############################################################################## ##############################################################################
# Architecture or project specific options # Architecture or project specific options
# #
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
DDEFS = DDEFS =
# #
# Architecture or project specific options # Architecture or project specific options
############################################################################## ##############################################################################
############################################################################## ##############################################################################
# Project, sources and paths # Project, sources and paths
# #
# Define project name here # Define project name here
PROJECT = rusefi_test PROJECT = rusefi_test
#PROJECT_BOARD = OLIMEX_STM32_E407 #PROJECT_BOARD = OLIMEX_STM32_E407
#ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407) #ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407)
# PROJECT_BOARD = ST_STM32F4_DISCOVERY # PROJECT_BOARD = ST_STM32F4_DISCOVERY
#endif #endif
#DDEFS += -D$(PROJECT_BOARD) #DDEFS += -D$(PROJECT_BOARD)
# Imported source files and paths # Imported source files and paths
include $(PROJECT_DIR)/util/util.mk include $(PROJECT_DIR)/util/util.mk
include $(PROJECT_DIR)/config/engines/engines.mk include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/controllers/algo/algo.mk include $(PROJECT_DIR)/controllers/algo/algo.mk
include $(PROJECT_DIR)/controllers/math/math.mk include $(PROJECT_DIR)/controllers/math/math.mk
include $(PROJECT_DIR)/controllers/sensors/sensors.mk include $(PROJECT_DIR)/controllers/sensors/sensors.mk
include test.mk include test.mk
# Define linker script file here # Define linker script file here
#LDSCRIPT= config/system/STM32F407xG.ld #LDSCRIPT= config/system/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld #LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global # C sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CSRC = $(UTILSRC) \ CSRC = $(UTILSRC) \
$(CONTROLLERS_ALGO_SRC) \ $(CONTROLLERS_ALGO_SRC) \
$(CONTROLLERS_MATH_SRC) \ $(CONTROLLERS_MATH_SRC) \
$(CONTROLLERS_SENSORS_SRC) \ $(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \ $(ENGINES_SRC) \
$(TEST_SRC_C) $(PROJECT_DIR)/controllers/trigger/trigger_mazda.c \
$(PROJECT_DIR)/controllers/trigger/trigger_structure.c \
# C++ sources that can be compiled in ARM or THUMB mode depending on the global $(TEST_SRC_C)
# setting.
CPPSRC = $(UTILSRC_CPP) \ # C++ sources that can be compiled in ARM or THUMB mode depending on the global
$(CONTROLLERS_ALGO_SRC_CPP) \ # setting.
$(ENGINES_SRC_CPP) \ CPPSRC = $(UTILSRC_CPP) \
$(TEST_SRC_CPP) \ $(CONTROLLERS_ALGO_SRC_CPP) \
main.cpp $(PROJECT_DIR)/controllers/trigger/trigger_chrysler.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_gm.cpp \
# C sources to be compiled in ARM mode regardless of the global setting. $(PROJECT_DIR)/controllers/trigger/trigger_decoder.cpp \
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler $(ENGINES_SRC_CPP) \
# option that results in lower performance and larger code size. $(CONTROLLERS_MATH_SRC_CPP) \
ACSRC = $(TEST_SRC_CPP) \
main.cpp
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # C sources to be compiled in ARM mode regardless of the global setting.
# option that results in lower performance and larger code size. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
ACPPSRC = # option that results in lower performance and larger code size.
ACSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # C++ sources to be compiled in ARM mode regardless of the global setting.
# option that results in lower performance and larger code size. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
TCSRC = # option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # C sources to be compiled in THUMB mode regardless of the global setting.
# option that results in lower performance and larger code size. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
TCPPSRC = # option that results in lower performance and larger code size.
TCSRC =
# List ASM source files here
ASMSRC = $(PORTASM) # C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
INCDIR = . \ # option that results in lower performance and larger code size.
$(PROJECT_DIR)/util \ TCPPSRC =
$(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/controllers/sensors \ # List ASM source files here
$(PROJECT_DIR)/controllers/algo \ ASMSRC = $(PORTASM)
$(PROJECT_DIR)/controllers/math \
$(PROJECT_DIR)/ext_algo \ INCDIR = . \
test_data_structures \ $(PROJECT_DIR)/util \
test_basic_math $(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/algo \
# $(PROJECT_DIR)/controllers/math \
# Project, sources and paths $(PROJECT_DIR)/controllers/trigger \
############################################################################## $(PROJECT_DIR)/ext_algo \
test_data_structures \
############################################################################## test_basic_math
# Compiler settings
#
#
#MCU = cortex-m4 # Project, sources and paths
##############################################################################
ifeq ($(OS),Windows_NT)
TRGT = i686-pc-mingw32- ##############################################################################
else # Compiler settings
TRGT = #
endif
#MCU = cortex-m4
CC = $(TRGT)gcc
CPPC = $(TRGT)g++ ifeq ($(OS),Windows_NT)
# Enable loading with g++ only if you need C++ runtime support. TRGT = i686-pc-mingw32-
# NOTE: You can use C++ even without C++ support if you are careful. C++ else
# runtime support makes code size explode. TRGT =
#LD = $(TRGT)gcc endif
LD = $(TRGT)g++
CP = $(TRGT)objcopy CC = $(TRGT)gcc
AS = $(TRGT)gcc -x assembler-with-cpp CPPC = $(TRGT)g++
OD = $(TRGT)objdump # Enable loading with g++ only if you need C++ runtime support.
HEX = $(CP) -O ihex # NOTE: You can use C++ even without C++ support if you are careful. C++
BIN = $(CP) -O binary # runtime support makes code size explode.
#LD = $(TRGT)gcc
# ARM-specific options here LD = $(TRGT)g++
AOPT = CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
# THUMB-specific options here OD = $(TRGT)objdump
TOPT = -mthumb -DTHUMB HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# Define C warning options here
CWARN = -Wall -Wextra -Wstrict-prototypes # ARM-specific options here
AOPT =
# Define C++ warning options here
CPPWARN = -Wall -Wextra # THUMB-specific options here
TOPT = -mthumb -DTHUMB
#
# Compiler settings # Define C warning options here
############################################################################## CWARN = -Wall -Wextra -Wstrict-prototypes
############################################################################## # Define C++ warning options here
# Start of default section CPPWARN = -Wall -Wextra
#
#
# List all default ASM defines here, like -D_DEBUG=1 # Compiler settings
DADEFS = ##############################################################################
# List all default directories to look for include files here ##############################################################################
DINCDIR = # Start of default section
#
# List the default directory to look for the libraries here
DLIBDIR = # List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default libraries here
DLIBS = -static-libgcc -static-libstdc++ # List all default directories to look for include files here
DINCDIR =
#
# End of default section # List the default directory to look for the libraries here
############################################################################## DLIBDIR =
############################################################################## # List all default libraries here
# Start of user section DLIBS = -static-libgcc -static-libstdc++
#
#
# List all user C define here, like -D_DEBUG=1 # End of default section
UDEFS = ##############################################################################
# Define ASM defines here ##############################################################################
UADEFS = # Start of user section
#
# List all user directories here
UINCDIR = # List all user C define here, like -D_DEBUG=1
UDEFS =
# List the user directory to look for the libraries here
ULIBDIR = # Define ASM defines here
UADEFS =
# List all user libraries here
ULIBS = -lm # List all user directories here
UINCDIR =
#
# End of user defines # List the user directory to look for the libraries here
############################################################################## ULIBDIR =
include rules.mk # List all user libraries here
ULIBS = -lm
#
# End of user defines
##############################################################################
include rules.mk

View File

@ -1,11 +1,11 @@
/** /**
* @file adc_inputs.h * @file adc_inputs.h
* *
* @date Dec 7, 2013 * @date Dec 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef ADC_INPUTS_H_ #ifndef ADC_INPUTS_H_
#define ADC_INPUTS_H_ #define ADC_INPUTS_H_
#endif /* ADC_INPUTS_H_ */ #endif /* ADC_INPUTS_H_ */

View File

@ -1,23 +1,22 @@
/** /**
* @file board.c * @file board.c
* *
* @date Nov 15, 2013 * @date Nov 15, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "boards.h" #include "boards.h"
float getVoltageDivided(int channel) { float getVoltageDivided(int channel) {
return 0; return 0;
} }
float getVoltage(int channel) { float getVoltage(int channel) {
return 0; return 0;
} }
int getAdcValue(int channel) {
int getAdcValue(int channel) { return 0;
return 0; }
}

View File

@ -1,24 +1,24 @@
/* /*
* boards.h * boards.h
* *
* Created on: Nov 15, 2013 * Created on: Nov 15, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef BOARDS_H_ #ifndef BOARDS_H_
#define BOARDS_H_ #define BOARDS_H_
#define ADC_LOGIC_TPS 0 #define ADC_LOGIC_TPS 0
#define ADC_LOGIC_AFR 0 #define ADC_LOGIC_AFR 0
#define ADC_LOGIC_MAF 0 #define ADC_LOGIC_MAF 0
#define ADC_LOGIC_MAP 0 #define ADC_LOGIC_MAP 0
#define ADC_CHANNEL_VREF 0 #define ADC_CHANNEL_VREF 0
#define ADC_CHANNEL_VBATT 0 #define ADC_CHANNEL_VBATT 0
#define ADC_LOGIC_INTAKE_AIR 0 #define ADC_LOGIC_INTAKE_AIR 0
#define ADC_LOGIC_COOLANT 0 #define ADC_LOGIC_COOLANT 0
float getVoltageDivided(int); float getVoltageDivided(int);
float getVoltage(int channel); float getVoltage(int channel);
int getAdcValue(int channel); int getAdcValue(int channel);
#endif /* BOARDS_H_ */ #endif /* BOARDS_H_ */

View File

@ -1,3 +1,3 @@
rm -rf .dep/ rm -rf .dep/
rm -rf build/ rm -rf build/
make make

View File

@ -1,13 +1,20 @@
/* /*
* efifeatures.h * efifeatures.h
* *
* Created on: Mar 7, 2014 * Created on: Mar 7, 2014
* Author: Andrey * Author: Andrey
*/ */
#ifndef EFIFEATURES_H_ #ifndef EFIFEATURES_H_
#define EFIFEATURES_H_ #define EFIFEATURES_H_
#define EFI_CLI_SUPPORT FALSE #define EFI_CLI_SUPPORT FALSE
#endif /* EFIFEATURES_H_ */ #define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#endif /* EFIFEATURES_H_ */

View File

@ -1,23 +1,19 @@
/* /*
* @file global.h * @file global.h
* *
* @date Nov 28, 2013 * @date Nov 28, 2013
* @author pc * @author pc
*/ */
#ifndef GLOBAL_H_ #ifndef GLOBAL_H_
#define GLOBAL_H_ #define GLOBAL_H_
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#define EFI_SUPPORT_FORD_ASPIRE TRUE #include "efitime.h"
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE #define TRUE 1
#define EFI_SUPPORT_FORD_FIESTA TRUE #define FALSE 0
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#endif /* GLOBAL_H_ */
#define TRUE 1
#define FALSE 0
#endif /* GLOBAL_H_ */

View File

@ -1,40 +1,40 @@
#!/bin/bash #!/bin/bash
echo "The PATH is ${PATH}" echo "The PATH is ${PATH}"
cd "${WORKSPACE}" cd "${WORKSPACE}"
echo "start in workspace ${PWD}" echo "start in workspace ${PWD}"
cd firmware cd firmware
echo "CD to ${PWD}" echo "CD to ${PWD}"
rm -fR .dep rm -fR .dep
rm -fR build rm -fR build
make make
if [ ! -f build/rusefi.hex ]; then if [ ! -f build/rusefi.hex ]; then
echo "Firmware compilation failed" echo "Firmware compilation failed"
exit -1 exit -1
fi fi
cd "${WORKSPACE}/win32_algo_tests" cd "${WORKSPACE}/win32_algo_tests"
echo "CD to ${PWD}" echo "CD to ${PWD}"
rm -fR .dep rm -fR .dep
rm -fR build rm -fR build
make make
if [ ! -f build/rusefi_test ]; then if [ ! -f build/rusefi_test ]; then
echo "test compilation failed" echo "test compilation failed"
exit -1 exit -1
fi fi
# we want to terminate if test fails # we want to terminate if test fails
set -e set -e
# invoke the tests - hopefully error code would be propagated? # invoke the tests - hopefully error code would be propagated?
build/rusefi_test build/rusefi_test
cd "${WORKSPACE}/java_console" cd "${WORKSPACE}/java_console"
echo "CD to ${PWD}" echo "CD to ${PWD}"
#JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64 #JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
#ant #ant

View File

@ -13,6 +13,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "main.h" #include "main.h"
#include "error_handling.h"
extern "C" extern "C"
{ {
@ -28,10 +29,10 @@ extern "C"
#include "test_signal_executor.h" #include "test_signal_executor.h"
#include "test_util.h" #include "test_util.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "test_trigger_decoder.h" #include "engine_math.h"
} }
#include "test_trigger_decoder.h"
static engine_configuration_s ec; static engine_configuration_s ec;
engine_configuration_s *engineConfiguration = &ec; engine_configuration_s *engineConfiguration = &ec;
@ -40,8 +41,12 @@ static float absF(float value) {
return value > 0 ? value : -value; return value > 0 ? value : -value;
} }
uint64_t getTimeNowUs(void) {
return 0;
}
void assertEqualsM(char *msg, float expected, float actual) { void assertEqualsM(char *msg, float expected, float actual) {
if (isnan(actual) && !isnan(expected)) { if (cisnan(actual) && !cisnan(expected)) {
printf("Unexpected: %s %.4f while expected %.4f\r\n", msg, actual, expected); printf("Unexpected: %s %.4f while expected %.4f\r\n", msg, actual, expected);
exit(-1); exit(-1);
} }
@ -86,6 +91,7 @@ static engine_configuration2_s ec2;
engine_configuration2_s *engineConfiguration2 = &ec2; engine_configuration2_s *engineConfiguration2 = &ec2;
int main(void) { int main(void) {
testOverflow64Counter();
testInterpolate3d(); testInterpolate3d();
testFindIndex(); testFindIndex();
testInterpolate2d(); testInterpolate2d();
@ -111,15 +117,16 @@ int main(void) {
testPinHelper(); testPinHelper();
testSetTableValue(); testSetTableValue();
printf("Success 20130319\r\n"); printf("Success 20130422\r\n");
// resizeMap(); // resizeMap();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
void warning(char *msg, float value) {
printf("Warning: %s %f\r\n", msg, value); int warning(obd_code_e code, const char *fmt, ...) {
printf("Warning: %s\r\n", fmt);
} }
void firmwareError(const char *fmt, ...) { void firmwareError(const char *fmt, ...) {

View File

@ -1,58 +1,62 @@
/** /**
* @file main.h * @file main.h
* @brief Test version of main.h * @brief Test version of main.h
* *
* Created on: Oct 17, 2013 * Created on: Oct 17, 2013
* Author: Andrey Belomutskiy (C) 2012-2013 * Author: Andrey Belomutskiy (C) 2012-2013
*/ */
#ifndef MAIN_H_ #ifndef MAIN_H_
#define MAIN_H_ #define MAIN_H_
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "error_handling.h"
#ifdef __cplusplus
#ifdef __cplusplus extern "C"
extern "C" {
{ #endif
#endif
#define CH_FREQUENCY 1000
#include "efilib.h"
#include "global.h"
#include "global.h" #include "error_handling.h"
#include "boards.h"
#include "engines.h" #include "efilib.h"
#include "efitime.h"
typedef int bool_t;
#include "boards.h"
void chDbgAssert(int c, char *msg, void *arg); #include "engines.h"
void print(const char *fmt, ...); typedef int bool_t;
#define TICKS_IN_MS 100 void chDbgAssert(int c, char *msg, void *arg);
#define DEBUG_INTERPOLATION 1 void print(const char *fmt, ...);
#define chDbgCheck(x, y) chDbgAssert(x, y, NULL) #define TICKS_IN_MS 100
void assertEqualsM(char *msg, float expected, float actual); #define DEBUG_INTERPOLATION 1
void assertEquals(float expected, float actual);
void assertTrue(float actual); #define chDbgCheck(x, y) chDbgAssert(x, y, NULL)
void assertTrueM(char *msg, float actual);
void assertFalse(float actual); void assertEqualsM(char *msg, float expected, float actual);
void assertFalseM(char *msg, float actual); void assertEquals(float expected, float actual);
void assertTrue(float actual);
float getIntakeAirTemperature(void); void assertTrueM(char *msg, float actual);
float getCoolantTemperature(void); void assertFalse(float actual);
float getVBatt(void); void assertFalseM(char *msg, float actual);
float getMaf(void);
float getIntakeAirTemperature(void);
#define systicks2ms(x) (0) float getCoolantTemperature(void);
float getVBatt(void);
#ifdef __cplusplus float getMaf(void);
}
#endif #define systicks2ms(x) (0)
#ifdef __cplusplus
#endif /* MAIN_H_ */ }
#endif
#endif /* MAIN_H_ */

View File

@ -1,8 +1,9 @@
junction controllers_algo ..\firmware\controllers\algo junction controllers_algo ..\firmware\controllers\algo
junction controllers_math ..\firmware\controllers\math junction controllers_math ..\firmware\controllers\math
junction engines ..\firmware\config\engines junction controllers_trigger ..\firmware\controllers\trigger
junction controllers_sensors ..\firmware\controllers\sensors junction engines ..\firmware\config\engines
junction util ..\firmware\util junction controllers_sensors ..\firmware\controllers\sensors
junction ext_algo ..\firmware\ext_algo junction util ..\firmware\util
junction ext_algo ..\firmware\ext_algo

View File

@ -1,176 +1,176 @@
/** /**
* @file map_resize.c * @file map_resize.c
* *
* @date Jan 12, 2014 * @date Jan 12, 2014
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include <stdio.h> #include <stdio.h>
#include "fuel_math.h" #include "fuel_math.h"
#include "interpolation.h" #include "interpolation.h"
#include "engines.h" #include "engines.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "main.h" #include "main.h"
#include "idle_controller.h" #include "idle_controller.h"
#if 1 #if 1
#define AD_LOAD_COUNT 16 #define AD_LOAD_COUNT 16
#define AD_RPM_COUNT 16 #define AD_RPM_COUNT 16
static float ad_rpm_table[] = {/*0*/ 800.000000, static float ad_rpm_table[] = {/*0*/ 800.000000,
/*1*/ 1213.333374, /*1*/ 1213.333374,
/*2*/ 1626.666748, /*2*/ 1626.666748,
/*3*/ 2040.000000, /*3*/ 2040.000000,
/*4*/ 2453.333496, /*4*/ 2453.333496,
/*5*/ 2866.666748, /*5*/ 2866.666748,
/*6*/ 3280.000000, /*6*/ 3280.000000,
/*7*/ 3693.333496, /*7*/ 3693.333496,
/*8*/ 4106.666992, /*8*/ 4106.666992,
/*9*/ 4520.000000, /*9*/ 4520.000000,
/*10*/ 4933.333496, /*10*/ 4933.333496,
/*11*/ 5346.666992, /*11*/ 5346.666992,
/*12*/ 5760.000000, /*12*/ 5760.000000,
/*13*/ 6173.333496, /*13*/ 6173.333496,
/*14*/ 6586.666992, /*14*/ 6586.666992,
/*15*/ 7000.000000, /*15*/ 7000.000000,
};; };;
static float ad_maf_table[] = static float ad_maf_table[] =
{/*0*/ 1.200000, {/*0*/ 1.200000,
/*1*/ 1.413333, /*1*/ 1.413333,
/*2*/ 1.626667, /*2*/ 1.626667,
/*3*/ 1.840000, /*3*/ 1.840000,
/*4*/ 2.053333, /*4*/ 2.053333,
/*5*/ 2.266667, /*5*/ 2.266667,
/*6*/ 2.480000, /*6*/ 2.480000,
/*7*/ 2.693333, /*7*/ 2.693333,
/*8*/ 2.906667, /*8*/ 2.906667,
/*9*/ 3.120000, /*9*/ 3.120000,
/*10*/ 3.333333, /*10*/ 3.333333,
/*11*/ 3.546667, /*11*/ 3.546667,
/*12*/ 3.760000, /*12*/ 3.760000,
/*13*/ 3.973333, /*13*/ 3.973333,
/*14*/ 4.186667, /*14*/ 4.186667,
/*15*/ 4.400000, /*15*/ 4.400000,
}; };
static float ad_table[AD_LOAD_COUNT][AD_RPM_COUNT] = { static float ad_table[AD_LOAD_COUNT][AD_RPM_COUNT] = {
/* RPM 800.000000 1213.333374 1626.666748 2040.000000 2453.333496 2866.666748 3280.000000 3693.333496 4106.666992 4520.000000 4933.333496 5346.666992 5760.000000 6173.333496 6586.666992 7000.000000*/ /* RPM 800.000000 1213.333374 1626.666748 2040.000000 2453.333496 2866.666748 3280.000000 3693.333496 4106.666992 4520.000000 4933.333496 5346.666992 5760.000000 6173.333496 6586.666992 7000.000000*/
/* Load 1.200000 */{ 0.662000, -7.730000, -16.722000, -23.139999, -29.398001, -31.268000, -32.108002, -30.436001, -30.896000, -26.656000, -24.704000, -25.108000, -25.132000, -25.459999, -25.459999, -25.459999}, /* Load 1.200000 */{ 0.662000, -7.730000, -16.722000, -23.139999, -29.398001, -31.268000, -32.108002, -30.436001, -30.896000, -26.656000, -24.704000, -25.108000, -25.132000, -25.459999, -25.459999, -25.459999},
/* Load 1.413333 */{ 0.546000, -7.662000, -16.882000, -23.482000, -29.520000, -31.323999, -32.108002, -30.656000, -30.468000, -26.879999, -24.746000, -24.742001, -29.032000, -25.562000, -25.562000, -25.562000}, /* Load 1.413333 */{ 0.546000, -7.662000, -16.882000, -23.482000, -29.520000, -31.323999, -32.108002, -30.656000, -30.468000, -26.879999, -24.746000, -24.742001, -29.032000, -25.562000, -25.562000, -25.562000},
/* Load 1.626667 */{ 0.584000, -7.870000, -16.714001, -23.025999, -29.542000, -31.166000, -32.175999, -30.540001, -30.268000, -26.416000, -24.134001, -25.007999, -24.698000, -26.167999, -26.167999, -26.167999}, /* Load 1.626667 */{ 0.584000, -7.870000, -16.714001, -23.025999, -29.542000, -31.166000, -32.175999, -30.540001, -30.268000, -26.416000, -24.134001, -25.007999, -24.698000, -26.167999, -26.167999, -26.167999},
/* Load 1.840000 */{ 0.584000, -7.658000, -16.714001, -23.254000, -29.351999, -30.978001, -32.141998, -30.874001, -30.896000, -26.507999, -24.558001, -24.389999, -25.761999, -35.492001, -35.492001, -35.492001}, /* Load 1.840000 */{ 0.584000, -7.658000, -16.714001, -23.254000, -29.351999, -30.978001, -32.141998, -30.874001, -30.896000, -26.507999, -24.558001, -24.389999, -25.761999, -35.492001, -35.492001, -35.492001},
/* Load 2.053333 */{ 0.584000, -7.862000, -16.538000, -23.254000, -29.232000, -31.296000, -32.520000, -30.142000, -30.388000, -25.903999, -24.370001, -24.082001, -24.792000, -24.351999, -24.351999, -24.351999}, /* Load 2.053333 */{ 0.584000, -7.862000, -16.538000, -23.254000, -29.232000, -31.296000, -32.520000, -30.142000, -30.388000, -25.903999, -24.370001, -24.082001, -24.792000, -24.351999, -24.351999, -24.351999},
/* Load 2.266667 */{ -1.364000, -7.726000, -16.806000, -23.254000, -29.639999, -31.006001, -32.298000, -30.912001, -29.882000, -26.392000, -24.664000, -27.233999, -25.374001, -25.417999, -25.417999, -25.417999}, /* Load 2.266667 */{ -1.364000, -7.726000, -16.806000, -23.254000, -29.639999, -31.006001, -32.298000, -30.912001, -29.882000, -26.392000, -24.664000, -27.233999, -25.374001, -25.417999, -25.417999, -25.417999},
/* Load 2.480000 */{ 1.364000, -10.490000, -16.705999, -22.441999, -28.101999, -30.238001, -32.363998, -30.719999, -30.896000, -26.608000, -24.664000, -24.431999, -24.500000, -25.510000, -25.510000, -25.510000}, /* Load 2.480000 */{ 1.364000, -10.490000, -16.705999, -22.441999, -28.101999, -30.238001, -32.363998, -30.719999, -30.896000, -26.608000, -24.664000, -24.431999, -24.500000, -25.510000, -25.510000, -25.510000},
/* Load 2.693333 */{ 9.864000, -10.416000, -11.680000, -19.150000, -25.754000, -27.936001, -32.554001, -30.656000, -30.153999, -27.184000, -25.252001, -22.812000, -24.452000, -25.219999, -25.219999, -25.219999}, /* Load 2.693333 */{ 9.864000, -10.416000, -11.680000, -19.150000, -25.754000, -27.936001, -32.554001, -30.656000, -30.153999, -27.184000, -25.252001, -22.812000, -24.452000, -25.219999, -25.219999, -25.219999},
/* Load 2.906667 */{ 9.866000, 5.452000, 2.854000, -17.212000, -17.552000, -20.688000, -25.660000, -27.809999, -27.691999, -27.224001, -25.882000, -25.360001, -26.100000, -27.992001, -27.992001, -27.992001}, /* Load 2.906667 */{ 9.866000, 5.452000, 2.854000, -17.212000, -17.552000, -20.688000, -25.660000, -27.809999, -27.691999, -27.224001, -25.882000, -25.360001, -26.100000, -27.992001, -27.992001, -27.992001},
/* Load 3.120000 */{ 9.864000, 5.452000, 2.854000, -0.342000, -12.526000, -16.218000, -21.364000, -27.590000, -25.780001, -24.170000, -24.664000, -25.584000, -26.490000, -31.968000, -31.968000, -31.968000}, /* Load 3.120000 */{ 9.864000, 5.452000, 2.854000, -0.342000, -12.526000, -16.218000, -21.364000, -27.590000, -25.780001, -24.170000, -24.664000, -25.584000, -26.490000, -31.968000, -31.968000, -31.968000},
/* Load 3.333333 */{ 9.864000, 5.516000, 2.854000, -0.226000, -2.738000, -3.816000, -11.924000, -18.808001, -21.038000, -21.538000, -21.209999, -22.228001, -25.046000, -25.156000, -25.156000, -25.156000}, /* Load 3.333333 */{ 9.864000, 5.516000, 2.854000, -0.226000, -2.738000, -3.816000, -11.924000, -18.808001, -21.038000, -21.538000, -21.209999, -22.228001, -25.046000, -25.156000, -25.156000, -25.156000},
/* Load 3.546667 */{ 9.866000, 5.518000, 2.854000, 0.000000, -3.022000, -3.816000, -6.428000, -7.788000, -19.426001, -20.860001, -19.966000, -21.030001, -21.396000, -21.570000, -21.570000, -21.570000}, /* Load 3.546667 */{ 9.866000, 5.518000, 2.854000, 0.000000, -3.022000, -3.816000, -6.428000, -7.788000, -19.426001, -20.860001, -19.966000, -21.030001, -21.396000, -21.570000, -21.570000, -21.570000},
/* Load 3.760000 */{ 9.864000, 5.516000, 2.772000, -0.226000, -2.732000, -3.500000, -6.798000, -8.102000, -8.660000, -9.500000, -11.788000, -20.132000, -20.072001, -20.510000, -20.510000, -20.510000}, /* Load 3.760000 */{ 9.864000, 5.516000, 2.772000, -0.226000, -2.732000, -3.500000, -6.798000, -8.102000, -8.660000, -9.500000, -11.788000, -20.132000, -20.072001, -20.510000, -20.510000, -20.510000},
/* Load 3.973333 */{ 9.864000, 5.518000, 2.854000, 0.000000, -2.880000, -3.816000, -6.420000, -8.320000, -8.426000, -8.532000, -11.470000, -11.442000, -13.610000, -12.022000, -12.022000, -12.022000}, /* Load 3.973333 */{ 9.864000, 5.518000, 2.854000, 0.000000, -2.880000, -3.816000, -6.420000, -8.320000, -8.426000, -8.532000, -11.470000, -11.442000, -13.610000, -12.022000, -12.022000, -12.022000},
/* Load 4.186667 */{ 9.750000, 5.518000, 2.604000, 0.000000, -2.880000, -3.654000, -6.050000, -6.888000, -8.372000, -9.364000, -11.764000, -11.732000, -11.864000, -12.376000, -12.376000, -12.376000}, /* Load 4.186667 */{ 9.750000, 5.518000, 2.604000, 0.000000, -2.880000, -3.654000, -6.050000, -6.888000, -8.372000, -9.364000, -11.764000, -11.732000, -11.864000, -12.376000, -12.376000, -12.376000},
/* Load 4.400000 */{ 0.350000, 5.590000, 0.502000, 0.910000, 0.864000, 0.954000, 1.324000, -7.436000, 1.170000, 1.054000, 2.058000, 2.098000, 2.636000, -12.352000, -12.352000, -12.352000} /* Load 4.400000 */{ 0.350000, 5.590000, 0.502000, 0.910000, 0.864000, 0.954000, 1.324000, -7.436000, 1.170000, 1.054000, 2.058000, 2.098000, 2.636000, -12.352000, -12.352000, -12.352000}
}; };
//float getBaseAdvance(int rpm, float key) { //float getBaseAdvance(int rpm, float key) {
// // todo: use interpolation // // todo: use interpolation
// int rpm_index = findIndex(ad_rpm_table, AD_RPM_COUNT, rpm); // int rpm_index = findIndex(ad_rpm_table, AD_RPM_COUNT, rpm);
// rpm_index = max(rpm_index, 0); // rpm_index = max(rpm_index, 0);
// int maf_index = findIndex(ad_maf_table, AD_LOAD_COUNT, key); // int maf_index = findIndex(ad_maf_table, AD_LOAD_COUNT, key);
// maf_index = max(maf_index, 0); // maf_index = max(maf_index, 0);
// //
// return ad_table[rpm_index][maf_index]; // return ad_table[rpm_index][maf_index];
//} //}
#define newRpmSize 16 #define newRpmSize 16
#define newKeySize 16 #define newKeySize 16
static float newRpmBin[newRpmSize]; static float newRpmBin[newRpmSize];
static float newKeyBin[newKeySize]; static float newKeyBin[newKeySize];
//static float *fuel_ptrs[FUEL_LOAD_COUNT]; //static float *fuel_ptrs[FUEL_LOAD_COUNT];
//EngineConfiguration *engineConfiguration; //EngineConfiguration *engineConfiguration;
extern int needInterpolationLogging; extern int needInterpolationLogging;
void resizeMap(void) { void resizeMap(void) {
// float keyMin = 1.2; // float keyMin = 1.2;
// float keyMax = 4.4; // float keyMax = 4.4;
// //
// float rpmMin = 800; // float rpmMin = 800;
// float rpmMax = 7000; // float rpmMax = 7000;
// for (int k = 0; k < FUEL_LOAD_COUNT; k++) // for (int k = 0; k < FUEL_LOAD_COUNT; k++)
// fuel_ptrs[k] = engineConfiguration->fuelTable[k]; // fuel_ptrs[k] = engineConfiguration->fuelTable[k];
// for (int i = 0; i < FUEL_MAF_COUNT; i++) // for (int i = 0; i < FUEL_MAF_COUNT; i++)
// engineConfiguration->fuelKeyBins[i] = default_fuel_maf_bins[i]; // engineConfiguration->fuelKeyBins[i] = default_fuel_maf_bins[i];
// for (int i = 0; i < FUEL_RPM_COUNT; i++) // for (int i = 0; i < FUEL_RPM_COUNT; i++)
// engineConfiguration->fuelRpmBins[i] = default_fuel_rpm_bins[i]; // engineConfiguration->fuelRpmBins[i] = default_fuel_rpm_bins[i];
// for (int k = 0; k < FUEL_MAF_COUNT; k++) { // for (int k = 0; k < FUEL_MAF_COUNT; k++) {
// for (int r = 0; r < FUEL_RPM_COUNT; r++) { // for (int r = 0; r < FUEL_RPM_COUNT; r++) {
// // todo: this is BAD, this needs to be fixed - TS table indexes are different from default indexes // // todo: this is BAD, this needs to be fixed - TS table indexes are different from default indexes
// engineConfiguration->fuelTable[k][r] = default_fuel_table[r][k]; // engineConfiguration->fuelTable[k][r] = default_fuel_table[r][k];
// } // }
// } // }
// assertEquals(15, interpolate3d(1.2, engineConfiguration->fuelKeyBins, FUEL_MAF_COUNT, 8000, // assertEquals(15, interpolate3d(1.2, engineConfiguration->fuelKeyBins, FUEL_MAF_COUNT, 8000,
// engineConfiguration->fuelRpmBins, // engineConfiguration->fuelRpmBins,
// FUEL_RPM_COUNT, fuel_ptrs)); // FUEL_RPM_COUNT, fuel_ptrs));
needInterpolationLogging = 0; needInterpolationLogging = 0;
// printf("static float ad_maf_table[AD_LOAD_COUNT] = {"); // printf("static float ad_maf_table[AD_LOAD_COUNT] = {");
// for (int i = 0; i < newKeySize; i++) { // for (int i = 0; i < newKeySize; i++) {
// newKeyBin[i] = interpolate(0, keyMin, newKeySize - 1, keyMax, i); // newKeyBin[i] = interpolate(0, keyMin, newKeySize - 1, keyMax, i);
// printf("/*%d*/ %f,\r\n", i, newKeyBin[i]); // printf("/*%d*/ %f,\r\n", i, newKeyBin[i]);
// } // }
// printf("};\r\n"); // printf("};\r\n");
// //
// printf("static float ad_rpm_table[AD_RPM_COUNT] = {"); // printf("static float ad_rpm_table[AD_RPM_COUNT] = {");
// for (int i = 0; i < newRpmSize; i++) { // for (int i = 0; i < newRpmSize; i++) {
// newRpmBin[i] = interpolate(0, rpmMin, newRpmSize - 1, rpmMax, i); // newRpmBin[i] = interpolate(0, rpmMin, newRpmSize - 1, rpmMax, i);
// printf("/*%d*/ %f,\r\n", i, newRpmBin[i]); // printf("/*%d*/ %f,\r\n", i, newRpmBin[i]);
// } // }
// printf("};\r\n"); // printf("};\r\n");
printf("static float ad_table[AD_RPM_COUNT][AD_LOAD_COUNT] = {\r\n"); printf("static float ad_table[AD_RPM_COUNT][AD_LOAD_COUNT] = {\r\n");
printf("/* RPM\t\t"); printf("/* RPM\t\t");
for (int r = 0; r < newRpmSize; r++) { for (int r = 0; r < newRpmSize; r++) {
float rpm = newRpmBin[r]; float rpm = newRpmBin[r];
printf("\t%f", rpm); printf("\t%f", rpm);
} }
printf("*/\r\n"); printf("*/\r\n");
for (int k = 0; k < newKeySize; k++) { for (int k = 0; k < newKeySize; k++) {
float load = newKeyBin[k]; float load = newKeyBin[k];
printf("/* Load %f */{", load); printf("/* Load %f */{", load);
for (int r = 0; r < newRpmSize; r++) { for (int r = 0; r < newRpmSize; r++) {
float rpm = newRpmBin[r]; float rpm = newRpmBin[r];
float v = ad_table[k][r]; float v = ad_table[k][r];
printf("\t%f", v); printf("\t%f", v);
if (r != newRpmSize - 1) if (r != newRpmSize - 1)
printf(","); printf(",");
} }
printf("}"); printf("}");
if (k != newKeySize - 1) if (k != newKeySize - 1)
printf(","); printf(",");
printf("\r\n"); printf("\r\n");
} }
printf("};\r\n"); printf("};\r\n");
} }
#endif #endif

View File

@ -1,13 +1,13 @@
/** /**
* @file map_resize.h * @file map_resize.h
* *
* @date Jan 12, 2014 * @date Jan 12, 2014
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef MAP_RESIZE_H_ #ifndef MAP_RESIZE_H_
#define MAP_RESIZE_H_ #define MAP_RESIZE_H_
void resizeMap(void); void resizeMap(void);
#endif /* MAP_RESIZE_H_ */ #endif /* MAP_RESIZE_H_ */

View File

@ -1,6 +1,6 @@
In this folder we have a naive test set. I am not sure what is the best approach to tests in C (someone can educate me), but my approach is: In this folder we have a naive test set. I am not sure what is the best approach to tests in C (someone can educate me), but my approach is:
1) with a symlink linking some (only some, not all) folders of the firmware implementation, we can compile some files of the firmware as win32 code. 1) with a symlink linking some (only some, not all) folders of the firmware implementation, we can compile some files of the firmware as win32 code.
Please execute the 'makelinks.bat' file to get the links. On XP you might need to execute 'junction.exe' before exuting the .bat file. Please execute the 'makelinks.bat' file to get the links. On XP you might need to execute 'junction.exe' before exuting the .bat file.
2) we then compile & run the .exe, which is expected to say SUCCESS and not fail :) 2) we then compile & run the .exe, which is expected to say SUCCESS and not fail :)

View File

@ -1,168 +1,168 @@
# ARM Cortex-Mx common makefile scripts and rules. # ARM Cortex-Mx common makefile scripts and rules.
# Output directory and files # Output directory and files
ifeq ($(BUILDDIR),) ifeq ($(BUILDDIR),)
BUILDDIR = build BUILDDIR = build
endif endif
ifeq ($(BUILDDIR),.) ifeq ($(BUILDDIR),.)
BUILDDIR = build BUILDDIR = build
endif endif
OUTFILES = $(BUILDDIR)/$(PROJECT) OUTFILES = $(BUILDDIR)/$(PROJECT)
# Automatic compiler options # Automatic compiler options
OPT = $(USE_OPT) OPT = $(USE_OPT)
COPT = $(USE_COPT) COPT = $(USE_COPT)
CPPOPT = $(USE_CPPOPT) CPPOPT = $(USE_CPPOPT)
ifeq ($(USE_LINK_GC),yes) ifeq ($(USE_LINK_GC),yes)
OPT += -ffunction-sections -fdata-sections -fno-common OPT += -ffunction-sections -fdata-sections -fno-common
endif endif
# Source files groups and paths # Source files groups and paths
ifeq ($(USE_THUMB),yes) ifeq ($(USE_THUMB),yes)
TCSRC += $(CSRC) TCSRC += $(CSRC)
TCPPSRC += $(CPPSRC) TCPPSRC += $(CPPSRC)
else else
ACSRC += $(CSRC) ACSRC += $(CSRC)
ACPPSRC += $(CPPSRC) ACPPSRC += $(CPPSRC)
endif endif
ASRC = $(ACSRC)$(ACPPSRC) ASRC = $(ACSRC)$(ACPPSRC)
TSRC = $(TCSRC)$(TCPPSRC) TSRC = $(TCSRC)$(TCPPSRC)
SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC))) SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC)))
# Various directories # Various directories
OBJDIR = $(BUILDDIR)/obj OBJDIR = $(BUILDDIR)/obj
LSTDIR = $(BUILDDIR)/lst LSTDIR = $(BUILDDIR)/lst
# Object files groups # Object files groups
ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o))) ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o)))
ACPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACPPSRC:.cpp=.o))) ACPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACPPSRC:.cpp=.o)))
TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o))) TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o)))
TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o))) TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o)))
ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o))) ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o)))
ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o))) ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o)))
OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS) OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS)
# Paths # Paths
IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)) IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
# Macros # Macros
DEFS = $(DDEFS) $(UDEFS) DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS) ADEFS = $(DADEFS) $(UADEFS)
# Libs # Libs
LIBS = $(DLIBS) $(ULIBS) LIBS = $(DLIBS) $(ULIBS)
# Various settings # Various settings
#MCFLAGS = -mcpu=$(MCU) #MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS) CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS) CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
ifeq ($(USE_LINK_GC),yes) ifeq ($(USE_LINK_GC),yes)
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
else else
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
endif endif
# Generate dependency information # Generate dependency information
CFLAGS += -MD -MP -MF .dep/$(@F).d CFLAGS += -MD -MP -MF .dep/$(@F).d
CPPFLAGS += -MD -MP -MF .dep/$(@F).d CPPFLAGS += -MD -MP -MF .dep/$(@F).d
# Paths where to search for sources # Paths where to search for sources
VPATH = $(SRCPATHS) VPATH = $(SRCPATHS)
# #
# Makefile rules # Makefile rules
# #
all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK
MAKE_ALL_RULE_HOOK: MAKE_ALL_RULE_HOOK:
$(OBJS): | $(BUILDDIR) $(OBJS): | $(BUILDDIR)
$(BUILDDIR) $(OBJDIR) $(LSTDIR): $(BUILDDIR) $(OBJDIR) $(LSTDIR):
ifneq ($(USE_VERBOSE_COMPILE),yes) ifneq ($(USE_VERBOSE_COMPILE),yes)
@echo Compiler Options @echo Compiler Options
@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o @echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o
@echo @echo
endif endif
mkdir -p $(OBJDIR) mkdir -p $(OBJDIR)
mkdir -p $(LSTDIR) mkdir -p $(LSTDIR)
$(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile $(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ $(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ @$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(TCPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile $(TCPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(ACOBJS) : $(OBJDIR)/%.o : %.c Makefile $(ACOBJS) : $(OBJDIR)/%.o : %.c Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(TCOBJS) : $(OBJDIR)/%.o : %.c Makefile $(TCOBJS) : $(OBJDIR)/%.o : %.c Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(ASMOBJS) : $(OBJDIR)/%.o : %.s Makefile $(ASMOBJS) : $(OBJDIR)/%.o : %.s Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@ $(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@ @$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@
endif endif
$(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile $(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(BUILDDIR)/$(PROJECT): $(OBJS) $(BUILDDIR)/$(PROJECT): $(OBJS)
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ $(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
else else
@echo Linking $@ @echo Linking $@
@$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ @$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
endif endif
clean: clean:
@echo Cleaning @echo Cleaning
-rm -fR .dep $(BUILDDIR) -rm -fR .dep $(BUILDDIR)
@echo Done @echo Done
# #
# Include the dependency files, should be the last of the makefile # Include the dependency files, should be the last of the makefile
# #
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF *** # *** EOF ***

View File

@ -1,13 +1,13 @@
/** /**
* @file settings.h * @file settings.h
* *
* @date Feb 13, 2014 * @date Feb 13, 2014
* @author Andrey Belomutskiy, (c) 2012-2014 * @author Andrey Belomutskiy, (c) 2012-2014
*/ */
#ifndef SETTINGS_H_ #ifndef SETTINGS_H_
#define SETTINGS_H_ #define SETTINGS_H_
#endif /* SETTINGS_H_ */ #endif /* SETTINGS_H_ */

View File

@ -1,14 +1,15 @@
TEST_SRC_C = boards.c \ TEST_SRC_C = boards.c \
test_data_structures/test_engine_math.c \ test_data_structures/test_engine_math.c \
test_event_registry.c \ test_basic_math/test_find_index.c \
test_basic_math/test_find_index.c \ test_basic_math/test_interpolation_3d.c \
test_basic_math/test_interpolation_3d.c \ test_idle_controller.c \
test_fuel_map.c \ test_sensors.c
test_idle_controller.c \
test_trigger_decoder.c \ TEST_SRC_CPP = test_util.cpp \
test_sensors.c \ test_data_structures/test_event_registry.cpp \
test_signal_executor.c test_trigger_decoder.cpp \
test_fuel_map.cpp \
TEST_SRC_CPP = test_util.cpp test_signal_executor.cpp

View File

@ -1,120 +1,120 @@
/* /*
* test_find_index.c * test_find_index.c
* *
* Created on: Oct 30, 2013 * Created on: Oct 30, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "engine_math.h" #include "engine_math.h"
#include "main.h" #include "main.h"
#include "interpolation.h" #include "interpolation.h"
#include <stdio.h> #include <stdio.h>
#include "engine_configuration.h" #include "engine_configuration.h"
void testFindIndex(void) { void testFindIndex(void) {
printf("*************************************************** testFindIndex\r\n"); printf("*************************************************** testFindIndex\r\n");
float array[] = { 1, 2, 3, 4, 5 }; float array[] = { 1, 2, 3, 4, 5 };
int size = 4; int size = 4;
int result; int result;
printf("To the left\r\n"); printf("To the left\r\n");
result = findIndex(array, size, -1.0); result = findIndex(array, size, -1.0);
assertEquals(-1, result); assertEquals(-1, result);
printf("To the right4\r\n"); printf("To the right4\r\n");
result = findIndex(array, size, 10.0); result = findIndex(array, size, 10.0);
assertEquals(3, result); assertEquals(3, result);
printf("To the right5\r\n"); printf("To the right5\r\n");
result = findIndex(array, 5, 10.0); result = findIndex(array, 5, 10.0);
assertEquals(4, result); assertEquals(4, result);
printf("On the edge\r\n"); printf("On the edge\r\n");
result = findIndex(array, size, 4.0); result = findIndex(array, size, 4.0);
assertEquals(3, result); assertEquals(3, result);
printf("Another1\r\n"); printf("Another1\r\n");
result = findIndex(array, size, 3.9); result = findIndex(array, size, 3.9);
assertEquals(2, result); assertEquals(2, result);
printf("Another2\r\n"); printf("Another2\r\n");
result = findIndex(array, size, 4.1); result = findIndex(array, size, 4.1);
assertEquals(3, result); assertEquals(3, result);
printf("Another3\r\n"); printf("Another3\r\n");
result = findIndex(array, size, 2); result = findIndex(array, size, 2);
assertEquals(1, result); assertEquals(1, result);
printf("Left edge1\r\n"); printf("Left edge1\r\n");
result = findIndex(array, size, 1); result = findIndex(array, size, 1);
assertEquals(0, result); assertEquals(0, result);
printf("Left edge2\r\n"); printf("Left edge2\r\n");
result = findIndex(array, size, 1.1); result = findIndex(array, size, 1.1);
assertEquals(0, result); assertEquals(0, result);
printf("Middle\r\n"); printf("Middle\r\n");
result = findIndex(array, size, 3); result = findIndex(array, size, 3);
assertEquals(2, result); assertEquals(2, result);
size = 5; // now test with off array size size = 5; // now test with off array size
printf("Middle2\r\n"); printf("Middle2\r\n");
result = findIndex(array, size, 4); result = findIndex(array, size, 4);
assertEquals(3, result); assertEquals(3, result);
printf("Middle2\r\n"); printf("Middle2\r\n");
result = findIndex(array, size, 3.1); result = findIndex(array, size, 3.1);
assertEquals(2, result); assertEquals(2, result);
} }
//static float getValue2(float key, float maf) { //static float getValue2(float key, float maf) {
// //
//} //}
void testInterpolate2d(void) { void testInterpolate2d(void) {
printf("*************************************************** testInterpolate2d\r\n"); printf("*************************************************** testInterpolate2d\r\n");
float bins4[] = { 1, 2, 3, 4 }; float bins4[] = { 1, 2, 3, 4 };
float values4[] = { 1, 20, 30, 400 }; float values4[] = { 1, 20, 30, 400 };
int size = 4; int size = 4;
int result; int result;
printf("Left size\r\n"); printf("Left size\r\n");
result = interpolate2d(0, bins4, values4, size); result = interpolate2d(0, bins4, values4, size);
assertEquals(1, result); assertEquals(1, result);
printf("Right size\r\n"); printf("Right size\r\n");
result = interpolate2d(10, bins4, values4, size); result = interpolate2d(10, bins4, values4, size);
assertEquals(400, result); assertEquals(400, result);
printf("Middle1\r\n"); printf("Middle1\r\n");
result = interpolate2d(3, bins4, values4, size); result = interpolate2d(3, bins4, values4, size);
assertEquals(30, result); assertEquals(30, result);
printf("Middle1\r\n"); printf("Middle1\r\n");
result = interpolate2d(3.5, bins4, values4, size); result = interpolate2d(3.5, bins4, values4, size);
assertEquals(215, result); assertEquals(215, result);
} }
static engine_configuration_s engineConfiguration; static engine_configuration_s engineConfiguration;
void testSetTableValue(void) { void testSetTableValue(void) {
printf("*************************************************** testSetTableValue\r\n"); printf("*************************************************** testSetTableValue\r\n");
for (int i = 0; i < CLT_CURVE_SIZE; i++) { for (int i = 0; i < CLT_CURVE_SIZE; i++) {
engineConfiguration.cltFuelCorrBins[i] = -40 + i * 10; engineConfiguration.cltFuelCorrBins[i] = -40 + i * 10;
engineConfiguration.cltFuelCorr[i] = 1; engineConfiguration.cltFuelCorr[i] = 1;
} }
assertEquals(1, engineConfiguration.cltFuelCorr[0]); assertEquals(1, engineConfiguration.cltFuelCorr[0]);
setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5); setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
assertEquals(1.5, engineConfiguration.cltFuelCorr[0]); assertEquals(1.5, engineConfiguration.cltFuelCorr[0]);
setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -50, 1.4); setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -50, 1.4);
assertEquals(1.4, engineConfiguration.cltFuelCorr[0]); assertEquals(1.4, engineConfiguration.cltFuelCorr[0]);
} }

View File

@ -1,15 +1,15 @@
/* /*
* test_find_index.h * test_find_index.h
* *
* Created on: Oct 30, 2013 * Created on: Oct 30, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_FIND_INDEX_H_ #ifndef TEST_FIND_INDEX_H_
#define TEST_FIND_INDEX_H_ #define TEST_FIND_INDEX_H_
void testFindIndex(void); void testFindIndex(void);
void testInterpolate2d(void); void testInterpolate2d(void);
void testSetTableValue(void); void testSetTableValue(void);
#endif /* TEST_FIND_INDEX_H_ */ #endif /* TEST_FIND_INDEX_H_ */

View File

@ -1,70 +1,70 @@
/* /*
* Created on: Oct 17, 2013 * Created on: Oct 17, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
/** /**
* @file test_interpolation_3d.c * @file test_interpolation_3d.c
*/ */
#include "test_interpolation_3d.h" #include "test_interpolation_3d.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "interpolation.h" #include "interpolation.h"
#include "main.h" #include "main.h"
float rpmBins[5] = { 100, 200, 300, 400, 500 }; float rpmBins[5] = { 100, 200, 300, 400, 500 };
float mafBins[4] = { 1, 2, 3, 4 }; float mafBins[4] = { 1, 2, 3, 4 };
float map0[4] = { 1, 2, 3, 4 }; float map0[4] = { 1, 2, 3, 4 };
float map1[4] = { 2, 3, 4, 5 }; float map1[4] = { 2, 3, 4, 5 };
float map2[4] = { 3, 4, 200, 300 }; float map2[4] = { 3, 4, 200, 300 };
float map3[4] = { 4, 200, 500, 600 }; float map3[4] = { 4, 200, 500, 600 };
float map4[4] = { 4, 200, 500, 600 }; float map4[4] = { 4, 200, 500, 600 };
float *map[5] = { map0, map1, map2, map3, map4 }; float *map[5] = { map0, map1, map2, map3, map4 };
static float getValue(float rpm, float maf) { static float getValue(float rpm, float maf) {
return interpolate3d(rpm, rpmBins, 5, maf, mafBins, 4, map); return interpolate3d(rpm, rpmBins, 5, maf, mafBins, 4, map);
} }
void testInterpolate3d(void) { void testInterpolate3d(void) {
printf("*************************************************** testInterpolate3d\r\n"); printf("*************************************************** testInterpolate3d\r\n");
float dwell; float dwell;
printf("*** no interpolation here 1\r\n"); printf("*** no interpolation here 1\r\n");
dwell = getValue(100, 2); dwell = getValue(100, 2);
assertEquals(2, dwell); assertEquals(2, dwell);
printf("*** no interpolation here 2\r\n"); printf("*** no interpolation here 2\r\n");
dwell = getValue(200, 4); dwell = getValue(200, 4);
assertEquals(5, dwell); assertEquals(5, dwell);
printf("*** rpm interpolated value expected1\r\n"); printf("*** rpm interpolated value expected1\r\n");
dwell = getValue(150, 2); dwell = getValue(150, 2);
assertEquals(2.5, dwell); assertEquals(2.5, dwell);
printf("*** rpm interpolated value expected2\r\n"); printf("*** rpm interpolated value expected2\r\n");
dwell = getValue(250, 3); dwell = getValue(250, 3);
assertEquals(102, dwell); assertEquals(102, dwell);
printf("*** both rpm and maf interpolated value expected\r\n"); printf("*** both rpm and maf interpolated value expected\r\n");
dwell = getValue(335.3, 3.551); dwell = getValue(335.3, 3.551);
assertEquals(361, dwell); assertEquals(361, dwell);
printf("*** both rpm and maf interpolated value expected 2\r\n"); printf("*** both rpm and maf interpolated value expected 2\r\n");
dwell = getValue(410.01, 2.012); dwell = getValue(410.01, 2.012);
assertEquals(203.6, dwell); assertEquals(203.6, dwell);
printf("*** both rpm and maf interpolated value expected 3\r\n"); printf("*** both rpm and maf interpolated value expected 3\r\n");
dwell = getValue(1000000, 1000); dwell = getValue(1000000, 1000);
assertEquals(600, dwell); assertEquals(600, dwell);
printf("*** both rpm and maf interpolated value expected 4\r\n"); printf("*** both rpm and maf interpolated value expected 4\r\n");
dwell = getValue(410.01, -1); dwell = getValue(410.01, -1);
assertEquals(4, dwell); assertEquals(4, dwell);
dwell = getValue(-1, -1); dwell = getValue(-1, -1);
assertEquals(1, dwell); assertEquals(1, dwell);
} }

View File

@ -1,16 +1,16 @@
/* /*
* Created on: Oct 17, 2013 * Created on: Oct 17, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
/** /**
* @file test_interpolation_3d.h * @file test_interpolation_3d.h
*/ */
#ifndef TEST_INTERPOLATION_3D_H_ #ifndef TEST_INTERPOLATION_3D_H_
#define TEST_INTERPOLATION_3D_H_ #define TEST_INTERPOLATION_3D_H_
void testInterpolate3d(void); void testInterpolate3d(void);
#endif /* TEST_INTERPOLATION_3D_H_ */ #endif /* TEST_INTERPOLATION_3D_H_ */

View File

@ -1,13 +1,22 @@
/* /*
* test_event_registry.h * test_event_registry.h
* *
* Created on: Nov 27, 2013 * Created on: Nov 27, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_EVENT_REGISTRY_H_ #ifndef TEST_EVENT_REGISTRY_H_
#define TEST_EVENT_REGISTRY_H_ #define TEST_EVENT_REGISTRY_H_
void testEventRegistry(void); #ifdef __cplusplus
extern "C"
#endif /* TEST_EVENT_REGISTRY_H_ */ {
#endif /* __cplusplus */
void testEventRegistry(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_EVENT_REGISTRY_H_ */

View File

@ -1,27 +1,27 @@
/* /*
* @file test_engine_math.c * @file test_engine_math.c
* *
* Created on: Nov 14, 2013 * Created on: Nov 14, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "test_engine_math.h" #include "test_engine_math.h"
#include "main.h" #include "main.h"
#include "engine_math.h" #include "engine_math.h"
#include "engine_configuration.h" #include "engine_configuration.h"
extern engine_configuration_s *engineConfiguration; extern engine_configuration_s *engineConfiguration;
extern engine_configuration2_s *engineConfiguration2; extern engine_configuration2_s *engineConfiguration2;
void testEngineMath(void) { void testEngineMath(void) {
printf("*************************************************** testEngineMath\r\n"); printf("*************************************************** testEngineMath\r\n");
engineConfiguration->rpmMultiplier = 0.5; engineConfiguration->rpmMultiplier = 0.5;
assertEqualsM("600 RPM", 5000, getOneDegreeTime(600) * 180); assertEqualsM("600 RPM", 5000, getOneDegreeTime(600) * 180);
assertEqualsM("6000 RPM", 500, getOneDegreeTime(6000) * 180); assertEqualsM("6000 RPM", 500, getOneDegreeTime(6000) * 180);
} }
float getMap(void) { float getMap(void) {
return 0; return 0;
} }

View File

@ -1,13 +1,13 @@
/* /*
* @file test_engine_math.h * @file test_engine_math.h
* *
* Created on: Nov 14, 2013 * Created on: Nov 14, 2013
* Author: Andrey Belomutskiy, (c) 2012-2013 * Author: Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_ENGINE_MATH_H_ #ifndef TEST_ENGINE_MATH_H_
#define TEST_ENGINE_MATH_H_ #define TEST_ENGINE_MATH_H_
void testEngineMath(void); void testEngineMath(void);
#endif /* TEST_ENGINE_MATH_H_ */ #endif /* TEST_ENGINE_MATH_H_ */

View File

@ -1,15 +1,24 @@
/* /*
* test_fuel_map.h * test_fuel_map.h
* *
* Created on: Nov 6, 2013 * Created on: Nov 6, 2013
* Author: pc * Author: pc
*/ */
#ifndef TEST_FUEL_MAP_H_ #ifndef TEST_FUEL_MAP_H_
#define TEST_FUEL_MAP_H_ #define TEST_FUEL_MAP_H_
void testFuelMap(void); #ifdef __cplusplus
void testAngleResolver(void); extern "C"
void testPinHelper(void); {
#endif /* __cplusplus */
#endif /* TEST_FUEL_MAP_H_ */
void testFuelMap(void);
void testAngleResolver(void);
void testPinHelper(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_FUEL_MAP_H_ */

View File

@ -1,17 +1,17 @@
/* /*
* test_idle_controller.c * test_idle_controller.c
* *
* Created on: Oct 17, 2013 * Created on: Oct 17, 2013
* Author: Andrey * Author: Andrey
*/ */
#include <stdio.h> #include <stdio.h>
void idleDebug(char *msg, int value) { void idleDebug(char *msg, int value) {
printf("%s\r\n", msg); printf("%s\r\n", msg);
} }
void isCranking(void) { void isCranking(void) {
return; return;
} }

View File

@ -1,7 +1,7 @@
#ifndef TEST_IDLE_CONTROLLER_H #ifndef TEST_IDLE_CONTROLLER_H
#define TEST_IDLE_CONTROLLER_H #define TEST_IDLE_CONTROLLER_H
void idleDebug(char *msg, int value); void idleDebug(char *msg, int value);
void isCranking(void); void isCranking(void);
#endif #endif

View File

@ -1,35 +1,52 @@
/** /**
* @file test_sensors.c * @file test_sensors.c
* *
* @date Dec 7, 2013 * @date Dec 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "main.h" #include "main.h"
#include "thermistors.h" #include "thermistors.h"
#include "map.h" #include "allsensors.h"
static ThermistorConf tc; static ThermistorConf tc;
static void testMapDecoding() { static void testMapDecoding(void) {
assertEqualsM("denso 0 volts", -6.64, getMAPValueHonda_Denso183(0)); assertEqualsM("denso 0 volts", -6.64, getMAPValueHonda_Denso183(0));
assertEquals(31.244, getMAPValueHonda_Denso183(1)); assertEquals(31.244, getMAPValueHonda_Denso183(1));
assertEqualsM("MPX_4250 0 volts", 8, getMAPValueMPX_4250(0)); assertEqualsM("MPX_4250 0 volts", 8, getMAPValueMPX_4250(0));
assertEquals(58.4, getMAPValueMPX_4250(1)); assertEquals(58.4, getMAPValueMPX_4250(1));
} }
void testSensors(void) { void testTpsRateOfChange(void) {
print("************************************************** testSensors\r\n"); print("************************************************** testTpsRateOfChange\r\n");
testMapDecoding(); saveTpsState(0, 0);
setThermistorConfiguration(&tc, 32, 9500, 75, 2100, 120, 1000); saveTpsState(CH_FREQUENCY, 50);
assertEquals(50, getTpsRateOfChange());
prepareThermistorCurve(&tc);
saveTpsState(2 * CH_FREQUENCY, 50);
assertEquals(-0.003, tc.s_h_a); assertEquals(0, getTpsRateOfChange());
assertEquals(0.001, tc.s_h_b);
assertEquals(0.0, tc.s_h_c); saveTpsState(3 * CH_FREQUENCY, 75);
assertEquals(25, getTpsRateOfChange());
float t = convertResistanceToKelvinTemperature(2100, &tc);
assertEquals(75 + KELV, t);
} }
void testSensors(void) {
print("************************************************** testSensors\r\n");
testMapDecoding();
testTpsRateOfChange();
setThermistorConfiguration(&tc, 32, 9500, 75, 2100, 120, 1000);
prepareThermistorCurve(&tc);
assertEquals(-0.003, tc.s_h_a);
assertEquals(0.001, tc.s_h_b);
assertEquals(0.0, tc.s_h_c);
float t = convertResistanceToKelvinTemperature(2100, &tc);
assertEquals(75 + KELV, t);
}

View File

@ -1,13 +1,13 @@
/** /**
* @file test_sensors.h * @file test_sensors.h
* *
* @date Dec 7, 2013 * @date Dec 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_SENSORS_H_ #ifndef TEST_SENSORS_H_
#define TEST_SENSORS_H_ #define TEST_SENSORS_H_
void testSensors(void); void testSensors(void);
#endif /* TEST_SENSORS_H_ */ #endif /* TEST_SENSORS_H_ */

View File

@ -1,13 +1,23 @@
/** /**
* @file test_signal_executor.h * @file test_signal_executor.h
* *
* @date Nov 28, 2013 * @date Nov 28, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_SIGNAL_EXECUTOR_H_ #ifndef TEST_SIGNAL_EXECUTOR_H_
#define TEST_SIGNAL_EXECUTOR_H_ #define TEST_SIGNAL_EXECUTOR_H_
void testSignalExecutor(void); #ifdef __cplusplus
extern "C"
#endif /* TEST_SIGNAL_EXECUTOR_H_ */ {
#endif /* __cplusplus */
void testSignalExecutor(void);
int getRevolutionCounter(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_SIGNAL_EXECUTOR_H_ */

View File

@ -1,13 +1,13 @@
/** /**
* @file test_trigger_decoder.h * @file test_trigger_decoder.h
* *
* @date Dec 24, 2013 * @date Dec 24, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_TRIGGER_DECODER_H_ #ifndef TEST_TRIGGER_DECODER_H_
#define TEST_TRIGGER_DECODER_H_ #define TEST_TRIGGER_DECODER_H_
void testTriggerDecoder(void); void testTriggerDecoder(void);
#endif /* TEST_TRIGGER_DECODER_H_ */ #endif /* TEST_TRIGGER_DECODER_H_ */

View File

@ -1,278 +1,294 @@
/** /**
* @file test_util.c * @file test_util.c
* *
* @date Dec 8, 2013 * @date Dec 8, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include <string.h> #include <string.h>
#include "test_util.h" #include "test_util.h"
#include "cyclic_buffer.h" #include "cyclic_buffer.h"
#include "main.h" #include "main.h"
#include "histogram.h" #include "histogram.h"
#include "malfunction_central.h" #include "malfunction_central.h"
#include "eficonsole_logic.h" #include "eficonsole_logic.h"
#include "nmea.h" #include "nmea.h"
#include "efilib2.h"
static cyclic_buffer sb;
static cyclic_buffer sb;
void testCyclicBuffer(void) {
print("*************************************** testCyclicBuffer\r\n"); void testOverflow64Counter(void) {
print("*************************************** testOverflow64Counter\r\n");
sb.add(10);
Overflow64Counter o;
assertEquals(10, sb.sum(3)); assertEquals(0, o.get());
o.offer(10);
sb.add(2); assertEquals(10, o.get());
assertEquals(12, sb.sum(2));
} o.offer(20);
assertEquals(20, o.get());
void testHistogram(void) {
print("******************************************* testHistogram\r\n"); o.offer(0); // overflow
assertEquals(4294967296, o.get());
initHistogramsModule(); }
assertEquals(80, histogramGetIndex(239)); void testCyclicBuffer(void) {
assertEquals(223, histogramGetIndex(239239)); print("*************************************** testCyclicBuffer\r\n");
assertEquals(364, histogramGetIndex(239239239));
sb.add(10);
histogram_s h;
assertEquals(10, sb.sum(3));
initHistogram(&h, "test");
sb.add(2);
int result[5]; assertEquals(12, sb.sum(2));
assertEquals(0, hsReport(&h, result)); }
hsAdd(&h, 10); void testHistogram(void) {
assertEquals(1, hsReport(&h, result)); print("******************************************* testHistogram\r\n");
assertEquals(10, result[0]);
initHistogramsModule();
// let's add same value one more time
hsAdd(&h, 10); assertEquals(80, histogramGetIndex(239));
assertEquals(2, hsReport(&h, result)); assertEquals(223, histogramGetIndex(239239));
assertEquals(10, result[0]); assertEquals(364, histogramGetIndex(239239239));
assertEquals(10, result[1]);
histogram_s h;
hsAdd(&h, 10);
hsAdd(&h, 10); initHistogram(&h, "test");
hsAdd(&h, 10);
int result[5];
hsAdd(&h, 1000); assertEquals(0, hsReport(&h, result));
hsAdd(&h, 100);
hsAdd(&h, 10);
assertEquals(5, hsReport(&h, result)); assertEquals(1, hsReport(&h, result));
assertEquals(10, result[0]);
assertEquals(5, result[0]);
assertEquals(10, result[1]); // let's add same value one more time
assertEquals(10, result[2]); hsAdd(&h, 10);
assertEquals(100, result[3]); assertEquals(2, hsReport(&h, result));
// values are not expected to be exactly the same, it's the shape what matters assertEquals(10, result[0]);
assertEquals(1011, result[4]); assertEquals(10, result[1]);
}
hsAdd(&h, 10);
static void testMalfunctionCentralRemoveNonExistent() { hsAdd(&h, 10);
print("******************************************* testMalfunctionCentralRemoveNonExistent\r\n"); hsAdd(&h, 10);
initMalfunctionCentral();
hsAdd(&h, 1000);
// this should not crash hsAdd(&h, 100);
removeError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
} assertEquals(5, hsReport(&h, result));
static void testMalfunctionCentralSameElementAgain() { assertEquals(5, result[0]);
initMalfunctionCentral(); assertEquals(10, result[1]);
print("******************************************* testMalfunctionCentralSameElementAgain\r\n"); assertEquals(10, result[2]);
error_codes_set_s localCopy; assertEquals(100, result[3]);
// values are not expected to be exactly the same, it's the shape what matters
addError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction); assertEquals(1011, result[4]);
addError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction); }
getErrorCodes(&localCopy);
assertEquals(1, localCopy.count); static void testMalfunctionCentralRemoveNonExistent() {
} print("******************************************* testMalfunctionCentralRemoveNonExistent\r\n");
initMalfunctionCentral();
static void testMalfunctionCentralRemoveFirstElement() {
initMalfunctionCentral(); // this should not crash
print("******************************************* testMalfunctionCentralRemoveFirstElement\r\n"); removeError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
error_codes_set_s localCopy; }
obd_code_e firstElement = OBD_Engine_Coolant_Temperature_Circuit_Malfunction; static void testMalfunctionCentralSameElementAgain() {
addError(firstElement); initMalfunctionCentral();
print("******************************************* testMalfunctionCentralSameElementAgain\r\n");
obd_code_e secondElement = OBD_Intake_Air_Temperature_Circuit_Malfunction; error_codes_set_s localCopy;
addError(secondElement);
getErrorCodes(&localCopy); addError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
assertEquals(2, localCopy.count); addError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
getErrorCodes(&localCopy);
// let's remove first element - code assertEquals(1, localCopy.count);
removeError(firstElement); }
getErrorCodes(&localCopy); static void testMalfunctionCentralRemoveFirstElement() {
assertEquals(1, localCopy.count); initMalfunctionCentral();
assertEquals(secondElement, localCopy.error_codes[0]); print("******************************************* testMalfunctionCentralRemoveFirstElement\r\n");
} error_codes_set_s localCopy;
void testMalfunctionCentral(void) { obd_code_e firstElement = OBD_Engine_Coolant_Temperature_Circuit_Malfunction;
testMalfunctionCentralRemoveNonExistent(); addError(firstElement);
testMalfunctionCentralSameElementAgain();
testMalfunctionCentralRemoveFirstElement(); obd_code_e secondElement = OBD_Intake_Air_Temperature_Circuit_Malfunction;
addError(secondElement);
print("******************************************* testMalfunctionCentral\r\n"); getErrorCodes(&localCopy);
initMalfunctionCentral(); assertEquals(2, localCopy.count);
error_codes_set_s localCopy; // let's remove first element - code
removeError(firstElement);
// on start-up error storage should be empty
getErrorCodes(&localCopy); getErrorCodes(&localCopy);
assertEquals(0, localCopy.count); assertEquals(1, localCopy.count);
assertEquals(secondElement, localCopy.error_codes[0]);
obd_code_e code = OBD_Engine_Coolant_Temperature_Circuit_Malfunction; }
// let's add one error and validate
addError(code); void testMalfunctionCentral(void) {
testMalfunctionCentralRemoveNonExistent();
getErrorCodes(&localCopy); testMalfunctionCentralSameElementAgain();
assertEqualsM("count #1", 1, localCopy.count); testMalfunctionCentralRemoveFirstElement();
assertEquals(code, localCopy.error_codes[0]);
print("******************************************* testMalfunctionCentral\r\n");
// let's remove value which is not in the collection initMalfunctionCentral();
removeError((obd_code_e)22);
// element not present - nothing to removed error_codes_set_s localCopy;
assertEquals(1, localCopy.count);
assertEquals(code, localCopy.error_codes[0]); // on start-up error storage should be empty
getErrorCodes(&localCopy);
code = OBD_Intake_Air_Temperature_Circuit_Malfunction; assertEquals(0, localCopy.count);
addError(code);
getErrorCodes(&localCopy); obd_code_e code = OBD_Engine_Coolant_Temperature_Circuit_Malfunction;
// todo: assertEquals(2, localCopy.count); // let's add one error and validate
addError(code);
for (int code = 0; code < 100; code++) {
addError((obd_code_e) code); getErrorCodes(&localCopy);
} assertEqualsM("count #1", 1, localCopy.count);
getErrorCodes(&localCopy); assertEquals(code, localCopy.error_codes[0]);
assertEquals(MAX_ERROR_CODES_COUNT, localCopy.count);
// let's remove value which is not in the collection
// now we have full array and code below present removeError((obd_code_e)22);
removeError(code); // element not present - nothing to removed
getErrorCodes(&localCopy); assertEquals(1, localCopy.count);
assertEquals(MAX_ERROR_CODES_COUNT - 1, localCopy.count); assertEquals(code, localCopy.error_codes[0]);
}
code = OBD_Intake_Air_Temperature_Circuit_Malfunction;
static int lastInteger = -1; addError(code);
static int lastInteger2 = -1; getErrorCodes(&localCopy);
// todo: assertEquals(2, localCopy.count);
static void testEchoI(int param) {
lastInteger = param; for (int code = 0; code < 100; code++) {
} addError((obd_code_e) code);
}
static void testEchoII(int param, int param2) { getErrorCodes(&localCopy);
lastInteger = param; assertEquals(MAX_ERROR_CODES_COUNT, localCopy.count);
lastInteger2 = param2;
} // now we have full array and code below present
removeError(code);
static char *lastFirst = NULL; getErrorCodes(&localCopy);
static char *lastThird = NULL; assertEquals(MAX_ERROR_CODES_COUNT - 1, localCopy.count);
}
static void testEchoSSS(char *first, char *second, char *third) {
lastFirst = first; static int lastInteger = -1;
lastThird = third; static int lastInteger2 = -1;
}
static void testEchoI(int param) {
#define UNKNOWN_COMMAND "dfadasdasd" lastInteger = param;
}
static loc_t GPSdata;
static void testEchoII(int param, int param2) {
static char nmeaMessage[1000]; lastInteger = param;
lastInteger2 = param2;
void testGpsParser(void) { }
print("******************************************* testGpsParser\r\n");
static char *lastFirst = NULL;
strcpy(nmeaMessage, ""); static char *lastThird = NULL;
gps_location(&GPSdata, nmeaMessage);
static void testEchoSSS(char *first, char *second, char *third) {
// we need to pass a mutable string, not a constant because the parser would be modifying the string lastFirst = first;
strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69"); lastThird = third;
gps_location(&GPSdata, nmeaMessage); }
assertEqualsM("1 valid", 4, GPSdata.quality);
assertEqualsM("1 latitude", 3349.896, GPSdata.latitude); #define UNKNOWN_COMMAND "dfadasdasd"
assertEqualsM("1 longitude", 11808.521, GPSdata.longitude);
assertEqualsM("1 speed", 0, GPSdata.speed); static loc_t GPSdata;
// assertEqualsM("1 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
assertEqualsM("1 course", 360, GPSdata.course); static char nmeaMessage[1000];
strcpy(nmeaMessage, "$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70"); void testGpsParser(void) {
gps_location(&GPSdata, nmeaMessage); print("******************************************* testGpsParser\r\n");
assertEqualsM("2 valid", 3, GPSdata.quality); // see field details
assertEqualsM("2 latitude", 50.0212, GPSdata.latitude); strcpy(nmeaMessage, "");
assertEqualsM("2 longitude", 36.2177, GPSdata.longitude); gps_location(&GPSdata, nmeaMessage);
assertEqualsM("2 speed", 0, GPSdata.speed);
assertEqualsM("2 altitude", 10.2, GPSdata.altitude); // we need to pass a mutable string, not a constant because the parser would be modifying the string
// assertEqualsM("2 course", 0, GPSdata.course); // GPGGA not overwrite course strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69");
gps_location(&GPSdata, nmeaMessage);
strcpy(nmeaMessage, "$GPRMC,111609.14,A,5001.27,N,3613.06,E,11.2,0.0,261206,0.0,E*50"); assertEqualsM("1 valid", 4, GPSdata.quality);
gps_location(&GPSdata, nmeaMessage); assertEqualsM("1 latitude", 3349.896, GPSdata.latitude);
assertEqualsM("3 valid", 4, GPSdata.quality); assertEqualsM("1 longitude", 11808.521, GPSdata.longitude);
assertEqualsM("3 latitude", 5001.27, GPSdata.latitude); assertEqualsM("1 speed", 0, GPSdata.speed);
assertEqualsM("3 longitude", 3613.06, GPSdata.longitude); // assertEqualsM("1 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
assertEqualsM("3 speed", 11.2, GPSdata.speed); assertEqualsM("1 course", 360, GPSdata.course);
// assertEqualsM("3 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
assertEqualsM("3 course", 0, GPSdata.course); strcpy(nmeaMessage, "$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70");
assertEqualsM("3 GPS yy",2006, GPSdata.GPStm.tm_year+1900); gps_location(&GPSdata, nmeaMessage);
assertEqualsM("3 GPS mm",12, GPSdata.GPStm.tm_mon); assertEqualsM("2 valid", 3, GPSdata.quality); // see field details
assertEqualsM("3 GPS yy",26, GPSdata.GPStm.tm_mday); assertEqualsM("2 latitude", 50.0212, GPSdata.latitude);
assertEqualsM("3 GPS hh",11, GPSdata.GPStm.tm_hour); assertEqualsM("2 longitude", 36.2177, GPSdata.longitude);
assertEqualsM("3 GPS mm",16, GPSdata.GPStm.tm_min); assertEqualsM("2 speed", 0, GPSdata.speed);
assertEqualsM("3 GPS ss",9, GPSdata.GPStm.tm_sec); assertEqualsM("2 altitude", 10.2, GPSdata.altitude);
// assertEqualsM("2 course", 0, GPSdata.course); // GPGGA not overwrite course
// check again first one
// we need to pass a mutable string, not a constant because the parser would be modifying the string strcpy(nmeaMessage, "$GPRMC,111609.14,A,5001.27,N,3613.06,E,11.2,0.0,261206,0.0,E*50");
strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69"); gps_location(&GPSdata, nmeaMessage);
gps_location(&GPSdata, nmeaMessage); assertEqualsM("3 valid", 4, GPSdata.quality);
assertEqualsM("4 valid", 4, GPSdata.quality); assertEqualsM("3 latitude", 5001.27, GPSdata.latitude);
assertEqualsM("4 latitude", 3349.896, GPSdata.latitude); assertEqualsM("3 longitude", 3613.06, GPSdata.longitude);
assertEqualsM("4 longitude", 11808.521, GPSdata.longitude); assertEqualsM("3 speed", 11.2, GPSdata.speed);
assertEqualsM("4 speed", 0, GPSdata.speed); // assertEqualsM("3 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
assertEqualsM("4 course", 360, GPSdata.course); assertEqualsM("3 course", 0, GPSdata.course);
} assertEqualsM("3 GPS yy",2006, GPSdata.GPStm.tm_year+1900);
assertEqualsM("3 GPS mm",12, GPSdata.GPStm.tm_mon);
// this buffer is needed because on Unix you would not be able to change static char constants assertEqualsM("3 GPS yy",26, GPSdata.GPStm.tm_mday);
static char buffer[300]; assertEqualsM("3 GPS hh",11, GPSdata.GPStm.tm_hour);
assertEqualsM("3 GPS mm",16, GPSdata.GPStm.tm_min);
void testConsoleLogic(void) { assertEqualsM("3 GPS ss",9, GPSdata.GPStm.tm_sec);
print("******************************************* testConsoleLogic\r\n");
resetConsoleActions(); // check again first one
// we need to pass a mutable string, not a constant because the parser would be modifying the string
helpCommand(); strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69");
gps_location(&GPSdata, nmeaMessage);
char *ptr = validateSecureLine(UNKNOWN_COMMAND); assertEqualsM("4 valid", 4, GPSdata.quality);
assertEquals(0, strcmp(UNKNOWN_COMMAND, ptr)); assertEqualsM("4 latitude", 3349.896, GPSdata.latitude);
assertEquals(10, tokenLength(UNKNOWN_COMMAND)); assertEqualsM("4 longitude", 11808.521, GPSdata.longitude);
assertEqualsM("4 speed", 0, GPSdata.speed);
// handling invalid token should work assertEqualsM("4 course", 360, GPSdata.course);
strcpy(buffer, "sdasdafasd asd"); }
handleConsoleLine(buffer);
// this buffer is needed because on Unix you would not be able to change static char constants
print("\r\naddConsoleActionI\r\n"); static char buffer[300];
addConsoleActionI("echoi", testEchoI);
strcpy(buffer, "echoi 239"); void testConsoleLogic(void) {
handleConsoleLine(buffer); print("******************************************* testConsoleLogic\r\n");
assertEquals(239, lastInteger); resetConsoleActions();
print("\r\naddConsoleActionII\r\n"); helpCommand();
addConsoleActionII("echoii", testEchoII);
strcpy(buffer, "echoii 22 239"); char *ptr = validateSecureLine(UNKNOWN_COMMAND);
handleConsoleLine(buffer); assertEquals(0, strcmp(UNKNOWN_COMMAND, ptr));
assertEquals(22, lastInteger); assertEquals(10, tokenLength(UNKNOWN_COMMAND));
assertEquals(239, lastInteger2);
// handling invalid token should work
print("\r\addConsoleActionSSS\r\n"); strcpy(buffer, "sdasdafasd asd");
addConsoleActionSSS("echosss", testEchoSSS); handleConsoleLine(buffer);
strcpy(buffer, "echosss 111 222 333");
handleConsoleLine(buffer); print("\r\naddConsoleActionI\r\n");
assertEquals(111, atoi(lastFirst)); addConsoleActionI("echoi", testEchoI);
assertEquals(333, atoi(lastThird)); strcpy(buffer, "echoi 239");
handleConsoleLine(buffer);
//addConsoleActionSSS("GPS", testGpsParser); assertEquals(239, lastInteger);
}
print("\r\naddConsoleActionII\r\n");
addConsoleActionII("echoii", testEchoII);
strcpy(buffer, "echoii 22 239");
handleConsoleLine(buffer);
assertEquals(22, lastInteger);
assertEquals(239, lastInteger2);
print("\r\addConsoleActionSSS\r\n");
addConsoleActionSSS("echosss", testEchoSSS);
strcpy(buffer, "echosss 111 222 333");
handleConsoleLine(buffer);
assertEquals(111, atoi(lastFirst));
assertEquals(333, atoi(lastThird));
//addConsoleActionSSS("GPS", testGpsParser);
}

View File

@ -1,30 +1,31 @@
/** /**
* @file test_cyclic_buffer.h * @file test_cyclic_buffer.h
* *
* @date Dec 8, 2013 * @date Dec 8, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef TEST_CYCLIC_BUFFER_H_ #ifndef TEST_CYCLIC_BUFFER_H_
#define TEST_CYCLIC_BUFFER_H_ #define TEST_CYCLIC_BUFFER_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif /* __cplusplus */ #endif /* __cplusplus */
void testCyclicBuffer(void); void testCyclicBuffer(void);
void testHistogram(void); void testOverflow64Counter(void);
void testMalfunctionCentral(void); void testHistogram(void);
void testConsoleLogic(void); void testMalfunctionCentral(void);
void testGpsParser(void); void testConsoleLogic(void);
void testGpsParser(void);
#ifdef __cplusplus
} #ifdef __cplusplus
#endif /* __cplusplus */ }
#endif /* __cplusplus */
#endif /* TEST_CYCLIC_BUFFER_H_ */
#endif /* TEST_CYCLIC_BUFFER_H_ */

View File

@ -1,42 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings"> <storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018"> <cconfiguration id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018" moduleId="org.eclipse.cdt.core.settings" name="Default"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/> <externalSettings/>
<extensions> <extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" 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.CWDLocator" 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"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" 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.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018" name="Default" parent="org.eclipse.cdt.build.core.emptycfg"> <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018.399281622" name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.cygwin.base.708884018.399281622" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.1622324288" name="cdt.managedbuild.toolchain.gnu.cygwin.base" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base"> <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.1622324288" name="cdt.managedbuild.toolchain.gnu.cygwin.base" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.1248686809" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.1248686809" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
<builder id="cdt.managedbuild.target.gnu.builder.cygwin.base.1348377632" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base"/> <builder id="cdt.managedbuild.target.gnu.builder.cygwin.base.1348377632" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.1582437132" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.1582437132" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.1785548679" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.1785548679" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.2026199438" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.2026199438" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.264596926" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.264596926" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1428225087" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1428225087" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.98334676" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/> <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.98334676" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
</toolChain> </toolChain>
</folderInfo> </folderInfo>
</configuration> </configuration>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration> </cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="win32_functional_tests.null.780571766" name="win32_functional_tests"/> <project id="win32_functional_tests.null.780571766" name="win32_functional_tests"/>
</storageModule> </storageModule>
<storageModule moduleId="scannerConfiguration"> <storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject> </cproject>

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>win32_functional_tests</name> <name>win32_functional_tests</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers> <triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers> <triggers>full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.cdt.core.cnature</nature> <nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature> <nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -1,256 +1,259 @@
############################################################################## ##############################################################################
# Build global options # Build global options
# NOTE: Can be overridden externally. # NOTE: Can be overridden externally.
# #
PROJECT_DIR = ../firmware PROJECT_DIR = ../firmware
#CHIBIOS = $(PROJECT_DIR)/chibios #CHIBIOS = $(PROJECT_DIR)/chibios
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
# this config if debugging is needed, but the binary is about 30M # this config if debugging is needed, but the binary is about 30M
# USE_OPT = -c -Wall -O0 -ggdb -g3 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=write-strings # USE_OPT = -c -Wall -O0 -ggdb -g3 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=write-strings
# this config producec a smaller binary file # this config producec a smaller binary file
USE_OPT = -c -Wall -O2 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=write-strings -Wno-error=strict-aliasing USE_OPT = -c -Wall -O2 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=write-strings -Wno-error=strict-aliasing
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),) ifeq ($(USE_COPT),)
USE_COPT = -std=gnu99 -fgnu89-inline USE_COPT = -std=gnu99 -fgnu89-inline
endif endif
# C++ specific options here (added to USE_OPT). # C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),) ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti -fpermissive -fno-exceptions -fno-use-cxa-atexit USE_CPPOPT = -fno-rtti -fpermissive -fno-exceptions -fno-use-cxa-atexit
endif endif
# Enable this if you want the linker to remove unused code and data # Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),) ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes USE_LINK_GC = yes
endif endif
# If enabled, this option allows to compile the application in THUMB mode. # If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),) ifeq ($(USE_THUMB),)
USE_THUMB = no USE_THUMB = no
endif endif
# Enable this if you want to see the full log while compiling. # Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),) ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no USE_VERBOSE_COMPILE = no
endif endif
# #
# Build global options # Build global options
############################################################################## ##############################################################################
############################################################################## ##############################################################################
# Architecture or project specific options # Architecture or project specific options
# #
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
DDEFS = DDEFS =
# #
# Architecture or project specific options # Architecture or project specific options
############################################################################## ##############################################################################
############################################################################## ##############################################################################
# Project, sources and paths # Project, sources and paths
# #
# Define project name here # Define project name here
PROJECT = rusefi_simulator PROJECT = rusefi_simulator
#PROJECT_BOARD = OLIMEX_STM32_E407 #PROJECT_BOARD = OLIMEX_STM32_E407
#ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407) #ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407)
# PROJECT_BOARD = ST_STM32F4_DISCOVERY # PROJECT_BOARD = ST_STM32F4_DISCOVERY
#endif #endif
#DDEFS += -D$(PROJECT_BOARD) #DDEFS += -D$(PROJECT_BOARD)
CHIBIOS = ../firmware/chibios CHIBIOS = ../firmware/chibios
# Imported source files and paths # Imported source files and paths
include $(PROJECT_DIR)/util/util.mk include $(PROJECT_DIR)/util/util.mk
include $(PROJECT_DIR)/config/engines/engines.mk include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/controllers/algo/algo.mk include $(PROJECT_DIR)/controllers/algo/algo.mk
include $(PROJECT_DIR)/controllers/math/math.mk include $(PROJECT_DIR)/controllers/math/math.mk
include $(PROJECT_DIR)/controllers/sensors/sensors.mk include $(PROJECT_DIR)/controllers/sensors/sensors.mk
include $(PROJECT_DIR)/controllers/trigger/trigger.mk include $(PROJECT_DIR)/controllers/trigger/trigger.mk
include $(PROJECT_DIR)/controllers/system/system.mk include $(PROJECT_DIR)/controllers/system/system.mk
include $(PROJECT_DIR)/console/console.mk include $(PROJECT_DIR)/console/console.mk
include $(PROJECT_DIR)/console_util/console_util.mk include $(PROJECT_DIR)/console_util/console_util.mk
include $(CHIBIOS)/boards/simulator/board.mk include $(CHIBIOS)/boards/simulator/board.mk
include ${CHIBIOS}/os/hal/hal.mk include ${CHIBIOS}/os/hal/hal.mk
include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk
include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk
include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/os/kernel/kernel.mk
# Define linker script file here # Define linker script file here
#LDSCRIPT= config/system/STM32F407xG.ld #LDSCRIPT= config/system/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld #LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global # C sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CSRC = ${PORTSRC} \ CSRC = ${PORTSRC} \
${KERNSRC} \ ${KERNSRC} \
${TESTSRC} \ ${TESTSRC} \
${HALSRC} \ ${HALSRC} \
${PLATFORMSRC} \ ${PLATFORMSRC} \
$(TRIGGERSRC) \ $(TRIGGER_SRC) \
$(SYSTEMSRC) \ $(SYSTEMSRC) \
$(CONSOLESRC) \ $(CONSOLESRC) \
$(CONSOLEUTILSRC) \ $(CONSOLEUTILSRC) \
$(CONTROLLERS_ALGO_SRC) \ $(CONTROLLERS_ALGO_SRC) \
$(CONTROLLERS_MATH_SRC) \ $(CONTROLLERS_MATH_SRC) \
$(CONTROLLERS_SENSORS_SRC) \ $(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \ $(ENGINES_SRC) \
$(BOARDSRC) \ $(BOARDSRC) \
${CHIBIOS}/os/various/chprintf.c \ ${CHIBIOS}/os/various/chprintf.c \
${CHIBIOS}/os/various/memstreams.c \ ${CHIBIOS}/os/various/memstreams.c \
$(UTILSRC) \ $(UTILSRC) \
simulator/rusEfiFunctionalTest.c \ simulator/rusEfiFunctionalTest.c \
$(PROJECT_DIR)/controllers/settings.c \ simulator/boards.c \
simulator/boards.c \ $(PROJECT_DIR)/emulation/analog_chart.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CPPSRC = $(UTILSRC_CPP) \ CPPSRC = $(UTILSRC_CPP) \
$(CONTROLLERS_ALGO_SRC_CPP) \ $(CONTROLLERS_ALGO_SRC_CPP) \
$(CONTROLLERSSRC_CPP) \ $(PROJECT_DIR)/controllers/settings.cpp \
$(SYSTEMSRC_CPP) \ $(TRIGGER_SRC_CPP) \
$(ENGINES_SRC_CPP) \ $(SYSTEMSRC_CPP) \
$(TEST_SRC_CPP) $(CONTROLLERS_MATH_SRC_CPP) \
# C sources to be compiled in ARM mode regardless of the global setting. $(ENGINES_SRC_CPP) \
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler $(TEST_SRC_CPP)
# option that results in lower performance and larger code size. # C sources to be compiled in ARM mode regardless of the global setting.
ACSRC = # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
# C++ sources to be compiled in ARM mode regardless of the global setting. ACSRC =
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size. # C++ sources to be compiled in ARM mode regardless of the global setting.
ACPPSRC = # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
# C sources to be compiled in THUMB mode regardless of the global setting. ACPPSRC =
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size. # C sources to be compiled in THUMB mode regardless of the global setting.
TCSRC = # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
# C sources to be compiled in THUMB mode regardless of the global setting. TCSRC =
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size. # C sources to be compiled in THUMB mode regardless of the global setting.
TCPPSRC = # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
# List ASM source files here TCPPSRC =
ASMSRC = $(PORTASM)
# List ASM source files here
INCDIR = . \ ASMSRC = $(PORTASM)
$(PORTINC) $(KERNINC) $(TESTINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) \ INCDIR = . \
$(PROJECT_DIR)/util \ $(PORTINC) $(KERNINC) $(TESTINC) \
$(PROJECT_DIR)/console \ $(HALINC) $(PLATFORMINC) $(BOARDINC) \
$(PROJECT_DIR)/console_util \ $(PROJECT_DIR)/util \
$(PROJECT_DIR)/config/engines \ $(PROJECT_DIR)/console \
$(PROJECT_DIR)/ext_algo \ $(PROJECT_DIR)/console_util \
$(PROJECT_DIR)/controllers \ $(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/controllers/sensors \ $(PROJECT_DIR)/ext_algo \
$(PROJECT_DIR)/controllers/system \ $(PROJECT_DIR)/controllers \
$(PROJECT_DIR)/hw_layer/algo \ $(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/algo \ $(PROJECT_DIR)/controllers/system \
$(PROJECT_DIR)/controllers/math \ $(PROJECT_DIR)/hw_layer/algo \
$(PROJECT_DIR)/controllers/math \ $(PROJECT_DIR)/emulation \
$(PROJECT_DIR)/controllers/trigger \ $(PROJECT_DIR)/controllers/algo \
${CHIBIOS}/os/various \ $(PROJECT_DIR)/controllers/math \
simulator $(PROJECT_DIR)/controllers/math \
$(PROJECT_DIR)/controllers/trigger \
${CHIBIOS}/os/various \
# simulator
# Project, sources and paths
##############################################################################
#
############################################################################## # Project, sources and paths
# Compiler settings ##############################################################################
#
##############################################################################
#MCU = cortex-m4 # Compiler settings
#
ifeq ($(OS),Windows_NT)
TRGT = i686-pc-mingw32- #MCU = cortex-m4
else
TRGT = ifeq ($(OS),Windows_NT)
endif TRGT = i686-pc-mingw32-
else
CC = $(TRGT)gcc TRGT =
CPPC = $(TRGT)g++ endif
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++ CC = $(TRGT)gcc
# runtime support makes code size explode. CPPC = $(TRGT)g++
#LD = $(TRGT)gcc # Enable loading with g++ only if you need C++ runtime support.
LD = $(TRGT)g++ # NOTE: You can use C++ even without C++ support if you are careful. C++
CP = $(TRGT)objcopy # runtime support makes code size explode.
AS = $(TRGT)gcc -x assembler-with-cpp #LD = $(TRGT)gcc
OD = $(TRGT)objdump LD = $(TRGT)g++
HEX = $(CP) -O ihex CP = $(TRGT)objcopy
BIN = $(CP) -O binary AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
# ARM-specific options here HEX = $(CP) -O ihex
AOPT = BIN = $(CP) -O binary
# THUMB-specific options here # ARM-specific options here
TOPT = -mthumb -DTHUMB AOPT =
# Define C warning options here # THUMB-specific options here
CWARN = -Wall -Wextra -Wstrict-prototypes TOPT = -mthumb -DTHUMB
# Define C++ warning options here # Define C warning options here
CPPWARN = -Wall -Wextra CWARN = -Wall -Wextra -Wstrict-prototypes
# # Define C++ warning options here
# Compiler settings CPPWARN = -Wall -Wextra
##############################################################################
#
############################################################################## # Compiler settings
# Start of default section ##############################################################################
#
##############################################################################
# List all default ASM defines here, like -D_DEBUG=1 # Start of default section
DADEFS = #
# List all default directories to look for include files here # List all default ASM defines here, like -D_DEBUG=1
DINCDIR = DADEFS =
# List the default directory to look for the libraries here # List all default directories to look for include files here
DLIBDIR = DINCDIR =
# List all default libraries here # List the default directory to look for the libraries here
DLIBS = -static-libgcc -static-libstdc++ -lws2_32 DLIBDIR =
# # List all default libraries here
# End of default section DLIBS = -static-libgcc -static-libstdc++ -lws2_32
##############################################################################
#
############################################################################## # End of default section
# Start of user section ##############################################################################
#
##############################################################################
# List all user C define here, like -D_DEBUG=1 # Start of user section
UDEFS = #
# Define ASM defines here # List all user C define here, like -D_DEBUG=1
UADEFS = UDEFS =
# List all user directories here # Define ASM defines here
UINCDIR = UADEFS =
# List the user directory to look for the libraries here # List all user directories here
ULIBDIR = UINCDIR =
# List all user libraries here # List the user directory to look for the libraries here
ULIBS = -lm ULIBDIR =
# # List all user libraries here
# End of user defines ULIBS = -lm
##############################################################################
#
include rules.mk # End of user defines
##############################################################################
include rules.mk

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
rem this is about CygWin colon issue, .dep files are invalid because of that rem this is about CygWin colon issue, .dep files are invalid because of that
rem rm -rf .dep rem rm -rf .dep
rm -f build/rusefi_simulator.exe rm -f build/rusefi_simulator.exe
make make

View File

@ -1,312 +1,312 @@
/* /*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/** /**
* @file templates/halconf.h * @file templates/halconf.h
* @brief HAL configuration header. * @brief HAL configuration header.
* @details HAL configuration file, this file allows to enable or disable the * @details HAL configuration file, this file allows to enable or disable the
* various device drivers from your application. You may also use * various device drivers from your application. You may also use
* this file in order to override the device drivers default settings. * this file in order to override the device drivers default settings.
* *
* @addtogroup HAL_CONF * @addtogroup HAL_CONF
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef _HALCONF_H_
#define _HALCONF_H_ #define _HALCONF_H_
/*#include "mcuconf.h"*/ /*#include "mcuconf.h"*/
/** /**
* @brief Enables the TM subsystem. * @brief Enables the TM subsystem.
*/ */
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__) #if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
#define HAL_USE_TM FALSE #define HAL_USE_TM FALSE
#endif #endif
/** /**
* @brief Enables the PAL subsystem. * @brief Enables the PAL subsystem.
*/ */
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
#define HAL_USE_PAL TRUE #define HAL_USE_PAL TRUE
#endif #endif
/** /**
* @brief Enables the ADC subsystem. * @brief Enables the ADC subsystem.
*/ */
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
#define HAL_USE_ADC FALSE #define HAL_USE_ADC FALSE
#endif #endif
/** /**
* @brief Enables the CAN subsystem. * @brief Enables the CAN subsystem.
*/ */
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/** /**
* @brief Enables the EXT subsystem. * @brief Enables the EXT subsystem.
*/ */
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE #define HAL_USE_EXT FALSE
#endif #endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
#define HAL_USE_GPT FALSE #define HAL_USE_GPT FALSE
#endif #endif
/** /**
* @brief Enables the I2C subsystem. * @brief Enables the I2C subsystem.
*/ */
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
#define HAL_USE_I2C FALSE #define HAL_USE_I2C FALSE
#endif #endif
/** /**
* @brief Enables the ICU subsystem. * @brief Enables the ICU subsystem.
*/ */
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
#define HAL_USE_ICU FALSE #define HAL_USE_ICU FALSE
#endif #endif
/** /**
* @brief Enables the MAC subsystem. * @brief Enables the MAC subsystem.
*/ */
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
#define HAL_USE_MAC FALSE #define HAL_USE_MAC FALSE
#endif #endif
/** /**
* @brief Enables the MMC_SPI subsystem. * @brief Enables the MMC_SPI subsystem.
*/ */
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
#define HAL_USE_MMC_SPI FALSE #define HAL_USE_MMC_SPI FALSE
#endif #endif
/** /**
* @brief Enables the PWM subsystem. * @brief Enables the PWM subsystem.
*/ */
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE #define HAL_USE_PWM FALSE
#endif #endif
/** /**
* @brief Enables the RTC subsystem. * @brief Enables the RTC subsystem.
*/ */
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
#define HAL_USE_RTC FALSE #define HAL_USE_RTC FALSE
#endif #endif
/** /**
* @brief Enables the SDC subsystem. * @brief Enables the SDC subsystem.
*/ */
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE #define HAL_USE_SDC FALSE
#endif #endif
/** /**
* @brief Enables the SERIAL subsystem. * @brief Enables the SERIAL subsystem.
*/ */
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL TRUE #define HAL_USE_SERIAL TRUE
#endif #endif
/** /**
* @brief Enables the SERIAL over USB subsystem. * @brief Enables the SERIAL over USB subsystem.
*/ */
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) #if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
#define HAL_USE_UART FALSE #define HAL_USE_UART FALSE
#endif #endif
/** /**
* @brief Enables the USB subsystem. * @brief Enables the USB subsystem.
*/ */
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) #if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
#define HAL_USE_USB FALSE #define HAL_USE_USB FALSE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables synchronous APIs. * @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
*/ */
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
#define ADC_USE_WAIT TRUE #define ADC_USE_WAIT TRUE
#endif #endif
/** /**
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
*/ */
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define ADC_USE_MUTUAL_EXCLUSION TRUE #define ADC_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* CAN driver related settings. */ /* CAN driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Sleep mode related APIs inclusion switch. * @brief Sleep mode related APIs inclusion switch.
*/ */
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables the mutual exclusion APIs on the I2C bus. * @brief Enables the mutual exclusion APIs on the I2C bus.
*/ */
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define I2C_USE_MUTUAL_EXCLUSION TRUE #define I2C_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* MAC driver related settings. */ /* MAC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables an event sources for incoming packets.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
#endif #endif
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables an event sources for incoming packets.
*/ */
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
#define MAC_USE_EVENTS TRUE #define MAC_USE_EVENTS TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* MMC_SPI driver related settings. */ /* MMC_SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Delays insertions. * @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting * @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with * routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however. * lower priority, this may slow down the driver a bit however.
* This option is recommended also if the SPI driver does not * This option is recommended also if the SPI driver does not
* use a DMA channel and heavily loads the CPU. * use a DMA channel and heavily loads the CPU.
*/ */
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE #define MMC_NICE_WAITING TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* SDC driver related settings. */ /* SDC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Number of initialization attempts before rejecting the card. * @brief Number of initialization attempts before rejecting the card.
* @note Attempts are performed at 10mS intervals. * @note Attempts are performed at 10mS intervals.
*/ */
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
#define SDC_INIT_RETRY 100 #define SDC_INIT_RETRY 100
#endif #endif
/** /**
* @brief Include support for MMC cards. * @brief Include support for MMC cards.
* @note MMC support is not yet implemented so this option must be kept * @note MMC support is not yet implemented so this option must be kept
* at @p FALSE. * at @p FALSE.
*/ */
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
#define SDC_MMC_SUPPORT FALSE #define SDC_MMC_SUPPORT FALSE
#endif #endif
/** /**
* @brief Delays insertions. * @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting * @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with * routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however. * lower priority, this may slow down the driver a bit however.
*/ */
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Default bit rate. * @brief Default bit rate.
* @details Configuration parameter, this is the baud rate selected for the * @details Configuration parameter, this is the baud rate selected for the
* default configuration. * default configuration.
*/ */
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SERIAL_DEFAULT_BITRATE 38400 #define SERIAL_DEFAULT_BITRATE 38400
#endif #endif
/** /**
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 64 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 32 #define SERIAL_BUFFERS_SIZE 32
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables synchronous APIs. * @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
*/ */
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
*/ */
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
#endif /* _HALCONF_H_ */ #endif /* _HALCONF_H_ */
/** @} */ /** @} */

View File

@ -1,189 +1,189 @@
/* /*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
#include "main.h" #include "main.h"
#include "chprintf.h" #include "chprintf.h"
#include "rusEfiFunctionalTest.h" #include "rusEfiFunctionalTest.h"
#define SHELL_WA_SIZE THD_WA_SIZE(4096) #define SHELL_WA_SIZE THD_WA_SIZE(4096)
#define CONSOLE_WA_SIZE THD_WA_SIZE(4096) #define CONSOLE_WA_SIZE THD_WA_SIZE(4096)
static Thread *cdtp; static Thread *cdtp;
//static Thread *shelltp1; //static Thread *shelltp1;
//static Thread *shelltp2; //static Thread *shelltp2;
#define cputs(msg) chMsgSend(cdtp, (msg_t)msg) #define cputs(msg) chMsgSend(cdtp, (msg_t)msg)
void printToWin32Console(char *p) { void printToWin32Console(char *p) {
cputs(p); cputs(p);
} }
TestStream testStream; TestStream testStream;
/* /*
* Console print server done using synchronous messages. This makes the access * Console print server done using synchronous messages. This makes the access
* to the C printf() thread safe and the print operation atomic among threads. * to the C printf() thread safe and the print operation atomic among threads.
* In this example the message is the zero terminated string itself. * In this example the message is the zero terminated string itself.
*/ */
static msg_t console_thread(void *arg) { static msg_t console_thread(void *arg) {
(void) arg; (void) arg;
while (!chThdShouldTerminate()) { while (!chThdShouldTerminate()) {
Thread *tp = chMsgWait(); Thread *tp = chMsgWait();
puts((char *) chMsgGet(tp)); puts((char *) chMsgGet(tp));
fflush(stdout); fflush(stdout);
chMsgRelease(tp, RDY_OK); chMsgRelease(tp, RDY_OK);
} }
return 0; return 0;
} }
extern int isSerialOverTcpReady; extern int isSerialOverTcpReady;
/** /**
* @brief Shell termination handler. * @brief Shell termination handler.
* *
* @param[in] id event id. * @param[in] id event id.
*/ */
static void termination_handler(eventid_t id) { static void termination_handler(eventid_t id) {
chThdSleepMilliseconds(10); chThdSleepMilliseconds(10);
cputs("Init: shell on SD1 terminated"); cputs("Init: shell on SD1 terminated");
chSysLock(); chSysLock();
chOQResetI(&SD1.oqueue); chOQResetI(&SD1.oqueue);
chSysUnlock(); chSysUnlock();
// if (shelltp2 && chThdTerminated(shelltp2)) { // if (shelltp2 && chThdTerminated(shelltp2)) {
// chThdWait(shelltp2); // chThdWait(shelltp2);
// shelltp2 = NULL; // shelltp2 = NULL;
// chThdSleepMilliseconds(10); // chThdSleepMilliseconds(10);
// cputs("Init: shell on SD2 terminated"); // cputs("Init: shell on SD2 terminated");
// chSysLock(); // chSysLock();
// chOQResetI(&SD2.oqueue); // chOQResetI(&SD2.oqueue);
// chSysUnlock(); // chSysUnlock();
// } // }
} }
static EventListener sd1fel, sd2fel; static EventListener sd1fel, sd2fel;
/** /**
* @brief SD1 status change handler. * @brief SD1 status change handler.
* *
* @param[in] id event id. * @param[in] id event id.
*/ */
static void sd1_handler(eventid_t id) { static void sd1_handler(eventid_t id) {
flagsmask_t flags; flagsmask_t flags;
(void) id; (void) id;
flags = chEvtGetAndClearFlags(&sd1fel); flags = chEvtGetAndClearFlags(&sd1fel);
if ((flags & CHN_CONNECTED)) { if ((flags & CHN_CONNECTED)) {
cputs("Init: connection on SD1"); cputs("Init: connection on SD1");
isSerialOverTcpReady = TRUE; isSerialOverTcpReady = TRUE;
} }
if (flags & CHN_DISCONNECTED) { if (flags & CHN_DISCONNECTED) {
cputs("Init: disconnection on SD1"); cputs("Init: disconnection on SD1");
isSerialOverTcpReady = FALSE; isSerialOverTcpReady = FALSE;
chSysLock(); chSysLock();
chIQResetI(&SD1.iqueue); chIQResetI(&SD1.iqueue);
chSysUnlock(); chSysUnlock();
} }
} }
/** /**
* @brief SD2 status change handler. * @brief SD2 status change handler.
* *
* @param[in] id event id. * @param[in] id event id.
*/ */
static void sd2_handler(eventid_t id) { static void sd2_handler(eventid_t id) {
flagsmask_t flags; flagsmask_t flags;
(void) id; (void) id;
flags = chEvtGetAndClearFlags(&sd2fel); flags = chEvtGetAndClearFlags(&sd2fel);
if ((flags & CHN_CONNECTED)) { if ((flags & CHN_CONNECTED)) {
cputs("Init: connection on SD2"); cputs("Init: connection on SD2");
} }
if (flags & CHN_DISCONNECTED) { if (flags & CHN_DISCONNECTED) {
cputs("Init: disconnection on SD2"); cputs("Init: disconnection on SD2");
chSysLock(); chSysLock();
chIQResetI(&SD2.iqueue); chIQResetI(&SD2.iqueue);
chSysUnlock(); chSysUnlock();
} }
} }
static evhandler_t fhandlers[] = { termination_handler, sd1_handler, sd2_handler }; static evhandler_t fhandlers[] = { termination_handler, sd1_handler, sd2_handler };
/*------------------------------------------------------------------------* /*------------------------------------------------------------------------*
* Simulator main. * * Simulator main. *
*------------------------------------------------------------------------*/ *------------------------------------------------------------------------*/
int main(void) { int main(void) {
initTestStream(&testStream); initTestStream(&testStream);
EventListener tel; EventListener tel;
/* /*
* System initializations. * System initializations.
* - HAL initialization, this also initializes the configured device drivers * - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations. * and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the * - Kernel initialization, the main() function becomes a thread and the
* RTOS is active. * RTOS is active.
*/ */
halInit(); halInit();
chSysInit(); chSysInit();
/* /*
* Serial ports (simulated) initialization. * Serial ports (simulated) initialization.
*/ */
sdStart(&SD1, NULL); sdStart(&SD1, NULL);
sdStart(&SD2, NULL); sdStart(&SD2, NULL);
/* /*
* Console thread started. * Console thread started.
*/ */
cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, console_thread, NULL); cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, console_thread, NULL);
/* /*
* Initializing connection/disconnection events. * Initializing connection/disconnection events.
*/ */
cputs("Shell service started on SD1, SD2"); cputs("Shell service started on SD1, SD2");
cputs(" - Listening for connections on SD1"); cputs(" - Listening for connections on SD1");
chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1); chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1);
cputs(" - Listening for connections on SD2"); cputs(" - Listening for connections on SD2");
chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2); chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2);
rusEfiFunctionalTest(); rusEfiFunctionalTest();
/* /*
* Events servicing loop. * Events servicing loop.
*/ */
while (!chThdShouldTerminate()) { while (!chThdShouldTerminate()) {
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
printPendingMessages(); printPendingMessages();
chThdSleepMilliseconds(100); chThdSleepMilliseconds(100);
} }
/* /*
* Clean simulator exit. * Clean simulator exit.
*/ */
chEvtUnregister(chnGetEventSource(&SD1), &sd1fel); chEvtUnregister(chnGetEventSource(&SD1), &sd1fel);
chEvtUnregister(chnGetEventSource(&SD2), &sd2fel); chEvtUnregister(chnGetEventSource(&SD2), &sd2fel);
return 0; return 0;
} }
int systicks2ms(int systicks) { int systicks2ms(int systicks) {
return systicks / TICKS_IN_MS; return systicks / TICKS_IN_MS;
} }

View File

@ -1,31 +1,2 @@
#include "global.h" #include "global.h"
#include "boards.h"
#include "eficonsole.h"
#include "efilib.h"
#include "datalogging.h"
#include "error_handling.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void printToWin32Console(char *p);
int systicks2ms(int systicks);
// todo: move somewhere else?
void lockAnyContext(void);
void unlockAnyContext(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/**
* number of SysClock ticks in one ms
*/
#define TICKS_IN_MS (CH_FREQUENCY / 1000)
#define hal_lld_get_counter_value() 0

View File

@ -1,168 +1,168 @@
# ARM Cortex-Mx common makefile scripts and rules. # ARM Cortex-Mx common makefile scripts and rules.
# Output directory and files # Output directory and files
ifeq ($(BUILDDIR),) ifeq ($(BUILDDIR),)
BUILDDIR = build BUILDDIR = build
endif endif
ifeq ($(BUILDDIR),.) ifeq ($(BUILDDIR),.)
BUILDDIR = build BUILDDIR = build
endif endif
OUTFILES = $(BUILDDIR)/$(PROJECT) OUTFILES = $(BUILDDIR)/$(PROJECT)
# Automatic compiler options # Automatic compiler options
OPT = $(USE_OPT) OPT = $(USE_OPT)
COPT = $(USE_COPT) COPT = $(USE_COPT)
CPPOPT = $(USE_CPPOPT) CPPOPT = $(USE_CPPOPT)
ifeq ($(USE_LINK_GC),yes) ifeq ($(USE_LINK_GC),yes)
OPT += -ffunction-sections -fdata-sections -fno-common OPT += -ffunction-sections -fdata-sections -fno-common
endif endif
# Source files groups and paths # Source files groups and paths
ifeq ($(USE_THUMB),yes) ifeq ($(USE_THUMB),yes)
TCSRC += $(CSRC) TCSRC += $(CSRC)
TCPPSRC += $(CPPSRC) TCPPSRC += $(CPPSRC)
else else
ACSRC += $(CSRC) ACSRC += $(CSRC)
ACPPSRC += $(CPPSRC) ACPPSRC += $(CPPSRC)
endif endif
ASRC = $(ACSRC)$(ACPPSRC) ASRC = $(ACSRC)$(ACPPSRC)
TSRC = $(TCSRC)$(TCPPSRC) TSRC = $(TCSRC)$(TCPPSRC)
SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC))) SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC)))
# Various directories # Various directories
OBJDIR = $(BUILDDIR)/obj OBJDIR = $(BUILDDIR)/obj
LSTDIR = $(BUILDDIR)/lst LSTDIR = $(BUILDDIR)/lst
# Object files groups # Object files groups
ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o))) ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o)))
ACPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACPPSRC:.cpp=.o))) ACPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACPPSRC:.cpp=.o)))
TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o))) TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o)))
TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o))) TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o)))
ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o))) ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o)))
ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o))) ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o)))
OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS) OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS)
# Paths # Paths
IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)) IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
# Macros # Macros
DEFS = $(DDEFS) $(UDEFS) DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS) ADEFS = $(DADEFS) $(UADEFS)
# Libs # Libs
LIBS = $(DLIBS) $(ULIBS) LIBS = $(DLIBS) $(ULIBS)
# Various settings # Various settings
#MCFLAGS = -mcpu=$(MCU) #MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS) CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS) CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
ifeq ($(USE_LINK_GC),yes) ifeq ($(USE_LINK_GC),yes)
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
else else
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
endif endif
# Generate dependency information # Generate dependency information
CFLAGS += -MD -MP -MF .dep/$(@F).d CFLAGS += -MD -MP -MF .dep/$(@F).d
CPPFLAGS += -MD -MP -MF .dep/$(@F).d CPPFLAGS += -MD -MP -MF .dep/$(@F).d
# Paths where to search for sources # Paths where to search for sources
VPATH = $(SRCPATHS) VPATH = $(SRCPATHS)
# #
# Makefile rules # Makefile rules
# #
all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK
MAKE_ALL_RULE_HOOK: MAKE_ALL_RULE_HOOK:
$(OBJS): | $(BUILDDIR) $(OBJS): | $(BUILDDIR)
$(BUILDDIR) $(OBJDIR) $(LSTDIR): $(BUILDDIR) $(OBJDIR) $(LSTDIR):
ifneq ($(USE_VERBOSE_COMPILE),yes) ifneq ($(USE_VERBOSE_COMPILE),yes)
@echo Compiler Options @echo Compiler Options
@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o @echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o
@echo @echo
endif endif
mkdir -p $(OBJDIR) mkdir -p $(OBJDIR)
mkdir -p $(LSTDIR) mkdir -p $(LSTDIR)
$(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile $(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ $(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ @$(CPPC) -c $(CPPFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(TCPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile $(TCPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CPPC) -c $(CPPFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(ACOBJS) : $(OBJDIR)/%.o : %.c Makefile $(ACOBJS) : $(OBJDIR)/%.o : %.c Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(CFLAGS) $(AOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(TCOBJS) : $(OBJDIR)/%.o : %.c Makefile $(TCOBJS) : $(OBJDIR)/%.o : %.c Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(CFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(ASMOBJS) : $(OBJDIR)/%.o : %.s Makefile $(ASMOBJS) : $(OBJDIR)/%.o : %.s Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@ $(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@ @$(AS) -c $(ASFLAGS) -I. $(IINCDIR) $< -o $@
endif endif
$(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile $(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ $(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
else else
@echo Compiling $(<F) @echo Compiling $(<F)
@$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@ @$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
endif endif
$(BUILDDIR)/$(PROJECT): $(OBJS) $(BUILDDIR)/$(PROJECT): $(OBJS)
ifeq ($(USE_VERBOSE_COMPILE),yes) ifeq ($(USE_VERBOSE_COMPILE),yes)
@echo @echo
$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ $(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
else else
@echo Linking $@ @echo Linking $@
@$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ @$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
endif endif
clean: clean:
@echo Cleaning @echo Cleaning
-rm -fR .dep $(BUILDDIR) -rm -fR .dep $(BUILDDIR)
@echo Done @echo Done
# #
# Include the dependency files, should be the last of the makefile # Include the dependency files, should be the last of the makefile
# #
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF *** # *** EOF ***

View File

@ -1,13 +1,13 @@
/** /**
* @file adc_inputs.h * @file adc_inputs.h
* *
* @date Dec 7, 2013 * @date Dec 7, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef ADC_INPUTS_H_ #ifndef ADC_INPUTS_H_
#define ADC_INPUTS_H_ #define ADC_INPUTS_H_
#include "adc_math.h" #include "adc_math.h"
#endif /* ADC_INPUTS_H_ */ #endif /* ADC_INPUTS_H_ */

View File

@ -1,57 +1,57 @@
/** /**
* @file board.c * @file board.c
* *
* @date Nov 15, 2013 * @date Nov 15, 2013
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "main.h" #include "main.h"
#include "boards.h" #include "boards.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "adc_math.h" #include "adc_math.h"
static Logging logger; static Logging logger;
extern engine_configuration_s *engineConfiguration; extern engine_configuration_s *engineConfiguration;
//float getVoltageDivided(int channel) { //float getVoltageDivided(int channel) {
// return 0; // return 0;
//} //}
// //
static float fakeAdcValues[16]; static float fakeAdcValues[16];
int getAdcValue(int hwChannel) { int getAdcValue(int hwChannel) {
return fakeAdcValues[hwChannel]; return fakeAdcValues[hwChannel];
} }
static void setVoltage(int hwChannel, float voltage) { static void setVoltage(int hwChannel, float voltage) {
scheduleMsg(&logger, "fake voltage: channel %d value %f", hwChannel, voltage); scheduleMsg(&logger, "fake voltage: channel %d value %f", hwChannel, voltage);
fakeAdcValues[hwChannel] = voltsToAdc(voltage); fakeAdcValues[hwChannel] = voltsToAdc(voltage);
} }
static void setCltVoltage(float voltage) { static void setCltVoltage(float voltage) {
setVoltage(engineConfiguration->cltAdcChannel, voltage); setVoltage(engineConfiguration->cltAdcChannel, voltage);
} }
static void setIatVoltage(float voltage) { static void setIatVoltage(float voltage) {
setVoltage(engineConfiguration->iatAdcChannel, voltage); setVoltage(engineConfiguration->iatAdcChannel, voltage);
} }
static void setMafVoltage(float voltage) { static void setMafVoltage(float voltage) {
setVoltage(engineConfiguration->mafAdcChannel, voltage); setVoltage(engineConfiguration->mafAdcChannel, voltage);
} }
static void setAfrVoltage(float voltage) { static void setAfrVoltage(float voltage) {
setVoltage(engineConfiguration->afrSensor.afrAdcChannel, voltage); setVoltage(engineConfiguration->afrSensor.afrAdcChannel, voltage);
} }
void initFakeBoard(void) { void initFakeBoard(void) {
initLogging(&logger, "simulator board"); initLogging(&logger, "simulator board");
addConsoleActionF("set_fake_clt_voltage", setCltVoltage); addConsoleActionF("set_fake_clt_voltage", setCltVoltage);
addConsoleActionF("set_fake_iat_voltage", setIatVoltage); addConsoleActionF("set_fake_iat_voltage", setIatVoltage);
addConsoleActionF("set_fake_maf_voltage", setMafVoltage); addConsoleActionF("set_fake_maf_voltage", setMafVoltage);
addConsoleActionF("set_fake_afr_voltage", setAfrVoltage); addConsoleActionF("set_fake_afr_voltage", setAfrVoltage);
} }

View File

@ -1,23 +1,32 @@
#ifndef BOARDS_FT_H_ #ifndef BOARDS_FT_H_
#define BOARDS_FT_H_ #define BOARDS_FT_H_
#define ADC_LOGIC_TPS 0 #define ADC_LOGIC_TPS 0
#define ADC_LOGIC_AFR 0 #define ADC_LOGIC_AFR 0
#define ADC_LOGIC_MAF 0 #define ADC_LOGIC_MAF 0
#define ADC_LOGIC_MAP 0 #define ADC_LOGIC_MAP 0
#define ADC_CHANNEL_VREF 0 #define ADC_CHANNEL_VREF 0
#define ADC_CHANNEL_VBATT 0 #define ADC_CHANNEL_VBATT 0
#define ADC_LOGIC_INTAKE_AIR 0 #define ADC_LOGIC_INTAKE_AIR 0
#define ADC_LOGIC_COOLANT 0 #define ADC_LOGIC_COOLANT 0
#define DELEGATE (&SD1) #define DELEGATE (&SD1)
#define EFI_CONSOLE_UART_DEVICE (&testStream) #define EFI_CONSOLE_UART_DEVICE (&testStream)
//float getVoltageDivided(int); #ifdef __cplusplus
int getAdcValue(int channel); extern "C"
void initFakeBoard(void); {
#endif /* __cplusplus */
#endif /* BOARDS_FT_H_ */
//float getVoltageDivided(int);
int getAdcValue(int channel);
void initFakeBoard(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BOARDS_FT_H_ */

View File

@ -1,13 +1,24 @@
/* /*
* efifeatures.h * efifeatures.h
* *
* Created on: Mar 7, 2014 * Created on: Mar 7, 2014
* Author: Andrey * Author: Andrey
*/ */
#ifndef EFIFEATURES_H_ #ifndef EFIFEATURES_H_
#define EFIFEATURES_H_ #define EFIFEATURES_H_
#define EFI_SIMULATOR TRUE
#endif /* EFIFEATURES_H_ */ #define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#define EFI_SIGNAL_EXECUTOR_SLEEP TRUE
#define EFI_WAVE_CHART TRUE
#endif /* EFIFEATURES_H_ */

View File

@ -1,163 +1,174 @@
/** /**
* @file rusEfiFunctionalTest.c * @file rusEfiFunctionalTest.c
* *
* @date Mar 1, 2014 * @date Mar 1, 2014
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#include "global.h" #include "global.h"
#include "rusEfiFunctionalTest.h" #include "rusEfiFunctionalTest.h"
#include "eficonsole.h" #include "eficonsole.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "rusefi_enums.h" #include "rusefi_enums.h"
#include "pwm_generator_logic.h" #include "pwm_generator_logic.h"
#include "wave_math.h" #include "wave_math.h"
#include "boards.h" #include "boards.h"
#include "trigger_central.h" #include "trigger_central.h"
#include "datalogging.h" #include "datalogging.h"
#include "algo.h" #include "algo.h"
#include "rpm_calculator.h" #include "rpm_calculator.h"
#include "wave_chart.h" #include "wave_chart.h"
#include "status_loop.h" #include "status_loop.h"
#include "trigger_emulator_algo.h" #include "trigger_emulator_algo.h"
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "allsensors.h" #include "allsensors.h"
#include "analog_chart.h"
extern WaveChart waveChart; extern WaveChart waveChart;
static engine_configuration_s ec; static persistent_config_s config;
static engine_configuration2_s ec2; static engine_configuration2_s ec2;
engine_configuration_s * engineConfiguration = &ec; engine_configuration_s * engineConfiguration = &config.engineConfiguration;
engine_configuration2_s *engineConfiguration2 = &ec2; board_configuration_s *boardConfiguration = &config.boardConfiguration;
engine_configuration2_s *engineConfiguration2 = &ec2;
void setOutputPinValue(io_pin_e pin, int logicValue) {
} void setOutputPinValue(io_pin_e pin, int logicValue) {
}
int isInjectionEnabled(void) {
return TRUE; int isInjectionEnabled(void) {
} return TRUE;
}
//void initOutputSignal(OutputSignal *signal, io_pin_e ioPin) {
// //void initOutputSignal(OutputSignal *signal, io_pin_e ioPin) {
//} //
//}
void idleDebug(char *msg, int value) {
void idleDebug(char *msg, int value) {
}
}
float getMap(void) {
return 0; float getMap(void) {
} return 0;
}
static int primaryWheelState = FALSE;
static int secondaryWheelState = FALSE; static int primaryWheelState = FALSE;
static int secondaryWheelState = FALSE;
static void triggerEmulatorCallback(PwmConfig *state, int stateIndex) {
int newPrimaryWheelState = state->multiWave.waves[0].pinStates[stateIndex]; static void triggerEmulatorCallback(PwmConfig *state, int stateIndex) {
int newSecondaryWheelState = state->multiWave.waves[1].pinStates[stateIndex]; int newPrimaryWheelState = state->multiWave.waves[0].pinStates[stateIndex];
int newSecondaryWheelState = state->multiWave.waves[1].pinStates[stateIndex];
if (primaryWheelState != newPrimaryWheelState) {
primaryWheelState = newPrimaryWheelState; if (primaryWheelState != newPrimaryWheelState) {
hwHandleShaftSignal(primaryWheelState ? SHAFT_PRIMARY_UP : SHAFT_PRIMARY_DOWN); primaryWheelState = newPrimaryWheelState;
} hwHandleShaftSignal(primaryWheelState ? SHAFT_PRIMARY_UP : SHAFT_PRIMARY_DOWN);
}
if (secondaryWheelState != newSecondaryWheelState) {
secondaryWheelState = newSecondaryWheelState; if (secondaryWheelState != newSecondaryWheelState) {
hwHandleShaftSignal(secondaryWheelState ? SHAFT_SECONDARY_UP : SHAFT_SECONDARY_DOWN); secondaryWheelState = newSecondaryWheelState;
} hwHandleShaftSignal(secondaryWheelState ? SHAFT_SECONDARY_UP : SHAFT_SECONDARY_DOWN);
}
// print("hello %d\r\n", chTimeNow());
} // print("hello %d\r\n", chTimeNow());
}
void rusEfiFunctionalTest(void) {
initializeConsole(); void rusEfiFunctionalTest(void) {
initializeConsole();
initFakeBoard();
initFakeBoard();
initStatusLoop();
initStatusLoop();
resetConfigurationExt(FORD_ASPIRE_1996, engineConfiguration, engineConfiguration2);
resetConfigurationExt(FORD_ASPIRE_1996, engineConfiguration, engineConfiguration2, boardConfiguration);
initThermistors();
initAlgo(); initThermistors();
initRpmCalculator(); initAlgo();
initRpmCalculator();
initTriggerEmulatorLogic(triggerEmulatorCallback);
initAnalogChart();
initMainEventListener();
initTriggerEmulatorLogic(triggerEmulatorCallback);
initTriggerCentral();
initMainEventListener();
}
initTriggerCentral();
void printPendingMessages(void) {
printPending(); }
if (getFullLog()) {
printSensors(); void printPendingMessages(void) {
finishStatusLine(); printPending();
publishChartIfFull(&waveChart); if (getFullLog()) {
} printState(getCrankEventCounter());
} finishStatusLine();
publishChartIfFull(&waveChart);
static size_t wt_writes(void *ip, const uint8_t *bp, size_t n) { }
printToWin32Console((char*)bp); }
return DELEGATE->vmt->write(DELEGATE, bp, n);
} static size_t wt_writes(void *ip, const uint8_t *bp, size_t n) {
printToWin32Console((char*)bp);
static size_t wt_reads(void *ip, uint8_t *bp, size_t n) { return DELEGATE->vmt->write(DELEGATE, bp, n);
return DELEGATE->vmt->read(DELEGATE, bp, n); }
}
static size_t wt_reads(void *ip, uint8_t *bp, size_t n) {
static char putMessageBuffer[2]; return DELEGATE->vmt->read(DELEGATE, bp, n);
}
static msg_t wt_put(void *ip, uint8_t b) {
putMessageBuffer[0] = b; static char putMessageBuffer[2];
putMessageBuffer[1] = 0;
printToWin32Console((char*)putMessageBuffer); static msg_t wt_put(void *ip, uint8_t b) {
// cputs("wt_put"); putMessageBuffer[0] = b;
return DELEGATE->vmt->put(DELEGATE, b); putMessageBuffer[1] = 0;
} printToWin32Console((char*)putMessageBuffer);
// cputs("wt_put");
static msg_t wt_get(void *ip) { return DELEGATE->vmt->put(DELEGATE, b);
// cputs("wt_get"); }
//return 0;
return DELEGATE->vmt->get(DELEGATE); static msg_t wt_get(void *ip) {
} // cputs("wt_get");
//return 0;
static const struct Win32TestStreamVMT vmt = { wt_writes, wt_reads, wt_put, wt_get }; return DELEGATE->vmt->get(DELEGATE);
}
void initTestStream(TestStream *ts) {
ts->vmt = &vmt; static const struct Win32TestStreamVMT vmt = { wt_writes, wt_reads, wt_put, wt_get };
}
void initTestStream(TestStream *ts) {
int isSerialOverTcpReady; ts->vmt = &vmt;
}
int is_serial_ready(void) {
return isSerialOverTcpReady; int isSerialOverTcpReady;
}
int is_serial_ready(void) {
void onFatalError(const char *msg, char * file, int line) { return isSerialOverTcpReady;
printf("onFatalError %s %s%d", msg, file, line); }
exit(-1);
} void onFatalError(const char *msg, char * file, int line) {
printf("onFatalError %s %s%d", msg, file, line);
int warning(const char *fmt, ...) { exit(-1);
printf("Warning: %s\r\n", fmt); }
return 0;
} int warning(obd_code_e code, const char *fmt, ...) {
printf("Warning: %s\r\n", fmt);
return 0;
void firmwareError(const char *fmt, ...) { }
fatal3((char*)fmt, __FILE__, __LINE__);
} void firmwareError(const char *fmt, ...) {
fatal3((char*)fmt, __FILE__, __LINE__);
int hasFatalError(void) { }
return false;
} int hasFatalError(void) {
return false;
int getVersion(void) { }
return 239;
} void chDbgPanic3(const char *msg, char * file, int line) {
onFatalError(msg, file, line);
}
uint64_t getTimeNowUs(void) {
return chTimeNow() * (1000000 / CH_FREQUENCY);
}
int getRusEfiVersion(void) {
return 239;
}

View File

@ -1,15 +1,15 @@
/** /**
* @file rusEfiFunctionalTest.h * @file rusEfiFunctionalTest.h
* *
* @date Mar 1, 2014 * @date Mar 1, 2014
* @author Andrey Belomutskiy, (c) 2012-2013 * @author Andrey Belomutskiy, (c) 2012-2013
*/ */
#ifndef RUSEFIFUNCTIONALTEST_H_ #ifndef RUSEFIFUNCTIONALTEST_H_
#define RUSEFIFUNCTIONALTEST_H_ #define RUSEFIFUNCTIONALTEST_H_
void rusEfiFunctionalTest(void); void rusEfiFunctionalTest(void);
void initTestStream(TestStream *ts); void initTestStream(TestStream *ts);
void printPendingMessages(void); void printPendingMessages(void);
#endif /* RUSEFIFUNCTIONALTEST_H_ */ #endif /* RUSEFIFUNCTIONALTEST_H_ */

View File

@ -1,2 +1,2 @@
int getVersion(void); int getRusEfiVersion(void);