Skip to content

Commit f728d55

Browse files
author
Juha Heiskanen
committed
Support for handle CRC error which will automatically change a channel.
If Driver call data ind with zero length we can then handle that like CRC error which will change a FHHS channel if is pending. Change-Id: Iba0cdce8dabf20f1640e63b33c116d7d3c0a9254
1 parent 6b6f535 commit f728d55

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/MAC/IEEE802_15_4/mac_pd_sap.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -890,14 +890,19 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
890890

891891
if (message->id == MAC15_4_PD_SAP_DATA_IND) {
892892
arm_pd_sap_generic_ind_t *pd_data_ind = &(message->message.generic_data_ind);
893+
mac_pre_parsed_frame_t *buffer = NULL;
894+
if (pd_data_ind->data_len == 0) {
895+
goto ERROR_HANDLER;
896+
}
897+
893898
if (pd_data_ind->data_len < 3) {
894899
return -1;
895900
}
896901

897902
mac_fcf_sequence_t fcf_read;
898903
const uint8_t *ptr = mac_header_parse_fcf_dsn(&fcf_read, pd_data_ind->data_ptr);
899904

900-
mac_pre_parsed_frame_t *buffer = mac_pd_sap_allocate_receive_buffer(rf_ptr, &fcf_read, pd_data_ind);
905+
buffer = mac_pd_sap_allocate_receive_buffer(rf_ptr, &fcf_read, pd_data_ind);
901906
if (buffer && mac_filter_modify_link_quality(rf_ptr->mac_interface_id, buffer) == 1) {
902907
goto ERROR_HANDLER;
903908
}
@@ -935,7 +940,9 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
935940
}
936941
ERROR_HANDLER:
937942
mcps_sap_pre_parsed_frame_buffer_free(buffer);
938-
sw_mac_stats_update(rf_ptr, STAT_MAC_RX_DROP, 0);
943+
if (pd_data_ind->data_len >= 3) {
944+
sw_mac_stats_update(rf_ptr, STAT_MAC_RX_DROP, 0);
945+
}
939946
if (rf_ptr->fhss_api) {
940947
rf_ptr->fhss_api->data_tx_done(rf_ptr->fhss_api, false, false, 0);
941948
}

0 commit comments

Comments
 (0)