Hack to make DS2411 ID useable as an Ethernet MAC address (remove multicast bit)

This commit is contained in:
adamdunkels 2009-04-10 00:40:08 +00:00
parent 3415ff26bd
commit 2545fd9069

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.52 2009/04/06 14:12:58 nifi Exp $ * @(#)$Id: contiki-sky-main.c,v 1.53 2009/04/10 00:40:08 adamdunkels Exp $
*/ */
#include <signal.h> #include <signal.h>
@ -205,6 +205,11 @@ main(int argc, char **argv)
leds_on(LEDS_GREEN); leds_on(LEDS_GREEN);
ds2411_init(); ds2411_init();
/* XXX hack: Fix it so that the 802.15.4 MAC address is compatible
with an Ethernet MAC address - byte 0 (byte 2 in the DS ID)
cannot be odd. */
ds2411_id[2] &= 0xfe;
leds_on(LEDS_BLUE); leds_on(LEDS_BLUE);
xmem_init(); xmem_init();
@ -214,9 +219,12 @@ main(int argc, char **argv)
* Hardware initialization done! * Hardware initialization done!
*/ */
/* Restore node id if such has been stored in external mem */ /* Restore node id if such has been stored in external mem */
node_id_restore(); node_id_restore();
random_init(ds2411_id[0] + node_id);
leds_off(LEDS_BLUE); leds_off(LEDS_BLUE);
/* /*
* Initialize Contiki and our processes. * Initialize Contiki and our processes.
@ -238,8 +246,6 @@ main(int argc, char **argv)
cc2420_set_pan_addr(IEEE802154_PANID, 0 /*XXX*/, ds2411_id); cc2420_set_pan_addr(IEEE802154_PANID, 0 /*XXX*/, ds2411_id);
cc2420_set_channel(RF_CHANNEL); cc2420_set_channel(RF_CHANNEL);
random_init(ds2411_id[0] + node_id);
printf(CONTIKI_VERSION_STRING " started. "); printf(CONTIKI_VERSION_STRING " started. ");
if(node_id > 0) { if(node_id > 0) {
printf("Node id is set to %u.\n", node_id); printf("Node id is set to %u.\n", node_id);