Merge pull request #433 from simonduq/contrib/15.4-default-channel

Homogenize IEEE 802.15.4 channel configuration
This commit is contained in:
George Oikonomou 2018-04-13 17:19:04 +01:00 committed by GitHub
commit cb120e328b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 57 additions and 111 deletions

View File

@ -219,14 +219,6 @@
*/
/* RF Config */
#ifdef RF_CHANNEL
#define CC2538_RF_CONF_CHANNEL RF_CHANNEL
#endif
#ifndef CC2538_RF_CONF_CHANNEL
#define CC2538_RF_CONF_CHANNEL 26
#endif /* CC2538_RF_CONF_CHANNEL */
#ifndef CC2538_RF_CONF_AUTOACK
#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */
#endif /* CC2538_CONF_AUTOACK */

View File

@ -113,7 +113,7 @@ static int8_t rssi;
static uint8_t crc_corr;
/*---------------------------------------------------------------------------*/
static uint8_t rf_flags;
static uint8_t rf_channel = CC2538_RF_CHANNEL;
static uint8_t rf_channel = IEEE802154_DEFAULT_CHANNEL;
static int on(void);
static int off(void);

View File

@ -74,12 +74,6 @@
#define CC2538_RF_CCA_THRES CC2538_RF_CCA_THRES_USER_GUIDE
#endif /* CC2538_RF_CONF_CCA_THRES */
#ifdef CC2538_RF_CONF_CHANNEL
#define CC2538_RF_CHANNEL CC2538_RF_CONF_CHANNEL
#else
#define CC2538_RF_CHANNEL 18
#endif /* CC2538_RF_CONF_CHANNEL */
#ifdef CC2538_RF_CONF_AUTOACK
#define CC2538_RF_AUTOACK CC2538_RF_CONF_AUTOACK
#else

View File

@ -54,14 +54,6 @@
#define CC2650_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH)
#endif
#ifdef RF_CHANNEL
#define RF_CORE_CONF_CHANNEL RF_CHANNEL
#endif
#ifndef RF_CORE_CONF_CHANNEL
#define RF_CORE_CONF_CHANNEL 25
#endif
/* Number of Prop Mode RX buffers */
#ifndef PROP_MODE_CONF_RX_BUF_CNT
#define PROP_MODE_CONF_RX_BUF_CNT 4
@ -81,9 +73,10 @@
#if CC13XX_CONF_PROP_MODE
#define NETSTACK_CONF_RADIO prop_mode_driver
#ifndef RF_CORE_CONF_CHANNEL
#define RF_CORE_CONF_CHANNEL 0
#endif
/* Channels count from 0 upwards in IEEE 802.15.4g */
#ifndef IEEE802154_CONF_DEFAULT_CHANNEL
#define IEEE802154_CONF_DEFAULT_CHANNEL 0
#endif /* IEEE802154_CONF_DEFAULT_CHANNEL */
#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 400)
#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)

View File

@ -610,7 +610,7 @@ init_rf_params(void)
cmd->startTime = 0x00000000;
cmd->startTrigger.triggerType = TRIG_NOW;
cmd->condition.rule = COND_NEVER;
cmd->channel = RF_CORE_CHANNEL;
cmd->channel = IEEE802154_DEFAULT_CHANNEL;
cmd->rxConfig.bAutoFlushCrc = 1;
cmd->rxConfig.bAutoFlushIgn = 0;

View File

@ -629,7 +629,7 @@ init(void)
smartrf_settings_cmd_prop_rx_adv.pQueue = &rx_data_queue;
smartrf_settings_cmd_prop_rx_adv.pOutput = (uint8_t *)&rx_stats;
set_channel(RF_CORE_CHANNEL);
set_channel(IEEE802154_DEFAULT_CHANNEL);
if(on() != RF_CORE_CMD_OK) {
PRINTF("init: on() failed\n");

View File

@ -57,13 +57,6 @@
#include <stdint.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
/* The channel to use in IEEE or prop mode. */
#ifdef RF_CORE_CONF_CHANNEL
#define RF_CORE_CHANNEL RF_CORE_CONF_CHANNEL
#else
#define RF_CORE_CHANNEL 25
#endif /* RF_CORE_CONF_IEEE_MODE_CHANNEL */
/*---------------------------------------------------------------------------*/
#define RF_CORE_FRONT_END_MODE_DIFFERENTIAL 0
#define RF_CORE_FRONT_END_MODE_SINGLE_RFP 1
#define RF_CORE_FRONT_END_MODE_SINGLE_RFN 2

View File

@ -641,7 +641,7 @@ cc2420_init(void)
init_security();
cc2420_set_pan_addr(0xffff, 0x0000, NULL);
cc2420_set_channel(CC2420_CONF_CHANNEL);
cc2420_set_channel(IEEE802154_DEFAULT_CHANNEL);
cc2420_set_cca_threshold(CC2420_CONF_CCA_THRESH);
flushrx();

View File

@ -50,10 +50,6 @@
#define WITH_SEND_CCA 1
#ifndef CC2420_CONF_CHANNEL
#define CC2420_CONF_CHANNEL 26
#endif /* CC2420_CONF_CHANNEL */
#ifndef CC2420_CONF_CCA_THRESH
#define CC2420_CONF_CCA_THRESH -45
#endif /* CC2420_CONF_CCA_THRESH */

View File

@ -106,7 +106,7 @@ set_rf_params(void)
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
}
/*---------------------------------------------------------------------------*/

View File

@ -133,7 +133,6 @@ typedef uint64_t rtimer_clock_t;
#define CFS_CONF_OFFSET_TYPE long
#define RF_CHANNEL 26
#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125
#define PLATFORM_CONF_SUPPORTS_STACK_CHECK 0

View File

@ -40,14 +40,6 @@
#include "jn516x-def.h"
#ifdef RF_CHANNEL
#define MICROMAC_CONF_CHANNEL RF_CHANNEL
#endif
#ifndef MICROMAC_CONF_CHANNEL
#define MICROMAC_CONF_CHANNEL 26
#endif
/* Configure radio driver */
#ifndef NETSTACK_CONF_RADIO
#define NETSTACK_CONF_RADIO micromac_radio_driver

View File

@ -100,11 +100,6 @@
#define MIRCOMAC_CONF_BUF_NUM 2
#endif /* MIRCOMAC_CONF_BUF_NUM */
/* Init radio channel */
#ifndef MICROMAC_CONF_CHANNEL
#define MICROMAC_CONF_CHANNEL 26
#endif
/* Default energy level threshold for clear channel detection */
#ifndef MICROMAC_CONF_CCA_THR
#define MICROMAC_CONF_CCA_THR 39 /* approximately -85 dBm */
@ -159,7 +154,7 @@ static uint8_t autoack_enabled = MICROMAC_CONF_AUTOACK;
static uint8_t send_on_cca = 0;
/* Current radio channel */
static int current_channel = MICROMAC_CONF_CHANNEL;
static int current_channel = IEEE802154_DEFAULT_CHANNEL;
/* Current set point tx power
Actual tx power may be different. Use get_txpower() for actual power */

View File

@ -115,7 +115,7 @@ set_rf_params(void)
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
}
/*---------------------------------------------------------------------------*/

View File

@ -11,10 +11,6 @@
#include "sky-def.h"
#include "msp430-def.h"
/*---------------------------------------------------------------------------*/
/* Map RF_CHANNEL to cc2420 default channel */
#ifdef RF_CHANNEL
#define CC2420_CONF_CHANNEL RF_CHANNEL
#endif /* RF_CHANNEL */
/* Configure radio driver */
#ifndef NETSTACK_CONF_RADIO

View File

@ -204,15 +204,7 @@ platform_init_stage_three(void)
LOG_INFO("Node id: N/A\n");
}
#if NETSTACK_CONF_WITH_IPV6
LOG_INFO("%s, rf channel %u, CCA threshold %i\n",
NETSTACK_MAC.name,
CC2420_CONF_CHANNEL,
CC2420_CONF_CCA_THRESH);
#else /* NETSTACK_CONF_WITH_IPV6 */
LOG_INFO("%s, rf channel %u\n",
NETSTACK_MAC.name, CC2420_CONF_CHANNEL);
#endif /* NETSTACK_CONF_WITH_IPV6 */
LOG_INFO("CC2420 CCA threshold %i\n", CC2420_CONF_CCA_THRESH);
#if !NETSTACK_CONF_WITH_IPV6
uart1_set_input(serial_line_input_byte);

View File

@ -128,7 +128,7 @@ set_rf_params(void)
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, RF_CORE_CHANNEL);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
/* also set the global node id */

View File

@ -171,7 +171,7 @@ set_rf_params(void)
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, IEEE802154_DEFAULT_CHANNEL);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
}
/*---------------------------------------------------------------------------*/

View File

@ -107,13 +107,6 @@ PROCESS_THREAD(er_example_server, ev, data)
PRINTF("Starting Erbium Example Server\n");
#ifdef RF_CHANNEL
PRINTF("RF channel: %u\n", RF_CHANNEL);
#endif
#ifdef IEEE802154_PANID
PRINTF("PAN ID: 0x%04X\n", IEEE802154_PANID);
#endif
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
PRINTF("LL header: %u\n", UIP_LLH_LEN);
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);

View File

@ -82,13 +82,6 @@ PROCESS_THREAD(plugtest_server, ev, data)
PRINTF("ETSI IoT CoAP Plugtests Server\n");
#ifdef RF_CHANNEL
PRINTF("RF channel: %u\n", RF_CHANNEL);
#endif
#ifdef IEEE802154_PANID
PRINTF("PAN ID: 0x%04X\n", IEEE802154_PANID);
#endif
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
PRINTF("LL header: %u\n", UIP_LLH_LEN);
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);

View File

@ -39,10 +39,6 @@
#ifndef PROJECT_ERBIUM_CONF_H_
#define PROJECT_ERBIUM_CONF_H_
/* Custom channel and PAN ID configuration for your project. */
/* #define RF_CHANNEL 26 */
/* #define IEEE802154_CONF_PANID 0xABCD */
/* IP buffer size must match all other hops, in particular the border router. */
/* #define UIP_CONF_BUFFER_SIZE 256 */

View File

@ -33,7 +33,7 @@
/*---------------------------------------------------------------------------*/
/* Change to match your configuration */
#define IEEE802154_CONF_PANID 0xABCD
#define RF_CORE_CONF_CHANNEL 25
#define IEEE802154_CONF_DEFAULT_CHANNEL 25
#define RF_BLE_CONF_ENABLED 1
/*---------------------------------------------------------------------------*/

View File

@ -36,7 +36,7 @@
/*---------------------------------------------------------------------------*/
/* Change to match your configuration */
#define IEEE802154_CONF_PANID 0xABCD
#define RF_CORE_CONF_CHANNEL 25
#define IEEE802154_CONF_DEFAULT_CHANNEL 25
#define RF_BLE_CONF_ENABLED 1
/*---------------------------------------------------------------------------*/
#endif /* PROJECT_CONF_H_ */

View File

@ -33,7 +33,7 @@
/*---------------------------------------------------------------------------*/
/* Change to match your configuration */
#define IEEE802154_CONF_PANID 0xABCD
#define RF_CORE_CONF_CHANNEL 25
#define IEEE802154_CONF_DEFAULT_CHANNEL 25
/*---------------------------------------------------------------------------*/
/* Enable the ROM bootloader */

View File

@ -72,8 +72,6 @@
#define IEEE802154_CONF_PANID 0xabcd
#define MICROMAC_CONF_CHANNEL 26
/* UART Configuration */
#define UART_HW_FLOW_CTRL 0

View File

@ -104,8 +104,6 @@
#if MAC_CONF_WITH_CSMA /* Configure Csma with ACK (default MAC) */
#define MICROMAC_CONF_CHANNEL 26
#define MICROMAC_CONF_AUTOACK 1
/* increase internal radio buffering */

View File

@ -24,7 +24,7 @@
<identifier>sky1</identifier>
<description>Sky Mote Type #sky1</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-udp/udp-server.c</source>
<commands EXPORT="discard">make clean udp-server.sky TARGET=sky</commands>
<commands EXPORT="discard">make udp-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-udp/udp-server.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
@ -47,7 +47,7 @@
<identifier>sky2</identifier>
<description>Sky Mote Type #sky2</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-udp/udp-client.c</source>
<commands EXPORT="discard">make clean udp-client.sky TARGET=sky</commands>
<commands EXPORT="discard">make udp-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-udp/udp-client.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>

View File

@ -41,6 +41,16 @@
#define IEEE802154_CONF_PANID 0xabcd
#endif /* IEEE802154_CONF_PANID */
/* IEEE802154_CONF_DEFAULT_CHANNEL defines the default channel for IEEE 802.15.4
* networks, for MAC layers without a channel selection or channel hopping
* mechanism. Current 802.15.4 MAC layers:
* - CSMA: uses IEEE802154_CONF_DEFAULT_CHANNEL
* - TSCH: uses its own TSCH_DEFAULT_HOPPING_SEQUENCE instead
*/
#ifndef IEEE802154_CONF_DEFAULT_CHANNEL
#define IEEE802154_CONF_DEFAULT_CHANNEL 26
#endif /* IEEE802154_CONF_DEF_CHANNEL */
/* QUEUEBUF_CONF_NUM specifies the number of queue buffers. Queue
buffers are used throughout the Contiki netstack but the
configuration option can be tweaked to save memory. Performance can

View File

@ -87,9 +87,15 @@ main(void)
platform_init_stage_two();
LOG_INFO("Starting " CONTIKI_VERSION_STRING "\n");
LOG_INFO(" Net: %s\n", NETSTACK_NETWORK.name);
LOG_INFO(" MAC: %s\n", NETSTACK_MAC.name);
LOG_INFO("- Routing: %s\n", NETSTACK_ROUTING.name);
LOG_INFO("- Net: %s\n", NETSTACK_NETWORK.name);
LOG_INFO("- MAC: %s\n", NETSTACK_MAC.name);
LOG_INFO("- 802.15.4 PANID: 0x%04x\n", IEEE802154_PANID);
#if MAC_CONF_WITH_CSMA
LOG_INFO("- 802.15.4 Channel: %u\n", IEEE802154_DEFAULT_CHANNEL);
#elif MAC_CONF_WITH_TSCH
LOG_INFO("- 802.15.4 TSCH default hopping sequence length: %u\n", (unsigned)sizeof(TSCH_DEFAULT_HOPPING_SEQUENCE));
#endif
netstack_init();

View File

@ -43,6 +43,14 @@
#include "contiki.h"
#include "dev/radio.h"
/**
*\brief The default channel for IEEE 802.15.4 networks.
*/
#ifdef IEEE802154_CONF_DEFAULT_CHANNEL
#define IEEE802154_DEFAULT_CHANNEL IEEE802154_CONF_DEFAULT_CHANNEL
#else /* IEEE802154_CONF_DEFAULT_CHANNEL */
#define IEEE802154_DEFAULT_CHANNEL 26
#endif /* IEEE802154_CONF_DEFAULT_CHANNEL */
typedef void (* mac_callback_t)(void *ptr, int status, int transmissions);

View File

@ -106,7 +106,9 @@ local_repair(const char *str)
static void
ext_header_remove(void)
{
#if NETSTACK_CONF_WITH_IPV6
uip_ext_len = 0;
#endif /* NETSTACK_CONF_WITH_IPV6 */
}
/*---------------------------------------------------------------------------*/
static int

View File

@ -16,18 +16,18 @@
##### "CONTIKI_VERSION_STRING": ________________ == CONTIKI_VERSION_STRING
#ifdef IEEE802154_CONF_PANID
##### "IEEE802154_CONF_PANID":__________________ == IEEE802154_CONF_PANID
#else
##### "IEEE802154_CONF_PANID":__________________ == IEEE802154_PANID
#endif
#ifdef FRAME802154_CONF_VERSION
##### "FRAME802154_CONF_VERSION":_______________ == FRAME802154_CONF_VERSION
#else
##### "FRAME802154_CONF_VERSION":_______________ == FRAME802154_VERSION
#endif
#ifdef IEEE802154_CONF_PANID
##### "IEEE802154_CONF_PANID":__________________ == IEEE802154_CONF_PANID
#else
##### "IEEE802154_CONF_PANID":__________________ == IEEE802154_PANID
#endif
#if MAC_CONF_WITH_TSCH
#ifdef TSCH_CONF_DEFAULT_HOPPING_SEQUENCE
@ -68,10 +68,10 @@
#else /* MAC_CONF_WITH_TSCH */
#ifdef RF_CHANNEL
##### "RF_CHANNEL": ____________________________ == RF_CHANNEL
#ifdef IEEE802154_CONF_DEFAULT_CHANNEL
##### "IEEE802154_CONF_DEFAULT_CHANNEL": _______ == IEEE802154_CONF_DEFAULT_CHANNEL
#else
##### "RF_CHANNEL": ____________________________ ><
##### "IEEE802154_CONF_DEFAULT_CHANNEL": _______ -> IEEE802154_DEFAULT_CHANNEL
#endif
#endif /*MAC_CONF_WITH_TSCH */