@@ -261,6 +261,19 @@ static protocol_interface_rf_mac_setup_s * test_mac_rf_mac_class_allocate(void)
261
261
return rf_mac_setup ;
262
262
}
263
263
264
+ static int fhss_tx_handle_callback (const fhss_api_t * api , bool is_broadcast_addr , uint8_t * destination_address , int frame_type , uint16_t frame_length , uint8_t phy_header_length , uint8_t phy_tail_length )
265
+ {
266
+ return 0 ;
267
+ }
268
+ static bool fhss_tx_condition = true;
269
+ static bool fhss_check_tx_conditions_callback (const fhss_api_t * api , bool is_broadcast_addr , uint8_t handle , int frame_type , uint16_t frame_length , uint8_t phy_header_length , uint8_t phy_tail_length )
270
+ {
271
+ if (frame_type == FHSS_SYNCH_REQUEST_FRAME ) {
272
+ return false;
273
+ }
274
+ return fhss_tx_condition ;
275
+ }
276
+
264
277
static uint8_t expect_data_confirmation_status = 0 ;
265
278
static bool data_confirm_valid = false;
266
279
@@ -447,7 +460,7 @@ bool test_mcps_sap_trig_tx()
447
460
448
461
// FHSS is on broadcast channel and tx conditions are fine
449
462
fhss_mac_interface_stub .channel_bool_value = true;
450
- fhss_mac_interface_stub . cond_bool_value = true;
463
+ fhss_tx_condition = true;
451
464
452
465
mcps_sap_trig_tx (rf_mac_setup );
453
466
// Active data request should be buf
@@ -775,7 +788,7 @@ bool test_mac_mcps_data_confirmation()
775
788
rf_mac_setup -> fhss_api = ns_fhss_create (0 , 0 );
776
789
nsdynmemlib_stub .returnCounter = 3 ;
777
790
data_req .TxAckReq = true;
778
- fhss_mac_interface_stub . cond_bool_value = true;
791
+ fhss_tx_condition = true;
779
792
mcps_sap_data_req_handler (rf_mac_setup , & data_req );
780
793
rf_mac_setup -> mac_tx_result = MAC_TX_FAIL ;
781
794
mcps_sap_pd_confirm (rf_mac_setup );
@@ -1865,7 +1878,7 @@ bool test_mac_mcps_data_indication()
1865
1878
buffer -> mac_class_ptr = rf_mac_setup ;
1866
1879
mcps_sap_pd_ind (buffer );
1867
1880
if (start_value != (fhss_mac_interface_stub .int8_value - 1 )) {
1868
- return false;
1881
+ return false;
1869
1882
}
1870
1883
1871
1884
test_mac_rf_mac_class_free (rf_mac_setup );
@@ -2009,7 +2022,7 @@ bool test_mcps_sap_pd_req_queue_write()
2009
2022
2010
2023
// Buffer has broadcast destination and TX conditions are fine
2011
2024
buffer -> fcf_dsn .ackRequested = false;
2012
- fhss_mac_interface_stub . cond_bool_value = true;
2025
+ fhss_tx_condition = true;
2013
2026
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
2014
2027
// Should be sent immediately
2015
2028
if (rf_mac_setup -> active_pd_data_request != buffer ) {
@@ -2022,7 +2035,7 @@ bool test_mcps_sap_pd_req_queue_write()
2022
2035
2023
2036
// Buffer has broadcast destination and TX conditions are bad
2024
2037
buffer -> fcf_dsn .ackRequested = false;
2025
- fhss_mac_interface_stub . cond_bool_value = false;
2038
+ fhss_tx_condition = false;
2026
2039
fhss_mac_interface_stub .queue_bool_value = true;
2027
2040
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
2028
2041
// Should be first in BC queue, one buffer in a bc queue
@@ -2036,7 +2049,7 @@ bool test_mcps_sap_pd_req_queue_write()
2036
2049
2037
2050
// Buffer has broadcast destination and TX conditions are bad
2038
2051
buffer -> fcf_dsn .ackRequested = false;
2039
- fhss_mac_interface_stub . cond_bool_value = false;
2052
+ fhss_tx_condition = false;
2040
2053
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
2041
2054
// Should be second in BC queue, two buffers in a bc queue
2042
2055
if ((rf_mac_setup -> pd_data_request_bc_queue_to_go -> next != buffer ) || (rf_mac_setup -> broadcast_queue_size != 2 )) {
@@ -2049,7 +2062,7 @@ bool test_mcps_sap_pd_req_queue_write()
2049
2062
2050
2063
// Buffer has broadcast destination and TX conditions are bad
2051
2064
buffer -> fcf_dsn .ackRequested = false;
2052
- fhss_mac_interface_stub . cond_bool_value = false;
2065
+ fhss_tx_condition = false;
2053
2066
// Higher priority for this buffer
2054
2067
buffer -> priority = 2 ;
2055
2068
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
@@ -2064,7 +2077,7 @@ bool test_mcps_sap_pd_req_queue_write()
2064
2077
2065
2078
// Buffer has unicast destination and TX conditions are bad
2066
2079
buffer -> fcf_dsn .ackRequested = true;
2067
- fhss_mac_interface_stub . cond_bool_value = false;
2080
+ fhss_tx_condition = false;
2068
2081
fhss_mac_interface_stub .queue_bool_value = false;
2069
2082
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
2070
2083
// Should be first in a UC queue, 1 buffer in a uc queue
@@ -2080,7 +2093,7 @@ bool test_mcps_sap_pd_req_queue_write()
2080
2093
2081
2094
// Buffer has broadcast destination and TX conditions are bad
2082
2095
buffer -> fcf_dsn .ackRequested = false;
2083
- fhss_mac_interface_stub . cond_bool_value = false;
2096
+ fhss_tx_condition = false;
2084
2097
// Beacon request should go to unicast queue
2085
2098
buffer -> fcf_dsn .frametype = FC_CMD_FRAME ;
2086
2099
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
@@ -2102,7 +2115,7 @@ bool test_mcps_sap_pd_req_queue_write()
2102
2115
mcps_sap_pd_req_queue_write (rf_mac_setup , buffer );
2103
2116
// Should be first in a BC queue, 1 buffer in a BC queue
2104
2117
if ((rf_mac_setup -> pd_data_request_bc_queue_to_go != buffer ) || (rf_mac_setup -> broadcast_queue_size != 1 )) {
2105
- return false;
2118
+ return false;
2106
2119
}
2107
2120
2108
2121
mac_mcps_buffer_queue_free (rf_mac_setup );
@@ -2697,15 +2710,17 @@ bool test_mac_mcps_trig_buffer_from_queue()
2697
2710
}
2698
2711
mac_mcps_buffer_queue_free (rf_mac_setup );
2699
2712
2700
- // FHSS TESTS START
2713
+ // FHSS TESTS START
2701
2714
rf_mac_setup -> fhss_api = ns_fhss_create (0 , 0 );
2715
+ fhss_config_stub .fhss_api_ptr .tx_handle = & fhss_tx_handle_callback ;
2716
+ fhss_config_stub .fhss_api_ptr .check_tx_conditions = & fhss_check_tx_conditions_callback ;
2702
2717
buf = tes_mac_mcps_temporary_buffer_get (0 );
2703
2718
rf_mac_setup -> pd_data_request_bc_queue_to_go = buf ;
2704
2719
rf_mac_setup -> broadcast_queue_size = 1 ;
2705
2720
2706
2721
// FHSS is not on broadcast channel and tx conditions are fine
2707
2722
fhss_mac_interface_stub .channel_bool_value = false;
2708
- fhss_mac_interface_stub . cond_bool_value = true;
2723
+ fhss_tx_condition = true;
2709
2724
mac_mcps_trig_buffer_from_queue (rf_mac_setup );
2710
2725
if (!rf_mac_setup -> pd_data_request_bc_queue_to_go ) {
2711
2726
test_mac_rf_mac_class_free (rf_mac_setup );
@@ -2714,7 +2729,7 @@ bool test_mac_mcps_trig_buffer_from_queue()
2714
2729
2715
2730
// FHSS is on broadcast channel and tx conditions are bad
2716
2731
fhss_mac_interface_stub .channel_bool_value = true;
2717
- fhss_mac_interface_stub . cond_bool_value = false;
2732
+ fhss_tx_condition = false;
2718
2733
mac_mcps_trig_buffer_from_queue (rf_mac_setup );
2719
2734
if (!rf_mac_setup -> pd_data_request_bc_queue_to_go ) {
2720
2735
test_mac_rf_mac_class_free (rf_mac_setup );
@@ -2723,7 +2738,7 @@ bool test_mac_mcps_trig_buffer_from_queue()
2723
2738
2724
2739
// FHSS is on broadcast channel and tx conditions are fine
2725
2740
fhss_mac_interface_stub .channel_bool_value = true;
2726
- fhss_mac_interface_stub . cond_bool_value = true;
2741
+ fhss_tx_condition = true;
2727
2742
mac_mcps_trig_buffer_from_queue (rf_mac_setup );
2728
2743
if (!rf_mac_setup -> active_pd_data_request || rf_mac_setup -> pd_data_request_bc_queue_to_go || rf_mac_setup -> broadcast_queue_size ) {
2729
2744
test_mac_rf_mac_class_free (rf_mac_setup );
@@ -2741,7 +2756,7 @@ bool test_mac_mcps_trig_buffer_from_queue()
2741
2756
rf_mac_setup -> pd_data_request_queue_to_go -> next = buf2 ;
2742
2757
rf_mac_setup -> unicast_queue_size = 2 ;
2743
2758
fhss_mac_interface_stub .channel_bool_value = false;
2744
- fhss_mac_interface_stub . cond_bool_value = true;
2759
+ fhss_tx_condition = true;
2745
2760
// Should trig second packet from queue
2746
2761
mac_mcps_trig_buffer_from_queue (rf_mac_setup );
2747
2762
// First packet should still be the Beacon request
@@ -2750,7 +2765,7 @@ bool test_mac_mcps_trig_buffer_from_queue()
2750
2765
return false;
2751
2766
}
2752
2767
mac_mcps_buffer_queue_free (rf_mac_setup );
2753
- // Free test setup struct
2768
+ // Free test setup struct
2754
2769
test_mac_rf_mac_class_free (rf_mac_setup );
2755
2770
return true;
2756
2771
}
0 commit comments