Contiki-Inga 3.x
contiki-raven-main.c
1 /*
2  * Copyright (c) 2006, Technical University of Munich
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  * @(#)$$
32  */
33 #define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
34 
35 #define ANNOUNCE_BOOT 1 //adds about 600 bytes to program size
36 #if ANNOUNCE_BOOT
37 #define PRINTA(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
38 #else
39 #define PRINTA(...)
40 #endif
41 
42 #define DEBUG 1
43 #if DEBUG
44 #define PRINTD(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
45 #else
46 #define PRINTD(...)
47 #endif
48 
49 /* Track interrupt flow through mac, rdc and radio driver */
50 #define DEBUGFLOWSIZE 32
51 #if DEBUGFLOWSIZE
52 unsigned char debugflowsize,debugflow[DEBUGFLOWSIZE];
53 #define DEBUGFLOW(c) if (debugflowsize<(DEBUGFLOWSIZE-1)) debugflow[debugflowsize++]=c
54 #else
55 #define DEBUGFLOW(c)
56 #endif
57 
58 #include <avr/pgmspace.h>
59 #include <avr/fuse.h>
60 #include <avr/eeprom.h>
61 #include <stdio.h>
62 #include <string.h>
63 #include <dev/watchdog.h>
64 
65 #include "loader/symbols-def.h"
66 #include "loader/symtab.h"
67 
68 #if RF230BB //radio driver using contiki core mac
69 #include "radio/rf230bb/rf230bb.h"
70 #include "net/mac/frame802154.h"
71 #include "net/mac/framer-802154.h"
72 #include "net/ipv6/sicslowpan.h"
73 
74 #else //radio driver using Atmel/Cisco 802.15.4'ish MAC
75 #include <stdbool.h>
76 #include "mac.h"
77 #include "sicslowmac.h"
78 #include "sicslowpan.h"
79 #include "ieee-15-4-manager.h"
80 #endif /*RF230BB*/
81 
82 #include "contiki.h"
83 #include "contiki-net.h"
84 #include "contiki-lib.h"
85 
86 #include "dev/rs232.h"
87 #include "dev/serial-line.h"
88 #include "dev/slip.h"
89 
90 #ifdef RAVEN_LCD_INTERFACE
91 #include "raven-lcd.h"
92 #endif
93 
94 #if AVR_WEBSERVER
95 #include "httpd-fs.h"
96 #include "httpd-cgi.h"
97 #endif
98 
99 #ifdef COFFEE_FILES
100 #include "cfs/cfs.h"
101 #include "cfs/cfs-coffee.h"
102 #endif
103 
104 #if UIP_CONF_ROUTER&&0
105 #include "net/routing/rimeroute.h"
106 #include "net/rime/rime-udp.h"
107 #endif
108 
109 #include "net/rime/rime.h"
110 
111 #include "params.h"
112 
113 /* Get periodic prints from idle loop, from clock seconds or rtimer interrupts */
114 /* Use of rtimer will conflict with other rtimer interrupts such as contikimac radio cycling */
115 /* STAMPS will print ENERGEST outputs if that is enabled. */
116 #define PERIODICPRINTS 1
117 #if PERIODICPRINTS
118 //#define PINGS 64
119 #define ROUTES 600
120 #define STAMPS 60
121 #define STACKMONITOR 600
122 uint32_t clocktime;
123 #define TESTRTIMER 0
124 #if TESTRTIMER
125 uint8_t rtimerflag=1;
126 struct rtimer rt;
127 void rtimercycle(void) {rtimerflag=1;}
128 #endif
129 #endif
130 uint16_t node_id = 0;
131 
132 /*-------------------------------------------------------------------------*/
133 /*----------------------Configuration of the .elf file---------------------*/
134 #if 1
135 /* The proper way to set the signature is */
136 #include <avr/signature.h>
137 #else
138 /* Older avr-gcc's may not define the needed SIGNATURE bytes. Do it manually if you get an error */
139 typedef struct {const unsigned char B2;const unsigned char B1;const unsigned char B0;} __signature_t;
140 #define SIGNATURE __signature_t __signature __attribute__((section (".signature")))
141 SIGNATURE = {
142  .B2 = 0x05,//SIGNATURE_2, //ATMEGA1284p
143  .B1 = 0x97,//SIGNATURE_1, //128KB flash
144  .B0 = 0x1E,//SIGNATURE_0, //Atmel
145 };
146 #endif
147 
148 #if !MCU_CONF_LOW_WEAR
149 /* JTAG, SPI enabled, Internal RC osc, Boot flash size 4K, 6CK+65msec delay, brownout disabled */
150 FUSES ={.low = 0xe2, .high = 0x99, .extended = 0xff,};
151 #endif
152 
153 /* Get a pseudo random number using the ADC */
154 uint8_t
155 rng_get_uint8(void) {
156 uint8_t i,j;
157  ADCSRA=1<<ADEN; //Enable ADC, not free running, interrupt disabled, fastest clock
158  for (i=0,j=0;i<4;i++) {
159  ADMUX = 0; //toggle reference to increase noise
160  ADMUX =0x1E; //Select AREF as reference, measure 1.1 volt bandgap reference.
161  ADCSRA|=1<<ADSC; //Start conversion
162  while (ADCSRA&(1<<ADSC)); //Wait till done
163  j = (j<<2) + ADC;
164  }
165  ADCSRA=0; //Disable ADC
166  PRINTD("rng issues %d\n",j);
167  return j;
168 }
169 
170 /*-------------------------Low level initialization------------------------*/
171 /*------Done in a subroutine to keep main routine stack usage small--------*/
172 void initialize(void)
173 {
174  watchdog_init();
175  watchdog_start();
176 
177 #ifdef RAVEN_LCD_INTERFACE
178  /* First rs232 port for Raven 3290 port */
179  rs232_init(RS232_PORT_0, USART_BAUD_38400,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
180  /* Set input handler for 3290 port */
181  rs232_set_input(0,raven_lcd_serial_input);
182 #else
183  /* Generic or slip connection on uart0 */
184  rs232_init(RS232_PORT_0, USART_BAUD_38400,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
185 #endif
186 
187  /* Second rs232 port for debugging or slip alternative */
188  rs232_init(RS232_PORT_1, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
189  /* Redirect stdout to second port */
190  rs232_redirect_stdout(RS232_PORT_1);
191  clock_init();
192 
193  PRINTD("\n\nChecking MCUSR...\n");
194  if(MCUSR & (1<<PORF )) PRINTD("Power-on reset.\n");
195  if(MCUSR & (1<<EXTRF)) PRINTD("External reset!\n");
196  if(MCUSR & (1<<BORF )) PRINTD("Brownout reset!\n");
197  if(MCUSR & (1<<WDRF )) PRINTD("Watchdog reset!\n");
198  if(MCUSR & (1<<JTRF )) PRINTD("JTAG reset!\n");
199  MCUSR = 0;
200 
201  PRINTD("CLOCK_SECOND %d\n",CLOCK_SECOND);
202  PRINTD("RTIMER_ARCH_SECOND %lu\n",RTIMER_ARCH_SECOND);
203  PRINTD("F_CPU %lu\n",F_CPU);
204 
205 #if STACKMONITOR
206  /* Simple stack pointer highwater monitor. Checks for magic numbers in the main
207  * loop. In conjuction with PERIODICPRINTS, never-used stack will be printed
208  * every STACKMONITOR seconds.
209  */
210 {
211 extern uint16_t __bss_end;
212 uint16_t p=(uint16_t)&__bss_end;
213  do {
214  *(uint16_t *)p = 0x4242;
215  p+=10;
216  } while (p<SP-10); //don't overwrite our own stack
217 }
218 #endif
219 
220 /* Calibrate internal mcu clock against external 32768Hz watch crystal */
221 #define CONF_CALIBRATE_OSCCAL 0
222 #if CONF_CALIBRATE_OSCCAL
223 void calibrate_rc_osc_32k();
224 {
225 extern uint8_t osccal_calibrated;
226 uint8_t i;
227  PRINTD("\nBefore calibration OSCCAL=%x\n",OSCCAL);
228  for (i=0;i<10;i++) {
230  PRINTD("Calibrated=%x\n",osccal_calibrated);
231 //#include <util/delay_basic.h>
232 //#define delay_us( us ) ( _delay_loop_2(1+(us*F_CPU)/4000000UL) )
233 // delay_us(50000);
234  }
235  clock_init();
236 }
237 #endif
238 
239  PRINTA("\n*******Booting %s*******\n",CONTIKI_VERSION_STRING);
240 
241 /* rtimers needed for radio cycling */
242  rtimer_init();
243 
244  /* Initialize process subsystem */
245  process_init();
246 
247  /* etimers must be started before ctimer_init */
248  process_start(&etimer_process, NULL);
249 
250 #if RF230BB
251 
252  ctimer_init();
253  /* Start radio and radio receive process */
254  NETSTACK_RADIO.init();
255 
256 /* Get a random seed for the 802.15.4 packet sequence number.
257  * Some layers will ignore duplicates found in a history (e.g. Contikimac)
258  * causing the initial packets to be ignored after a short-cycle restart.
259  */
260  random_init(rng_get_uint8());
261 
262  /* Set addresses BEFORE starting tcpip process */
263 
264  linkaddr_t addr;
265  if (params_get_eui64(addr.u8)) {
266  PRINTA("Random EUI64 address generated\n");
267  }
268 
269 #if UIP_CONF_IPV6
270  PRINTD("Initial node_id %u\n",node_id);
271  if (node_id) {
272  addr.u8[3]=node_id&0xff;
273  addr.u8[4]=(node_id&0xff)>>8;
274  addr.u8[5]=node_id;
275  addr.u8[6]=node_id;
276  addr.u8[7]=node_id;
277  } else {
278  node_id=addr.u8[7]+(addr.u8[6]<<8);
279  }
280  memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t));
281  linkaddr_set_node_addr(&addr);
282  rf230_set_pan_addr(params_get_panid(),params_get_panaddr(),(uint8_t *)&addr.u8);
283 #elif WITH_NODE_ID
284  node_id=get_panaddr_from_eeprom();
285  addr.u8[1]=node_id&0xff;
286  addr.u8[0]=(node_id&0xff00)>>8;
287  PRINTA("Node ID from eeprom: %X\n",node_id);
288  uint16_t inv_node_id=((node_id&0xff00)>>8)+((node_id&0xff)<<8); // change order of bytes for rf23x
289  linkaddr_set_node_addr(&addr);
290  rf230_set_pan_addr(params_get_panid(),inv_node_id,NULL);
291 #else
292  linkaddr_set_node_addr(&addr);
293  rf230_set_pan_addr(params_get_panid(),params_get_panaddr(),(uint8_t *)&addr.u8);
294 #endif
295  rf230_set_channel(params_get_channel());
296  rf230_set_txpower(params_get_txpower());
297 
298 #if UIP_CONF_IPV6
299  PRINTA("EUI-64 MAC: %x-%x-%x-%x-%x-%x-%x-%x\n",addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]);
300 #else
301  PRINTA("MAC address ");
302  uint8_t i;
303  for (i=sizeof(linkaddr_t); i>0; i--){
304  PRINTA("%x:",addr.u8[i-1]);
305  }
306  PRINTA("\n");
307 #endif
308 
309  /* Initialize stack protocols */
310  queuebuf_init();
311  NETSTACK_RDC.init();
312  NETSTACK_MAC.init();
313  NETSTACK_NETWORK.init();
314 
315 #if ANNOUNCE_BOOT
316  PRINTA("%s %s, channel %u , check rate %u Hz tx power %u\n",NETSTACK_MAC.name, NETSTACK_RDC.name, rf230_get_channel(),
317  CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:NETSTACK_RDC.channel_check_interval()),
318  rf230_get_txpower());
319 #if UIP_CONF_IPV6_RPL
320  PRINTA("RPL Enabled\n");
321 #endif
322 #if UIP_CONF_ROUTER
323  PRINTA("Routing Enabled\n");
324 #endif
325 #endif /* ANNOUNCE_BOOT */
326 
327 // rime_init(rime_udp_init(NULL));
328 // uip_router_register(&rimeroute);
329 
330  process_start(&tcpip_process, NULL);
331 
332 #else /* !RF230BB */
333 /* Original RF230 combined mac/radio driver */
334 /* mac process must be started before tcpip process! */
335  process_start(&mac_process, NULL);
336  process_start(&tcpip_process, NULL);
337 #endif /* RF230BB */
338 
339 #ifdef RAVEN_LCD_INTERFACE
340  process_start(&raven_lcd_process, NULL);
341 #endif
342 
343 #if !RAVEN_LCD_INTERFACE
344  rs232_set_input(RS232_PORT_1, serial_line_input_byte);
345  serial_line_init();
346 #endif
347 
348  /* Autostart other processes */
349  autostart_start(autostart_processes);
350 
351  /*---If using coffee file system create initial web content if necessary---*/
352 #if COFFEE_FILES
353  int fa = cfs_open( "/index.html", CFS_READ);
354  if (fa<0) { //Make some default web content
355  PRINTA("No index.html file found, creating upload.html!\n");
356  PRINTA("Formatting FLASH file system for coffee...");
358  PRINTA("Done!\n");
359  fa = cfs_open( "/index.html", CFS_WRITE);
360  int r = cfs_write(fa, &"It works!", 9);
361  if (r<0) PRINTA("Can''t create /index.html!\n");
362  cfs_close(fa);
363 // fa = cfs_open("upload.html"), CFW_WRITE);
364 // <html><body><form action="upload.html" enctype="multipart/form-data" method="post"><input name="userfile" type="file" size="50" /><input value="Upload" type="submit" /></form></body></html>
365  }
366 #endif /* COFFEE_FILES */
367 
368 /* Add addresses for testing */
369 #if 0
370 {
371  uip_ip6addr_t ipaddr;
372  uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
373  uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
374 // uip_ds6_prefix_add(&ipaddr,64,0);
375 }
376 #endif
377 
378 /*--------------------------Announce the configuration---------------------*/
379 #if ANNOUNCE_BOOT
380 {
381 #if AVR_WEBSERVER
382  uint8_t i;
383  char buf1[40],buf[40];
384  unsigned int size;
385 
386  for (i=0;i<UIP_DS6_ADDR_NB;i++) {
387  if (uip_ds6_if.addr_list[i].isused) {
388  httpd_cgi_sprint_ip6(uip_ds6_if.addr_list[i].ipaddr,buf);
389  PRINTA("IPv6 Address: %s\n",buf);
390  }
391  }
392  cli();
393  eeprom_read_block (buf1,eemem_server_name, sizeof(eemem_server_name));
394  eeprom_read_block (buf,eemem_domain_name, sizeof(eemem_domain_name));
395  sei();
396  buf1[sizeof(eemem_server_name)]=0;
397  PRINTA("%s",buf1);
398  buf[sizeof(eemem_domain_name)]=0;
399  size=httpd_fs_get_size();
400 #ifndef COFFEE_FILES
401  PRINTA(".%s online with fixed %u byte web content\n",buf,size);
402 #elif COFFEE_FILES==1
403  PRINTA(".%s online with static %u byte EEPROM file system\n",buf,size);
404 #elif COFFEE_FILES==2
405  PRINTA(".%s online with dynamic %u KB EEPROM file system\n",buf,size>>10);
406 #elif COFFEE_FILES==3
407  PRINTA(".%s online with static %u byte program memory file system\n",buf,size);
408 #elif COFFEE_FILES==4
409  PRINTA(".%s online with dynamic %u KB program memory file system\n",buf,size>>10);
410 #endif /* COFFEE_FILES */
411 
412 #else
413  PRINTA("Online\n");
414 #endif /* AVR_WEBSERVER */
415 
416 #endif /* ANNOUNCE_BOOT */
417 }
418 }
419 
420 #if ROUTES && UIP_CONF_IPV6
421 static void
422 ipaddr_add(const uip_ipaddr_t *addr)
423 {
424  uint16_t a;
425  int8_t i, f;
426  for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) {
427  a = (addr->u8[i] << 8) + addr->u8[i + 1];
428  if(a == 0 && f >= 0) {
429  if(f++ == 0) PRINTF("::");
430  } else {
431  if(f > 0) {
432  f = -1;
433  } else if(i > 0) {
434  PRINTF(":");
435  }
436  PRINTF("%x",a);
437  }
438  }
439 }
440 #endif
441 
442 /*-------------------------------------------------------------------------*/
443 /*------------------------- Main Scheduler loop----------------------------*/
444 /*-------------------------------------------------------------------------*/
445 int
446 main(void)
447 {
448 #if UIP_CONF_IPV6
449  uip_ds6_nbr_t *nbr;
450 #endif /* UIP_CONF_IPV6 */
451  initialize();
452 
453  while(1) {
454  process_run();
456 
457 #if 0
458 /* Various entry points for debugging in the AVR Studio simulator.
459  * Set as next statement and step into the routine.
460  */
461  NETSTACK_RADIO.send(packetbuf_hdrptr(), 42);
462  process_poll(&rf230_process);
463  packetbuf_clear();
464  len = rf230_read(packetbuf_dataptr(), PACKETBUF_SIZE);
466  NETSTACK_RDC.input();
467 #endif
468 
469 #if 0
470 /* Clock.c can trigger a periodic PLL calibration in the RF230BB driver.
471  * This can show when that happens.
472  */
473  extern uint8_t rf230_calibrated;
474  if (rf230_calibrated) {
475  PRINTD("\nRF230 calibrated!\n");
476  rf230_calibrated=0;
477  }
478 #endif
479 
480 /* Set DEBUGFLOWSIZE in contiki-conf.h to track path through MAC, RDC, and RADIO */
481 #if DEBUGFLOWSIZE
482  if (debugflowsize) {
483  debugflow[debugflowsize]=0;
484  PRINTF("%s\n",debugflow);
485  debugflowsize=0;
486  }
487 #endif
488 
489 #if PERIODICPRINTS
490 #if TESTRTIMER
491 /* Timeout can be increased up to 8 seconds maximum.
492  * A one second cycle is convenient for triggering the various debug printouts.
493  * The triggers are staggered to avoid printing everything at once.
494  */
495  if (rtimerflag) {
496  rtimer_set(&rt, RTIMER_NOW()+ RTIMER_ARCH_SECOND*1UL, 1,(void *) rtimercycle, NULL);
497  rtimerflag=0;
498 #else
499  if (clocktime!=clock_seconds()) {
500  clocktime=clock_seconds();
501 #endif
502 
503 #if STAMPS
504 if ((clocktime%STAMPS)==0) {
505 #if ENERGEST_CONF_ON
506 #include "lib/print-stats.h"
507  print_stats();
508 #elif RADIOSTATS
509 extern volatile unsigned long radioontime;
510  PRINTF("%u(%u)s\n",clocktime,radioontime);
511 #else
512  PRINTF("%us\n",clocktime);
513 #endif
514 
515 }
516 #endif
517 #if TESTRTIMER
518  clocktime+=1;
519 #endif
520 
521 #if PINGS && UIP_CONF_IPV6
522 extern void raven_ping6(void);
523 if ((clocktime%PINGS)==1) {
524  PRINTF("**Ping\n");
525  raven_ping6();
526 }
527 #endif
528 
529 #if ROUTES && UIP_CONF_IPV6
530 if ((clocktime%ROUTES)==2) {
531 
532 extern uip_ds6_netif_t uip_ds6_if;
533 
534  uint8_t i,j;
535  PRINTF("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB);
536  for (i=0;i<UIP_DS6_ADDR_NB;i++) {
537  if (uip_ds6_if.addr_list[i].isused) {
538  ipaddr_add(&uip_ds6_if.addr_list[i].ipaddr);
539  PRINTF("\n");
540  }
541  }
542  PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS);
543  for(nbr = nbr_table_head(ds6_neighbors);
544  nbr != NULL;
545  nbr = nbr_table_next(ds6_neighbors, nbr)) {
546  ipaddr_add(&nbr->ipaddr);
547  PRINTF("\n");
548  j=0;
549  }
550  if (j) PRINTF(" <none>");
551  {
552  uip_ds6_route_t *r;
553  PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
554  j = 1;
555  for(r = uip_ds6_route_head();
556  r != NULL;
557  r = uip_ds6_route_next(r)) {
558  ipaddr_add(&r->ipaddr);
559  PRINTF("/%u (via ", r->length);
560  ipaddr_add(uip_ds6_route_nexthop(r));
561  PRINTF(") %lus\n", r->state.lifetime);
562  j = 0;
563  }
564  }
565  if (j) PRINTF(" <none>");
566  PRINTF("\n---------\n");
567 }
568 #endif
569 
570 #if STACKMONITOR
571 if ((clocktime%STACKMONITOR)==3) {
572  extern uint16_t __bss_end;
573  uint16_t p=(uint16_t)&__bss_end;
574  do {
575  if (*(uint16_t *)p != 0x4242) {
576  PRINTF("Never-used stack > %d bytes\n",p-(uint16_t)&__bss_end);
577  break;
578  }
579  p+=10;
580  } while (p<RAMEND-10);
581 }
582 #endif
583 
584  }
585 #endif /* PERIODICPRINTS */
586 
587 #if RF230BB&&0
588 extern uint8_t rf230processflag;
589  if (rf230processflag) {
590  PRINTF("rf230p%d",rf230processflag);
591  rf230processflag=0;
592  }
593 #endif
594 
595 #if RF230BB&&0
596 extern uint8_t rf230interruptflag;
597  if (rf230interruptflag) {
598  // if (rf230interruptflag!=11) {
599  PRINTF("**RI%u\n",rf230interruptflag);
600  // }
601  rf230interruptflag=0;
602  }
603 #endif
604  }
605  return 0;
606 }
607 
608 /*---------------------------------------------------------------------------*/
609 
610 void log_message(char *m1, char *m2)
611 {
612  PRINTF("%s%s\n", m1, m2);
613 }