Merge branch 'contiki' into osd

This commit is contained in:
Harald Pichler 2014-12-07 15:24:00 +01:00
commit a02be51f08
274 changed files with 1159 additions and 1285 deletions

View file

@ -51,7 +51,7 @@ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \
$(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) \
$(ETHERNET_SOURCEFILES)
MODULES += core/ctk core/net/ip core/net/ipv4 core/net/ipv6
MODULES += core/ctk
# Set target-specific variable values
${addprefix $(OBJECTDIR)/,${call oname, $(ETHERNET_SOURCEFILES)}}: ASFLAGS += -D DYN_DRV=0

View file

@ -2,4 +2,5 @@ CONTIKI_PROJECT = ethconfig
all: $(CONTIKI_PROJECT)
CONTIKI = ../../..
CONTIKI_WITH_IPV4 = 1
include $(CONTIKI)/Makefile.include

View file

@ -2,4 +2,5 @@ CONTIKI_PROJECT = ipconfig
all: $(CONTIKI_PROJECT)
CONTIKI = ../../..
CONTIKI_WITH_IPV4 = 1
include $(CONTIKI)/Makefile.include

View file

@ -59,12 +59,12 @@ pollhandler(void)
uip_len = ethernet_poll();
if(uip_len > 0) {
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
tcpip_input();
} else
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input();

View file

@ -76,7 +76,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
-I$(CONTIKI_CPU)/dbg-io \
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \
-DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \
-DWITH_ASCII -DMCK=$(MCK) \
-Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN

View file

@ -117,12 +117,12 @@ PROCESS_THREAD(usb_eth_process, ev , data)
uip_len = sizeof(recv_data) - recv_buffer.left;
/* printf("Received: %d bytes\n", uip_len); */
memcpy(uip_buf, recv_data, uip_len);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
tcpip_input();
} else
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input();

View file

@ -75,7 +75,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
-I$(CONTIKI_CPU)/dbg-io \
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \
-DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \
-DWITH_ASCII -DMCK=$(MCK) \
-Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN

View file

@ -101,6 +101,7 @@ CFLAGSNO = -Wall -mmcu=$(MCU) -gdwarf-2 -fno-strict-aliasing \
-I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \
$(CONTIKI_PLAT_DEFS)
CFLAGS += $(CFLAGSNO) -O$(OPTI)
ASFLAGS += -mmcu=$(MCU)
ifndef BOOTLOADER_START
BOOTLOADER_START = 0x1F800
endif

View file

@ -72,7 +72,7 @@
#include <avr/interrupt.h>
/* Two tick counters avoid a software divide when CLOCK_SECOND is not a power of two. */
#if CLOCK_SECOND && (CLOCK_SECOND - 1)
#if CLOCK_SECOND & (CLOCK_SECOND - 1)
#define TWO_COUNTERS 1
#endif

View file

@ -426,11 +426,7 @@ sicslowmac_dataRequest(void)
params.fcf.srcAddrMode = LONGADDRMODE;
params.dest_pid = ieee15_4ManagerAddress.get_dst_panid();
/*
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null) ) {
if(packetbuf_holds_broadcast()) {
/* Broadcast requires short address mode. */
params.fcf.destAddrMode = SHORTADDRMODE;
params.dest_pid = BROADCASTPANDID;

View file

@ -35,9 +35,9 @@ endef
### Banking Guesswork:
### Examples outside examples/sensinode do not specify banking.
### We automatically turn it on if its unspecified and if we are building with
### UIP_CONF_IPV6
### CONTIKI_WITH_IPV6
ifndef HAVE_BANKING
ifeq ($(UIP_CONF_IPV6),1)
ifeq ($(CONTIKI_WITH_IPV6),1)
HAVE_BANKING=1
else
HAVE_BANKING=0

View file

@ -51,9 +51,9 @@ endif
### Banking Guesswork:
### Generic examples do not specify banking.
### We automatically turn it on if its unspecified and if we are building with
### UIP_CONF_IPV6
### CONTIKI_WITH_IPV6
ifndef HAVE_BANKING
ifeq ($(UIP_CONF_IPV6),1)
ifeq ($(CONTIKI_WITH_IPV6),1)
HAVE_BANKING=1
else
HAVE_BANKING=0

View file

@ -57,7 +57,7 @@ slip_arch_writeb(unsigned char c)
*
*/
/*---------------------------------------------------------------------------*/
#if WITH_UIP
#if NETSTACK_CONF_WITH_IPV4
int
putchar(int c)
{
@ -83,7 +83,7 @@ putchar(int c)
return c;
}
#endif
#endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port and the SLIP driver.

View file

@ -100,8 +100,8 @@ uart0_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */
#if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port.

View file

@ -97,8 +97,8 @@ uart1_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */
#if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port.

View file

@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c)
*
*/
/*---------------------------------------------------------------------------*/
#if WITH_UIP
#if NETSTACK_CONF_WITH_IPV4
int
putchar(int c)
{
@ -75,7 +75,7 @@ putchar(int c)
return c;
}
#endif
#endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port and the SLIP driver.

View file

@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c)
*
*/
/*---------------------------------------------------------------------------*/
#if WITH_UIP
#if NETSTACK_CONF_WITH_IPV4
int
putchar(int c)
{
@ -75,7 +75,7 @@ putchar(int c)
return c;
}
#endif
#endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port and the SLIP driver.

View file

@ -34,11 +34,11 @@
#include "net/ip/uip.h"
#include "net/ip/uipopt.h"
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
#include "tapdev6.h"
#else
#include "tapdev.h"
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
#include "tapdev-drv.h"
@ -48,7 +48,7 @@
PROCESS(tapdev_process, "TAP driver");
/*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
uint8_t
tapdev_output(void)
{
@ -64,16 +64,16 @@ pollhandler(void)
uip_len = tapdev_poll();
if(uip_len > 0) {
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
tcpip_input();
} else
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input();
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
#if !UIP_CONF_IPV6 //math
#if !NETSTACK_CONF_WITH_IPV6 //math
uip_arp_arpin();
/* If the above function invocation resulted in data that
should be sent out on the network, the global variable
@ -95,7 +95,7 @@ PROCESS_THREAD(tapdev_process, ev, data)
PROCESS_BEGIN();
tapdev_init();
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
tcpip_set_outputfunc(tapdev_output);
#else
tcpip_set_outputfunc(tapdev_send);

View file

@ -36,7 +36,7 @@
#include "net/ip/uip.h"
#include "net/ip/uipopt.h"
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
#include <fcntl.h>
#include <stdlib.h>
@ -204,4 +204,4 @@ tapdev_exit(void)
}
/*---------------------------------------------------------------------------*/
#endif /* !UIP_CONF_IPV6 */
#endif /* !NETSTACK_CONF_WITH_IPV6 */

View file

@ -36,7 +36,7 @@
#include "net/ip/uip.h"
#include "net/ip/uipopt.h"
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
#include <fcntl.h>
#include <stdlib.h>
@ -419,4 +419,4 @@ tapdev_exit(void)
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */

View file

@ -64,7 +64,7 @@
PROCESS(wpcap_process, "WinPcap driver");
/*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
uint8_t
wpcap_output(void)
{
@ -73,7 +73,7 @@ wpcap_output(void)
return 0;
}
#endif /* !UIP_CONF_IPV6 */
#endif /* !NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/
static void
pollhandler(void)
@ -83,16 +83,16 @@ pollhandler(void)
uip_len = wpcap_poll();
if(uip_len > 0) {
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
// printf("wpcap poll calls tcpip");
tcpip_input();
} else
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input();
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
uip_arp_arpin(); //math
/* If the above function invocation resulted in data that
@ -101,7 +101,7 @@ pollhandler(void)
if(uip_len > 0) {
wpcap_send();
}
#endif /* !UIP_CONF_IPV6 */
#endif /* !NETSTACK_CONF_WITH_IPV6 */
} else {
uip_len = 0;
}
@ -125,16 +125,16 @@ pollhandler(void)
tcpip_input();
} else
goto bail;
#elif UIP_CONF_IPV6
#elif NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
tcpip_input();
} else
goto bail;
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input();
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
uip_arp_arpin(); //math
/* If the above function invocation resulted in data that
@ -143,7 +143,7 @@ pollhandler(void)
if(uip_len > 0) {
wfall_send();
}
#endif /* !UIP_CONF_IPV6 */
#endif /* !NETSTACK_CONF_WITH_IPV6 */
} else {
bail:
uip_len = 0;
@ -161,13 +161,13 @@ PROCESS_THREAD(wpcap_process, ev, data)
wpcap_init();
#if !UIP_CONF_IPV6
#if !NETSTACK_CONF_WITH_IPV6
tcpip_set_outputfunc(wpcap_output);
#else
#if !FALLBACK_HAS_ETHERNET_HEADERS
tcpip_set_outputfunc(wpcap_send);
#endif
#endif /* !UIP_CONF_IPV6 */
#endif /* !NETSTACK_CONF_WITH_IPV6 */
process_poll(&wpcap_process);

View file

@ -68,7 +68,7 @@
#define FALLBACK_HAS_ETHERNET_HEADERS 1
#endif
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
#include <ws2tcpip.h>
struct in6_addr addr6;
char addr6str[64];
@ -122,7 +122,7 @@ sprint_ip6addr(struct in6_addr addr, char * result)
return (result - starting);
}
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
#ifdef __CYGWIN__
@ -158,7 +158,7 @@ static struct pcap *pcap;
/* uip_lladdr is defined in uip.c. It is not used in uip6.c.
* If needed for some purpose it can be defined here
*/
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
//struct uip_eth_addr uip_lladdr;
#endif
@ -174,7 +174,7 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int);
#ifdef UIP_FALLBACK_INTERFACE
static struct pcap *pfall;
struct in_addr addrfall;
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
struct in_addr6 addrfall6;
#endif
@ -265,7 +265,7 @@ set_ethaddr(struct in_addr addr)
adapters->PhysicalAddress[2], adapters->PhysicalAddress[3],
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i];
#else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
@ -281,7 +281,7 @@ set_ethaddr(struct in_addr addr)
}
}
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
/*---------------------------------------------------------------------------*/
static void
set_ethaddr6(struct in_addr6 addr)
@ -327,7 +327,7 @@ set_ethaddr6(struct in_addr6 addr)
adapters->PhysicalAddress[2], adapters->PhysicalAddress[3],
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing?
#else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
@ -396,7 +396,7 @@ init_pcap(struct in_addr addr)
}
#endif
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
} else if(paddr->addr != NULL && paddr->addr->sa_family == AF_INET6) {
struct in6_addr interface_addr;
@ -431,7 +431,7 @@ init_pcap(struct in_addr addr)
return;
}
#endif
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
}
}
}
@ -457,13 +457,13 @@ wpcap_init(void)
#ifdef __CYGWIN__
if ((*__argv)[1]) {
addr.s_addr = inet_addr((*__argv)[1]);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
uiplib_ipaddrconv((*__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr);
#endif
#ifdef UIP_FALLBACK_INTERFACE
if ((*__argv)[2]) {
addrfall.s_addr = inet_addr((*__argv)[2]);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
uiplib_ipaddrconv((*__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr);
#endif
}
@ -473,13 +473,13 @@ wpcap_init(void)
#else /* __CYGWIN__ */
/* VC++ build on win32 platform. Currently the platform has no ipv6 support */
addr.s_addr = inet_addr(__argv[1]);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if((__argv)[1])
uiplib_ipaddrconv((__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr);
#endif
#ifdef UIP_FALLBACK_INTERFACE
addrfall.s_addr = inet_addr(__argv[2]);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
if((__argv)[2])
uiplib_ipaddrconv((__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr);
#endif
@ -498,7 +498,7 @@ wpcap_init(void)
#endif
/* Use build defaults if not enough addresses passed */
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
#ifdef UIP_FALLBACK_INTERFACE
if(addrfall.s_addr == INADDR_NONE) {
@ -561,7 +561,7 @@ wpcap_init(void)
#endif
log_message("usage: <program> <ip addr of ethernet card to share>\n-->I'll try guessing ", inet_ntoa(addr));
}
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
#if DEBUG
log_message("wpcap_init:Using ipv4 ", inet_ntoa(addr));
@ -610,7 +610,7 @@ wpcap_poll(void)
return 0;
}
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
/* Since pcap_setdirection(PCAP_D_IN) is not implemented in winpcap all outgoing packets
* will be echoed back. The stack will ignore any packets not addressed to it, but initial
* ipv6 neighbor solicitations are addressed to everyone and the echoed NS sent on startup
@ -649,7 +649,7 @@ wpcap_poll(void)
}
#endif
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(packet_header->caplen > UIP_BUFSIZE) {
return 0;
@ -673,7 +673,7 @@ wfall_poll(void)
case 0:
return 0;
}
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
#if FALLBACK_HAS_ETHERNET_HEADERS
#define ETHERNET_LLADDR_LEN 6
#else
@ -692,7 +692,7 @@ wfall_poll(void)
PRINTF("Discarding echoed packet\n");
return 0;
}
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(packet_header->caplen > UIP_BUFSIZE) {
return 0;
@ -706,7 +706,7 @@ wfall_poll(void)
#endif
/*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
uint8_t
wpcap_send(const uip_lladdr_t *lladdr)
{
@ -777,7 +777,7 @@ wfall_send(const uip_lladdr_t *lladdr)
return 0;
}
#endif
#else /* UIP_CONF_IPV6 */
#else /* NETSTACK_CONF_WITH_IPV6 */
void
wpcap_send(void)
{
@ -792,7 +792,7 @@ wpcap_send(void)
error_exit("error on send\n");
}
}
#endif /* UIP_CONF_IPV6 */
#endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/
void
wpcap_exit(void)

View file

@ -38,7 +38,7 @@
void wpcap_init(void);
uint16_t wpcap_poll(void);
uint16_t wfall_poll(void);
#if UIP_CONF_IPV6
#if NETSTACK_CONF_WITH_IPV6
uint8_t wpcap_send(const uip_lladdr_t *lladdr);
uint8_t wfall_send(const uip_lladdr_t *lladdr);
#else

View file

@ -120,9 +120,9 @@ uart1_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
#if ! WITH_UIP
/* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */
#if ! NETSTACK_CONF_WITH_IPV4
/* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/
/*
* Initalize the RS232 port.