Added IP/SLIP support

This commit is contained in:
adamdunkels 2007-03-22 19:04:43 +00:00
parent b731014bc0
commit 630ec03ba1
2 changed files with 33 additions and 7 deletions

View file

@ -1,10 +1,11 @@
# $Id: Makefile.sky,v 1.2 2007/03/21 23:26:12 adamdunkels Exp $
# $Id: Makefile.sky,v 1.3 2007/03/22 19:04:43 adamdunkels Exp $
ARCH=msp430.c minileds.c watchdog.c light.c button.c spi.c ds2411.c \
rom.c xmem.c i2c.c \
simple-cc2420.c simple-cc2420-rime.c cc2420_uart0.c irq.c \
node-id.c sensors.c button-sensor.c cfs-xmem.c
node-id.c sensors.c button-sensor.c cfs-xmem.c \
slip.c slip_uart1.c uip-ipchksum.c
CONTIKI_TARGET_DIRS = . dev apps net loader
ifndef CONTIKI_TARGET_MAIN
@ -26,3 +27,6 @@ ifndef COMPORT
endif
%.up: %.ihex
$(BSL) --telosb -D -c $(COMPORT) -r -e -I -p $<
%.send: %.co
$(CONTIKI)/tools/codeprop 192.168.1.2 $<

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: contiki-sky-main.c,v 1.2 2007/03/21 23:26:34 adamdunkels Exp $
* @(#)$Id: contiki-sky-main.c,v 1.3 2007/03/22 19:04:43 adamdunkels Exp $
*/
#include <stdio.h>
@ -45,6 +45,7 @@
#include "dev/xmem.h"
#include "dev/simple-cc2420.h"
#include "dev/simple-cc2420-rime.h"
#include "dev/slip.h"
#include "dev/uart1.h"
#include "net/rime.h"
@ -54,6 +55,14 @@
/*#include "codeprop/codeprop.h"*/
SENSORS(&button_sensor);
#define WITH_UIP 1
#if WITH_UIP
static struct uip_fw_netif slipif =
{UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)};
#endif /* WITH_UIP */
/*---------------------------------------------------------------------------*/
#if 0
int
@ -86,10 +95,11 @@ main(int argc, char **argv)
leds_init();
leds_toggle(LEDS_RED | LEDS_GREEN | LEDS_BLUE);
uart1_init(BAUD2UBR(57600)); /* Must come before first printf */
/* uart1_init(BAUD2UBR(57600)); /\* Must come before first printf *\/ */
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
printf("Starting %s "
"($Id: contiki-sky-main.c,v 1.2 2007/03/21 23:26:34 adamdunkels Exp $)\n", __FILE__);
"($Id: contiki-sky-main.c,v 1.3 2007/03/22 19:04:43 adamdunkels Exp $)\n", __FILE__);
ds2411_init();
sensors_light_init();
xmem_init();
@ -104,6 +114,14 @@ main(int argc, char **argv)
simple_cc2420_set_chan_pan_addr(RF_CHANNEL, panId, 0 /*XXX*/, ds2411_id);
#if WITH_UIP
uip_init();
uip_sethostaddr(&slipif.ipaddr);
uip_setnetmask(&slipif.netmask);
uip_fw_default(&slipif); /* Point2point, no default router. */
tcpip_set_forwarding(0);
#endif /* WITH_UIP */
/*
* Initialize Contiki and our processes.
*/
@ -119,8 +137,12 @@ main(int argc, char **argv)
rime_init();
/* rimeaddr_set_node_addr*/
#if WITH_UIP
process_start(&tcpip_process, NULL);
process_start(&uip_fw_process, NULL); /* Start IP output */
process_start(&slip_process, NULL);
/* process_start(&tcp_loader_process, NULL);*/
#endif /* WITH_UIP */
printf("Autostarting processes\n");
autostart_start((struct process **) autostart_processes);