@@ -875,9 +875,79 @@ bool test_mac_mcps_data_confirmation()
875875 test_mac_rf_mac_class_free (rf_mac_setup );
876876 return false;
877877 }
878-
879-
880-
878+ // Test full 4 restarts and give up
879+ nsdynmemlib_stub .returnCounter = 3 ;
880+ data_req .TxAckReq = true;
881+ fhss_tx_condition = true;
882+ rf_mac_setup -> tx_failure_restart_max = 4 ;
883+ rf_mac_setup -> dev_driver -> phy_driver -> extension = test_rf_extension ;
884+ rf_mac_setup -> blacklist_min_ms = 20 ;
885+ rf_mac_setup -> blacklist_max_ms = 200 ;
886+ mcps_sap_data_req_handler (rf_mac_setup , & data_req );
887+ for (int i = 0 ; i < 4 ; i ++ ) {
888+ rf_mac_setup -> mac_tx_result = MAC_TX_FAIL ;
889+ mcps_sap_pd_confirm (rf_mac_setup );
890+ if (!rf_mac_setup -> active_pd_data_request ) {
891+ test_mac_rf_mac_class_free (rf_mac_setup );
892+ return false;
893+ }
894+ }
895+ rf_mac_setup -> mac_tx_result = MAC_TX_FAIL ;
896+ mcps_sap_pd_confirm (rf_mac_setup );
897+ if (rf_mac_setup -> active_pd_data_request ) {
898+ test_mac_rf_mac_class_free (rf_mac_setup );
899+ return false;
900+ }
901+ // Test full CCA backoffs and give up
902+ nsdynmemlib_stub .returnCounter = 3 ;
903+ data_req .TxAckReq = true;
904+ fhss_tx_condition = true;
905+ rf_mac_setup -> tx_failure_restart_max = 4 ;
906+ rf_mac_setup -> cca_failure_restart_max = 9 ;
907+ rf_mac_setup -> dev_driver -> phy_driver -> extension = test_rf_extension ;
908+ rf_mac_setup -> blacklist_min_ms = 20 ;
909+ rf_mac_setup -> blacklist_max_ms = 200 ;
910+ mcps_sap_data_req_handler (rf_mac_setup , & data_req );
911+ for (int i = 0 ; i < 9 ; i ++ ) {
912+ rf_mac_setup -> mac_tx_result = MAC_CCA_FAIL ;
913+ mcps_sap_pd_confirm (rf_mac_setup );
914+ if (!rf_mac_setup -> active_pd_data_request ) {
915+ test_mac_rf_mac_class_free (rf_mac_setup );
916+ return false;
917+ }
918+ }
919+ rf_mac_setup -> mac_tx_result = MAC_CCA_FAIL ;
920+ mcps_sap_pd_confirm (rf_mac_setup );
921+ if (rf_mac_setup -> active_pd_data_request ) {
922+ test_mac_rf_mac_class_free (rf_mac_setup );
923+ return false;
924+ }
925+ // Test full CCA backoffs for EF priority and give up
926+ nsdynmemlib_stub .returnCounter = 3 ;
927+ data_req .TxAckReq = true;
928+ fhss_tx_condition = true;
929+ rf_mac_setup -> tx_failure_restart_max = 4 ;
930+ rf_mac_setup -> cca_failure_restart_max = 9 ;
931+ rf_mac_setup -> dev_driver -> phy_driver -> extension = test_rf_extension ;
932+ rf_mac_setup -> blacklist_min_ms = 20 ;
933+ rf_mac_setup -> blacklist_max_ms = 200 ;
934+ mcps_sap_data_req_handler (rf_mac_setup , & data_req );
935+ rf_mac_setup -> active_pd_data_request -> priority = MAC_PD_DATA_EF_PRIORITY ;
936+ rf_mac_setup -> active_pd_data_request -> cca_request_restart_cnt *= MAC_PRIORITY_EF_BACKOFF_MULTIPLIER ;
937+ for (int i = 0 ; i < 9 * MAC_PRIORITY_EF_BACKOFF_MULTIPLIER ; i ++ ) {
938+ rf_mac_setup -> mac_tx_result = MAC_CCA_FAIL ;
939+ mcps_sap_pd_confirm (rf_mac_setup );
940+ if (!rf_mac_setup -> active_pd_data_request ) {
941+ test_mac_rf_mac_class_free (rf_mac_setup );
942+ return false;
943+ }
944+ }
945+ rf_mac_setup -> mac_tx_result = MAC_CCA_FAIL ;
946+ mcps_sap_pd_confirm (rf_mac_setup );
947+ if (rf_mac_setup -> active_pd_data_request ) {
948+ test_mac_rf_mac_class_free (rf_mac_setup );
949+ return false;
950+ }
881951
882952 test_mac_rf_mac_class_free (rf_mac_setup );
883953 return true;
0 commit comments