Skip to content

Commit 052b62f

Browse files
authored
Merge branch 'develop' into upstreaming/heapmem-alignment-fix
2 parents 93acc32 + 7b4de05 commit 052b62f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+961
-273
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ env:
7373
- TEST_NAME='rpl-classic' BUILD_COOJA=true
7474
- TEST_NAME='tun-rpl-br' BUILD_COOJA=true
7575
- TEST_NAME='coap-lwm2m'
76+
- TEST_NAME='script-base'
7677
- TEST_NAME='simulation-base' BUILD_COOJA=true
7778
- TEST_NAME='ieee802154' BUILD_COOJA=true
7879
- TEST_NAME='compile-nxp-ports'

arch/cpu/cc2538/cc2538-conf.h

-5
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@
263263
#ifndef NETSTACK_CONF_RADIO
264264
#define NETSTACK_CONF_RADIO cc2538_rf_driver
265265
#endif
266-
267-
/**
268-
* \brief Maximum packet size
269-
*/
270-
#define cc2538_rf_driver_max_payload_len 125
271266
/** @} */
272267
/*---------------------------------------------------------------------------*/
273268
/**

arch/cpu/cc2538/dev/cc2538-rf.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ static radio_result_t get_value(radio_param_t param, radio_value_t *value);
148148
#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].power)
149149
#define OUTPUT_POWER_MAX (output_power[0].power)
150150
/*---------------------------------------------------------------------------*/
151+
/*
152+
* The maximum number of bytes this driver can accept from the MAC layer for
153+
* transmission or will deliver to the MAC layer after reception. Includes
154+
* the MAC header and payload, but not the FCS.
155+
*/
156+
#define MAX_PAYLOAD_LEN (CC2538_RF_MAX_PACKET_LEN - CHECKSUM_LEN)
157+
/*---------------------------------------------------------------------------*/
151158
PROCESS(cc2538_rf_process, "cc2538 RF driver");
152159
/*---------------------------------------------------------------------------*/
153160
/**
@@ -600,7 +607,7 @@ prepare(const void *payload, unsigned short payload_len)
600607
{
601608
uint8_t i;
602609

603-
if(payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
610+
if(payload_len > MAX_PAYLOAD_LEN) {
604611
return RADIO_TX_ERR;
605612
}
606613

@@ -665,7 +672,7 @@ transmit(unsigned short transmit_len)
665672

666673
LOG_INFO("Transmit\n");
667674

668-
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
675+
if(transmit_len > MAX_PAYLOAD_LEN) {
669676
return RADIO_TX_ERR;
670677
}
671678

@@ -934,6 +941,9 @@ get_value(radio_param_t param, radio_value_t *value)
934941
case RADIO_CONST_DELAY_BEFORE_DETECT:
935942
*value = (radio_value_t)CC2538_DELAY_BEFORE_DETECT;
936943
return RADIO_RESULT_OK;
944+
case RADIO_CONST_MAX_PAYLOAD_LEN:
945+
*value = (radio_value_t)MAX_PAYLOAD_LEN;
946+
return RADIO_RESULT_OK;
937947
default:
938948
return RADIO_RESULT_NOT_SUPPORTED;
939949
}

arch/cpu/cc26x0-cc13x0/cc13xx-cc26xx-conf.h

-8
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@
104104
#ifndef AES_128_CONF
105105
#define AES_128_CONF cc26xx_aes_128_driver
106106
#endif /* AES_128_CONF */
107-
108-
/* This is fixed */
109-
#define ieee_mode_driver_max_payload_len 125
110-
/* This maybe changed in the future, with software upgrade */
111-
#define prop_mode_driver_max_payload_len 125
112-
/* This is not used, but needs to be defined in order to compile */
113-
#define ble_cc2650_driver_max_payload_len 125
114-
115107
/** @} */
116108
/*---------------------------------------------------------------------------*/
117109
/**

arch/cpu/cc26x0-cc13x0/rf-core/ieee-mode.c

+19-3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,19 @@ static rfc_CMD_IEEE_MOD_FILT_t filter_cmd;
181181
*/
182182
static uint8_t cmd_ieee_rx_buf[RF_CMD_BUFFER_SIZE] CC_ALIGN(4);
183183
/*---------------------------------------------------------------------------*/
184+
/*
185+
* The number of bytes appended at the end of an outgoing frame as a footer
186+
* Currently fixed at 2 bytes for IEEE 802.15.4 compliance.
187+
*/
188+
#define CHECKSUM_LEN 2
189+
190+
/*
191+
* The maximum number of bytes this driver can accept from the MAC layer for
192+
* transmission or will deliver to the MAC layer after reception. Includes
193+
* the MAC header and payload, but not the FCS.
194+
*/
195+
#define MAX_PAYLOAD_LEN (127 - CHECKSUM_LEN)
196+
/*---------------------------------------------------------------------------*/
184197
#define DATA_ENTRY_LENSZ_NONE 0
185198
#define DATA_ENTRY_LENSZ_BYTE 1
186199
#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */
@@ -198,7 +211,7 @@ static uint8_t cmd_ieee_rx_buf[RF_CMD_BUFFER_SIZE] CC_ALIGN(4);
198211
#define RX_BUF_DATA_OFFSET (RX_BUF_LENGTH_OFFSET + 1)
199212

200213
#define RX_BUF_SIZE (RX_BUF_DATA_OFFSET \
201-
+ NETSTACK_RADIO_MAX_PAYLOAD_LEN \
214+
+ MAX_PAYLOAD_LEN \
202215
+ RX_BUF_METADATA_SIZE)
203216

204217
/* Four receive buffers entries with room for 1 IEEE802.15.4 frame in each */
@@ -767,7 +780,7 @@ init(void)
767780
static int
768781
prepare(const void *payload, unsigned short payload_len)
769782
{
770-
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
783+
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > MAX_PAYLOAD_LEN) {
771784
return RADIO_TX_ERR;
772785
}
773786

@@ -786,7 +799,7 @@ transmit(unsigned short transmit_len)
786799
rtimer_clock_t t0;
787800
volatile rfc_CMD_IEEE_TX_t cmd;
788801

789-
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
802+
if(transmit_len > MAX_PAYLOAD_LEN) {
790803
PRINTF("transmit: too long\n");
791804
return RADIO_TX_ERR;
792805
}
@@ -1283,6 +1296,9 @@ get_value(radio_param_t param, radio_value_t *value)
12831296
case RADIO_CONST_DELAY_BEFORE_DETECT:
12841297
*value = (radio_value_t)RADIO_DELAY_BEFORE_DETECT;
12851298
return RADIO_RESULT_OK;
1299+
case RADIO_CONST_MAX_PAYLOAD_LEN:
1300+
*value = (radio_value_t)MAX_PAYLOAD_LEN;
1301+
return RADIO_RESULT_OK;
12861302
default:
12871303
return RADIO_RESULT_NOT_SUPPORTED;
12881304
}

arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.c

+24-3
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@ static rfc_propRxOutput_t rx_stats;
156156
#define DOT_4G_PHR_DW_BIT 0
157157
#endif
158158
/*---------------------------------------------------------------------------*/
159+
/*
160+
* The maximum number of bytes this driver can accept from the MAC layer for
161+
* transmission or will deliver to the MAC layer after reception. Includes
162+
* the MAC header and payload, but not the CRC.
163+
*
164+
* Unlike typical 2.4GHz radio drivers, this driver supports the .15.4g
165+
* 32-bit CRC option.
166+
*
167+
* This radio hardware is perfectly happy to transmit frames longer than 127
168+
* bytes, which is why it's OK to end up transmitting 125 payload bytes plus
169+
* a 4-byte CRC.
170+
*
171+
* In the future we can change this to support transmission of long frames,
172+
* for example as per .15.4g. the size of the TX and RX buffers would need
173+
* adjusted accordingly.
174+
*/
175+
#define MAX_PAYLOAD_LEN 125
176+
/*---------------------------------------------------------------------------*/
159177
/* TX power table for the 431-527MHz band */
160178
#ifdef PROP_MODE_CONF_TX_POWER_431_527
161179
#define PROP_MODE_TX_POWER_431_527 PROP_MODE_CONF_TX_POWER_431_527
@@ -217,7 +235,7 @@ static const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]
217235
#define ALIGN_TO_4(size) (((size) + 3) & ~3)
218236

219237
#define RX_BUF_SIZE ALIGN_TO_4(RX_BUF_DATA_OFFSET \
220-
+ NETSTACK_RADIO_MAX_PAYLOAD_LEN \
238+
+ MAX_PAYLOAD_LEN \
221239
+ RX_BUF_METADATA_SIZE)
222240

223241
/*
@@ -661,7 +679,7 @@ init(void)
661679
static int
662680
prepare(const void *payload, unsigned short payload_len)
663681
{
664-
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
682+
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > MAX_PAYLOAD_LEN) {
665683
return RADIO_TX_ERR;
666684
}
667685

@@ -680,7 +698,7 @@ transmit(unsigned short transmit_len)
680698
/* Length in .15.4g PHY HDR. Includes the CRC but not the HDR itself */
681699
uint16_t total_length;
682700

683-
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
701+
if(transmit_len > MAX_PAYLOAD_LEN) {
684702
PRINTF("transmit: too long\n");
685703
return RADIO_TX_ERR;
686704
}
@@ -1234,6 +1252,9 @@ get_value(radio_param_t param, radio_value_t *value)
12341252
case RADIO_CONST_DELAY_BEFORE_DETECT:
12351253
*value = (radio_value_t)RADIO_DELAY_BEFORE_DETECT;
12361254
return RADIO_RESULT_OK;
1255+
case RADIO_CONST_MAX_PAYLOAD_LEN:
1256+
*value = (radio_value_t)MAX_PAYLOAD_LEN;
1257+
return RADIO_RESULT_OK;
12371258
default:
12381259
return RADIO_RESULT_NOT_SUPPORTED;
12391260
}

arch/cpu/msp430/msp430-conf.h

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@
5555
#define SLIP_ARCH_CONF_ENABLED 0
5656
#endif
5757
#endif
58-
59-
#define cc2420_driver_max_payload_len 125
60-
6158
/*---------------------------------------------------------------------------*/
6259
#endif /* MSP430_CONF_H_ */
6360
/*---------------------------------------------------------------------------*/

arch/cpu/simplelink-cc13xx-cc26xx/cc13xx-cc26xx-conf.h

-4
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@
238238
#else
239239
#error "Unsupported Device Line defined"
240240
#endif /* Unsupported device line */
241-
242-
#define prop_mode_driver_max_payload_len 125
243-
#define ieee_mode_driver_max_payload_len 125
244-
245241
/** @} */
246242
/*---------------------------------------------------------------------------*/
247243
/**

arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x0/prop-settings.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,20 @@
6666
#include "prop-settings.h"
6767
/*---------------------------------------------------------------------------*/
6868
/* TI-RTOS RF Mode Object */
69+
70+
/*
71+
* CC1310 only supports RF_MODE_PROPRIETARY_SUB_1, and hence we need to
72+
* separate the rfMode setting between CC1310 and CC1350*.
73+
*/
74+
#if defined(DEVICE_CC1310)
75+
#define RF_PROP_MODE RF_MODE_PROPRIETARY_SUB_1
76+
#else
77+
#define RF_PROP_MODE RF_MODE_MULTIPLE
78+
#endif
79+
6980
RF_Mode rf_prop_mode =
7081
{
71-
.rfMode = RF_MODE_MULTIPLE,
82+
.rfMode = RF_PROP_MODE,
7283
.cpePatchFxn = &rf_patch_cpe_genfsk,
7384
.mcePatchFxn = 0,
7485
.rfePatchFxn = &rf_patch_rfe_genfsk,

arch/cpu/simplelink-cc13xx-cc26xx/rf/ieee-mode.c

+19-2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@
113113
#define STATUS_REJECT_FRAME 0x40 /* bit 6 */
114114
#define STATUS_CRC_FAIL 0x80 /* bit 7 */
115115
/*---------------------------------------------------------------------------*/
116+
/*
117+
* The number of bytes appended at the end of an outgoing frame as a footer
118+
* Currently fixed at 2 bytes for IEEE 802.15.4 compliance.
119+
*/
120+
#define CHECKSUM_LEN 2
121+
122+
/*
123+
* The maximum number of bytes this driver can accept from the MAC layer for
124+
* transmission or will deliver to the MAC layer after reception. Includes
125+
* the MAC header and payload, but not the FCS.
126+
*/
127+
#define MAX_PAYLOAD_LEN (127 - CHECKSUM_LEN)
128+
/*---------------------------------------------------------------------------*/
116129
#define FRAME_FCF_OFFSET 0
117130
#define FRAME_SEQNUM_OFFSET 2
118131

@@ -423,7 +436,7 @@ init(void)
423436
static int
424437
prepare(const void *payload, unsigned short payload_len)
425438
{
426-
if(payload_len > TX_BUF_SIZE || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
439+
if(payload_len > TX_BUF_SIZE || payload_len > MAX_PAYLOAD_LEN) {
427440
return RADIO_TX_ERR;
428441
}
429442
memcpy(ieee_radio.tx_buf, payload, payload_len);
@@ -435,7 +448,7 @@ transmit(unsigned short transmit_len)
435448
{
436449
rf_result_t res;
437450

438-
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
451+
if(transmit_len > MAX_PAYLOAD_LEN) {
439452
LOG_ERR("Too long\n");
440453
return RADIO_TX_ERR;
441454
}
@@ -824,6 +837,10 @@ get_value(radio_param_t param, radio_value_t *value)
824837
*value = (radio_value_t)ieee_radio.last.corr_lqi;
825838
return RADIO_RESULT_OK;
826839

840+
case RADIO_CONST_MAX_PAYLOAD_LEN:
841+
*value = (radio_value_t)MAX_PAYLOAD_LEN;
842+
return RADIO_RESULT_OK;
843+
827844
default:
828845
return RADIO_RESULT_NOT_SUPPORTED;
829846
}

arch/cpu/simplelink-cc13xx-cc26xx/rf/prop-mode.c

+24-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ typedef enum {
122122
#define DOT_4G_PHR_DW_BIT 0
123123
#endif
124124
/*---------------------------------------------------------------------------*/
125+
/*
126+
* The maximum number of bytes this driver can accept from the MAC layer for
127+
* transmission or will deliver to the MAC layer after reception. Includes
128+
* the MAC header and payload, but not the CRC.
129+
*
130+
* Unlike typical 2.4GHz radio drivers, this driver supports the .15.4g
131+
* 32-bit CRC option.
132+
*
133+
* This radio hardware is perfectly happy to transmit frames longer than 127
134+
* bytes, which is why it's OK to end up transmitting 125 payload bytes plus
135+
* a 4-byte CRC.
136+
*
137+
* In the future we can change this to support transmission of long frames,
138+
* for example as per .15.4g. the size of the TX and RX buffers would need
139+
* adjusted accordingly.
140+
*/
141+
#define MAX_PAYLOAD_LEN 125
142+
/*---------------------------------------------------------------------------*/
125143
/* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */
126144
#define TIMEOUT_ENTER_RX_WAIT (RTIMER_SECOND >> 10)
127145

@@ -333,7 +351,7 @@ calculate_lqi(int8_t rssi)
333351
static int
334352
prepare(const void *payload, unsigned short payload_len)
335353
{
336-
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
354+
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > MAX_PAYLOAD_LEN) {
337355
return RADIO_TX_ERR;
338356
}
339357

@@ -346,7 +364,7 @@ transmit(unsigned short transmit_len)
346364
{
347365
rf_result_t res;
348366

349-
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
367+
if(transmit_len > MAX_PAYLOAD_LEN) {
350368
LOG_ERR("Too long\n");
351369
return RADIO_TX_ERR;
352370
}
@@ -620,6 +638,10 @@ get_value(radio_param_t param, radio_value_t *value)
620638
*value = (radio_value_t)tx_power_max(rf_tx_power_table, rf_tx_power_table_size);
621639
return RADIO_RESULT_OK;
622640

641+
case RADIO_CONST_MAX_PAYLOAD_LEN:
642+
*value = (radio_value_t)MAX_PAYLOAD_LEN;
643+
return RADIO_RESULT_OK;
644+
623645
default:
624646
return RADIO_RESULT_NOT_SUPPORTED;
625647
}

arch/dev/cc1200/cc1200-conf.h

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
#else
7373
#define CC1200_MAX_PAYLOAD_LEN 125
7474
#endif
75-
76-
#define cc1200_driver_max_payload_len CC1200_MAX_PAYLOAD_LEN
7775
/*---------------------------------------------------------------------------*/
7876
/*
7977
* The RX watchdog is used to check whether the radio is in RX mode at regular

arch/dev/cc1200/cc1200.c

+4
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,10 @@ get_value(radio_param_t param, radio_value_t *value)
13341334
*value = (radio_value_t)CC1200_RF_CFG.delay_before_detect;
13351335
return RADIO_RESULT_OK;
13361336

1337+
case RADIO_CONST_MAX_PAYLOAD_LEN:
1338+
*value = (radio_value_t)CC1200_MAX_PAYLOAD_LEN;
1339+
return RADIO_RESULT_OK;
1340+
13371341
default:
13381342

13391343
return RADIO_RESULT_NOT_SUPPORTED;

0 commit comments

Comments
 (0)