diff --git a/source/MAC/IEEE802_15_4/mac_pd_sap.c b/source/MAC/IEEE802_15_4/mac_pd_sap.c index 799205ceb0e2..b8cf81447ad2 100644 --- a/source/MAC/IEEE802_15_4/mac_pd_sap.c +++ b/source/MAC/IEEE802_15_4/mac_pd_sap.c @@ -456,10 +456,7 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r if (rf_ptr->mac_ack_tx_active) { //Accept direct non crypted acks and crypted only if neighbor is at list if (rf_ptr->ack_tx_possible) { -#ifdef TIMING_TOOL_TRACES - tr_info("%u TX_start %u", mac_mcps_sap_get_phy_timestamp(rf_ptr), rf_ptr->mac_channel); -#endif - return PHY_TX_ALLOWED; + goto VALIDATE_TX_TIME; } //Compare time to started time @@ -471,19 +468,16 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r } if (rf_ptr->mac_edfe_tx_active) { - return PHY_TX_ALLOWED; + goto VALIDATE_TX_TIME; } if (mac_data_asynch_channel_switch(rf_ptr, rf_ptr->active_pd_data_request)) { -#ifdef TIMING_TOOL_TRACES - tr_info("%u TX_start %u", mac_mcps_sap_get_phy_timestamp(rf_ptr), rf_ptr->mac_channel); -#endif rf_ptr->active_pd_data_request->initial_tx_channel = rf_ptr->mac_channel; int8_t channel_cca_threshold = mac_cca_thr_get_dbm(rf_ptr, rf_ptr->mac_channel); if (CCA_FAILED_DBM != channel_cca_threshold) { rf_ptr->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD, (uint8_t *)&channel_cca_threshold); } - return PHY_TX_ALLOWED; + goto VALIDATE_TX_TIME; } if (rf_ptr->fhss_api) { @@ -525,10 +519,12 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r return PHY_RESTART_CSMA; } } +VALIDATE_TX_TIME: +// TODO: Validate TX time here #ifdef TIMING_TOOL_TRACES tr_info("%u TX_start %u", mac_mcps_sap_get_phy_timestamp(rf_ptr), rf_ptr->mac_channel); #endif - return 0; + return PHY_TX_ALLOWED; } if (rf_ptr->mac_ack_tx_active) {