Skip to content

Commit

Permalink
Created validate TX time handler (ARMmbed#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso authored Aug 20, 2020
1 parent 022d61f commit 5752eae
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions source/MAC/IEEE802_15_4/mac_pd_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 5752eae

Please sign in to comment.