Modifs to minimal-net for IPv6 support

This commit is contained in:
julienabeille 2008-10-14 10:06:26 +00:00
parent f5f0044578
commit 9b2961046a
3 changed files with 38 additions and 16 deletions

View file

@ -5,13 +5,18 @@ endif
CONTIKI_TARGET_DIRS = . CONTIKI_TARGET_DIRS = .
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
CONTIKI_TARGET_SOURCEFILES = contiki-main.c dlloader.c clock.c \ CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c leds.c leds-arch.c cfs-posix.c cfs-posix-dir.c dlloader.c
leds.c leds-arch.c cfs-posix.c cfs-posix-dir.c
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
else else
CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c tapdev.c CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c
#math
ifndef UIP_CONF_IPV6
CONTIKI_TARGET_SOURCEFILES += tapdev.c
else
CONTIKI_TARGET_SOURCEFILES += tapdev6.c
endif
endif endif
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)

View file

@ -28,13 +28,14 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: contiki-conf.h,v 1.6 2007/11/18 00:46:51 oliverschmidt Exp $ * @(#)$Id: contiki-conf.h,v 1.7 2008/10/14 10:06:26 julienabeille Exp $
*/ */
#ifndef __CONTIKI_CONF_H__ #ifndef __CONTIKI_CONF_H__
#define __CONTIKI_CONF_H__ #define __CONTIKI_CONF_H__
#include <inttypes.h> #include <inttypes.h>
#include <limits.h>
#define CC_CONF_REGISTER_ARGS 1 #define CC_CONF_REGISTER_ARGS 1
#define CC_CONF_FUNCTION_POINTER_ARGS 1 #define CC_CONF_FUNCTION_POINTER_ARGS 1
@ -50,16 +51,28 @@ typedef uint32_t u32_t;
typedef int32_t s32_t; typedef int32_t s32_t;
typedef unsigned short uip_stats_t; typedef unsigned short uip_stats_t;
#define UIP_CONF_MAX_CONNECTIONS 40 #define UIP_CONF_MAX_CONNECTIONS 40
#define UIP_CONF_MAX_LISTENPORTS 40 #define UIP_CONF_MAX_LISTENPORTS 40
#define UIP_CONF_BUFFER_SIZE 600 #define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN #define UIP_CONF_TCP_SPLIT 0
#define UIP_CONF_TCP_SPLIT 1 #define UIP_CONF_IP_FORWARD 0
#define UIP_CONF_LOGGING 1 #define UIP_CONF_LOGGING 0
#define UIP_CONF_UDP_CHECKSUMS 1 #define UIP_CONF_UDP_CHECKSUMS 0
#define UIP_CONF_UDP 0
#define UIP_CONF_TCP 0
#define UIP_CONF_IPV6 1
#define UIP_CONF_IPV6_QUEUE_PKT 1
#define UIP_CONF_IPV6_CHECKS 1
#define UIP_CONF_IPV6_REASSEMBLY 1
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
#define UIP_CONF_ND6_MAX_PREFIXES 3
#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
typedef unsigned long clock_time_t; typedef unsigned long clock_time_t;
#define CLOCK_CONF_SECOND 1000 #define CLOCK_CONF_SECOND 1000
#define INFINITE_TIME ULONG_MAX
#define LOG_CONF_ENABLED 1 #define LOG_CONF_ENABLED 1

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki OS * This file is part of the Contiki OS
* *
* $Id: contiki-main.c,v 1.15 2008/02/10 22:52:41 oliverschmidt Exp $ * $Id: contiki-main.c,v 1.16 2008/10/14 10:06:26 julienabeille Exp $
* *
*/ */
@ -39,6 +39,7 @@
#include <unistd.h> #include <unistd.h>
#include "contiki.h" #include "contiki.h"
#include "contiki-net.h" //math
#include "net/uip.h" #include "net/uip.h"
#ifdef __CYGWIN__ #ifdef __CYGWIN__
@ -50,21 +51,22 @@
#ifdef __CYGWIN__ #ifdef __CYGWIN__
PROCINIT(&etimer_process, &tcpip_process, &wpcap_process); PROCINIT(&etimer_process, &tcpip_process, &wpcap_process);
#else /* __CYGWIN__ */ #else /* __CYGWIN__ */
PROCINIT(&etimer_process, &tcpip_process, &tapdev_process); PROCINIT(&etimer_process, &tapdev_process, &tcpip_process);
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
main(void) main(void)
{ {
uip_ipaddr_t addr;
process_init(); process_init();
procinit_init(); procinit_init();
autostart_start(autostart_processes); autostart_start(autostart_processes);
#if !UIP_CONF_IPV6
uip_ipaddr_t addr;
uip_ipaddr(&addr, 192,168,2,2); uip_ipaddr(&addr, 192,168,2,2);
printf("IP Address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr)); printf("IP Address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_sethostaddr(&addr); uip_sethostaddr(&addr);
@ -76,6 +78,8 @@ main(void)
uip_ipaddr(&addr, 192,168,2,1); uip_ipaddr(&addr, 192,168,2,1);
printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr)); printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setdraddr(&addr); uip_setdraddr(&addr);
#endif
//
while(1) { while(1) {
int n; int n;