From 9f299c277e502e02a8b7ba42677db46e35715cb7 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 23 Apr 2009 09:15:51 +0000 Subject: [PATCH] added experimental slip support for contiki motes --- platform/cooja/Makefile.cooja | 4 ++-- platform/cooja/init-net-uip.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/platform/cooja/Makefile.cooja b/platform/cooja/Makefile.cooja index b241d3a43..f3f0ae29b 100644 --- a/platform/cooja/Makefile.cooja +++ b/platform/cooja/Makefile.cooja @@ -1,4 +1,4 @@ -# $Id: Makefile.cooja,v 1.33 2009/04/01 13:39:54 fros4943 Exp $ +# $Id: Makefile.cooja,v 1.34 2009/04/23 09:15:51 fros4943 Exp $ ## The COOJA Simulator Contiki platform Makefile ## @@ -51,7 +51,7 @@ CONTIKI_APP_OBJ = $(CONTIKI_APP).co COOJA = $(CONTIKI)/platform/$(TARGET) CONTIKI_TARGET_DIRS = . dev lib sys cfs net -COOJA_BASE = simEnvChange.c irq.c cooja_mt.c cooja_mtarch.c rtimer-arch.c +COOJA_BASE = simEnvChange.c irq.c cooja_mt.c cooja_mtarch.c rtimer-arch.c slip.c COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \ pir-sensor.c rs232.c vib-sensor.c \ diff --git a/platform/cooja/init-net-uip.c b/platform/cooja/init-net-uip.c index 73967d031..f0e187281 100644 --- a/platform/cooja/init-net-uip.c +++ b/platform/cooja/init-net-uip.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: init-net-uip.c,v 1.3 2009/04/01 13:50:12 fros4943 Exp $ + * $Id: init-net-uip.c,v 1.4 2009/04/23 09:15:51 fros4943 Exp $ */ #include "contiki.h" @@ -43,6 +43,8 @@ #include "node-id.h" #include "dev/cooja-radio.h" +#include "dev/slip.h" + #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) /*---------------------------------------------------------------------------*/ @@ -60,7 +62,10 @@ receiver(const struct radio_driver *d) } /*---------------------------------------------------------------------------*/ /* Only using a single network interface */ -static struct uip_fw_netif default_if = {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, sender)}; +static struct uip_fw_netif wsn_if = + {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, sender)}; +static struct uip_fw_netif slip_if = + {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, slip_send)}; /*---------------------------------------------------------------------------*/ void init_net(void) @@ -83,15 +88,19 @@ init_net(void) /* Init uIPv4 */ process_start(&tcpip_process, NULL); process_start(&uip_fw_process, NULL); + process_start(&slip_process, NULL); uip_init(); + uip_fw_init(); uip_ipaddr(&hostaddr, 172, 16, rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0]); uip_ipaddr(&netmask, 255,255,0,0); uip_sethostaddr(&hostaddr); uip_setnetmask(&netmask); - uip_fw_default(&default_if); + uip_fw_register(&wsn_if); + uip_fw_default(&slip_if); + rs232_set_input(slip_input_byte); printf("uIP started with IP address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr)); /* uIPv4 <-> COOJA's packet radio */ - tcpip_set_outputfunc(sender); + /*tcpip_set_outputfunc(sender);*/ cooja_radio.set_receive_function(receiver); }