Export fix-point representation of the ETX. Make RPL temporarily use the same representation as before.
This commit is contained in:
parent
8cd27a3edb
commit
86823a84fb
3 changed files with 17 additions and 8 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: neighbor-info.c,v 1.13 2010/10/22 11:34:24 joxe Exp $
|
||||
* $Id: neighbor-info.c,v 1.14 2010/10/22 13:50:13 nvt-se Exp $
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
|
@ -52,9 +52,6 @@
|
|||
#define ETX_SCALE 100
|
||||
#define ETX_ALPHA 70
|
||||
#define ETX_FIRST_GUESS 3
|
||||
|
||||
#define ETX2FIX(etx) ((etx) << 4)
|
||||
#define FIX2ETX(fix) ((fix) >> 4)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
NEIGHBOR_ATTRIBUTE(uint8_t, etx, NULL);
|
||||
|
||||
|
@ -83,7 +80,7 @@ update_etx(const rimeaddr_t *dest, int packet_etx)
|
|||
if(neighbor_attr_has_neighbor(dest)) {
|
||||
neighbor_attr_set_data(&etx, dest, &new_etx);
|
||||
if(new_etx != recorded_etx && subscriber_callback != NULL) {
|
||||
subscriber_callback(dest, 1, FIX2ETX(new_etx));
|
||||
subscriber_callback(dest, 1, new_etx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +165,8 @@ uint8_t
|
|||
neighbor_info_get_etx(const rimeaddr_t *addr)
|
||||
{
|
||||
uint8_t *etxp;
|
||||
|
||||
etxp = (uint8_t *)neighbor_attr_get_data(&etx, addr);
|
||||
return etxp == NULL ? 0 : etxp;
|
||||
return etxp == NULL ? 0 : *etxp;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: neighbor-info.h,v 1.3 2010/10/22 11:34:24 joxe Exp $
|
||||
* $Id: neighbor-info.h,v 1.4 2010/10/22 13:50:13 nvt-se Exp $
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
|
@ -42,6 +42,15 @@
|
|||
|
||||
#include "net/rime.h"
|
||||
|
||||
/* ETX_DIVISOR is the value that a fix-point representation of the ETX
|
||||
should be divided by in order to obtain the integer representation. */
|
||||
#define ETX_DIVISOR 16
|
||||
|
||||
/* Macros for converting between a fix-point representation of the ETX
|
||||
and a integer representation. */
|
||||
#define ETX2FIX(etx) ((etx) << 4)
|
||||
#define FIX2ETX(fix) ((fix) >> 4)
|
||||
|
||||
typedef void (*neighbor_info_subscriber_t)(const rimeaddr_t *, int known, int etx);
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: rpl.c,v 1.9 2010/09/20 15:30:12 joxe Exp $
|
||||
* $Id: rpl.c,v 1.10 2010/10/22 13:50:13 nvt-se Exp $
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
|
@ -123,6 +123,8 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx)
|
|||
rpl_dag_t *dag;
|
||||
rpl_parent_t *parent;
|
||||
|
||||
etx = FIX2ETX(etx);
|
||||
|
||||
uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr);
|
||||
PRINTF("RPL: Neighbor ");
|
||||
|
|
Loading…
Reference in a new issue