Implement RADIO_CONST_MAX_PAYLOAD_LEN: simplelink ieee-mode
#define STATUS_REJECT_FRAME 0x40 /* bit 6 */
#define STATUS_CRC_FAIL 0x80 /* bit 7 */
/*---------------------------------------------------------------------------*/
+/*
+ * The number of bytes appended at the end of an outgoing frame as a footer
+ * Currently fixed at 2 bytes for IEEE 802.15.4 compliance.
+ */
+#define CHECKSUM_LEN 2
+
+/*
+ * The maximum number of bytes this driver can accept from the MAC layer for
+ * transmission or will deliver to the MAC layer after reception. Includes
+ * the MAC header and payload, but not the FCS.
+ */
+#define MAX_PAYLOAD_LEN (127 - CHECKSUM_LEN)
+/*---------------------------------------------------------------------------*/
#define FRAME_FCF_OFFSET 0
#define FRAME_SEQNUM_OFFSET 2
@@ -423,7 +436,7 @@ init(void)
static int
prepare(const void *payload, unsigned short payload_len)
{
- if(payload_len > TX_BUF_SIZE || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
+ if(payload_len > TX_BUF_SIZE || payload_len > MAX_PAYLOAD_LEN) {
return RADIO_TX_ERR;
}
memcpy(ieee_radio.tx_buf, payload, payload_len);
@@ -435,7 +448,7 @@ transmit(unsigned short transmit_len)
{
rf_result_t res;
- if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
+ if(transmit_len > MAX_PAYLOAD_LEN) {
LOG_ERR("Too long\n");
return RADIO_TX_ERR;
}
@@ -824,6 +837,10 @@ get_value(radio_param_t param, radio_value_t *value)
*value = (radio_value_t)ieee_radio.last.corr_lqi;
return RADIO_RESULT_OK;
+ case RADIO_CONST_MAX_PAYLOAD_LEN:
+ *value = (radio_value_t)MAX_PAYLOAD_LEN;
+ return RADIO_RESULT_OK;
+
default:
return RADIO_RESULT_NOT_SUPPORTED;
}
