##// END OF EJS Templates
Se probarán los cambios de la aplicación Control_Module: Reporte hacia el Central_Control_Module
imanay -
r29:30
parent child
Show More
@@ -0,0 +1,219
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
No newline at end of file
2 <?fileVersion 4.0.0?>
No newline at end of file
3
No newline at end of file
4 <cproject>
No newline at end of file
5 <storageModule moduleId="org.eclipse.cdt.core.settings">
No newline at end of file
6 <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1568263498">
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">
No newline at end of file
8 <externalSettings/>
No newline at end of file
9 <extensions>
No newline at end of file
10 <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
No newline at end of file
11 <extension id="org.eclipse.cdt.core.MakeErrorParser" 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"/>
No newline at end of file
13 <extension id="org.eclipse.cdt.core.GASErrorParser" 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"/>
No newline at end of file
15 </extensions>
No newline at end of file
16 </storageModule>
No newline at end of file
17 <storageModule moduleId="cdtBuildSystem" version="4.0.0">
No newline at end of file
18 <configuration artifactName="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
19 <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1568263498." name="/" resourcePath="">
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">
No newline at end of file
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/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
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
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
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
27 </tool>
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">
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"/>
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"/>
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"/>
No newline at end of file
32 </tool>
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">
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
35 <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
No newline at end of file
36 <additionalInput kind="additionalinput" paths="$(LIBS)"/>
No newline at end of file
37 </inputType>
No newline at end of file
38 </tool>
No newline at end of file
39 <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
40 <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
41 <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
No newline at end of file
42 </tool>
No newline at end of file
43 </toolChain>
No newline at end of file
44 </folderInfo>
No newline at end of file
45 </configuration>
No newline at end of file
46 </storageModule>
No newline at end of file
47 <storageModule moduleId="scannerConfiguration">
No newline at end of file
48 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
No newline at end of file
49 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
No newline at end of file
50 <buildOutputProvider>
No newline at end of file
51 <openAction enabled="true" filePath=""/>
No newline at end of file
52 <parser enabled="true"/>
No newline at end of file
53 </buildOutputProvider>
No newline at end of file
54 <scannerInfoProvider id="specsFile">
No newline at end of file
55 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
56 <parser enabled="true"/>
No newline at end of file
57 </scannerInfoProvider>
No newline at end of file
58 </profile>
No newline at end of file
59 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
No newline at end of file
60 <buildOutputProvider>
No newline at end of file
61 <openAction enabled="true" filePath=""/>
No newline at end of file
62 <parser enabled="true"/>
No newline at end of file
63 </buildOutputProvider>
No newline at end of file
64 <scannerInfoProvider id="makefileGenerator">
No newline at end of file
65 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
No newline at end of file
66 <parser enabled="true"/>
No newline at end of file
67 </scannerInfoProvider>
No newline at end of file
68 </profile>
No newline at end of file
69 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
No newline at end of file
70 <buildOutputProvider>
No newline at end of file
71 <openAction enabled="true" filePath=""/>
No newline at end of file
72 <parser enabled="true"/>
No newline at end of file
73 </buildOutputProvider>
No newline at end of file
74 <scannerInfoProvider id="specsFile">
No newline at end of file
75 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
76 <parser enabled="true"/>
No newline at end of file
77 </scannerInfoProvider>
No newline at end of file
78 </profile>
No newline at end of file
79 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
No newline at end of file
80 <buildOutputProvider>
No newline at end of file
81 <openAction enabled="true" filePath=""/>
No newline at end of file
82 <parser enabled="true"/>
No newline at end of file
83 </buildOutputProvider>
No newline at end of file
84 <scannerInfoProvider id="specsFile">
No newline at end of file
85 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
No newline at end of file
86 <parser enabled="true"/>
No newline at end of file
87 </scannerInfoProvider>
No newline at end of file
88 </profile>
No newline at end of file
89 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
No newline at end of file
90 <buildOutputProvider>
No newline at end of file
91 <openAction enabled="true" filePath=""/>
No newline at end of file
92 <parser enabled="true"/>
No newline at end of file
93 </buildOutputProvider>
No newline at end of file
94 <scannerInfoProvider id="specsFile">
No newline at end of file
95 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
No newline at end of file
96 <parser enabled="true"/>
No newline at end of file
97 </scannerInfoProvider>
No newline at end of file
98 </profile>
No newline at end of file
99 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
No newline at end of file
100 <buildOutputProvider>
No newline at end of file
101 <openAction enabled="true" filePath=""/>
No newline at end of file
102 <parser enabled="true"/>
No newline at end of file
103 </buildOutputProvider>
No newline at end of file
104 <scannerInfoProvider id="specsFile">
No newline at end of file
105 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
106 <parser enabled="true"/>
No newline at end of file
107 </scannerInfoProvider>
No newline at end of file
108 </profile>
No newline at end of file
109 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
No newline at end of file
110 <buildOutputProvider>
No newline at end of file
111 <openAction enabled="true" filePath=""/>
No newline at end of file
112 <parser enabled="true"/>
No newline at end of file
113 </buildOutputProvider>
No newline at end of file
114 <scannerInfoProvider id="specsFile">
No newline at end of file
115 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
No newline at end of file
116 <parser enabled="true"/>
No newline at end of file
117 </scannerInfoProvider>
No newline at end of file
118 </profile>
No newline at end of file
119 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
No newline at end of file
120 <buildOutputProvider>
No newline at end of file
121 <openAction enabled="true" filePath=""/>
No newline at end of file
122 <parser enabled="true"/>
No newline at end of file
123 </buildOutputProvider>
No newline at end of file
124 <scannerInfoProvider id="specsFile">
No newline at end of file
125 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
No newline at end of file
126 <parser enabled="true"/>
No newline at end of file
127 </scannerInfoProvider>
No newline at end of file
128 </profile>
No newline at end of file
129 <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
130 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
No newline at end of file
131 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
No newline at end of file
132 <buildOutputProvider>
No newline at end of file
133 <openAction enabled="true" filePath=""/>
No newline at end of file
134 <parser enabled="true"/>
No newline at end of file
135 </buildOutputProvider>
No newline at end of file
136 <scannerInfoProvider id="specsFile">
No newline at end of file
137 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
138 <parser enabled="true"/>
No newline at end of file
139 </scannerInfoProvider>
No newline at end of file
140 </profile>
No newline at end of file
141 <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
No newline at end of file
142 <buildOutputProvider>
No newline at end of file
143 <openAction enabled="true" filePath=""/>
No newline at end of file
144 <parser enabled="true"/>
No newline at end of file
145 </buildOutputProvider>
No newline at end of file
146 <scannerInfoProvider id="makefileGenerator">
No newline at end of file
147 <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
No newline at end of file
148 <parser enabled="true"/>
No newline at end of file
149 </scannerInfoProvider>
No newline at end of file
150 </profile>
No newline at end of file
151 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
No newline at end of file
152 <buildOutputProvider>
No newline at end of file
153 <openAction enabled="true" filePath=""/>
No newline at end of file
154 <parser enabled="true"/>
No newline at end of file
155 </buildOutputProvider>
No newline at end of file
156 <scannerInfoProvider id="specsFile">
No newline at end of file
157 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
158 <parser enabled="true"/>
No newline at end of file
159 </scannerInfoProvider>
No newline at end of file
160 </profile>
No newline at end of file
161 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
No newline at end of file
162 <buildOutputProvider>
No newline at end of file
163 <openAction enabled="true" filePath=""/>
No newline at end of file
164 <parser enabled="true"/>
No newline at end of file
165 </buildOutputProvider>
No newline at end of file
166 <scannerInfoProvider id="specsFile">
No newline at end of file
167 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
No newline at end of file
168 <parser enabled="true"/>
No newline at end of file
169 </scannerInfoProvider>
No newline at end of file
170 </profile>
No newline at end of file
171 <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
No newline at end of file
172 <buildOutputProvider>
No newline at end of file
173 <openAction enabled="true" filePath=""/>
No newline at end of file
174 <parser enabled="true"/>
No newline at end of file
175 </buildOutputProvider>
No newline at end of file
176 <scannerInfoProvider id="specsFile">
No newline at end of file
177 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
No newline at end of file
178 <parser enabled="true"/>
No newline at end of file
179 </scannerInfoProvider>
No newline at end of file
180 </profile>
No newline at end of file
181 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
No newline at end of file
182 <buildOutputProvider>
No newline at end of file
183 <openAction enabled="true" filePath=""/>
No newline at end of file
184 <parser enabled="true"/>
No newline at end of file
185 </buildOutputProvider>
No newline at end of file
186 <scannerInfoProvider id="specsFile">
No newline at end of file
187 <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
No newline at end of file
188 <parser enabled="true"/>
No newline at end of file
189 </scannerInfoProvider>
No newline at end of file
190 </profile>
No newline at end of file
191 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
No newline at end of file
192 <buildOutputProvider>
No newline at end of file
193 <openAction enabled="true" filePath=""/>
No newline at end of file
194 <parser enabled="true"/>
No newline at end of file
195 </buildOutputProvider>
No newline at end of file
196 <scannerInfoProvider id="specsFile">
No newline at end of file
197 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
No newline at end of file
198 <parser enabled="true"/>
No newline at end of file
199 </scannerInfoProvider>
No newline at end of file
200 </profile>
No newline at end of file
201 <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
No newline at end of file
202 <buildOutputProvider>
No newline at end of file
203 <openAction enabled="true" filePath=""/>
No newline at end of file
204 <parser enabled="true"/>
No newline at end of file
205 </buildOutputProvider>
No newline at end of file
206 <scannerInfoProvider id="specsFile">
No newline at end of file
207 <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
No newline at end of file
208 <parser enabled="true"/>
No newline at end of file
209 </scannerInfoProvider>
No newline at end of file
210 </profile>
No newline at end of file
211 </scannerConfigBuildInfo>
No newline at end of file
212 </storageModule>
No newline at end of file
213 <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
No newline at end of file
214 </cconfiguration>
No newline at end of file
215 </storageModule>
No newline at end of file
216 <storageModule moduleId="cdtBuildSystem" version="4.0.0">
No newline at end of file
217 <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
No newline at end of file
218 </storageModule>
No newline at end of file
219 </cproject> No newline at end of file
@@ -0,0 +1,81
1 <?xml version="1.0" encoding="UTF-8"?>
No newline at end of file
2 <projectDescription>
No newline at end of file
3 <name>Control_Module</name>
No newline at end of file
4 <comment></comment>
No newline at end of file
5 <projects>
No newline at end of file
6 </projects>
No newline at end of file
7 <buildSpec>
No newline at end of file
8 <buildCommand>
No newline at end of file
9 <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
No newline at end of file
10 <triggers>clean,full,incremental,</triggers>
No newline at end of file
11 <arguments>
No newline at end of file
12 <dictionary>
No newline at end of file
13 <key>?name?</key>
No newline at end of file
14 <value></value>
No newline at end of file
15 </dictionary>
No newline at end of file
16 <dictionary>
No newline at end of file
17 <key>org.eclipse.cdt.make.core.append_environment</key>
No newline at end of file
18 <value>true</value>
No newline at end of file
19 </dictionary>
No newline at end of file
20 <dictionary>
No newline at end of file
21 <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
No newline at end of file
22 <value>all</value>
No newline at end of file
23 </dictionary>
No newline at end of file
24 <dictionary>
No newline at end of file
25 <key>org.eclipse.cdt.make.core.buildArguments</key>
No newline at end of file
26 <value></value>
No newline at end of file
27 </dictionary>
No newline at end of file
28 <dictionary>
No newline at end of file
29 <key>org.eclipse.cdt.make.core.buildCommand</key>
No newline at end of file
30 <value>make</value>
No newline at end of file
31 </dictionary>
No newline at end of file
32 <dictionary>
No newline at end of file
33 <key>org.eclipse.cdt.make.core.buildLocation</key>
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
36 <dictionary>
No newline at end of file
37 <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
No newline at end of file
38 <value>clean</value>
No newline at end of file
39 </dictionary>
No newline at end of file
40 <dictionary>
No newline at end of file
41 <key>org.eclipse.cdt.make.core.contents</key>
No newline at end of file
42 <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
No newline at end of file
43 </dictionary>
No newline at end of file
44 <dictionary>
No newline at end of file
45 <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
No newline at end of file
46 <value>false</value>
No newline at end of file
47 </dictionary>
No newline at end of file
48 <dictionary>
No newline at end of file
49 <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
No newline at end of file
50 <value>true</value>
No newline at end of file
51 </dictionary>
No newline at end of file
52 <dictionary>
No newline at end of file
53 <key>org.eclipse.cdt.make.core.enableFullBuild</key>
No newline at end of file
54 <value>true</value>
No newline at end of file
55 </dictionary>
No newline at end of file
56 <dictionary>
No newline at end of file
57 <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
No newline at end of file
58 <value>all</value>
No newline at end of file
59 </dictionary>
No newline at end of file
60 <dictionary>
No newline at end of file
61 <key>org.eclipse.cdt.make.core.stopOnError</key>
No newline at end of file
62 <value>true</value>
No newline at end of file
63 </dictionary>
No newline at end of file
64 <dictionary>
No newline at end of file
65 <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
No newline at end of file
66 <value>true</value>
No newline at end of file
67 </dictionary>
No newline at end of file
68 </arguments>
No newline at end of file
69 </buildCommand>
No newline at end of file
70 <buildCommand>
No newline at end of file
71 <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
No newline at end of file
72 <arguments>
No newline at end of file
73 </arguments>
No newline at end of file
74 </buildCommand>
No newline at end of file
75 </buildSpec>
No newline at end of file
76 <natures>
No newline at end of file
77 <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
No newline at end of file
78 <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
No newline at end of file
79 <nature>org.eclipse.cdt.core.cnature</nature>
No newline at end of file
80 </natures>
No newline at end of file
81 </projectDescription> No newline at end of file
@@ -0,0 +1,102
1 /*
No newline at end of file
2 * This programmer uses AT91' GPIO lines
No newline at end of file
3 *
No newline at end of file
4 * 2006 by Carlos Camargo
No newline at end of file
5 * 2007.May.10 Andres Calderon
No newline at end of file
6 * 2009.Aug.26 Jose Francisco Quenta
No newline at end of file
7 */
No newline at end of file
8
No newline at end of file
9 #include <stdint.h>
No newline at end of file
10 #include <stdlib.h>
No newline at end of file
11 #include <stdio.h>
No newline at end of file
12 #include <unistd.h>
No newline at end of file
13
No newline at end of file
14
No newline at end of file
15 #include <sys/types.h>
No newline at end of file
16 #include <sys/stat.h>
No newline at end of file
17 #include <sys/mman.h>
No newline at end of file
18 #include <fcntl.h>
No newline at end of file
19
No newline at end of file
20 #include "./Librerias/AT91gpio_Funciones.h"
No newline at end of file
21
No newline at end of file
22 void pio_out(AT91S_PIO * pio, int mask, unsigned long val, int opcion)
No newline at end of file
23 {
No newline at end of file
24 if (opcion == 1)
No newline at end of file
25 pio->PIO_SODR = mask & val;
No newline at end of file
26 else
No newline at end of file
27 pio->PIO_CODR = mask & val;
No newline at end of file
28 }
No newline at end of file
29
No newline at end of file
30
No newline at end of file
31 int pio_in(AT91S_PIO * pio, int mask)
No newline at end of file
32 {
No newline at end of file
33 return (pio->PIO_PDSR & mask);
No newline at end of file
34 }
No newline at end of file
35
No newline at end of file
36
No newline at end of file
37 AT91S_PIO *pio_map(unsigned int piobase)
No newline at end of file
38 {
No newline at end of file
39 int fd;
No newline at end of file
40 void *base;
No newline at end of file
41
No newline at end of file
42 AT91S_PIO *pio;
No newline at end of file
43
No newline at end of file
44 off_t addr = piobase;
No newline at end of file
45
No newline at end of file
46 if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
No newline at end of file
47 fprintf(stderr, "Cannot open /dev/mem.\n");
No newline at end of file
48 exit(EXIT_FAILURE);
No newline at end of file
49 }
No newline at end of file
50
No newline at end of file
51 fprintf(stderr, "/dev/mem opened.\n");
No newline at end of file
52
No newline at end of file
53 base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, addr & ~MAP_MASK);
No newline at end of file
54
No newline at end of file
55 if (base == (void *) -1) {
No newline at end of file
56 fprintf(stderr, "Cannot open /dev/mem.\n");
No newline at end of file
57 exit(EXIT_FAILURE);
No newline at end of file
58 }
No newline at end of file
59
No newline at end of file
60 fprintf(stderr, "Memory mapped at address %p.\n", base);
No newline at end of file
61
No newline at end of file
62 pio = base + (addr & MAP_MASK);
No newline at end of file
63
No newline at end of file
64 return pio;
No newline at end of file
65 }
No newline at end of file
66
No newline at end of file
67
No newline at end of file
68 void pio_enable(AT91S_PIO * pio, int mask)
No newline at end of file
69 {
No newline at end of file
70 pio->PIO_PER = mask; /* Enable PIO */
No newline at end of file
71 }
No newline at end of file
72
No newline at end of file
73 void pio_output_enable(AT91S_PIO * pio, int mask)
No newline at end of file
74 {
No newline at end of file
75 pio->PIO_OER = mask; /* Set TDI, TMS and TCK as outputs */
No newline at end of file
76 }
No newline at end of file
77
No newline at end of file
78 void pio_input_enable(AT91S_PIO * pio, int mask)
No newline at end of file
79 {
No newline at end of file
80 pio->PIO_ODR = mask; /* Set TDO as input */
No newline at end of file
81 pio->PIO_IFER = mask; /* Enable Input Filter */
No newline at end of file
82 }
No newline at end of file
83
No newline at end of file
84 void pio_disable_irq(AT91S_PIO * pio, int mask)
No newline at end of file
85 {
No newline at end of file
86 pio->PIO_IDR = mask; /* Disable pin interrupts */
No newline at end of file
87 }
No newline at end of file
88
No newline at end of file
89 void pio_disable_multiple_driver(AT91S_PIO * pio, int mask)
No newline at end of file
90 {
No newline at end of file
91 pio->PIO_MDDR = mask; /* Disable Multiple Diver */
No newline at end of file
92 }
No newline at end of file
93
No newline at end of file
94 void pio_disable_pull_ups(AT91S_PIO * pio, int mask)
No newline at end of file
95 {
No newline at end of file
96 pio->PIO_PUDR = mask; /* Disable Pull-Ups */
No newline at end of file
97 }
No newline at end of file
98
No newline at end of file
99 void pio_synchronous_data_output(AT91S_PIO * pio, int mask)
No newline at end of file
100 {
No newline at end of file
101 pio->PIO_OWDR = mask; /* Synchronous Data Output Write in PIO_ */
No newline at end of file
102 } No newline at end of file
@@ -0,0 +1,131
1 /*
No newline at end of file
2 * This programmer uses AT91' GPIO lines
No newline at end of file
3 *
No newline at end of file
4 * 2006 by Carlos Camargo
No newline at end of file
5 * 2007.May.10 Andres Calderon
No newline at end of file
6 * 2009.Aug.26 Jose Francisco Quenta
No newline at end of file
7 */
No newline at end of file
8
No newline at end of file
9 #ifndef ECB_AT91_H
No newline at end of file
10 #define ECB_AT91_H
No newline at end of file
11
No newline at end of file
12
No newline at end of file
13 #define MAP_SIZE 4096Ul
No newline at end of file
14 #define MAP_MASK (MAP_SIZE - 1)
No newline at end of file
15
No newline at end of file
16 #define PIOA_BASE 0xFFFFF400
No newline at end of file
17 #define PIOB_BASE 0xFFFFF600
No newline at end of file
18 #define PIOC_BASE 0xFFFFF800
No newline at end of file
19 #define PIOD_BASE 0xFFFFFA00
No newline at end of file
20
No newline at end of file
21 #define PB0 (1 << 0)
No newline at end of file
22 #define PB1 (1 << 1)
No newline at end of file
23 #define PB2 (1 << 2)
No newline at end of file
24 #define PB3 (1 << 3)
No newline at end of file
25 #define PB8 (1 << 8)
No newline at end of file
26 #define PB9 (1 << 9)
No newline at end of file
27 #define PB10 (1 << 10)
No newline at end of file
28 #define PB11 (1 << 11)
No newline at end of file
29 #define PB16 (1 << 16)
No newline at end of file
30 #define PB17 (1 << 17)
No newline at end of file
31 #define PB18 (1 << 18)
No newline at end of file
32 #define PB19 (1 << 19)
No newline at end of file
33 #define PB20 (1 << 20)
No newline at end of file
34 #define PB21 (1 << 21)
No newline at end of file
35 #define PB22 (1 << 22)
No newline at end of file
36 #define PB23 (1 << 23)
No newline at end of file
37 #define PB24 (1 << 24)
No newline at end of file
38 #define PB25 (1 << 25)
No newline at end of file
39 #define PB30 (1 << 30)
No newline at end of file
40 #define PB31 (1 << 31)
No newline at end of file
41
No newline at end of file
42 #define PC0 (1 << 0)
No newline at end of file
43 #define PC1 (1 << 1)
No newline at end of file
44 #define PC4 (1 << 4)
No newline at end of file
45 #define PC5 (1 << 5)
No newline at end of file
46 #define PC6 (1 << 6)
No newline at end of file
47 #define PC7 (1 << 7)
No newline at end of file
48 #define PC8 (1 << 8)
No newline at end of file
49 #define PC9 (1 << 9)
No newline at end of file
50 #define PC10 (1 << 10)
No newline at end of file
51 #define PC11 (1 << 11)
No newline at end of file
52 #define PC16 (1 << 16)
No newline at end of file
53 #define PC17 (1 << 17)
No newline at end of file
54 #define PC18 (1 << 18)
No newline at end of file
55 #define PC19 (1 << 19)
No newline at end of file
56 #define PC20 (1 << 20)
No newline at end of file
57 #define PC21 (1 << 21)
No newline at end of file
58 #define PC22 (1 << 22)
No newline at end of file
59 #define PC23 (1 << 23)
No newline at end of file
60 #define PC24 (1 << 24)
No newline at end of file
61 #define PC25 (1 << 25)
No newline at end of file
62 #define PC26 (1 << 26)
No newline at end of file
63 #define PC27 (1 << 27)
No newline at end of file
64 #define PC28 (1 << 28)
No newline at end of file
65 #define PC29 (1 << 29)
No newline at end of file
66 #define PC30 (1 << 30)
No newline at end of file
67 #define PC31 (1 << 31)
No newline at end of file
68
No newline at end of file
69
No newline at end of file
70 typedef volatile unsigned int AT91_REG;
No newline at end of file
71 /* Hardware register definition */
No newline at end of file
72
No newline at end of file
73 typedef struct _AT91S_PIO {
No newline at end of file
74 AT91_REG PIO_PER; /* PIO Enable Register */
No newline at end of file
75 AT91_REG PIO_PDR; /* PIO Disable Register */
No newline at end of file
76 AT91_REG PIO_PSR; /* PIO Status Register */
No newline at end of file
77 AT91_REG Reserved0[1];
No newline at end of file
78 AT91_REG PIO_OER; /* Output Enable Register */
No newline at end of file
79 AT91_REG PIO_ODR; /* Output Disable Registerr */
No newline at end of file
80 AT91_REG PIO_OSR; /* Output Status Register */
No newline at end of file
81 AT91_REG Reserved1[1];
No newline at end of file
82 AT91_REG PIO_IFER; /* Input Filter Enable Register */
No newline at end of file
83 AT91_REG PIO_IFDR; /* Input Filter Disable Register */
No newline at end of file
84 AT91_REG PIO_IFSR; /* Input Filter Status Register */
No newline at end of file
85 AT91_REG Reserved2[1];
No newline at end of file
86 AT91_REG PIO_SODR; /* Set Output Data Register */
No newline at end of file
87 AT91_REG PIO_CODR; /* Clear Output Data Register */
No newline at end of file
88 AT91_REG PIO_ODSR; /* Output Data Status Register */
No newline at end of file
89 AT91_REG PIO_PDSR; /* Pin Data Status Register */
No newline at end of file
90 AT91_REG PIO_IER; /* Interrupt Enable Register */
No newline at end of file
91 AT91_REG PIO_IDR; /* Interrupt Disable Register */
No newline at end of file
92 AT91_REG PIO_IMR; /* Interrupt Mask Register */
No newline at end of file
93 AT91_REG PIO_ISR; /* Interrupt Status Register */
No newline at end of file
94 AT91_REG PIO_MDER; /* Multi-driver Enable Register */
No newline at end of file
95 AT91_REG PIO_MDDR; /* Multi-driver Disable Register */
No newline at end of file
96 AT91_REG PIO_MDSR; /* Multi-driver Status Register */
No newline at end of file
97 AT91_REG Reserved3[1];
No newline at end of file
98 AT91_REG PIO_PUDR; /* Pull-up Disable Register */
No newline at end of file
99 AT91_REG PIO_PUER; /* Pull-up Enable Register */
No newline at end of file
100 AT91_REG PIO_PUSR; /* Pad Pull-up Status Register */
No newline at end of file
101 AT91_REG Reserved4[1];
No newline at end of file
102 AT91_REG PIO_ASR; /* Select A Register */
No newline at end of file
103 AT91_REG PIO_BSR; /* Select B Register */
No newline at end of file
104 AT91_REG PIO_ABSR; /* AB Select Status Register */
No newline at end of file
105 AT91_REG Reserved5[9];
No newline at end of file
106 AT91_REG PIO_OWER; /* Output Write Enable Register */
No newline at end of file
107 AT91_REG PIO_OWDR; /* Output Write Disable Register */
No newline at end of file
108 AT91_REG PIO_OWSR; /* Output Write Status Register */
No newline at end of file
109 } AT91S_PIO, *AT91PS_PIO;
No newline at end of file
110
No newline at end of file
111 void pio_out(AT91S_PIO * pio, int mask, unsigned long val, int opcion);
No newline at end of file
112
No newline at end of file
113 int pio_in(AT91S_PIO * pio, int mask);
No newline at end of file
114
No newline at end of file
115 AT91S_PIO *pio_map(unsigned int piobase);
No newline at end of file
116
No newline at end of file
117 void pio_enable(AT91S_PIO * pio, int mask);
No newline at end of file
118
No newline at end of file
119 void pio_output_enable(AT91S_PIO * pio, int mask);
No newline at end of file
120
No newline at end of file
121 void pio_input_enable(AT91S_PIO * pio, int mask);
No newline at end of file
122
No newline at end of file
123 void pio_disable_irq(AT91S_PIO * pio, int mask);
No newline at end of file
124
No newline at end of file
125 void pio_disable_multiple_driver(AT91S_PIO * pio, int mask);
No newline at end of file
126
No newline at end of file
127 void pio_disable_pull_ups(AT91S_PIO * pio, int mask);
No newline at end of file
128
No newline at end of file
129 void pio_synchronous_data_output(AT91S_PIO * pio, int mask);
No newline at end of file
130
No newline at end of file
131 #endif No newline at end of file
@@ -0,0 +1,19
1 /*
No newline at end of file
2 * Funciones_ControlERs.h
No newline at end of file
3 *
No newline at end of file
4 * Created on: Jan 14, 2010
No newline at end of file
5 * Author: redes
No newline at end of file
6 */
No newline at end of file
7
No newline at end of file
8 #ifndef FUNCIONES_CONTROLERS_H_
No newline at end of file
9 #define FUNCIONES_CONTROLERS_H_
No newline at end of file
10
No newline at end of file
11 int estado_ERemota(char dir_red[],int dir_inicio,int dir_fin);
No newline at end of file
12
No newline at end of file
13 int envia_experimento(char valor[], int base);
No newline at end of file
14
No newline at end of file
15 int trae_monitoreo(char valor[], int base);
No newline at end of file
16
No newline at end of file
17 int ClienteUDP(char *opcion, char *valor);
No newline at end of file
18
No newline at end of file
19 #endif /* FUNCIONES_CONTROLERS_H_ */ No newline at end of file
@@ -0,0 +1,17
1 /*
No newline at end of file
2 * Mensajes.h
No newline at end of file
3 *
No newline at end of file
4 * Created on: Nov 12, 2009
No newline at end of file
5 * Author: redes
No newline at end of file
6 */
No newline at end of file
7
No newline at end of file
8 #ifndef MENSAJES_H_
No newline at end of file
9 #define MENSAJES_H_
No newline at end of file
10
No newline at end of file
11 void LOG_SERVIDOR(char *mensaje);
No newline at end of file
12 void LOG_CLIENTE(char *mensaje);
No newline at end of file
13 void ERROR_FATAL(char *mensaje);
No newline at end of file
14 void ERROR(char *mensaje);
No newline at end of file
15
No newline at end of file
16
No newline at end of file
17 #endif /* MENSAJES_H_ */ No newline at end of file
@@ -0,0 +1,39
1 /*
No newline at end of file
2 * Mensajes.c
No newline at end of file
3 *
No newline at end of file
4 * Created on: Nov 12, 2009
No newline at end of file
5 * Author: Jose Francisco Quenta
No newline at end of file
6 */
No newline at end of file
7
No newline at end of file
8 #include <stdio.h>
No newline at end of file
9 #include <stdlib.h>
No newline at end of file
10
No newline at end of file
11 /*
No newline at end of file
12 * Imprime mensajes del servidor
No newline at end of file
13 */
No newline at end of file
14 void LOG_SERVIDOR(char *mensaje){
No newline at end of file
15 printf("SERVIDOR: %s\n",mensaje);
No newline at end of file
16 }
No newline at end of file
17
No newline at end of file
18 /*
No newline at end of file
19 * Imprime mensajes del cliente
No newline at end of file
20 */
No newline at end of file
21 void LOG_CLIENTE(char *mensaje){
No newline at end of file
22 printf("CLIENTE: %s\n",mensaje);
No newline at end of file
23 }
No newline at end of file
24
No newline at end of file
25 /*
No newline at end of file
26 * Error no fatal, permite la continuación del programa
No newline at end of file
27 */
No newline at end of file
28 void ERROR(char *mensaje){
No newline at end of file
29 fprintf(stderr, "ERROR. %s\n", mensaje);
No newline at end of file
30 }
No newline at end of file
31
No newline at end of file
32 /*
No newline at end of file
33 * Error fatal, aborta la ejecución del programa con código de salida de error
No newline at end of file
34 */
No newline at end of file
35 void ERROR_FATAL(char *mensaje){
No newline at end of file
36 fprintf(stderr, "ERROR FATAL. %s\n", mensaje);
No newline at end of file
37 exit(EXIT_FAILURE);
No newline at end of file
38 }
No newline at end of file
39 No newline at end of file
@@ -0,0 +1,324
1 /*
No newline at end of file
2 * Servidor.c
No newline at end of file
3 *
No newline at end of file
4 * Created on: Nov 3, 2009
No newline at end of file
5 * Author: Jose Francisco Quenta
No newline at end of file
6 *
No newline at end of file
7 * Se implementa:
No newline at end of file
8 * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO
No newline at end of file
9 * -Cambio de apunte.
No newline at end of file
10 * -Lectura del estado actual del apunte y grabado del mismo en un archivo
No newline at end of file
11 */
No newline at end of file
12
No newline at end of file
13 #include <stdio.h>
No newline at end of file
14 #include <stdlib.h>
No newline at end of file
15 #include <string.h>
No newline at end of file
16 #include <unistd.h>
No newline at end of file
17 #include <errno.h>
No newline at end of file
18
No newline at end of file
19 #include <sys/types.h>
No newline at end of file
20 #include <sys/socket.h>
No newline at end of file
21 #include <netinet/in.h>
No newline at end of file
22 #include <arpa/inet.h>
No newline at end of file
23 #include <netdb.h>
No newline at end of file
24
No newline at end of file
25 #include "./Librerias/AT91gpio_Funciones.h"
No newline at end of file
26 #include "./Librerias/Mensajes.h"
No newline at end of file
27
No newline at end of file
28 #define PUERTO_SERVIDOR 5500
No newline at end of file
29 #define TAM_BUFFER 100
No newline at end of file
30
No newline at end of file
31 #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE
No newline at end of file
32
No newline at end of file
33 #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION
No newline at end of file
34
No newline at end of file
35 #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB
No newline at end of file
36 #define bit_up_1 0x00040000
No newline at end of file
37 #define bit_up_0 0x00100000
No newline at end of file
38 #define bit_dow_2 0x40000000
No newline at end of file
39 #define bit_dow_1 0x01000000
No newline at end of file
40 #define bit_dow_0 0x00400000
No newline at end of file
41
No newline at end of file
42 #define MyID 11
No newline at end of file
43
No newline at end of file
44 char *buff_experimento= NULL;
No newline at end of file
45
No newline at end of file
46 AT91S_PIO *pioc;
No newline at end of file
47 AT91S_PIO *piob;
No newline at end of file
48
No newline at end of file
49 /*
No newline at end of file
50 * Zona de declaracion de cabeceras.
No newline at end of file
51 */
No newline at end of file
52 void inicializa_gpio();
No newline at end of file
53 int procesa_peticion(char *buff_peticion);
No newline at end of file
54 int cambia_apuntamiento(char *puntero_char);
No newline at end of file
55 int carga_experimento(char *nombre_archivo);
No newline at end of file
56 int chequeo_sistema(char *numero_muestras);
No newline at end of file
57
No newline at end of file
58 /*
No newline at end of file
59 *
No newline at end of file
60 */
No newline at end of file
61 int main(){
No newline at end of file
62
No newline at end of file
63 int conexion_servidorFd;
No newline at end of file
64 struct sockaddr_in inf_servidor;
No newline at end of file
65 struct sockaddr_storage inf_cliente;
No newline at end of file
66 int resultado;
No newline at end of file
67 int numbytes_recibidos;
No newline at end of file
68 int rpta;
No newline at end of file
69
No newline at end of file
70 char *buff_peticion = (char *) malloc(TAM_BUFFER);
No newline at end of file
71
No newline at end of file
72 size_t addr_len;
No newline at end of file
73
No newline at end of file
74 memset(&inf_servidor, 0, sizeof(inf_servidor));
No newline at end of file
75 inf_servidor.sin_family= AF_INET;
No newline at end of file
76 inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
No newline at end of file
77 inf_servidor.sin_addr.s_addr= INADDR_ANY;
No newline at end of file
78
No newline at end of file
79 /* Se establece el socket */
No newline at end of file
80 conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0);
No newline at end of file
81 if (conexion_servidorFd == -1){
No newline at end of file
82 ERROR_FATAL("No se establecio correctamente el socket: socket()");
No newline at end of file
83 }
No newline at end of file
84
No newline at end of file
85 /* Se asocia el socket a un puerto y una IP */
No newline at end of file
86 resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
No newline at end of file
87 if (resultado== -1){
No newline at end of file
88 ERROR_FATAL("No se establecio correctamente el socket: bind()");
No newline at end of file
89 }
No newline at end of file
90
No newline at end of file
91 /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */
No newline at end of file
92 inicializa_gpio();
No newline at end of file
93
No newline at end of file
94 while(1){
No newline at end of file
95 LOG_SERVIDOR("Esperando solicitud de cliente...\n");
No newline at end of file
96
No newline at end of file
97 /* Se espera hasta que un cliente se conecte */
No newline at end of file
98 addr_len = sizeof(inf_cliente);
No newline at end of file
99 numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len);
No newline at end of file
100 if (numbytes_recibidos == -1){
No newline at end of file
101 ERROR_FATAL("Error en la recepcion de datos: recvfrom()");
No newline at end of file
102 }
No newline at end of file
103
No newline at end of file
104 /* Se procede a procesar los datos recibidos */
No newline at end of file
105 buff_peticion[numbytes_recibidos]= '\0';
No newline at end of file
106
No newline at end of file
107 /* procesamiento de la peticion */
No newline at end of file
108 rpta = procesa_peticion(buff_peticion);
No newline at end of file
109
No newline at end of file
110 //Respuesta del modulo de control
No newline at end of file
111 //
No newline at end of file
112
No newline at end of file
113
No newline at end of file
114 }
No newline at end of file
115 }
No newline at end of file
116
No newline at end of file
117
No newline at end of file
118
No newline at end of file
119 /*
No newline at end of file
120 * Esta funcion incializa el puerto GPIO
No newline at end of file
121 */
No newline at end of file
122 void inicializa_gpio(){
No newline at end of file
123
No newline at end of file
124 // Configuracion de los pines de APUNTE
No newline at end of file
125 pioc = pio_map(PIOC_BASE);
No newline at end of file
126 pio_enable(pioc, maskc_out);
No newline at end of file
127 pio_disable_irq(pioc, maskc_out);
No newline at end of file
128 pio_disable_multiple_driver(pioc, maskc_out);
No newline at end of file
129 pio_disable_pull_ups(pioc, maskc_out);
No newline at end of file
130 pio_synchronous_data_output(pioc, maskc_out);
No newline at end of file
131 pio_output_enable(pioc, maskc_out);
No newline at end of file
132
No newline at end of file
133 // Configuracion de los pines de VERIFICACION
No newline at end of file
134 piob = pio_map(PIOB_BASE);
No newline at end of file
135 pio_enable(piob, maskb_in);
No newline at end of file
136 pio_disable_irq(piob, maskb_in);
No newline at end of file
137 pio_disable_multiple_driver(piob, maskb_in);
No newline at end of file
138 pio_disable_pull_ups(piob, maskb_in);
No newline at end of file
139 pio_input_enable(piob, maskb_in);
No newline at end of file
140
No newline at end of file
141 }
No newline at end of file
142
No newline at end of file
143 /*
No newline at end of file
144 * Esta funcion procesa el mensaje de peticion y genera respuesta
No newline at end of file
145 */
No newline at end of file
146 int procesa_peticion(char *buff_peticion){
No newline at end of file
147 int rpta;
No newline at end of file
148 // char *header = strtok(buff_peticion, ":");
No newline at end of file
149 // char *ipSource = strtok(buff_peticion, ":");
No newline at end of file
150 // char *ipDestino = strtok(buff_peticion, ":");
No newline at end of file
151 char *comando = strtok(buff_peticion, ":");
No newline at end of file
152 char *valor = strtok(NULL, ":");
No newline at end of file
153
No newline at end of file
154 if ((comando == NULL) || (valor == NULL)){
No newline at end of file
155 ERROR("procesarPeticion: formato de mensaje incorrecto");
No newline at end of file
156 }
No newline at end of file
157 else{
No newline at end of file
158 if(strcmp(comando,"CARGA") == 0)
No newline at end of file
159 rpta = carga_experimento(valor);
No newline at end of file
160 else if(strcmp(comando,"CAMBIA") == 0)
No newline at end of file
161 rpta = cambia_apuntamiento(valor);
No newline at end of file
162 else if(strcmp(comando,"CHEQUEO") == 0)
No newline at end of file
163 rpta = chequeo_sistema(valor);
No newline at end of file
164 else
No newline at end of file
165 ERROR("procesa_peticion: comando no reconocido");
No newline at end of file
166 }
No newline at end of file
167
No newline at end of file
168 return rpta;
No newline at end of file
169 }
No newline at end of file
170
No newline at end of file
171
No newline at end of file
172 /*
No newline at end of file
173 * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego
No newline at end of file
174 * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato
No newline at end of file
175 * que sera usado en el cambio de apuntamiento.
No newline at end of file
176 */
No newline at end of file
177 int carga_experimento(char *nombre_archivo){
No newline at end of file
178
No newline at end of file
179 FILE *Archivo_Fd;
No newline at end of file
180
No newline at end of file
181 char *cadena = (char *) malloc(25);
No newline at end of file
182
No newline at end of file
183 int longitud_cadena;
No newline at end of file
184 int num_bytes= 0;
No newline at end of file
185 int num_filas= 0;
No newline at end of file
186
No newline at end of file
187 char ruta_archivo[50]; // Se crea la ruta para abrir el archivo
No newline at end of file
188 strcpy(ruta_archivo,"/mnt/sd/archivos/");
No newline at end of file
189 strcat(ruta_archivo,nombre_archivo);
No newline at end of file
190
No newline at end of file
191 Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada
No newline at end of file
192 if(!Archivo_Fd){
No newline at end of file
193 ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n");
No newline at end of file
194 return -1;
No newline at end of file
195 }else{
No newline at end of file
196
No newline at end of file
197 while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria
No newline at end of file
198 fgets(cadena,20,Archivo_Fd);
No newline at end of file
199 longitud_cadena= strlen(cadena);
No newline at end of file
200 cadena[longitud_cadena-1] = '\0';
No newline at end of file
201 num_bytes = num_bytes + longitud_cadena;
No newline at end of file
202 num_filas++;
No newline at end of file
203 }
No newline at end of file
204
No newline at end of file
205 rewind(Archivo_Fd); // Se reinicia el puntero del archivo
No newline at end of file
206
No newline at end of file
207 char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun
No newline at end of file
208 // la longitud del archivo
No newline at end of file
209 fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd);
No newline at end of file
210
No newline at end of file
211 char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo
No newline at end of file
212 puntero= puntero + 12;
No newline at end of file
213
No newline at end of file
214 buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3);
No newline at end of file
215 strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo
No newline at end of file
216
No newline at end of file
217 fclose(Archivo_Fd);
No newline at end of file
218
No newline at end of file
219 cambia_apuntamiento("0"); // Se apunta a la direccion 0
No newline at end of file
220
No newline at end of file
221 return 1;
No newline at end of file
222 }
No newline at end of file
223 }
No newline at end of file
224
No newline at end of file
225 /*
No newline at end of file
226 * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en
No newline at end of file
227 * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta
No newline at end of file
228 * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a
No newline at end of file
229 * traves del puerto GPIO.
No newline at end of file
230 */
No newline at end of file
231 int cambia_apuntamiento(char *puntero_char){
No newline at end of file
232
No newline at end of file
233 /*MSB-UP-LSB MSB-DOWN-LSB*/
No newline at end of file
234 int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara
No newline at end of file
235 // al dato que ingresa para formar el número
No newline at end of file
236 // entero que se le pasara al puerto GPIO
No newline at end of file
237 // Estos números son los pines del puerto GPIO
No newline at end of file
238 // que se estan usando para el control
No newline at end of file
239
No newline at end of file
240 int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero
No newline at end of file
241
No newline at end of file
242 int base= 7*puntero; // base= cantidad_bytes del dato x puntero
No newline at end of file
243 // cantidad de bytes es el numero de bytes que
No newline at end of file
244 printf("%i\n",puntero); // contiene cada dato, para este caso es 7
No newline at end of file
245 // porque es 6 bits de datos + 1 bit del cambio
No newline at end of file
246 // de linea.
No newline at end of file
247 char valor_char;
No newline at end of file
248 unsigned long valor;
No newline at end of file
249 unsigned long acumulado_ceros=0;
No newline at end of file
250 unsigned long acumulado_unos=0;
No newline at end of file
251
No newline at end of file
252 int offset; // Defino offset para el desplazamiento a traves
No newline at end of file
253 for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento"
No newline at end of file
254
No newline at end of file
255 valor_char= buff_experimento[base+offset]; // Obtengo el dato
No newline at end of file
256
No newline at end of file
257 if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno
No newline at end of file
258 valor= 0;
No newline at end of file
259 acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]);
No newline at end of file
260 }else{
No newline at end of file
261 valor= 1;
No newline at end of file
262 acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]);
No newline at end of file
263 }
No newline at end of file
264
No newline at end of file
265 }
No newline at end of file
266
No newline at end of file
267 pio_out(pioc, maskc_out, acumulado_unos, 1);
No newline at end of file
268 pio_out(pioc, maskc_out, acumulado_ceros, 0);
No newline at end of file
269
No newline at end of file
270 return 1;
No newline at end of file
271
No newline at end of file
272 }
No newline at end of file
273
No newline at end of file
274 /*
No newline at end of file
275 * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el
No newline at end of file
276 * archivo Verificacion.
No newline at end of file
277 */
No newline at end of file
278
No newline at end of file
279 int chequeo_sistema(char *numero_muestras){
No newline at end of file
280
No newline at end of file
281 char valor[7];
No newline at end of file
282 int i,cnt;
No newline at end of file
283 unsigned int entradac= 0;
No newline at end of file
284 FILE *fd;
No newline at end of file
285 fd=fopen("/mnt/sd/archivos/Verificacion","w");
No newline at end of file
286 fprintf(fd,"%s\n","Verificacion");
No newline at end of file
287 fprintf(fd,"%s\n","------------");
No newline at end of file
288 cnt=0;
No newline at end of file
289 do
No newline at end of file
290 {
No newline at end of file
291 //Inicializando arreglo
No newline at end of file
292 for(i=0;i<6;i++)
No newline at end of file
293 valor[i]='0';
No newline at end of file
294
No newline at end of file
295 valor[6]='\0';
No newline at end of file
296
No newline at end of file
297 //Lectura de puerto
No newline at end of file
298 entradac= pio_in(piob,maskb_in);
No newline at end of file
299
No newline at end of file
300 //Dandole formato al dato
No newline at end of file
301 if (!(entradac & bit_up_2))
No newline at end of file
302 valor[0] = '1';
No newline at end of file
303 if (!(entradac & bit_up_1))
No newline at end of file
304 valor[1] = '1';
No newline at end of file
305 if (!(entradac & bit_up_0))
No newline at end of file
306 valor[2] = '1';
No newline at end of file
307 if (!(entradac & bit_dow_2))
No newline at end of file
308 valor[3] = '1';
No newline at end of file
309 if (!(entradac & bit_dow_1))
No newline at end of file
310 valor[4] = '1';
No newline at end of file
311 if (!(entradac & bit_dow_0))
No newline at end of file
312 valor[5] = '1';
No newline at end of file
313
No newline at end of file
314 //Escribiendo en archivo
No newline at end of file
315 fprintf(fd,"%s\n",valor);
No newline at end of file
316 cnt=cnt+1;
No newline at end of file
317 usleep(1*1000*1000);
No newline at end of file
318
No newline at end of file
319 }while(cnt < atoi(numero_muestras));
No newline at end of file
320
No newline at end of file
321 fclose(fd);
No newline at end of file
322
No newline at end of file
323 return 1;
No newline at end of file
324 } No newline at end of file
@@ -0,0 +1,322
1 /*
No newline at end of file
2 * Servidor.c
No newline at end of file
3 *
No newline at end of file
4 * Created on: Nov 3, 2009
No newline at end of file
5 * Author: Jose Francisco Quenta
No newline at end of file
6 *
No newline at end of file
7 * Se implementa:
No newline at end of file
8 * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO
No newline at end of file
9 * -Cambio de apunte.
No newline at end of file
10 * -Lectura del estado actual del apunte y grabado del mismo en un archivo
No newline at end of file
11 */
No newline at end of file
12
No newline at end of file
13 #include <stdio.h>
No newline at end of file
14 #include <stdlib.h>
No newline at end of file
15 #include <string.h>
No newline at end of file
16 #include <unistd.h>
No newline at end of file
17 #include <errno.h>
No newline at end of file
18
No newline at end of file
19 #include <sys/types.h>
No newline at end of file
20 #include <sys/socket.h>
No newline at end of file
21 #include <netinet/in.h>
No newline at end of file
22 #include <arpa/inet.h>
No newline at end of file
23 #include <netdb.h>
No newline at end of file
24
No newline at end of file
25 #include "./Librerias/AT91gpio_Funciones.h"
No newline at end of file
26 #include "./Librerias/Mensajes.h"
No newline at end of file
27
No newline at end of file
28 #define PUERTO_SERVIDOR 5500
No newline at end of file
29 #define TAM_BUFFER 100
No newline at end of file
30
No newline at end of file
31 #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE
No newline at end of file
32
No newline at end of file
33 #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION
No newline at end of file
34
No newline at end of file
35 #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB
No newline at end of file
36 #define bit_up_1 0x00040000
No newline at end of file
37 #define bit_up_0 0x00100000
No newline at end of file
38 #define bit_dow_2 0x40000000
No newline at end of file
39 #define bit_dow_1 0x01000000
No newline at end of file
40 #define bit_dow_0 0x00400000
No newline at end of file
41
No newline at end of file
42 #define MyID 11
No newline at end of file
43
No newline at end of file
44 char *buff_experimento= NULL;
No newline at end of file
45
No newline at end of file
46 AT91S_PIO *pioc;
No newline at end of file
47 AT91S_PIO *piob;
No newline at end of file
48
No newline at end of file
49 /*
No newline at end of file
50 * Zona de declaracion de cabeceras.
No newline at end of file
51 */
No newline at end of file
52 void inicializa_gpio();
No newline at end of file
53 int procesa_peticion(char *buff_peticion);
No newline at end of file
54 int cambia_apuntamiento(char *puntero_char);
No newline at end of file
55 int carga_experimento(char *nombre_archivo);
No newline at end of file
56 int chequeo_sistema(char *numero_muestras);
No newline at end of file
57
No newline at end of file
58 /*
No newline at end of file
59 *
No newline at end of file
60 */
No newline at end of file
61 int main(){
No newline at end of file
62
No newline at end of file
63 int conexion_servidorFd;
No newline at end of file
64 struct sockaddr_in inf_servidor;
No newline at end of file
65 struct sockaddr_storage inf_cliente;
No newline at end of file
66 int resultado;
No newline at end of file
67 int numbytes_recibidos;
No newline at end of file
68 int rpta;
No newline at end of file
69
No newline at end of file
70 char *buff_peticion = (char *) malloc(TAM_BUFFER);
No newline at end of file
71
No newline at end of file
72 size_t addr_len;
No newline at end of file
73
No newline at end of file
74 memset(&inf_servidor, 0, sizeof(inf_servidor));
No newline at end of file
75 inf_servidor.sin_family= AF_INET;
No newline at end of file
76 inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
No newline at end of file
77 inf_servidor.sin_addr.s_addr= INADDR_ANY;
No newline at end of file
78
No newline at end of file
79 /* Se establece el socket */
No newline at end of file
80 conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0);
No newline at end of file
81 if (conexion_servidorFd == -1){
No newline at end of file
82 ERROR_FATAL("No se establecio correctamente el socket: socket()");
No newline at end of file
83 }
No newline at end of file
84
No newline at end of file
85 /* Se asocia el socket a un puerto y una IP */
No newline at end of file
86 resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
No newline at end of file
87 if (resultado== -1){
No newline at end of file
88 ERROR_FATAL("No se establecio correctamente el socket: bind()");
No newline at end of file
89 }
No newline at end of file
90
No newline at end of file
91 /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */
No newline at end of file
92 inicializa_gpio();
No newline at end of file
93
No newline at end of file
94 while(1){
No newline at end of file
95 LOG_SERVIDOR("Esperando solicitud de cliente...\n");
No newline at end of file
96
No newline at end of file
97 /* Se espera hasta que un cliente se conecte */
No newline at end of file
98 addr_len = sizeof(inf_cliente);
No newline at end of file
99 numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len);
No newline at end of file
100 if (numbytes_recibidos == -1){
No newline at end of file
101 ERROR_FATAL("Error en la recepcion de datos: recvfrom()");
No newline at end of file
102 }
No newline at end of file
103
No newline at end of file
104 /* Se procede a procesar los datos recibidos */
No newline at end of file
105 buff_peticion[numbytes_recibidos]= '\0';
No newline at end of file
106
No newline at end of file
107 /* procesamiento de la peticion */
No newline at end of file
108 rpta = procesa_peticion(buff_peticion);
No newline at end of file
109
No newline at end of file
110 //Respuesta del modulo de control
No newline at end of file
111 //
No newline at end of file
112
No newline at end of file
113
No newline at end of file
114 }
No newline at end of file
115 }
No newline at end of file
116
No newline at end of file
117 /*
No newline at end of file
118 * Esta funcion incializa el puerto GPIO
No newline at end of file
119 */
No newline at end of file
120 void inicializa_gpio(){
No newline at end of file
121
No newline at end of file
122 // Configuracion de los pines de APUNTE
No newline at end of file
123 pioc = pio_map(PIOC_BASE);
No newline at end of file
124 pio_enable(pioc, maskc_out);
No newline at end of file
125 pio_disable_irq(pioc, maskc_out);
No newline at end of file
126 pio_disable_multiple_driver(pioc, maskc_out);
No newline at end of file
127 pio_disable_pull_ups(pioc, maskc_out);
No newline at end of file
128 pio_synchronous_data_output(pioc, maskc_out);
No newline at end of file
129 pio_output_enable(pioc, maskc_out);
No newline at end of file
130
No newline at end of file
131 // Configuracion de los pines de VERIFICACION
No newline at end of file
132 piob = pio_map(PIOB_BASE);
No newline at end of file
133 pio_enable(piob, maskb_in);
No newline at end of file
134 pio_disable_irq(piob, maskb_in);
No newline at end of file
135 pio_disable_multiple_driver(piob, maskb_in);
No newline at end of file
136 pio_disable_pull_ups(piob, maskb_in);
No newline at end of file
137 pio_input_enable(piob, maskb_in);
No newline at end of file
138
No newline at end of file
139 }
No newline at end of file
140
No newline at end of file
141 /*
No newline at end of file
142 * Esta funcion procesa el mensaje de peticion y genera respuesta
No newline at end of file
143 */
No newline at end of file
144 int procesa_peticion(char *buff_peticion){
No newline at end of file
145 int rpta;
No newline at end of file
146 // char *header = strtok(buff_peticion, ":");
No newline at end of file
147 // char *ipSource = strtok(buff_peticion, ":");
No newline at end of file
148 // char *ipDestino = strtok(buff_peticion, ":");
No newline at end of file
149 char *comando = strtok(buff_peticion, ":");
No newline at end of file
150 char *valor = strtok(NULL, ":");
No newline at end of file
151
No newline at end of file
152 if ((comando == NULL) || (valor == NULL)){
No newline at end of file
153 ERROR("procesarPeticion: formato de mensaje incorrecto");
No newline at end of file
154 }
No newline at end of file
155 else{
No newline at end of file
156 if(strcmp(comando,"CARGA") == 0)
No newline at end of file
157 rpta = carga_experimento(valor);
No newline at end of file
158 else if(strcmp(comando,"CAMBIA") == 0)
No newline at end of file
159 rpta = cambia_apuntamiento(valor);
No newline at end of file
160 else if(strcmp(comando,"CHEQUEO") == 0)
No newline at end of file
161 rpta = chequeo_sistema(valor);
No newline at end of file
162 else
No newline at end of file
163 ERROR("procesa_peticion: comando no reconocido");
No newline at end of file
164 }
No newline at end of file
165
No newline at end of file
166 return rpta;
No newline at end of file
167 }
No newline at end of file
168
No newline at end of file
169
No newline at end of file
170 /*
No newline at end of file
171 * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego
No newline at end of file
172 * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato
No newline at end of file
173 * que sera usado en el cambio de apuntamiento.
No newline at end of file
174 */
No newline at end of file
175 int carga_experimento(char *nombre_archivo){
No newline at end of file
176
No newline at end of file
177 FILE *Archivo_Fd;
No newline at end of file
178
No newline at end of file
179 char *cadena = (char *) malloc(25);
No newline at end of file
180
No newline at end of file
181 int longitud_cadena;
No newline at end of file
182 int num_bytes= 0;
No newline at end of file
183 int num_filas= 0;
No newline at end of file
184
No newline at end of file
185 char ruta_archivo[50]; // Se crea la ruta para abrir el archivo
No newline at end of file
186 strcpy(ruta_archivo,"/mnt/sd/archivos/");
No newline at end of file
187 strcat(ruta_archivo,nombre_archivo);
No newline at end of file
188
No newline at end of file
189 Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada
No newline at end of file
190 if(!Archivo_Fd){
No newline at end of file
191 ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n");
No newline at end of file
192 return -1;
No newline at end of file
193 }else{
No newline at end of file
194
No newline at end of file
195 while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria
No newline at end of file
196 fgets(cadena,20,Archivo_Fd);
No newline at end of file
197 longitud_cadena= strlen(cadena);
No newline at end of file
198 cadena[longitud_cadena-1] = '\0';
No newline at end of file
199 num_bytes = num_bytes + longitud_cadena;
No newline at end of file
200 num_filas++;
No newline at end of file
201 }
No newline at end of file
202
No newline at end of file
203 rewind(Archivo_Fd); // Se reinicia el puntero del archivo
No newline at end of file
204
No newline at end of file
205 char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun
No newline at end of file
206 // la longitud del archivo
No newline at end of file
207 fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd);
No newline at end of file
208
No newline at end of file
209 char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo
No newline at end of file
210 puntero= puntero + 12;
No newline at end of file
211
No newline at end of file
212 buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3);
No newline at end of file
213 strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo
No newline at end of file
214
No newline at end of file
215 fclose(Archivo_Fd);
No newline at end of file
216
No newline at end of file
217 cambia_apuntamiento("0"); // Se apunta a la direccion 0
No newline at end of file
218
No newline at end of file
219 return 1;
No newline at end of file
220 }
No newline at end of file
221 }
No newline at end of file
222
No newline at end of file
223 /*
No newline at end of file
224 * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en
No newline at end of file
225 * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta
No newline at end of file
226 * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a
No newline at end of file
227 * traves del puerto GPIO.
No newline at end of file
228 */
No newline at end of file
229 int cambia_apuntamiento(char *puntero_char){
No newline at end of file
230
No newline at end of file
231 /*MSB-UP-LSB MSB-DOWN-LSB*/
No newline at end of file
232 int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara
No newline at end of file
233 // al dato que ingresa para formar el número
No newline at end of file
234 // entero que se le pasara al puerto GPIO
No newline at end of file
235 // Estos números son los pines del puerto GPIO
No newline at end of file
236 // que se estan usando para el control
No newline at end of file
237
No newline at end of file
238 int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero
No newline at end of file
239
No newline at end of file
240 int base= 7*puntero; // base= cantidad_bytes del dato x puntero
No newline at end of file
241 // cantidad de bytes es el numero de bytes que
No newline at end of file
242 printf("%i\n",puntero); // contiene cada dato, para este caso es 7
No newline at end of file
243 // porque es 6 bits de datos + 1 bit del cambio
No newline at end of file
244 // de linea.
No newline at end of file
245 char valor_char;
No newline at end of file
246 unsigned long valor;
No newline at end of file
247 unsigned long acumulado_ceros=0;
No newline at end of file
248 unsigned long acumulado_unos=0;
No newline at end of file
249
No newline at end of file
250 int offset; // Defino offset para el desplazamiento a traves
No newline at end of file
251 for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento"
No newline at end of file
252
No newline at end of file
253 valor_char= buff_experimento[base+offset]; // Obtengo el dato
No newline at end of file
254
No newline at end of file
255 if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno
No newline at end of file
256 valor= 0;
No newline at end of file
257 acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]);
No newline at end of file
258 }else{
No newline at end of file
259 valor= 1;
No newline at end of file
260 acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]);
No newline at end of file
261 }
No newline at end of file
262
No newline at end of file
263 }
No newline at end of file
264
No newline at end of file
265 pio_out(pioc, maskc_out, acumulado_unos, 1);
No newline at end of file
266 pio_out(pioc, maskc_out, acumulado_ceros, 0);
No newline at end of file
267
No newline at end of file
268 return 1;
No newline at end of file
269
No newline at end of file
270 }
No newline at end of file
271
No newline at end of file
272 /*
No newline at end of file
273 * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el
No newline at end of file
274 * archivo Verificacion.
No newline at end of file
275 */
No newline at end of file
276
No newline at end of file
277 int chequeo_sistema(char *numero_muestras){
No newline at end of file
278
No newline at end of file
279 char valor[7];
No newline at end of file
280 int i,cnt;
No newline at end of file
281 unsigned int entradac= 0;
No newline at end of file
282 FILE *fd;
No newline at end of file
283 fd=fopen("/mnt/sd/archivos/Verificacion","w");
No newline at end of file
284 fprintf(fd,"%s\n","Verificacion");
No newline at end of file
285 fprintf(fd,"%s\n","------------");
No newline at end of file
286 cnt=0;
No newline at end of file
287 do
No newline at end of file
288 {
No newline at end of file
289 //Inicializando arreglo
No newline at end of file
290 for(i=0;i<6;i++)
No newline at end of file
291 valor[i]='0';
No newline at end of file
292
No newline at end of file
293 valor[6]='\0';
No newline at end of file
294
No newline at end of file
295 //Lectura de puerto
No newline at end of file
296 entradac= pio_in(piob,maskb_in);
No newline at end of file
297
No newline at end of file
298 //Dandole formato al dato
No newline at end of file
299 if (!(entradac & bit_up_2))
No newline at end of file
300 valor[0] = '1';
No newline at end of file
301 if (!(entradac & bit_up_1))
No newline at end of file
302 valor[1] = '1';
No newline at end of file
303 if (!(entradac & bit_up_0))
No newline at end of file
304 valor[2] = '1';
No newline at end of file
305 if (!(entradac & bit_dow_2))
No newline at end of file
306 valor[3] = '1';
No newline at end of file
307 if (!(entradac & bit_dow_1))
No newline at end of file
308 valor[4] = '1';
No newline at end of file
309 if (!(entradac & bit_dow_0))
No newline at end of file
310 valor[5] = '1';
No newline at end of file
311
No newline at end of file
312 //Escribiendo en archivo
No newline at end of file
313 fprintf(fd,"%s\n",valor);
No newline at end of file
314 cnt=cnt+1;
No newline at end of file
315 usleep(1*1000*1000);
No newline at end of file
316
No newline at end of file
317 }while(cnt < atoi(numero_muestras));
No newline at end of file
318
No newline at end of file
319 fclose(fd);
No newline at end of file
320
No newline at end of file
321 return 1;
No newline at end of file
322 } No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now