@@ -60,6 +60,8 @@ static uint8_t chan_map[] = { 0x1F, 0XF1, 0x1F, 0xF1, 0x1F };
6060static bool volatile is_iso_connected ;
6161static uint8_t volatile is_iso_disconnected ;
6262static bool volatile deleting_pa_sync ;
63+
64+ #if !defined(CONFIG_TEST_LL_INTERFACE )
6365static void iso_connected (struct bt_iso_chan * chan );
6466static void iso_disconnected (struct bt_iso_chan * chan , uint8_t reason );
6567static void iso_recv (struct bt_iso_chan * chan ,
@@ -193,6 +195,7 @@ static void iso_send(struct k_work *work)
193195
194196 k_work_schedule (& iso_send_work , K_USEC (9970 ));
195197}
198+ #endif /* !CONFIG_TEST_LL_INTERFACE */
196199
197200static void setup_ext_adv (struct bt_le_ext_adv * * adv )
198201{
@@ -261,7 +264,7 @@ static void teardown_ext_adv(struct bt_le_ext_adv *adv)
261264 printk ("success.\n" );
262265}
263266
264- #if TEST_LL_INTERFACE
267+ #if defined( CONFIG_TEST_LL_INTERFACE )
265268static void create_ll_big (uint8_t big_handle , struct bt_le_ext_adv * adv )
266269{
267270 uint16_t max_sdu = CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX ;
@@ -303,8 +306,8 @@ static void terminate_ll_big(uint8_t big_handle)
303306 }
304307 printk ("success.\n" );
305308}
306- #endif /* TEST_LL_INTERFACE */
307309
310+ #else /* !CONFIG_TEST_LL_INTERFACE */
308311static void create_big (struct bt_le_ext_adv * adv , struct bt_iso_big * * big )
309312{
310313 struct bt_iso_big_create_param big_create_param = { 0 };
@@ -337,6 +340,26 @@ static void create_big(struct bt_le_ext_adv *adv, struct bt_iso_big **big)
337340 printk ("ISO connected\n" );
338341}
339342
343+ static void terminate_big (struct bt_iso_big * big )
344+ {
345+ int err ;
346+
347+ printk ("Terminating BIG...\n" );
348+ err = bt_iso_big_terminate (big );
349+ if (err ) {
350+ FAIL ("Could not terminate BIG: %d\n" , err );
351+ return ;
352+ }
353+ printk ("success.\n" );
354+
355+ printk ("Wait for ISO disconnected callback..." );
356+ while (is_iso_disconnected == 0U ) {
357+ k_sleep (K_MSEC (100 ));
358+ }
359+ printk ("ISO disconnected\n" );
360+ }
361+ #endif /* !CONFIG_TEST_LL_INTERFACE */
362+
340363#if defined(CONFIG_BT_ISO_TEST_PARAMS )
341364static void create_advanced_big (struct bt_le_ext_adv * adv , struct bt_iso_big * * big )
342365{
@@ -378,29 +401,9 @@ static void create_advanced_big(struct bt_le_ext_adv *adv, struct bt_iso_big **b
378401}
379402#endif /* CONFIG_BT_ISO_TEST_PARAMS */
380403
381- static void terminate_big (struct bt_iso_big * big )
382- {
383- int err ;
384-
385- printk ("Terminating BIG...\n" );
386- err = bt_iso_big_terminate (big );
387- if (err ) {
388- FAIL ("Could not terminate BIG: %d\n" , err );
389- return ;
390- }
391- printk ("success.\n" );
392-
393- printk ("Wait for ISO disconnected callback..." );
394- while (is_iso_disconnected == 0U ) {
395- k_sleep (K_MSEC (100 ));
396- }
397- printk ("ISO disconnected\n" );
398- }
399-
400404static void test_iso_main (void )
401405{
402406 struct bt_le_ext_adv * adv ;
403- struct bt_iso_big * big ;
404407 int err ;
405408
406409 printk ("\n*ISO broadcast test*\n" );
@@ -415,16 +418,19 @@ static void test_iso_main(void)
415418
416419 setup_ext_adv (& adv );
417420
418- #if TEST_LL_INTERFACE
421+ #if defined( CONFIG_TEST_LL_INTERFACE )
419422 uint8_t big_handle = 0 ;
420423
421424 create_ll_big (big_handle , adv );
422- #endif
425+
426+ #else /* !CONFIG_TEST_LL_INTERFACE */
427+ struct bt_iso_big * big ;
423428
424429 create_big (adv , & big );
425430
426431 k_work_init_delayable (& iso_send_work , iso_send );
427432 k_work_schedule (& iso_send_work , K_NO_WAIT );
433+ #endif /* !CONFIG_TEST_LL_INTERFACE */
428434
429435 k_sleep (K_MSEC (5000 ));
430436
@@ -459,11 +465,11 @@ static void test_iso_main(void)
459465
460466 k_sleep (K_MSEC (5000 ));
461467
462- k_work_cancel_delayable (& iso_send_work );
463-
464- #if TEST_LL_INTERFACE
468+ #if defined(CONFIG_TEST_LL_INTERFACE )
465469 terminate_ll_big (big_handle );
466- #endif
470+
471+ #else /* !CONFIG_TEST_LL_INTERFACE */
472+ k_work_cancel_delayable (& iso_send_work );
467473
468474 terminate_big (big );
469475 big = NULL ;
@@ -477,6 +483,7 @@ static void test_iso_main(void)
477483 terminate_big (big );
478484 big = NULL ;
479485#endif /* CONFIG_BT_ISO_TEST_PARAMS */
486+ #endif /* !CONFIG_TEST_LL_INTERFACE */
480487
481488 k_sleep (K_MSEC (10000 ));
482489
@@ -499,6 +506,7 @@ static const char *phy2str(uint8_t phy)
499506 }
500507}
501508
509+ #if !defined(CONFIG_TEST_LL_INTERFACE )
502510/** Print data as d_0 d_1 d_2 ... d_(n-2) d_(n-1) d_(n) to show the 3 first and 3 last octets
503511 *
504512 * Examples:
@@ -585,6 +593,7 @@ static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason)
585593
586594 is_iso_disconnected = reason ;
587595}
596+ #endif /* !CONFIG_TEST_LL_INTERFACE */
588597
589598static bool volatile is_sync ;
590599
@@ -819,18 +828,17 @@ static void test_iso_recv_main(void)
819828 }
820829 printk ("success.\n" );
821830
822- #if TEST_LL_INTERFACE
823- printk ("Creating BIG Sync..." );
831+ #if defined(CONFIG_TEST_LL_INTERFACE )
824832 uint8_t bcode [BT_ISO_BROADCAST_CODE_SIZE ] = { 0 };
825833 uint16_t sync_timeout = 10 ;
834+ uint8_t bis [1 ] = { 0x01 , };
826835 uint8_t big_handle = 0 ;
827- uint8_t bis_handle = 0 ;
828836 uint8_t encryption = 0 ;
829- uint8_t bis_count = 1 ; /* TODO: Add support for multiple BIS per BIG */
830837 uint8_t mse = 0 ;
831838
839+ printk ("Creating BIG Sync..." );
832840 err = ll_big_sync_create (big_handle , sync -> handle , encryption , bcode ,
833- mse , sync_timeout , bis_count , & bis_handle );
841+ mse , sync_timeout , ARRAY_SIZE ( bis ), bis );
834842 if (err ) {
835843 FAIL ("Could not create BIG sync: %d\n" , err );
836844 return ;
@@ -839,16 +847,6 @@ static void test_iso_recv_main(void)
839847
840848 k_sleep (K_MSEC (5000 ));
841849
842- printk ("Deleting Periodic Advertising Sync..." );
843- deleting_pa_sync = true;
844- err = bt_le_per_adv_sync_delete (sync );
845- if (err ) {
846- FAIL ("Failed to delete periodic advertising sync (err %d)\n" ,
847- err );
848- return ;
849- }
850- printk ("success.\n" );
851-
852850 printk ("Terminating BIG Sync..." );
853851 struct node_rx_pdu * node_rx = NULL ;
854852 err = ll_big_sync_terminate (big_handle , (void * * )& node_rx );
@@ -866,7 +864,7 @@ static void test_iso_recv_main(void)
866864
867865 printk ("Creating BIG Sync after terminate..." );
868866 err = ll_big_sync_create (big_handle , sync -> handle , encryption , bcode ,
869- mse , sync_timeout , bis_count , & bis_handle );
867+ mse , sync_timeout , ARRAY_SIZE ( bis ), bis );
870868 if (err ) {
871869 FAIL ("Could not create BIG sync: %d\n" , err );
872870 return ;
@@ -886,7 +884,18 @@ static void test_iso_recv_main(void)
886884 node_rx -> hdr .next = NULL ;
887885 ll_rx_mem_release ((void * * )& node_rx );
888886 }
889- #else
887+
888+ printk ("Deleting Periodic Advertising Sync..." );
889+ deleting_pa_sync = true;
890+ err = bt_le_per_adv_sync_delete (sync );
891+ if (err ) {
892+ FAIL ("Failed to delete periodic advertising sync (err %d)\n" ,
893+ err );
894+ return ;
895+ }
896+ printk ("success.\n" );
897+
898+ #else /* !CONFIG_TEST_LL_INTERFACE */
890899 struct bt_iso_big_sync_param big_param = { 0 , };
891900 struct bt_iso_big * big ;
892901
@@ -998,7 +1007,6 @@ static void test_iso_recv_main(void)
9981007 return ;
9991008 }
10001009 printk ("success.\n" );
1001- #endif
10021010
10031011 for (int chan = 0 ; chan < CONFIG_BT_ISO_MAX_CHAN ; chan ++ ) {
10041012 if (expected_seq_num [chan ] < SEQ_NUM_MAX ) {
@@ -1007,6 +1015,7 @@ static void test_iso_recv_main(void)
10071015 return ;
10081016 }
10091017 }
1018+ #endif /* !CONFIG_TEST_LL_INTERFACE */
10101019
10111020 PASS ("ISO recv test Passed\n" );
10121021
0 commit comments