TSCH: cleanup flags for CCA configuration

This commit is contained in:
Simon Duquennoy 2018-09-28 16:12:28 +02:00
parent f91ef005bc
commit 9fb7e8bfed
2 changed files with 14 additions and 4 deletions

View File

@ -365,18 +365,21 @@
/******** Configuration: CSMA *******/
/* TSCH CSMA-CA parameters, see IEEE 802.15.4e-2012 */
/* Min backoff exponent */
#ifdef TSCH_CONF_MAC_MIN_BE
#define TSCH_MAC_MIN_BE TSCH_CONF_MAC_MIN_BE
#else
#define TSCH_MAC_MIN_BE 1
#endif
/* Max backoff exponent */
#ifdef TSCH_CONF_MAC_MAX_BE
#define TSCH_MAC_MAX_BE TSCH_CONF_MAC_MAX_BE
#else
#define TSCH_MAC_MAX_BE 5
#endif
/* Max number of re-transmissions */
#ifdef TSCH_CONF_MAC_MAX_FRAME_RETRIES
#define TSCH_MAC_MAX_FRAME_RETRIES TSCH_CONF_MAC_MAX_FRAME_RETRIES
@ -391,6 +394,13 @@
#define TSCH_PACKET_EACK_WITH_SRC_ADDR 0
#endif
/* Perform CCA before sending? */
#ifdef TSCH_CONF_CCA_ENABLED
#define TSCH_CCA_ENABLED TSCH_CONF_CCA_ENABLED
#else
#define TSCH_CCA_ENABLED 0
#endif
/* Include destination address in ACK? */
#ifdef TSCH_PACKET_CONF_EACK_WITH_DEST_ADDR
#define TSCH_PACKET_EACK_WITH_DEST_ADDR TSCH_PACKET_CONF_EACK_WITH_DEST_ADDR

View File

@ -464,9 +464,9 @@ PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t))
/* Did we set the frame pending bit to request an extra burst link? */
static int burst_link_requested;
#if CCA_ENABLED
#if TSCH_CCA_ENABLED
static uint8_t cca_status;
#endif
#endif /* TSCH_CCA_ENABLED */
/* get payload */
packet = queuebuf_dataptr(current_packet->qb);
@ -507,7 +507,7 @@ PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t))
if(packet_ready && NETSTACK_RADIO.prepare(packet, packet_len) == 0) { /* 0 means success */
static rtimer_clock_t tx_duration;
#if CCA_ENABLED
#if TSCH_CCA_ENABLED
cca_status = 1;
/* delay before CCA */
TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, TS_CCA_OFFSET, "cca");
@ -522,7 +522,7 @@ PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t))
if(cca_status == 0) {
mac_tx_status = MAC_TX_COLLISION;
} else
#endif /* CCA_ENABLED */
#endif /* TSCH_CCA_ENABLED */
{
/* delay before TX */
TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, tsch_timing[tsch_ts_tx_offset] - RADIO_DELAY_BEFORE_TX, "TxBeforeTx");