commit
b646b5161a
@ -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
|
||||
|
@ -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,22 +507,22 @@ 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");
|
||||
TSCH_SCHEDULE_AND_YIELD(pt, t, current_slot_start, tsch_timing[tsch_ts_cca_offset], "cca");
|
||||
TSCH_DEBUG_TX_EVENT();
|
||||
tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT);
|
||||
/* CCA */
|
||||
BUSYWAIT_UNTIL_ABS(!(cca_status |= NETSTACK_RADIO.channel_clear()),
|
||||
current_slot_start, TS_CCA_OFFSET + TS_CCA);
|
||||
BUSYWAIT_UNTIL_ABS(!(cca_status &= NETSTACK_RADIO.channel_clear()),
|
||||
current_slot_start, tsch_timing[tsch_ts_cca_offset] + tsch_timing[tsch_ts_cca]);
|
||||
TSCH_DEBUG_TX_EVENT();
|
||||
/* there is not enough time to turn radio off */
|
||||
/* NETSTACK_RADIO.off(); */
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user