Skip to content

Commit cd1afb1

Browse files
author
Jarkko Paso
committed
MAC: Fixed aborting active TX when sending Ack
1 parent b0a3c70 commit cd1afb1

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, const m
17401740
rf_ptr->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CSMA_PARAMETERS, (uint8_t *) &csma_params);
17411741
if (rf_ptr->active_pd_data_request) {
17421742
timer_mac_stop(rf_ptr);
1743-
mac_pd_sap_set_phy_tx_time(rf_ptr, 0, false);
1743+
mac_pd_abort_active_tx(rf_ptr);
17441744
}
17451745
return mcps_pd_data_cca_trig(rf_ptr, buffer);
17461746
}

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,20 @@ int8_t mac_pd_sap_req(protocol_interface_rf_mac_setup_s *rf_mac_setup)
199199
}
200200

201201

202+
/**
203+
* Abort active PHY transmission.
204+
*
205+
* \param rf_mac_setup pointer to MAC.
206+
*
207+
*/
208+
void mac_pd_abort_active_tx(protocol_interface_rf_mac_setup_s *rf_mac_setup)
209+
{
210+
phy_csma_params_t csma_params;
211+
// Set TX time to 0 to abort current transmission
212+
csma_params.backoff_time = 0;
213+
rf_mac_setup->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CSMA_PARAMETERS, (uint8_t *) &csma_params);
214+
}
215+
202216
/**
203217
* Set PHY TX time.
204218
*

source/MAC/IEEE802_15_4/mac_pd_sap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ int8_t mac_pd_sap_req(struct protocol_interface_rf_mac_setup *rf_mac_setup);
3939

4040
int8_t mac_plme_cca_req(struct protocol_interface_rf_mac_setup *rf_mac_setup);
4141

42+
void mac_pd_abort_active_tx(struct protocol_interface_rf_mac_setup *rf_mac_setup);
43+
4244
void mac_pd_sap_set_phy_tx_time(struct protocol_interface_rf_mac_setup *rf_mac_setup, uint32_t tx_time, bool cca_enabled);
4345

4446
void mac_pd_sap_rf_low_level_function_set(void *mac_ptr, void *driver);

0 commit comments

Comments
 (0)