23
23
#include "lll/lll_adv_types.h"
24
24
#include "lll_adv.h"
25
25
#include "lll/lll_adv_pdu.h"
26
+ #include "lll/lll_adv_internal.h"
26
27
#include "lll_adv_sync.h"
27
28
#include "lll/lll_df_types.h"
28
29
@@ -62,9 +63,7 @@ void test_add_number_of_cte_to_sigle_pdu_chain(void)
62
63
/* Validate result */
63
64
common_validate_chain_with_cte (adv , TEST_CTE_COUNT , TEST_PER_ADV_SINGLE_PDU );
64
65
65
- /* Teardown */
66
- common_release_per_adv_chain (adv );
67
- common_release_adv_set (adv );
66
+ common_teardown (adv );
68
67
}
69
68
70
69
void test_add_cte_for_each_pdu_in_chain (void )
@@ -90,9 +89,7 @@ void test_add_cte_for_each_pdu_in_chain(void)
90
89
/* Validate result */
91
90
common_validate_chain_with_cte (adv , TEST_CTE_COUNT , TEST_CTE_COUNT );
92
91
93
- /* Teardown */
94
- common_release_per_adv_chain (adv );
95
- common_release_adv_set (adv );
92
+ common_teardown (adv );
96
93
}
97
94
98
95
void test_add_cte_for_not_all_pdu_in_chain (void )
@@ -118,9 +115,44 @@ void test_add_cte_for_not_all_pdu_in_chain(void)
118
115
/* Validate result */
119
116
common_validate_chain_with_cte (adv , TEST_CTE_COUNT , TEST_PER_ADV_CHAIN_LENGTH );
120
117
121
- /* Teardown */
122
- common_release_per_adv_chain (adv );
123
- common_release_adv_set (adv );
118
+ common_teardown (adv );
119
+ }
120
+
121
+ void test_add_cte_to_not_all_pdus_in_chain_enqueued_to_lll (void )
122
+ {
123
+ struct pdu_adv * pdu_prev , * pdu_new ;
124
+ struct ll_adv_set * adv ;
125
+ uint8_t handle ;
126
+ uint8_t upd ;
127
+ int err ;
128
+
129
+ /* Setup for test */
130
+ adv = common_create_adv_set (TEST_ADV_SET_HANDLE );
131
+ /* Use the same number for PDUs in a chain as for CTE request */
132
+ common_prepare_df_cfg (adv , TEST_CTE_COUNT );
133
+ common_create_per_adv_chain (adv , TEST_PER_ADV_CHAIN_LENGTH );
134
+ common_validate_per_adv_chain (adv , TEST_PER_ADV_CHAIN_LENGTH );
135
+
136
+ /* Swap PDU double buffer and get new latest PDU data */
137
+ pdu_new = lll_adv_sync_data_latest_get (adv -> lll .sync , NULL , & upd );
138
+ zassert_not_equal (pdu_new , NULL ,
139
+ "Unexpected value of new PDU pointer after PDU double buffer swap" );
140
+
141
+ pdu_prev = lll_adv_sync_data_peek (adv -> lll .sync , NULL );
142
+ zassert_equal (pdu_prev , pdu_new ,
143
+ "Unexpected value of previous PDU pointer after PDU double buffer swap" );
144
+
145
+ handle = ull_adv_handle_get (adv );
146
+
147
+ err = ll_df_set_cl_cte_tx_enable (handle , true);
148
+ zassert_equal (err , 0 ,
149
+ "Unexpected error while enabling CTE for periodic avertising chain, err: %d" ,
150
+ err );
151
+
152
+ /* Validate result */
153
+ common_validate_chain_with_cte (adv , TEST_CTE_COUNT , TEST_PER_ADV_CHAIN_LENGTH );
154
+
155
+ common_teardown (adv );
124
156
}
125
157
126
158
void test_add_cte_for_single_pdu_chain (void )
@@ -146,9 +178,7 @@ void test_add_cte_for_single_pdu_chain(void)
146
178
/* Validate result */
147
179
common_validate_chain_with_cte (adv , TEST_CTE_SINGLE , TEST_PER_ADV_SINGLE_PDU );
148
180
149
- /* Teardown */
150
- common_release_per_adv_chain (adv );
151
- common_release_adv_set (adv );
181
+ common_teardown (adv );
152
182
}
153
183
154
184
void run_add_cte_to_per_adv_chain_tests (void )
@@ -157,6 +187,7 @@ void run_add_cte_to_per_adv_chain_tests(void)
157
187
ztest_unit_test (test_add_number_of_cte_to_sigle_pdu_chain ),
158
188
ztest_unit_test (test_add_cte_for_each_pdu_in_chain ),
159
189
ztest_unit_test (test_add_cte_for_not_all_pdu_in_chain ),
190
+ ztest_unit_test (test_add_cte_to_not_all_pdus_in_chain_enqueued_to_lll ),
160
191
ztest_unit_test (test_add_cte_for_single_pdu_chain ));
161
192
ztest_run_test_suite (test_add_cte_to_per_adv_chain );
162
193
}
0 commit comments