Skip to content

Commit

Permalink
MAC: Validate TX time (ARMmbed#2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso authored Aug 27, 2020
1 parent a1bfed4 commit 587add5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/MAC/IEEE802_15_4/mac_pd_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,14 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r
}
}
VALIDATE_TX_TIME:
// TODO: Validate TX time here
if (rf_ptr->active_pd_data_request && rf_ptr->active_pd_data_request->tx_time && !rf_ptr->mac_ack_tx_active && !rf_ptr->mac_edfe_tx_active) {
int32_t tx_time_error_us = mac_mcps_sap_get_phy_timestamp(rf_ptr) - rf_ptr->active_pd_data_request->tx_time;
// Positive error means that TX is too late. Do not allow transmit if transmission is delayed over 5ms
if (tx_time_error_us > 5000) {
mac_sap_cca_fail_cb(rf_ptr, 0xffff);
return PHY_TX_NOT_ALLOWED;
}
}
#ifdef TIMING_TOOL_TRACES
tr_info("%u TX_start %u", mac_mcps_sap_get_phy_timestamp(rf_ptr), rf_ptr->mac_channel);
#endif
Expand Down

0 comments on commit 587add5

Please sign in to comment.