@@ -0,0 +1,324 | |||||
|
1 | /* | |||
|
2 | * Servidor.c | |||
|
3 | * | |||
|
4 | * Created on: Nov 3, 2009 | |||
|
5 | * Author: Jose Francisco Quenta | |||
|
6 | * | |||
|
7 | * Se implementa: | |||
|
8 | * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO | |||
|
9 | * -Cambio de apunte. | |||
|
10 | * -Lectura del estado actual del apunte y grabado del mismo en un archivo | |||
|
11 | */ | |||
|
12 | ||||
|
13 | #include <stdio.h> | |||
|
14 | #include <stdlib.h> | |||
|
15 | #include <string.h> | |||
|
16 | #include <unistd.h> | |||
|
17 | #include <errno.h> | |||
|
18 | ||||
|
19 | #include <sys/types.h> | |||
|
20 | #include <sys/socket.h> | |||
|
21 | #include <netinet/in.h> | |||
|
22 | #include <arpa/inet.h> | |||
|
23 | #include <netdb.h> | |||
|
24 | ||||
|
25 | #include "./Librerias/AT91gpio_Funciones.h" | |||
|
26 | #include "./Librerias/Mensajes.h" | |||
|
27 | ||||
|
28 | #define PUERTO_SERVIDOR 5500 | |||
|
29 | #define TAM_BUFFER 100 | |||
|
30 | ||||
|
31 | #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE | |||
|
32 | ||||
|
33 | #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION | |||
|
34 | ||||
|
35 | #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB | |||
|
36 | #define bit_up_1 0x00040000 | |||
|
37 | #define bit_up_0 0x00100000 | |||
|
38 | #define bit_dow_2 0x40000000 | |||
|
39 | #define bit_dow_1 0x01000000 | |||
|
40 | #define bit_dow_0 0x00400000 | |||
|
41 | ||||
|
42 | #define MyID 11 | |||
|
43 | ||||
|
44 | char *buff_experimento= NULL; | |||
|
45 | ||||
|
46 | AT91S_PIO *pioc; | |||
|
47 | AT91S_PIO *piob; | |||
|
48 | ||||
|
49 | /* | |||
|
50 | * Zona de declaracion de cabeceras. | |||
|
51 | */ | |||
|
52 | void inicializa_gpio(); | |||
|
53 | int procesa_peticion(char *buff_peticion); | |||
|
54 | int cambia_apuntamiento(char *puntero_char); | |||
|
55 | int carga_experimento(char *nombre_archivo); | |||
|
56 | int chequeo_sistema(char *numero_muestras); | |||
|
57 | ||||
|
58 | /* | |||
|
59 | * | |||
|
60 | */ | |||
|
61 | int main(){ | |||
|
62 | ||||
|
63 | int conexion_servidorFd; | |||
|
64 | struct sockaddr_in inf_servidor; | |||
|
65 | struct sockaddr_storage inf_cliente; | |||
|
66 | int resultado; | |||
|
67 | int numbytes_recibidos; | |||
|
68 | int rpta; | |||
|
69 | ||||
|
70 | char *buff_peticion = (char *) malloc(TAM_BUFFER); | |||
|
71 | ||||
|
72 | size_t addr_len; | |||
|
73 | ||||
|
74 | memset(&inf_servidor, 0, sizeof(inf_servidor)); | |||
|
75 | inf_servidor.sin_family= AF_INET; | |||
|
76 | inf_servidor.sin_port= htons(PUERTO_SERVIDOR); | |||
|
77 | inf_servidor.sin_addr.s_addr= INADDR_ANY; | |||
|
78 | ||||
|
79 | /* Se establece el socket */ | |||
|
80 | conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0); | |||
|
81 | if (conexion_servidorFd == -1){ | |||
|
82 | ERROR_FATAL("No se establecio correctamente el socket: socket()"); | |||
|
83 | } | |||
|
84 | ||||
|
85 | /* Se asocia el socket a un puerto y una IP */ | |||
|
86 | resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); | |||
|
87 | if (resultado== -1){ | |||
|
88 | ERROR_FATAL("No se establecio correctamente el socket: bind()"); | |||
|
89 | } | |||
|
90 | ||||
|
91 | /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ | |||
|
92 | inicializa_gpio(); | |||
|
93 | ||||
|
94 | while(1){ | |||
|
95 | LOG_SERVIDOR("Esperando solicitud de cliente...\n"); | |||
|
96 | ||||
|
97 | /* Se espera hasta que un cliente se conecte */ | |||
|
98 | addr_len = sizeof(inf_cliente); | |||
|
99 | numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len); | |||
|
100 | if (numbytes_recibidos == -1){ | |||
|
101 | ERROR_FATAL("Error en la recepcion de datos: recvfrom()"); | |||
|
102 | } | |||
|
103 | ||||
|
104 | /* Se procede a procesar los datos recibidos */ | |||
|
105 | buff_peticion[numbytes_recibidos]= '\0'; | |||
|
106 | ||||
|
107 | /* procesamiento de la peticion */ | |||
|
108 | rpta = procesa_peticion(buff_peticion); | |||
|
109 | ||||
|
110 | //Respuesta del modulo de control | |||
|
111 | // | |||
|
112 | ||||
|
113 | ||||
|
114 | } | |||
|
115 | } | |||
|
116 | ||||
|
117 | ||||
|
118 | ||||
|
119 | /* | |||
|
120 | * Esta funcion incializa el puerto GPIO | |||
|
121 | */ | |||
|
122 | void inicializa_gpio(){ | |||
|
123 | ||||
|
124 | // Configuracion de los pines de APUNTE | |||
|
125 | pioc = pio_map(PIOC_BASE); | |||
|
126 | pio_enable(pioc, maskc_out); | |||
|
127 | pio_disable_irq(pioc, maskc_out); | |||
|
128 | pio_disable_multiple_driver(pioc, maskc_out); | |||
|
129 | pio_disable_pull_ups(pioc, maskc_out); | |||
|
130 | pio_synchronous_data_output(pioc, maskc_out); | |||
|
131 | pio_output_enable(pioc, maskc_out); | |||
|
132 | ||||
|
133 | // Configuracion de los pines de VERIFICACION | |||
|
134 | piob = pio_map(PIOB_BASE); | |||
|
135 | pio_enable(piob, maskb_in); | |||
|
136 | pio_disable_irq(piob, maskb_in); | |||
|
137 | pio_disable_multiple_driver(piob, maskb_in); | |||
|
138 | pio_disable_pull_ups(piob, maskb_in); | |||
|
139 | pio_input_enable(piob, maskb_in); | |||
|
140 | ||||
|
141 | } | |||
|
142 | ||||
|
143 | /* | |||
|
144 | * Esta funcion procesa el mensaje de peticion y genera respuesta | |||
|
145 | */ | |||
|
146 | int procesa_peticion(char *buff_peticion){ | |||
|
147 | int rpta; | |||
|
148 | // char *header = strtok(buff_peticion, ":"); | |||
|
149 | // char *ipSource = strtok(buff_peticion, ":"); | |||
|
150 | // char *ipDestino = strtok(buff_peticion, ":"); | |||
|
151 | char *comando = strtok(buff_peticion, ":"); | |||
|
152 | char *valor = strtok(NULL, ":"); | |||
|
153 | ||||
|
154 | if ((comando == NULL) || (valor == NULL)){ | |||
|
155 | ERROR("procesarPeticion: formato de mensaje incorrecto"); | |||
|
156 | } | |||
|
157 | else{ | |||
|
158 | if(strcmp(comando,"CARGA") == 0) | |||
|
159 | rpta = carga_experimento(valor); | |||
|
160 | else if(strcmp(comando,"CAMBIA") == 0) | |||
|
161 | rpta = cambia_apuntamiento(valor); | |||
|
162 | else if(strcmp(comando,"CHEQUEO") == 0) | |||
|
163 | rpta = chequeo_sistema(valor); | |||
|
164 | else | |||
|
165 | ERROR("procesa_peticion: comando no reconocido"); | |||
|
166 | } | |||
|
167 | ||||
|
168 | return rpta; | |||
|
169 | } | |||
|
170 | ||||
|
171 | ||||
|
172 | /* | |||
|
173 | * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego | |||
|
174 | * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato | |||
|
175 | * que sera usado en el cambio de apuntamiento. | |||
|
176 | */ | |||
|
177 | int carga_experimento(char *nombre_archivo){ | |||
|
178 | ||||
|
179 | FILE *Archivo_Fd; | |||
|
180 | ||||
|
181 | char *cadena = (char *) malloc(25); | |||
|
182 | ||||
|
183 | int longitud_cadena; | |||
|
184 | int num_bytes= 0; | |||
|
185 | int num_filas= 0; | |||
|
186 | ||||
|
187 | char ruta_archivo[50]; // Se crea la ruta para abrir el archivo | |||
|
188 | strcpy(ruta_archivo,"/mnt/sd/archivos/"); | |||
|
189 | strcat(ruta_archivo,nombre_archivo); | |||
|
190 | ||||
|
191 | Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada | |||
|
192 | if(!Archivo_Fd){ | |||
|
193 | ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); | |||
|
194 | return -1; | |||
|
195 | }else{ | |||
|
196 | ||||
|
197 | while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria | |||
|
198 | fgets(cadena,20,Archivo_Fd); | |||
|
199 | longitud_cadena= strlen(cadena); | |||
|
200 | cadena[longitud_cadena-1] = '\0'; | |||
|
201 | num_bytes = num_bytes + longitud_cadena; | |||
|
202 | num_filas++; | |||
|
203 | } | |||
|
204 | ||||
|
205 | rewind(Archivo_Fd); // Se reinicia el puntero del archivo | |||
|
206 | ||||
|
207 | char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun | |||
|
208 | // la longitud del archivo | |||
|
209 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); | |||
|
210 | ||||
|
211 | char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo | |||
|
212 | puntero= puntero + 12; | |||
|
213 | ||||
|
214 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); | |||
|
215 | strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo | |||
|
216 | ||||
|
217 | fclose(Archivo_Fd); | |||
|
218 | ||||
|
219 | cambia_apuntamiento("0"); // Se apunta a la direccion 0 | |||
|
220 | ||||
|
221 | return 1; | |||
|
222 | } | |||
|
223 | } | |||
|
224 | ||||
|
225 | /* | |||
|
226 | * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en | |||
|
227 | * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta | |||
|
228 | * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a | |||
|
229 | * traves del puerto GPIO. | |||
|
230 | */ | |||
|
231 | int cambia_apuntamiento(char *puntero_char){ | |||
|
232 | ||||
|
233 | /*MSB-UP-LSB MSB-DOWN-LSB*/ | |||
|
234 | int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara | |||
|
235 | // al dato que ingresa para formar el número | |||
|
236 | // entero que se le pasara al puerto GPIO | |||
|
237 | // Estos números son los pines del puerto GPIO | |||
|
238 | // que se estan usando para el control | |||
|
239 | ||||
|
240 | int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero | |||
|
241 | ||||
|
242 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero | |||
|
243 | // cantidad de bytes es el numero de bytes que | |||
|
244 | printf("%i\n",puntero); // contiene cada dato, para este caso es 7 | |||
|
245 | // porque es 6 bits de datos + 1 bit del cambio | |||
|
246 | // de linea. | |||
|
247 | char valor_char; | |||
|
248 | unsigned long valor; | |||
|
249 | unsigned long acumulado_ceros=0; | |||
|
250 | unsigned long acumulado_unos=0; | |||
|
251 | ||||
|
252 | int offset; // Defino offset para el desplazamiento a traves | |||
|
253 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" | |||
|
254 | ||||
|
255 | valor_char= buff_experimento[base+offset]; // Obtengo el dato | |||
|
256 | ||||
|
257 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno | |||
|
258 | valor= 0; | |||
|
259 | acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); | |||
|
260 | }else{ | |||
|
261 | valor= 1; | |||
|
262 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); | |||
|
263 | } | |||
|
264 | ||||
|
265 | } | |||
|
266 | ||||
|
267 | pio_out(pioc, maskc_out, acumulado_unos, 1); | |||
|
268 | pio_out(pioc, maskc_out, acumulado_ceros, 0); | |||
|
269 | ||||
|
270 | return 1; | |||
|
271 | ||||
|
272 | } | |||
|
273 | ||||
|
274 | /* | |||
|
275 | * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el | |||
|
276 | * archivo Verificacion. | |||
|
277 | */ | |||
|
278 | ||||
|
279 | int chequeo_sistema(char *numero_muestras){ | |||
|
280 | ||||
|
281 | char valor[7]; | |||
|
282 | int i,cnt; | |||
|
283 | unsigned int entradac= 0; | |||
|
284 | FILE *fd; | |||
|
285 | fd=fopen("/mnt/sd/archivos/Verificacion","w"); | |||
|
286 | fprintf(fd,"%s\n","Verificacion"); | |||
|
287 | fprintf(fd,"%s\n","------------"); | |||
|
288 | cnt=0; | |||
|
289 | do | |||
|
290 | { | |||
|
291 | //Inicializando arreglo | |||
|
292 | for(i=0;i<6;i++) | |||
|
293 | valor[i]='0'; | |||
|
294 | ||||
|
295 | valor[6]='\0'; | |||
|
296 | ||||
|
297 | //Lectura de puerto | |||
|
298 | entradac= pio_in(piob,maskb_in); | |||
|
299 | ||||
|
300 | //Dandole formato al dato | |||
|
301 | if (!(entradac & bit_up_2)) | |||
|
302 | valor[0] = '1'; | |||
|
303 | if (!(entradac & bit_up_1)) | |||
|
304 | valor[1] = '1'; | |||
|
305 | if (!(entradac & bit_up_0)) | |||
|
306 | valor[2] = '1'; | |||
|
307 | if (!(entradac & bit_dow_2)) | |||
|
308 | valor[3] = '1'; | |||
|
309 | if (!(entradac & bit_dow_1)) | |||
|
310 | valor[4] = '1'; | |||
|
311 | if (!(entradac & bit_dow_0)) | |||
|
312 | valor[5] = '1'; | |||
|
313 | ||||
|
314 | //Escribiendo en archivo | |||
|
315 | fprintf(fd,"%s\n",valor); | |||
|
316 | cnt=cnt+1; | |||
|
317 | usleep(1*1000*1000); | |||
|
318 | ||||
|
319 | }while(cnt < atoi(numero_muestras)); | |||
|
320 | ||||
|
321 | fclose(fd); | |||
|
322 | ||||
|
323 | return 1; | |||
|
324 | } |
@@ -1,219 +1,221 | |||||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
2 | <?fileVersion 4.0.0?> |
|
2 | <?fileVersion 4.0.0?> | |
3 |
|
3 | |||
4 | <cproject> |
|
4 | <cproject> | |
5 | <storageModule moduleId="org.eclipse.cdt.core.settings"> |
|
5 | <storageModule moduleId="org.eclipse.cdt.core.settings"> | |
6 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1568263498"> |
|
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"> |
|
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/> |
|
8 | <externalSettings/> | |
9 | <extensions> |
|
9 | <extensions> | |
10 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> |
|
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"/> |
|
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"/> |
|
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"/> |
|
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"/> |
|
14 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
15 | </extensions> |
|
15 | </extensions> | |
16 | </storageModule> |
|
16 | </storageModule> | |
17 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
|
17 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
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"> |
|
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"> | |
19 | <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1568263498." name="/" resourcePath=""> |
|
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"> |
|
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"/> | |
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"/> |
|
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"/> | |
23 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.1343949145" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> |
|
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"> |
|
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"/> |
|
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"/> |
|
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> |
|
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"> |
|
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"/> |
|
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"/> |
|
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"/> |
|
31 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1347535566" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> | |
32 | </tool> |
|
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"> |
|
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 | <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2046701530" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> |
|
34 | <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)"/> |
|
35 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | |
36 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> |
|
36 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> | |
37 | </inputType> |
|
37 | </inputType> | |
38 | </tool> |
|
38 | </tool> | |
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"/> |
|
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"/> | |
40 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.796779267" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> |
|
40 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.796779267" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> | |
41 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> |
|
41 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> | |
42 | </tool> |
|
42 | </tool> | |
43 | </toolChain> |
|
43 | </toolChain> | |
44 | </folderInfo> |
|
44 | </folderInfo> | |
45 | </configuration> |
|
45 | </configuration> | |
46 | </storageModule> |
|
46 | </storageModule> | |
47 | <storageModule moduleId="scannerConfiguration"> |
|
47 | <storageModule moduleId="scannerConfiguration"> | |
48 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> |
|
48 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> | |
49 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
|
49 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> | |
50 | <buildOutputProvider> |
|
50 | <buildOutputProvider> | |
51 | <openAction enabled="true" filePath=""/> |
|
51 | <openAction enabled="true" filePath=""/> | |
52 | <parser enabled="true"/> |
|
52 | <parser enabled="true"/> | |
53 | </buildOutputProvider> |
|
53 | </buildOutputProvider> | |
54 | <scannerInfoProvider id="specsFile"> |
|
54 | <scannerInfoProvider id="specsFile"> | |
55 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
55 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
56 | <parser enabled="true"/> |
|
56 | <parser enabled="true"/> | |
57 | </scannerInfoProvider> |
|
57 | </scannerInfoProvider> | |
58 | </profile> |
|
58 | </profile> | |
59 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
|
59 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> | |
60 | <buildOutputProvider> |
|
60 | <buildOutputProvider> | |
61 | <openAction enabled="true" filePath=""/> |
|
61 | <openAction enabled="true" filePath=""/> | |
62 | <parser enabled="true"/> |
|
62 | <parser enabled="true"/> | |
63 | </buildOutputProvider> |
|
63 | </buildOutputProvider> | |
64 | <scannerInfoProvider id="makefileGenerator"> |
|
64 | <scannerInfoProvider id="makefileGenerator"> | |
65 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> |
|
65 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> | |
66 | <parser enabled="true"/> |
|
66 | <parser enabled="true"/> | |
67 | </scannerInfoProvider> |
|
67 | </scannerInfoProvider> | |
68 | </profile> |
|
68 | </profile> | |
69 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
|
69 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> | |
70 | <buildOutputProvider> |
|
70 | <buildOutputProvider> | |
71 | <openAction enabled="true" filePath=""/> |
|
71 | <openAction enabled="true" filePath=""/> | |
72 | <parser enabled="true"/> |
|
72 | <parser enabled="true"/> | |
73 | </buildOutputProvider> |
|
73 | </buildOutputProvider> | |
74 | <scannerInfoProvider id="specsFile"> |
|
74 | <scannerInfoProvider id="specsFile"> | |
75 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
75 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
76 | <parser enabled="true"/> |
|
76 | <parser enabled="true"/> | |
77 | </scannerInfoProvider> |
|
77 | </scannerInfoProvider> | |
78 | </profile> |
|
78 | </profile> | |
79 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
|
79 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> | |
80 | <buildOutputProvider> |
|
80 | <buildOutputProvider> | |
81 | <openAction enabled="true" filePath=""/> |
|
81 | <openAction enabled="true" filePath=""/> | |
82 | <parser enabled="true"/> |
|
82 | <parser enabled="true"/> | |
83 | </buildOutputProvider> |
|
83 | </buildOutputProvider> | |
84 | <scannerInfoProvider id="specsFile"> |
|
84 | <scannerInfoProvider id="specsFile"> | |
85 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
|
85 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> | |
86 | <parser enabled="true"/> |
|
86 | <parser enabled="true"/> | |
87 | </scannerInfoProvider> |
|
87 | </scannerInfoProvider> | |
88 | </profile> |
|
88 | </profile> | |
89 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
|
89 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> | |
90 | <buildOutputProvider> |
|
90 | <buildOutputProvider> | |
91 | <openAction enabled="true" filePath=""/> |
|
91 | <openAction enabled="true" filePath=""/> | |
92 | <parser enabled="true"/> |
|
92 | <parser enabled="true"/> | |
93 | </buildOutputProvider> |
|
93 | </buildOutputProvider> | |
94 | <scannerInfoProvider id="specsFile"> |
|
94 | <scannerInfoProvider id="specsFile"> | |
95 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
|
95 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> | |
96 | <parser enabled="true"/> |
|
96 | <parser enabled="true"/> | |
97 | </scannerInfoProvider> |
|
97 | </scannerInfoProvider> | |
98 | </profile> |
|
98 | </profile> | |
99 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
|
99 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> | |
100 | <buildOutputProvider> |
|
100 | <buildOutputProvider> | |
101 | <openAction enabled="true" filePath=""/> |
|
101 | <openAction enabled="true" filePath=""/> | |
102 | <parser enabled="true"/> |
|
102 | <parser enabled="true"/> | |
103 | </buildOutputProvider> |
|
103 | </buildOutputProvider> | |
104 | <scannerInfoProvider id="specsFile"> |
|
104 | <scannerInfoProvider id="specsFile"> | |
105 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
105 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
106 | <parser enabled="true"/> |
|
106 | <parser enabled="true"/> | |
107 | </scannerInfoProvider> |
|
107 | </scannerInfoProvider> | |
108 | </profile> |
|
108 | </profile> | |
109 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
|
109 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> | |
110 | <buildOutputProvider> |
|
110 | <buildOutputProvider> | |
111 | <openAction enabled="true" filePath=""/> |
|
111 | <openAction enabled="true" filePath=""/> | |
112 | <parser enabled="true"/> |
|
112 | <parser enabled="true"/> | |
113 | </buildOutputProvider> |
|
113 | </buildOutputProvider> | |
114 | <scannerInfoProvider id="specsFile"> |
|
114 | <scannerInfoProvider id="specsFile"> | |
115 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
|
115 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> | |
116 | <parser enabled="true"/> |
|
116 | <parser enabled="true"/> | |
117 | </scannerInfoProvider> |
|
117 | </scannerInfoProvider> | |
118 | </profile> |
|
118 | </profile> | |
119 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
|
119 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> | |
120 | <buildOutputProvider> |
|
120 | <buildOutputProvider> | |
121 | <openAction enabled="true" filePath=""/> |
|
121 | <openAction enabled="true" filePath=""/> | |
122 | <parser enabled="true"/> |
|
122 | <parser enabled="true"/> | |
123 | </buildOutputProvider> |
|
123 | </buildOutputProvider> | |
124 | <scannerInfoProvider id="specsFile"> |
|
124 | <scannerInfoProvider id="specsFile"> | |
125 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
|
125 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> | |
126 | <parser enabled="true"/> |
|
126 | <parser enabled="true"/> | |
127 | </scannerInfoProvider> |
|
127 | </scannerInfoProvider> | |
128 | </profile> |
|
128 | </profile> | |
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"> |
|
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"> | |
130 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> |
|
130 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> | |
131 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
|
131 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> | |
132 | <buildOutputProvider> |
|
132 | <buildOutputProvider> | |
133 | <openAction enabled="true" filePath=""/> |
|
133 | <openAction enabled="true" filePath=""/> | |
134 | <parser enabled="true"/> |
|
134 | <parser enabled="true"/> | |
135 | </buildOutputProvider> |
|
135 | </buildOutputProvider> | |
136 | <scannerInfoProvider id="specsFile"> |
|
136 | <scannerInfoProvider id="specsFile"> | |
137 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
137 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
138 | <parser enabled="true"/> |
|
138 | <parser enabled="true"/> | |
139 | </scannerInfoProvider> |
|
139 | </scannerInfoProvider> | |
140 | </profile> |
|
140 | </profile> | |
141 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
|
141 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> | |
142 | <buildOutputProvider> |
|
142 | <buildOutputProvider> | |
143 | <openAction enabled="true" filePath=""/> |
|
143 | <openAction enabled="true" filePath=""/> | |
144 | <parser enabled="true"/> |
|
144 | <parser enabled="true"/> | |
145 | </buildOutputProvider> |
|
145 | </buildOutputProvider> | |
146 | <scannerInfoProvider id="makefileGenerator"> |
|
146 | <scannerInfoProvider id="makefileGenerator"> | |
147 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> |
|
147 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> | |
148 | <parser enabled="true"/> |
|
148 | <parser enabled="true"/> | |
149 | </scannerInfoProvider> |
|
149 | </scannerInfoProvider> | |
150 | </profile> |
|
150 | </profile> | |
151 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
|
151 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> | |
152 | <buildOutputProvider> |
|
152 | <buildOutputProvider> | |
153 | <openAction enabled="true" filePath=""/> |
|
153 | <openAction enabled="true" filePath=""/> | |
154 | <parser enabled="true"/> |
|
154 | <parser enabled="true"/> | |
155 | </buildOutputProvider> |
|
155 | </buildOutputProvider> | |
156 | <scannerInfoProvider id="specsFile"> |
|
156 | <scannerInfoProvider id="specsFile"> | |
157 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
157 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
158 | <parser enabled="true"/> |
|
158 | <parser enabled="true"/> | |
159 | </scannerInfoProvider> |
|
159 | </scannerInfoProvider> | |
160 | </profile> |
|
160 | </profile> | |
161 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
|
161 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> | |
162 | <buildOutputProvider> |
|
162 | <buildOutputProvider> | |
163 | <openAction enabled="true" filePath=""/> |
|
163 | <openAction enabled="true" filePath=""/> | |
164 | <parser enabled="true"/> |
|
164 | <parser enabled="true"/> | |
165 | </buildOutputProvider> |
|
165 | </buildOutputProvider> | |
166 | <scannerInfoProvider id="specsFile"> |
|
166 | <scannerInfoProvider id="specsFile"> | |
167 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
|
167 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> | |
168 | <parser enabled="true"/> |
|
168 | <parser enabled="true"/> | |
169 | </scannerInfoProvider> |
|
169 | </scannerInfoProvider> | |
170 | </profile> |
|
170 | </profile> | |
171 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
|
171 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> | |
172 | <buildOutputProvider> |
|
172 | <buildOutputProvider> | |
173 | <openAction enabled="true" filePath=""/> |
|
173 | <openAction enabled="true" filePath=""/> | |
174 | <parser enabled="true"/> |
|
174 | <parser enabled="true"/> | |
175 | </buildOutputProvider> |
|
175 | </buildOutputProvider> | |
176 | <scannerInfoProvider id="specsFile"> |
|
176 | <scannerInfoProvider id="specsFile"> | |
177 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
|
177 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> | |
178 | <parser enabled="true"/> |
|
178 | <parser enabled="true"/> | |
179 | </scannerInfoProvider> |
|
179 | </scannerInfoProvider> | |
180 | </profile> |
|
180 | </profile> | |
181 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
|
181 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> | |
182 | <buildOutputProvider> |
|
182 | <buildOutputProvider> | |
183 | <openAction enabled="true" filePath=""/> |
|
183 | <openAction enabled="true" filePath=""/> | |
184 | <parser enabled="true"/> |
|
184 | <parser enabled="true"/> | |
185 | </buildOutputProvider> |
|
185 | </buildOutputProvider> | |
186 | <scannerInfoProvider id="specsFile"> |
|
186 | <scannerInfoProvider id="specsFile"> | |
187 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
|
187 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> | |
188 | <parser enabled="true"/> |
|
188 | <parser enabled="true"/> | |
189 | </scannerInfoProvider> |
|
189 | </scannerInfoProvider> | |
190 | </profile> |
|
190 | </profile> | |
191 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
|
191 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> | |
192 | <buildOutputProvider> |
|
192 | <buildOutputProvider> | |
193 | <openAction enabled="true" filePath=""/> |
|
193 | <openAction enabled="true" filePath=""/> | |
194 | <parser enabled="true"/> |
|
194 | <parser enabled="true"/> | |
195 | </buildOutputProvider> |
|
195 | </buildOutputProvider> | |
196 | <scannerInfoProvider id="specsFile"> |
|
196 | <scannerInfoProvider id="specsFile"> | |
197 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
|
197 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> | |
198 | <parser enabled="true"/> |
|
198 | <parser enabled="true"/> | |
199 | </scannerInfoProvider> |
|
199 | </scannerInfoProvider> | |
200 | </profile> |
|
200 | </profile> | |
201 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
|
201 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> | |
202 | <buildOutputProvider> |
|
202 | <buildOutputProvider> | |
203 | <openAction enabled="true" filePath=""/> |
|
203 | <openAction enabled="true" filePath=""/> | |
204 | <parser enabled="true"/> |
|
204 | <parser enabled="true"/> | |
205 | </buildOutputProvider> |
|
205 | </buildOutputProvider> | |
206 | <scannerInfoProvider id="specsFile"> |
|
206 | <scannerInfoProvider id="specsFile"> | |
207 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
|
207 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> | |
208 | <parser enabled="true"/> |
|
208 | <parser enabled="true"/> | |
209 | </scannerInfoProvider> |
|
209 | </scannerInfoProvider> | |
210 | </profile> |
|
210 | </profile> | |
211 | </scannerConfigBuildInfo> |
|
211 | </scannerConfigBuildInfo> | |
212 | </storageModule> |
|
212 | </storageModule> | |
213 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> |
|
213 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |
|
214 | <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> | |||
|
215 | <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> | |||
214 | </cconfiguration> |
|
216 | </cconfiguration> | |
215 | </storageModule> |
|
217 | </storageModule> | |
216 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
|
218 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
217 | <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> |
|
219 | <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> | |
218 | </storageModule> |
|
220 | </storageModule> | |
219 | </cproject> |
|
221 | </cproject> |
@@ -1,81 +1,81 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <projectDescription> |
|
2 | <projectDescription> | |
3 | <name>Control_Module</name> |
|
3 | <name>Control_Module_test</name> | |
4 | <comment></comment> |
|
4 | <comment></comment> | |
5 | <projects> |
|
5 | <projects> | |
6 | </projects> |
|
6 | </projects> | |
7 | <buildSpec> |
|
7 | <buildSpec> | |
8 | <buildCommand> |
|
8 | <buildCommand> | |
9 | <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> |
|
9 | <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | |
10 | <triggers>clean,full,incremental,</triggers> |
|
10 | <triggers>clean,full,incremental,</triggers> | |
11 | <arguments> |
|
11 | <arguments> | |
12 | <dictionary> |
|
12 | <dictionary> | |
13 | <key>?name?</key> |
|
13 | <key>?name?</key> | |
14 | <value></value> |
|
14 | <value></value> | |
15 | </dictionary> |
|
15 | </dictionary> | |
16 | <dictionary> |
|
16 | <dictionary> | |
17 | <key>org.eclipse.cdt.make.core.append_environment</key> |
|
17 | <key>org.eclipse.cdt.make.core.append_environment</key> | |
18 | <value>true</value> |
|
18 | <value>true</value> | |
19 | </dictionary> |
|
19 | </dictionary> | |
20 | <dictionary> |
|
20 | <dictionary> | |
21 | <key>org.eclipse.cdt.make.core.autoBuildTarget</key> |
|
21 | <key>org.eclipse.cdt.make.core.autoBuildTarget</key> | |
22 | <value>all</value> |
|
22 | <value>all</value> | |
23 | </dictionary> |
|
23 | </dictionary> | |
24 | <dictionary> |
|
24 | <dictionary> | |
25 | <key>org.eclipse.cdt.make.core.buildArguments</key> |
|
25 | <key>org.eclipse.cdt.make.core.buildArguments</key> | |
26 | <value></value> |
|
26 | <value></value> | |
27 | </dictionary> |
|
27 | </dictionary> | |
28 | <dictionary> |
|
28 | <dictionary> | |
29 | <key>org.eclipse.cdt.make.core.buildCommand</key> |
|
29 | <key>org.eclipse.cdt.make.core.buildCommand</key> | |
30 | <value>make</value> |
|
30 | <value>make</value> | |
31 | </dictionary> |
|
31 | </dictionary> | |
32 | <dictionary> |
|
32 | <dictionary> | |
33 | <key>org.eclipse.cdt.make.core.buildLocation</key> |
|
33 | <key>org.eclipse.cdt.make.core.buildLocation</key> | |
34 | <value>${workspace_loc:/Control_Module/Release}</value> |
|
34 | <value>${workspace_loc:/Control_Module/Release}</value> | |
35 | </dictionary> |
|
35 | </dictionary> | |
36 | <dictionary> |
|
36 | <dictionary> | |
37 | <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> |
|
37 | <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> | |
38 | <value>clean</value> |
|
38 | <value>clean</value> | |
39 | </dictionary> |
|
39 | </dictionary> | |
40 | <dictionary> |
|
40 | <dictionary> | |
41 | <key>org.eclipse.cdt.make.core.contents</key> |
|
41 | <key>org.eclipse.cdt.make.core.contents</key> | |
42 | <value>org.eclipse.cdt.make.core.activeConfigSettings</value> |
|
42 | <value>org.eclipse.cdt.make.core.activeConfigSettings</value> | |
43 | </dictionary> |
|
43 | </dictionary> | |
44 | <dictionary> |
|
44 | <dictionary> | |
45 | <key>org.eclipse.cdt.make.core.enableAutoBuild</key> |
|
45 | <key>org.eclipse.cdt.make.core.enableAutoBuild</key> | |
46 | <value>false</value> |
|
46 | <value>false</value> | |
47 | </dictionary> |
|
47 | </dictionary> | |
48 | <dictionary> |
|
48 | <dictionary> | |
49 | <key>org.eclipse.cdt.make.core.enableCleanBuild</key> |
|
49 | <key>org.eclipse.cdt.make.core.enableCleanBuild</key> | |
50 | <value>true</value> |
|
50 | <value>true</value> | |
51 | </dictionary> |
|
51 | </dictionary> | |
52 | <dictionary> |
|
52 | <dictionary> | |
53 | <key>org.eclipse.cdt.make.core.enableFullBuild</key> |
|
53 | <key>org.eclipse.cdt.make.core.enableFullBuild</key> | |
54 | <value>true</value> |
|
54 | <value>true</value> | |
55 | </dictionary> |
|
55 | </dictionary> | |
56 | <dictionary> |
|
56 | <dictionary> | |
57 | <key>org.eclipse.cdt.make.core.fullBuildTarget</key> |
|
57 | <key>org.eclipse.cdt.make.core.fullBuildTarget</key> | |
58 | <value>all</value> |
|
58 | <value>all</value> | |
59 | </dictionary> |
|
59 | </dictionary> | |
60 | <dictionary> |
|
60 | <dictionary> | |
61 | <key>org.eclipse.cdt.make.core.stopOnError</key> |
|
61 | <key>org.eclipse.cdt.make.core.stopOnError</key> | |
62 | <value>true</value> |
|
62 | <value>true</value> | |
63 | </dictionary> |
|
63 | </dictionary> | |
64 | <dictionary> |
|
64 | <dictionary> | |
65 | <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> |
|
65 | <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> | |
66 | <value>true</value> |
|
66 | <value>true</value> | |
67 | </dictionary> |
|
67 | </dictionary> | |
68 | </arguments> |
|
68 | </arguments> | |
69 | </buildCommand> |
|
69 | </buildCommand> | |
70 | <buildCommand> |
|
70 | <buildCommand> | |
71 | <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> |
|
71 | <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | |
72 | <arguments> |
|
72 | <arguments> | |
73 | </arguments> |
|
73 | </arguments> | |
74 | </buildCommand> |
|
74 | </buildCommand> | |
75 | </buildSpec> |
|
75 | </buildSpec> | |
76 | <natures> |
|
76 | <natures> | |
77 | <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> |
|
77 | <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | |
78 | <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> |
|
78 | <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | |
79 | <nature>org.eclipse.cdt.core.cnature</nature> |
|
79 | <nature>org.eclipse.cdt.core.cnature</nature> | |
80 | </natures> |
|
80 | </natures> | |
81 | </projectDescription> |
|
81 | </projectDescription> |
@@ -1,322 +1,330 | |||||
1 | /* |
|
1 | /* | |
2 | * Servidor.c |
|
2 | * Servidor.c | |
3 | * |
|
3 | * | |
4 | * Created on: Nov 3, 2009 |
|
4 | * Created on: Nov 3, 2009 | |
5 | * Author: Jose Francisco Quenta |
|
5 | * Author: Jose Francisco Quenta | |
6 | * |
|
6 | * | |
7 | * Se implementa: |
|
7 | * Se implementa: | |
8 | * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO |
|
8 | * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO | |
9 | * -Cambio de apunte. |
|
9 | * -Cambio de apunte. | |
10 | * -Lectura del estado actual del apunte y grabado del mismo en un archivo |
|
10 | * -Lectura del estado actual del apunte y grabado del mismo en un archivo | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include <stdio.h> |
|
13 | #include <stdio.h> | |
14 | #include <stdlib.h> |
|
14 | #include <stdlib.h> | |
15 | #include <string.h> |
|
15 | #include <string.h> | |
16 | #include <unistd.h> |
|
16 | #include <unistd.h> | |
17 | #include <errno.h> |
|
17 | #include <errno.h> | |
18 |
|
18 | |||
19 | #include <sys/types.h> |
|
19 | #include <sys/types.h> | |
20 | #include <sys/socket.h> |
|
20 | #include <sys/socket.h> | |
21 | #include <netinet/in.h> |
|
21 | #include <netinet/in.h> | |
22 | #include <arpa/inet.h> |
|
22 | #include <arpa/inet.h> | |
23 | #include <netdb.h> |
|
23 | #include <netdb.h> | |
24 |
|
24 | |||
25 | #include "./Librerias/AT91gpio_Funciones.h" |
|
25 | #include "./Librerias/AT91gpio_Funciones.h" | |
26 | #include "./Librerias/Mensajes.h" |
|
26 | #include "./Librerias/Mensajes.h" | |
27 |
|
27 | |||
28 | #define PUERTO_SERVIDOR 5500 |
|
28 | #define PUERTO_SERVIDOR 5500 | |
29 | #define TAM_BUFFER 100 |
|
29 | #define TAM_BUFFER 100 | |
30 |
|
30 | |||
31 | #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE |
|
31 | #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE | |
32 |
|
32 | |||
33 | #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION |
|
33 | #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION | |
34 |
|
34 | |||
35 | #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB |
|
35 | #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB | |
36 | #define bit_up_1 0x00040000 |
|
36 | #define bit_up_1 0x00040000 | |
37 | #define bit_up_0 0x00100000 |
|
37 | #define bit_up_0 0x00100000 | |
38 | #define bit_dow_2 0x40000000 |
|
38 | #define bit_dow_2 0x40000000 | |
39 | #define bit_dow_1 0x01000000 |
|
39 | #define bit_dow_1 0x01000000 | |
40 | #define bit_dow_0 0x00400000 |
|
40 | #define bit_dow_0 0x00400000 | |
41 |
|
41 | |||
42 | #define MyID 11 |
|
42 | #define MyID 11 | |
43 |
|
43 | |||
44 | char *buff_experimento= NULL; |
|
44 | char *buff_experimento= NULL; | |
45 |
|
45 | |||
46 | AT91S_PIO *pioc; |
|
46 | AT91S_PIO *pioc; | |
47 | AT91S_PIO *piob; |
|
47 | AT91S_PIO *piob; | |
48 |
|
48 | |||
49 | /* |
|
49 | /* | |
50 | * Zona de declaracion de cabeceras. |
|
50 | * Zona de declaracion de cabeceras. | |
51 | */ |
|
51 | */ | |
52 | void inicializa_gpio(); |
|
52 | void inicializa_gpio(); | |
53 | int procesa_peticion(char *buff_peticion); |
|
53 | int procesa_peticion(char *buff_peticion); | |
54 | int cambia_apuntamiento(char *puntero_char); |
|
54 | int cambia_apuntamiento(char *puntero_char); | |
55 | int carga_experimento(char *nombre_archivo); |
|
55 | int carga_experimento(char *nombre_archivo); | |
56 | int chequeo_sistema(char *numero_muestras); |
|
56 | int chequeo_sistema(char *numero_muestras); | |
57 |
|
57 | |||
58 | /* |
|
58 | /* | |
59 | * |
|
59 | * | |
60 | */ |
|
60 | */ | |
61 | int main(){ |
|
61 | int main(){ | |
62 |
|
62 | |||
63 | int conexion_servidorFd; |
|
63 | int conexion_servidorFd; | |
64 | struct sockaddr_in inf_servidor; |
|
64 | struct sockaddr_in inf_servidor; | |
65 | struct sockaddr_storage inf_cliente; |
|
65 | struct sockaddr_storage inf_cliente; | |
66 | int resultado; |
|
66 | int resultado; | |
67 | int numbytes_recibidos; |
|
67 | int numbytes_recibidos; | |
68 | int rpta; |
|
68 | int rpta; | |
|
69 | int numbytes_enviados; | |||
69 |
|
70 | |||
70 | char *buff_peticion = (char *) malloc(TAM_BUFFER); |
|
71 | char *buff_peticion = (char *) malloc(TAM_BUFFER); | |
71 |
|
72 | |||
72 | size_t addr_len; |
|
73 | size_t addr_len; | |
73 |
|
74 | |||
74 | memset(&inf_servidor, 0, sizeof(inf_servidor)); |
|
75 | memset(&inf_servidor, 0, sizeof(inf_servidor)); | |
75 | inf_servidor.sin_family= AF_INET; |
|
76 | inf_servidor.sin_family= AF_INET; | |
76 | inf_servidor.sin_port= htons(PUERTO_SERVIDOR); |
|
77 | inf_servidor.sin_port= htons(PUERTO_SERVIDOR); | |
77 | inf_servidor.sin_addr.s_addr= INADDR_ANY; |
|
78 | inf_servidor.sin_addr.s_addr= INADDR_ANY; | |
78 |
|
79 | |||
79 | /* Se establece el socket */ |
|
80 | /* Se establece el socket */ | |
80 | conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0); |
|
81 | conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0); | |
81 | if (conexion_servidorFd == -1){ |
|
82 | if (conexion_servidorFd == -1){ | |
82 | ERROR_FATAL("No se establecio correctamente el socket: socket()"); |
|
83 | ERROR_FATAL("No se establecio correctamente el socket: socket()"); | |
83 | } |
|
84 | } | |
84 |
|
85 | |||
85 | /* Se asocia el socket a un puerto y una IP */ |
|
86 | /* Se asocia el socket a un puerto y una IP */ | |
86 | resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); |
|
87 | resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); | |
87 | if (resultado== -1){ |
|
88 | if (resultado== -1){ | |
88 | ERROR_FATAL("No se establecio correctamente el socket: bind()"); |
|
89 | ERROR_FATAL("No se establecio correctamente el socket: bind()"); | |
89 | } |
|
90 | } | |
90 |
|
91 | |||
91 | /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ |
|
92 | /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ | |
92 | inicializa_gpio(); |
|
93 | inicializa_gpio(); | |
93 |
|
94 | |||
94 | while(1){ |
|
95 | while(1){ | |
95 | LOG_SERVIDOR("Esperando solicitud de cliente...\n"); |
|
96 | LOG_SERVIDOR("Esperando solicitud de cliente...\n"); | |
96 |
|
97 | |||
97 | /* Se espera hasta que un cliente se conecte */ |
|
98 | /* Se espera hasta que un cliente se conecte */ | |
98 | addr_len = sizeof(inf_cliente); |
|
99 | addr_len = sizeof(inf_cliente); | |
99 | numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len); |
|
100 | numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len); | |
100 | if (numbytes_recibidos == -1){ |
|
101 | if (numbytes_recibidos == -1){ | |
101 | ERROR_FATAL("Error en la recepcion de datos: recvfrom()"); |
|
102 | ERROR_FATAL("Error en la recepcion de datos: recvfrom()"); | |
102 | } |
|
103 | } | |
103 |
|
104 | |||
104 | /* Se procede a procesar los datos recibidos */ |
|
105 | /* Se procede a procesar los datos recibidos */ | |
105 | buff_peticion[numbytes_recibidos]= '\0'; |
|
106 | buff_peticion[numbytes_recibidos]= '\0'; | |
106 |
|
107 | |||
107 | /* procesamiento de la peticion */ |
|
108 | /* procesamiento de la peticion */ | |
108 | rpta = procesa_peticion(buff_peticion); |
|
109 | rpta = procesa_peticion(buff_peticion); | |
109 |
|
110 | |||
110 | //Respuesta del modulo de control |
|
111 | //Respuesta del modulo de control | |
111 | // |
|
112 | // | |
112 |
|
113 | //numbytes_enviados= sendto(conexion_servidorFd,buff_peticion,strlen(buff_peticion),0,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); | ||
|
114 | LOG_SERVIDOR("Enviando respuesta al cliente...\n"); | |||
|
115 | numbytes_enviados= sendto(conexion_servidorFd,&rpta,sizeof(rpta),0,(struct sockaddr *)&inf_cliente,sizeof(inf_cliente)); | |||
|
116 | printf("%i bytes enviados\n",numbytes_enviados); | |||
|
117 | if(numbytes_enviados == -1){ | |||
|
118 | ERROR("Error de envio de datos: sendto()"); | |||
|
119 | return -1; | |||
|
120 | } | |||
113 |
|
121 | |||
114 | } |
|
122 | } | |
115 | } |
|
123 | } | |
116 |
|
124 | |||
117 | /* |
|
125 | /* | |
118 | * Esta funcion incializa el puerto GPIO |
|
126 | * Esta funcion incializa el puerto GPIO | |
119 | */ |
|
127 | */ | |
120 | void inicializa_gpio(){ |
|
128 | void inicializa_gpio(){ | |
121 |
|
129 | |||
122 | // Configuracion de los pines de APUNTE |
|
130 | // Configuracion de los pines de APUNTE | |
123 | pioc = pio_map(PIOC_BASE); |
|
131 | pioc = pio_map(PIOC_BASE); | |
124 | pio_enable(pioc, maskc_out); |
|
132 | pio_enable(pioc, maskc_out); | |
125 | pio_disable_irq(pioc, maskc_out); |
|
133 | pio_disable_irq(pioc, maskc_out); | |
126 | pio_disable_multiple_driver(pioc, maskc_out); |
|
134 | pio_disable_multiple_driver(pioc, maskc_out); | |
127 | pio_disable_pull_ups(pioc, maskc_out); |
|
135 | pio_disable_pull_ups(pioc, maskc_out); | |
128 | pio_synchronous_data_output(pioc, maskc_out); |
|
136 | pio_synchronous_data_output(pioc, maskc_out); | |
129 | pio_output_enable(pioc, maskc_out); |
|
137 | pio_output_enable(pioc, maskc_out); | |
130 |
|
138 | |||
131 | // Configuracion de los pines de VERIFICACION |
|
139 | // Configuracion de los pines de VERIFICACION | |
132 | piob = pio_map(PIOB_BASE); |
|
140 | piob = pio_map(PIOB_BASE); | |
133 | pio_enable(piob, maskb_in); |
|
141 | pio_enable(piob, maskb_in); | |
134 | pio_disable_irq(piob, maskb_in); |
|
142 | pio_disable_irq(piob, maskb_in); | |
135 | pio_disable_multiple_driver(piob, maskb_in); |
|
143 | pio_disable_multiple_driver(piob, maskb_in); | |
136 | pio_disable_pull_ups(piob, maskb_in); |
|
144 | pio_disable_pull_ups(piob, maskb_in); | |
137 | pio_input_enable(piob, maskb_in); |
|
145 | pio_input_enable(piob, maskb_in); | |
138 |
|
146 | |||
139 | } |
|
147 | } | |
140 |
|
148 | |||
141 | /* |
|
149 | /* | |
142 | * Esta funcion procesa el mensaje de peticion y genera respuesta |
|
150 | * Esta funcion procesa el mensaje de peticion y genera respuesta | |
143 | */ |
|
151 | */ | |
144 | int procesa_peticion(char *buff_peticion){ |
|
152 | int procesa_peticion(char *buff_peticion){ | |
145 | int rpta; |
|
153 | int rpta; | |
146 | // char *header = strtok(buff_peticion, ":"); |
|
154 | // char *header = strtok(buff_peticion, ":"); | |
147 | // char *ipSource = strtok(buff_peticion, ":"); |
|
155 | // char *ipSource = strtok(buff_peticion, ":"); | |
148 | // char *ipDestino = strtok(buff_peticion, ":"); |
|
156 | // char *ipDestino = strtok(buff_peticion, ":"); | |
149 | char *comando = strtok(buff_peticion, ":"); |
|
157 | char *comando = strtok(buff_peticion, ":"); | |
150 | char *valor = strtok(NULL, ":"); |
|
158 | char *valor = strtok(NULL, ":"); | |
151 |
|
159 | |||
152 | if ((comando == NULL) || (valor == NULL)){ |
|
160 | if ((comando == NULL) || (valor == NULL)){ | |
153 | ERROR("procesarPeticion: formato de mensaje incorrecto"); |
|
161 | ERROR("procesarPeticion: formato de mensaje incorrecto"); | |
154 | } |
|
162 | } | |
155 | else{ |
|
163 | else{ | |
156 | if(strcmp(comando,"CARGA") == 0) |
|
164 | if(strcmp(comando,"CARGA") == 0) | |
157 | rpta = carga_experimento(valor); |
|
165 | rpta = carga_experimento(valor); | |
158 | else if(strcmp(comando,"CAMBIA") == 0) |
|
166 | else if(strcmp(comando,"CAMBIA") == 0) | |
159 | rpta = cambia_apuntamiento(valor); |
|
167 | rpta = cambia_apuntamiento(valor); | |
160 | else if(strcmp(comando,"CHEQUEO") == 0) |
|
168 | else if(strcmp(comando,"CHEQUEO") == 0) | |
161 | rpta = chequeo_sistema(valor); |
|
169 | rpta = chequeo_sistema(valor); | |
162 | else |
|
170 | else | |
163 | ERROR("procesa_peticion: comando no reconocido"); |
|
171 | ERROR("procesa_peticion: comando no reconocido"); | |
164 | } |
|
172 | } | |
165 |
|
173 | |||
166 | return rpta; |
|
174 | return rpta; | |
167 | } |
|
175 | } | |
168 |
|
176 | |||
169 |
|
177 | |||
170 | /* |
|
178 | /* | |
171 | * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego |
|
179 | * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego | |
172 | * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato |
|
180 | * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato | |
173 | * que sera usado en el cambio de apuntamiento. |
|
181 | * que sera usado en el cambio de apuntamiento. | |
174 | */ |
|
182 | */ | |
175 | int carga_experimento(char *nombre_archivo){ |
|
183 | int carga_experimento(char *nombre_archivo){ | |
176 |
|
184 | |||
177 | FILE *Archivo_Fd; |
|
185 | FILE *Archivo_Fd; | |
178 |
|
186 | |||
179 | char *cadena = (char *) malloc(25); |
|
187 | char *cadena = (char *) malloc(25); | |
180 |
|
188 | |||
181 | int longitud_cadena; |
|
189 | int longitud_cadena; | |
182 | int num_bytes= 0; |
|
190 | int num_bytes= 0; | |
183 | int num_filas= 0; |
|
191 | int num_filas= 0; | |
184 |
|
192 | |||
185 | char ruta_archivo[50]; // Se crea la ruta para abrir el archivo |
|
193 | char ruta_archivo[50]; // Se crea la ruta para abrir el archivo | |
186 | strcpy(ruta_archivo,"/mnt/sd/archivos/"); |
|
194 | strcpy(ruta_archivo,"/mnt/sd/archivos/"); | |
187 | strcat(ruta_archivo,nombre_archivo); |
|
195 | strcat(ruta_archivo,nombre_archivo); | |
188 |
|
196 | |||
189 | Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada |
|
197 | Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada | |
190 | if(!Archivo_Fd){ |
|
198 | if(!Archivo_Fd){ | |
191 | ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); |
|
199 | ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); | |
192 | return -1; |
|
200 | return -1; | |
193 | }else{ |
|
201 | }else{ | |
194 |
|
202 | |||
195 | while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria |
|
203 | while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria | |
196 | fgets(cadena,20,Archivo_Fd); |
|
204 | fgets(cadena,20,Archivo_Fd); | |
197 | longitud_cadena= strlen(cadena); |
|
205 | longitud_cadena= strlen(cadena); | |
198 | cadena[longitud_cadena-1] = '\0'; |
|
206 | cadena[longitud_cadena-1] = '\0'; | |
199 | num_bytes = num_bytes + longitud_cadena; |
|
207 | num_bytes = num_bytes + longitud_cadena; | |
200 | num_filas++; |
|
208 | num_filas++; | |
201 | } |
|
209 | } | |
202 |
|
210 | |||
203 | rewind(Archivo_Fd); // Se reinicia el puntero del archivo |
|
211 | rewind(Archivo_Fd); // Se reinicia el puntero del archivo | |
204 |
|
212 | |||
205 | char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun |
|
213 | char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun | |
206 | // la longitud del archivo |
|
214 | // la longitud del archivo | |
207 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); |
|
215 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); | |
208 |
|
216 | |||
209 | char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo |
|
217 | char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo | |
210 | puntero= puntero + 12; |
|
218 | puntero= puntero + 12; | |
211 |
|
219 | |||
212 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); |
|
220 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); | |
213 | strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo |
|
221 | strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo | |
214 |
|
222 | |||
215 | fclose(Archivo_Fd); |
|
223 | fclose(Archivo_Fd); | |
216 |
|
224 | |||
217 | cambia_apuntamiento("0"); // Se apunta a la direccion 0 |
|
225 | cambia_apuntamiento("0"); // Se apunta a la direccion 0 | |
218 |
|
226 | |||
219 | return 1; |
|
227 | return 1; | |
220 | } |
|
228 | } | |
221 | } |
|
229 | } | |
222 |
|
230 | |||
223 | /* |
|
231 | /* | |
224 | * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en |
|
232 | * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en | |
225 | * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta |
|
233 | * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta | |
226 | * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a |
|
234 | * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a | |
227 | * traves del puerto GPIO. |
|
235 | * traves del puerto GPIO. | |
228 | */ |
|
236 | */ | |
229 | int cambia_apuntamiento(char *puntero_char){ |
|
237 | int cambia_apuntamiento(char *puntero_char){ | |
230 |
|
238 | |||
231 | /*MSB-UP-LSB MSB-DOWN-LSB*/ |
|
239 | /*MSB-UP-LSB MSB-DOWN-LSB*/ | |
232 | int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara |
|
240 | int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara | |
233 | // al dato que ingresa para formar el número |
|
241 | // al dato que ingresa para formar el número | |
234 | // entero que se le pasara al puerto GPIO |
|
242 | // entero que se le pasara al puerto GPIO | |
235 | // Estos números son los pines del puerto GPIO |
|
243 | // Estos números son los pines del puerto GPIO | |
236 | // que se estan usando para el control |
|
244 | // que se estan usando para el control | |
237 |
|
245 | |||
238 | int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero |
|
246 | int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero | |
239 |
|
247 | |||
240 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero |
|
248 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero | |
241 | // cantidad de bytes es el numero de bytes que |
|
249 | // cantidad de bytes es el numero de bytes que | |
242 | printf("%i\n",puntero); // contiene cada dato, para este caso es 7 |
|
250 | printf("%i\n",puntero); // contiene cada dato, para este caso es 7 | |
243 | // porque es 6 bits de datos + 1 bit del cambio |
|
251 | // porque es 6 bits de datos + 1 bit del cambio | |
244 | // de linea. |
|
252 | // de linea. | |
245 | char valor_char; |
|
253 | char valor_char; | |
246 | unsigned long valor; |
|
254 | unsigned long valor; | |
247 | unsigned long acumulado_ceros=0; |
|
255 | unsigned long acumulado_ceros=0; | |
248 | unsigned long acumulado_unos=0; |
|
256 | unsigned long acumulado_unos=0; | |
249 |
|
257 | |||
250 | int offset; // Defino offset para el desplazamiento a traves |
|
258 | int offset; // Defino offset para el desplazamiento a traves | |
251 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" |
|
259 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" | |
252 |
|
260 | |||
253 | valor_char= buff_experimento[base+offset]; // Obtengo el dato |
|
261 | valor_char= buff_experimento[base+offset]; // Obtengo el dato | |
254 |
|
262 | |||
255 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno |
|
263 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno | |
256 | valor= 0; |
|
264 | valor= 0; | |
257 | acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); |
|
265 | acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); | |
258 | }else{ |
|
266 | }else{ | |
259 | valor= 1; |
|
267 | valor= 1; | |
260 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); |
|
268 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); | |
261 | } |
|
269 | } | |
262 |
|
270 | |||
263 | } |
|
271 | } | |
264 |
|
272 | |||
265 | pio_out(pioc, maskc_out, acumulado_unos, 1); |
|
273 | pio_out(pioc, maskc_out, acumulado_unos, 1); | |
266 | pio_out(pioc, maskc_out, acumulado_ceros, 0); |
|
274 | pio_out(pioc, maskc_out, acumulado_ceros, 0); | |
267 |
|
275 | |||
268 | return 1; |
|
276 | return 1; | |
269 |
|
277 | |||
270 | } |
|
278 | } | |
271 |
|
279 | |||
272 | /* |
|
280 | /* | |
273 | * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el |
|
281 | * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el | |
274 | * archivo Verificacion. |
|
282 | * archivo Verificacion. | |
275 | */ |
|
283 | */ | |
276 |
|
284 | |||
277 | int chequeo_sistema(char *numero_muestras){ |
|
285 | int chequeo_sistema(char *numero_muestras){ | |
278 |
|
286 | |||
279 | char valor[7]; |
|
287 | char valor[7]; | |
280 | int i,cnt; |
|
288 | int i,cnt; | |
281 | unsigned int entradac= 0; |
|
289 | unsigned int entradac= 0; | |
282 | FILE *fd; |
|
290 | FILE *fd; | |
283 | fd=fopen("/mnt/sd/archivos/Verificacion","w"); |
|
291 | fd=fopen("/mnt/sd/archivos/Verificacion","w"); | |
284 | fprintf(fd,"%s\n","Verificacion"); |
|
292 | fprintf(fd,"%s\n","Verificacion"); | |
285 | fprintf(fd,"%s\n","------------"); |
|
293 | fprintf(fd,"%s\n","------------"); | |
286 | cnt=0; |
|
294 | cnt=0; | |
287 | do |
|
295 | do | |
288 | { |
|
296 | { | |
289 | //Inicializando arreglo |
|
297 | //Inicializando arreglo | |
290 | for(i=0;i<6;i++) |
|
298 | for(i=0;i<6;i++) | |
291 | valor[i]='0'; |
|
299 | valor[i]='0'; | |
292 |
|
300 | |||
293 | valor[6]='\0'; |
|
301 | valor[6]='\0'; | |
294 |
|
302 | |||
295 | //Lectura de puerto |
|
303 | //Lectura de puerto | |
296 | entradac= pio_in(piob,maskb_in); |
|
304 | entradac= pio_in(piob,maskb_in); | |
297 |
|
305 | |||
298 | //Dandole formato al dato |
|
306 | //Dandole formato al dato | |
299 | if (!(entradac & bit_up_2)) |
|
307 | if (!(entradac & bit_up_2)) | |
300 | valor[0] = '1'; |
|
308 | valor[0] = '1'; | |
301 | if (!(entradac & bit_up_1)) |
|
309 | if (!(entradac & bit_up_1)) | |
302 | valor[1] = '1'; |
|
310 | valor[1] = '1'; | |
303 | if (!(entradac & bit_up_0)) |
|
311 | if (!(entradac & bit_up_0)) | |
304 | valor[2] = '1'; |
|
312 | valor[2] = '1'; | |
305 | if (!(entradac & bit_dow_2)) |
|
313 | if (!(entradac & bit_dow_2)) | |
306 | valor[3] = '1'; |
|
314 | valor[3] = '1'; | |
307 | if (!(entradac & bit_dow_1)) |
|
315 | if (!(entradac & bit_dow_1)) | |
308 | valor[4] = '1'; |
|
316 | valor[4] = '1'; | |
309 | if (!(entradac & bit_dow_0)) |
|
317 | if (!(entradac & bit_dow_0)) | |
310 | valor[5] = '1'; |
|
318 | valor[5] = '1'; | |
311 |
|
319 | |||
312 | //Escribiendo en archivo |
|
320 | //Escribiendo en archivo | |
313 | fprintf(fd,"%s\n",valor); |
|
321 | fprintf(fd,"%s\n",valor); | |
314 | cnt=cnt+1; |
|
322 | cnt=cnt+1; | |
315 | usleep(1*1000*1000); |
|
323 | usleep(1*1000*1000); | |
316 |
|
324 | |||
317 | }while(cnt < atoi(numero_muestras)); |
|
325 | }while(cnt < atoi(numero_muestras)); | |
318 |
|
326 | |||
319 | fclose(fd); |
|
327 | fclose(fd); | |
320 |
|
328 | |||
321 | return 1; |
|
329 | return 1; | |
322 | } |
|
330 | } |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now