Skip to content

Commit

Permalink
Support for handle CRC error which will automatically change a channel.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Juha Heiskanen committed Feb 13, 2020
1 parent 6b6f535 commit f728d55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions source/MAC/IEEE802_15_4/mac_pd_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,14 +890,19 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)

if (message->id == MAC15_4_PD_SAP_DATA_IND) {
arm_pd_sap_generic_ind_t *pd_data_ind = &(message->message.generic_data_ind);
mac_pre_parsed_frame_t *buffer = NULL;
if (pd_data_ind->data_len == 0) {
goto ERROR_HANDLER;
}

if (pd_data_ind->data_len < 3) {
return -1;
}

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

mac_pre_parsed_frame_t *buffer = mac_pd_sap_allocate_receive_buffer(rf_ptr, &fcf_read, pd_data_ind);
buffer = mac_pd_sap_allocate_receive_buffer(rf_ptr, &fcf_read, pd_data_ind);
if (buffer && mac_filter_modify_link_quality(rf_ptr->mac_interface_id, buffer) == 1) {
goto ERROR_HANDLER;
}
Expand Down Expand Up @@ -935,7 +940,9 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
}
ERROR_HANDLER:
mcps_sap_pre_parsed_frame_buffer_free(buffer);
sw_mac_stats_update(rf_ptr, STAT_MAC_RX_DROP, 0);
if (pd_data_ind->data_len >= 3) {
sw_mac_stats_update(rf_ptr, STAT_MAC_RX_DROP, 0);
}
if (rf_ptr->fhss_api) {
rf_ptr->fhss_api->data_tx_done(rf_ptr->fhss_api, false, false, 0);
}
Expand Down

0 comments on commit f728d55

Please sign in to comment.