Contiki 3.x
contiki-z1-main.c
1 /*
2  * Copyright (c) 2006, Swedish Institute of Computer Science
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  */
30 
31 #include <stdio.h>
32 #include <string.h>
33 #include <stdarg.h>
34 
35 #include "contiki.h"
36 #include "platform-conf.h"
37 #include "isr_compat.h"
38 //#include "dev/cc2420.h"
39 #include "cc1120.h"
40 #include "cc1120-arch.h"
41 #include "dev/leds.h"
42 #include "dev/serial-line.h"
43 #include "dev/slip.h"
44 #include "dev/avr-handler.h"
45 #ifndef NO_SLIP
46  #include "dev/slip.h"
47 #endif
48 #include "dev/uart0.h"
49 #include "dev/watchdog.h"
50 #include "dev/xmem.h"
51 #include "lib/random.h"
52 #include "net/netstack.h"
53 #include "net/mac/frame802154.h"
54 #include "dev/button-sensor.h"
55 #include "dev/adxl345.h"
56 #include "sys/clock.h"
57 #include "dev/uart1_i2c_master.h"
58 #include "dev/reset-sensor.h"
59 #include "dev/spi.h"
60 #if NETSTACK_CONF_WITH_IPV6
61 #include "net/ipv6/uip-ds6.h"
62 #endif /* NETSTACK_CONF_WITH_IPV6 */
63 
64 #include "net/rime/rime.h"
65 
66 #include "sys/node-id.h"
67 #include "cfs-coffee-arch.h"
68 #include "cfs/cfs-coffee.h"
69 #include "sys/autostart.h"
70 
71 #include "dev/battery-sensor.h"
72 #include "dev/button-sensor.h"
73 
74 SENSORS(&button_sensor);
75 
76 extern unsigned char node_mac[8];
77 
78 #if DCOSYNCH_CONF_ENABLED
79 static struct timer mgt_timer;
80 #endif
81 
82 #ifndef NETSTACK_CONF_WITH_IPV4
83 #define NETSTACK_CONF_WITH_IPV4 0
84 #endif
85 
86 #if NETSTACK_CONF_WITH_IPV4
87 #include "net/ip/uip.h"
88 #include "net/ipv4/uip-fw.h"
89 #include "net/uip-fw-drv.h"
90 #include "net/ipv4/uip-over-mesh.h"
91 static struct uip_fw_netif slipif =
92 { UIP_FW_NETIF(192, 168, 1, 2, 255, 255, 255, 255, slip_send) };
93 static struct uip_fw_netif meshif =
94 { UIP_FW_NETIF(172, 16, 0, 0, 255, 255, 0, 0, uip_over_mesh_send) };
95 
96 #endif /* NETSTACK_CONF_WITH_IPV4 */
97 
98 #define UIP_OVER_MESH_CHANNEL 8
99 #if NETSTACK_CONF_WITH_IPV4
100 static uint8_t is_gateway;
101 #endif /* NETSTACK_CONF_WITH_IPV4 */
102 
103 #ifdef EXPERIMENT_SETUP
104 #include "experiment-setup.h"
105 #endif
106 
107 #define DEBUG 1
108 #if DEBUG
109 #include <stdio.h>
110 #define PRINTF(...) printf(__VA_ARGS__)
111 #else
112 #define PRINTF(...)
113 #endif
114 
115 void init_platform(void);
116 
117 /*---------------------------------------------------------------------------*/
118 #if 0
119 int
120 force_float_inclusion()
121 {
122  extern int __fixsfsi;
123  extern int __floatsisf;
124  extern int __mulsf3;
125  extern int __subsf3;
126 
127  return __fixsfsi + __floatsisf + __mulsf3 + __subsf3;
128 }
129 #endif
130 /*---------------------------------------------------------------------------*/
131 void
132 uip_log(char *msg)
133 {
134  puts(msg);
135 }
136 /*---------------------------------------------------------------------------*/
137 #if 0
138 void
139 force_inclusion(int d1, int d2)
140 {
141  snprintf(NULL, 0, "%d", d1 % d2);
142 }
143 #endif
144 /*---------------------------------------------------------------------------*/
145 static void
146 set_rime_addr(void)
147 {
148  linkaddr_t addr;
149  //int i;
150 
151  memset(&addr, 0, sizeof(linkaddr_t));
152 #if NETSTACK_CONF_WITH_IPV6
153  memcpy(addr.u8, node_mac, sizeof(addr.u8));
154 #else
155  if(node_id == 0) {
156  for(i = 0; i < sizeof(linkaddr_t); ++i) {
157  addr.u8[i] = node_mac[7 - i];
158  }
159  } else {
160  addr.u8[0] = node_id & 0xff;
161  addr.u8[1] = node_id >> 8;
162  }
163 #endif
164  linkaddr_set_node_addr(&addr);
165  /*printf("Rime started with address ");
166  for(i = 0; i < sizeof(addr.u8) - 1; i++) {
167  printf("%d.", addr.u8[i]);
168  }
169  printf("%d\n", addr.u8[i]);*/
170 }
171 /*---------------------------------------------------------------------------*/
172 static void
173 print_processes(struct process *const processes[])
174 {
175  /* const struct process * const * p = processes;*/
176  printf("Starting");
177  while(*processes != NULL) {
178  //printf(" '%s'", (*processes)->name);
179  processes++;
180  }
181  putchar('\n');
182 }
183 /*--------------------------------------------------------------------------*/
184 #if NETSTACK_CONF_WITH_IPV4
185 static void
186 set_gateway(void)
187 {
188  if(!is_gateway) {
189  leds_on(LEDS_RED);
190  printf("%d.%d: making myself the IP network gateway.\n\n",
192  printf("IPv4 address of the gateway: %d.%d.%d.%d\n\n",
193  uip_ipaddr_to_quad(&uip_hostaddr));
194  uip_over_mesh_set_gateway(&linkaddr_node_addr);
195  uip_over_mesh_make_announced_gateway();
196  is_gateway = 1;
197  }
198 }
199 #endif /* NETSTACK_CONF_WITH_IPV4 */
200 /*---------------------------------------------------------------------------*/
201 int
202 main(int argc, char **argv)
203 {
204  /*
205  * Initalize hardware.
206  */
207  msp430_cpu_init();
208  clock_init();
209  i2c_enable();
210 
211  RADIO_EN_PORT(DIR) |= BV(RADIO_EN_PIN);
212  RADIO_EN_PORT(OUT) |= BV(RADIO_EN_PIN); /* Set Radio high to ensure radio is on */
213 
214 
215  cc1120_arch_pin_init(); /* Configure CC1120 SPI pins to prevent SPI conflicts. */
216 
217  leds_init();
218  leds_on(LEDS_RED);
219 
220  clock_wait(100);
221 
222  uart0_init(BAUD2UBR(115200)); /* Must come before first printf */
223 #if NETSTACK_CONF_WITH_IPV4
224  slip_arch_init(BAUD2UBR(115200));
225 #endif /* NETSTACK_CONF_WITH_IPV4 */
226 
227  uart1_pin_init();
228 #ifndef Z1_SAMPLER_AVR_DISABLE
229  uart1_init('b'); /* It ignores the input to the func */
230 #endif
231  spi_init(); /* Initialise SPI. Moved here to limit re-init problems. */
232  xmem_init();
233  rtimer_init();
234  /*
235  * Hardware initialization done!
236  */
237 
238  /* Restore node id if such has been stored in external mem */
239  node_id_restore();
240 
241  /* If no MAC address was burned, we use the node ID. */
242  if(!(node_mac[0] | node_mac[1] | node_mac[2] | node_mac[3] |
243  node_mac[4] | node_mac[5] | node_mac[6] | node_mac[7])) {
244  node_mac[0] = 0xc1; /* Hardcoded for Z1 */
245  node_mac[1] = 0x0c; /* Hardcoded for Revision C */
246  node_mac[2] = 0x00; /* Hardcoded to arbitrary even number so that
247  the 802.15.4 MAC address is compatible with
248  an Ethernet MAC address - byte 0 (byte 2 in
249  the DS ID) */
250  node_mac[3] = 0x00; /* Hardcoded */
251  node_mac[4] = 0x00; /* Hardcoded */
252  node_mac[5] = 0x00; /* Hardcoded */
253  node_mac[6] = node_id >> 8;
254  node_mac[7] = node_id & 0xff;
255  }
256 
257  /* Overwrite node MAC if desired at compile time */
258 #ifdef MACID
259 #warning "***** CHANGING DEFAULT MAC *****"
260  node_mac[0] = 0xc1; /* Hardcoded for Z1 */
261  node_mac[1] = 0x0c; /* Hardcoded for Revision C */
262  node_mac[2] = 0x00; /* Hardcoded to arbitrary even number so that
263  the 802.15.4 MAC address is compatible with
264  an Ethernet MAC address - byte 0 (byte 2 in
265  the DS ID) */
266  node_mac[3] = 0x00; /* Hardcoded */
267  node_mac[4] = 0x00; /* Hardcoded */
268  node_mac[5] = 0x00; /* Hardcoded */
269  node_mac[6] = MACID >> 8;
270  node_mac[7] = MACID & 0xff;
271 #endif
272 
273 #ifdef IEEE_802154_MAC_ADDRESS
274  /* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
275  {
276  uint8_t ieee[] = IEEE_802154_MAC_ADDRESS;
277  memcpy(node_mac, ieee, sizeof(uip_lladdr.addr));
278  node_mac[7] = node_id & 0xff;
279  }
280 #endif /* IEEE_802154_MAC_ADDRESS */
281 
282  /*
283  * Initialize Contiki and our processes.
284  */
285  process_init();
286  process_start(&etimer_process, NULL);
287 
288  ctimer_init();
289 
290  init_platform();
291 
292  set_rime_addr();
293 
294  NETSTACK_RADIO.init();
295  //cc11xx_arch_init();
296  //cc2420_init();
297 #ifndef FESHIE_NO_ACC
298  accm_init();
299 #endif // FESHIE_NO_ACC
300 
301  {
302  uint8_t longaddr[8];
303  //uint16_t shortaddr;
304 
305  //shortaddr = (linkaddr_node_addr.u8[0] << 8) +
306  // linkaddr_node_addr.u8[1];
307  memset(longaddr, 0, sizeof(longaddr));
308  linkaddr_copy((linkaddr_t *)&longaddr, &linkaddr_node_addr);
309  //printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
310  // longaddr[0], longaddr[1], longaddr[2], longaddr[3],
311  // longaddr[4], longaddr[5], longaddr[6], longaddr[7]);
312 
313  //cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
314  }
315  //cc2420_set_channel(RF_CHANNEL);
316  //printf("Set channel to 42...");
317  //cc1120_set_channel(RF_CHANNEL);
318  //printf("OK\n\r");
319  leds_off(LEDS_ALL);
320 
321  PRINTF(CONTIKI_VERSION_STRING " started. ");
322 
323  //update reset counter
324  reset_sensor.configure(SENSORS_ACTIVE,1); //update reet counter
325  printf("Reset Count %d \n",reset_sensor.value(0)); //print rurrent reset count
326 
327  if(node_id) {
328  PRINTF("Node id is set to %u.\n", node_id);
329  } else {
330  PRINTF("Node id not set\n");
331  }
332 
333 #if NETSTACK_CONF_WITH_IPV6
334  memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
335  /* Setup nullmac-like MAC for 802.15.4 */
336 /* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */
337 /* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */
338 
339  /* Setup X-MAC for 802.15.4 */
340  queuebuf_init();
341 
342  NETSTACK_RDC.init();
343  NETSTACK_MAC.init();
344  NETSTACK_NETWORK.init();
345 
346  //printf("%s %s, channel check rate %lu Hz, radio channel %u\n",
347  // NETSTACK_MAC.name, NETSTACK_RDC.name,
348  // CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 :
349  // NETSTACK_RDC.channel_check_interval()),
350  // RF_CHANNEL);
351 
352  process_start(&tcpip_process, NULL);
353 
354  printf("Tentative link-local IPv6 address ");
355  {
356  uip_ds6_addr_t *lladdr;
357  int i;
358  lladdr = uip_ds6_get_link_local(-1);
359  for(i = 0; i < 7; ++i) {
360  printf("%02x%02x:", lladdr->ipaddr.u8[i * 2],
361  lladdr->ipaddr.u8[i * 2 + 1]);
362  }
363  printf("%02x%02x\n", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
364  }
365 
366  if(!UIP_CONF_IPV6_RPL) {
367  uip_ipaddr_t ipaddr;
368  int i;
369  uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
370  uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
371  uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
372  printf("Tentative global IPv6 address ");
373  for(i = 0; i < 7; ++i) {
374  printf("%02x%02x:",
375  ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
376  }
377  printf("%02x%02x\n",
378  ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
379  }
380 
381 #else /* NETSTACK_CONF_WITH_IPV6 */
382 
383  NETSTACK_RDC.init();
384  NETSTACK_MAC.init();
385  NETSTACK_NETWORK.init();
386 
387  printf("%s %s, channel check rate %lu Hz, radio channel %u\n",
388  NETSTACK_MAC.name, NETSTACK_RDC.name,
389  CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 :
390  NETSTACK_RDC.channel_check_interval()),
391  CC2420_CONF_CHANNEL);
392 #endif /* NETSTACK_CONF_WITH_IPV6 */
393 
394 #if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6
395  uart0_set_input(serial_line_input_byte);
396  serial_line_init();
397 #endif
398 
399 #ifndef Z1_SAMPLER_AVR_DISABLE
400  uart1_set_input(avr_input_byte);
401  avr_set_output(uart1_writearray);
402  process_start(&avr_process, NULL);
403 #endif
404 
405 #if PROFILE_CONF_ON
406  profile_init();
407 #endif /* PROFILE_CONF_ON */
408 
409  leds_off(LEDS_GREEN);
410 
411 #if TIMESYNCH_CONF_ENABLED
412  timesynch_init();
414 #endif /* TIMESYNCH_CONF_ENABLED */
415 
416 #if NETSTACK_CONF_WITH_IPV4
417  process_start(&tcpip_process, NULL);
418  process_start(&uip_fw_process, NULL); /* Start IP output */
419  process_start(&slip_process, NULL);
420 
421  slip_set_input_callback(set_gateway);
422 
423  {
424  uip_ipaddr_t hostaddr, netmask;
425 
426  uip_init();
427 
428  uip_ipaddr(&hostaddr, 172, 16,
430  uip_ipaddr(&netmask, 255, 255, 0, 0);
431  uip_ipaddr_copy(&meshif.ipaddr, &hostaddr);
432 
433  uip_sethostaddr(&hostaddr);
434  uip_setnetmask(&netmask);
435  uip_over_mesh_set_net(&hostaddr, &netmask);
436 #ifndef NO_SLIP
437  /* uip_fw_register(&slipif);*/
438  uip_over_mesh_set_gateway_netif(&slipif);
439 #endif
440  uip_fw_default(&meshif);
441  uip_over_mesh_init(UIP_OVER_MESH_CHANNEL);
442  printf("uIP started with IP address %d.%d.%d.%d\n",
443  uip_ipaddr_to_quad(&hostaddr));
444  }
445 #endif /* NETSTACK_CONF_WITH_IPV4 */
446 
447  energest_init();
448  ENERGEST_ON(ENERGEST_TYPE_CPU);
449 
450  print_processes(autostart_processes);
451  autostart_start(autostart_processes);
452 
453  /*
454  * This is the scheduler loop.
455  */
456 #if DCOSYNCH_CONF_ENABLED
457  timer_set(&mgt_timer, DCOSYNCH_PERIOD * CLOCK_SECOND);
458 #endif
459  watchdog_start();
460  /* watchdog_stop();*/
461  while(1) {
462  int r;
463 #if PROFILE_CONF_ON
464  profile_episode_start();
465 #endif /* PROFILE_CONF_ON */
466  do {
467  /* Reset watchdog. */
469  r = process_run();
470  } while(r > 0);
471 #if PROFILE_CONF_ON
472  profile_episode_end();
473 #endif /* PROFILE_CONF_ON */
474 
475  /*
476  * Idle processing.
477  */
478  int s = splhigh(); /* Disable interrupts. */
479  /* uart0_active is for avoiding LPM3 when still sending or receiving */
480  if(process_nevents() != 0 || uart0_active()) {
481  splx(s); /* Re-enable interrupts. */
482  } else {
483  static unsigned long irq_energest = 0;
484 
485 #if DCOSYNCH_CONF_ENABLED
486  /* before going down to sleep possibly do some management */
487  if(timer_expired(&mgt_timer)) {
488  timer_reset(&mgt_timer);
489  msp430_sync_dco();
490  }
491 #endif
492 
493  /* Re-enable interrupts and go to sleep atomically. */
494  ENERGEST_OFF(ENERGEST_TYPE_CPU);
495  ENERGEST_ON(ENERGEST_TYPE_LPM);
496  /* We only want to measure the processing done in IRQs when we
497  are asleep, so we discard the processing time done when we
498  were awake. */
499  energest_type_set(ENERGEST_TYPE_IRQ, irq_energest);
500  watchdog_stop();
501  _BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This
502  statement will block
503  until the CPU is
504  woken up by an
505  interrupt that sets
506  the wake up flag. */
507 
508  /* We get the current processing time for interrupts that was
509  done during the LPM and store it for next time around. */
510  dint();
511  irq_energest = energest_type_time(ENERGEST_TYPE_IRQ);
512  eint();
513  watchdog_start();
514  ENERGEST_OFF(ENERGEST_TYPE_LPM);
515  ENERGEST_ON(ENERGEST_TYPE_CPU);
516  }
517  }
518 
519  return 0;
520 }
521 /*---------------------------------------------------------------------------*/
522 
523 void
524 clock_delay_usec(uint16_t usec)
525 {
526  clock_delay(usec / 100);
527 }
528 
529 #if LOG_CONF_ENABLED
530 void
531 log_message(char *m1, char *m2)
532 {
533  printf("%s%s\n", m1, m2);
534 }
535 #endif /* LOG_CONF_ENABLED */
536 
void uip_log(char *msg)
Print out a uIP log message.
#define uip_sethostaddr(addr)
Set the IP address of this host.
Definition: uip.h:192
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
Definition: uip-nd6.c:129
void uart0_init(unsigned long ubr)
Initalize the RS232 port.
Definition: uart0.c:143
void timer_reset(struct timer *t)
Reset the timer with the same interval.
Definition: timer.c:85
#define uip_ipaddr(addr, addr0, addr1, addr2, addr3)
Construct an IP address from four bytes.
Definition: uip.h:956
void timesynch_set_authority_level(int level)
Set the authority level of the current time.
static uip_ds6_addr_t * addr
Pointer to a router list entry.
Definition: uip-nd6.c:124
uint8_t slip_send(void)
Send an IP packet from the uIP buffer with SLIP.
Definition: slip.c:193
Header file for IPv6-related data structures.
void uart1_init(unsigned long ubr)
Initalize the RS232 port.
Definition: uart1.c:143
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
Definition: timer.c:64
uip_ipaddr_t ipaddr
The IP address of this interface.
Definition: uip-fw.h:57
A timer.
Definition: timer.h:86
void watchdog_stop(void)
Stops the WDT such that it won't timeout and cause MCU reset.
Definition: watchdog.c:58
Header file for tunnelling uIP over Rime mesh
void clock_init(void)
Initialize the clock library.
Definition: clock.c:76
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
Definition: uip.h:1027
Platform configuration for the Z1-feshie platform
void uart1_pin_init(void)
Configure pins for RS232 port.
Definition: i2cmaster.c:323
void i2c_enable(void)
Configure serial controller in I2C mode and set I2C speed.
Definition: i2c.c:52
int process_run(void)
Run the system once - call poll handlers and process one event.
Definition: process.c:302
Unicast address structure.
Definition: uip-ds6.h:202
void slip_arch_init(unsigned long ubr)
Initalize the RS232 port and the SLIP driver.
Definition: slip-arch.c:56
void slip_set_input_callback(void(*c)(void))
Set a function to be called when there is activity on the SLIP interface; used for detecting if a nod...
Definition: slip.c:143
SENSORS & button_sensor
Copyright (c) 2014, Analog Devices, Inc.
uip_ipaddr_t netmask
The netmask of the interface.
Definition: uip-fw.h:58
Header file for the Rime stack
#define uip_setnetmask(addr)
Set the netmask.
Definition: uip.h:236
#define NULL
The null pointer.
#define uip_ipaddr_to_quad(a)
Convert an IP address to four bytes separated by commas.
Definition: uip.h:928
802.15.4 frame creation and parsing functions
uIP packet forwarding header file.
void linkaddr_set_node_addr(linkaddr_t *t)
Set the address of the current node.
Definition: linkaddr.c:72
#define UIP_FW_NETIF(ip1, ip2, ip3, ip4, nm1, nm2, nm3, nm4, outputfunc)
Instantiating macro for a uIP network interface.
Definition: uip-fw.h:80
void watchdog_periodic(void)
Writes the WDT clear sequence.
Definition: watchdog.c:64
#define ADDR_TENTATIVE
Possible states for the an address (RFC 4862)
Definition: uip-ds6.h:153
#define CLOCK_SECOND
A second, measured in system clock time.
Definition: clock.h:82
#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)
Construct an IPv6 address from eight 16-bit words.
Definition: uip.h:970
Header file for the uIP TCP/IP stack.
I2C communication device driver header file for Zolertia Z1 sensor node.
void clock_delay(unsigned int delay)
Obsolete delay function but we implement it here since some code still uses it.
Definition: clock.c:60
void process_start(struct process *p, process_data_t data)
Start a process.
Definition: process.c:99
Header for the Coffee file system.
uip_ds6_addr_t * uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type)
Add a unicast address to the interface.
Definition: uip-ds6.c:326
Header file for module for automatically starting and exiting a list of processes.
void clock_wait(clock_time_t t)
Wait for a given number of ticks.
Definition: clock.c:162
void timesynch_init(void)
Initialize the timesynch module.
void rtimer_init(void)
Initialize the real-time scheduler.
Definition: rtimer.c:61
Generic serial I/O process header filer.
CCIF uip_lladdr_t uip_lladdr
Host L2 address.
Definition: uip.c:118
void uip_init(void)
uIP initialization function.
Definition: uip.c:363
int process_nevents(void)
Number of events waiting to be processed.
Definition: process.c:316
void process_init(void)
Initialize the process module.
Definition: process.c:208
void ctimer_init(void)
Initialize the callback timer library.
Definition: ctimer.c:91
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a Rime address.
Definition: linkaddr.c:60
linkaddr_t linkaddr_node_addr
The Rime address of the node.
Definition: linkaddr.c:48
int serial_line_input_byte(unsigned char c)
Get one byte of input from the serial driver.
Definition: serial-line.c:60
void watchdog_start(void)
Starts the WDT in watchdog mode if enabled by user configuration, maximum interval.
Definition: watchdog.c:49
void clock_delay_usec(uint16_t usec)
Delay a given number of microseconds.
Coffee architecture-dependent header for the Zolertia Z1 platform.
Include file for the Contiki low-layer network stack (NETSTACK)
void uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr)
set the last 64 bits of an IP address based on the MAC address
Definition: uip-ds6.c:542
void uip_fw_default(struct uip_fw_netif *netif)
Register a default network interface.
Definition: uip-fw.c:515
int timer_expired(struct timer *t)
Check if a timer has expired.
Definition: timer.c:122
Representation of a uIP network interface.
Definition: uip-fw.h:54