Moved remotely

git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@113 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
Matthias
2009-01-12 08:38:14 +00:00
parent 4e45654a5f
commit 6cc948eef8
204 changed files with 0 additions and 0 deletions
+607
View File
@@ -0,0 +1,607 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/BusProtocol"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/BusProtocol/Debug"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" 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"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="BusProtocol" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" 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.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684" name="Debug" parent="cdt.managedbuild.config.gnu.cygwin.lib.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug.326940027" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug.1094805505" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/BusProtocol/Debug}" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.target.gnu.builder.cygwin.lib.debug.1509971901" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.lib.debug"/>
<tool command="arm-elf-as" id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.debug.772227085" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1203300128" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool command="arm-elf-ar" id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug.777348117" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.debug.858821726" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.debug"/>
<tool command="arm-elf-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug">
<option id="gnu.c.compiler.option.include.paths.1509385572" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Drivers}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BusProtocol}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/FreeRTOS/include}&quot;"/>
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1680796165" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="ROWLEY_LPC23xx"/>
<listOptionValue builtIn="false" value="THUMB_INTERWORK"/>
<listOptionValue builtIn="false" value="ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)"/>
<listOptionValue builtIn="false" value="PACK_STRUCT_END=__attribute\(\(packed\)\)"/>
</option>
<option id="gnu.c.compiler.option.misc.other.499633930" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -fshort-enums -mthumb-interwork" valueType="string"/>
<option id="gnu.c.compiler.cygwin.lib.debug.option.optimization.level.563157300" name="Optimization Level" superClass="gnu.c.compiler.cygwin.lib.debug.option.optimization.level" value="gnu.c.optimization.level.more" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1773436851" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.1204613450" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811;cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684;cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/BusProtocol"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/BusProtocol/Release"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" 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"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="BusProtocol" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" 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.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811" name="Release" parent="cdt.managedbuild.config.gnu.cygwin.lib.release">
<folderInfo id="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.lib.release.1075073645" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.lib.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.cygwin.lib.release.152549363" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.cygwin.lib.release"/>
<builder buildPath="${workspace_loc:/BusProtocol/Release}" id="cdt.managedbuild.target.gnu.builder.cygwin.lib.release.1933028258" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.release.983843060" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.329238432" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release.919655387" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.release.1331857812" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.release">
<option id="gnu.cpp.compiler.cygwin.lib.release.option.optimization.level.1532574349" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.cygwin.lib.release.option.debugging.level.1861766211" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.cygwin.lib.release.option.optimization.level.1435830" name="Optimization Level" superClass="gnu.c.compiler.cygwin.lib.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.cygwin.lib.release.option.debugging.level.570236671" name="Debug Level" superClass="gnu.c.compiler.cygwin.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1391519689" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.1610264802" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811;cdt.managedbuild.config.gnu.cygwin.lib.release.1186752811.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release.782884106;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2138187002">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684;cdt.managedbuild.config.gnu.cygwin.lib.debug.1544585684.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug.1733787066;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.456804014">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="BusProtocol.cdt.managedbuild.target.gnu.cygwin.lib.1635067160" name="Static Library" projectType="cdt.managedbuild.target.gnu.cygwin.lib"/>
</storageModule>
</cproject>
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BusProtocol</name>
<comment></comment>
<projects>
<project>Drivers</project>
<project>FreeRTOS</project>
<project>inc</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/BusProtocol/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,131 @@
/* ---------------------------------------------------------------------------
* BpMessageFormat.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "BpMessageFormat.h"
#include "Crc.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
/** \brief Calculates the CRC over payload etc... and sets unique start byte
*
* \param msg Message over which the CRC should be calculated
*/
void bpmsgEncodeMessage( t_bpmsg_message * msg )
{
UINT16 crc;
crc = crcCalc( &msg->payloadSize, 1, 0);
crc = crcCalc( msg->payload, msg->payloadSize, crc);
msg->crc = crc;
}
void bpmsgAdd16bit(UINT8 *payloadlocation, UINT16 data)
{
UINT8 index = 0;
payloadlocation[index] = (UINT8)(data >> 8);
index++;
payloadlocation[index] = (UINT8)(data & 0x00FF);
}
void bpmsgAdd32bit(UINT8 *payloadlocation, UINT32 data)
{
UINT8 index = 0;
payloadlocation[index] = (UINT8)(data >> 24);
index++;
payloadlocation[index] = (UINT8)(data >> 16);
index++;
payloadlocation[index] = (UINT8)(data >> 8);
index++;
payloadlocation[index] = (UINT8)(data & 0xFF);
}
UINT8 bpmsgGet8bit(UINT8 *payload, UINT8 *payloadIndex)
{
UINT8 result;
result = (UINT8)payload[*payloadIndex];
(*payloadIndex)++;
return result;
}
UINT16 bpmsgGet16bit(UINT8 *payload, UINT8 *payloadIndex)
{
UINT16 result;
result = ((UINT16)payload[*payloadIndex]) << 8;
(*payloadIndex)++;
result += ((UINT16)payload[*payloadIndex] & 0x00FF);
(*payloadIndex)++;
return result;
}
UINT32 bpmsgGet32bit(UINT8 *payload, UINT8 *payloadIndex)
{
UINT32 result;
result = ((UINT32)payload[*payloadIndex]) << 24;
(*payloadIndex)++;
result += ((UINT32)payload[*payloadIndex]) << 16;
(*payloadIndex)++;
result += ((UINT32)payload[*payloadIndex]) << 8;
(*payloadIndex)++;
result += ((UINT32)payload[*payloadIndex] & 0x000000FF);
(*payloadIndex)++;
return result;
}
@@ -0,0 +1,102 @@
/* ---------------------------------------------------------------------------
* BpMessageFormat.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __BPMESSAGEFORMAT_H__
#define __BPMESSAGEFORMAT_H__
/** \file BpMessageFormat.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "types.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define BPMSG_STARTBYTE (0xAA)
#define BPMSG_MSGID_PASSTURN (0x00)
#define BPMSG_MSGID_RESETCLIENT (0x01)
#define BPMSG_MSGID_GIVEELECTRONICSTATUS (0x02)
#define BPMSG_MSGID_SETDACVALUE (0x03)
#define BPMSG_MSGID_SETDIGITALOUTVALUE (0x04)
#define BPMSG_MSGID_SETADCMODE (0x05)
#define BPMSG_MSGID_SETALLDIGITALOUT (0x06)
#define BPMSG_MSGID_SETALLDACVALUES (0x07)
#define BPMSG_MSGID_SETALLDOUTPUT (0x08)
#define BPMSG_MSGID_CALLRPC (0x10)
#define BPMSG_MSGID_GIVERPCRESULTS (0x11)
#define BPMSG_BROADCAST_ID (0xFF)
#define BPMSG_MASTER_DEVID (0x01)
#define BPMSG_STATUS_FINISHEDSENDING (0xC0)
#define BPMSG_STATUS_BUSYSENDING (0x40)
#define BPMSG_DACMODE_VOLTAGE (0x00)
#define BPMSG_DACMODE_CURRENT (0x01)
#define BPMSG_ADCMODE_VOLTAGE (0x00)
#define BPMSG_ADCMODE_CURRENT (0x01)
#define BPMSG_RPC_ERRORRESULT (0xFF)
#define BPMSG_UINT32_SIZE (4)
#define BPMSG_UINT16_SIZE (2)
#define BPMSG_UINT8_SIZE (1)
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
typedef struct t_BPMSG_MESSAGE {
UINT8 uniqueStartByte;
UINT8 senderId;
UINT8 targetId;
UINT8 packetNr;
UINT8 status;
UINT8 messageId;
UINT8 payloadSize;
UINT8 *payload;
UINT16 crc;
} t_bpmsg_message;
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Calculates the CRC over payload and sets unique start byte */
void bpmsgEncodeMessage( t_bpmsg_message * msg );
void bpmsgAdd16bit(UINT8 *payloadlocation, UINT16 data);
void bpmsgAdd32bit(UINT8 *payloadlocation, UINT32 data);
UINT8 bpmsgGet8bit(UINT8 *payload, UINT8 *payloadIndex);
UINT16 bpmsgGet16bit(UINT8 *payload, UINT8 *payloadIndex);
UINT32 bpmsgGet32bit(UINT8 *payload, UINT8 *payloadIndex);
#endif /* __BPMESSAGEFORMAT_H__ */
@@ -0,0 +1,685 @@
/* ---------------------------------------------------------------------------
* BusProtocol.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 28, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "types.h"
#include "BusProtocol.h"
#include "ProtocolThread.h"
#include "MessageHandlerQueue.h"
#include "RemoteProcedureCalls.h"
#include "RpcResults.h"
#include "bus.h"
#include "serial.h"
#include "ElecStatusCache.h"
#include "mem_mod.h"
#include "FreeRTOS.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
typedef struct t_BP_ADMIN {
UINT8 deviceId;
UINT8 rpcRequestNr;
int rpcHandle;
int rpcrHandle;
int bpthreadHandle;
int messageHandlerHandle;
} t_bp_admin;
memman *bpMessagePool;
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
static void WriteElectricStatusCallback( int handle, BOOLEAN isDigital, UINT8 device, UINT8 channel, UINT16 value );
/** \brief Initialises the BusProtocol
*
* \param bus The bus to communicate on
* \param deviceId the bus identity for this device
* \retval the handle for the BusProtocol-driver (0 = unsuccesfull)
*/
int bpInit( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, UINT8 inputQueueSize )
{
t_bp_admin *newBusProtocol = (t_bp_admin *)pvPortMalloc( sizeof(t_bp_admin));
if (newBusProtocol != NULL)
{
// Fill administration
newBusProtocol->deviceId = deviceId;
newBusProtocol->rpcRequestNr = 0;
newBusProtocol->rpcHandle = rpcInit();
newBusProtocol->rpcrHandle = rpcrInit();
newBusProtocol->messageHandlerHandle = mhqInit();
// Allocate payload queue
bpMessagePool = Memmod_Create( inputQueueSize, 64); // Make sure size is dividable by 4
// Register RPC Callback
mhqAdd( newBusProtocol->messageHandlerHandle, BPMSG_MSGID_CALLRPC, rpcRequestHandler, newBusProtocol->rpcHandle );
// Register RPC-result Callback
mhqAdd( newBusProtocol->messageHandlerHandle, BPMSG_MSGID_GIVERPCRESULTS, rpcrRequestHandler, newBusProtocol->rpcrHandle );
// Register Write electronic status callbac )
bpecAttachWriteCallback(newBusProtocol, WriteElectricStatusCallback);
// Open bus
busInit(recvBus);
if (recvBus != sendBus)
{
busInit(sendBus);
}
// Create & start thread to poll bus
newBusProtocol->bpthreadHandle = bpthreadStart( recvBus, sendBus, deviceId, highestDeviceId, (int)newBusProtocol, newBusProtocol->messageHandlerHandle );
}
return (int)newBusProtocol;
}
/** \brief Closes the active BusProtocol
*
* \post Protocol on this handle cannot be used anymore
* \param handle The handle for the BusProtocol (received with bpInit())
*/
void bpDeinit( int handle )
{
// Stop & Destroy the bus poll thread
rpcDeinit( ((t_bp_admin *)handle)->rpcHandle );
rpcrDeinit( ((t_bp_admin *)handle)->rpcrHandle );
bpthreadStop( ((t_bp_admin *)handle)->bpthreadHandle );
// Free BusProtocol-administration
vPortFree( (void *)handle );
}
/** \brief Indicates whether a message a device is received in the last 10 seconds
* Only used by the master
*/
BOOLEAN bpDeviceIsDetected( int handle, UINT8 deviceId )
{
return bpthreadDeviceIsDetected(((t_bp_admin *)handle)->bpthreadHandle, deviceId);
}
/** \brief Sends message to pass turn (Nothing to send)
*
* \param handle The handle for the BusProtocol (received with bpInit())
*/
void bpSendPassTurn( int handle )
{
t_bpmsg_message sendPassTurnMessage;
BP_DEBUG_OUT('p');BP_DEBUG_OUT('>');
// Create new message
sendPassTurnMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendPassTurnMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendPassTurnMessage.targetId = BPMSG_BROADCAST_ID;
sendPassTurnMessage.packetNr = 0; // packetNr filled at transmitting time
sendPassTurnMessage.status = 0; // Clear status (filled by ProtocolThread)
sendPassTurnMessage.messageId = BPMSG_MSGID_PASSTURN;
sendPassTurnMessage.payloadSize = 0;
sendPassTurnMessage.payload = NULL;
// Calculate CRC
bpmsgEncodeMessage(&sendPassTurnMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendPassTurnMessage);
}
/** \brief Sends message to reset another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId Identity of targeted bus device (0xFF = all devices)
*/
void bpSendResetClient( int handle, UINT8 deviceId )
{
t_bpmsg_message sendResetClientMessage;
// Create new message
sendResetClientMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendResetClientMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendResetClientMessage.targetId = deviceId;
sendResetClientMessage.packetNr = 0; // packetNr filled at transmitting time
sendResetClientMessage.status = 0; // Clear status (filled by ProtocolThread)
sendResetClientMessage.messageId = BPMSG_MSGID_RESETCLIENT;
sendResetClientMessage.payloadSize = 0;
sendResetClientMessage.payload = NULL;
// Calculate CRC
bpmsgEncodeMessage(&sendResetClientMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendResetClientMessage);
}
/** \brief Sends message with all electronic information (DAC's, ADC's and digital I/O)
*
* Broadcasts the electronic status of the device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param nrOfAdcValues Number of ADC-values included in the message
* \param adcValues Pointer to a UINT16 array
* \param nrOfDacValues Number of DAC-values included in the message
* \param dacValues Pointer to a UINT16 array
* \param nrOfDiValues Number of digital input values included in the message
* \param diValues Digital input channel values (8 channels per byte)
* \param nrOfDoValues Number of digital output values inculded in the message
* \param doValues Digital output channel values (8 channels per byte)
*/
void bpSendGiveElectronicStatus( int handle,
UINT8 nrOfAdcValues,
UINT16 *adcValues,
UINT8 nrOfDacValues,
UINT16 *dacValues,
UINT8 nrOfDiValues,
UINT8 *diValues,
UINT8 nrOfDoValues,
UINT8 *doValues
)
{
t_bpmsg_message sendGiveElectronicStatusMessage;
UINT8 *payload;
UINT16 payloadSize;
UINT8 payloadIndex = 0;
UINT8 index;
// Determine payload size
payloadSize = BPMSG_UINT8_SIZE;
payloadSize += nrOfAdcValues * BPMSG_UINT16_SIZE;
payloadSize += BPMSG_UINT8_SIZE;
payloadSize += nrOfDacValues * BPMSG_UINT16_SIZE;
payloadSize += BPMSG_UINT8_SIZE;
payloadSize += nrOfDiValues * BPMSG_UINT8_SIZE;
payloadSize += BPMSG_UINT8_SIZE;
payloadSize += nrOfDoValues * BPMSG_UINT8_SIZE;
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
// Create new message
sendGiveElectronicStatusMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendGiveElectronicStatusMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendGiveElectronicStatusMessage.targetId = BPMSG_BROADCAST_ID;
sendGiveElectronicStatusMessage.packetNr = 0; // packetNr filled at transmitting time
sendGiveElectronicStatusMessage.status = 0; // Clear status (filled by ProtocolThread)
sendGiveElectronicStatusMessage.messageId = BPMSG_MSGID_GIVEELECTRONICSTATUS;
sendGiveElectronicStatusMessage.payloadSize = payloadSize;
sendGiveElectronicStatusMessage.payload = payload;
// Fill Payload
payload[payloadIndex] = nrOfAdcValues;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfAdcValues; index++)
{
bpmsgAdd16bit( &payload[payloadIndex], adcValues[index]);
payloadIndex += BPMSG_UINT16_SIZE;
}
payload[payloadIndex] = nrOfDacValues;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfDacValues; index++)
{
bpmsgAdd16bit( &payload[payloadIndex], dacValues[index]);
payloadIndex += BPMSG_UINT16_SIZE;
}
payload[payloadIndex] = nrOfDiValues;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfDiValues; index++)
{
payload[payloadIndex] = diValues[index];
payloadIndex += BPMSG_UINT8_SIZE;
}
payload[payloadIndex] = nrOfDoValues;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfDoValues; index++)
{
payload[payloadIndex] = doValues[index];
payloadIndex += BPMSG_UINT8_SIZE;
}
// Calculate CRC
bpmsgEncodeMessage(&sendGiveElectronicStatusMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendGiveElectronicStatusMessage);
}
/** \brief Sends message to set a DAC on another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId Identity of targeted bus device
* \param channelNr Number of the DAC-channel
* \param dacMode Voltage (0) / Ampere (<> 0)
* \param davValue New DAC value (voltage: 0-10000mV, ampere: 0-20000uA)
*/
void bpSendSetDacValue( int handle, UINT8 deviceId, UINT8 channelNr, UINT8 dacMode, UINT16 dacValue )
{
t_bpmsg_message sendSetDacMessage;
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('>');
// Create new message
sendSetDacMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendSetDacMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendSetDacMessage.targetId = deviceId;
sendSetDacMessage.packetNr = 0; // packetNr filled at transmitting time
sendSetDacMessage.status = 0; // Clear status (filled by ProtocolThread)
sendSetDacMessage.messageId = BPMSG_MSGID_SETDACVALUE;
sendSetDacMessage.payloadSize = 4;
sendSetDacMessage.payload = payload;
// Fill Payload
payload[0] = channelNr;
payload[1] = dacMode;
bpmsgAdd16bit( &payload[2], dacValue);
// Calculate CRC
bpmsgEncodeMessage(&sendSetDacMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDacMessage);
}
/** \brief Sends message to set the values of all DAC's on another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId Identity of targeted bus device
* \param davValue pointer to array with 4 DAC value, i.e. DAC-value position 0 for Channel 0 etc... (voltage: 0-10000mV, ampere: 0-20000uA)
*/
void bpSendSetAllDacValues( int handle, UINT8 deviceId, UINT16 *dacValue )
{
t_bpmsg_message sendSetDacMessage;
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('>');
// Create new message
sendSetDacMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendSetDacMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendSetDacMessage.targetId = deviceId;
sendSetDacMessage.packetNr = 0; // packetNr filled at transmitting time
sendSetDacMessage.status = 0; // Clear status (filled by ProtocolThread)
sendSetDacMessage.messageId = BPMSG_MSGID_SETALLDACVALUES;
sendSetDacMessage.payloadSize = 4 * 2;
sendSetDacMessage.payload = payload;
// Fill Payload
bpmsgAdd16bit( &payload[0], dacValue[0]);
bpmsgAdd16bit( &payload[2], dacValue[1]);
bpmsgAdd16bit( &payload[4], dacValue[2]);
bpmsgAdd16bit( &payload[6], dacValue[3]);
// Calculate CRC
bpmsgEncodeMessage(&sendSetDacMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDacMessage);
}
/** \brief Sends message to set a digital out on another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param bitNr Number of the digital output pin
* \param value Low-level (0) or High-level (<> 0)
*/
void bpSendSetDigitalOutValue( int handle, UINT8 deviceId, UINT8 bitNr, UINT8 value )
{
t_bpmsg_message sendSetDoMessage;
UINT8 *payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
BP_DEBUG_OUT('d'); BP_DEBUG_OUT('>');
// Create new message
sendSetDoMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendSetDoMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendSetDoMessage.targetId = deviceId;
sendSetDoMessage.packetNr = 0; // packetNr filled at transmitting time
sendSetDoMessage.status = 0; // Clear status (filled by ProtocolThread)
sendSetDoMessage.messageId = BPMSG_MSGID_SETDIGITALOUTVALUE;
sendSetDoMessage.payloadSize = 2;
sendSetDoMessage.payload = payload;
// Fill Payload
payload[0] = bitNr;
payload[1] = value;
// Calculate CRC
bpmsgEncodeMessage(&sendSetDoMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDoMessage);
}
/** \brief Sends message to set all digital out ports at once on another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId The ID of the other bus device
* \param bits All bitsNumber of the digital output pin
*/
void bpSendSetAllDigitalOut( int handle, UINT8 deviceId, UINT8 bits)
{
t_bpmsg_message sendSetDoMessage;
UINT8 *payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
BP_DEBUG_OUT('d'); BP_DEBUG_OUT('>');
// Create new message
sendSetDoMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendSetDoMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendSetDoMessage.targetId = deviceId;
sendSetDoMessage.packetNr = 0; // packetNr filled at transmitting time
sendSetDoMessage.status = 0; // Clear status (filled by ProtocolThread)
sendSetDoMessage.messageId = BPMSG_MSGID_SETALLDIGITALOUT;
sendSetDoMessage.payloadSize = 1;
sendSetDoMessage.payload = payload;
// Fill Payload
payload[0] = bits;
// Calculate CRC
bpmsgEncodeMessage(&sendSetDoMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetDoMessage);
}
/** \brief Sends message to set all outputs (analogue & digital) on another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId Identity of targeted bus device
* \param bits All bitsNumber of the digital output pin
* \param davValue pointer to array with 4 DAC value, i.e. DAC-value position 0 for Channel 0 etc... (voltage: 0-10000mV, ampere: 0-20000uA)
*/
void bpSendSetAllOutput( int handle, UINT8 deviceId, UINT8 bits, UINT16 *dacValue )
{
t_bpmsg_message sendSetAllOutpuntMessage;
UINT8 *payload = (UINT8 *) Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
BP_DEBUG_OUT('a'); BP_DEBUG_OUT('o'); BP_DEBUG_OUT('>');
// Create new message
sendSetAllOutpuntMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendSetAllOutpuntMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendSetAllOutpuntMessage.targetId = deviceId;
sendSetAllOutpuntMessage.packetNr = 0; // packetNr filled at transmitting time
sendSetAllOutpuntMessage.status = 0; // Clear status (filled by ProtocolThread)
sendSetAllOutpuntMessage.messageId = BPMSG_MSGID_SETALLDOUTPUT;
sendSetAllOutpuntMessage.payloadSize = (4 * 2) + 1;
sendSetAllOutpuntMessage.payload = payload;
// Fill Payload
payload[0] = bits;
bpmsgAdd16bit( &payload[1], dacValue[0]);
bpmsgAdd16bit( &payload[3], dacValue[1]);
bpmsgAdd16bit( &payload[5], dacValue[2]);
bpmsgAdd16bit( &payload[7], dacValue[3]);
// Calculate CRC
bpmsgEncodeMessage(&sendSetAllOutpuntMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendSetAllOutpuntMessage);
}
/** \brief Sends message to call an Remote Procedure Call on an other bus device
*
* Request to execute a procedure on another device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param deviceId Identity of targeted bus device
* \param functionId Identity of the RPC-function
* \param nrOfParams Number of parameters for the RPC-function
* \param params Pointer to an array of 32-bit integers
*/
void bpSendCallRpc( int handle, UINT8 deviceId, UINT8 functionId, UINT8 nrOfParams, INT32 *params )
{
t_bpmsg_message sendCallRpcMessage;
UINT8 *payload;
UINT8 payloadSize;
UINT8 payloadIndex = 0;
UINT8 index;
BP_DEBUG_OUT('c'); BP_DEBUG_OUT('>');
// Determine payload size
payloadSize = 3 * BPMSG_UINT8_SIZE;
payloadSize += nrOfParams * BPMSG_UINT32_SIZE;
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
// Create new message
sendCallRpcMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendCallRpcMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendCallRpcMessage.targetId = deviceId;
sendCallRpcMessage.packetNr = 0; // packetNr filled at transmitting time
sendCallRpcMessage.status = 0; // Clear status (filled by ProtocolThread)
sendCallRpcMessage.messageId = BPMSG_MSGID_CALLRPC;
sendCallRpcMessage.payloadSize = payloadSize;
sendCallRpcMessage.payload = payload;
// Fill Payload
payload[payloadIndex] = ((t_bp_admin *)handle)->rpcRequestNr;
((t_bp_admin *)handle)->rpcRequestNr++;
payloadIndex += BPMSG_UINT8_SIZE;
payload[payloadIndex] = functionId;
payloadIndex += BPMSG_UINT8_SIZE;
payload[payloadIndex] = nrOfParams;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfParams; index++)
{
bpmsgAdd32bit( payload + payloadIndex, (UINT32)params[index]);
payloadIndex += BPMSG_UINT32_SIZE;
}
if (payloadIndex >= 54)
{
serWrite(1, sizeof("Message too large"), "Message too large");
}
// Calculate CRC
bpmsgEncodeMessage(&sendCallRpcMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendCallRpcMessage);
}
/** \brief Sends message to give result on issued RPC-function
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param nrOfResults Number of results to be send
* \param results Pointer to array with results.
*/
void bpSendRpcResult( int handle, UINT8 deviceId, UINT8 functionId, UINT8 requestNr, UINT8 nrOfResults, INT32 *results )
{
t_bpmsg_message sendCallRpcResultMessage;
UINT8 *payload;
UINT8 payloadSize;
UINT8 payloadIndex = 0;
UINT8 index;
BP_DEBUG_OUT('r'); BP_DEBUG_OUT('>');
// Determine payload size
payloadSize = 3 * BPMSG_UINT8_SIZE;
payloadSize += nrOfResults * BPMSG_UINT32_SIZE;
payload = (UINT8 *)Memmod_Alloc( bpMessagePool );
if (payload == 0) return;
// Create new message
sendCallRpcResultMessage.uniqueStartByte = BPMSG_STARTBYTE;
sendCallRpcResultMessage.senderId = ((t_bp_admin *)handle)->deviceId;
sendCallRpcResultMessage.targetId = deviceId;
sendCallRpcResultMessage.packetNr = 0; // packetNr filled at transmitting time
sendCallRpcResultMessage.status = 0; // Clear status (filled by ProtocolThread)
sendCallRpcResultMessage.messageId = BPMSG_MSGID_GIVERPCRESULTS;
sendCallRpcResultMessage.payloadSize = payloadSize;
sendCallRpcResultMessage.payload = payload;
// Fill Payload
payload[payloadIndex] = requestNr;
payloadIndex += BPMSG_UINT8_SIZE;
payload[payloadIndex] = functionId;
payloadIndex += BPMSG_UINT8_SIZE;
payload[payloadIndex] = nrOfResults;
payloadIndex += BPMSG_UINT8_SIZE;
for (index = 0; index < nrOfResults; index++)
{
bpmsgAdd32bit( &payload[payloadIndex], (UINT32)results[index]);
payloadIndex += BPMSG_UINT32_SIZE;
}
// Calculate CRC
bpmsgEncodeMessage(&sendCallRpcResultMessage);
bpthreadAddMessage(((t_bp_admin *)handle)->bpthreadHandle, &sendCallRpcResultMessage);
}
/** \brief Attachs a callback, which is called when it is the device its turn to send data on the bus
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param onMyTurnCallback pointer to the callback function
*/
void bpAttachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
bpthreadAttachMyTurn( bpAdmin->bpthreadHandle, onMyTurnCallback);
}
/** \brief Detaches the above callback
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param onMyTurnCallback pointer to the callback function
*/
void bpDetachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
bpthreadDetachMyTurn( bpAdmin->bpthreadHandle, onMyTurnCallback);
}
/** \brief Attachs a RPC-function, which can be called by another bus device
*
* \param handle The handle for the BusProtocol (received with bpInit())
* \param functionId The identity of the RPC-function
* \param functionPointer Pointer to actual RPC-function
* \param nrOfParams Number of parameters, required by RPC
*/
void bpAttachRpc( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call functionPointer, UINT8 nrOfParams )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
rpcAdd( bpAdmin->rpcHandle, functionId, functionName, functionPointer, nrOfParams);
}
/** \brief Detaches the above RPC-function
*
* \post RPC-function is not supported anymore
* \param handle The handle for the BusProtocol (received with bpInit())
* \param functionId Identity of the detached RPC-function
*/
void bpDetachRpc( int handle, UINT8 functionId )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
rpcRemove( bpAdmin->rpcHandle, functionId );
}
/** \brief Attachs a "RPC result"-function, which is a result of a requeste RPC-call on another bus device
*
* \param handle The handle for the BusProtocol (returned by bpInit())
* \param functionId The functionId on which the result should be catched
* \param functionPointer The funtion which must be called when a RPC-result is received.
*/
void bpAttachRpcResult( int handle, UINT8 functionId, t_bp_rpcresult_callback functionPointer, UINT8 nrOfResults )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
rpcrAdd( bpAdmin->rpcrHandle, functionId, functionPointer, nrOfResults);
}
/** \brief Detaches the above "RPC result"-function
*
* \param handle The handle for the BusProtocol (returned by bpInit())
* \param functionId The functionId on which the result should be catched
*/
void bpDetachRpcResult( int handle, UINT8 functionId )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
rpcrRemove( bpAdmin->rpcrHandle, functionId );
}
t_rpc_entity *bpLookupRpcEntry( int handle, UINT8 functionId )
{
t_bp_admin *bpAdmin = (t_bp_admin *)handle;
return rpcLookupEntry( bpAdmin->rpcHandle, functionId );
}
void WriteElectricStatusCallback( int handle, BOOLEAN isDigital, UINT8 device, UINT8 channel, UINT16 value )
{
if (isDigital)
{
bpSendSetDigitalOutValue( handle, device, channel, (BOOLEAN)value ) ;
}
else
{
bpSendSetDacValue( handle, device, channel, 0, value );
}
}
@@ -0,0 +1,141 @@
/* ---------------------------------------------------------------------------
* BusProtocol.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 28, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __BUSPROTOCOL_H__
#define __BUSPROTOCOL_H__
/** \file BusProtocol.h
\brief Implementation of BusProtocol
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "types.h"
#include "bus.h"
#include "RemoteProcedureCalls.h"
#include "BpMessageFormat.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define MASTER_DEVICE_ID (1)
#define MAX_PAYLOAD_SIZE (50)
#define BP_DEBUG_OUT(a) /* serPut( COM2, a) */
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
typedef void (*t_bp_myturn_callback)(void);
typedef void (*t_bp_rpcresult_callback)( UINT8 requestNr, UINT8 nrOfResults, UINT32 *results );
typedef void (*t_bp_messagehandler)(t_bpmsg_message *receivedMessage, int ownHandler );
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Initialises the BusProtocol */
int bpInit( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, UINT8 inputQueueSize );
/** \brief Closes the active BusProtocol */
void bpDeinit( int handle );
/** \brief Indicates whether a message a device is received in the last 10 seconds
* Only used by the master
*/
BOOLEAN bpDeviceIsDetected( int handle, UINT8 deviceId );
/** \brief Sends message to pass turn (Nothing to send) */
void bpSendPassTurn( int handle );
/** \brief Sends message to reset another bus device */
void bpSendResetClient( int handle, UINT8 deviceId );
/** \brief Sends message with all electronic information (DAC's, ADC's and digital I/O) */
void bpSendGiveElectronicStatus( int handle,
UINT8 nrOfAdcValues,
UINT16 *adcValues,
UINT8 nrOfDacValues,
UINT16 *dacValues,
UINT8 nrOfDiValues,
UINT8 *diValues,
UINT8 nrOfDoValues,
UINT8 *doValues
);
/** \brief Sends message to set a DAC on another bus device */
void bpSendSetDacValue( int handle, UINT8 deviceId, UINT8 channelNr, UINT8 dacMode, UINT16 dacValue );
/** \brief Sends message to set the values of all DAC's on another bus device */
void bpSendSetAllDacValues( int handle, UINT8 deviceId, UINT16 *dacValue );
/** \brief Sends message to set a digital out on another bus device */
void bpSendSetDigitalOutValue( int handle, UINT8 deviceId, UINT8 bitNr, UINT8 value );
/** \brief Sends message to set all digital out ports at once on another bus device */
void bpSendSetAllDigitalOut( int handle, UINT8 deviceId, UINT8 bits);
/** \brief Sends message to set all outputs (analogue & digital) on another bus device */
void bpSendSetAllOutput( int handle, UINT8 deviceId, UINT8 bits, UINT16 *dacValue);
/** \brief Sends message to call an Remote Procedure Call on an other bus device */
void bpSendCallRpc( int handle, UINT8 deviceId, UINT8 functionId, UINT8 nrOfParams, INT32 *params );
/** \brief Attachs a callback, which is called when it is the device its turn to send data on the bus */
void bpAttachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback );
/** \brief Detaches the above callback */
void bpDetachOnMyTurn( int handle, t_bp_myturn_callback onMyTurnCallback );
/** \brief Attach callback on receiving a specific message */
void bpAttachMessageHandler( int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
/** \brief Attach callback on receiving a specific message */
void bpDetachMessageHandler( int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
/** \brief Attachs a RPC-function, which can be called by another bus device */
void bpAttachRpc( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call functionPointer, UINT8 nrOfParams );
/** \brief Detaches the above RPC-function */
void bpDetachRpc( int handle, UINT8 functionId );
/** \brief Attachs a "RPC result"-function, which is a result of a requeste RPC-call on another bus device */
void bpAttachRpcResult( int handle, UINT8 functionId, t_bp_rpcresult_callback functionPointer, UINT8 nrOfResult );
/** \brief Detaches the above "RPC result"-function */
void bpDetachRpcResult( int handle, UINT8 functionId );
t_rpc_entity *bpLookupRpcEntry( int handle, UINT8 functionId );
/** \brief Sends message to give result on issued RPC-function */
void bpSendRpcResult( int handle, UINT8 deviceId, UINT8 functionId, UINT8 requestNr, UINT8 nrOfResults, INT32 *results );
#endif /* __BUSPROTOCOL_H__ */
+123
View File
@@ -0,0 +1,123 @@
/* ---------------------------------------------------------------------------
* Crc.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 31, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "crc.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
const UINT16 CRC_table[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
};
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
/*!
* \brief Calculate 16 bit CRC
*
* a function to calculate an serial 16 bit CRC
* according to the CCITT V.024 standard
* To short down the calculation time of the serial CRC
* a hash table is used.
* This CRC is a fast (with hash table) and good CRC for
* data transfer and integrity test of data storage. It can effectively
* can detect errors by data transfer. 16 Bit is good for data blocks from
* 0 - 4 KByte with a residual risk for non detection of 10E-8 per transfer.
* (Multiply this with the error factor of the transmit line)
*
* The polynoom of CRC-16-CCIT = x^16 + x^12 + x^5 + 1
*
* \param data Build the crc from this data block
* \param length Length of the data block
* \param feed Initial CRC value (take 0 by default)
*/
UINT16 crcCalc(UINT8 * data, UINT32 length, UINT16 feed)
{
unsigned short crc = feed;
unsigned char index;
unsigned int count;
for(count=0; count<length; count++)
{
index = (unsigned char)(crc >> 8);
crc = crc & 0x00FF;
crc = (crc << 8);
crc &= 0xFF00;
crc = crc ^ CRC_table[index] ^ (*data & 0x00FF);
data++;
}
return crc;
}
+59
View File
@@ -0,0 +1,59 @@
/* ---------------------------------------------------------------------------
* Crc.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 31, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __CRC_H__
#define __CRC_H__
/** \file Crc.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "types.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
UINT16 crcCalc(UINT8 * pData, UINT32 length, UINT16 feed);
#endif /* __CRC_H__ */
@@ -0,0 +1,204 @@
/* ---------------------------------------------------------------------------
* MessageHandlerQueue.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 30, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "MessageHandlerQueue.h"
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
typedef struct t_mhq_ENTITY
{
UINT8 messageId;
t_bp_messagehandler messageHandler;
int ownHandle;
struct t_mhq_ENTITY *next;
struct t_mhq_ENTITY *previous;
} t_mhq_entity;
typedef struct t_mhq_ADMIN
{
struct t_mhq_ENTITY *head;
struct t_mhq_ENTITY *tail;
} t_mhq_admin;
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
static t_mhq_entity *lookupMhqEntry(int handle, UINT8 messageId);
int mhqInit()
{
t_mhq_admin *newAdmin = (t_mhq_admin *)pvPortMalloc( sizeof(t_mhq_admin) );
newAdmin->head = NULL;
return (int)newAdmin;
}
void mhqDeinit(int handle)
{
t_mhq_entity *iterator = ((t_mhq_admin *)handle)->head;
while (iterator != NULL)
{
t_mhq_entity *nextItem = iterator->next;
vPortFree( iterator );
iterator = nextItem;
}
vPortFree( (t_mhq_admin *)handle );
}
void mhqAdd(int handle, UINT8 messageId, t_bp_messagehandler messageHandler, int ownHandle)
{
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
t_mhq_entity *newEntry = (t_mhq_entity *)pvPortMalloc( sizeof(t_mhq_entity) );
// fill entry
newEntry->messageId = messageId;
newEntry->messageHandler = messageHandler;
newEntry->ownHandle = ownHandle;
newEntry->next = NULL;
newEntry->previous = NULL;
taskENTER_CRITICAL();
{
// Add to linked list
if (theAdmin->head != NULL)
{
theAdmin->tail->next = newEntry;
newEntry->previous = theAdmin->tail;
theAdmin->tail = newEntry;
}
else
{
theAdmin->head = newEntry;
theAdmin->tail = newEntry;
}
}
taskEXIT_CRITICAL();
}
void mhqRemove(int handle, UINT8 messageId, t_bp_messagehandler messageHandler)
{
t_mhq_entity *entry = lookupMhqEntry(handle, messageId);
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
taskENTER_CRITICAL();
{
if (entry != NULL)
{
// rebuild linked list
if (entry->next != NULL)
{
entry->next->previous = entry->previous;
}
else
{
theAdmin->tail = entry->previous;
}
if (entry->previous != NULL)
{
entry->previous->next = entry->next;
}
else
{
theAdmin->head = entry->next;
}
// remove entry
vPortFree( entry );
}
}
taskEXIT_CRITICAL();
}
RESULT mhqExecute(int handle, UINT8 messageId, t_bpmsg_message *message)
{
t_mhq_entity *item = lookupMhqEntry(handle, messageId);
if (item != NULL)
{
item->messageHandler( message, item->ownHandle );
return OK;
}
else
{
return ERROR;
}
}
t_mhq_entity *lookupMhqEntry(int handle, UINT8 messageId)
{
t_mhq_admin *theAdmin = (t_mhq_admin *)handle;
t_mhq_entity *result = NULL;
t_mhq_entity *iterator;
taskENTER_CRITICAL();
{
iterator = theAdmin->head;
while ((result == NULL) && (iterator != NULL))
{
if (iterator->messageId == messageId)
{
result = iterator;
}
else
{
iterator = iterator->next;
}
}
}
taskEXIT_CRITICAL();
return result;
}
@@ -0,0 +1,65 @@
/* ---------------------------------------------------------------------------
* MessageHandlerQueue.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 30, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __MESSAGEHANDLERQUEUE_H__
#define __MESSAGEHANDLERQUEUE_H__
/** \file MessageHandlerQueue.h
\brief Contains a list of message handlers
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "BusProtocol.h"
#include "BpMessageFormat.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
int mhqInit();
void mhqAdd(int handle, UINT8 messageId, t_bp_messagehandler messageHandler, int ownHandle);
void mhqRemove(int handle, UINT8 messageId, t_bp_messagehandler messageHandler);
RESULT mhqExecute(int handle, UINT8 messageId, t_bpmsg_message *message);
#endif /* __MESSAGEHANDLERQUEUE_H__ */
@@ -0,0 +1,124 @@
/* ---------------------------------------------------------------------------
* MessageQueue.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include <stdlib.h>
#include <string.h>
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "MessageQueue.h"
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
t_mq_messagequeue *mqInit()
{
t_mq_messagequeue *newMessageQueue = (t_mq_messagequeue *)pvPortMalloc( sizeof(t_mq_messagequeue) );
newMessageQueue->count = 0;
newMessageQueue->head = 0;
newMessageQueue->tail = 0;
return newMessageQueue;
}
RESULT mqAdd( t_mq_messagequeue *queue, t_bpmsg_message *message)
{
RESULT result = OK;
taskENTER_CRITICAL();
{
if(queue->count >= TX_QUEUE_SIZE)
{
result = ERROR;
}
else
{
memcpy( &(queue->messages[queue->tail]), message, sizeof(t_bpmsg_message) );
queue->count++;
queue->tail = (queue->tail + 1) % TX_QUEUE_SIZE;
}
}
taskEXIT_CRITICAL();
return result;
}
RESULT mqGet( t_mq_messagequeue *queue, t_bpmsg_message *message)
{
RESULT result = OK;
taskENTER_CRITICAL();
{
if(queue->count > 0)
{
memcpy( message, &(queue->messages[queue->head]), sizeof(t_bpmsg_message) );
queue->head = (queue->head + 1) % TX_QUEUE_SIZE;
queue->count--;
}
else
{
result = ERROR;
}
}
taskEXIT_CRITICAL();
return result;
}
BOOLEAN mqEmpty( t_mq_messagequeue *queue )
{
UINT8 count;
taskENTER_CRITICAL();
{
count = queue->count;
}
taskEXIT_CRITICAL();
return ( count == 0 ? TRUE : FALSE);
}
@@ -0,0 +1,72 @@
/* ---------------------------------------------------------------------------
* MessageQueue.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __MESSAGEQUEUE_H__
#define __MESSAGEQUEUE_H__
/** \file MessageQueue.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "types.h"
#include "BpMessageFormat.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define TX_QUEUE_SIZE (20)
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
typedef struct t_mq_MESSAGEQUEUE
{
t_bpmsg_message messages[TX_QUEUE_SIZE];
UINT8 head;
UINT8 tail;
UINT8 count;
} t_mq_messagequeue;
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
t_mq_messagequeue *mqInit();
RESULT mqAdd( t_mq_messagequeue *queue, t_bpmsg_message *message);
RESULT mqGet( t_mq_messagequeue *queue, t_bpmsg_message *message);
BOOLEAN mqEmpty( t_mq_messagequeue *queue );
#endif /* __MESSAGEQUEUE_H__ */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
/* ---------------------------------------------------------------------------
* ProtocolThread.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __PROTOCOLTHREAD_H__
#define __PROTOCOLTHREAD_H__
/** \file ProtocolThread.h
\brief Thread which handles the messaging of the protocol.
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "bus.h"
#include "BpMessageFormat.h"
#include "BusProtocol.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Starts the protocol handling thread */
int bpthreadStart( t_bus_devices recvBus, t_bus_devices sendBus, UINT8 deviceId, UINT8 highestDeviceId, int bpHandle, int mhqHandle );
/** \brief Stops the protocol handling thread */
void bpthreadStop( int handle );
/** \brief Indicates whether a message a device is received in the last 10 seconds
* Only used by the master
*/
BOOLEAN bpthreadDeviceIsDetected( int handle, UINT8 deviceId );
/** \brief Add a message to the tx-queue. Message will be send when its this device its turn */
void bpthreadAddMessage( int handle, t_bpmsg_message *message );
/** \brief Attaches a callback function to MyTurn-event, which notifies when it is this device its turn */
void bpthreadAttachMyTurn( int handle, t_bp_myturn_callback callback);
/** \brief Detaches the callback function to MyTurn-event */
void bpthreadDetachMyTurn( int handle, t_bp_myturn_callback callback);
#endif /* __PROTOCOLTHREAD_H__ */
@@ -0,0 +1,301 @@
/* ---------------------------------------------------------------------------
* RemoteProcedureCalls.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include <stdlib.h>
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "types.h"
#include "RemoteProcedureCalls.h"
#include "serial.h"
#include "BusProtocol.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "mem_mod.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
#define RPC_DISPATCH_QUEUE_SIZE (10)
extern memman *bpMessagePool;
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
//static t_rpc_entity *lookupRpcEntry( int handle, UINT8 functionId );
/** \brief Initialises a Remote Procedure Call administration
*
* \returns Handle to Remote Procedure Call administration (0 = failure)
*/
int rpcInit()
{
t_rpc_admin *newAdmin = (t_rpc_admin *)pvPortMalloc( sizeof(t_rpc_admin) );
if (newAdmin != NULL)
{
newAdmin->firstEntry = NULL;
newAdmin->lastEntry = NULL;
}
return (int)newAdmin;
}
/** \brief Deinitialises the Remote Procedure Call administration
*
* \param handle Handle to RPC-adminstration
*/
void rpcDeinit( int handle )
{
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
// Remove whole list
if (theAdmin->firstEntry != NULL)
{
t_rpc_entity *entry = theAdmin->firstEntry;
while (entry != NULL)
{
t_rpc_entity *nextEntry = entry->next;
vPortFree( entry );
entry = nextEntry;
}
}
// Remove admin
vPortFree( (void *)handle );
}
/** \brief Adds a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC
* \param nrOfParams Nr of parameters required by RPC-function
*/
void rpcAdd( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call funcptr, UINT8 nrOfParams )
{
t_rpc_entity *newEntry = (t_rpc_entity *)pvPortMalloc( sizeof(t_rpc_entity) );
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
// fill entry
newEntry->functionId = functionId;
newEntry->functionName = functionName;
newEntry->rpcFunction = funcptr;
newEntry->nrOfParams = nrOfParams;
newEntry->next = NULL;
newEntry->previous = NULL;
// Add to linked list
if (theAdmin->firstEntry != NULL)
{
theAdmin->lastEntry->next = newEntry;
newEntry->previous = theAdmin->lastEntry;
theAdmin->lastEntry = newEntry;
}
else
{
theAdmin->firstEntry = newEntry;
theAdmin->lastEntry = newEntry;
}
}
/** \brief Removes a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC-function
*/
void rpcRemove( int handle, UINT8 functionId )
{
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
if (entry != NULL)
{
// rebuild linked list
if (entry->next != NULL)
{
entry->next->previous = entry->previous;
}
else
{
theAdmin->lastEntry = entry->previous;
}
if (entry->previous != NULL)
{
entry->previous->next = entry->next;
}
else
{
theAdmin->firstEntry = entry->next;
}
// remove entry
vPortFree( entry );
}
}
/** \brief Looks up a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC-function
* \retval Pointer to RPC-function (NULL when not found)
*/
t_rpc_remote_procedure_call rpcLookup( int handle, UINT8 functionId )
{
t_rpc_remote_procedure_call result = NULL;
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
if (entry != NULL)
{
result = entry->rpcFunction;
}
return result;
}
/** \brief Executes a Remote Procedure Call
*
* \param handle Handle to RPC-administration
* \param nrOfParams Nr of parameters in params-array
* \param params Pointer to array with all parameters
* \retval OK RPC request is send
* \retval ERROR Unable to send RPC request
*/
RESULT rpcExecute( int handle, UINT8 functionId, UINT8 nrOfParams, const UINT32 *params )
{
t_rpc_entity *entry = rpcLookupEntry(handle, functionId);
if (entry != NULL)
{
// Dispatch function to rpcThread
// execute function
//result = entry->rpcFunction;
return OK;
}
else
{
return ERROR;
}
}
t_rpc_entity *rpcLookupEntry( int handle, UINT8 functionId )
{
t_rpc_admin *theAdmin = (t_rpc_admin *)handle;
t_rpc_entity *result = NULL;
t_rpc_entity *iterator;
iterator = theAdmin->firstEntry;
while ((result == NULL) && (iterator != NULL))
{
if (iterator->functionId == functionId)
{
result = iterator;
}
else
{
iterator = iterator->next;
}
}
return result;
}
void rpcRequestHandler(t_bpmsg_message *msg, int ownHandler)
{
UINT8 index = 0;
UINT8 count;
UINT8 targetId, senderId, requestNr, functionId, nrOfParams;
UINT32 *params;
t_rpc_entity *rpcEntry;
// Decode message
targetId = msg->targetId;
senderId = msg->senderId;
requestNr = bpmsgGet8bit( msg->payload, &index);
functionId = bpmsgGet8bit( msg->payload, &index);
nrOfParams = bpmsgGet8bit( msg->payload, &index);
BP_DEBUG_OUT('{');
BP_DEBUG_OUT('a' + functionId);
// Allocate an array for the params
if (nrOfParams > 0)
{
params = (UINT32 *)Memmod_Alloc( bpMessagePool );
if (params != NULL)
{
for (count = 0; count < nrOfParams; count++)
{
params[count] = bpmsgGet32bit(msg->payload, &index);
}
}
else
{
// Error already indicated by heap_2.c
return;
}
}
else
{
params = NULL;
}
// Call RPC-function
rpcEntry = rpcLookupEntry(ownHandler, functionId);
if (rpcEntry != NULL)
{
BP_DEBUG_OUT('a' + functionId);
// execute function
rpcEntry->rpcFunction( senderId, targetId, requestNr, functionId, nrOfParams, params );
}
if (params != NULL)
{
Memmod_Free( bpMessagePool, params );
}
}
@@ -0,0 +1,96 @@
/* ---------------------------------------------------------------------------
* RemoteProcedureCalls.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: Holds supported Remote Procedure Calls
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __REMOTEPROCEDURECALLS_H__
#define __REMOTEPROCEDURECALLS_H__
/** \file RemoteProcedureCalls.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "BpMessageFormat.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
typedef void (*t_rpc_remote_procedure_call)( UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params );
typedef struct t_RPC_ENTITY {
UINT8 functionId;
char * functionName;
UINT8 nrOfParams;
t_rpc_remote_procedure_call rpcFunction;
struct t_RPC_ENTITY *next;
struct t_RPC_ENTITY *previous;
} t_rpc_entity;
typedef struct t_RPC_ADMIN {
t_rpc_entity *firstEntry;
t_rpc_entity *lastEntry;
} t_rpc_admin;
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Initialises a Remote Procedure Call administration */
int rpcInit();
/** \brief Deinitialises the Remote Procedure Call administration */
void rpcDeinit( int handle );
/** \brief Adds a Remote Procedure Call to the administration */
void rpcAdd( int handle, UINT8 functionId, char * functionName, t_rpc_remote_procedure_call funcptr, UINT8 nrOfParams );
/** \brief Removes a Remote Procedure Call to the administration */
void rpcRemove( int handle, UINT8 functionId );
/** \brief Looks up a Remote Procedure Call to the administration */
t_rpc_remote_procedure_call rpcLookup( int handle, UINT8 functionId );
/** \brief Executes a Remote Procedure Call */
RESULT rpcExecute( int handle, UINT8 functionId, UINT8 nrOfParams, const UINT32 *params );
t_rpc_entity *rpcLookupEntry( int handle, UINT8 functionId );
/** \brief Message handler for RPC-requests */
void rpcRequestHandler(t_bpmsg_message *msg, int ownHandler);
#endif /* __REMOTEPROCEDURECALLS_H__ */
@@ -0,0 +1,288 @@
/* ---------------------------------------------------------------------------
* RemoteProcedureCalls.c - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include <stdlib.h>
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "types.h"
#include "RpcResults.h"
#include "serial.h"
#include "BusProtocol.h"
#include "mem_mod.h"
#include "FreeRTOS.h"
#include "queue.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
#define RPCR_DISPATCH_QUEUE_SIZE (10)
typedef struct t_RPCR_ENTITY {
UINT8 functionId;
UINT8 nrOfParams;
t_bp_rpcresult_callback rpcrFunction;
struct t_RPCR_ENTITY *next;
struct t_RPCR_ENTITY *previous;
} t_rpcr_entity;
typedef struct t_RPCR_ADMIN {
t_rpcr_entity *firstEntry;
t_rpcr_entity *lastEntry;
} t_rpcr_admin;
extern memman *bpMessagePool;
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
static t_rpcr_entity *lookupRpcrEntry( int handle, UINT8 functionId );
/** \brief Initialises a Remote Procedure Call administration
*
* \returns Handle to Remote Procedure Call administration (0 = failure)
*/
int rpcrInit()
{
t_rpcr_admin *newAdmin = (t_rpcr_admin *)pvPortMalloc( sizeof(t_rpcr_admin) );
if (newAdmin != NULL)
{
newAdmin->firstEntry = NULL;
newAdmin->lastEntry = NULL;
}
return (int)newAdmin;
}
/** \brief Deinitialises the Remote Procedure Call administration
*
* \param handle Handle to RPC-adminstration
*/
void rpcrDeinit( int handle )
{
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
// Remove whole list
if (theAdmin->firstEntry != NULL)
{
t_rpcr_entity *entry = theAdmin->firstEntry;
while (entry != NULL)
{
t_rpcr_entity *nextEntry = entry->next;
vPortFree( entry );
entry = nextEntry;
}
}
// Remove admin
vPortFree( (void *)handle );
}
/** \brief Adds a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC
* \param nrOfParams Nr of parameters required by RPC-function
*/
void rpcrAdd( int handle, UINT8 functionId, t_bp_rpcresult_callback funcptr, UINT8 nrOfParams )
{
t_rpcr_entity *newEntry = (t_rpcr_entity *)pvPortMalloc( sizeof(t_rpcr_entity) );
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
// fill entry
newEntry->functionId = functionId;
newEntry->rpcrFunction = funcptr;
newEntry->nrOfParams = nrOfParams;
newEntry->next = NULL;
newEntry->previous = NULL;
// Add to linked list
if (theAdmin->firstEntry != NULL)
{
theAdmin->lastEntry->next = newEntry;
newEntry->previous = theAdmin->lastEntry;
theAdmin->lastEntry = newEntry;
}
else
{
theAdmin->firstEntry = newEntry;
theAdmin->lastEntry = newEntry;
}
}
/** \brief Removes a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC-function
*/
void rpcrRemove( int handle, UINT8 functionId )
{
t_rpcr_entity *entry = lookupRpcrEntry(handle, functionId);
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
if (entry != NULL)
{
// rebuild linked list
if (entry->next != NULL)
{
entry->next->previous = entry->previous;
}
else
{
theAdmin->lastEntry = entry->previous;
}
if (entry->previous != NULL)
{
entry->previous->next = entry->next;
}
else
{
theAdmin->firstEntry = entry->next;
}
// remove entry
vPortFree( entry );
}
}
/** \brief Looks up a Remote Procedure Call to the administration
*
* \param handle Handle to RPC-administration
* \param functionId Identifier for RPC-function
* \retval Pointer to RPC-function (NULL when not found)
*/
t_bp_rpcresult_callback rpcrLookup( int handle, UINT8 functionId )
{
t_bp_rpcresult_callback result = NULL;
t_rpcr_entity *entry = lookupRpcrEntry(handle, functionId);
if (entry != NULL)
{
result = entry->rpcrFunction;
}
return result;
}
t_rpcr_entity *lookupRpcrEntry( int handle, UINT8 functionId )
{
t_rpcr_admin *theAdmin = (t_rpcr_admin *)handle;
t_rpcr_entity *result = NULL;
t_rpcr_entity *iterator;
iterator = theAdmin->firstEntry;
while ((result == NULL) && (iterator != NULL))
{
if (iterator->functionId == functionId)
{
result = iterator;
}
else
{
iterator = iterator->next;
}
}
return result;
}
void rpcrRequestHandler(t_bpmsg_message *msg, int ownHandler)
{
UINT8 index = 0;
UINT8 count;
UINT8 targetId, senderId, requestNr, functionId, nrOfResults;
UINT32 *results;
t_rpcr_entity *rpcrEntry;
BP_DEBUG_OUT( '!');
// Decode message
targetId = msg->targetId;
senderId = msg->senderId;
requestNr = bpmsgGet8bit( msg->payload, &index);
functionId = bpmsgGet8bit( msg->payload, &index);
nrOfResults = bpmsgGet8bit( msg->payload, &index);
// Allocate an array for the params
if (nrOfResults > 0)
{
results = (UINT32 *)Memmod_Alloc( bpMessagePool );
if (results != NULL)
{
for (count = 0; count < nrOfResults; count++)
{
results[count] = bpmsgGet32bit(msg->payload, &index);
}
}
else
{
// Error already indicated by heap_2.c
return;
}
}
else
{
results = NULL;
}
// Call RPC-function
rpcrEntry = lookupRpcrEntry(ownHandler, functionId);
if (rpcrEntry != NULL)
{
// execute function
BP_DEBUG_OUT('#');
rpcrEntry->rpcrFunction( requestNr, nrOfResults, results );
}
if (results != NULL)
{
Memmod_Free( bpMessagePool, results );
}
}
@@ -0,0 +1,76 @@
/* ---------------------------------------------------------------------------
* RpcResults.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: Holds supported Remote Procedure Calls
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __RPCRESULTS_H__
#define __RPCRESULTS_H__
/** \file RpcResults.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "BusProtocol.h"
#include "BpMessageFormat.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Initialises a Remote Procedure Call-Result administration */
int rpcrInit();
/** \brief Deinitialises the Remote Procedure Call-Result administration */
void rpcrDeinit( int handle );
/** \brief Adds a RPC-result handler to the administration */
void rpcrAdd( int handle, UINT8 functionId, t_bp_rpcresult_callback funcptr, UINT8 nrOfParams);
/** \brief Removes a RPC-result handler to the administration */
void rpcrRemove( int handle, UINT8 functionId );
/** \brief Looks up a RPC-result handler to the administration */
t_bp_rpcresult_callback rpcrLookup( int handle, UINT8 functionId );
/** \brief Message handler for RPC-requests */
void rpcrRequestHandler(t_bpmsg_message *msg, int ownHandler);
#endif /* __RPCRESULTS_H__ */
@@ -0,0 +1,90 @@
#include "mem_mod.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "Task.h"
#include "Queue.h"
extern void serWrite (
int device,
short length, /**< Lengh of data in bytes */
char * data /**< Pointer to data */
);
void Memmod_Init(memman *me,unsigned char buf_count,unsigned short buf_size)
{
unsigned char *buffer;
unsigned short i;
me->count = buf_count;
me->size = buf_size;
buffer = pvPortMalloc(buf_count*buf_size);
me->buffer = buffer;
me->free_index = buf_count;
me->freelist = pvPortMalloc(buf_count*sizeof(link_item));
for(i=0;i<buf_count;i++)
{
me->freelist[i].data = buffer;
buffer = buffer+buf_size;
}
}
unsigned char* Memmod_GetBuffer(memman *me)
{
return me->buffer;
}
memman *Memmod_Create(unsigned char buf_count,unsigned short buf_size)
{
memman *new_item;
new_item = (memman *)pvPortMalloc(sizeof(memman));
Memmod_Init(new_item,buf_count,buf_size);
return new_item;
}
void *Memmod_Alloc(memman *me)
{
unsigned char index;
void *retval;
taskENTER_CRITICAL();
{
index = me->free_index;
if(index > 0)
{
index--;
me->free_index=index;
retval = me->freelist[index].data;
}
else
{
retval = 0;
}
}
taskEXIT_CRITICAL();
if (retval == 0)
{
serWrite(1, sizeof("buffer error"), "buffer error");
}
return retval;
}
void Memmod_Free(memman *me,void *buffer)
{
unsigned char index;
taskENTER_CRITICAL();
{
index = me->free_index;
if(index < me->count)
{
me->freelist[index].data = buffer;
index++;
me->free_index=index;
}
}
taskEXIT_CRITICAL();
}
@@ -0,0 +1,32 @@
#ifndef _MEM_MODH
#define _MEM_MODH
#ifdef __cplusplus
extern "C" {
#endif
typedef struct link_item
{
void *data;
} link_item;
typedef struct
{
unsigned char count;
unsigned char size;
unsigned char free_index;
void *buffer;
link_item *freelist;
} memman;
void Memmod_Init(memman *me,unsigned char buf_count,unsigned short buf_size);
memman *Memmod_Create(unsigned char buf_count,unsigned short buf_size);
unsigned char* Memmod_GetBuffer(memman *me);
void *Memmod_Alloc(memman *me);
void Memmod_Free(memman *me,void *buffer);
#ifdef __cplusplus
}
#endif
#endif