@@ -138,6 +138,11 @@ static fhss_api_t *test_generate_fhss_api(void)
138
138
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_broadcast_interval = 1000 ;
139
139
fhss_common_stub .fhss_struct .ws -> get_neighbor_info = & app_get_neighbor_info ;
140
140
fhss_common_stub .fhss_struct .number_of_channels = 50 ;
141
+ fhss_common_stub .fhss_struct .number_of_uc_channels = 50 ;
142
+ fhss_common_stub .fhss_struct .ws -> fhss_configuration .unicast_channel_mask [1 ] = 0x0003ffff ;
143
+ fhss_common_stub .fhss_struct .ws -> fhss_configuration .unicast_channel_mask [0 ] = 0xffffffff ;
144
+ fhss_common_stub .fhss_struct .ws -> fhss_configuration .channel_mask [1 ] = 0x0003ffff ;
145
+ fhss_common_stub .fhss_struct .ws -> fhss_configuration .channel_mask [0 ] = 0xffffffff ;
141
146
fhss_common_stub .fhss_struct .rx_channel = DEFAULT_CHANNEL ;
142
147
fhss_common_stub .fhss_struct .fhss_state = FHSS_UNSYNCHRONIZED ;
143
148
fhss_common_stub .fhss_struct .own_hop = 0xff ;
@@ -273,6 +278,7 @@ bool test_fhss_ws_tx_handle_callback()
273
278
memset (& neighbor_info , 0 , sizeof (fhss_ws_neighbor_timing_info_t ));
274
279
// Test direct hash channel function
275
280
neighbor_info .uc_timing_info .unicast_channel_function = WS_DH1CF ;
281
+ neighbor_info .uc_timing_info .unicast_number_of_channels = fhss_common_stub .fhss_struct .number_of_channels ;
276
282
if (fhss_common_stub .fhss_struct .fhss_api -> tx_handle (api , DEFAULT_IS_BC_DEST , dest_address , DEFAULT_FRAME_TYPE , DEFAULT_FRAME_LENGTH , DEFAULT_PHY_HEAD_LENGTH , DEFAULT_PHY_TAIL_LENGTH , DEFAULT_TX_TIME ) != 0 ) {
277
283
return false;
278
284
}
@@ -332,6 +338,7 @@ bool test_fhss_ws_check_tx_conditions_callback()
332
338
fhss_common_stub .fhss_struct .own_hop = 0 ;
333
339
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_broadcast_interval = 800 ;
334
340
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_bc_dwell_interval = 200 ;
341
+ fhss_common_stub .fhss_struct .ws -> txrx_slot_length_ms = 100 ;
335
342
fhss_platform_stub .remaining_slots_value = 550000 ;
336
343
if (fhss_common_stub .fhss_struct .fhss_api -> check_tx_conditions (api , DEFAULT_IS_BC_DEST , DEFAULT_HANDLE , DEFAULT_FRAME_TYPE , DEFAULT_FRAME_LENGTH , DEFAULT_PHY_HEAD_LENGTH , DEFAULT_PHY_TAIL_LENGTH ) != true) {
337
344
return false;
@@ -356,6 +363,7 @@ bool test_fhss_ws_check_tx_conditions_callback()
356
363
fhss_common_stub .fhss_struct .own_hop = 2 ;
357
364
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_broadcast_interval = 1000 ;
358
365
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_bc_dwell_interval = 250 ;
366
+ fhss_common_stub .fhss_struct .ws -> txrx_slot_length_ms = 125 ;
359
367
fhss_platform_stub .remaining_slots_value = 700000 ;
360
368
if (fhss_common_stub .fhss_struct .fhss_api -> check_tx_conditions (api , DEFAULT_IS_BC_DEST , DEFAULT_HANDLE , DEFAULT_FRAME_TYPE , DEFAULT_FRAME_LENGTH , DEFAULT_PHY_HEAD_LENGTH , DEFAULT_PHY_TAIL_LENGTH ) != true) {
361
369
return false;
@@ -398,6 +406,7 @@ bool test_fhss_ws_data_tx_done_callback()
398
406
bool test_fhss_ws_data_tx_fail_callback ()
399
407
{
400
408
fhss_api_t * api = test_generate_fhss_api ();
409
+ fhss_common_stub .fhss_struct .ws -> fhss_configuration .config_parameters .number_of_channel_retries = 4 ;
401
410
// Test when FHSS struct not found
402
411
disable_fhss_struct ();
403
412
if (fhss_common_stub .fhss_struct .fhss_api -> data_tx_fail (api , DEFAULT_HANDLE , DEFAULT_FRAME_TYPE , DEFAULT_BAD_CHANNEL ) != false) {
@@ -457,6 +466,7 @@ bool test_fhss_ws_write_synch_info_callback()
457
466
fhss_api_t * api = test_generate_fhss_api ();
458
467
fhss_common_stub .fhss_struct .ws -> fhss_configuration .ws_uc_channel_function = WS_TR51CF ;
459
468
fhss_common_stub .fhss_struct .rx_channel = 0 ;
469
+ fhss_common_stub .fhss_struct .ws -> unicast_timer_running = true;
460
470
uint8_t synch_info [100 ] = {0x05 , 0x15 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x05 , 0x15 , 0x01 , 0x04 , 0x00 , 0x00 , 0x00 , 0x00 , 0x3f };
461
471
// Test when FHSS struct not found
462
472
disable_fhss_struct ();
@@ -556,12 +566,13 @@ bool test_fhss_ws_get_retry_period_callback()
556
566
// Test when own hop not set
557
567
fhss_common_stub .fhss_struct .ws -> is_on_bc_channel = false;
558
568
fhss_common_stub .fhss_struct .own_hop = 0xff ;
559
- if (fhss_common_stub .fhss_struct .fhss_api -> get_retry_period (api , NULL , 0 ) != 0 ) {
569
+ if (fhss_common_stub .fhss_struct .fhss_api -> get_retry_period (api , NULL , 0 ) != 100000 ) {
560
570
return false;
561
571
}
562
572
// Test when on broadcast channel
563
573
fhss_common_stub .fhss_struct .ws -> is_on_bc_channel = true;
564
574
fhss_common_stub .fhss_struct .own_hop = 1 ;
575
+ fhss_common_stub .fhss_struct .ws -> broadcast_timer_running = true;
565
576
if (fhss_common_stub .fhss_struct .fhss_api -> get_retry_period (api , NULL , 0 ) != 0 ) {
566
577
return false;
567
578
}
@@ -655,7 +666,7 @@ bool test_fhss_ws_update_uc_channel_callback()
655
666
// We do not want to start broadcast timer
656
667
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_bc_dwell_interval = 0 ;
657
668
fhss_common_stub .fhss_struct .ws -> fhss_configuration .fhss_broadcast_interval = 0 ;
658
- fhss_common_stub .fhss_struct .ws -> uc_slot = fhss_common_stub .fhss_struct .number_of_channels - 1 ;
669
+ fhss_common_stub .fhss_struct .ws -> uc_slot = fhss_common_stub .fhss_struct .number_of_uc_channels - 1 ;
659
670
660
671
// Test fixed channel
661
672
enable_fhss_struct ();
0 commit comments