@@ -156,6 +156,24 @@ static rfc_propRxOutput_t rx_stats;
156
156
#define DOT_4G_PHR_DW_BIT 0
157
157
#endif
158
158
/*---------------------------------------------------------------------------*/
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
+ /*---------------------------------------------------------------------------*/
159
177
/* TX power table for the 431-527MHz band */
160
178
#ifdef PROP_MODE_CONF_TX_POWER_431_527
161
179
#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]
217
235
#define ALIGN_TO_4 (size ) (((size) + 3) & ~3)
218
236
219
237
#define RX_BUF_SIZE ALIGN_TO_4(RX_BUF_DATA_OFFSET \
220
- + NETSTACK_RADIO_MAX_PAYLOAD_LEN \
238
+ + MAX_PAYLOAD_LEN \
221
239
+ RX_BUF_METADATA_SIZE)
222
240
223
241
/*
@@ -661,7 +679,7 @@ init(void)
661
679
static int
662
680
prepare (const void * payload , unsigned short payload_len )
663
681
{
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 ) {
665
683
return RADIO_TX_ERR ;
666
684
}
667
685
@@ -680,7 +698,7 @@ transmit(unsigned short transmit_len)
680
698
/* Length in .15.4g PHY HDR. Includes the CRC but not the HDR itself */
681
699
uint16_t total_length ;
682
700
683
- if (transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN ) {
701
+ if (transmit_len > MAX_PAYLOAD_LEN ) {
684
702
PRINTF ("transmit: too long\n" );
685
703
return RADIO_TX_ERR ;
686
704
}
@@ -1234,6 +1252,9 @@ get_value(radio_param_t param, radio_value_t *value)
1234
1252
case RADIO_CONST_DELAY_BEFORE_DETECT :
1235
1253
* value = (radio_value_t )RADIO_DELAY_BEFORE_DETECT ;
1236
1254
return RADIO_RESULT_OK ;
1255
+ case RADIO_CONST_MAX_PAYLOAD_LEN :
1256
+ * value = (radio_value_t )MAX_PAYLOAD_LEN ;
1257
+ return RADIO_RESULT_OK ;
1237
1258
default :
1238
1259
return RADIO_RESULT_NOT_SUPPORTED ;
1239
1260
}
0 commit comments