##// END OF EJS Templates
imanay -
r117:118
parent child
Show More
@@ -1,224 +1,227
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> No newline at end of file
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <?fileVersion 4.0.0?> No newline at end of file
2 <?fileVersion 4.0.0?>
3 No newline at end of file
3
4 <cproject> No newline at end of file
4 <cproject>
5 <storageModule moduleId="org.eclipse.cdt.core.settings"> No newline at end of file
5 <storageModule moduleId="org.eclipse.cdt.core.settings">
6 <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1568263498"> No newline at end of file
6 <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1568263498">
7 <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1568263498" moduleId="org.eclipse.cdt.core.settings" name="Release"> No newline at end of file
7 <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1568263498" moduleId="org.eclipse.cdt.core.settings" name="Release">
8 <externalSettings/> No newline at end of file
8 <externalSettings/>
9 <extensions> No newline at end of file
9 <extensions>
10 <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> No newline at end of file
10 <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
11 <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file
11 <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
12 <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file
12 <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
13 <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file
13 <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
14 <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file
14 <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
15 </extensions> No newline at end of file
15 </extensions>
16 </storageModule> No newline at end of file
16 </storageModule>
17 <storageModule moduleId="cdtBuildSystem" version="4.0.0">
17 <storageModule moduleId="cdtBuildSystem" version="4.0.0">
No newline at end of file
18 <configuration artifactName="tcp_Control_Module" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1568263498" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> No newline at end of file
18 <configuration artifactName="Control_Module_v1_debug" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1568263498" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> No newline at end of file
19 <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1568263498." name="/" resourcePath=""> No newline at end of file
19 <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1568263498." name="/" resourcePath="">
20 <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.785297601" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> No newline at end of file
20 <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.785297601" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
21 <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1008424557" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
21 <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1008424557" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
No newline at end of file
22 <builder buildPath="${workspace_loc:/Control_Module}" id="cdt.managedbuild.target.gnu.builder.exe.release.365458410" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/> No newline at end of file
22 <builder buildPath="${workspace_loc:/Control_Module/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.365458410" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/> No newline at end of file
23 <tool id="cdt.managedbuild.tool.gnu.archiver.base.1343949145" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> No newline at end of file
23 <tool id="cdt.managedbuild.tool.gnu.archiver.base.1343949145" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
24 <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.57926565" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> No newline at end of file
24 <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.57926565" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
25 <option id="gnu.cpp.compiler.exe.release.option.optimization.level.35312113" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> No newline at end of file
25 <option id="gnu.cpp.compiler.exe.release.option.optimization.level.35312113" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
26 <option id="gnu.cpp.compiler.exe.release.option.debugging.level.936269591" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> No newline at end of file
26 <option id="gnu.cpp.compiler.exe.release.option.debugging.level.936269591" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
27 </tool> No newline at end of file
27 </tool>
28 <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"> No newline at end of file
28 <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
29 <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.499243164" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/> No newline at end of file
29 <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.499243164" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
30 <option id="gnu.c.compiler.exe.release.option.debugging.level.1960011250" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> No newline at end of file
30 <option id="gnu.c.compiler.exe.release.option.debugging.level.1960011250" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
31 <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1347535566" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> No newline at end of file
31 <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1347535566" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
32 </tool> No newline at end of file
32 </tool>
33 <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1288648685" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"> No newline at end of file
33 <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1288648685" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release">
34 <option id="gnu.c.link.option.libs.1983512541" superClass="gnu.c.link.option.libs" valueType="libs">
No newline at end of file
35 <listOptionValue builtIn="false" value="m"/>
No newline at end of file
36 </option> No newline at end of file
34 <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2046701530" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> No newline at end of file
37 <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2046701530" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
35 <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> No newline at end of file
38 <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
36 <additionalInput kind="additionalinput" paths="$(LIBS)"/> No newline at end of file
39 <additionalInput kind="additionalinput" paths="$(LIBS)"/>
37 </inputType> No newline at end of file
40 </inputType>
38 <outputType id="cdt.managedbuild.tool.gnu.c.linker.output.439510446" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.output"/> No newline at end of file
41 <outputType id="cdt.managedbuild.tool.gnu.c.linker.output.439510446" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.output"/>
39 </tool> No newline at end of file
42 </tool>
40 <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1068281678" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/> No newline at end of file
43 <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1068281678" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/>
41 <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.796779267" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> No newline at end of file
44 <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.796779267" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
42 <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> No newline at end of file
45 <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
43 </tool> No newline at end of file
46 </tool>
44 </toolChain> No newline at end of file
47 </toolChain>
45 </folderInfo> No newline at end of file
48 </folderInfo>
46 </configuration> No newline at end of file
49 </configuration>
47 </storageModule> No newline at end of file
50 </storageModule>
48 No newline at end of file
51
49 <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> No newline at end of file
52 <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
50 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> No newline at end of file
53 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
51 <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> No newline at end of file
54 <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
52 <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> No newline at end of file
55 <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
53 <storageModule moduleId="scannerConfiguration"> No newline at end of file
56 <storageModule moduleId="scannerConfiguration">
54 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> No newline at end of file
57 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
55 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> No newline at end of file
58 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
56 <buildOutputProvider> No newline at end of file
59 <buildOutputProvider>
57 <openAction enabled="true" filePath=""/> No newline at end of file
60 <openAction enabled="true" filePath=""/>
58 <parser enabled="true"/> No newline at end of file
61 <parser enabled="true"/>
59 </buildOutputProvider> No newline at end of file
62 </buildOutputProvider>
60 <scannerInfoProvider id="specsFile"> No newline at end of file
63 <scannerInfoProvider id="specsFile">
61 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
64 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
62 <parser enabled="true"/> No newline at end of file
65 <parser enabled="true"/>
63 </scannerInfoProvider> No newline at end of file
66 </scannerInfoProvider>
64 </profile> No newline at end of file
67 </profile>
65 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> No newline at end of file
68 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
66 <buildOutputProvider> No newline at end of file
69 <buildOutputProvider>
67 <openAction enabled="true" filePath=""/> No newline at end of file
70 <openAction enabled="true" filePath=""/>
68 <parser enabled="true"/> No newline at end of file
71 <parser enabled="true"/>
69 </buildOutputProvider> No newline at end of file
72 </buildOutputProvider>
70 <scannerInfoProvider id="makefileGenerator"> No newline at end of file
73 <scannerInfoProvider id="makefileGenerator">
71 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> No newline at end of file
74 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
72 <parser enabled="true"/> No newline at end of file
75 <parser enabled="true"/>
73 </scannerInfoProvider> No newline at end of file
76 </scannerInfoProvider>
74 </profile> No newline at end of file
77 </profile>
75 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> No newline at end of file
78 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
76 <buildOutputProvider> No newline at end of file
79 <buildOutputProvider>
77 <openAction enabled="true" filePath=""/> No newline at end of file
80 <openAction enabled="true" filePath=""/>
78 <parser enabled="true"/> No newline at end of file
81 <parser enabled="true"/>
79 </buildOutputProvider> No newline at end of file
82 </buildOutputProvider>
80 <scannerInfoProvider id="specsFile"> No newline at end of file
83 <scannerInfoProvider id="specsFile">
81 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
84 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
82 <parser enabled="true"/> No newline at end of file
85 <parser enabled="true"/>
83 </scannerInfoProvider> No newline at end of file
86 </scannerInfoProvider>
84 </profile> No newline at end of file
87 </profile>
85 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> No newline at end of file
88 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
86 <buildOutputProvider> No newline at end of file
89 <buildOutputProvider>
87 <openAction enabled="true" filePath=""/> No newline at end of file
90 <openAction enabled="true" filePath=""/>
88 <parser enabled="true"/> No newline at end of file
91 <parser enabled="true"/>
89 </buildOutputProvider> No newline at end of file
92 </buildOutputProvider>
90 <scannerInfoProvider id="specsFile"> No newline at end of file
93 <scannerInfoProvider id="specsFile">
91 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file
94 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
92 <parser enabled="true"/> No newline at end of file
95 <parser enabled="true"/>
93 </scannerInfoProvider> No newline at end of file
96 </scannerInfoProvider>
94 </profile> No newline at end of file
97 </profile>
95 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> No newline at end of file
98 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
96 <buildOutputProvider> No newline at end of file
99 <buildOutputProvider>
97 <openAction enabled="true" filePath=""/> No newline at end of file
100 <openAction enabled="true" filePath=""/>
98 <parser enabled="true"/> No newline at end of file
101 <parser enabled="true"/>
99 </buildOutputProvider> No newline at end of file
102 </buildOutputProvider>
100 <scannerInfoProvider id="specsFile"> No newline at end of file
103 <scannerInfoProvider id="specsFile">
101 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file
104 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
102 <parser enabled="true"/> No newline at end of file
105 <parser enabled="true"/>
103 </scannerInfoProvider> No newline at end of file
106 </scannerInfoProvider>
104 </profile> No newline at end of file
107 </profile>
105 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> No newline at end of file
108 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
106 <buildOutputProvider> No newline at end of file
109 <buildOutputProvider>
107 <openAction enabled="true" filePath=""/> No newline at end of file
110 <openAction enabled="true" filePath=""/>
108 <parser enabled="true"/> No newline at end of file
111 <parser enabled="true"/>
109 </buildOutputProvider> No newline at end of file
112 </buildOutputProvider>
110 <scannerInfoProvider id="specsFile"> No newline at end of file
113 <scannerInfoProvider id="specsFile">
111 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
114 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
112 <parser enabled="true"/> No newline at end of file
115 <parser enabled="true"/>
113 </scannerInfoProvider> No newline at end of file
116 </scannerInfoProvider>
114 </profile> No newline at end of file
117 </profile>
115 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> No newline at end of file
118 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
116 <buildOutputProvider> No newline at end of file
119 <buildOutputProvider>
117 <openAction enabled="true" filePath=""/> No newline at end of file
120 <openAction enabled="true" filePath=""/>
118 <parser enabled="true"/> No newline at end of file
121 <parser enabled="true"/>
119 </buildOutputProvider> No newline at end of file
122 </buildOutputProvider>
120 <scannerInfoProvider id="specsFile"> No newline at end of file
123 <scannerInfoProvider id="specsFile">
121 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file
124 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
122 <parser enabled="true"/> No newline at end of file
125 <parser enabled="true"/>
123 </scannerInfoProvider> No newline at end of file
126 </scannerInfoProvider>
124 </profile> No newline at end of file
127 </profile>
125 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> No newline at end of file
128 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
126 <buildOutputProvider> No newline at end of file
129 <buildOutputProvider>
127 <openAction enabled="true" filePath=""/> No newline at end of file
130 <openAction enabled="true" filePath=""/>
128 <parser enabled="true"/> No newline at end of file
131 <parser enabled="true"/>
129 </buildOutputProvider> No newline at end of file
132 </buildOutputProvider>
130 <scannerInfoProvider id="specsFile"> No newline at end of file
133 <scannerInfoProvider id="specsFile">
131 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file
134 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
132 <parser enabled="true"/> No newline at end of file
135 <parser enabled="true"/>
133 </scannerInfoProvider> No newline at end of file
136 </scannerInfoProvider>
134 </profile> No newline at end of file
137 </profile>
135 <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1568263498;cdt.managedbuild.config.gnu.exe.release.1568263498.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929;cdt.managedbuild.tool.gnu.c.compiler.input.1347535566"> No newline at end of file
138 <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1568263498;cdt.managedbuild.config.gnu.exe.release.1568263498.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929;cdt.managedbuild.tool.gnu.c.compiler.input.1347535566">
136 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> No newline at end of file
139 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
137 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> No newline at end of file
140 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
138 <buildOutputProvider> No newline at end of file
141 <buildOutputProvider>
139 <openAction enabled="true" filePath=""/> No newline at end of file
142 <openAction enabled="true" filePath=""/>
140 <parser enabled="true"/> No newline at end of file
143 <parser enabled="true"/>
141 </buildOutputProvider> No newline at end of file
144 </buildOutputProvider>
142 <scannerInfoProvider id="specsFile"> No newline at end of file
145 <scannerInfoProvider id="specsFile">
143 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
146 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
144 <parser enabled="true"/> No newline at end of file
147 <parser enabled="true"/>
145 </scannerInfoProvider> No newline at end of file
148 </scannerInfoProvider>
146 </profile> No newline at end of file
149 </profile>
147 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> No newline at end of file
150 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
148 <buildOutputProvider> No newline at end of file
151 <buildOutputProvider>
149 <openAction enabled="true" filePath=""/> No newline at end of file
152 <openAction enabled="true" filePath=""/>
150 <parser enabled="true"/> No newline at end of file
153 <parser enabled="true"/>
151 </buildOutputProvider> No newline at end of file
154 </buildOutputProvider>
152 <scannerInfoProvider id="makefileGenerator"> No newline at end of file
155 <scannerInfoProvider id="makefileGenerator">
153 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> No newline at end of file
156 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
154 <parser enabled="true"/> No newline at end of file
157 <parser enabled="true"/>
155 </scannerInfoProvider> No newline at end of file
158 </scannerInfoProvider>
156 </profile> No newline at end of file
159 </profile>
157 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> No newline at end of file
160 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
158 <buildOutputProvider> No newline at end of file
161 <buildOutputProvider>
159 <openAction enabled="true" filePath=""/> No newline at end of file
162 <openAction enabled="true" filePath=""/>
160 <parser enabled="true"/> No newline at end of file
163 <parser enabled="true"/>
161 </buildOutputProvider> No newline at end of file
164 </buildOutputProvider>
162 <scannerInfoProvider id="specsFile"> No newline at end of file
165 <scannerInfoProvider id="specsFile">
163 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
166 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
164 <parser enabled="true"/> No newline at end of file
167 <parser enabled="true"/>
165 </scannerInfoProvider> No newline at end of file
168 </scannerInfoProvider>
166 </profile> No newline at end of file
169 </profile>
167 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> No newline at end of file
170 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
168 <buildOutputProvider> No newline at end of file
171 <buildOutputProvider>
169 <openAction enabled="true" filePath=""/> No newline at end of file
172 <openAction enabled="true" filePath=""/>
170 <parser enabled="true"/> No newline at end of file
173 <parser enabled="true"/>
171 </buildOutputProvider> No newline at end of file
174 </buildOutputProvider>
172 <scannerInfoProvider id="specsFile"> No newline at end of file
175 <scannerInfoProvider id="specsFile">
173 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file
176 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
174 <parser enabled="true"/> No newline at end of file
177 <parser enabled="true"/>
175 </scannerInfoProvider> No newline at end of file
178 </scannerInfoProvider>
176 </profile> No newline at end of file
179 </profile>
177 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> No newline at end of file
180 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
178 <buildOutputProvider> No newline at end of file
181 <buildOutputProvider>
179 <openAction enabled="true" filePath=""/> No newline at end of file
182 <openAction enabled="true" filePath=""/>
180 <parser enabled="true"/> No newline at end of file
183 <parser enabled="true"/>
181 </buildOutputProvider> No newline at end of file
184 </buildOutputProvider>
182 <scannerInfoProvider id="specsFile"> No newline at end of file
185 <scannerInfoProvider id="specsFile">
183 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file
186 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
184 <parser enabled="true"/> No newline at end of file
187 <parser enabled="true"/>
185 </scannerInfoProvider> No newline at end of file
188 </scannerInfoProvider>
186 </profile> No newline at end of file
189 </profile>
187 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> No newline at end of file
190 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
188 <buildOutputProvider> No newline at end of file
191 <buildOutputProvider>
189 <openAction enabled="true" filePath=""/> No newline at end of file
192 <openAction enabled="true" filePath=""/>
190 <parser enabled="true"/> No newline at end of file
193 <parser enabled="true"/>
191 </buildOutputProvider> No newline at end of file
194 </buildOutputProvider>
192 <scannerInfoProvider id="specsFile"> No newline at end of file
195 <scannerInfoProvider id="specsFile">
193 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file
196 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
194 <parser enabled="true"/> No newline at end of file
197 <parser enabled="true"/>
195 </scannerInfoProvider> No newline at end of file
198 </scannerInfoProvider>
196 </profile> No newline at end of file
199 </profile>
197 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> No newline at end of file
200 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
198 <buildOutputProvider> No newline at end of file
201 <buildOutputProvider>
199 <openAction enabled="true" filePath=""/> No newline at end of file
202 <openAction enabled="true" filePath=""/>
200 <parser enabled="true"/> No newline at end of file
203 <parser enabled="true"/>
201 </buildOutputProvider> No newline at end of file
204 </buildOutputProvider>
202 <scannerInfoProvider id="specsFile"> No newline at end of file
205 <scannerInfoProvider id="specsFile">
203 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file
206 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
204 <parser enabled="true"/> No newline at end of file
207 <parser enabled="true"/>
205 </scannerInfoProvider> No newline at end of file
208 </scannerInfoProvider>
206 </profile> No newline at end of file
209 </profile>
207 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> No newline at end of file
210 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
208 <buildOutputProvider> No newline at end of file
211 <buildOutputProvider>
209 <openAction enabled="true" filePath=""/> No newline at end of file
212 <openAction enabled="true" filePath=""/>
210 <parser enabled="true"/> No newline at end of file
213 <parser enabled="true"/>
211 </buildOutputProvider> No newline at end of file
214 </buildOutputProvider>
212 <scannerInfoProvider id="specsFile"> No newline at end of file
215 <scannerInfoProvider id="specsFile">
213 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file
216 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
214 <parser enabled="true"/> No newline at end of file
217 <parser enabled="true"/>
215 </scannerInfoProvider> No newline at end of file
218 </scannerInfoProvider>
216 </profile> No newline at end of file
219 </profile>
217 </scannerConfigBuildInfo> No newline at end of file
220 </scannerConfigBuildInfo>
218 </storageModule> No newline at end of file
221 </storageModule>
219 </cconfiguration> No newline at end of file
222 </cconfiguration>
220 </storageModule> No newline at end of file
223 </storageModule>
221 <storageModule moduleId="cdtBuildSystem" version="4.0.0"> No newline at end of file
224 <storageModule moduleId="cdtBuildSystem" version="4.0.0">
222 <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> No newline at end of file
225 <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
223 </storageModule> No newline at end of file
226 </storageModule>
224 </cproject> No newline at end of file
227 </cproject>
@@ -1,81 +1,81
1 <?xml version="1.0" encoding="UTF-8"?> No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription> No newline at end of file
2 <projectDescription>
3 <name>Control_Module</name> No newline at end of file
3 <name>Control_Module</name>
4 <comment></comment> No newline at end of file
4 <comment></comment>
5 <projects> No newline at end of file
5 <projects>
6 </projects> No newline at end of file
6 </projects>
7 <buildSpec> No newline at end of file
7 <buildSpec>
8 <buildCommand> No newline at end of file
8 <buildCommand>
9 <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> No newline at end of file
9 <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10 <triggers>clean,full,incremental,</triggers> No newline at end of file
10 <triggers>clean,full,incremental,</triggers>
11 <arguments> No newline at end of file
11 <arguments>
12 <dictionary> No newline at end of file
12 <dictionary>
13 <key>?name?</key> No newline at end of file
13 <key>?name?</key>
14 <value></value> No newline at end of file
14 <value></value>
15 </dictionary> No newline at end of file
15 </dictionary>
16 <dictionary> No newline at end of file
16 <dictionary>
17 <key>org.eclipse.cdt.make.core.append_environment</key> No newline at end of file
17 <key>org.eclipse.cdt.make.core.append_environment</key>
18 <value>true</value> No newline at end of file
18 <value>true</value>
19 </dictionary> No newline at end of file
19 </dictionary>
20 <dictionary> No newline at end of file
20 <dictionary>
21 <key>org.eclipse.cdt.make.core.autoBuildTarget</key> No newline at end of file
21 <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
22 <value>all</value> No newline at end of file
22 <value>all</value>
23 </dictionary> No newline at end of file
23 </dictionary>
24 <dictionary> No newline at end of file
24 <dictionary>
25 <key>org.eclipse.cdt.make.core.buildArguments</key> No newline at end of file
25 <key>org.eclipse.cdt.make.core.buildArguments</key>
26 <value></value> No newline at end of file
26 <value></value>
27 </dictionary> No newline at end of file
27 </dictionary>
28 <dictionary> No newline at end of file
28 <dictionary>
29 <key>org.eclipse.cdt.make.core.buildCommand</key> No newline at end of file
29 <key>org.eclipse.cdt.make.core.buildCommand</key>
30 <value>make</value> No newline at end of file
30 <value>make</value>
31 </dictionary> No newline at end of file
31 </dictionary>
32 <dictionary> No newline at end of file
32 <dictionary>
33 <key>org.eclipse.cdt.make.core.buildLocation</key>
33 <key>org.eclipse.cdt.make.core.buildLocation</key>
No newline at end of file
34 <value>${workspace_loc:/Control_Module}</value> No newline at end of file
34 <value>${workspace_loc:/Control_Module/Release}</value> No newline at end of file
35 </dictionary> No newline at end of file
35 </dictionary>
36 <dictionary> No newline at end of file
36 <dictionary>
37 <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> No newline at end of file
37 <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
38 <value>clean</value> No newline at end of file
38 <value>clean</value>
39 </dictionary> No newline at end of file
39 </dictionary>
40 <dictionary> No newline at end of file
40 <dictionary>
41 <key>org.eclipse.cdt.make.core.contents</key> No newline at end of file
41 <key>org.eclipse.cdt.make.core.contents</key>
42 <value>org.eclipse.cdt.make.core.activeConfigSettings</value> No newline at end of file
42 <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
43 </dictionary> No newline at end of file
43 </dictionary>
44 <dictionary> No newline at end of file
44 <dictionary>
45 <key>org.eclipse.cdt.make.core.enableAutoBuild</key> No newline at end of file
45 <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
46 <value>false</value> No newline at end of file
46 <value>false</value>
47 </dictionary> No newline at end of file
47 </dictionary>
48 <dictionary> No newline at end of file
48 <dictionary>
49 <key>org.eclipse.cdt.make.core.enableCleanBuild</key> No newline at end of file
49 <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
50 <value>true</value> No newline at end of file
50 <value>true</value>
51 </dictionary> No newline at end of file
51 </dictionary>
52 <dictionary> No newline at end of file
52 <dictionary>
53 <key>org.eclipse.cdt.make.core.enableFullBuild</key> No newline at end of file
53 <key>org.eclipse.cdt.make.core.enableFullBuild</key>
54 <value>true</value> No newline at end of file
54 <value>true</value>
55 </dictionary> No newline at end of file
55 </dictionary>
56 <dictionary> No newline at end of file
56 <dictionary>
57 <key>org.eclipse.cdt.make.core.fullBuildTarget</key> No newline at end of file
57 <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
58 <value>all</value> No newline at end of file
58 <value>all</value>
59 </dictionary> No newline at end of file
59 </dictionary>
60 <dictionary> No newline at end of file
60 <dictionary>
61 <key>org.eclipse.cdt.make.core.stopOnError</key> No newline at end of file
61 <key>org.eclipse.cdt.make.core.stopOnError</key>
62 <value>true</value> No newline at end of file
62 <value>true</value>
63 </dictionary> No newline at end of file
63 </dictionary>
64 <dictionary> No newline at end of file
64 <dictionary>
65 <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> No newline at end of file
65 <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
66 <value>true</value> No newline at end of file
66 <value>true</value>
67 </dictionary> No newline at end of file
67 </dictionary>
68 </arguments> No newline at end of file
68 </arguments>
69 </buildCommand> No newline at end of file
69 </buildCommand>
70 <buildCommand> No newline at end of file
70 <buildCommand>
71 <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> No newline at end of file
71 <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
72 <arguments> No newline at end of file
72 <arguments>
73 </arguments> No newline at end of file
73 </arguments>
74 </buildCommand> No newline at end of file
74 </buildCommand>
75 </buildSpec> No newline at end of file
75 </buildSpec>
76 <natures> No newline at end of file
76 <natures>
77 <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> No newline at end of file
77 <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
78 <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> No newline at end of file
78 <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
79 <nature>org.eclipse.cdt.core.cnature</nature> No newline at end of file
79 <nature>org.eclipse.cdt.core.cnature</nature>
80 </natures> No newline at end of file
80 </natures>
81 </projectDescription> No newline at end of file
81 </projectDescription>
@@ -1,1023 +1,1030
1 /* No newline at end of file
1 /*
2 * Servidor.c No newline at end of file
2 * Servidor.c
3 * No newline at end of file
3 *
4 * Created on: Nov 3, 2009 No newline at end of file
4 * Created on: Nov 3, 2009
5 * Author: Jose Francisco Quenta No newline at end of file
5 * Author: Jose Francisco Quenta
6 * No newline at end of file
6 *
7 * Se implementa: No newline at end of file
7 * Se implementa:
8 * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO No newline at end of file
8 * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO
9 * -Cambio de apunte. No newline at end of file
9 * -Cambio de apunte.
10 * -Lectura del estado actual del apunte y grabado del mismo en un archivo No newline at end of file
10 * -Lectura del estado actual del apunte y grabado del mismo en un archivo
11 * No newline at end of file
11 *
12 * Modified by Iván Manay since Nov 2012 No newline at end of file
12 * Modified by Iván Manay since Nov 2012
13 * -From UDP to TCP. No newline at end of file
13 * -From UDP to TCP.
14 * -Use of a frame for TCP communications with the central control module. No newline at end of file
14 * -Use of a frame for TCP communications with the central control module.
15 */ No newline at end of file
15 */
16 No newline at end of file
16
17 #include <stdio.h> No newline at end of file
17 #include <stdio.h>
18 #include <stdlib.h> No newline at end of file
18 #include <stdlib.h>
19 #include <string.h> No newline at end of file
19 #include <string.h>
20 #include <unistd.h> No newline at end of file
20 #include <unistd.h>
21 #include <errno.h> No newline at end of file
21 #include <errno.h>
22 No newline at end of file
22
23 #include <sys/types.h> No newline at end of file
23 #include <sys/types.h>
24 #include <sys/socket.h> No newline at end of file
24 #include <sys/socket.h>
25 #include <netinet/in.h> No newline at end of file
25 #include <netinet/in.h>
26 #include <arpa/inet.h> No newline at end of file
26 #include <arpa/inet.h>
27 #include <netdb.h> No newline at end of file
27 #include <netdb.h>
28 #include <time.h> No newline at end of file
28 #include <time.h>
29 #include <math.h> No newline at end of file
29 #include <math.h>
30 No newline at end of file
30
31 #include "./Librerias/at91gpio.h" No newline at end of file
31 #include "./Librerias/at91gpio.h"
32 //#include "./Librerias/Mensajes.h" No newline at end of file
32 //#include "./Librerias/Mensajes.h"
33 #include "./Librerias/at91adc.h" No newline at end of file
33 #include "./Librerias/at91adc.h"
34 //clock No newline at end of file
34 //clock
35 #include "./Librerias/at91sysclock.h" No newline at end of file
35 #include "./Librerias/at91sysclock.h"
36 No newline at end of file
36
37 #define PUERTO_SERVIDOR 5500 No newline at end of file
37 #define PUERTO_SERVIDOR 5500
38 #define TAM_BUFFER 1024 No newline at end of file
38 #define TAM_BUFFER 1024
39 No newline at end of file
39
40 #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE No newline at end of file
40 #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE
41 No newline at end of file
41
42 #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION No newline at end of file
42 #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION
43 No newline at end of file
43
44 #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB No newline at end of file
44 #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB
45 #define bit_up_1 0x00040000 No newline at end of file
45 #define bit_up_1 0x00040000
46 #define bit_up_0 0x00100000 No newline at end of file
46 #define bit_up_0 0x00100000
47 #define bit_dow_2 0x40000000 No newline at end of file
47 #define bit_dow_2 0x40000000
48 #define bit_dow_1 0x01000000 No newline at end of file
48 #define bit_dow_1 0x01000000
49 #define bit_dow_0 0x00400000 No newline at end of file
49 #define bit_dow_0 0x00400000
50 No newline at end of file
50
51 #define MyID 11 No newline at end of file
51 #define MyID 11
52 #define MAXPENDING 5 /* Maximum outstanding connection requests */ No newline at end of file
52 #define MAXPENDING 5 /* Maximum outstanding connection requests */
53 No newline at end of file
53
54 //parameters for the name of the output file No newline at end of file
54 //parameters for the name of the output file
55 #define FPRE "AD" //prefix for the output file name No newline at end of file
55 #define FPRE "AD" //prefix for the output file name
56 #define FEXT ".out" //file extension for the output file No newline at end of file
56 #define FEXT ".out" //file extension for the output file
57 #define FNAMELEN 40 No newline at end of file
57 #define FNAMELEN 40
58 No newline at end of file
58
59 //ADC parameters No newline at end of file
59 //ADC parameters
60 #define REP 1 //defines how many times the data acquisation loop is repeated No newline at end of file
60 #define REP 1 //defines how many times the data acquisation loop is repeated
61 #define NSAMPLES 100 //defines how many samples are taken in one data acqu- No newline at end of file
61 #define NSAMPLES 100 //defines how many samples are taken in one data acqu-
62 // isation loop No newline at end of file
62 // isation loop
63 #define CNVTIME 14.3 //defines how long it takes to get one sample. Value No newline at end of file
63 #define CNVTIME 14.3 //defines how long it takes to get one sample. Value
64 // is only needed for the output file, doesn't change No newline at end of file
64 // is only needed for the output file, doesn't change
65 // any ADC configurations No newline at end of file
65 // any ADC configurations
66 #define UREF 3.3 //Reference Voltage of ADC (max. ADC Voltage) No newline at end of file
66 #define UREF 3.3 //Reference Voltage of ADC (max. ADC Voltage)
67 #define ADCRES 1023 //Resolution of ADC (10bit=1023) No newline at end of file
67 #define ADCRES 1023 //Resolution of ADC (10bit=1023)
68 No newline at end of file
68
69 No newline at end of file
69
70 char *buff_experimento= NULL; No newline at end of file
70 char *buff_experimento= NULL;
71 No newline at end of file
71
72 AT91S_PIO *pioc; No newline at end of file
72 AT91S_PIO *pioc;
73 AT91S_PIO *piob; No newline at end of file
73 AT91S_PIO *piob;
74 No newline at end of file
74
75 struct control_module_parameters { No newline at end of file
75 struct control_module_parameters {
76 char ID[20]; No newline at end of file
76 char ID[20];
77 char param2[20]; No newline at end of file
77 char param2[20];
78 char param3[20]; No newline at end of file
78 char param3[20];
79 char param4[20]; No newline at end of file
79 char param4[20];
80 }; No newline at end of file
80 };
81 No newline at end of file
81
82 typedef struct control_module_parameters cmp; No newline at end of file
82 typedef struct control_module_parameters cmp;
83 No newline at end of file
83
84 char *header = NULL; No newline at end of file
84 char *header = NULL;
85 char *TypeOfInstrument = NULL; No newline at end of file
85 char *TypeOfInstrument = NULL;
86 char *iDSource = NULL; No newline at end of file
86 char *iDSource = NULL;
87 char *iDDestino = NULL; No newline at end of file
87 char *iDDestino = NULL;
88 char *rx_len = NULL; No newline at end of file
88 char *rx_len = NULL;
89 char *cmd = NULL; No newline at end of file
89 char *cmd = NULL;
90 char *rx_data = NULL; No newline at end of file
90 char *rx_data = NULL;
91 char *crc = NULL; No newline at end of file
91 char *crc = NULL;
92 No newline at end of file
92
93 cmp parameters; No newline at end of file
93 cmp parameters;
94 /* No newline at end of file
94 /*
95 * Zona de declaracion de cabeceras. No newline at end of file
95 * Zona de declaracion de cabeceras.
96 */ No newline at end of file
96 */
97 cmp inicializa_modulo(cmp p); No newline at end of file
97 cmp inicializa_modulo(cmp p);
98 int inicializa_ethernet(); No newline at end of file
98 int inicializa_ethernet();
99 int rxData(int, char*); No newline at end of file
99 int rxData(int, char*);
100 void txData(int, char*); No newline at end of file
100 void txData(int, char*);
101 void inicializa_gpio(); No newline at end of file
101 void inicializa_gpio();
102 void procesa_peticion(char *rx_buffer, char *tx_buffer); No newline at end of file
102 void procesa_peticion(char *rx_buffer, char *tx_buffer);
103 int cambia_apuntamiento(char *puntero_char); No newline at end of file
103 int cambia_apuntamiento(char *puntero_char);
104 int carga_experimento(char *nombre_archivo); No newline at end of file
104 int carga_experimento(char *nombre_archivo);
105 char *chequeo_sistema(char *filename, char *numero_muestras); No newline at end of file
105 char *chequeo_sistema(char *filename, char *numero_muestras);
106 void recibe_experimento(char *data, char filename[]); No newline at end of file
106 void recibe_experimento(char *data, char filename[]);
107 void SplitFrame(char *frame); No newline at end of file
107 void SplitFrame(char *frame);
108 void intToStr( int number, char* str ); No newline at end of file
108 void intToStr( int number, char* str );
109 No newline at end of file
109
110 //ABS monitoring No newline at end of file
110 //ABS monitoring
111 int ABS_monitoreo(int sel_atenuador, int sel_calibracion, float umbral, int pulsewidth); No newline at end of file
111 int ABS_monitoreo(int sel_atenuador, int sel_calibracion, float umbral, int pulsewidth);
112 No newline at end of file
112
113 AT91S_ADC * configADC1(void); No newline at end of file
113 AT91S_ADC * configADC1(void);
114 AT91S_ADC * configADC2(void); No newline at end of file
114 AT91S_ADC * configADC2(void);
115 No newline at end of file
115
116 FILE * create_Output(char*, time_t); No newline at end of file
116 FILE * create_Output(char*, time_t);
117 No newline at end of file
117
118 void writeOutput(float resultado, FILE * output); No newline at end of file
118 void writeOutput(float resultado, FILE * output);
119 No newline at end of file
119
120 int checkTx(long int results1[],long int results2[], float umbral, int pulsewidth); No newline at end of file
120 int checkTx(long int results1[],long int results2[], float umbral, int pulsewidth);
121 No newline at end of file
121
122 double mediana(long int *results, unsigned int cuenta); No newline at end of file
122 double mediana(long int *results, unsigned int cuenta);
123 float getPhase(long int results1[], long int results2[]); No newline at end of file
123 float getPhase(long int results1[], long int results2[]);
124 No newline at end of file
124
125 int fExists(char *); No newline at end of file
125 int fExists(char *);
126 int configCLK(); No newline at end of file
126 int configCLK();
127 // No newline at end of file
127 //
128 No newline at end of file
128
129 /* No newline at end of file
129 /*
130 * No newline at end of file
130 *
131 */ No newline at end of file
131 */
132 int main(){ No newline at end of file
132 int main(){
133 No newline at end of file
133
134 int servSocket; No newline at end of file
134 int servSocket;
135 int clntSocket; No newline at end of file
135 int clntSocket;
136 No newline at end of file
136
137 No newline at end of file
137
138 char *rx_buffer = (char *) malloc(TAM_BUFFER); No newline at end of file
138 char *rx_buffer = (char *) malloc(TAM_BUFFER);
139 char *tx_buffer = (char *) malloc(TAM_BUFFER); No newline at end of file
139 char *tx_buffer = (char *) malloc(TAM_BUFFER);
140 /* Inicializa parametros del modulo*/ No newline at end of file
140 /* Inicializa parametros del modulo*/
141 parameters = inicializa_modulo(parameters); No newline at end of file
141 parameters = inicializa_modulo(parameters);
142 printf("%s\n%s\n%s\n%s\n",parameters.ID, parameters.param2, parameters.param3, parameters.param4); No newline at end of file
142 printf("%s\n%s\n%s\n%s\n",parameters.ID, parameters.param2, parameters.param3, parameters.param4);
143 /* Inicializa red*/ No newline at end of file
143 /* Inicializa red*/
144 servSocket = inicializa_ethernet(); No newline at end of file
144 servSocket = inicializa_ethernet();
145 /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ No newline at end of file
145 /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */
146 inicializa_gpio(); No newline at end of file
146 inicializa_gpio();
147 No newline at end of file
147
148 while(1){ No newline at end of file
148 while(1){
149 // Recepción TCP de petición No newline at end of file
149 // Recepción TCP de petición
150 clntSocket = rxData(servSocket, rx_buffer); No newline at end of file
150 clntSocket = rxData(servSocket, rx_buffer);
151 //testpoint No newline at end of file
151 //testpoint
152 printf("rx:%s\n",rx_buffer); No newline at end of file
152 printf("rx:%s\n",rx_buffer);
153 // Procesamiento de la petición No newline at end of file
153 // Procesamiento de la petición
154 procesa_peticion(rx_buffer, tx_buffer); No newline at end of file
154 procesa_peticion(rx_buffer, tx_buffer);
155 //testpoint No newline at end of file
155 //testpoint
156 printf("tx:%s\n",tx_buffer); No newline at end of file
156 printf("tx:%s\n",tx_buffer);
157 // Respuesta del modulo de control No newline at end of file
157 // Respuesta del modulo de control
158 txData(clntSocket, tx_buffer); No newline at end of file
158 txData(clntSocket, tx_buffer);
159 No newline at end of file
159
160 } No newline at end of file
160 }
161 } No newline at end of file
161 }
162 No newline at end of file
162
163 No newline at end of file
163
164 int inicializa_ethernet(){ No newline at end of file
164 int inicializa_ethernet(){
165 No newline at end of file
165
166 struct sockaddr_in inf_servidor; No newline at end of file
166 struct sockaddr_in inf_servidor;
167 No newline at end of file
167
168 int servSocket; No newline at end of file
168 int servSocket;
169 No newline at end of file
169
170 int resultado; No newline at end of file
170 int resultado;
171 No newline at end of file
171
172 /* Haciendo la estructura local*/ No newline at end of file
172 /* Haciendo la estructura local*/
173 memset(&inf_servidor, 0, sizeof(inf_servidor)); No newline at end of file
173 memset(&inf_servidor, 0, sizeof(inf_servidor));
174 inf_servidor.sin_family= AF_INET; No newline at end of file
174 inf_servidor.sin_family= AF_INET;
175 inf_servidor.sin_port= htons(PUERTO_SERVIDOR); No newline at end of file
175 inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
176 inf_servidor.sin_addr.s_addr= INADDR_ANY; No newline at end of file
176 inf_servidor.sin_addr.s_addr= INADDR_ANY;
177 No newline at end of file
177
178 /* Se establece el socket */ No newline at end of file
178 /* Se establece el socket */
179 servSocket = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP); No newline at end of file
179 servSocket = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP);
180 if (servSocket == -1){ No newline at end of file
180 if (servSocket == -1){
181 printf("No se establecio correctamente el socket: socket()\n"); No newline at end of file
181 printf("No se establecio correctamente el socket: socket()\n");
182 //ERROR_FATAL("No se establecio correctamente el socket: socket()\n"); No newline at end of file
182 //ERROR_FATAL("No se establecio correctamente el socket: socket()\n");
183 exit(-1); No newline at end of file
183 exit(-1);
184 } No newline at end of file
184 }
185 No newline at end of file
185
186 /* Se asocia el socket a un puerto y una IP */ No newline at end of file
186 /* Se asocia el socket a un puerto y una IP */
187 resultado = bind(servSocket,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); No newline at end of file
187 resultado = bind(servSocket,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
188 if (resultado== -1){ No newline at end of file
188 if (resultado== -1){
189 printf("No se establecio correctamente el socket: bind()\n"); No newline at end of file
189 printf("No se establecio correctamente el socket: bind()\n");
190 //ERROR_FATAL("No se establecio correctamente el socket: bind()\n"); No newline at end of file
190 //ERROR_FATAL("No se establecio correctamente el socket: bind()\n");
191 exit(-1); No newline at end of file
191 exit(-1);
192 } No newline at end of file
192 }
193 No newline at end of file
193
194 if (listen(servSocket, MAXPENDING) < 0){ No newline at end of file
194 if (listen(servSocket, MAXPENDING) < 0){
195 printf("listen() failed\n"); No newline at end of file
195 printf("listen() failed\n");
196 exit(-1); No newline at end of file
196 exit(-1);
197 } No newline at end of file
197 }
198 No newline at end of file
198
199 return servSocket; No newline at end of file
199 return servSocket;
200 No newline at end of file
200
201 } No newline at end of file
201 }
202 No newline at end of file
202
203 int rxData(int servSocket, char* rx_buffer){ No newline at end of file
203 int rxData(int servSocket, char* rx_buffer){
204 No newline at end of file
204
205 int clntSocket; No newline at end of file
205 int clntSocket;
206 struct sockaddr_in inf_cliente; No newline at end of file
206 struct sockaddr_in inf_cliente;
207 int numbytes_recibidos; No newline at end of file
207 int numbytes_recibidos;
208 unsigned int inf_client_Len; No newline at end of file
208 unsigned int inf_client_Len;
209 No newline at end of file
209
210 printf("\nEsperando solicitud de cliente...\n"); No newline at end of file
210 printf("\nEsperando solicitud de cliente...\n");
211 No newline at end of file
211
212 /* Set the size of the in-out parameter */ No newline at end of file
212 /* Set the size of the in-out parameter */
213 inf_client_Len = sizeof(inf_cliente); No newline at end of file
213 inf_client_Len = sizeof(inf_cliente);
214 /* Se espera hasta que un cliente se conecte */ No newline at end of file
214 /* Se espera hasta que un cliente se conecte */
215 if ((clntSocket = accept(servSocket, (struct sockaddr *) &inf_cliente, No newline at end of file
215 if ((clntSocket = accept(servSocket, (struct sockaddr *) &inf_cliente,
216 &inf_client_Len)) < 0) No newline at end of file
216 &inf_client_Len)) < 0)
217 printf("accept() failed\n"); No newline at end of file
217 printf("accept() failed\n");
218 No newline at end of file
218
219 if ((numbytes_recibidos = recv(clntSocket, rx_buffer, TAM_BUFFER, 0)) < 0) No newline at end of file
219 if ((numbytes_recibidos = recv(clntSocket, rx_buffer, TAM_BUFFER, 0)) < 0)
220 printf("recv() failed\n"); No newline at end of file
220 printf("recv() failed\n");
221 No newline at end of file
221
222 /* Se procede a procesar los datos recibidos */ No newline at end of file
222 /* Se procede a procesar los datos recibidos */
223 rx_buffer[numbytes_recibidos]= '\0'; No newline at end of file
223 rx_buffer[numbytes_recibidos]= '\0';
224 No newline at end of file
224
225 return clntSocket; No newline at end of file
225 return clntSocket;
226 } No newline at end of file
226 }
227 No newline at end of file
227
228 void txData(int clntSocket, char* data){ No newline at end of file
228 void txData(int clntSocket, char* data){
229 No newline at end of file
229
230 /* Echo message back to client */ No newline at end of file
230 /* Echo message back to client */
231 if (send(clntSocket, data, strlen(data), 0) != strlen(data)) No newline at end of file
231 if (send(clntSocket, data, strlen(data), 0) != strlen(data))
232 printf("send() failed\n"); No newline at end of file
232 printf("send() failed\n");
233 No newline at end of file
233
234 close(clntSocket); /* Close client socket */ No newline at end of file
234 close(clntSocket); /* Close client socket */
235 } No newline at end of file
235 }
236 No newline at end of file
236
237 /* No newline at end of file
237 /*
238 * Esta funcion incializa el puerto GPIO No newline at end of file
238 * Esta funcion incializa el puerto GPIO
239 */ No newline at end of file
239 */
240 void inicializa_gpio(){ No newline at end of file
240 void inicializa_gpio(){
241 No newline at end of file
241
242 // Configuracion de los pines de APUNTE No newline at end of file
242 // Configuracion de los pines de APUNTE
243 pioc = pio_map(PIOC_BASE); No newline at end of file
243 pioc = pio_map(PIOC_BASE);
244 pio_enable(pioc, maskc_out); No newline at end of file
244 pio_enable(pioc, maskc_out);
245 pio_disable_irq(pioc, maskc_out); No newline at end of file
245 pio_disable_irq(pioc, maskc_out);
246 pio_disable_multiple_driver(pioc, maskc_out); No newline at end of file
246 pio_disable_multiple_driver(pioc, maskc_out);
247 pio_disable_pull_ups(pioc, maskc_out); No newline at end of file
247 pio_disable_pull_ups(pioc, maskc_out);
248 pio_synchronous_data_output(pioc, maskc_out); No newline at end of file
248 pio_synchronous_data_output(pioc, maskc_out);
249 pio_output_enable(pioc, maskc_out); No newline at end of file
249 pio_output_enable(pioc, maskc_out);
250 No newline at end of file
250
251 // Configuracion de los pines de VERIFICACION No newline at end of file
251 // Configuracion de los pines de VERIFICACION
252 piob = pio_map(PIOB_BASE); No newline at end of file
252 piob = pio_map(PIOB_BASE);
253 pio_enable(piob, maskb_in); No newline at end of file
253 pio_enable(piob, maskb_in);
254 pio_disable_irq(piob, maskb_in); No newline at end of file
254 pio_disable_irq(piob, maskb_in);
255 pio_disable_multiple_driver(piob, maskb_in); No newline at end of file
255 pio_disable_multiple_driver(piob, maskb_in);
256 pio_disable_pull_ups(piob, maskb_in); No newline at end of file
256 pio_disable_pull_ups(piob, maskb_in);
257 pio_input_enable(piob, maskb_in); No newline at end of file
257 pio_input_enable(piob, maskb_in);
258 } No newline at end of file
258 }
259 No newline at end of file
259
260 No newline at end of file
260
261 /* No newline at end of file
261 /*
262 * Divide rx frame into the frame components No newline at end of file
262 * Divide rx frame into the frame components
263 */ No newline at end of file
263 */
264 void SplitFrame(char *frame){ No newline at end of file
264 void SplitFrame(char *frame){
265 header = malloc(4); No newline at end of file
265 header = malloc(4);
266 *header = *frame; No newline at end of file
266 *header = *frame;
267 *(header + 1) = *(frame + 1); No newline at end of file
267 *(header + 1) = *(frame + 1);
268 *(header + 2) = *(frame + 2); No newline at end of file
268 *(header + 2) = *(frame + 2);
269 *(header + 3) = '\0'; No newline at end of file
269 *(header + 3) = '\0';
270 TypeOfInstrument = malloc(4); No newline at end of file
270 TypeOfInstrument = malloc(4);
271 *TypeOfInstrument = *(frame + 3); No newline at end of file
271 *TypeOfInstrument = *(frame + 3);
272 *(TypeOfInstrument + 1) = *(frame + 4); No newline at end of file
272 *(TypeOfInstrument + 1) = *(frame + 4);
273 *(TypeOfInstrument + 2) = *(frame + 5); No newline at end of file
273 *(TypeOfInstrument + 2) = *(frame + 5);
274 *(TypeOfInstrument + 3) = '\0'; No newline at end of file
274 *(TypeOfInstrument + 3) = '\0';
275 iDSource = malloc(8); No newline at end of file
275 iDSource = malloc(8);
276 *iDSource = *(frame + 6); No newline at end of file
276 *iDSource = *(frame + 6);
277 *(iDSource + 1) = *(frame + 7); No newline at end of file
277 *(iDSource + 1) = *(frame + 7);
278 *(iDSource + 2) = *(frame + 8); No newline at end of file
278 *(iDSource + 2) = *(frame + 8);
279 *(iDSource + 3) = *(frame + 9); No newline at end of file
279 *(iDSource + 3) = *(frame + 9);
280 *(iDSource + 4) = *(frame + 10); No newline at end of file
280 *(iDSource + 4) = *(frame + 10);
281 *(iDSource + 5) = *(frame + 11); No newline at end of file
281 *(iDSource + 5) = *(frame + 11);
282 *(iDSource + 6) = *(frame + 12); No newline at end of file
282 *(iDSource + 6) = *(frame + 12);
283 *(iDSource + 7) = '\0'; No newline at end of file
283 *(iDSource + 7) = '\0';
284 iDDestino = malloc(8); No newline at end of file
284 iDDestino = malloc(8);
285 *iDDestino = *(frame + 13); No newline at end of file
285 *iDDestino = *(frame + 13);
286 *(iDDestino + 1) = *(frame + 14); No newline at end of file
286 *(iDDestino + 1) = *(frame + 14);
287 *(iDDestino + 2) = *(frame + 15); No newline at end of file
287 *(iDDestino + 2) = *(frame + 15);
288 *(iDDestino + 3) = *(frame + 16); No newline at end of file
288 *(iDDestino + 3) = *(frame + 16);
289 *(iDDestino + 4) = *(frame + 17); No newline at end of file
289 *(iDDestino + 4) = *(frame + 17);
290 *(iDDestino + 5) = *(frame + 18); No newline at end of file
290 *(iDDestino + 5) = *(frame + 18);
291 *(iDDestino + 6) = *(frame + 19); No newline at end of file
291 *(iDDestino + 6) = *(frame + 19);
292 *(iDDestino + 7) = '\0'; No newline at end of file
292 *(iDDestino + 7) = '\0';
293 rx_len = malloc(7); No newline at end of file
293 rx_len = malloc(7);
294 *rx_len = *(frame + 20); No newline at end of file
294 *rx_len = *(frame + 20);
295 *(rx_len + 1) = *(frame + 21); No newline at end of file
295 *(rx_len + 1) = *(frame + 21);
296 *(rx_len + 2) = *(frame + 22); No newline at end of file
296 *(rx_len + 2) = *(frame + 22);
297 *(rx_len + 3) = *(frame + 23); No newline at end of file
297 *(rx_len + 3) = *(frame + 23);
298 *(rx_len + 4) = *(frame + 24); No newline at end of file
298 *(rx_len + 4) = *(frame + 24);
299 *(rx_len + 5) = *(frame + 25); No newline at end of file
299 *(rx_len + 5) = *(frame + 25);
300 *(rx_len + 6) = '\0'; No newline at end of file
300 *(rx_len + 6) = '\0';
301 cmd = malloc(5); No newline at end of file
301 cmd = malloc(5);
302 *cmd = *(frame + 26); No newline at end of file
302 *cmd = *(frame + 26);
303 *(cmd + 1) = *(frame + 27); No newline at end of file
303 *(cmd + 1) = *(frame + 27);
304 *(cmd + 2) = *(frame + 28); No newline at end of file
304 *(cmd + 2) = *(frame + 28);
305 *(cmd + 3) = *(frame + 29); No newline at end of file
305 *(cmd + 3) = *(frame + 29);
306 *(cmd + 4) = '\0'; No newline at end of file
306 *(cmd + 4) = '\0';
307 No newline at end of file
307
308 int l = atoi(rx_len); No newline at end of file
308 int l = atoi(rx_len);
309 rx_data = malloc(l + 1); No newline at end of file
309 rx_data = malloc(l + 1);
310 int i; No newline at end of file
310 int i;
311 for (i = 30; i < 30 + l; i++) No newline at end of file
311 for (i = 30; i < 30 + l; i++)
312 *(rx_data + (i-30)) = *(frame + i); No newline at end of file
312 *(rx_data + (i-30)) = *(frame + i);
313 *(rx_data + l) = '\0'; No newline at end of file
313 *(rx_data + l) = '\0';
314 crc = malloc(2); No newline at end of file
314 crc = malloc(2);
315 *crc = *(frame + 30 + l); No newline at end of file
315 *crc = *(frame + 30 + l);
316 *(crc + 1) = '\0'; No newline at end of file
316 *(crc + 1) = '\0';
317 } No newline at end of file
317 }
318 No newline at end of file
318
319 No newline at end of file
319
320 /* No newline at end of file
320 /*
321 * Esta funcion procesa el mensaje de peticion y genera respuesta No newline at end of file
321 * Esta funcion procesa el mensaje de peticion y genera respuesta
322 */ No newline at end of file
322 */
323 void procesa_peticion(char *rx_buffer, char *tx_buffer){ No newline at end of file
323 void procesa_peticion(char *rx_buffer, char *tx_buffer){
324 // int n = 0; No newline at end of file
324 // int n = 0;
325 char filename1[50]; No newline at end of file
325 char filename1[50];
326 char filename2[] = "verificacion.txt"; No newline at end of file
326 char filename2[] = "verificacion.txt";
327 char *tx_data = NULL; No newline at end of file
327 char *tx_data = NULL;
328 char *tx_len = NULL; No newline at end of file
328 char *tx_len = NULL;
329 SplitFrame(rx_buffer); No newline at end of file
329 SplitFrame(rx_buffer);
330 No newline at end of file
330
331 if ((cmd == NULL) || (rx_data == NULL)){ No newline at end of file
331 if ((cmd == NULL) || (rx_data == NULL)){
332 printf("procesarPeticion: formato de mensaje incorrecto"); No newline at end of file
332 printf("procesarPeticion: formato de mensaje incorrecto");
333 //ERROR("procesarPeticion: formato de mensaje incorrecto"); No newline at end of file
333 //ERROR("procesarPeticion: formato de mensaje incorrecto");
334 No newline at end of file
334
335 } No newline at end of file
335 }
336 else{ No newline at end of file
336 else{
337 if(strcmp(cmd,"SNDF") == 0){ No newline at end of file
337 if(strcmp(cmd,"SNDF") == 0){
338 recibe_experimento(rx_data,filename1); No newline at end of file
338 recibe_experimento(rx_data,filename1);
339 carga_experimento(filename1); No newline at end of file
339 carga_experimento(filename1);
340 cambia_apuntamiento("0"); No newline at end of file
340 cambia_apuntamiento("0");
341 tx_data = (char*)malloc(3); No newline at end of file
341 tx_data = (char*)malloc(3);
342 tx_data = "OK"; No newline at end of file
342 tx_data = "OK";
343 } No newline at end of file
343 }
344 else if(strcmp(cmd,"CHGB") == 0){ No newline at end of file
344 else if(strcmp(cmd,"CHGB") == 0){
345 cambia_apuntamiento(rx_data); No newline at end of file
345 cambia_apuntamiento(rx_data);
346 tx_data = (char*)malloc(3); No newline at end of file
346 tx_data = (char*)malloc(3);
347 tx_data = "OK"; No newline at end of file
347 tx_data = "OK";
348 } No newline at end of file
348 }
349 else if(strcmp(cmd,"ANST") == 0){ No newline at end of file
349 else if(strcmp(cmd,"ANST") == 0){
350 tx_data = chequeo_sistema(filename2,rx_data); No newline at end of file
350 tx_data = chequeo_sistema(filename2,rx_data);
351 ABS_monitoreo(1, 1, 50, 10); No newline at end of file
351 ABS_monitoreo(1, 1, 50, 10);
352 printf("%s\n",tx_data); No newline at end of file
352 printf("%s\n",tx_data);
353 } No newline at end of file
353 }
354 else if(strcmp(cmd,"NTST") == 0){ No newline at end of file
354 else if(strcmp(cmd,"NTST") == 0){
355 tx_data = malloc(strlen(parameters.ID) + 1); No newline at end of file
355 tx_data = malloc(strlen(parameters.ID) + 1);
356 strcpy(tx_data,parameters.ID); No newline at end of file
356 strcpy(tx_data,parameters.ID);
357 printf("%s\n",tx_data); No newline at end of file
357 printf("%s\n",tx_data);
358 } No newline at end of file
358 }
359 else{ No newline at end of file
359 else{
360 tx_data = (char*)malloc(6); No newline at end of file
360 tx_data = (char*)malloc(6);
361 tx_data = "Error"; No newline at end of file
361 tx_data = "Error";
362 printf("procesa_peticion: comando no reconocido"); No newline at end of file
362 printf("procesa_peticion: comando no reconocido");
363 //ERROR("procesa_peticion: comando no reconocido"); No newline at end of file
363 //ERROR("procesa_peticion: comando no reconocido");
364 } No newline at end of file
364 }
365 No newline at end of file
365
366 tx_len = malloc(7); No newline at end of file
366 tx_len = malloc(7);
367 int number = strlen(tx_data); No newline at end of file
367 int number = strlen(tx_data);
368 intToStr(number, tx_len ); No newline at end of file
368 intToStr(number, tx_len );
369 No newline at end of file
369
370 strcpy(tx_buffer,header); //3 No newline at end of file
370 strcpy(tx_buffer,header); //3
371 strcat(tx_buffer,TypeOfInstrument); //3 No newline at end of file
371 strcat(tx_buffer,TypeOfInstrument); //3
372 strcat(tx_buffer,parameters.ID); //7 No newline at end of file
372 strcat(tx_buffer,parameters.ID); //7
373 strcat(tx_buffer,iDSource); //7 No newline at end of file
373 strcat(tx_buffer,iDSource); //7
374 strcat(tx_buffer,tx_len); //6 No newline at end of file
374 strcat(tx_buffer,tx_len); //6
375 strcat(tx_buffer,cmd); //4 No newline at end of file
375 strcat(tx_buffer,cmd); //4
376 strcat(tx_buffer,tx_data); //? No newline at end of file
376 strcat(tx_buffer,tx_data); //?
377 strcat(tx_buffer,crc); //1 No newline at end of file
377 strcat(tx_buffer,crc); //1
378 No newline at end of file
378
379 } No newline at end of file
379 }
380 No newline at end of file
380
381 } No newline at end of file
381 }
382 No newline at end of file
382
383 /* No newline at end of file
383 /*
384 * Esta función genera el archivo de experimento a partir de la trama TCP recibida No newline at end of file
384 * Esta función genera el archivo de experimento a partir de la trama TCP recibida
385 */ No newline at end of file
385 */
386 void recibe_experimento(char *p_data, char filename[]){ No newline at end of file
386 void recibe_experimento(char *p_data, char filename[]){
387 FILE *fd; No newline at end of file
387 FILE *fd;
388 int i = 0; No newline at end of file
388 int i = 0;
389 No newline at end of file
389
390 while (*p_data != '\n'){ No newline at end of file
390 while (*p_data != '\n'){
391 filename[i] = *p_data; No newline at end of file
391 filename[i] = *p_data;
392 i++; No newline at end of file
392 i++;
393 p_data++; No newline at end of file
393 p_data++;
394 } No newline at end of file
394 }
395 filename[i] = '\0'; No newline at end of file
395 filename[i] = '\0';
396 p_data = p_data - i; No newline at end of file
396 p_data = p_data - i;
397 fd = fopen(filename,"w"); No newline at end of file
397 fd = fopen(filename,"w");
398 fprintf(fd, p_data); No newline at end of file
398 fprintf(fd, p_data);
399 fclose(fd); No newline at end of file
399 fclose(fd);
400 } No newline at end of file
400 }
401 No newline at end of file
401
402 /* No newline at end of file
402 /*
403 * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego No newline at end of file
403 * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego
404 * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato No newline at end of file
404 * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato
405 * que sera usado en el cambio de apuntamiento. No newline at end of file
405 * que sera usado en el cambio de apuntamiento.
406 */ No newline at end of file
406 */
407 int carga_experimento(char *nombre_archivo){ No newline at end of file
407 int carga_experimento(char *nombre_archivo){
408 No newline at end of file
408
409 FILE *Archivo_Fd; No newline at end of file
409 FILE *Archivo_Fd;
410 No newline at end of file
410
411 char *cadena = (char *) malloc(25); No newline at end of file
411 char *cadena = (char *) malloc(25);
412 No newline at end of file
412
413 int longitud_cadena; No newline at end of file
413 int longitud_cadena;
414 int num_bytes= 0; No newline at end of file
414 int num_bytes= 0;
415 int num_filas= 0; No newline at end of file
415 int num_filas= 0;
416 No newline at end of file
416
417 Archivo_Fd = fopen(nombre_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada No newline at end of file
417 Archivo_Fd = fopen(nombre_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada
418 if(!Archivo_Fd){ No newline at end of file
418 if(!Archivo_Fd){
419 printf("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); No newline at end of file
419 printf("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n");
420 //ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); No newline at end of file
420 //ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n");
421 return -1; No newline at end of file
421 return -1;
422 }else{ No newline at end of file
422 }else{
423 No newline at end of file
423
424 while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria No newline at end of file
424 while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria
425 fgets(cadena,20,Archivo_Fd); No newline at end of file
425 fgets(cadena,20,Archivo_Fd);
426 longitud_cadena= strlen(cadena); No newline at end of file
426 longitud_cadena= strlen(cadena);
427 cadena[longitud_cadena-1] = '\0'; No newline at end of file
427 cadena[longitud_cadena-1] = '\0';
428 num_bytes = num_bytes + longitud_cadena; No newline at end of file
428 num_bytes = num_bytes + longitud_cadena;
429 num_filas++; No newline at end of file
429 num_filas++;
430 } No newline at end of file
430 }
431 No newline at end of file
431
432 rewind(Archivo_Fd); // Se reinicia el puntero del archivo No newline at end of file
432 rewind(Archivo_Fd); // Se reinicia el puntero del archivo
433 No newline at end of file
433
434 char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun No newline at end of file
434 char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun
435 // la longitud del archivo No newline at end of file
435 // la longitud del archivo
436 fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); No newline at end of file
436 fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd);
437 No newline at end of file
437
438 char *puntero= strstr(buffer_temporal,".ab1"); // Se procede a eliminar la cabecera del archivo No newline at end of file
438 char *puntero= strstr(buffer_temporal,".ab1"); // Se procede a eliminar la cabecera del archivo
439 puntero= puntero + 12; No newline at end of file
439 puntero= puntero + 12;
440 No newline at end of file
440
441 buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); No newline at end of file
441 buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3);
442 strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo No newline at end of file
442 strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo
443 No newline at end of file
443
444 fclose(Archivo_Fd); No newline at end of file
444 fclose(Archivo_Fd);
445 No newline at end of file
445
446 return 1; No newline at end of file
446 return 1;
447 } No newline at end of file
447 }
448 } No newline at end of file
448 }
449 No newline at end of file
449
450 /* No newline at end of file
450 /*
451 * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en No newline at end of file
451 * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en
452 * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta No newline at end of file
452 * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta
453 * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a No newline at end of file
453 * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a
454 * traves del puerto GPIO. No newline at end of file
454 * traves del puerto GPIO.
455 */ No newline at end of file
455 */
456 int cambia_apuntamiento(char *puntero_char){ No newline at end of file
456 int cambia_apuntamiento(char *puntero_char){
457 No newline at end of file
457
458 /*MSB-UP-LSB MSB-DOWN-LSB*/ No newline at end of file
458 /*MSB-UP-LSB MSB-DOWN-LSB*/
459 int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara No newline at end of file
459 int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara
460 // al dato que ingresa para formar el número No newline at end of file
460 // al dato que ingresa para formar el número
461 // entero que se le pasara al puerto GPIO No newline at end of file
461 // entero que se le pasara al puerto GPIO
462 // Estos números son los pines del puerto GPIO No newline at end of file
462 // Estos números son los pines del puerto GPIO
463 // que se estan usando para el control No newline at end of file
463 // que se estan usando para el control
464 No newline at end of file
464
465 int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero No newline at end of file
465 int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero
466 No newline at end of file
466
467 int base= 7*puntero; // base= cantidad_bytes del dato x puntero No newline at end of file
467 int base= 7*puntero; // base= cantidad_bytes del dato x puntero
468 // cantidad de bytes es el numero de bytes que No newline at end of file
468 // cantidad de bytes es el numero de bytes que
469 printf("%s\n",puntero_char); // contiene cada dato, para este caso es 7 No newline at end of file
469 printf("%s\n",puntero_char); // contiene cada dato, para este caso es 7
470 // porque es 6 bits de datos + 1 bit del cambio No newline at end of file
470 // porque es 6 bits de datos + 1 bit del cambio
471 // de linea. No newline at end of file
471 // de linea.
472 char valor_char; No newline at end of file
472 char valor_char;
473 unsigned long valor; No newline at end of file
473 unsigned long valor;
474 unsigned long acumulado_ceros=0; No newline at end of file
474 unsigned long acumulado_ceros=0;
475 unsigned long acumulado_unos=0; No newline at end of file
475 unsigned long acumulado_unos=0;
476 No newline at end of file
476
477 int offset; // Defino offset para el desplazamiento a traves No newline at end of file
477 int offset; // Defino offset para el desplazamiento a traves
478 for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" No newline at end of file
478 for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento"
479 No newline at end of file
479
480 valor_char= buff_experimento[base+offset]; // Obtengo el dato No newline at end of file
480 valor_char= buff_experimento[base+offset]; // Obtengo el dato
481 No newline at end of file
481
482 if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno No newline at end of file
482 if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno
483 valor= 0; No newline at end of file
483 valor= 0;
484 acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); No newline at end of file
484 acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]);
485 }else{ No newline at end of file
485 }else{
486 valor= 1; No newline at end of file
486 valor= 1;
487 acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); No newline at end of file
487 acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]);
488 } No newline at end of file
488 }
489 } No newline at end of file
489 }
490 pio_out(pioc, maskc_out, acumulado_unos, 1); No newline at end of file
490 pio_out(pioc, maskc_out, acumulado_unos, 1);
491 pio_out(pioc, maskc_out, acumulado_ceros, 0); No newline at end of file
491 pio_out(pioc, maskc_out, acumulado_ceros, 0);
492 No newline at end of file
492
493 return 1; No newline at end of file
493 return 1;
494 No newline at end of file
494
495 } No newline at end of file
495 }
496 No newline at end of file
496
497 /* No newline at end of file
497 /*
498 * Esta funcion lee "n" veces el estado del APUNTE actual y reporta No newline at end of file
498 * Esta funcion lee "n" veces el estado del APUNTE actual y reporta
499 * una cadena de Verificacion. No newline at end of file
499 * una cadena de Verificacion.
500 */ No newline at end of file
500 */
501 char* chequeo_sistema(char *filename, char *numero_muestras){ No newline at end of file
501 char* chequeo_sistema(char *filename, char *numero_muestras){
502 No newline at end of file
502
503 int i; No newline at end of file
503 int i;
504 int cnt = 0; No newline at end of file
504 int cnt = 0;
505 unsigned int entradac= 0; No newline at end of file
505 unsigned int entradac= 0;
506 No newline at end of file
506
507 char page0[250]; No newline at end of file
507 char page0[250];
508 No newline at end of file
508
509 strcpy(page0,"Verificacion\n"); No newline at end of file
509 strcpy(page0,"Verificacion\n");
510 strcat(page0,parameters.ID); No newline at end of file
510 strcat(page0,parameters.ID);
511 strcat(page0,"\n------------\n"); No newline at end of file
511 strcat(page0,"\n------------\n");
512 No newline at end of file
512
513 char page1[8]; No newline at end of file
513 char page1[8];
514 No newline at end of file
514
515 do{ No newline at end of file
515 do{
516 //Inicializando arreglo No newline at end of file
516 //Inicializando arreglo
517 for(i=0;i<6;i++) No newline at end of file
517 for(i=0;i<6;i++)
518 page1[i]='0'; No newline at end of file
518 page1[i]='0';
519 page1[6] = '\n'; No newline at end of file
519 page1[6] = '\n';
520 page1[7] = '\0'; No newline at end of file
520 page1[7] = '\0';
521 //Lectura de puerto No newline at end of file
521 //Lectura de puerto
522 entradac= pio_in(piob,maskb_in); No newline at end of file
522 entradac= pio_in(piob,maskb_in);
523 //Dandole formato al dato No newline at end of file
523 //Dandole formato al dato
524 if (!(entradac & bit_up_2)) No newline at end of file
524 if (!(entradac & bit_up_2))
525 page1[0] = '1'; No newline at end of file
525 page1[0] = '1';
526 if (!(entradac & bit_up_1)) No newline at end of file
526 if (!(entradac & bit_up_1))
527 page1[1] = '1'; No newline at end of file
527 page1[1] = '1';
528 if (!(entradac & bit_up_0)) No newline at end of file
528 if (!(entradac & bit_up_0))
529 page1[2] = '1'; No newline at end of file
529 page1[2] = '1';
530 if (!(entradac & bit_dow_2)) No newline at end of file
530 if (!(entradac & bit_dow_2))
531 page1[3] = '1'; No newline at end of file
531 page1[3] = '1';
532 if (!(entradac & bit_dow_1)) No newline at end of file
532 if (!(entradac & bit_dow_1))
533 page1[4] = '1'; No newline at end of file
533 page1[4] = '1';
534 if (!(entradac & bit_dow_0)) No newline at end of file
534 if (!(entradac & bit_dow_0))
535 page1[5] = '1'; No newline at end of file
535 page1[5] = '1';
536 No newline at end of file
536
537 strcat(page0, page1); No newline at end of file
537 strcat(page0, page1);
538 cnt=cnt+1; No newline at end of file
538 cnt=cnt+1;
539 usleep(1*1000*1000); No newline at end of file
539 usleep(1*1000*1000);
540 No newline at end of file
540
541 }while(cnt < atoi(numero_muestras)); No newline at end of file
541 }while(cnt < atoi(numero_muestras));
542 No newline at end of file
542
543 page0[strlen(page0)] = '\0'; No newline at end of file
543 page0[strlen(page0)] = '\0';
544 No newline at end of file
544
545 char *all_pages = malloc(strlen(page0)+1); No newline at end of file
545 char *all_pages = malloc(strlen(page0)+1);
546 strcpy(all_pages, page0); No newline at end of file
546 strcpy(all_pages, page0);
547 return all_pages; No newline at end of file
547 return all_pages;
548 } No newline at end of file
548 }
549 No newline at end of file
549
550 /* No newline at end of file
550 /*
551 * No newline at end of file
551 *
552 */ No newline at end of file
552 */
553 cmp inicializa_modulo(cmp p){ No newline at end of file
553 cmp inicializa_modulo(cmp p){
554 FILE *fd = fopen("configuration.txt","r"); No newline at end of file
554 FILE *fd = fopen("configuration.txt","r");
555 fgets(p.ID,20,fd); No newline at end of file
555 fgets(p.ID,20,fd);
556 p.ID[7]='\0'; No newline at end of file
556 p.ID[7]='\0';
557 fgets(p.param2,20,fd); No newline at end of file
557 fgets(p.param2,20,fd);
558 p.param2[10]='\0'; No newline at end of file
558 p.param2[10]='\0';
559 fgets(p.param3,20,fd); No newline at end of file
559 fgets(p.param3,20,fd);
560 p.param3[10]='\0'; No newline at end of file
560 p.param3[10]='\0';
561 fgets(p.param4,20,fd); No newline at end of file
561 fgets(p.param4,20,fd);
562 p.param4[10]='\0'; No newline at end of file
562 p.param4[10]='\0';
563 fclose(fd); No newline at end of file
563 fclose(fd);
564 return p; No newline at end of file
564 return p;
565 } No newline at end of file
565 }
566 No newline at end of file
566
567 /* No newline at end of file
567 /*
568 * No newline at end of file
568 *
569 */ No newline at end of file
569 */
570 void intToStr( int number, char* str ) No newline at end of file
570 void intToStr( int number, char* str )
571 No newline at end of file
571
572 { No newline at end of file
572 {
573 int index = 0; No newline at end of file
573 int index = 0;
574 No newline at end of file
574
575 while( number > 0 ) No newline at end of file
575 while( number > 0 )
576 { No newline at end of file
576 {
577 int digit = number%10; No newline at end of file
577 int digit = number%10;
578 str[index++] = digit + '0'; No newline at end of file
578 str[index++] = digit + '0';
579 number /= 10; No newline at end of file
579 number /= 10;
580 } No newline at end of file
580 }
581 str[index] = '\0'; No newline at end of file
581 str[index] = '\0';
582 //Adding zero to the left No newline at end of file
582 //Adding zero to the left
583 int n= strlen(str); No newline at end of file
583 int n= strlen(str);
584 if (n == 1) { No newline at end of file
584 if (n == 1) {
585 strcat(str,"00000"); No newline at end of file
585 strcat(str,"00000");
586 index = index + 5; No newline at end of file
586 index = index + 5;
587 }else if(n == 2){ No newline at end of file
587 }else if(n == 2){
588 strcat(str,"0000"); No newline at end of file
588 strcat(str,"0000");
589 index = index + 4; No newline at end of file
589 index = index + 4;
590 }else if(n == 3){ No newline at end of file
590 }else if(n == 3){
591 strcat(str,"000"); No newline at end of file
591 strcat(str,"000");
592 index = index + 3; No newline at end of file
592 index = index + 3;
593 }else if(n == 4){ No newline at end of file
593 }else if(n == 4){
594 strcat(str,"00"); No newline at end of file
594 strcat(str,"00");
595 index = index + 2; No newline at end of file
595 index = index + 2;
596 }else if(n == 5){ No newline at end of file
596 }else if(n == 5){
597 strcat(str,"0"); No newline at end of file
597 strcat(str,"0");
598 index = index + 1; No newline at end of file
598 index = index + 1;
599 } No newline at end of file
599 }
600 //Now reverse the numbers in the string. No newline at end of file
600 //Now reverse the numbers in the string.
601 int position; No newline at end of file
601 int position;
602 for( position = 0; position <= (index-1)/2; ++position ) No newline at end of file
602 for( position = 0; position <= (index-1)/2; ++position )
603 { No newline at end of file
603 {
604 char tmp = str[position]; No newline at end of file
604 char tmp = str[position];
605 str[position] = str[(index-1)-position]; No newline at end of file
605 str[position] = str[(index-1)-position];
606 str[(index-1)-position] = tmp; No newline at end of file
606 str[(index-1)-position] = tmp;
607 } No newline at end of file
607 }
608 } No newline at end of file
608 }
609 No newline at end of file
609
610 No newline at end of file
610
611 //***************************************************************** No newline at end of file
611 //*****************************************************************
612 //ABS_monitoreo es la funci�n principal del proyecto ABS_Monitoreo. No newline at end of file
612 //ABS_monitoreo es la funci�n principal del proyecto ABS_Monitoreo.
613 //Esta funci�n es la que se debe agregar en otros c�digos. No newline at end of file
613 //Esta funci�n es la que se debe agregar en otros c�digos.
614 //***************************************************************** No newline at end of file
614 //*****************************************************************
615 int ABS_monitoreo(int sel_atenuador, int sel_calibracion, float umbral, int pulsewidth){ No newline at end of file
615 int ABS_monitoreo(int sel_atenuador, int sel_calibracion, float umbral, int pulsewidth){
616 No newline at end of file
616
617 //local variables No newline at end of file
617 //local variables
618 AT91S_PIO *pioc; No newline at end of file
618 AT91S_PIO *pioc;
619 pioc = pio_map(PIOC_BASE); No newline at end of file
619 pioc = pio_map(PIOC_BASE);
620 unsigned int mask_sel_canal =PC4; //Aqu� se indican los pines que se desean usar como salidas. Las constantes PCx est�n defiidas en el header at91gpio.h No newline at end of file
620 unsigned int mask_sel_canal =PC4; //Aqu� se indican los pines que se desean usar como salidas. Las constantes PCx est�n defiidas en el header at91gpio.h
621 unsigned int mask_sel_atenuacion =PC5; No newline at end of file
621 unsigned int mask_sel_atenuacion =PC5;
622 unsigned int mask_sel_calibracion =PC6; No newline at end of file
622 unsigned int mask_sel_calibracion =PC6;
623 AT91S_ADC *padc; No newline at end of file
623 AT91S_ADC *padc;
624 AT91S_ADC *padd; No newline at end of file
624 AT91S_ADC *padd;
625 FILE *fp; No newline at end of file
625 FILE *fp;
626 long int results1[NSAMPLES], results2[NSAMPLES], results3[NSAMPLES], results4[NSAMPLES]; No newline at end of file
626 long int results1[NSAMPLES], results2[NSAMPLES], results3[NSAMPLES], results4[NSAMPLES];
627 unsigned int i=0; No newline at end of file
627 unsigned int i=0;
628 char fname[FNAMELEN]; No newline at end of file
628 char fname[FNAMELEN];
629 int j=0; No newline at end of file
629 int j=0;
630 time_t now; No newline at end of file
630 time_t now;
631 FILE *archivo; No newline at end of file
631 FILE *archivo;
632 float phase1; No newline at end of file
632 float phase1;
633 float phase2; No newline at end of file
633 float phase2;
634 //system("./map_clock"); No newline at end of file
634 //system("./map_clock");
635 No newline at end of file
635
636 if (configCLK() == 1) No newline at end of file
636 if (configCLK() == 1)
637 printf("clock ADC enable.\n"); No newline at end of file
637 printf("clock ADC enable.\n");
638 No newline at end of file
638
639 No newline at end of file
639
640 //configurar tres pines como salida usando als m�scaras mask_sel_canal, mask_sel_atenuacion y mask_sel_calibracion. En este caso corresponden a los pines pc4, pc5 y pc6. No newline at end of file
640 //configurar tres pines como salida usando als m�scaras mask_sel_canal, mask_sel_atenuacion y mask_sel_calibracion. En este caso corresponden a los pines pc4, pc5 y pc6.
641 pio_enable(pioc, mask_sel_canal); No newline at end of file
641 pio_enable(pioc, mask_sel_canal);
642 pio_enable(pioc, mask_sel_atenuacion); No newline at end of file
642 pio_enable(pioc, mask_sel_atenuacion);
643 pio_enable(pioc, mask_sel_calibracion); No newline at end of file
643 pio_enable(pioc, mask_sel_calibracion);
644 pio_output_enable(pioc, mask_sel_canal); //configurar pc4 como salida No newline at end of file
644 pio_output_enable(pioc, mask_sel_canal); //configurar pc4 como salida
645 pio_output_enable(pioc, mask_sel_atenuacion); //configurar pc5 como salida No newline at end of file
645 pio_output_enable(pioc, mask_sel_atenuacion); //configurar pc5 como salida
646 pio_output_enable(pioc, mask_sel_calibracion); //configurar pc6 como salida No newline at end of file
646 pio_output_enable(pioc, mask_sel_calibracion); //configurar pc6 como salida
647 No newline at end of file
647
648 No newline at end of file
648
649 //Se modifican las salidas correspondientes a la selecci�n del atenuador y calibraci�n, de acuerdo a los par�metros ingresados en la funci�n ABS_monitoreo. No newline at end of file
649 //Se modifican las salidas correspondientes a la selecci�n del atenuador y calibraci�n, de acuerdo a los par�metros ingresados en la funci�n ABS_monitoreo.
650 if ( sel_atenuador == 1) No newline at end of file
650 pio_out(pioc, mask_sel_atenuacion, sel_atenuador,1); No newline at end of file
651 pio_out(pioc, mask_sel_atenuacion, sel_atenuador,1);
652 else
No newline at end of file
653 pio_out(pioc, mask_sel_atenuacion, sel_atenuador,0);
No newline at end of file
654 if ( sel_calibracion == 1) No newline at end of file
651 pio_out(pioc, mask_sel_calibracion, sel_calibracion,1); No newline at end of file
655 pio_out(pioc, mask_sel_calibracion, sel_calibracion,1);
656 else
No newline at end of file
657 pio_out(pioc, mask_sel_calibracion, sel_calibracion,0); No newline at end of file
652 No newline at end of file
658
653 No newline at end of file
659
654 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt"); //Direcci�n y nombre del archivo donde se desea guardar los datos. No newline at end of file
660 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt"); //Direcci�n y nombre del archivo donde se desea guardar los datos.
655 No newline at end of file
661
656 if (fExists(fname)==0){ //si el archivo no existe, crea uno y le asigna el titulo No newline at end of file
662 if (fExists(fname)==0){ //si el archivo no existe, crea uno y le asigna el titulo
657 archivo = fopen(fname,"a+"); No newline at end of file
663 archivo = fopen(fname,"a+");
658 fprintf(archivo,"%s"," Registro de datos del ABS Control \n"); No newline at end of file
664 fprintf(archivo,"%s"," Registro de datos del ABS Control \n");
659 fprintf(archivo,"%s"," Fecha y hora Fase UP Fase DOWN\n"); No newline at end of file
665 fprintf(archivo,"%s"," Fecha y hora Fase UP Fase DOWN\n");
660 fclose(archivo); No newline at end of file
666 fclose(archivo);
661 } No newline at end of file
667 }
662 No newline at end of file
668
663 No newline at end of file
669
664 //configure ADC Settings No newline at end of file
670 //configure ADC Settings
665 padc=configADC1(); No newline at end of file
671 padc=configADC1();
666 padd=configADC2(); No newline at end of file
672 padd=configADC2();
667 No newline at end of file
673
668 while (1){ No newline at end of file
674 while (1){
669 No newline at end of file
675
670 ENABLE_CHANNEL(padc, ADC_CH0+ADC_CH1); No newline at end of file
676 ENABLE_CHANNEL(padc, ADC_CH0+ADC_CH1);
671 printf("\nAdquiriendo datos...\n"); //Indica en el terminal que se est�n adquiriendo datos (muestreando la se�al). No newline at end of file
677 printf("\nAdquiriendo datos...\n"); //Indica en el terminal que se est�n adquiriendo datos (muestreando la se�al).
672 No newline at end of file
678
673 No newline at end of file
679
674 now = time(0); //Get current Time for File Name No newline at end of file
680 now = time(0); //Get current Time for File Name
675 No newline at end of file
681
676 No newline at end of file
682
677 //Se pone la salida de selecci�n de canal para seleccionar el canal 1 del detector de fase No newline at end of file
683 //Se pone la salida de selecci�n de canal para seleccionar el canal 1 del detector de fase
684 // pio_out(pioc, mask_sel_canal, 0,1); No newline at end of file
678 pio_out(pioc, mask_sel_canal, 0,1); No newline at end of file
685 pio_out(pioc, mask_sel_canal, 0,1);
679 No newline at end of file
686
680 No newline at end of file
687
681 //Se toman muestras para el canal 1 del detector de fase No newline at end of file
688 //Se toman muestras para el canal 1 del detector de fase
682 while(1){ No newline at end of file
689 while(1){
683 for(i=0; i < NSAMPLES; i++){ No newline at end of file
690 for(i=0; i < NSAMPLES; i++){
684 No newline at end of file
691
685 ADC_INIT(padc); No newline at end of file
692 ADC_INIT(padc);
686 results1[i] = GET_ADC0(padc); No newline at end of file
693 results1[i] = GET_ADC0(padc);
687 results2[i] = GET_ADC1(padd); No newline at end of file
694 results2[i] = GET_ADC1(padd);
688 } No newline at end of file
695 }
689 No newline at end of file
696
690 No newline at end of file
697
691 if (checkTx(results1, results2, umbral, pulsewidth)==1){ //Se verifica que las muestras tomadas del canal 1 del datector de fase //correspondan a un pulso. No newline at end of file
698 if (checkTx(results1, results2, umbral, pulsewidth)==1){ //Se verifica que las muestras tomadas del canal 1 del datector de fase //correspondan a un pulso.
692 break; No newline at end of file
699 break;
693 } No newline at end of file
700 }
694 } No newline at end of file
701 }
695 No newline at end of file
702
696 No newline at end of file
703
697 //Se pone la salida de selecci�n de canal para seleccionar el canal 2 del detector de fase No newline at end of file
704 //Se pone la salida de selecci�n de canal para seleccionar el canal 2 del detector de fase
698 pio_out(pioc, mask_sel_canal, 1,1); No newline at end of file
705 pio_out(pioc, mask_sel_canal, 1,1);
699 No newline at end of file
706
700 No newline at end of file
707
701 No newline at end of file
708
702 //Setoman muestras para el canal 2 del detector de fase No newline at end of file
709 //Setoman muestras para el canal 2 del detector de fase
703 while(1){ No newline at end of file
710 while(1){
704 for(i=0; i < NSAMPLES; i++){ No newline at end of file
711 for(i=0; i < NSAMPLES; i++){
705 No newline at end of file
712
706 ADC_INIT(padc); No newline at end of file
713 ADC_INIT(padc);
707 results3[i] = GET_ADC0(padc); No newline at end of file
714 results3[i] = GET_ADC0(padc);
708 results4[i] = GET_ADC1(padd); No newline at end of file
715 results4[i] = GET_ADC1(padd);
709 } No newline at end of file
716 }
710 No newline at end of file
717
711 if (checkTx(results3, results4, umbral, pulsewidth)==1){ //Se verifica que las muestras tomadas del canal 2 del detector de fase //correspondan a un pulso. No newline at end of file
718 if (checkTx(results3, results4, umbral, pulsewidth)==1){ //Se verifica que las muestras tomadas del canal 2 del detector de fase //correspondan a un pulso.
712 break; No newline at end of file
719 break;
713 } No newline at end of file
720 }
714 } No newline at end of file
721 }
715 No newline at end of file
722
716 No newline at end of file
723
717 //Una vez que se ha encontrado un pulso en cada canal, se calcula la fase de ambos. No newline at end of file
724 //Una vez que se ha encontrado un pulso en cada canal, se calcula la fase de ambos.
718 No newline at end of file
725
719 phase1 = getPhase(results1, results2); //Calcular la fase del canal 1 del detector de fase. No newline at end of file
726 phase1 = getPhase(results1, results2); //Calcular la fase del canal 1 del detector de fase.
720 phase2 = getPhase(results3, results4); //Calcular la fase del canal 2 del detector de fase. No newline at end of file
727 phase2 = getPhase(results3, results4); //Calcular la fase del canal 2 del detector de fase.
721 //create Output File No newline at end of file
728 //create Output File
722 No newline at end of file
729
723 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt"); No newline at end of file
730 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt");
724 printf("\nTerminada la prueba # %d \n", j++); No newline at end of file
731 printf("\nTerminada la prueba # %d \n", j++);
725 fp=create_Output(fname, now); //Coloca la fecha y la hora en el archivo de texto No newline at end of file
732 fp=create_Output(fname, now); //Coloca la fecha y la hora en el archivo de texto
726 printf("mediana ch1 = %1.2f\n", phase1); //muestra resultado en terminal No newline at end of file
733 printf("mediana ch1 = %1.2f\n", phase1); //muestra resultado en terminal
727 printf("mediana ch2 = %1.2f\n", phase2); //muestra resultado en terminal No newline at end of file
734 printf("mediana ch2 = %1.2f\n", phase2); //muestra resultado en terminal
728 writeOutput(phase1, fp); //graba el resultado en el archivo de texto No newline at end of file
735 writeOutput(phase1, fp); //graba el resultado en el archivo de texto
729 writeOutput(phase2, fp); //graba el resultado en el archivo de texto No newline at end of file
736 writeOutput(phase2, fp); //graba el resultado en el archivo de texto
730 fprintf(fp, "\n"); //Pasa a la siguiente l�nea del archivo de texto No newline at end of file
737 fprintf(fp, "\n"); //Pasa a la siguiente l�nea del archivo de texto
731 fclose(fp); No newline at end of file
738 fclose(fp);
732 printf("Resultado guardado en %s \n", fname); No newline at end of file
739 printf("Resultado guardado en %s \n", fname);
733 No newline at end of file
740
734 sleep(1); No newline at end of file
741 sleep(1);
735 No newline at end of file
742
736 } No newline at end of file
743 }
737 return 0; No newline at end of file
744 return 0;
738 } No newline at end of file
745 }
739 /*============================================================================= No newline at end of file
746 /*=============================================================================
740 Function definitions No newline at end of file
747 Function definitions
741 =============================================================================*/ No newline at end of file
748 =============================================================================*/
742 No newline at end of file
749
743 // Configures ADC registers in order to get a sample every 10us No newline at end of file
750 // Configures ADC registers in order to get a sample every 10us
744 AT91S_ADC * configADC1(void){ No newline at end of file
751 AT91S_ADC * configADC1(void){
745 //Variables a usar: No newline at end of file
752 //Variables a usar:
746 unsigned int maskc_adc =PC0; //Usamos ADC0 y ADC1 No newline at end of file
753 unsigned int maskc_adc =PC0; //Usamos ADC0 y ADC1
747 No newline at end of file
754
748 //configuro pin: No newline at end of file
755 //configuro pin:
749 AT91S_PIO *pioc; No newline at end of file
756 AT91S_PIO *pioc;
750 pioc = pio_map(PIOC_BASE); No newline at end of file
757 pioc = pio_map(PIOC_BASE);
751 pin_adc_enable(pioc,maskc_adc); //Habilitamos PC0 para usar con ADC0 y 1 No newline at end of file
758 pin_adc_enable(pioc,maskc_adc); //Habilitamos PC0 para usar con ADC0 y 1
752 pio_disable_irq(pioc, maskc_adc); No newline at end of file
759 pio_disable_irq(pioc, maskc_adc);
753 pio_disable_multiple_driver(pioc, maskc_adc); No newline at end of file
760 pio_disable_multiple_driver(pioc, maskc_adc);
754 pio_disable_pull_ups(pioc, maskc_adc); No newline at end of file
761 pio_disable_pull_ups(pioc, maskc_adc);
755 pio_input_enable(pioc, maskc_adc); No newline at end of file
762 pio_input_enable(pioc, maskc_adc);
756 No newline at end of file
763
757 No newline at end of file
764
758 //Configuro el ADC: No newline at end of file
765 //Configuro el ADC:
759 AT91S_ADC *padc; No newline at end of file
766 AT91S_ADC *padc;
760 No newline at end of file
767
761 padc = adc_map1(ADC_BASE); No newline at end of file
768 padc = adc_map1(ADC_BASE);
762 No newline at end of file
769
763 //clock ADC = 1MHz No newline at end of file
770 //clock ADC = 1MHz
764 //time startup = 8us No newline at end of file
771 //time startup = 8us
765 //time sample and hold = 2us No newline at end of file
772 //time sample and hold = 2us
766 // hold No newline at end of file
773 // hold
767 // ___________ No newline at end of file
774 // ___________
768 // start ___________| |___________ No newline at end of file
775 // start ___________| |___________
769 // No newline at end of file
776 //
770 // | --1.2us-- | --0.15us-- | No newline at end of file
777 // | --1.2us-- | --0.15us-- |
771 //ADC_RESET(padc); No newline at end of file
778 //ADC_RESET(padc);
772 CONFIG_ADC(padc,ADC_TRGEN_DIS | ADC_RES_10BIT | ADC_SLEEP_NORMAL_MODE | ADC_PRESCAL | ADC_STARTUP | ADC_SHTIM); No newline at end of file
779 CONFIG_ADC(padc,ADC_TRGEN_DIS | ADC_RES_10BIT | ADC_SLEEP_NORMAL_MODE | ADC_PRESCAL | ADC_STARTUP | ADC_SHTIM);
773 ENABLE_CHANNEL(padc,ADC_CH0); //habilito canal 0 No newline at end of file
780 ENABLE_CHANNEL(padc,ADC_CH0); //habilito canal 0
774 No newline at end of file
781
775 No newline at end of file
782
776 return padc; No newline at end of file
783 return padc;
777 } No newline at end of file
784 }
778 No newline at end of file
785
779 AT91S_ADC * configADC2(void){ No newline at end of file
786 AT91S_ADC * configADC2(void){
780 //Variables a usar: No newline at end of file
787 //Variables a usar:
781 unsigned int maskc_adc =PC1; //Usamos ADC0 y ADC1 No newline at end of file
788 unsigned int maskc_adc =PC1; //Usamos ADC0 y ADC1
782 No newline at end of file
789
783 //configuro pin: No newline at end of file
790 //configuro pin:
784 AT91S_PIO *piod; No newline at end of file
791 AT91S_PIO *piod;
785 piod = pio_map(PIOC_BASE); No newline at end of file
792 piod = pio_map(PIOC_BASE);
786 pin_adc_enable(piod,maskc_adc); //Habilitamos PC0 para usar con ADC0 y 1 No newline at end of file
793 pin_adc_enable(piod,maskc_adc); //Habilitamos PC0 para usar con ADC0 y 1
787 pio_disable_irq(piod, maskc_adc); No newline at end of file
794 pio_disable_irq(piod, maskc_adc);
788 pio_disable_multiple_driver(piod, maskc_adc); No newline at end of file
795 pio_disable_multiple_driver(piod, maskc_adc);
789 pio_disable_pull_ups(piod, maskc_adc); No newline at end of file
796 pio_disable_pull_ups(piod, maskc_adc);
790 pio_input_enable(piod, maskc_adc); No newline at end of file
797 pio_input_enable(piod, maskc_adc);
791 No newline at end of file
798
792 //Configuro el ADC: No newline at end of file
799 //Configuro el ADC:
793 AT91S_ADC *padd; No newline at end of file
800 AT91S_ADC *padd;
794 No newline at end of file
801
795 padd = adc_map1(ADC_BASE); No newline at end of file
802 padd = adc_map1(ADC_BASE);
796 No newline at end of file
803
797 //clock ADC = 1MHz No newline at end of file
804 //clock ADC = 1MHz
798 //time startup = 8us No newline at end of file
805 //time startup = 8us
799 //time sample and hold = 2us No newline at end of file
806 //time sample and hold = 2us
800 // hold No newline at end of file
807 // hold
801 // ___________ No newline at end of file
808 // ___________
802 // start ___________| |___________ No newline at end of file
809 // start ___________| |___________
803 // No newline at end of file
810 //
804 // | --1.2us-- | --0.15us-- | No newline at end of file
811 // | --1.2us-- | --0.15us-- |
805 //ADC_RESET(padc); No newline at end of file
812 //ADC_RESET(padc);
806 CONFIG_ADC(padd,ADC_TRGEN_DIS | ADC_RES_10BIT | ADC_SLEEP_NORMAL_MODE | ADC_PRESCAL | ADC_STARTUP | ADC_SHTIM); No newline at end of file
813 CONFIG_ADC(padd,ADC_TRGEN_DIS | ADC_RES_10BIT | ADC_SLEEP_NORMAL_MODE | ADC_PRESCAL | ADC_STARTUP | ADC_SHTIM);
807 ENABLE_CHANNEL(padd,ADC_CH1); //habilito canal 1 No newline at end of file
814 ENABLE_CHANNEL(padd,ADC_CH1); //habilito canal 1
808 return padd; No newline at end of file
815 return padd;
809 } No newline at end of file
816 }
810 No newline at end of file
817
811 No newline at end of file
818
812 //++++++++++++++++++++ No newline at end of file
819 //++++++++++++++++++++
813 No newline at end of file
820
814 //creats the output file with a timestamp in the name No newline at end of file
821 //creats the output file with a timestamp in the name
815 FILE * create_Output(char *fname, time_t rawtime){ No newline at end of file
822 FILE * create_Output(char *fname, time_t rawtime){
816 FILE *file; No newline at end of file
823 FILE *file;
817 char timestamp[80];//, counter[5]="dcv"; No newline at end of file
824 char timestamp[80];//, counter[5]="dcv";
818 //char str[4]; No newline at end of file
825 //char str[4];
819 struct tm * timeinfo; No newline at end of file
826 struct tm * timeinfo;
820 No newline at end of file
827
821 //format time No newline at end of file
828 //format time
822 timeinfo = localtime ( &rawtime ); No newline at end of file
829 timeinfo = localtime ( &rawtime );
823 strftime (timestamp,sizeof(timestamp),"%a %y-%m-%d %H:%M:%S %Z",timeinfo); No newline at end of file
830 strftime (timestamp,sizeof(timestamp),"%a %y-%m-%d %H:%M:%S %Z",timeinfo);
824 No newline at end of file
831
825 No newline at end of file
832
826 //Creates the file name out of the #define parameters No newline at end of file
833 //Creates the file name out of the #define parameters
827 No newline at end of file
834
828 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt"); No newline at end of file
835 strcpy (fname, "/mnt/sd/archivos/absmonitoreo.txt");
829 file = fopen(fname,"a+"); No newline at end of file
836 file = fopen(fname,"a+");
830 fprintf(file,"%s", timestamp); No newline at end of file
837 fprintf(file,"%s", timestamp);
831 //printf("\nTerminada la prueba # %d. Guardando resultado en %s\n",r, fname); No newline at end of file
838 //printf("\nTerminada la prueba # %d. Guardando resultado en %s\n",r, fname);
832 //printf("\nTerminada la prueba # %d/%d. Writing data to the file %s\n",r+1 , REP, fname); No newline at end of file
839 //printf("\nTerminada la prueba # %d/%d. Writing data to the file %s\n",r+1 , REP, fname);
833 //printf("\nAAAAAAAAAA %d...%s\n", counter[1], fname); No newline at end of file
840 //printf("\nAAAAAAAAAA %d...%s\n", counter[1], fname);
834 // return file pointer No newline at end of file
841 // return file pointer
835 return file; No newline at end of file
842 return file;
836 } No newline at end of file
843 }
837 No newline at end of file
844
838 //++++++++++++++++++++ No newline at end of file
845 //++++++++++++++++++++
839 No newline at end of file
846
840 //tests if a file already exists. returns 1 if it exists and 0 if it doesn't No newline at end of file
847 //tests if a file already exists. returns 1 if it exists and 0 if it doesn't
841 No newline at end of file
848
842 No newline at end of file
849
843 No newline at end of file
850
844 //Funci�n checkTx verifica que la se�al muestreada corresponda a un pulso. No newline at end of file
851 //Funci�n checkTx verifica que la se�al muestreada corresponda a un pulso.
845 //results1 y results2 son los arreglos que contienen los datos muestreados por ambos canales del ADC del embebido. No newline at end of file
852 //results1 y results2 son los arreglos que contienen los datos muestreados por ambos canales del ADC del embebido.
846 //umbral indica qu� valor debe superar una muestra para considerarla un posible pulso o pico. No newline at end of file
853 //umbral indica qu� valor debe superar una muestra para considerarla un posible pulso o pico.
847 //pulsewidth indica cu�ntas muestras consecutivas deben superar el umbral para que se considere que se ha detectado un pulso. No newline at end of file
854 //pulsewidth indica cu�ntas muestras consecutivas deben superar el umbral para que se considere que se ha detectado un pulso.
848 int checkTx(long int results1[],long int results2[], float umbral, int pulsewidth){ No newline at end of file
855 int checkTx(long int results1[],long int results2[], float umbral, int pulsewidth){
849 No newline at end of file
856
850 int i, cont; No newline at end of file
857 int i, cont;
851 float z[NSAMPLES], sum, avg; No newline at end of file
858 float z[NSAMPLES], sum, avg;
852 int isSignal, pulse; No newline at end of file
859 int isSignal, pulse;
853 No newline at end of file
860
854 for(i=0;i<NSAMPLES;i++){ No newline at end of file
861 for(i=0;i<NSAMPLES;i++){
855 No newline at end of file
862
856 z[i] =sqrt(1.0*results1[i]*results1[i]+1.0*results2[i]*results2[i]); No newline at end of file
863 z[i] =sqrt(1.0*results1[i]*results1[i]+1.0*results2[i]*results2[i]);
857 } No newline at end of file
864 }
858 No newline at end of file
865
859 pulse = 0; No newline at end of file
866 pulse = 0;
860 isSignal = 0; No newline at end of file
867 isSignal = 0;
861 cont =0; No newline at end of file
868 cont =0;
862 No newline at end of file
869
863 sum = 0; No newline at end of file
870 sum = 0;
864 for(i=0;i<NSAMPLES;i++){ No newline at end of file
871 for(i=0;i<NSAMPLES;i++){
865 No newline at end of file
872
866 sum += z[i]; No newline at end of file
873 sum += z[i];
867 avg = sum/(i+1); No newline at end of file
874 avg = sum/(i+1);
868 if ((z[i] - avg) > umbral){ No newline at end of file
875 if ((z[i] - avg) > umbral){
869 if (isSignal == 1){ No newline at end of file
876 if (isSignal == 1){
870 cont += 1; No newline at end of file
877 cont += 1;
871 } No newline at end of file
878 }
872 if (cont == pulsewidth){ No newline at end of file
879 if (cont == pulsewidth){
873 pulse = 1; No newline at end of file
880 pulse = 1;
874 break; No newline at end of file
881 break;
875 } No newline at end of file
882 }
876 isSignal = 1; No newline at end of file
883 isSignal = 1;
877 continue; No newline at end of file
884 continue;
878 isSignal = 0; No newline at end of file
885 isSignal = 0;
879 cont = 0; No newline at end of file
886 cont = 0;
880 } No newline at end of file
887 }
881 } No newline at end of file
888 }
882 No newline at end of file
889
883 return pulse; //devuelve un entero: 1 si se ha detectado pulso, de lo contrario, 0. No newline at end of file
890 return pulse; //devuelve un entero: 1 si se ha detectado pulso, de lo contrario, 0.
884 } No newline at end of file
891 }
885 No newline at end of file
892
886 No newline at end of file
893
887 int fExists(char * fname){ No newline at end of file
894 int fExists(char * fname){
888 FILE * file; No newline at end of file
895 FILE * file;
889 No newline at end of file
896
890 file = fopen (fname, "r"); No newline at end of file
897 file = fopen (fname, "r");
891 if (file == NULL) No newline at end of file
898 if (file == NULL)
892 { No newline at end of file
899 {
893 return 0; No newline at end of file
900 return 0;
894 } No newline at end of file
901 }
895 fclose(file); No newline at end of file
902 fclose(file);
896 return 1; No newline at end of file
903 return 1;
897 } No newline at end of file
904 }
898 No newline at end of file
905
899 No newline at end of file
906
900 //Funci�n que calcula la mediana de un conjunto de muestras No newline at end of file
907 //Funci�n que calcula la mediana de un conjunto de muestras
901 double mediana(long int *results,unsigned int cuenta){ No newline at end of file
908 double mediana(long int *results,unsigned int cuenta){
902 unsigned int i=0,j=0,aux=0; No newline at end of file
909 unsigned int i=0,j=0,aux=0;
903 No newline at end of file
910
904 double median=0; No newline at end of file
911 double median=0;
905 /*Calculo mediana */ No newline at end of file
912 /*Calculo mediana */
906 No newline at end of file
913
907 for(i=0;i<cuenta-1;i++){ No newline at end of file
914 for(i=0;i<cuenta-1;i++){
908 for (j=i+1;j<cuenta;j++){ No newline at end of file
915 for (j=i+1;j<cuenta;j++){
909 if(results[i]>results[j] ){ No newline at end of file
916 if(results[i]>results[j] ){
910 No newline at end of file
917
911 aux=results[i]; No newline at end of file
918 aux=results[i];
912 results[i]=results[j]; No newline at end of file
919 results[i]=results[j];
913 results[j]=aux; No newline at end of file
920 results[j]=aux;
914 No newline at end of file
921
915 } No newline at end of file
922 }
916 } No newline at end of file
923 }
917 No newline at end of file
924
918 } No newline at end of file
925 }
919 median=results[cuenta/2]; No newline at end of file
926 median=results[cuenta/2];
920 return median; No newline at end of file
927 return median;
921 } No newline at end of file
928 }
922 No newline at end of file
929
923 No newline at end of file
930
924 No newline at end of file
931
925 //Funci�n que halla la fase de la se�al. No newline at end of file
932 //Funci�n que halla la fase de la se�al.
926 //Tiene como entradas las muestras correspondientes a la parte real e imaginaria de la se�al. No newline at end of file
933 //Tiene como entradas las muestras correspondientes a la parte real e imaginaria de la se�al.
927 float getPhase(long int results1[],long int results2[]){ No newline at end of file
934 float getPhase(long int results1[],long int results2[]){
928 No newline at end of file
935
929 unsigned int count=0, i=0,umbral=1000; No newline at end of file
936 unsigned int count=0, i=0,umbral=1000;
930 //long int results1[]; No newline at end of file
937 //long int results1[];
931 //long int results2[]; No newline at end of file
938 //long int results2[];
932 long int power[NSAMPLES]; No newline at end of file
939 long int power[NSAMPLES];
933 long int sumI=0,sumQ=0,I[NSAMPLES], Q[NSAMPLES],II[NSAMPLES], QQ[NSAMPLES]; No newline at end of file
940 long int sumI=0,sumQ=0,I[NSAMPLES], Q[NSAMPLES],II[NSAMPLES], QQ[NSAMPLES];
934 double median1=0,median2=0; No newline at end of file
941 double median1=0,median2=0;
935 long int promedioI=0,promedioQ=0;/*Calculo mediana 1*/ No newline at end of file
942 long int promedioI=0,promedioQ=0;/*Calculo mediana 1*/
936 float resultado=0; No newline at end of file
943 float resultado=0;
937 No newline at end of file
944
938 for(i=0;i<NSAMPLES;i++){ No newline at end of file
945 for(i=0;i<NSAMPLES;i++){
939 No newline at end of file
946
940 I[i] =results1[i]; No newline at end of file
947 I[i] =results1[i];
941 Q[i] =results2[i]; No newline at end of file
948 Q[i] =results2[i];
942 } No newline at end of file
949 }
943 No newline at end of file
950
944 /*Calculo mediana 1*/ No newline at end of file
951 /*Calculo mediana 1*/
945 median1=mediana(I,NSAMPLES); No newline at end of file
952 median1=mediana(I,NSAMPLES);
946 No newline at end of file
953
947 /*Calculo mediana 2*/ No newline at end of file
954 /*Calculo mediana 2*/
948 median2=mediana(Q,NSAMPLES); No newline at end of file
955 median2=mediana(Q,NSAMPLES);
949 No newline at end of file
956
950 No newline at end of file
957
951 No newline at end of file
958
952 No newline at end of file
959
953 No newline at end of file
960
954 No newline at end of file
961
955 for(i=0;i<NSAMPLES;i++){ No newline at end of file
962 for(i=0;i<NSAMPLES;i++){
956 No newline at end of file
963
957 I[i] =results1[i]; No newline at end of file
964 I[i] =results1[i];
958 Q[i] =results2[i]; No newline at end of file
965 Q[i] =results2[i];
959 No newline at end of file
966
960 } No newline at end of file
967 }
961 No newline at end of file
968
962 No newline at end of file
969
963 No newline at end of file
970
964 for(i = 0; i < NSAMPLES ; i++){ No newline at end of file
971 for(i = 0; i < NSAMPLES ; i++){
965 No newline at end of file
972
966 I[i]=(I[i]-median1); No newline at end of file
973 I[i]=(I[i]-median1);
967 Q[i]=(Q[i]-median2); No newline at end of file
974 Q[i]=(Q[i]-median2);
968 No newline at end of file
975
969 } No newline at end of file
976 }
970 No newline at end of file
977
971 for(i = 0; i < NSAMPLES ; i++){ No newline at end of file
978 for(i = 0; i < NSAMPLES ; i++){
972 No newline at end of file
979
973 power[i]=I[i]*I[i]+Q[i]*Q[i]; No newline at end of file
980 power[i]=I[i]*I[i]+Q[i]*Q[i];
974 No newline at end of file
981
975 if(power[i] > umbral) No newline at end of file
982 if(power[i] > umbral)
976 { No newline at end of file
983 {
977 No newline at end of file
984
978 II[count]=I[i]; No newline at end of file
985 II[count]=I[i];
979 QQ[count]=Q[i]; No newline at end of file
986 QQ[count]=Q[i];
980 count=count+1; No newline at end of file
987 count=count+1;
981 No newline at end of file
988
982 } No newline at end of file
989 }
983 No newline at end of file
990
984 } No newline at end of file
991 }
985 No newline at end of file
992
986 for(i = 0; i < count ; i++){ No newline at end of file
993 for(i = 0; i < count ; i++){
987 No newline at end of file
994
988 sumI=sumI+II[i]; No newline at end of file
995 sumI=sumI+II[i];
989 sumQ=sumQ+QQ[i]; No newline at end of file
996 sumQ=sumQ+QQ[i];
990 No newline at end of file
997
991 } No newline at end of file
998 }
992 No newline at end of file
999
993 promedioI=sumI; No newline at end of file
1000 promedioI=sumI;
994 promedioQ=sumQ; No newline at end of file
1001 promedioQ=sumQ;
995 No newline at end of file
1002
996 resultado = atan2(1.0*promedioI,1.0*promedioQ)*180/3.1416+62-44; No newline at end of file
1003 resultado = atan2(1.0*promedioI,1.0*promedioQ)*180/3.1416+62-44;
997 No newline at end of file
1004
998 No newline at end of file
1005
999 return resultado; No newline at end of file
1006 return resultado;
1000 No newline at end of file
1007
1001 } No newline at end of file
1008 }
1002 No newline at end of file
1009
1003 No newline at end of file
1010
1004 No newline at end of file
1011
1005 //Funci�n que muestra la fase detectada en el terminal y tambi�n la graba en el archivo de texto. No newline at end of file
1012 //Funci�n que muestra la fase detectada en el terminal y tambi�n la graba en el archivo de texto.
1006 void writeOutput(float resultado, FILE * output){ No newline at end of file
1013 void writeOutput(float resultado, FILE * output){
1007 No newline at end of file
1014
1008 No newline at end of file
1015
1009 // No newline at end of file
1016 //
1010 No newline at end of file
1017
1011 fprintf(output," %1.2f ",resultado); //graba resultado en archivo .txt No newline at end of file
1018 fprintf(output," %1.2f ",resultado); //graba resultado en archivo .txt
1012 // No newline at end of file
1019 //
1013 No newline at end of file
1020
1014 } No newline at end of file
1021 }
1015 No newline at end of file
1022
1016 int configCLK(){ No newline at end of file
1023 int configCLK(){
1017 //configuro pin: No newline at end of file
1024 //configuro pin:
1018 AT91S_PMC *sys_clock; No newline at end of file
1025 AT91S_PMC *sys_clock;
1019 sys_clock = clock_map(CLOCK_BASE); No newline at end of file
1026 sys_clock = clock_map(CLOCK_BASE);
1020 enable_clock_adc(sys_clock); No newline at end of file
1027 enable_clock_adc(sys_clock);
1021 //printf("clock ADC enable.\n"); No newline at end of file
1028 //printf("clock ADC enable.\n");
1022 return 1; No newline at end of file
1029 return 1;
1023 } No newline at end of file
1030 }
General Comments 0
You need to be logged in to leave comments. Login now