@@ -1053,6 +1053,14 @@ static void mac_data_interface_frame_handler(mac_pre_parsed_frame_t *buf)
10531053
10541054}
10551055
1056+ static void mac_mcps_asynch_finish (protocol_interface_rf_mac_setup_s * rf_mac_setup , mac_pre_build_frame_t * buffer )
1057+ {
1058+ if (buffer -> asynch_request && rf_mac_setup -> fhss_api ) {
1059+ // Must return to scheduled channel after asynch process by calling TX done
1060+ rf_mac_setup -> fhss_api -> data_tx_done (rf_mac_setup -> fhss_api , false, true, buffer -> msduHandle );
1061+ }
1062+ }
1063+
10561064void mac_mcps_trig_buffer_from_queue (protocol_interface_rf_mac_setup_s * rf_mac_setup )
10571065{
10581066 if (!rf_mac_setup ) {
@@ -1075,6 +1083,7 @@ void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_s
10751083 mac_data_request_init (rf_mac_setup , buffer );
10761084 if (mcps_pd_data_request (rf_mac_setup , buffer ) != 0 ) {
10771085 rf_mac_setup -> active_pd_data_request = NULL ;
1086+ mac_mcps_asynch_finish (rf_mac_setup , buffer );
10781087 mcps_data_confirm_handle (rf_mac_setup , buffer , NULL );
10791088 } else {
10801089 return ;
@@ -1120,14 +1129,12 @@ static void mac_pd_data_confirm_handle(protocol_interface_rf_mac_setup_s *rf_mac
11201129 mac_pre_build_frame_t * buffer = rf_mac_setup -> active_pd_data_request ;
11211130 if (mac_data_request_confirmation_finnish (rf_mac_setup , buffer ) ) {
11221131 rf_mac_setup -> active_pd_data_request = NULL ;
1123- if (buffer -> asynch_request && rf_mac_setup -> fhss_api ) {
1124- // Must return to scheduled channel after asynch process by calling TX done
1125- rf_mac_setup -> fhss_api -> data_tx_done (rf_mac_setup -> fhss_api , false, true, buffer -> msduHandle );
1126- }
1132+ mac_mcps_asynch_finish (rf_mac_setup , buffer );
11271133 mcps_data_confirm_handle (rf_mac_setup , buffer , NULL );
11281134 } else {
11291135 if (mcps_pd_data_request (rf_mac_setup , buffer ) != 0 ) {
11301136 rf_mac_setup -> active_pd_data_request = NULL ;
1137+ mac_mcps_asynch_finish (rf_mac_setup , buffer );
11311138 mcps_data_confirm_handle (rf_mac_setup , buffer , NULL );
11321139 } else {
11331140 return ;
@@ -1155,10 +1162,6 @@ static void mac_pd_data_ack_handler(mac_pre_parsed_frame_t *buf) {
11551162 }
11561163
11571164 rf_mac_setup -> active_pd_data_request = NULL ;
1158- if (buffer -> asynch_request && rf_mac_setup -> fhss_api ) {
1159- // Must return to scheduled channel after asynch process by calling TX done
1160- rf_mac_setup -> fhss_api -> data_tx_done (rf_mac_setup -> fhss_api , false, true, buffer -> msduHandle );
1161- }
11621165 mcps_data_confirm_handle (rf_mac_setup , buffer , buf );
11631166 mcps_sap_pre_parsed_frame_buffer_free (buf );
11641167
@@ -1423,7 +1426,7 @@ static void mcps_data_confirm_handle(protocol_interface_rf_mac_setup_s *rf_ptr,
14231426 sw_mac_stats_update (rf_ptr , STAT_MAC_TX_CCA_ATT , rf_ptr -> mac_tx_status .cca_cnt );
14241427 sw_mac_stats_update (rf_ptr , STAT_MAC_TX_RETRY , rf_ptr -> mac_tx_status .retry );
14251428 mcps_data_conf_t confirm ;
1426- if (rf_ptr -> fhss_api ) {
1429+ if (rf_ptr -> fhss_api && ! buffer -> asynch_request ) {
14271430 // FHSS checks if this failed buffer needs to be pushed back to TX queue and retransmitted
14281431 if ((rf_ptr -> mac_tx_result == MAC_TX_FAIL ) || (rf_ptr -> mac_tx_result == MAC_CCA_FAIL )) {
14291432 if (rf_ptr -> fhss_api -> data_tx_fail (rf_ptr -> fhss_api , buffer -> msduHandle , mac_convert_frame_type_to_fhss (buffer -> fcf_dsn .frametype )) == true) {
@@ -1989,7 +1992,7 @@ static mac_pre_build_frame_t * mcps_sap_pd_req_queue_read(protocol_interface_rf_
19891992 // With FHSS, check TX conditions
19901993 if (rf_mac_setup -> fhss_api ) {
19911994 while (buffer ) {
1992- if ((flush == true) || (rf_mac_setup -> fhss_api -> check_tx_conditions (rf_mac_setup -> fhss_api , !mac_is_ack_request_set (buffer ),
1995+ if (buffer -> asynch_request || (flush == true) || (rf_mac_setup -> fhss_api -> check_tx_conditions (rf_mac_setup -> fhss_api , !mac_is_ack_request_set (buffer ),
19931996 buffer -> msduHandle , mac_convert_frame_type_to_fhss (buffer -> fcf_dsn .frametype ), buffer -> mac_payload_length ,
19941997 rf_mac_setup -> dev_driver -> phy_driver -> phy_header_length , rf_mac_setup -> dev_driver -> phy_driver -> phy_tail_length ) == true)) {
19951998 break ;
0 commit comments