cooja-radio: enable to turn off the turnaround and CCA features
This commit is contained in:
parent
33e86042e5
commit
830753f360
@ -46,9 +46,6 @@
|
|||||||
#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE
|
#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE
|
||||||
#define CCA_SS_THRESHOLD -95
|
#define CCA_SS_THRESHOLD -95
|
||||||
|
|
||||||
#define WITH_TURNAROUND 1
|
|
||||||
#define WITH_SEND_CCA 1
|
|
||||||
|
|
||||||
const struct simInterface radio_interface;
|
const struct simInterface radio_interface;
|
||||||
|
|
||||||
/* COOJA */
|
/* COOJA */
|
||||||
@ -174,14 +171,14 @@ radio_send(const void *payload, unsigned short payload_len)
|
|||||||
int radiostate = simRadioHWOn;
|
int radiostate = simRadioHWOn;
|
||||||
|
|
||||||
/* Simulate turnaround time of 2ms for packets, 1ms for acks*/
|
/* Simulate turnaround time of 2ms for packets, 1ms for acks*/
|
||||||
#if WITH_TURNAROUND
|
#if COOJA_SIMULATE_TURNAROUND
|
||||||
simProcessRunValue = 1;
|
simProcessRunValue = 1;
|
||||||
cooja_mt_yield();
|
cooja_mt_yield();
|
||||||
if(payload_len > 3) {
|
if(payload_len > 3) {
|
||||||
simProcessRunValue = 1;
|
simProcessRunValue = 1;
|
||||||
cooja_mt_yield();
|
cooja_mt_yield();
|
||||||
}
|
}
|
||||||
#endif /* WITH_TURNAROUND */
|
#endif /* COOJA_SIMULATE_TURNAROUND */
|
||||||
|
|
||||||
if(!simRadioHWOn) {
|
if(!simRadioHWOn) {
|
||||||
/* Turn on radio temporarily */
|
/* Turn on radio temporarily */
|
||||||
@ -198,11 +195,11 @@ radio_send(const void *payload, unsigned short payload_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Transmit on CCA */
|
/* Transmit on CCA */
|
||||||
#if WITH_SEND_CCA
|
#if COOJA_TRANSMIT_ON_CCA
|
||||||
if(!channel_clear()) {
|
if(!channel_clear()) {
|
||||||
return RADIO_TX_COLLISION;
|
return RADIO_TX_COLLISION;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SEND_CCA */
|
#endif /* COOJA_TRANSMIT_ON_CCA */
|
||||||
|
|
||||||
/* Copy packet data to temporary storage */
|
/* Copy packet data to temporary storage */
|
||||||
memcpy(simOutDataBuffer, payload, payload_len);
|
memcpy(simOutDataBuffer, payload, payload_len);
|
||||||
|
@ -36,6 +36,18 @@
|
|||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
|
|
||||||
|
#ifdef COOJA_CONF_SIMULATE_TURNAROUND
|
||||||
|
#define COOJA_SIMULATE_TURNAROUND COOJA_CONF_SIMULATE_TURNAROUND
|
||||||
|
#else
|
||||||
|
#define COOJA_SIMULATE_TURNAROUND 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COOJA_CONF_TRANSMIT_ON_CCA
|
||||||
|
#define COOJA_TRANSMIT_ON_CCA COOJA_CONF_TRANSMIT_ON_CCA
|
||||||
|
#else
|
||||||
|
#define COOJA_TRANSMIT_ON_CCA 1
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const struct radio_driver cooja_radio_driver;
|
extern const struct radio_driver cooja_radio_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user