Replaced old framer (framer_get/framer_set) with new NETSTACK style configuration. Added nullrdc-framer that is a nullrdc with framer support.
This commit is contained in:
parent
0c084b8c68
commit
5e43a6998b
10 changed files with 166 additions and 59 deletions
|
@ -1,2 +1,2 @@
|
||||||
CONTIKI_SOURCEFILES += cxmac.c xmac.c nullmac.c lpp.c frame802154.c sicslowmac.c nullrdc.c mac.c
|
CONTIKI_SOURCEFILES += cxmac.c xmac.c nullmac.c lpp.c frame802154.c sicslowmac.c nullrdc.c nullrdc-framer.c mac.c
|
||||||
CONTIKI_SOURCEFILES += framer.c framer-nullmac.c framer-802154.c csma.c contikimac.c phase.c
|
CONTIKI_SOURCEFILES += framer-nullmac.c framer-802154.c csma.c contikimac.c phase.c
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: contikimac.c,v 1.7 2010/02/28 20:19:47 adamdunkels Exp $
|
* $Id: contikimac.c,v 1.8 2010/03/01 13:30:22 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,6 @@
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
#include "net/mac/framer.h"
|
|
||||||
#include "net/mac/contikimac.h"
|
#include "net/mac/contikimac.h"
|
||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include "sys/compower.h"
|
#include "sys/compower.h"
|
||||||
|
@ -498,7 +497,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
|
||||||
}
|
}
|
||||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||||
len = framer_get()->create();
|
len = NETSTACK_FRAMER.create();
|
||||||
if(len == 0) {
|
if(len == 0) {
|
||||||
/* Failed to send */
|
/* Failed to send */
|
||||||
PRINTF("contikimac: send failed, too large header\n");
|
PRINTF("contikimac: send failed, too large header\n");
|
||||||
|
@ -723,7 +722,7 @@ input_packet(void)
|
||||||
|
|
||||||
packet_indication_flag = 0;
|
packet_indication_flag = 0;
|
||||||
|
|
||||||
if(packetbuf_totlen() > 0 && framer_get()->parse()) {
|
if(packetbuf_totlen() > 0 && NETSTACK_FRAMER.parse()) {
|
||||||
|
|
||||||
if(packetbuf_datalen() > 0 &&
|
if(packetbuf_datalen() > 0 &&
|
||||||
packetbuf_totlen() > 0 &&
|
packetbuf_totlen() > 0 &&
|
||||||
|
@ -783,7 +782,7 @@ send_announcement(void *ptr)
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER,
|
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER,
|
||||||
announcement_radio_txpower);
|
announcement_radio_txpower);
|
||||||
if(framer_get()->create()) {
|
if(NETSTACK_FRAMER.create()) {
|
||||||
we_are_sending = 1;
|
we_are_sending = 1;
|
||||||
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
we_are_sending = 0;
|
we_are_sending = 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: cxmac.c,v 1.11 2010/02/23 20:09:11 nifi Exp $
|
* $Id: cxmac.c,v 1.12 2010/03/01 13:30:22 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,6 @@
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
#include "net/netstack.h"
|
#include "net/netstack.h"
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
#include "net/mac/framer.h"
|
|
||||||
#include "net/mac/cxmac.h"
|
#include "net/mac/cxmac.h"
|
||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include "net/rime/timesynch.h"
|
#include "net/rime/timesynch.h"
|
||||||
|
@ -453,7 +452,7 @@ send_packet(void)
|
||||||
}
|
}
|
||||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||||
len = framer_get()->create();
|
len = NETSTACK_FRAMER.create();
|
||||||
strobe_len = len + sizeof(struct cxmac_hdr);
|
strobe_len = len + sizeof(struct cxmac_hdr);
|
||||||
if(len == 0 || strobe_len > sizeof(strobe)) {
|
if(len == 0 || strobe_len > sizeof(strobe)) {
|
||||||
/* Failed to send */
|
/* Failed to send */
|
||||||
|
@ -565,7 +564,7 @@ send_packet(void)
|
||||||
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
packetbuf_set_datalen(len);
|
packetbuf_set_datalen(len);
|
||||||
if(framer_get()->parse()) {
|
if(NETSTACK_FRAMER.parse()) {
|
||||||
hdr = packetbuf_dataptr();
|
hdr = packetbuf_dataptr();
|
||||||
if(hdr->dispatch == DISPATCH && hdr->type == TYPE_STROBE_ACK) {
|
if(hdr->dispatch == DISPATCH && hdr->type == TYPE_STROBE_ACK) {
|
||||||
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||||
|
@ -706,7 +705,7 @@ input_packet(void)
|
||||||
{
|
{
|
||||||
struct cxmac_hdr *hdr;
|
struct cxmac_hdr *hdr;
|
||||||
|
|
||||||
if(framer_get()->parse()) {
|
if(NETSTACK_FRAMER.parse()) {
|
||||||
hdr = packetbuf_dataptr();
|
hdr = packetbuf_dataptr();
|
||||||
|
|
||||||
if(hdr->dispatch != DISPATCH) {
|
if(hdr->dispatch != DISPATCH) {
|
||||||
|
@ -761,7 +760,7 @@ input_packet(void)
|
||||||
packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
||||||
packetbuf_compact();
|
packetbuf_compact();
|
||||||
if(framer_get()->create()) {
|
if(NETSTACK_FRAMER.create()) {
|
||||||
/* We turn on the radio in anticipation of the incoming
|
/* We turn on the radio in anticipation of the incoming
|
||||||
packet. */
|
packet. */
|
||||||
someone_is_sending = 1;
|
someone_is_sending = 1;
|
||||||
|
@ -825,7 +824,7 @@ send_announcement(void *ptr)
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower);
|
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower);
|
||||||
if(framer_get()->create()) {
|
if(NETSTACK_FRAMER.create()) {
|
||||||
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: framer.h,v 1.1 2009/10/19 18:30:03 adamdunkels Exp $
|
* $Id: framer.h,v 1.2 2010/03/01 13:30:23 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,10 +49,4 @@ struct framer {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct framer *framer_current;
|
|
||||||
|
|
||||||
const struct framer *framer_get(void);
|
|
||||||
|
|
||||||
void framer_set(const struct framer *f);
|
|
||||||
|
|
||||||
#endif /* __FRAMER_H__ */
|
#endif /* __FRAMER_H__ */
|
||||||
|
|
120
core/net/mac/nullrdc-framer.c
Normal file
120
core/net/mac/nullrdc-framer.c
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* $Id: nullrdc-framer.c,v 1.1 2010/03/01 13:30:23 nifi Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A null RDC implementation that uses framer for headers.
|
||||||
|
* \author
|
||||||
|
* Adam Dunkels <adam@sics.se>
|
||||||
|
* Niclas Finne <nfi@sics.se>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "net/mac/nullrdc-framer.h"
|
||||||
|
#include "net/rime/packetbuf.h"
|
||||||
|
#include "net/netstack.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
send_packet(mac_callback_t sent, void *ptr)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
||||||
|
if(NETSTACK_FRAMER.create() == 0) {
|
||||||
|
/* Failed to allocate space for headers */
|
||||||
|
PRINTF("nullrdc_framer: send failed, too large header\n");
|
||||||
|
ret = MAC_TX_ERR_FATAL;
|
||||||
|
} else if(NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen())
|
||||||
|
== RADIO_TX_OK) {
|
||||||
|
ret = MAC_TX_OK;
|
||||||
|
} else {
|
||||||
|
ret = MAC_TX_ERR;
|
||||||
|
}
|
||||||
|
mac_call_sent_callback(sent, ptr, ret, 1);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
packet_input(void)
|
||||||
|
{
|
||||||
|
if(NETSTACK_FRAMER.parse() == 0) {
|
||||||
|
PRINTF("nullrdc_framer: failed to parse %u\n", packetbuf_datalen());
|
||||||
|
} else {
|
||||||
|
NETSTACK_MAC.input();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
on(void)
|
||||||
|
{
|
||||||
|
return NETSTACK_RADIO.on();
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
off(int keep_radio_on)
|
||||||
|
{
|
||||||
|
if(keep_radio_on) {
|
||||||
|
return NETSTACK_RADIO.on();
|
||||||
|
} else {
|
||||||
|
return NETSTACK_RADIO.off();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static unsigned short
|
||||||
|
channel_check_interval(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
init(void)
|
||||||
|
{
|
||||||
|
on();
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
const struct rdc_driver nullrdc_framer_driver = {
|
||||||
|
"nullrdc-framer",
|
||||||
|
init,
|
||||||
|
send_packet,
|
||||||
|
packet_input,
|
||||||
|
on,
|
||||||
|
off,
|
||||||
|
channel_check_interval,
|
||||||
|
};
|
||||||
|
/*---------------------------------------------------------------------------*/
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Swedish Institute of Computer Science.
|
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -26,35 +26,24 @@
|
||||||
* 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: framer.c,v 1.1 2009/10/19 18:30:03 adamdunkels Exp $
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* $Id: nullrdc-framer.h,v 1.1 2010/03/01 13:30:23 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* A MAC framer is responsible for constructing and parsing
|
* A null RDC implementation that uses framer for headers.
|
||||||
* the header in MAC frames. At least the sender and receiver
|
|
||||||
* are required to be encoded in the MAC frame headers.
|
|
||||||
* \author
|
* \author
|
||||||
|
* Adam Dunkels <adam@sics.se>
|
||||||
* Niclas Finne <nfi@sics.se>
|
* Niclas Finne <nfi@sics.se>
|
||||||
* Joakim Eriksson <joakime@sics.se>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#ifndef __NULLRDC_FRAMER_H__
|
||||||
#include "net/mac/framer.h"
|
#define __NULLRDC_FRAMER_H__
|
||||||
#include "net/mac/framer-nullmac.h"
|
|
||||||
|
|
||||||
const struct framer *framer_current;
|
#include "net/mac/rdc.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
extern const struct rdc_driver nullrdc_framer_driver;
|
||||||
const struct framer *
|
|
||||||
framer_get(void)
|
#endif /* __NULLRDC_FRAMER_H__ */
|
||||||
{
|
|
||||||
return framer_current != NULL ? framer_current : &framer_nullmac;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
framer_set(const struct framer *f)
|
|
||||||
{
|
|
||||||
framer_current = f;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: xmac.c,v 1.54 2010/02/23 20:09:11 nifi Exp $
|
* $Id: xmac.c,v 1.55 2010/03/01 13:30:23 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,6 @@
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
#include "net/netstack.h"
|
#include "net/netstack.h"
|
||||||
#include "net/mac/framer.h"
|
|
||||||
#include "net/mac/xmac.h"
|
#include "net/mac/xmac.h"
|
||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include "net/rime/timesynch.h"
|
#include "net/rime/timesynch.h"
|
||||||
|
@ -448,7 +447,7 @@ send_packet(void)
|
||||||
}
|
}
|
||||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||||
len = framer_get()->create();
|
len = NETSTACK_FRAMER.create();
|
||||||
strobe_len = len + sizeof(struct xmac_hdr);
|
strobe_len = len + sizeof(struct xmac_hdr);
|
||||||
if(len == 0 || strobe_len > sizeof(strobe)) {
|
if(len == 0 || strobe_len > sizeof(strobe)) {
|
||||||
/* Failed to send */
|
/* Failed to send */
|
||||||
|
@ -560,7 +559,7 @@ send_packet(void)
|
||||||
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
packetbuf_set_datalen(len);
|
packetbuf_set_datalen(len);
|
||||||
if(framer_get()->parse()) {
|
if(NETSTACK_FRAMER.parse()) {
|
||||||
hdr = packetbuf_dataptr();
|
hdr = packetbuf_dataptr();
|
||||||
if(hdr->dispatch == DISPATCH && hdr->type == TYPE_STROBE_ACK) {
|
if(hdr->dispatch == DISPATCH && hdr->type == TYPE_STROBE_ACK) {
|
||||||
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||||
|
@ -702,7 +701,7 @@ input_packet(void)
|
||||||
{
|
{
|
||||||
struct xmac_hdr *hdr;
|
struct xmac_hdr *hdr;
|
||||||
|
|
||||||
if(framer_get()->parse()) {
|
if(NETSTACK_FRAMER.parse()) {
|
||||||
hdr = packetbuf_dataptr();
|
hdr = packetbuf_dataptr();
|
||||||
|
|
||||||
if(hdr->dispatch != DISPATCH) {
|
if(hdr->dispatch != DISPATCH) {
|
||||||
|
@ -757,7 +756,7 @@ input_packet(void)
|
||||||
packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
||||||
packetbuf_compact();
|
packetbuf_compact();
|
||||||
if(framer_get()->create()) {
|
if(NETSTACK_FRAMER.create()) {
|
||||||
/* We turn on the radio in anticipation of the incoming
|
/* We turn on the radio in anticipation of the incoming
|
||||||
packet. */
|
packet. */
|
||||||
someone_is_sending = 1;
|
someone_is_sending = 1;
|
||||||
|
@ -821,7 +820,7 @@ send_announcement(void *ptr)
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower);
|
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower);
|
||||||
if(framer_get()->create()) {
|
if(NETSTACK_FRAMER.create()) {
|
||||||
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: netstack.h,v 1.4 2010/02/23 20:09:11 nifi Exp $
|
* $Id: netstack.h,v 1.5 2010/03/01 13:30:21 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,8 +75,17 @@
|
||||||
#endif /* NETSTACK_CONF_RADIO */
|
#endif /* NETSTACK_CONF_RADIO */
|
||||||
#endif /* NETSTACK_RADIO */
|
#endif /* NETSTACK_RADIO */
|
||||||
|
|
||||||
|
#ifndef NETSTACK_FRAMER
|
||||||
|
#ifdef NETSTACK_CONF_FRAMER
|
||||||
|
#define NETSTACK_FRAMER NETSTACK_CONF_FRAMER
|
||||||
|
#else /* NETSTACK_CONF_FRAMER */
|
||||||
|
#define NETSTACK_FRAMER framer_nullmac
|
||||||
|
#endif /* NETSTACK_CONF_FRAMER */
|
||||||
|
#endif /* NETSTACK_FRAMER */
|
||||||
|
|
||||||
#include "net/mac/mac.h"
|
#include "net/mac/mac.h"
|
||||||
#include "net/mac/rdc.h"
|
#include "net/mac/rdc.h"
|
||||||
|
#include "net/mac/framer.h"
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,6 +105,7 @@ extern const struct network_driver NETSTACK_NETWORK;
|
||||||
extern const struct rdc_driver NETSTACK_RDC;
|
extern const struct rdc_driver NETSTACK_RDC;
|
||||||
extern const struct mac_driver NETSTACK_MAC;
|
extern const struct mac_driver NETSTACK_MAC;
|
||||||
extern const struct radio_driver NETSTACK_RADIO;
|
extern const struct radio_driver NETSTACK_RADIO;
|
||||||
|
extern const struct framer NETSTACK_FRAMER;
|
||||||
|
|
||||||
void netstack_init(void);
|
void netstack_init(void);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* -*- C -*- */
|
/* -*- C -*- */
|
||||||
/* @(#)$Id: contiki-conf.h,v 1.74 2010/02/25 15:51:37 joxe Exp $ */
|
/* @(#)$Id: contiki-conf.h,v 1.75 2010/03/01 13:30:21 nifi Exp $ */
|
||||||
|
|
||||||
#ifndef CONTIKI_CONF_H
|
#ifndef CONTIKI_CONF_H
|
||||||
#define CONTIKI_CONF_H
|
#define CONTIKI_CONF_H
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#define NETSTACK_CONF_MAC csma_driver
|
#define NETSTACK_CONF_MAC csma_driver
|
||||||
#define NETSTACK_CONF_RDC contikimac_driver
|
#define NETSTACK_CONF_RDC contikimac_driver
|
||||||
#define NETSTACK_CONF_RADIO cc2420_driver
|
#define NETSTACK_CONF_RADIO cc2420_driver
|
||||||
|
#define NETSTACK_CONF_FRAMER framer_802154
|
||||||
|
|
||||||
#define CC2420_CONF_AUTOACK 1
|
#define CC2420_CONF_AUTOACK 1
|
||||||
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
#define NETSTACK_CONF_MAC csma_driver
|
#define NETSTACK_CONF_MAC csma_driver
|
||||||
#define NETSTACK_CONF_RDC contikimac_driver
|
#define NETSTACK_CONF_RDC contikimac_driver
|
||||||
#define NETSTACK_CONF_RADIO cc2420_driver
|
#define NETSTACK_CONF_RADIO cc2420_driver
|
||||||
|
#define NETSTACK_CONF_FRAMER framer_802154
|
||||||
|
|
||||||
#define CC2420_CONF_AUTOACK 1
|
#define CC2420_CONF_AUTOACK 1
|
||||||
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
||||||
|
|
|
@ -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.72 2010/02/23 21:02:30 nifi Exp $
|
* @(#)$Id: contiki-sky-main.c,v 1.73 2010/03/01 13:30:21 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -50,9 +50,6 @@
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
#include "net/netstack.h"
|
#include "net/netstack.h"
|
||||||
#include "net/mac/frame802154.h"
|
#include "net/mac/frame802154.h"
|
||||||
#include "net/mac/framer-802154.h"
|
|
||||||
#include "net/mac/framer-nullmac.h"
|
|
||||||
#include "net/mac/framer.h"
|
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
#include "net/sicslowpan.h"
|
#include "net/sicslowpan.h"
|
||||||
|
@ -271,8 +268,6 @@ main(int argc, char **argv)
|
||||||
ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3],
|
ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3],
|
||||||
ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7]);*/
|
ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7]);*/
|
||||||
|
|
||||||
framer_set(&framer_802154);
|
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, ds2411_id, sizeof(uip_lladdr.addr));
|
||||||
/* Setup nullmac-like MAC for 802.15.4 */
|
/* Setup nullmac-like MAC for 802.15.4 */
|
||||||
|
|
Loading…
Reference in a new issue