Simplify CSMA configuration
This commit is contained in:
parent
9a0087faf3
commit
dc9e77eaf2
@ -251,10 +251,6 @@ typedef uint32_t rtimer_clock_t;
|
||||
#include "board.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* Configure CSMA for when it's selected */
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 1
|
||||
|
||||
#define NETSTACK_CONF_RADIO cc2538_rf_driver
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -59,8 +59,7 @@
|
||||
/* Default network config */
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
#define CSMA_CONF_SEND_802154_ACK 1
|
||||
#define CSMA_CONF_SEND_SOFT_ACK 1
|
||||
#define CSMA_CONF_ACK_WAIT_TIME RTIMER_SECOND / 500
|
||||
#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME 0
|
||||
|
||||
|
@ -44,9 +44,6 @@
|
||||
#define NETSTACK_CONF_RADIO micromac_radio_driver
|
||||
#endif /* NETSTACK_CONF_RADIO */
|
||||
|
||||
/* Csma: use hardware ACKs */
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 1
|
||||
|
||||
/* Platform-specific (H/W) CCM* implementation */
|
||||
#ifndef CCM_STAR_CONF
|
||||
#define CCM_STAR_CONF ccm_star_driver_jn516x
|
||||
|
@ -304,10 +304,6 @@ typedef uint32_t rtimer_clock_t;
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Configure CSMA for when it's selected */
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 1
|
||||
|
||||
#ifndef NETSTACK_CONF_RADIO
|
||||
#define NETSTACK_CONF_RADIO cc2538_rf_driver
|
||||
#endif
|
||||
|
@ -58,9 +58,6 @@
|
||||
#define CC2650_FAST_RADIO_STARTUP 0
|
||||
#endif
|
||||
|
||||
/* Configure CSMA for when it's selected */
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
|
||||
#ifdef RF_CHANNEL
|
||||
#define RF_CORE_CONF_CHANNEL RF_CHANNEL
|
||||
#endif
|
||||
@ -94,15 +91,13 @@
|
||||
|
||||
#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 400)
|
||||
#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 0
|
||||
#define CSMA_CONF_SEND_802154_ACK 1
|
||||
#define CSMA_CONF_SEND_SOFT_ACK 1
|
||||
|
||||
#else
|
||||
#else /* CC13XX_CONF_PROP_MODE */
|
||||
#define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 1
|
||||
#define CSMA_CONF_SEND_802154_ACK 0
|
||||
#endif
|
||||
#define CSMA_CONF_SEND_SOFT_ACK 0
|
||||
#endif /* CC13XX_CONF_PROP_MODE */
|
||||
|
||||
#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125
|
||||
|
||||
|
@ -312,9 +312,6 @@ typedef uint32_t rtimer_clock_t;
|
||||
|
||||
#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 200)
|
||||
#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1500)
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
#define CSMA_CONF_802154_AUTOACK_HW 1
|
||||
#define CSMA_CONF_SEND_802154_ACK 0
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -166,16 +166,13 @@ send_one_packet(void *ptr)
|
||||
int last_sent_ok = 0;
|
||||
|
||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
|
||||
#if CSMA_802154_AUTOACK || CSMA_802154_AUTOACK_HW
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
|
||||
#endif /* CSMA_802154_AUTOACK || CSMA_802154_AUTOACK_HW */
|
||||
|
||||
if(NETSTACK_FRAMER.create() < 0) {
|
||||
/* Failed to allocate space for headers */
|
||||
LOG_ERR("failed to create packet\n");
|
||||
ret = MAC_TX_ERR_FATAL;
|
||||
} else {
|
||||
#if CSMA_802154_AUTOACK
|
||||
int is_broadcast;
|
||||
uint8_t dsn;
|
||||
dsn = ((uint8_t *)packetbuf_hdrptr())[2] & 0xff;
|
||||
@ -250,25 +247,6 @@ send_one_packet(void *ptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !CSMA_802154_AUTOACK */
|
||||
|
||||
switch(NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen())) {
|
||||
case RADIO_TX_OK:
|
||||
ret = MAC_TX_OK;
|
||||
break;
|
||||
case RADIO_TX_COLLISION:
|
||||
ret = MAC_TX_COLLISION;
|
||||
break;
|
||||
case RADIO_TX_NOACK:
|
||||
ret = MAC_TX_NOACK;
|
||||
break;
|
||||
default:
|
||||
ret = MAC_TX_ERR;
|
||||
break;
|
||||
}
|
||||
|
||||
#endif /* !CSMA_802154_AUTOACK */
|
||||
}
|
||||
if(ret == MAC_TX_OK) {
|
||||
last_sent_ok = 1;
|
||||
|
@ -59,21 +59,18 @@ send_packet(mac_callback_t sent, void *ptr)
|
||||
static void
|
||||
input_packet(void)
|
||||
{
|
||||
#if CSMA_SEND_802154_ACK
|
||||
#if CSMA_SEND_SOFT_ACK
|
||||
int original_datalen;
|
||||
uint8_t *original_dataptr;
|
||||
|
||||
original_datalen = packetbuf_datalen();
|
||||
original_dataptr = packetbuf_dataptr();
|
||||
#endif /* CSMA_SEND_802154_ACK */
|
||||
#endif
|
||||
|
||||
#if CSMA_802154_AUTOACK
|
||||
if(packetbuf_datalen() == CSMA_ACK_LEN) {
|
||||
/* Ignore ack packets */
|
||||
LOG_DBG("ignored ack\n");
|
||||
} else
|
||||
#endif /* CSMA_802154_AUTOACK */
|
||||
if(NETSTACK_FRAMER.parse() < 0) {
|
||||
} else if(NETSTACK_FRAMER.parse() < 0) {
|
||||
LOG_ERR("failed to parse %u\n", packetbuf_datalen());
|
||||
} else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_node_addr) &&
|
||||
@ -82,7 +79,6 @@ input_packet(void)
|
||||
} else {
|
||||
int duplicate = 0;
|
||||
|
||||
#if CSMA_802154_AUTOACK || CSMA_802154_AUTOACK_HW
|
||||
/* Check for duplicate packet. */
|
||||
duplicate = mac_sequence_is_duplicate();
|
||||
if(duplicate) {
|
||||
@ -93,9 +89,8 @@ input_packet(void)
|
||||
} else {
|
||||
mac_sequence_register_seqno();
|
||||
}
|
||||
#endif /* CSMA_802154_AUTOACK */
|
||||
|
||||
#if CSMA_SEND_802154_ACK
|
||||
#if CSMA_SEND_SOFT_ACK
|
||||
{
|
||||
frame802154_t info154;
|
||||
frame802154_parse(original_dataptr, original_datalen, &info154);
|
||||
@ -111,7 +106,7 @@ input_packet(void)
|
||||
NETSTACK_RADIO.send(ackdata, CSMA_ACK_LEN);
|
||||
}
|
||||
}
|
||||
#endif /* CSMA_SEND_802154_ACK */
|
||||
#endif /* CSMA_SEND_SOFT_ACK */
|
||||
if(!duplicate) {
|
||||
LOG_WARN("received packet from ");
|
||||
LOG_WARN_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
||||
|
@ -45,23 +45,11 @@
|
||||
#include "net/mac/mac.h"
|
||||
#include "dev/radio.h"
|
||||
|
||||
#ifdef CSMA_CONF_802154_AUTOACK
|
||||
#define CSMA_802154_AUTOACK CSMA_CONF_802154_AUTOACK
|
||||
#else
|
||||
#define CSMA_802154_AUTOACK 0
|
||||
#endif /* CSMA_CONF_802154_AUTOACK */
|
||||
|
||||
#ifdef CSMA_CONF_802154_AUTOACK_HW
|
||||
#define CSMA_802154_AUTOACK_HW CSMA_CONF_802154_AUTOACK_HW
|
||||
#else
|
||||
#define CSMA_802154_AUTOACK_HW 0
|
||||
#endif /* CSMA_CONF_802154_AUTOACK_HW */
|
||||
|
||||
#ifdef CSMA_CONF_SEND_802154_ACK
|
||||
#define CSMA_SEND_802154_ACK CSMA_CONF_SEND_802154_ACK
|
||||
#else /* CSMA_CONF_SEND_802154_ACK */
|
||||
#define CSMA_SEND_802154_ACK 0
|
||||
#endif /* CSMA_CONF_SEND_802154_ACK */
|
||||
#ifdef CSMA_CONF_SEND_SOFT_ACK
|
||||
#define CSMA_SEND_SOFT_ACK CSMA_CONF_SEND_SOFT_ACK
|
||||
#else /* CSMA_CONF_SEND_SOFT_ACK */
|
||||
#define CSMA_SEND_SOFT_ACK 0
|
||||
#endif /* CSMA_CONF_SEND_SOFT_ACK */
|
||||
|
||||
#ifdef CSMA_CONF_ACK_WAIT_TIME
|
||||
#define CSMA_ACK_WAIT_TIME CSMA_CONF_ACK_WAIT_TIME
|
||||
|
@ -39,9 +39,6 @@
|
||||
#define JSON_WS_CONF_CALLBACK_PORT 80
|
||||
#define JSON_WS_CONF_CALLBACK_INTERVAL 120
|
||||
|
||||
#undef CSMA_CONF_802154_AUTOACK
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
|
||||
/* needs to be ~4 for fragmentation to work */
|
||||
#undef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 4
|
||||
|
@ -52,12 +52,7 @@
|
||||
#undef UIP_CONF_TCP
|
||||
#define UIP_CONF_TCP 0
|
||||
|
||||
#if !WITH_TSCH
|
||||
|
||||
#undef CSMA_CONF_802154_AUTOACK
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
|
||||
#else
|
||||
#if WITH_TSCH
|
||||
|
||||
/*******************************************************/
|
||||
/********************* Enable TSCH *********************/
|
||||
@ -106,6 +101,6 @@
|
||||
#undef TSCH_SCHEDULE_CONF_MAX_LINKS
|
||||
#define TSCH_SCHEDULE_CONF_MAX_LINKS 4
|
||||
|
||||
#endif
|
||||
#endif /* WITH_TSCH */
|
||||
|
||||
#endif
|
||||
|
@ -40,9 +40,6 @@
|
||||
#define NETSTACK_MAX_ROUTE_ENTRIES 10
|
||||
#endif /* TEST_MORE_ROUTES */
|
||||
|
||||
#undef CSMA_CONF_802154_AUTOACK
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
|
||||
/* Define as minutes */
|
||||
#define RPL_CONF_DEFAULT_LIFETIME_UNIT 60
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
|
||||
#define CSMA_CONF_802154_AUTOACK 1
|
||||
|
||||
#define RPL_CONF_DAO_ACK 1
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user