Skip to content

Commit

Permalink
MAC: Fixed aborting active TX when sending Ack
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso committed Feb 25, 2019
1 parent b0a3c70 commit cd1afb1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/MAC/IEEE802_15_4/mac_mcps_sap.c
Expand Up @@ -1740,7 +1740,7 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, const m
rf_ptr->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CSMA_PARAMETERS, (uint8_t *) &csma_params);
if (rf_ptr->active_pd_data_request) {
timer_mac_stop(rf_ptr);
mac_pd_sap_set_phy_tx_time(rf_ptr, 0, false);
mac_pd_abort_active_tx(rf_ptr);
}
return mcps_pd_data_cca_trig(rf_ptr, buffer);
}
Expand Down
14 changes: 14 additions & 0 deletions source/MAC/IEEE802_15_4/mac_pd_sap.c
Expand Up @@ -199,6 +199,20 @@ int8_t mac_pd_sap_req(protocol_interface_rf_mac_setup_s *rf_mac_setup)
}


/**
* Abort active PHY transmission.
*
* \param rf_mac_setup pointer to MAC.
*
*/
void mac_pd_abort_active_tx(protocol_interface_rf_mac_setup_s *rf_mac_setup)
{
phy_csma_params_t csma_params;
// Set TX time to 0 to abort current transmission
csma_params.backoff_time = 0;
rf_mac_setup->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CSMA_PARAMETERS, (uint8_t *) &csma_params);
}

/**
* Set PHY TX time.
*
Expand Down
2 changes: 2 additions & 0 deletions source/MAC/IEEE802_15_4/mac_pd_sap.h
Expand Up @@ -39,6 +39,8 @@ int8_t mac_pd_sap_req(struct protocol_interface_rf_mac_setup *rf_mac_setup);

int8_t mac_plme_cca_req(struct protocol_interface_rf_mac_setup *rf_mac_setup);

void mac_pd_abort_active_tx(struct protocol_interface_rf_mac_setup *rf_mac_setup);

void mac_pd_sap_set_phy_tx_time(struct protocol_interface_rf_mac_setup *rf_mac_setup, uint32_t tx_time, bool cca_enabled);

void mac_pd_sap_rf_low_level_function_set(void *mac_ptr, void *driver);
Expand Down

0 comments on commit cd1afb1

Please sign in to comment.