map rime address to mac address for ipv6

This commit is contained in:
nvt-se 2008-11-06 15:14:24 +00:00
parent 1ddc7443e8
commit 21e4b4be80
2 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* -*- C -*- */ /* -*- C -*- */
/* @(#)$Id: contiki-conf.h,v 1.29 2008/11/05 14:31:06 nvt-se Exp $ */ /* @(#)$Id: contiki-conf.h,v 1.30 2008/11/06 15:14:24 nvt-se Exp $ */
#ifndef CONTIKI_CONF_H #ifndef CONTIKI_CONF_H
#define CONTIKI_CONF_H #define CONTIKI_CONF_H
@ -53,6 +53,9 @@
#define BAUD2UBR(baud) ((F_CPU/baud)) #define BAUD2UBR(baud) ((F_CPU/baud))
#ifdef WITH_UIP6 #ifdef WITH_UIP6
#define RIMEADDR_CONF_SIZE 8
#define UIP_CONF_LL_802154 1 #define UIP_CONF_LL_802154 1
#define UIP_CONF_LLH_LEN 0 #define UIP_CONF_LLH_LEN 0

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)$Id: contiki-sky-main.c,v 1.38 2008/11/05 15:34:04 nvt-se Exp $ * @(#)$Id: contiki-sky-main.c,v 1.39 2008/11/06 15:14:24 nvt-se Exp $
*/ */
#include <signal.h> #include <signal.h>
@ -126,7 +126,11 @@ set_rime_addr(void)
{ {
rimeaddr_t addr; rimeaddr_t addr;
int i; int i;
memset(&addr, 0, sizeof(rimeaddr_t)); memset(&addr, 0, sizeof(rimeaddr_t));
#if UIP_CONF_IPV6
memcpy(addr.u8, ds2411_id, sizeof(addr.u8));
#else
if(node_id == 0) { if(node_id == 0) {
for(i = 0; i < sizeof(rimeaddr_t); ++i) { for(i = 0; i < sizeof(rimeaddr_t); ++i) {
addr.u8[i] = ds2411_id[7 - i]; addr.u8[i] = ds2411_id[7 - i];
@ -135,8 +139,13 @@ set_rime_addr(void)
addr.u8[0] = node_id & 0xff; addr.u8[0] = node_id & 0xff;
addr.u8[1] = node_id >> 8; addr.u8[1] = node_id >> 8;
} }
#endif
rimeaddr_set_node_addr(&addr); rimeaddr_set_node_addr(&addr);
printf("Rime started with address %d.%d\n", addr.u8[0], addr.u8[1]); printf("Rime started with address ");
for(i = 0; i < sizeof(addr.u8) - 1; i++) {
printf("%d.", addr.u8[i]);
}
printf("%d\n", addr.u8[i]);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void