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