Contiki 3.x
contiki-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 #define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
33 
34 #define ANNOUNCE_BOOT 1 //adds about 600 bytes to program size
35 #if ANNOUNCE_BOOT
36 #define PRINTA(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
37 #else
38 #define PRINTA(...)
39 #endif
40 
41 #define DEBUG 0
42 #if DEBUG
43 #define PRINTD(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
44 #else
45 #define PRINTD(...)
46 #endif
47 
48 #include <avr/pgmspace.h>
49 #include <avr/fuse.h>
50 #include <avr/eeprom.h>
51 #include <stdio.h>
52 #include <string.h>
53 #include <dev/watchdog.h>
54 
55 #include "loader/symbols-def.h"
56 #include "loader/symtab.h"
57 
58 #include "params.h"
59 #include "radio/rf230bb/rf230bb.h"
60 #include "net/mac/frame802154.h"
61 #include "net/mac/framer-802154.h"
62 #include "net/ipv6/sicslowpan.h"
63 
64 #include "contiki.h"
65 #include "contiki-net.h"
66 #include "contiki-lib.h"
67 
68 #include "dev/rs232.h"
69 #include "dev/serial-line.h"
70 #include "dev/slip.h"
71 
72 #ifdef RAVEN_LCD_INTERFACE
73 #include "raven-lcd.h"
74 #endif
75 
76 #if AVR_WEBSERVER
77 #include "httpd-fs.h"
78 #include "httpd-cgi.h"
79 #endif
80 
81 #ifdef COFFEE_FILES
82 #include "cfs/cfs.h"
83 #include "cfs/cfs-coffee.h"
84 #endif
85 
86 #if UIP_CONF_ROUTER&&0
87 #include "net/routing/rimeroute.h"
88 #include "net/rime/rime-udp.h"
89 #endif
90 
91 #include "net/rime/rime.h"
92 
93 /* Track interrupt flow through mac, rdc and radio driver */
94 //#define DEBUGFLOWSIZE 32
95 #if DEBUGFLOWSIZE
96 uint8_t debugflowsize,debugflow[DEBUGFLOWSIZE];
97 #define DEBUGFLOW(c) if (debugflowsize<(DEBUGFLOWSIZE-1)) debugflow[debugflowsize++]=c
98 #else
99 #define DEBUGFLOW(c)
100 #endif
101 
102 /* Get periodic prints from idle loop, from clock seconds or rtimer interrupts */
103 /* Use of rtimer will conflict with other rtimer interrupts such as contikimac radio cycling */
104 /* STAMPS will print ENERGEST outputs if that is enabled. */
105 #define PERIODICPRINTS 1
106 #if PERIODICPRINTS
107 //#define PINGS 64
108 #define ROUTES 600
109 #define STAMPS 60
110 #define STACKMONITOR 1024
111 uint32_t clocktime;
112 #define TESTRTIMER 0
113 #if TESTRTIMER
114 uint8_t rtimerflag=1;
115 struct rtimer rt;
116 void rtimercycle(void) {rtimerflag=1;}
117 #endif
118 #endif
119 
120 uint16_t ledtimer;
121 
122 /*-------------------------------------------------------------------------*/
123 /*----------------------Configuration of the .elf file---------------------*/
124 #if 1
125 /* The proper way to set the signature is */
126 #include <avr/signature.h>
127 #else
128 /* Older avr-gcc's may not define the needed SIGNATURE bytes. Do it manually if you get an error */
129 typedef struct {const unsigned char B2;const unsigned char B1;const unsigned char B0;} __signature_t;
130 #define SIGNATURE __signature_t __signature __attribute__((section (".signature")))
131 SIGNATURE = {
132  .B2 = 0x01,//SIGNATURE_2, //ATMEGA128rfa1
133  .B1 = 0xA7,//SIGNATURE_1, //128KB flash
134  .B0 = 0x1E,//SIGNATURE_0, //Atmel
135 };
136 #endif
137 
138 #if 1
139 /* JTAG, SPI enabled, Internal RC osc, Boot flash size 4K, 6CK+65msec delay, brownout disabled */
140 FUSES ={.low = 0xe2, .high = 0x99, .extended = 0xff,};
141 #else
142 /* JTAG+SPI, Boot 4096 words @ $F000, Internal oscillator, startup 6 CK +0 ms, Brownout 1.8 volts */
143 FUSES ={.low = 0xC2, .high = 0x99, .extended = 0xfe,};
144 #endif
145 
146 uint8_t
147 rng_get_uint8(void) {
148 #if 1
149  /* Upper two RSSI reg bits (RND_VALUE) are random in rf231 */
150  uint8_t j;
151  j = (PHY_RSSI&0xc0) + ((PHY_RSSI>>2)&0x30) + ((PHY_RSSI>>4)&0x0c) + ((PHY_RSSI>>6)&0x03);
152 #else
153 /* Get a pseudo random number using the ADC */
154  uint8_t i,j;
155  ADCSRA=1<<ADEN; //Enable ADC, not free running, interrupt disabled, fastest clock
156  for (i=0;i<4;i++) {
157  ADMUX = 0; //toggle reference to increase noise
158  ADMUX =0x1E; //Select AREF as reference, measure 1.1 volt bandgap reference.
159  ADCSRA|=1<<ADSC; //Start conversion
160  while (ADCSRA&(1<<ADSC)); //Wait till done
161  j = (j<<2) + ADC;
162  }
163  ADCSRA=0; //Disable ADC
164 #endif
165  PRINTD("rng issues %d\n",j);
166  return j;
167 }
168 
169 /*-------------------------Low level initialization------------------------*/
170 /*------Done in a subroutine to keep main routine stack usage small--------*/
171 void initialize(void)
172 {
173  watchdog_init();
174  watchdog_start();
175 
176 /* The Raven implements a serial command and data interface via uart0 to a 3290p,
177  * which could be duplicated using another host computer.
178  */
179 #if !RF230BB_CONF_LEDONPORTE1 //Conflicts with USART0
180 #ifdef RAVEN_LCD_INTERFACE
181  rs232_init(RS232_PORT_0, USART_BAUD_38400,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
182  rs232_set_input(0,raven_lcd_serial_input);
183 #else
184  /* Generic or slip connection on uart0 */
185  rs232_init(RS232_PORT_0, USART_BAUD_38400,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
186 #endif
187 #endif
188 
189  /* Second rs232 port for debugging or slip alternative */
190  rs232_init(RS232_PORT_1, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
191  /* Redirect stdout */
192 #if RF230BB_CONF_LEDONPORTE1 || defined(RAVEN_LCD_INTERFACE)
193  rs232_redirect_stdout(RS232_PORT_1);
194 #else
195  rs232_redirect_stdout(RS232_PORT_0);
196 #endif
197  clock_init();
198 
199  if(MCUSR & (1<<PORF )) PRINTD("Power-on reset.\n");
200  if(MCUSR & (1<<EXTRF)) PRINTD("External reset!\n");
201  if(MCUSR & (1<<BORF )) PRINTD("Brownout reset!\n");
202  if(MCUSR & (1<<WDRF )) PRINTD("Watchdog reset!\n");
203  if(MCUSR & (1<<JTRF )) PRINTD("JTAG reset!\n");
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 #define CONF_CALIBRATE_OSCCAL 0
221 #if CONF_CALIBRATE_OSCCAL
222 void calibrate_rc_osc_32k();
223 {
224 extern uint8_t osccal_calibrated;
225 uint8_t i;
226  PRINTD("\nBefore calibration OSCCAL=%x\n",OSCCAL);
227  for (i=0;i<10;i++) {
229  PRINTD("Calibrated=%x\n",osccal_calibrated);
230 //#include <util/delay_basic.h>
231 //#define delay_us( us ) ( _delay_loop_2(1+(us*F_CPU)/4000000UL) )
232 // delay_us(50000);
233  }
234  clock_init();
235 }
236 #endif
237 
238  PRINTA("\n*******Booting %s*******\n",CONTIKI_VERSION_STRING);
239 
240 /* rtimers needed for radio cycling */
241  rtimer_init();
242 
243  /* Initialize process subsystem */
244  process_init();
245 
246  /* etimers must be started before ctimer_init */
247  process_start(&etimer_process, NULL);
248  ctimer_init();
249 
250  /* Start radio and radio receive process */
251  NETSTACK_RADIO.init();
252 
253 /* Get a random seed for the 802.15.4 packet sequence number.
254  * Some layers will ignore duplicates found in a history (e.g. Contikimac)
255  * causing the initial packets to be ignored after a short-cycle restart.
256  */
257  random_init(rng_get_uint8());
258 
259  /* Set addresses BEFORE starting tcpip process */
260 
261  linkaddr_t addr;
262 
263  if (params_get_eui64(addr.u8)) {
264  PRINTA("Random EUI64 address generated\n");
265  }
266 
267 #if UIP_CONF_IPV6
268  memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t));
269 #elif WITH_NODE_ID
270  node_id=get_panaddr_from_eeprom();
271  addr.u8[1]=node_id&0xff;
272  addr.u8[0]=(node_id&0xff00)>>8;
273  PRINTA("Node ID from eeprom: %X\n",node_id);
274 #endif
275  linkaddr_set_node_addr(&addr);
276 
277  rf230_set_pan_addr(params_get_panid(),params_get_panaddr(),(uint8_t *)&addr.u8);
278  rf230_set_channel(params_get_channel());
279  rf230_set_txpower(params_get_txpower());
280 
281 #if UIP_CONF_IPV6
282  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]);
283 #else
284  PRINTA("MAC address ");
285  uint8_t i;
286  for (i=sizeof(linkaddr_t); i>0; i--){
287  PRINTA("%x:",addr.u8[i-1]);
288  }
289  PRINTA("\n");
290 #endif
291 
292  /* Initialize stack protocols */
293  queuebuf_init();
294  NETSTACK_RDC.init();
295  NETSTACK_MAC.init();
296  NETSTACK_NETWORK.init();
297 
298 #if ANNOUNCE_BOOT
299  PRINTA("%s %s, channel %u , check rate %u Hz tx power %u\n",NETSTACK_MAC.name, NETSTACK_RDC.name, rf230_get_channel(),
300  CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:NETSTACK_RDC.channel_check_interval()),
301  rf230_get_txpower());
302 #if UIP_CONF_IPV6_RPL
303  PRINTA("RPL Enabled\n");
304 #endif
305 #if UIP_CONF_ROUTER
306  PRINTA("Routing Enabled\n");
307 #endif
308 
309 #endif /* ANNOUNCE_BOOT */
310 
311  process_start(&tcpip_process, NULL);
312 
313 #ifdef RAVEN_LCD_INTERFACE
314  process_start(&raven_lcd_process, NULL);
315 #endif
316 
317  /* Autostart other processes */
318  autostart_start(autostart_processes);
319 
320  /*---If using coffee file system create initial web content if necessary---*/
321 #if COFFEE_FILES
322  int fa = cfs_open( "/index.html", CFS_READ);
323  if (fa<0) { //Make some default web content
324  PRINTA("No index.html file found, creating upload.html!\n");
325  PRINTA("Formatting FLASH file system for coffee...");
327  PRINTA("Done!\n");
328  fa = cfs_open( "/index.html", CFS_WRITE);
329  int r = cfs_write(fa, &"It works!", 9);
330  if (r<0) PRINTA("Can''t create /index.html!\n");
331  cfs_close(fa);
332 // fa = cfs_open("upload.html"), CFW_WRITE);
333 // <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>
334  }
335 #endif /* COFFEE_FILES */
336 
337 /* Add addresses for testing */
338 #if 0
339 {
340  uip_ip6addr_t ipaddr;
341  uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
342  uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
343 // uip_ds6_prefix_add(&ipaddr,64,0);
344 }
345 #endif
346 
347 /*--------------------------Announce the configuration---------------------*/
348 #if ANNOUNCE_BOOT
349 #if AVR_WEBSERVER
350 { uint8_t i;
351  char buf[80];
352  unsigned int size;
353 
354  for (i=0;i<UIP_DS6_ADDR_NB;i++) {
355  if (uip_ds6_if.addr_list[i].isused) {
356  httpd_cgi_sprint_ip6(uip_ds6_if.addr_list[i].ipaddr,buf);
357  PRINTA("IPv6 Address: %s\n",buf);
358  }
359  }
360  cli();
361  eeprom_read_block (buf,eemem_server_name, sizeof(eemem_server_name));
362  sei();
363  buf[sizeof(eemem_server_name)]=0;
364  PRINTA("%s",buf);
365  cli();
366  eeprom_read_block (buf,eemem_domain_name, sizeof(eemem_domain_name));
367  sei();
368  buf[sizeof(eemem_domain_name)]=0;
369  size=httpd_fs_get_size();
370 #ifndef COFFEE_FILES
371  PRINTA(".%s online with fixed %u byte web content\n",buf,size);
372 #elif COFFEE_FILES==1
373  PRINTA(".%s online with static %u byte EEPROM file system\n",buf,size);
374 #elif COFFEE_FILES==2
375  PRINTA(".%s online with dynamic %u KB EEPROM file system\n",buf,size>>10);
376 #elif COFFEE_FILES==3
377  PRINTA(".%s online with static %u byte program memory file system\n",buf,size);
378 #elif COFFEE_FILES==4
379  PRINTA(".%s online with dynamic %u KB program memory file system\n",buf,size>>10);
380 #endif /* COFFEE_FILES */
381 }
382 #else
383  PRINTA("Online\n");
384 #endif
385 #endif /* ANNOUNCE_BOOT */
386 
387 #if RF230BB_CONF_LEDONPORTE1
388  /* NB: PORTE1 conflicts with UART0 */
389  DDRE|=(1<<DDE1); //set led pin to output (Micheal Hatrtman board)
390  PORTE&=~(1<<PE1); //and low to turn led off
391 #endif
392 }
393 
394 #if ROUTES && UIP_CONF_IPV6
395 static void
396 ipaddr_add(const uip_ipaddr_t *addr)
397 {
398  uint16_t a;
399  int8_t i, f;
400  for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) {
401  a = (addr->u8[i] << 8) + addr->u8[i + 1];
402  if(a == 0 && f >= 0) {
403  if(f++ == 0) PRINTF("::");
404  } else {
405  if(f > 0) {
406  f = -1;
407  } else if(i > 0) {
408  PRINTF(":");
409  }
410  PRINTF("%x",a);
411  }
412  }
413 }
414 #endif
415 
416 /*-------------------------------------------------------------------------*/
417 /*------------------------- Main Scheduler loop----------------------------*/
418 /*-------------------------------------------------------------------------*/
419 int
420 main(void)
421 {
422 #if UIP_CONF_IPV6
423  uip_ds6_nbr_t *nbr;
424 #endif /* UIP_CONF_IPV6 */
425  initialize();
426 
427  while(1) {
428  process_run();
430 
431  /* Turn off LED after a while */
432  if (ledtimer) {
433  if (--ledtimer==0) {
434 #if RF230BB_CONF_LEDONPORTE1
435  PORTE&=~(1<<PE1);
436 #endif
437 #if defined(RAVEN_LCD_INTERFACE)&&0
438  /* ledtimer can be set by received ping; ping the other way for testing */
439  extern void raven_ping6(void);
440  raven_ping6();
441 #endif
442  }
443  }
444 
445 #if 0
446 /* Various entry points for debugging in the AVR Studio simulator.
447  * Set as next statement and step into the routine.
448  */
449  NETSTACK_RADIO.send(packetbuf_hdrptr(), 42);
450  process_poll(&rf230_process);
451  packetbuf_clear();
452  len = rf230_read(packetbuf_dataptr(), PACKETBUF_SIZE);
454  NETSTACK_RDC.input();
455 #endif
456 
457 #if 0
458 /* Clock.c can trigger a periodic PLL calibration in the RF230BB driver.
459  * This can show when that happens.
460  */
461  extern uint8_t rf230_calibrated;
462  if (rf230_calibrated) {
463  PRINTD("\nRF230 calibrated!\n");
464  rf230_calibrated=0;
465  }
466 #endif
467 
468 /* Set DEBUGFLOWSIZE in contiki-conf.h to track path through MAC, RDC, and RADIO */
469 #if DEBUGFLOWSIZE
470  if (debugflowsize) {
471  debugflow[debugflowsize]=0;
472  PRINTF("%s",debugflow);
473  debugflowsize=0;
474  }
475 #endif
476 
477 #if PERIODICPRINTS
478 #if TESTRTIMER
479 /* Timeout can be increased up to 8 seconds maximum.
480  * A one second cycle is convenient for triggering the various debug printouts.
481  * The triggers are staggered to avoid printing everything at once.
482  */
483  if (rtimerflag) {
484  rtimer_set(&rt, RTIMER_NOW()+ RTIMER_ARCH_SECOND*1UL, 1,(void *) rtimercycle, NULL);
485  rtimerflag=0;
486 #else
487  if (clocktime!=clock_seconds()) {
488  clocktime=clock_seconds();
489 #endif
490 
491 #if STAMPS
492 if ((clocktime%STAMPS)==0) {
493 #if ENERGEST_CONF_ON
494 #include "lib/print-stats.h"
495  print_stats();
496 #elif RADIOSTATS
497 extern volatile unsigned long radioontime;
498  PRINTF("%u(%u)s\n",clocktime,radioontime);
499 #else
500  PRINTF("%us\n",clocktime);
501 #endif
502 
503 }
504 #endif
505 #if TESTRTIMER
506  clocktime+=1;
507 #endif
508 
509 #if PINGS && UIP_CONF_IPV6
510 extern void raven_ping6(void);
511 if ((clocktime%PINGS)==1) {
512  PRINTF("**Ping\n");
513  raven_ping6();
514 }
515 #endif
516 
517 #if ROUTES && UIP_CONF_IPV6
518 if ((clocktime%ROUTES)==2) {
519 
520 extern uip_ds6_netif_t uip_ds6_if;
521 
522  uint8_t i,j;
523  PRINTF("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB);
524  for (i=0;i<UIP_DS6_ADDR_NB;i++) {
525  if (uip_ds6_if.addr_list[i].isused) {
526  ipaddr_add(&uip_ds6_if.addr_list[i].ipaddr);
527  PRINTF("\n");
528  }
529  }
530  PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS);
531 
532  for(nbr = nbr_table_head(ds6_neighbors);
533  nbr != NULL;
534  nbr = nbr_table_next(ds6_neighbors, nbr)) {
535  ipaddr_add(&nbr->ipaddr);
536  PRINTF("\n");
537  j=0;
538  }
539  if (j) PRINTF(" <none>");
540  PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
541  {
542  uip_ds6_route_t *r;
543  PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
544  j = 1;
545  for(r = uip_ds6_route_head();
546  r != NULL;
547  r = uip_ds6_route_next(r)) {
548  ipaddr_add(&r->ipaddr);
549  PRINTF("/%u (via ", r->length);
550  ipaddr_add(uip_ds6_route_nexthop(r));
551  PRINTF(") %lus\n", r->state.lifetime);
552  j = 0;
553  }
554  }
555  if (j) PRINTF(" <none>");
556  PRINTF("\n---------\n");
557 }
558 #endif
559 
560 #if STACKMONITOR
561 if ((clocktime%STACKMONITOR)==3) {
562  extern uint16_t __bss_end;
563  uint16_t p=(uint16_t)&__bss_end;
564  do {
565  if (*(uint16_t *)p != 0x4242) {
566  PRINTF("Never-used stack > %d bytes\n",p-(uint16_t)&__bss_end);
567  break;
568  }
569  p+=10;
570  } while (p<RAMEND-10);
571 }
572 #endif
573 
574  }
575 #endif /* PERIODICPRINTS */
576 
577 #if RF230BB&&0
578 extern uint8_t rf230processflag;
579  if (rf230processflag) {
580  PRINTF("rf230p%d",rf230processflag);
581  rf230processflag=0;
582  }
583 #endif
584 
585 #if RF230BB&&0
586 extern uint8_t rf230_interrupt_flag;
587  if (rf230_interrupt_flag) {
588  // if (rf230_interrupt_flag!=11) {
589  PRINTF("**RI%u",rf230_interrupt_flag);
590  // }
591  rf230_interrupt_flag=0;
592  }
593 #endif
594  }
595  return 0;
596 }
597 
598 /*---------------------------------------------------------------------------*/
599 
600 void log_message(char *m1, char *m2)
601 {
602  PRINTF("%s%s\n", m1, m2);
603 }
void rs232_init(void)
Initialize the RS232 module.
Definition: rs232.c:50
An entry in the routing table.
A MAC framer for IEEE 802.15.4
void process_poll(struct process *p)
Request a process to be polled.
Definition: process.c:371
CCIF uip_lladdr_t uip_lladdr
Host L2 address.
Definition: uip6.c:115
802.15.4 frame creation and parsing functions
int cfs_open(const char *name, int flags)
Open a file.
Definition: cfs-coffee.c:996
#define PORTE
Peripheral PORTE base pointer.
Definition: MK60D10.h:6431
#define CFS_WRITE
Specify that cfs_open() should open a file for writing.
Definition: cfs.h:104
void watchdog_start(void)
Starts the WDT in watchdog mode if enabled by user configuration, maximum interval.
Definition: watchdog.c:49
int rtimer_set(struct rtimer *rtimer, rtimer_clock_t time, rtimer_clock_t duration, rtimer_callback_t func, void *ptr)
Post a real-time task.
Definition: rtimer.c:67
void rtimer_init(void)
Initialize the real-time scheduler.
Definition: rtimer.c:61
void calibrate_rc_osc_32k(void)
Calibrate the internal RC oscillator.
Definition: radio.c:1332
void rs232_set_input(int(*f)(unsigned char))
Set an input handler for incoming RS232 data.
Definition: rs232.c:55
#define NULL
The null pointer.
#define CFS_READ
Specify that cfs_open() should open a file for reading.
Definition: cfs.h:90
void clock_init(void)
Initialize the clock library.
Definition: clock.c:76
int main(void)
This is main...
Definition: ethconfig.c:49
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
Definition: packetbuf.c:200
void process_init(void)
Initialize the process module.
Definition: process.c:208
Header file for the Rime stack
Header file for the 6lowpan implementation (RFC4944 and draft-hui-6lowpan-hc-01) ...
void random_init(unsigned short seed)
Seed the cc2430 random number generator.
Definition: random.c:41
void * packetbuf_hdrptr(void)
Get a pointer to the header in the packetbuf, for outbound packets.
Definition: packetbuf.c:213
Convenience function for printing system statistics
Generic serial I/O process header filer.
void watchdog_periodic(void)
Writes the WDT clear sequence.
Definition: watchdog.c:64
void ctimer_init(void)
Initialize the callback timer library.
Definition: ctimer.c:91
CCIF unsigned long clock_seconds(void)
Get the current value of the platform seconds.
Definition: clock.c:57
void packetbuf_clear(void)
Clear and reset the packetbuf.
Definition: packetbuf.c:77
void process_start(struct process *p, process_data_t data)
Start a process.
Definition: process.c:99
int cfs_coffee_format(void)
Format the storage area assigned to Coffee.
Definition: cfs-coffee.c:1346
#define RTIMER_NOW()
Get the current clock time.
Definition: rtimer.h:133
Interface structure (contains all the interface variables)
Definition: uip-ds6.h:212
int process_run(void)
Run the system once - call poll handlers and process one event.
Definition: process.c:302
#define PACKETBUF_SIZE
The size of the packetbuf, in bytes.
Definition: packetbuf.h:65
void linkaddr_set_node_addr(linkaddr_t *t)
Set the address of the current node.
Definition: linkaddr.c:72
Representation of a real-time task.
Definition: rtimer.h:84
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
Definition: packetbuf.c:207
Header for the Coffee file system.
#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)
Construct an IPv6 address from eight 16-bit words.
Definition: uip.h:969
void watchdog_init(void)
Copyright (c) 2014, Analog Devices, Inc.
Definition: watchdog.c:42
void cfs_close(int fd)
Close an open file.
Definition: cfs-coffee.c:1032
#define CLOCK_SECOND
A second, measured in system clock time.
Definition: clock.h:82
An entry in the nbr cache.
Definition: uip-ds6-nbr.h:70
CFS header file.