Made the ContikiMAC header configurable from contiki-conf.h
This commit is contained in:
parent
9e30f0f7c6
commit
3cb42ceb10
1 changed files with 7 additions and 7 deletions
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* The Contiki power-saving MAC protocol (ContikiMAC)
|
* Implementation of the ContikiMAC power-saving radio duty cycling protocol
|
||||||
* \author
|
* \author
|
||||||
* Adam Dunkels <adam@sics.se>
|
* Adam Dunkels <adam@sics.se>
|
||||||
* Niclas Finne <nfi@sics.se>
|
* Niclas Finne <nfi@sics.se>
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
#include "sys/pt.h"
|
#include "sys/pt.h"
|
||||||
#include "sys/rtimer.h"
|
#include "sys/rtimer.h"
|
||||||
|
|
||||||
|
|
||||||
/*#include "cooja-debug.h"*/
|
/*#include "cooja-debug.h"*/
|
||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
|
|
||||||
|
@ -66,7 +67,9 @@
|
||||||
#ifndef WITH_STREAMING
|
#ifndef WITH_STREAMING
|
||||||
#define WITH_STREAMING 0
|
#define WITH_STREAMING 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef WITH_CONTIKIMAC_HEADER
|
#ifdef CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER
|
||||||
|
#define WITH_CONTIKIMAC_HEADER CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER
|
||||||
|
#else
|
||||||
#define WITH_CONTIKIMAC_HEADER 1
|
#define WITH_CONTIKIMAC_HEADER 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef WITH_FAST_SLEEP
|
#ifndef WITH_FAST_SLEEP
|
||||||
|
@ -382,7 +385,7 @@ powercycle(struct rtimer *t, void *ptr)
|
||||||
t0 = RTIMER_NOW();
|
t0 = RTIMER_NOW();
|
||||||
if(we_are_sending == 0) {
|
if(we_are_sending == 0) {
|
||||||
powercycle_turn_radio_on();
|
powercycle_turn_radio_on();
|
||||||
// schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME);
|
/* schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME);*/
|
||||||
#if 0
|
#if 0
|
||||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME));
|
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME));
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
@ -398,7 +401,7 @@ powercycle(struct rtimer *t, void *ptr)
|
||||||
}
|
}
|
||||||
powercycle_turn_radio_off();
|
powercycle_turn_radio_off();
|
||||||
}
|
}
|
||||||
// schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME + CCA_SLEEP_TIME);
|
/* schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME + CCA_SLEEP_TIME);*/
|
||||||
schedule_powercycle_fixed(t, RTIMER_NOW() + CCA_SLEEP_TIME);
|
schedule_powercycle_fixed(t, RTIMER_NOW() + CCA_SLEEP_TIME);
|
||||||
/* COOJA_DEBUG_STR("yield\n");*/
|
/* COOJA_DEBUG_STR("yield\n");*/
|
||||||
PT_YIELD(&pt);
|
PT_YIELD(&pt);
|
||||||
|
@ -675,12 +678,10 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
|
||||||
packet length. */
|
packet length. */
|
||||||
transmit_len = packetbuf_totlen();
|
transmit_len = packetbuf_totlen();
|
||||||
if(transmit_len < SHORTEST_PACKET_SIZE) {
|
if(transmit_len < SHORTEST_PACKET_SIZE) {
|
||||||
#if 0
|
|
||||||
/* Pad with zeroes */
|
/* Pad with zeroes */
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
ptr = packetbuf_dataptr();
|
ptr = packetbuf_dataptr();
|
||||||
memset(ptr + packetbuf_datalen(), 0, SHORTEST_PACKET_SIZE - packetbuf_totlen());
|
memset(ptr + packetbuf_datalen(), 0, SHORTEST_PACKET_SIZE - packetbuf_totlen());
|
||||||
#endif
|
|
||||||
|
|
||||||
PRINTF("contikimac: shorter than shortest (%d)\n", packetbuf_totlen());
|
PRINTF("contikimac: shorter than shortest (%d)\n", packetbuf_totlen());
|
||||||
transmit_len = SHORTEST_PACKET_SIZE;
|
transmit_len = SHORTEST_PACKET_SIZE;
|
||||||
|
@ -888,7 +889,6 @@ qsend_packet(mac_callback_t sent, void *ptr)
|
||||||
{
|
{
|
||||||
int ret = send_packet(sent, ptr);
|
int ret = send_packet(sent, ptr);
|
||||||
if(ret != MAC_TX_DEFERRED) {
|
if(ret != MAC_TX_DEFERRED) {
|
||||||
// printf("contikimac qsend_packet %p\n", ptr);
|
|
||||||
mac_call_sent_callback(sent, ptr, ret, 1);
|
mac_call_sent_callback(sent, ptr, ret, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue