Remove RDC layer
This commit is contained in:
parent
bd6f26963a
commit
aa1191d8f0
@ -94,7 +94,7 @@ do_rssi(void)
|
||||
static int sample;
|
||||
int channel;
|
||||
|
||||
NETSTACK_MAC.off(0);
|
||||
NETSTACK_MAC.off();
|
||||
|
||||
cc2420_on();
|
||||
for(channel = 11; channel <= 26; ++channel) {
|
||||
|
@ -54,13 +54,6 @@
|
||||
/* #define NETSTACK_CONF_FRAMER framer_802154 */
|
||||
#endif /* NETSTACK_CONF_FRAMER */
|
||||
|
||||
/* NETSTACK_CONF_RDC specifies the Radio Duty Cycling (RDC) layer. The
|
||||
nullrdc_driver never turns the radio off and is compatible with all
|
||||
radios, but consumes a lot of power. */
|
||||
#ifndef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC nullrdc_driver
|
||||
#endif /* NETSTACK_CONF_RDC */
|
||||
|
||||
/* NETSTACK_CONF_MAC specifies the Medium Access Control (MAC)
|
||||
layer. The nullmac_driver does not provide any MAC
|
||||
functionality. The csma_driver is the default CSMA MAC layer, but
|
||||
|
@ -1321,7 +1321,7 @@ output(const uip_lladdr_t *localdest)
|
||||
}
|
||||
PRINTFO("sicslowpan output: header of len %d\n", packetbuf_hdr_len);
|
||||
|
||||
/* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_RDC.
|
||||
/* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_MAC.
|
||||
* We calculate it here only to make a better decision of whether the outgoing packet
|
||||
* needs to be fragmented or not. */
|
||||
#ifndef SICSLOWPAN_USE_FIXED_HDRLEN
|
||||
|
@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
#include "net/mac/csma.h"
|
||||
#include "net/mac/nullrdc.h"
|
||||
#include "net/packetbuf.h"
|
||||
#include "net/queuebuf.h"
|
||||
|
||||
@ -164,7 +165,7 @@ transmit_packet_list(void *ptr)
|
||||
PRINTF("csma: preparing number %d %p, queue len %d\n", n->transmissions, q,
|
||||
list_length(n->queued_packet_list));
|
||||
/* Send packets in the neighbor's list */
|
||||
NETSTACK_RDC.send_list(packet_sent, n, q);
|
||||
nullrdc_send_list(packet_sent, n, q);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,19 +442,19 @@ send_packet(mac_callback_t sent, void *ptr)
|
||||
static void
|
||||
input_packet(void)
|
||||
{
|
||||
NETSTACK_NETWORK.input();
|
||||
nullrdc_packet_input();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
on(void)
|
||||
{
|
||||
return NETSTACK_RDC.on();
|
||||
return NETSTACK_RADIO.on();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
off(int keep_radio_on)
|
||||
off(void)
|
||||
{
|
||||
return NETSTACK_RDC.off(keep_radio_on);
|
||||
return NETSTACK_RADIO.off();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
@ -462,6 +463,7 @@ init(void)
|
||||
memb_init(&packet_memb);
|
||||
memb_init(&metadata_memb);
|
||||
memb_init(&neighbor_memb);
|
||||
on();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct mac_driver csma_driver = {
|
||||
|
@ -67,7 +67,7 @@ struct mac_driver {
|
||||
int (* on)(void);
|
||||
|
||||
/** Turn the MAC layer off. */
|
||||
int (* off)(int keep_radio_on);
|
||||
int (* off)(void);
|
||||
};
|
||||
|
||||
/* Generic MAC return values. */
|
||||
|
@ -62,7 +62,7 @@ on(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
off(int keep_radio_on)
|
||||
off(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -233,14 +233,8 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
||||
return last_sent_ok;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_packet(mac_callback_t sent, void *ptr)
|
||||
{
|
||||
send_one_packet(sent, ptr);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
||||
void
|
||||
nullrdc_send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
||||
{
|
||||
while(buf_list != NULL) {
|
||||
/* We backup the next pointer, as it may be nullified by
|
||||
@ -261,8 +255,8 @@ send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
packet_input(void)
|
||||
void
|
||||
nullrdc_packet_input(void)
|
||||
{
|
||||
#if NULLRDC_SEND_802154_ACK
|
||||
int original_datalen;
|
||||
@ -321,40 +315,8 @@ packet_input(void)
|
||||
}
|
||||
#endif /* NULLRDC_SEND_ACK */
|
||||
if(!duplicate) {
|
||||
NETSTACK_MAC.input();
|
||||
NETSTACK_NETWORK.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 void
|
||||
init(void)
|
||||
{
|
||||
on();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct rdc_driver nullrdc_driver = {
|
||||
"nullrdc",
|
||||
init,
|
||||
send_packet,
|
||||
send_list,
|
||||
packet_input,
|
||||
on,
|
||||
off
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -41,8 +41,27 @@
|
||||
#ifndef NULLRDC_H_
|
||||
#define NULLRDC_H_
|
||||
|
||||
#include "net/mac/rdc.h"
|
||||
#include "contiki-conf.h"
|
||||
#include "net/mac/mac.h"
|
||||
|
||||
extern const struct rdc_driver nullrdc_driver;
|
||||
#ifdef RDC_CONF_WITH_DUPLICATE_DETECTION
|
||||
#define RDC_WITH_DUPLICATE_DETECTION RDC_CONF_WITH_DUPLICATE_DETECTION
|
||||
#else /* RDC_CONF_WITH_DUPLICATE_DETECTION */
|
||||
/* As frames can be spoofed, the RDC layer should not discard a
|
||||
frame because it has seen its sequence number already. Replay
|
||||
protection should be implemented at the LLSEC layer where the
|
||||
authenticity of frames is verified. */
|
||||
#define RDC_WITH_DUPLICATE_DETECTION !LLSEC802154_ENABLED
|
||||
#endif /* RDC_CONF_WITH_DUPLICATE_DETECTION */
|
||||
|
||||
/* List of packets to be sent by RDC layer */
|
||||
struct rdc_buf_list {
|
||||
struct rdc_buf_list *next;
|
||||
struct queuebuf *buf;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
void nullrdc_send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list);
|
||||
void nullrdc_packet_input(void);
|
||||
|
||||
#endif /* NULLRDC_H_ */
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "lib/memb.h"
|
||||
#include "lib/random.h"
|
||||
#include "net/queuebuf.h"
|
||||
#include "net/mac/rdc.h"
|
||||
#include "net/mac/tsch/tsch.h"
|
||||
#include "net/mac/tsch/tsch-private.h"
|
||||
#include "net/mac/tsch/tsch-queue.h"
|
||||
|
@ -1001,13 +1001,9 @@ turn_on(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
turn_off(int keep_radio_on)
|
||||
turn_off(void)
|
||||
{
|
||||
if(keep_radio_on) {
|
||||
NETSTACK_RADIO.on();
|
||||
} else {
|
||||
NETSTACK_RADIO.off();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -43,7 +43,6 @@ void
|
||||
netstack_init(void)
|
||||
{
|
||||
NETSTACK_RADIO.init();
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
}
|
||||
|
@ -59,14 +59,6 @@
|
||||
#endif /* NETSTACK_CONF_MAC */
|
||||
#endif /* NETSTACK_MAC */
|
||||
|
||||
#ifndef NETSTACK_RDC
|
||||
#ifdef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_RDC NETSTACK_CONF_RDC
|
||||
#else /* NETSTACK_CONF_RDC */
|
||||
#define NETSTACK_RDC nullrdc_driver
|
||||
#endif /* NETSTACK_CONF_RDC */
|
||||
#endif /* NETSTACK_RDC */
|
||||
|
||||
#ifndef NETSTACK_RADIO
|
||||
#ifdef NETSTACK_CONF_RADIO
|
||||
#define NETSTACK_RADIO NETSTACK_CONF_RADIO
|
||||
@ -84,7 +76,6 @@
|
||||
#endif /* NETSTACK_FRAMER */
|
||||
|
||||
#include "net/mac/mac.h"
|
||||
#include "net/mac/rdc.h"
|
||||
#include "net/mac/framer/framer.h"
|
||||
#include "dev/radio.h"
|
||||
|
||||
@ -102,7 +93,6 @@ struct network_driver {
|
||||
};
|
||||
|
||||
extern const struct network_driver NETSTACK_NETWORK;
|
||||
extern const struct rdc_driver NETSTACK_RDC;
|
||||
extern const struct mac_driver NETSTACK_MAC;
|
||||
extern const struct radio_driver NETSTACK_RADIO;
|
||||
extern const struct framer NETSTACK_FRAMER;
|
||||
|
@ -363,7 +363,7 @@ PROCESS_THREAD(aducrf101_rf_process, ev, data)
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ PROCESS_THREAD(cc2538_rf_process, ev, data)
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ PROCESS_THREAD(rf_core_process, ev, data)
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
} while(len > 0);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ handle_fd(fd_set *rset, fd_set *wset)
|
||||
buflen = bytes;
|
||||
memcpy(packetbuf_dataptr(), sockbuf, bytes);
|
||||
packetbuf_set_datalen(bytes);
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ on(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
off(int keep_radio_on)
|
||||
off(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ pollhandler(void)
|
||||
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ PROCESS_THREAD(cc2420_process, ev, data)
|
||||
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
@ -660,7 +660,7 @@ PROCESS_THREAD(cc2520_process, ev, data)
|
||||
len = cc2520_read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||
packetbuf_set_datalen(len);
|
||||
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
/* flushrx(); */
|
||||
}
|
||||
|
||||
|
@ -193,8 +193,6 @@ main(void)
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF(" MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
PRINTF(" RDC: ");
|
||||
PRINTF("%s\n", NETSTACK_RDC.name);
|
||||
|
||||
/* Initialise the H/W RNG engine. */
|
||||
random_init(0);
|
||||
|
@ -189,8 +189,8 @@ contiki_init(void)
|
||||
|
||||
/* Initialize communication stack */
|
||||
netstack_init();
|
||||
printf("%s/%s/%s\n",
|
||||
NETSTACK_NETWORK.name, NETSTACK_MAC.name, NETSTACK_RDC.name);
|
||||
printf("%s/%s\n",
|
||||
NETSTACK_NETWORK.name, NETSTACK_MAC.name);
|
||||
|
||||
/* IPv6 CONFIGURATION */
|
||||
|
||||
|
@ -240,8 +240,8 @@ contiki_init()
|
||||
|
||||
/* Initialize communication stack */
|
||||
netstack_init();
|
||||
printf("%s/%s/%s\n",
|
||||
NETSTACK_NETWORK.name, NETSTACK_MAC.name, NETSTACK_RDC.name);
|
||||
printf("%s/%s\n",
|
||||
NETSTACK_NETWORK.name, NETSTACK_MAC.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV4
|
||||
/* IPv4 CONFIGURATION */
|
||||
|
@ -289,7 +289,7 @@ PROCESS_THREAD(cooja_radio_process, ev, data)
|
||||
len = radio_read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ main(void)
|
||||
queuebuf_init();
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
PRINTF("%s %s\n",NETSTACK_MAC.name, NETSTACK_RDC.name);
|
||||
PRINTF("%s\n",NETSTACK_MAC.name);
|
||||
|
||||
#ifndef UIP_FALLBACK_INTERFACE
|
||||
uart0_set_input(serial_line_input_byte);
|
||||
|
@ -884,7 +884,7 @@ PROCESS_THREAD(micromac_radio_process, ev, data)
|
||||
/* is packet valid? */
|
||||
if(len > 0) {
|
||||
packetbuf_set_datalen(len);
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
/* Remove packet from ringbuf */
|
||||
ringbufindex_get(&input_ringbuf);
|
||||
|
@ -205,7 +205,7 @@ main(int argc, char **argv)
|
||||
set_rime_addr();
|
||||
|
||||
netstack_init();
|
||||
printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name);
|
||||
printf("MAC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_NETWORK.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
queuebuf_init();
|
||||
|
@ -206,8 +206,6 @@ main(void)
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF("MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
PRINTF("RDC: ");
|
||||
PRINTF("%s\n", NETSTACK_RDC.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
|
||||
|
@ -298,12 +298,11 @@ main(int argc, char **argv)
|
||||
|
||||
/* Setup X-MAC for 802.15.4 */
|
||||
queuebuf_init();
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
PRINTF("%s %s, radio channel %u, CCA threshold %i\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
PRINTF("%s, radio channel %u, CCA threshold %i\n",
|
||||
NETSTACK_MAC.name,
|
||||
CC2420_CONF_CHANNEL,
|
||||
CC2420_CONF_CCA_THRESH);
|
||||
|
||||
@ -339,13 +338,11 @@ main(int argc, char **argv)
|
||||
}
|
||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
PRINTF("%s %s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
CC2420_CONF_CHANNEL);
|
||||
PRINTF("%s, radio channel %u\n",
|
||||
NETSTACK_MAC.name CC2420_CONF_CHANNEL);
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6
|
||||
|
@ -211,9 +211,6 @@ main(void)
|
||||
printf("%s\n", NETSTACK_NETWORK.name);
|
||||
printf(" MAC: ");
|
||||
printf("%s\n", NETSTACK_MAC.name);
|
||||
printf(" RDC: ");
|
||||
printf("%s", NETSTACK_RDC.name);
|
||||
printf("\n");
|
||||
|
||||
netstack_init();
|
||||
|
||||
|
@ -296,13 +296,11 @@ main(int argc, char **argv)
|
||||
|
||||
/* Setup X-MAC for 802.15.4 */
|
||||
queuebuf_init();
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
RF_CHANNEL);
|
||||
printf("%s, radio channel %u\n",
|
||||
NETSTACK_MAC.name RF_CHANNEL);
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
|
||||
@ -335,13 +333,11 @@ main(int argc, char **argv)
|
||||
|
||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
RF_CHANNEL);
|
||||
printf("%s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, RF_CHANNEL);
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6
|
||||
|
@ -315,13 +315,11 @@ main(int argc, char **argv)
|
||||
/* Setup X-MAC for 802.15.4 */
|
||||
queuebuf_init();
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
CC2420_CONF_CHANNEL);
|
||||
printf("%s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, CC2420_CONF_CHANNEL);
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
|
||||
@ -354,13 +352,11 @@ main(int argc, char **argv)
|
||||
|
||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %s, radio channel %u\n",
|
||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||
CC2420_CONF_CHANNEL);
|
||||
NETSTACK_MAC.name, CC2420_CONF_CHANNEL);
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
#if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6
|
||||
|
@ -271,8 +271,6 @@ main(void)
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF(" MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
PRINTF(" RDC: ");
|
||||
PRINTF("%s\n", NETSTACK_RDC.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
|
||||
|
@ -289,10 +289,6 @@ PROCESS_THREAD(router_process, ev, data)
|
||||
|
||||
setup_network();
|
||||
|
||||
/* The data sink runs with a 100% duty cycle in order to ensure high
|
||||
packet reception rates. */
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
while(1) {
|
||||
etimer_set(&timer, CLOCK_SECOND * 5);
|
||||
PROCESS_YIELD();
|
||||
|
@ -147,8 +147,6 @@ PROCESS_THREAD(rpl_root_process, ev, data)
|
||||
|
||||
PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name);
|
||||
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
set_own_addresses();
|
||||
|
||||
prepare_mcast();
|
||||
|
@ -140,21 +140,12 @@ send_packet(mac_callback_t sent, void *ptr)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
||||
{
|
||||
if(buf_list != NULL) {
|
||||
queuebuf_to_packetbuf(buf_list->buf);
|
||||
send_packet(sent, ptr);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
packet_input(void)
|
||||
{
|
||||
if(NETSTACK_FRAMER.parse() < 0) {
|
||||
PRINTF("br-rdc: failed to parse %u\n", packetbuf_datalen());
|
||||
} else {
|
||||
NETSTACK_MAC.input();
|
||||
NETSTACK_NETWORK.input();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -165,7 +156,7 @@ on(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
off(int keep_radio_on)
|
||||
off()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -176,11 +167,10 @@ init(void)
|
||||
callback_pos = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct rdc_driver border_router_rdc_driver = {
|
||||
"br-rdc",
|
||||
const struct mac_driver border_router_mac_driver = {
|
||||
"br-mac",
|
||||
init,
|
||||
send_packet,
|
||||
send_list,
|
||||
packet_input,
|
||||
on,
|
||||
off
|
||||
|
@ -346,10 +346,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||
print_local_addresses();
|
||||
#endif
|
||||
|
||||
/* The border router runs with a 100% duty cycle in order to ensure high
|
||||
packet reception rates. */
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
while(1) {
|
||||
etimer_set(&et, CLOCK_SECOND * 2);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
|
@ -51,8 +51,8 @@
|
||||
|
||||
#define CMD_CONF_OUTPUT border_router_cmd_output
|
||||
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC border_router_rdc_driver
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC border_router_mac_driver
|
||||
|
||||
/* used by wpcap (see /cpu/native/net/wpcap-drv.c) */
|
||||
#define SELECT_CALLBACK 1
|
||||
|
@ -166,7 +166,7 @@ slip_packet_input(unsigned char *data, int len)
|
||||
if(slip_config_verbose > 0) {
|
||||
printf("Packet input over SLIP: %d\n", len);
|
||||
}
|
||||
NETSTACK_RDC.input();
|
||||
NETSTACK_MAC.input();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
|
@ -409,20 +409,13 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||
* Prevent that by turning the radio off until we are initialized as a DAG root.
|
||||
*/
|
||||
prefix_set = 0;
|
||||
NETSTACK_MAC.off(0);
|
||||
NETSTACK_MAC.off();
|
||||
|
||||
PROCESS_PAUSE();
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
PRINTF("RPL-Border router started\n");
|
||||
#if 0
|
||||
/* The border router runs with a 100% duty cycle in order to ensure high
|
||||
packet reception rates.
|
||||
Note if the MAC RDC is not turned off now, aggressive power management of the
|
||||
cpu will interfere with establishing the SLIP connection */
|
||||
NETSTACK_MAC.off(1);
|
||||
#endif
|
||||
|
||||
/* Request prefix until it has been received */
|
||||
while(!prefix_set) {
|
||||
@ -431,11 +424,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
}
|
||||
|
||||
/* Now turn the radio on, but disable radio duty cycling.
|
||||
* Since we are the DAG root, reception delays would constrain mesh throughbut.
|
||||
*/
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
#if DEBUG || 1
|
||||
print_local_addresses();
|
||||
#endif
|
||||
|
@ -63,8 +63,6 @@
|
||||
/* Netstack layers */
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC tschmac_driver
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC nordc_driver
|
||||
|
||||
/* IEEE802.15.4 frame version */
|
||||
#undef FRAME802154_CONF_VERSION
|
||||
|
@ -151,10 +151,6 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||
|
||||
print_local_addresses();
|
||||
|
||||
/* The data sink runs with a 100% duty cycle in order to ensure high
|
||||
packet reception rates. */
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL);
|
||||
if(server_conn == NULL) {
|
||||
PRINTF("No UDP connection available, exiting the process!\n");
|
||||
|
@ -217,7 +217,6 @@ PROCESS_THREAD(slip_radio_process, ev, data)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
init();
|
||||
NETSTACK_RDC.off(1);
|
||||
#ifdef SLIP_RADIO_CONF_SENSORS
|
||||
SLIP_RADIO_CONF_SENSORS.init();
|
||||
#endif
|
||||
|
@ -407,7 +407,7 @@ PROCESS_THREAD(very_sleepy_demo_process, ev, data)
|
||||
|
||||
if(mac_keep_on == MAC_CAN_BE_TURNED_OFF && state == STATE_VERY_SLEEPY) {
|
||||
leds_off(LEDS_GREEN);
|
||||
NETSTACK_MAC.off(0);
|
||||
NETSTACK_MAC.off();
|
||||
} else {
|
||||
leds_on(LEDS_GREEN);
|
||||
NETSTACK_MAC.on();
|
||||
|
@ -40,7 +40,6 @@
|
||||
#define MAC_CONFIG MAC_CONFIG_TSCH
|
||||
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#undef NETSTACK_CONF_FRAMER
|
||||
|
||||
#if MAC_CONFIG == MAC_CONFIG_NULLRDC
|
||||
@ -58,7 +57,6 @@
|
||||
#endif /* WITH_SECURITY */
|
||||
|
||||
#define NETSTACK_CONF_MAC tschmac_driver
|
||||
#define NETSTACK_CONF_RDC nordc_driver
|
||||
|
||||
/* IEEE802.15.4 frame version */
|
||||
#undef FRAME802154_CONF_VERSION
|
||||
|
@ -116,7 +116,6 @@ rpl_tools_init(uip_ipaddr_t *br_prefix)
|
||||
uip_ipaddr_t global_ipaddr;
|
||||
|
||||
if(br_prefix) { /* We are root */
|
||||
NETSTACK_RDC.off(1);
|
||||
memcpy(&global_ipaddr, br_prefix, 16);
|
||||
uip_ds6_set_addr_iid(&global_ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&global_ipaddr, 0, ADDR_AUTOCONF);
|
||||
|
@ -150,10 +150,6 @@
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC tschmac_driver
|
||||
|
||||
/* Contiki netstack: RDC */
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC nordc_driver
|
||||
|
||||
#else /* No TSCH, use Csma with ACK (default MAC) */
|
||||
|
||||
#undef MICROMAC_CONF_CHANNEL
|
||||
|
@ -115,7 +115,6 @@ rpl_tools_init(uip_ipaddr_t *br_prefix)
|
||||
#endif
|
||||
if(br_prefix) { /* We are root */
|
||||
/* If an RDC layer is used, turn it off (i.e. keep the radio on at the root). */
|
||||
NETSTACK_RDC.off(1);
|
||||
memcpy(&global_ipaddr, br_prefix, 16);
|
||||
uip_ds6_set_addr_iid(&global_ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&global_ipaddr, 0, ADDR_AUTOCONF);
|
||||
|
@ -271,7 +271,7 @@ PROCESS_THREAD(router_node_process, ev, data)
|
||||
static struct etimer et;
|
||||
|
||||
/* Turn radio off while initialazing */
|
||||
NETSTACK_MAC.off(0);
|
||||
NETSTACK_MAC.off();
|
||||
|
||||
/* Initialize the IP64 module so we'll start translating packets */
|
||||
ip64_init();
|
||||
@ -307,9 +307,6 @@ PROCESS_THREAD(router_node_process, ev, data)
|
||||
|
||||
leds_off(LEDS_DHCP);
|
||||
|
||||
/* Turn the radio on and create the network */
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
/* Set us up as a RPL root node. */
|
||||
rpl_dag_root_init_dag();
|
||||
|
||||
|
@ -125,9 +125,6 @@ PROCESS_THREAD(zoul_demo_process, ev, data)
|
||||
|
||||
counter = 0;
|
||||
|
||||
/* Disable the radio duty cycle and keep the radio on */
|
||||
NETSTACK_MAC.off(1);
|
||||
|
||||
broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx);
|
||||
|
||||
/* Configure the user button */
|
||||
|
@ -33,6 +33,6 @@ void
|
||||
netstack_init(void)
|
||||
{
|
||||
NETSTACK_RADIO.init();
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -32,8 +32,8 @@
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC sensniff_rdc_driver
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC sensniff_mac_driver
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Include platform-specific header */
|
||||
#include "target-conf.h"
|
||||
|
@ -36,7 +36,6 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "net/mac/mac.h"
|
||||
#include "net/mac/rdc.h"
|
||||
#include "net/netstack.h"
|
||||
#include "sensniff.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -46,11 +45,6 @@ send(mac_callback_t sent, void *ptr)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *list)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
input(void)
|
||||
{
|
||||
sensniff_output_frame();
|
||||
@ -60,17 +54,11 @@ static int
|
||||
on(void)
|
||||
{
|
||||
NETSTACK_RADIO.on();
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
off(int keep_radio_on)
|
||||
{
|
||||
return keep_radio_on;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned short
|
||||
cca(void)
|
||||
off(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -81,14 +69,12 @@ init(void)
|
||||
on();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct rdc_driver sensniff_rdc_driver = {
|
||||
const struct mac_driver sensniff_mac_driver = {
|
||||
"sensniff-rdc",
|
||||
init,
|
||||
send,
|
||||
send_list,
|
||||
input,
|
||||
on,
|
||||
off,
|
||||
cca,
|
||||
off
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -47,9 +47,6 @@
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC tschmac_driver
|
||||
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC nordc_driver
|
||||
|
||||
#undef FRAME802154_CONF_VERSION
|
||||
#define FRAME802154_CONF_VERSION FRAME802154_IEEE802154E_2012
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
#undef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC tschmac_driver
|
||||
#undef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC nordc_driver
|
||||
|
||||
#if WITH_SECURITY_ON
|
||||
#define TEST_CONFIG_TYPE SECURITY_ON
|
||||
|
Loading…
Reference in New Issue
Block a user