From dd917c3260db7f871d0205b2d647d7fff5173bf1 Mon Sep 17 00:00:00 2001 From: Harald Pichler Date: Thu, 28 Nov 2013 09:43:59 +0100 Subject: [PATCH] bugfix server client demo --- core/net/mac/contikimac/contikimac.c | 2 ++ platform/osd-merkur/contiki-conf.h | 6 ++--- platform/osd-merkur/contiki-main.c | 35 ++++++++++++++-------------- platform/osd-merkur/dev/led.c | 8 +++---- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index e46f51bff..eb79f60e1 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -659,11 +659,13 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, watchdog_periodic(); +#if WITH_PHASE_OPTIMIZATION if(!is_broadcast && (is_receiver_awake || is_known_receiver) && !RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + MAX_PHASE_STROBE_TIME)) { PRINTF("miss to %d\n", packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0]); break; } +#endif /* WITH_PHASE_OPTIMIZATION */ len = 0; diff --git a/platform/osd-merkur/contiki-conf.h b/platform/osd-merkur/contiki-conf.h index 489cdaf61..2cafeac31 100644 --- a/platform/osd-merkur/contiki-conf.h +++ b/platform/osd-merkur/contiki-conf.h @@ -222,7 +222,7 @@ typedef unsigned short uip_stats_t; /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define UIP_CONF_DS6_NBR_NBU 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 @@ -243,7 +243,7 @@ typedef unsigned short uip_stats_t; /* So without the header this needed for RPL mesh to form */ #define CONTIKIMAC_CONF_SHORTEST_PACKET_SIZE 43-18 //multicast RPL DIS length /* Not tested much yet */ -#define WITH_PHASE_OPTIMIZATION 0 +#define CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION 0 #define CONTIKIMAC_CONF_COMPOWER 1 #define RIMESTATS_CONF_ENABLED 1 #define NETSTACK_CONF_FRAMER framer_802154 @@ -266,7 +266,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define UIP_CONF_DS6_NBR_NBU 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 diff --git a/platform/osd-merkur/contiki-main.c b/platform/osd-merkur/contiki-main.c index 7fd111290..aa8772510 100644 --- a/platform/osd-merkur/contiki-main.c +++ b/platform/osd-merkur/contiki-main.c @@ -436,6 +436,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { +#if UIP_CONF_IPV6 + uip_ds6_nbr_t *nbr; +#endif /* UIP_CONF_IPV6 */ initialize(); while(1) { @@ -533,11 +536,9 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; - uint8_t i,j; + uint8_t i,j=0; PRINTF("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB); for (i=0;iipaddr); + PRINTF("\n"); + j=0; } + if (j) PRINTF(" "); PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); { uip_ds6_route_t *r; j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { + ipaddr_add(uip_ds6_route_nexthop(r)); PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } j = 0; } } if (j) PRINTF(" "); PRINTF("\n---------\n"); + } #endif diff --git a/platform/osd-merkur/dev/led.c b/platform/osd-merkur/dev/led.c index 8f330e13a..0194ff1f6 100644 --- a/platform/osd-merkur/dev/led.c +++ b/platform/osd-merkur/dev/led.c @@ -52,8 +52,8 @@ void led1_on(void) { - DDRE |= (1<