1 /*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 * Copyright (c) 2020 Demant
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8 #include <zephyr/types.h>
9 #include <zephyr/ztest.h>
10
11 #include <zephyr/bluetooth/hci.h>
12 #include <zephyr/sys/byteorder.h>
13 #include <zephyr/sys/slist.h>
14 #include <zephyr/sys/util.h>
15
16 #include "hal/ccm.h"
17
18 #include "util/util.h"
19 #include "util/mem.h"
20 #include "util/memq.h"
21 #include "util/dbuf.h"
22
23 #include "pdu_df.h"
24 #include "lll/pdu_vendor.h"
25 #include "pdu.h"
26 #include "ll.h"
27 #include "ll_settings.h"
28 #include "ll_feat.h"
29
30 #include "lll.h"
31 #include "lll/lll_df_types.h"
32 #include "lll_conn_iso.h"
33
34 #include "lll_conn.h"
35 #include "ull_tx_queue.h"
36 #include "isoal.h"
37 #include "ull_iso_types.h"
38 #include "ull_conn_types.h"
39 #include "ull_conn_iso_types.h"
40
41 #include "ull_llcp.h"
42
43 #include "helper_pdu.h"
44 #include "helper_features.h"
45
46 #define PDU_MEM_EQUAL(_f, _s, _p, _t) \
47 zassert_mem_equal(_s._f, _p->_f, sizeof(_p->_f), _t "\nCalled at %s:%d\n", file, line);
48
helper_pdu_encode_ping_req(struct pdu_data * pdu,void * param)49 void helper_pdu_encode_ping_req(struct pdu_data *pdu, void *param)
50 {
51 pdu->ll_id = PDU_DATA_LLID_CTRL;
52 pdu->len = offsetof(struct pdu_data_llctrl, ping_req) +
53 sizeof(struct pdu_data_llctrl_ping_req);
54 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PING_REQ;
55 }
56
helper_pdu_encode_ping_rsp(struct pdu_data * pdu,void * param)57 void helper_pdu_encode_ping_rsp(struct pdu_data *pdu, void *param)
58 {
59 pdu->ll_id = PDU_DATA_LLID_CTRL;
60 pdu->len = offsetof(struct pdu_data_llctrl, ping_rsp) +
61 sizeof(struct pdu_data_llctrl_ping_rsp);
62 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PING_RSP;
63 }
64
helper_pdu_encode_feature_req(struct pdu_data * pdu,void * param)65 void helper_pdu_encode_feature_req(struct pdu_data *pdu, void *param)
66 {
67 struct pdu_data_llctrl_feature_req *feature_req = param;
68
69 pdu->ll_id = PDU_DATA_LLID_CTRL;
70 pdu->len = offsetof(struct pdu_data_llctrl, feature_req) +
71 sizeof(struct pdu_data_llctrl_feature_req);
72 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_REQ;
73 for (int counter = 0; counter < 8; counter++) {
74 uint8_t expected_value = feature_req->features[counter];
75
76 pdu->llctrl.feature_req.features[counter] = expected_value;
77 }
78 }
helper_pdu_encode_peripheral_feature_req(struct pdu_data * pdu,void * param)79 void helper_pdu_encode_peripheral_feature_req(struct pdu_data *pdu, void *param)
80 {
81 struct pdu_data_llctrl_feature_req *feature_req = param;
82
83 pdu->ll_id = PDU_DATA_LLID_CTRL;
84 pdu->len = offsetof(struct pdu_data_llctrl, feature_req) +
85 sizeof(struct pdu_data_llctrl_feature_req);
86 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG;
87
88 for (int counter = 0; counter < 8; counter++) {
89 uint8_t expected_value = feature_req->features[counter];
90
91 pdu->llctrl.feature_req.features[counter] = expected_value;
92 }
93 }
94
helper_pdu_encode_feature_rsp(struct pdu_data * pdu,void * param)95 void helper_pdu_encode_feature_rsp(struct pdu_data *pdu, void *param)
96 {
97 struct pdu_data_llctrl_feature_rsp *feature_rsp = param;
98
99 pdu->ll_id = PDU_DATA_LLID_CTRL;
100 pdu->len = offsetof(struct pdu_data_llctrl, feature_rsp) +
101 sizeof(struct pdu_data_llctrl_feature_rsp);
102 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP;
103 for (int counter = 0; counter < 8; counter++) {
104 uint8_t expected_value = feature_rsp->features[counter];
105
106 pdu->llctrl.feature_req.features[counter] = expected_value;
107 }
108 }
109
helper_pdu_encode_min_used_chans_ind(struct pdu_data * pdu,void * param)110 void helper_pdu_encode_min_used_chans_ind(struct pdu_data *pdu, void *param)
111 {
112 struct pdu_data_llctrl_min_used_chans_ind *p = param;
113
114 pdu->ll_id = PDU_DATA_LLID_CTRL;
115 pdu->len = offsetof(struct pdu_data_llctrl, min_used_chans_ind) +
116 sizeof(struct pdu_data_llctrl_min_used_chans_ind);
117 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND;
118 pdu->llctrl.min_used_chans_ind.phys = p->phys;
119 pdu->llctrl.min_used_chans_ind.min_used_chans = p->min_used_chans;
120 }
121
helper_pdu_encode_version_ind(struct pdu_data * pdu,void * param)122 void helper_pdu_encode_version_ind(struct pdu_data *pdu, void *param)
123 {
124 struct pdu_data_llctrl_version_ind *p = param;
125
126 pdu->ll_id = PDU_DATA_LLID_CTRL;
127 pdu->len = offsetof(struct pdu_data_llctrl, version_ind) +
128 sizeof(struct pdu_data_llctrl_version_ind);
129 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_VERSION_IND;
130 pdu->llctrl.version_ind.version_number = p->version_number;
131 pdu->llctrl.version_ind.company_id = p->company_id;
132 pdu->llctrl.version_ind.sub_version_number = p->sub_version_number;
133 }
134
helper_pdu_encode_enc_req(struct pdu_data * pdu,void * param)135 void helper_pdu_encode_enc_req(struct pdu_data *pdu, void *param)
136 {
137 struct pdu_data_llctrl_enc_req *p = param;
138
139 pdu->ll_id = PDU_DATA_LLID_CTRL;
140 pdu->len =
141 offsetof(struct pdu_data_llctrl, enc_req) + sizeof(struct pdu_data_llctrl_enc_req);
142 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ;
143 memcpy(pdu->llctrl.enc_req.rand, p->rand, sizeof(pdu->llctrl.enc_req.rand));
144 memcpy(pdu->llctrl.enc_req.ediv, p->ediv, sizeof(pdu->llctrl.enc_req.ediv));
145 memcpy(pdu->llctrl.enc_req.skdm, p->skdm, sizeof(pdu->llctrl.enc_req.skdm));
146 memcpy(pdu->llctrl.enc_req.ivm, p->ivm, sizeof(pdu->llctrl.enc_req.ivm));
147 }
148
helper_pdu_encode_enc_rsp(struct pdu_data * pdu,void * param)149 void helper_pdu_encode_enc_rsp(struct pdu_data *pdu, void *param)
150 {
151 struct pdu_data_llctrl_enc_rsp *p = param;
152
153 pdu->ll_id = PDU_DATA_LLID_CTRL;
154 pdu->len =
155 offsetof(struct pdu_data_llctrl, enc_rsp) + sizeof(struct pdu_data_llctrl_enc_rsp);
156 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_ENC_RSP;
157 memcpy(pdu->llctrl.enc_rsp.skds, p->skds, sizeof(pdu->llctrl.enc_rsp.skds));
158 memcpy(pdu->llctrl.enc_rsp.ivs, p->ivs, sizeof(pdu->llctrl.enc_rsp.ivs));
159 }
160
helper_pdu_encode_start_enc_req(struct pdu_data * pdu,void * param)161 void helper_pdu_encode_start_enc_req(struct pdu_data *pdu, void *param)
162 {
163 pdu->ll_id = PDU_DATA_LLID_CTRL;
164 pdu->len = offsetof(struct pdu_data_llctrl, start_enc_req) +
165 sizeof(struct pdu_data_llctrl_start_enc_req);
166 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_REQ;
167 }
168
helper_pdu_encode_start_enc_rsp(struct pdu_data * pdu,void * param)169 void helper_pdu_encode_start_enc_rsp(struct pdu_data *pdu, void *param)
170 {
171 pdu->ll_id = PDU_DATA_LLID_CTRL;
172 pdu->len = offsetof(struct pdu_data_llctrl, start_enc_rsp) +
173 sizeof(struct pdu_data_llctrl_start_enc_rsp);
174 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_RSP;
175 }
176
helper_pdu_encode_pause_enc_req(struct pdu_data * pdu,void * param)177 void helper_pdu_encode_pause_enc_req(struct pdu_data *pdu, void *param)
178 {
179 pdu->ll_id = PDU_DATA_LLID_CTRL;
180 pdu->len = offsetof(struct pdu_data_llctrl, pause_enc_req) +
181 sizeof(struct pdu_data_llctrl_pause_enc_req);
182 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ;
183 }
184
helper_pdu_encode_pause_enc_rsp(struct pdu_data * pdu,void * param)185 void helper_pdu_encode_pause_enc_rsp(struct pdu_data *pdu, void *param)
186 {
187 pdu->ll_id = PDU_DATA_LLID_CTRL;
188 pdu->len = offsetof(struct pdu_data_llctrl, pause_enc_rsp) +
189 sizeof(struct pdu_data_llctrl_pause_enc_rsp);
190 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP;
191 }
192
helper_pdu_encode_reject_ext_ind(struct pdu_data * pdu,void * param)193 void helper_pdu_encode_reject_ext_ind(struct pdu_data *pdu, void *param)
194 {
195 struct pdu_data_llctrl_reject_ext_ind *p = param;
196
197 pdu->ll_id = PDU_DATA_LLID_CTRL;
198 pdu->len = offsetof(struct pdu_data_llctrl, reject_ext_ind) +
199 sizeof(struct pdu_data_llctrl_reject_ext_ind);
200 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;
201 pdu->llctrl.reject_ext_ind.reject_opcode = p->reject_opcode;
202 pdu->llctrl.reject_ext_ind.error_code = p->error_code;
203 }
204
helper_pdu_encode_reject_ind(struct pdu_data * pdu,void * param)205 void helper_pdu_encode_reject_ind(struct pdu_data *pdu, void *param)
206 {
207 struct pdu_data_llctrl_reject_ind *p = param;
208
209 pdu->ll_id = PDU_DATA_LLID_CTRL;
210 pdu->len = offsetof(struct pdu_data_llctrl, reject_ind) +
211 sizeof(struct pdu_data_llctrl_reject_ind);
212 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_IND;
213 pdu->llctrl.reject_ind.error_code = p->error_code;
214 }
215
helper_pdu_encode_phy_req(struct pdu_data * pdu,void * param)216 void helper_pdu_encode_phy_req(struct pdu_data *pdu, void *param)
217 {
218 struct pdu_data_llctrl_phy_req *p = param;
219
220 pdu->ll_id = PDU_DATA_LLID_CTRL;
221 pdu->len =
222 offsetof(struct pdu_data_llctrl, phy_req) + sizeof(struct pdu_data_llctrl_phy_req);
223 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_REQ;
224 pdu->llctrl.phy_req.rx_phys = p->rx_phys;
225 pdu->llctrl.phy_req.tx_phys = p->tx_phys;
226 }
227
helper_pdu_encode_phy_rsp(struct pdu_data * pdu,void * param)228 void helper_pdu_encode_phy_rsp(struct pdu_data *pdu, void *param)
229 {
230 struct pdu_data_llctrl_phy_rsp *p = param;
231
232 pdu->ll_id = PDU_DATA_LLID_CTRL;
233 pdu->len =
234 offsetof(struct pdu_data_llctrl, phy_rsp) + sizeof(struct pdu_data_llctrl_phy_rsp);
235 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_RSP;
236 pdu->llctrl.phy_rsp.rx_phys = p->rx_phys;
237 pdu->llctrl.phy_rsp.tx_phys = p->tx_phys;
238 }
239
helper_pdu_encode_phy_update_ind(struct pdu_data * pdu,void * param)240 void helper_pdu_encode_phy_update_ind(struct pdu_data *pdu, void *param)
241 {
242 struct pdu_data_llctrl_phy_upd_ind *p = param;
243
244 pdu->ll_id = PDU_DATA_LLID_CTRL;
245 pdu->len = offsetof(struct pdu_data_llctrl, phy_upd_ind) +
246 sizeof(struct pdu_data_llctrl_phy_upd_ind);
247 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND;
248 pdu->llctrl.phy_upd_ind.instant = p->instant;
249 pdu->llctrl.phy_upd_ind.c_to_p_phy = p->c_to_p_phy;
250 pdu->llctrl.phy_upd_ind.p_to_c_phy = p->p_to_c_phy;
251 }
252
helper_pdu_encode_unknown_rsp(struct pdu_data * pdu,void * param)253 void helper_pdu_encode_unknown_rsp(struct pdu_data *pdu, void *param)
254 {
255 struct pdu_data_llctrl_unknown_rsp *p = param;
256
257 pdu->ll_id = PDU_DATA_LLID_CTRL;
258 pdu->len = offsetof(struct pdu_data_llctrl, unknown_rsp) +
259 sizeof(struct pdu_data_llctrl_unknown_rsp);
260 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP;
261 pdu->llctrl.unknown_rsp.type = p->type;
262 }
263
helper_pdu_encode_conn_param_req(struct pdu_data * pdu,void * param)264 void helper_pdu_encode_conn_param_req(struct pdu_data *pdu, void *param)
265 {
266 struct pdu_data_llctrl_conn_param_req *p = param;
267
268 pdu->ll_id = PDU_DATA_LLID_CTRL;
269 pdu->len = offsetof(struct pdu_data_llctrl, conn_param_req) +
270 sizeof(struct pdu_data_llctrl_conn_param_req);
271 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ;
272
273 pdu->llctrl.conn_param_req.interval_min = sys_cpu_to_le16(p->interval_min);
274 pdu->llctrl.conn_param_req.interval_max = sys_cpu_to_le16(p->interval_max);
275 pdu->llctrl.conn_param_req.latency = sys_cpu_to_le16(p->latency);
276 pdu->llctrl.conn_param_req.timeout = sys_cpu_to_le16(p->timeout);
277 pdu->llctrl.conn_param_req.preferred_periodicity = p->preferred_periodicity;
278 pdu->llctrl.conn_param_req.reference_conn_event_count =
279 sys_cpu_to_le16(p->reference_conn_event_count);
280 pdu->llctrl.conn_param_req.offset0 = sys_cpu_to_le16(p->offset0);
281 pdu->llctrl.conn_param_req.offset1 = sys_cpu_to_le16(p->offset1);
282 pdu->llctrl.conn_param_req.offset2 = sys_cpu_to_le16(p->offset2);
283 pdu->llctrl.conn_param_req.offset3 = sys_cpu_to_le16(p->offset3);
284 pdu->llctrl.conn_param_req.offset4 = sys_cpu_to_le16(p->offset4);
285 pdu->llctrl.conn_param_req.offset5 = sys_cpu_to_le16(p->offset5);
286 }
287
helper_pdu_encode_conn_param_rsp(struct pdu_data * pdu,void * param)288 void helper_pdu_encode_conn_param_rsp(struct pdu_data *pdu, void *param)
289 {
290 struct pdu_data_llctrl_conn_param_rsp *p = param;
291
292 pdu->ll_id = PDU_DATA_LLID_CTRL;
293 pdu->len = offsetof(struct pdu_data_llctrl, conn_param_rsp) +
294 sizeof(struct pdu_data_llctrl_conn_param_rsp);
295 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP;
296
297 pdu->llctrl.conn_param_rsp.interval_min = sys_cpu_to_le16(p->interval_min);
298 pdu->llctrl.conn_param_rsp.interval_max = sys_cpu_to_le16(p->interval_max);
299 pdu->llctrl.conn_param_rsp.latency = sys_cpu_to_le16(p->latency);
300 pdu->llctrl.conn_param_rsp.timeout = sys_cpu_to_le16(p->timeout);
301 pdu->llctrl.conn_param_rsp.preferred_periodicity = p->preferred_periodicity;
302 pdu->llctrl.conn_param_rsp.reference_conn_event_count =
303 sys_cpu_to_le16(p->reference_conn_event_count);
304 pdu->llctrl.conn_param_rsp.offset0 = sys_cpu_to_le16(p->offset0);
305 pdu->llctrl.conn_param_rsp.offset1 = sys_cpu_to_le16(p->offset1);
306 pdu->llctrl.conn_param_rsp.offset2 = sys_cpu_to_le16(p->offset2);
307 pdu->llctrl.conn_param_rsp.offset3 = sys_cpu_to_le16(p->offset3);
308 pdu->llctrl.conn_param_rsp.offset4 = sys_cpu_to_le16(p->offset4);
309 pdu->llctrl.conn_param_rsp.offset5 = sys_cpu_to_le16(p->offset5);
310 }
311
helper_pdu_encode_conn_update_ind(struct pdu_data * pdu,void * param)312 void helper_pdu_encode_conn_update_ind(struct pdu_data *pdu, void *param)
313 {
314 struct pdu_data_llctrl_conn_update_ind *p = param;
315
316 pdu->ll_id = PDU_DATA_LLID_CTRL;
317 pdu->len = offsetof(struct pdu_data_llctrl, conn_update_ind) +
318 sizeof(struct pdu_data_llctrl_conn_update_ind);
319 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_UPDATE_IND;
320
321 pdu->llctrl.conn_update_ind.win_size = p->win_size;
322 pdu->llctrl.conn_update_ind.win_offset = sys_cpu_to_le16(p->win_offset);
323 pdu->llctrl.conn_update_ind.interval = sys_cpu_to_le16(p->interval);
324 pdu->llctrl.conn_update_ind.latency = sys_cpu_to_le16(p->latency);
325 pdu->llctrl.conn_update_ind.timeout = sys_cpu_to_le16(p->timeout);
326 pdu->llctrl.conn_update_ind.instant = sys_cpu_to_le16(p->instant);
327 }
328
helper_pdu_encode_terminate_ind(struct pdu_data * pdu,void * param)329 void helper_pdu_encode_terminate_ind(struct pdu_data *pdu, void *param)
330 {
331 struct pdu_data_llctrl_terminate_ind *p = param;
332
333 pdu->ll_id = PDU_DATA_LLID_CTRL;
334 pdu->len = offsetof(struct pdu_data_llctrl, terminate_ind) +
335 sizeof(struct pdu_data_llctrl_terminate_ind);
336 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_TERMINATE_IND;
337 pdu->llctrl.terminate_ind.error_code = p->error_code;
338 }
339
helper_pdu_encode_channel_map_update_ind(struct pdu_data * pdu,void * param)340 void helper_pdu_encode_channel_map_update_ind(struct pdu_data *pdu, void *param)
341 {
342 struct pdu_data_llctrl_chan_map_ind *p = param;
343
344 pdu->ll_id = PDU_DATA_LLID_CTRL;
345 pdu->len = offsetof(struct pdu_data_llctrl, chan_map_ind) +
346 sizeof(struct pdu_data_llctrl_chan_map_ind);
347 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CHAN_MAP_IND;
348 pdu->llctrl.chan_map_ind.instant = p->instant;
349 memcpy(pdu->llctrl.chan_map_ind.chm, p->chm, sizeof(pdu->llctrl.chan_map_ind.chm));
350 }
351
helper_pdu_encode_length_req(struct pdu_data * pdu,void * param)352 void helper_pdu_encode_length_req(struct pdu_data *pdu, void *param)
353 {
354 struct pdu_data_llctrl_length_req *p = param;
355
356 pdu->ll_id = PDU_DATA_LLID_CTRL;
357 pdu->len = offsetof(struct pdu_data_llctrl, length_req) +
358 sizeof(struct pdu_data_llctrl_length_req);
359 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_LENGTH_REQ;
360
361 pdu->llctrl.length_req.max_rx_octets = p->max_rx_octets;
362 pdu->llctrl.length_req.max_tx_octets = p->max_tx_octets;
363 pdu->llctrl.length_req.max_rx_time = p->max_rx_time;
364 pdu->llctrl.length_req.max_tx_time = p->max_tx_time;
365 }
366
helper_pdu_encode_length_rsp(struct pdu_data * pdu,void * param)367 void helper_pdu_encode_length_rsp(struct pdu_data *pdu, void *param)
368 {
369 struct pdu_data_llctrl_length_rsp *p = param;
370
371 pdu->ll_id = PDU_DATA_LLID_CTRL;
372 pdu->len = offsetof(struct pdu_data_llctrl, length_rsp) +
373 sizeof(struct pdu_data_llctrl_length_rsp);
374 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_LENGTH_RSP;
375
376 pdu->llctrl.length_req.max_rx_octets = p->max_rx_octets;
377 pdu->llctrl.length_req.max_tx_octets = p->max_tx_octets;
378 pdu->llctrl.length_req.max_rx_time = p->max_rx_time;
379 pdu->llctrl.length_req.max_tx_time = p->max_tx_time;
380 }
helper_pdu_encode_cte_req(struct pdu_data * pdu,void * param)381 void helper_pdu_encode_cte_req(struct pdu_data *pdu, void *param)
382 {
383 struct pdu_data_llctrl_cte_req *p = param;
384
385 pdu->ll_id = PDU_DATA_LLID_CTRL;
386 pdu->len =
387 offsetof(struct pdu_data_llctrl, cte_req) + sizeof(struct pdu_data_llctrl_cte_req);
388 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CTE_REQ;
389 pdu->llctrl.cte_req.min_cte_len_req = p->min_cte_len_req;
390 pdu->llctrl.cte_req.cte_type_req = p->cte_type_req;
391 }
392
helper_pdu_encode_cte_rsp(struct pdu_data * pdu,void * param)393 void helper_pdu_encode_cte_rsp(struct pdu_data *pdu, void *param)
394 {
395 pdu->ll_id = PDU_DATA_LLID_CTRL;
396 pdu->len =
397 offsetof(struct pdu_data_llctrl, cte_rsp) + sizeof(struct pdu_data_llctrl_cte_rsp);
398 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CTE_RSP;
399 }
400
helper_pdu_encode_zero(struct pdu_data * pdu,void * param)401 void helper_pdu_encode_zero(struct pdu_data *pdu, void *param)
402 {
403 pdu->ll_id = PDU_DATA_LLID_CTRL;
404 pdu->len = 0;
405 }
406
helper_node_encode_cte_rsp(struct node_rx_pdu * rx,void * param)407 void helper_node_encode_cte_rsp(struct node_rx_pdu *rx, void *param)
408 {
409 rx->hdr.rx_ftr.iq_report = (struct cte_conn_iq_report *)param;
410 }
411
helper_pdu_encode_cis_req(struct pdu_data * pdu,void * param)412 void helper_pdu_encode_cis_req(struct pdu_data *pdu, void *param)
413 {
414 struct pdu_data_llctrl_cis_req *p = param;
415
416 pdu->ll_id = PDU_DATA_LLID_CTRL;
417 pdu->len = offsetof(struct pdu_data_llctrl, cis_req) +
418 sizeof(struct pdu_data_llctrl_cis_req);
419 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_REQ;
420
421 pdu->llctrl.cis_req.cig_id = p->cig_id;
422 pdu->llctrl.cis_req.cis_id = p->cis_id;
423 pdu->llctrl.cis_req.c_phy = p->c_phy;
424 pdu->llctrl.cis_req.p_phy = p->p_phy;
425 pdu->llctrl.cis_req.c_max_pdu = p->c_max_pdu;
426 pdu->llctrl.cis_req.p_max_pdu = p->p_max_pdu;
427 pdu->llctrl.cis_req.nse = p->nse;
428 pdu->llctrl.cis_req.p_bn = p->p_bn;
429 pdu->llctrl.cis_req.c_bn = p->c_bn;
430 pdu->llctrl.cis_req.c_ft = p->c_ft;
431 pdu->llctrl.cis_req.p_ft = p->p_ft;
432 pdu->llctrl.cis_req.iso_interval = p->iso_interval;
433 pdu->llctrl.cis_req.conn_event_count = p->conn_event_count;
434 memcpy(pdu->llctrl.cis_req.c_max_sdu_packed, p->c_max_sdu_packed,
435 sizeof(p->c_max_sdu_packed));
436 memcpy(pdu->llctrl.cis_req.p_max_sdu, p->p_max_sdu, sizeof(p->p_max_sdu));
437 memcpy(pdu->llctrl.cis_req.c_sdu_interval, p->c_sdu_interval, sizeof(p->c_sdu_interval));
438 memcpy(pdu->llctrl.cis_req.p_sdu_interval, p->p_sdu_interval, sizeof(p->p_sdu_interval));
439 memcpy(pdu->llctrl.cis_req.sub_interval, p->sub_interval, sizeof(p->sub_interval));
440 memcpy(pdu->llctrl.cis_req.cis_offset_min, p->cis_offset_min, sizeof(p->cis_offset_min));
441 memcpy(pdu->llctrl.cis_req.cis_offset_max, p->cis_offset_max, sizeof(p->cis_offset_max));
442 }
443
helper_pdu_encode_cis_rsp(struct pdu_data * pdu,void * param)444 void helper_pdu_encode_cis_rsp(struct pdu_data *pdu, void *param)
445 {
446 struct pdu_data_llctrl_cis_rsp *p = param;
447
448 pdu->ll_id = PDU_DATA_LLID_CTRL;
449 pdu->len = offsetof(struct pdu_data_llctrl, cis_rsp) +
450 sizeof(struct pdu_data_llctrl_cis_rsp);
451 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_RSP;
452 memcpy(pdu->llctrl.cis_rsp.cis_offset_min, p->cis_offset_min, sizeof(p->cis_offset_min));
453 memcpy(pdu->llctrl.cis_rsp.cis_offset_max, p->cis_offset_max, sizeof(p->cis_offset_max));
454 pdu->llctrl.cis_rsp.conn_event_count = p->conn_event_count;
455 }
456
helper_pdu_encode_cis_ind(struct pdu_data * pdu,void * param)457 void helper_pdu_encode_cis_ind(struct pdu_data *pdu, void *param)
458 {
459 struct pdu_data_llctrl_cis_ind *p = param;
460
461 pdu->ll_id = PDU_DATA_LLID_CTRL;
462 pdu->len = offsetof(struct pdu_data_llctrl, cis_ind) +
463 sizeof(struct pdu_data_llctrl_cis_ind);
464 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_IND;
465 memcpy(pdu->llctrl.cis_ind.aa, p->aa, sizeof(p->aa));
466 memcpy(pdu->llctrl.cis_ind.cis_offset, p->cis_offset, sizeof(p->cis_offset));
467 memcpy(pdu->llctrl.cis_ind.cig_sync_delay, p->cig_sync_delay, sizeof(p->cig_sync_delay));
468 memcpy(pdu->llctrl.cis_ind.cis_sync_delay, p->cis_sync_delay, sizeof(p->cis_sync_delay));
469 pdu->llctrl.cis_ind.conn_event_count = p->conn_event_count;
470 }
471
helper_pdu_encode_cis_terminate_ind(struct pdu_data * pdu,void * param)472 void helper_pdu_encode_cis_terminate_ind(struct pdu_data *pdu, void *param)
473 {
474 struct pdu_data_llctrl_cis_terminate_ind *p = param;
475
476 pdu->ll_id = PDU_DATA_LLID_CTRL;
477 pdu->len = offsetof(struct pdu_data_llctrl, cis_terminate_ind) +
478 sizeof(struct pdu_data_llctrl_cis_terminate_ind);
479 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_TERMINATE_IND;
480 pdu->llctrl.cis_terminate_ind.cig_id = p->cig_id;
481 pdu->llctrl.cis_terminate_ind.cis_id = p->cis_id;
482 pdu->llctrl.cis_terminate_ind.error_code = p->error_code;
483 }
484
helper_pdu_encode_sca_req(struct pdu_data * pdu,void * param)485 void helper_pdu_encode_sca_req(struct pdu_data *pdu, void *param)
486 {
487 struct pdu_data_llctrl_clock_accuracy_req *p = param;
488
489 pdu->ll_id = PDU_DATA_LLID_CTRL;
490 pdu->len = offsetof(struct pdu_data_llctrl, clock_accuracy_req) +
491 sizeof(struct pdu_data_llctrl_clock_accuracy_req);
492 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ;
493 pdu->llctrl.clock_accuracy_req.sca = p->sca;
494 }
495
helper_pdu_encode_sca_rsp(struct pdu_data * pdu,void * param)496 void helper_pdu_encode_sca_rsp(struct pdu_data *pdu, void *param)
497 {
498 struct pdu_data_llctrl_clock_accuracy_rsp *p = param;
499
500 pdu->ll_id = PDU_DATA_LLID_CTRL;
501 pdu->len = offsetof(struct pdu_data_llctrl, clock_accuracy_rsp) +
502 sizeof(struct pdu_data_llctrl_clock_accuracy_rsp);
503 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP;
504 pdu->llctrl.clock_accuracy_rsp.sca = p->sca;
505 }
506
helper_pdu_verify_version_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)507 void helper_pdu_verify_version_ind(const char *file, uint32_t line, struct pdu_data *pdu,
508 void *param)
509 {
510 struct pdu_data_llctrl_version_ind *p = param;
511
512 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
513 line);
514 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_VERSION_IND,
515 "Not a LL_VERSION_IND.\nCalled at %s:%d\n", file, line);
516 zassert_equal(pdu->llctrl.version_ind.version_number, p->version_number,
517 "Wrong version number.\nCalled at %s:%d\n", file, line);
518 zassert_equal(pdu->llctrl.version_ind.company_id, p->company_id,
519 "Wrong company id.\nCalled at %s:%d\n", file, line);
520 zassert_equal(pdu->llctrl.version_ind.sub_version_number, p->sub_version_number,
521 "Wrong sub version number.\nCalled at %s:%d\n", file, line);
522 }
523
helper_pdu_verify_ping_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)524 void helper_pdu_verify_ping_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
525 {
526 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
527 line);
528 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PING_REQ,
529 "Not a LL_PING_REQ. Called at %s:%d\n", file, line);
530 }
531
helper_pdu_verify_ping_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)532 void helper_pdu_verify_ping_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
533 {
534 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
535 line);
536 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PING_RSP,
537 "Not a LL_PING_RSP.\nCalled at %s:%d\n", file, line);
538 }
539
helper_pdu_verify_feature_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)540 void helper_pdu_verify_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
541 void *param)
542 {
543 struct pdu_data_llctrl_feature_req *feature_req = param;
544
545 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL);
546 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_FEATURE_REQ,
547 "Wrong opcode.\nCalled at %s:%d\n", file, line);
548
549 for (int counter = 0; counter < 8; counter++) {
550 uint8_t expected_value = feature_req->features[counter];
551
552 zassert_equal(pdu->llctrl.feature_req.features[counter], expected_value,
553 "Wrong feature exchange data.\nAt %s:%d\n", file, line);
554 }
555 }
556
helper_pdu_verify_peripheral_feature_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)557 void helper_pdu_verify_peripheral_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
558 void *param)
559 {
560 struct pdu_data_llctrl_feature_req *feature_req = param;
561
562 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL);
563 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG);
564
565 for (int counter = 0; counter < 8; counter++) {
566 uint8_t expected_value = feature_req->features[counter];
567
568 zassert_equal(pdu->llctrl.feature_req.features[counter], expected_value,
569 "Wrong feature data\nCalled at %s:%d\n", file, line);
570 }
571 }
572
helper_pdu_verify_feature_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)573 void helper_pdu_verify_feature_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
574 void *param)
575 {
576 struct pdu_data_llctrl_feature_rsp *feature_rsp = param;
577
578 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL);
579 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_FEATURE_RSP,
580 "Response: %d Expected: %d\n", pdu->llctrl.opcode,
581 PDU_DATA_LLCTRL_TYPE_FEATURE_RSP);
582
583 for (int counter = 0; counter < 8; counter++) {
584 uint8_t expected_value = feature_rsp->features[counter];
585
586 zassert_equal(pdu->llctrl.feature_rsp.features[counter], expected_value,
587 "Wrong feature data\nCalled at %s:%d\n", file, line);
588 }
589 }
590
helper_pdu_verify_min_used_chans_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)591 void helper_pdu_verify_min_used_chans_ind(const char *file, uint32_t line, struct pdu_data *pdu,
592 void *param)
593 {
594 struct pdu_data_llctrl_min_used_chans_ind *p = param;
595
596 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
597 line);
598 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND,
599 "Not a MIN_USED_CHAN_IND.\nCalled at %s:%d\n", file, line);
600 zassert_equal(pdu->llctrl.min_used_chans_ind.phys, p->phys, "Wrong PHY.\nCalled at %s:%d\n",
601 file, line);
602 zassert_equal(pdu->llctrl.min_used_chans_ind.min_used_chans, p->min_used_chans,
603 "Channel count\nCalled at %s:%d\n", file, line);
604 }
605
helper_pdu_verify_enc_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)606 void helper_pdu_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
607 {
608 struct pdu_data_llctrl_enc_req *p = param;
609
610 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
611 line);
612 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_ENC_REQ,
613 "Not a LL_ENC_REQ. Called at %s:%d\n", file, line);
614
615 PDU_MEM_EQUAL(rand, pdu->llctrl.enc_req, p, "Rand mismatch.");
616 PDU_MEM_EQUAL(ediv, pdu->llctrl.enc_req, p, "EDIV mismatch.");
617 PDU_MEM_EQUAL(skdm, pdu->llctrl.enc_req, p, "SKDm mismatch.");
618 PDU_MEM_EQUAL(ivm, pdu->llctrl.enc_req, p, "IVm mismatch.");
619 }
620
helper_pdu_ntf_verify_enc_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)621 void helper_pdu_ntf_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
622 void *param)
623 {
624 struct pdu_data_llctrl_enc_req *p = param;
625
626 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
627 line);
628 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_ENC_REQ,
629 "Not a LL_ENC_REQ. Called at %s:%d\n", file, line);
630
631 PDU_MEM_EQUAL(rand, pdu->llctrl.enc_req, p, "Rand mismatch.");
632 PDU_MEM_EQUAL(ediv, pdu->llctrl.enc_req, p, "EDIV mismatch.");
633 }
634
helper_pdu_verify_enc_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)635 void helper_pdu_verify_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
636 {
637 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
638 line);
639 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_ENC_RSP,
640 "Not a LL_ENC_RSP.\nCalled at %s:%d\n", file, line);
641 }
642
helper_pdu_verify_start_enc_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)643 void helper_pdu_verify_start_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
644 void *param)
645 {
646 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
647 line);
648 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_START_ENC_REQ,
649 "Not a LL_START_ENC_REQ.\nCalled at %s:%d\n", file, line);
650 }
651
helper_pdu_verify_start_enc_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)652 void helper_pdu_verify_start_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
653 void *param)
654 {
655 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
656 line);
657 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_START_ENC_RSP,
658 "Not a LL_START_ENC_RSP.\nCalled at %s:%d\n", file, line);
659 }
660
helper_pdu_verify_pause_enc_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)661 void helper_pdu_verify_pause_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
662 void *param)
663 {
664 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
665 line);
666 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ,
667 "Not a LL_PAUSE_ENC_REQ.\nCalled at %s:%d\n", file, line);
668 }
669
helper_pdu_verify_pause_enc_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)670 void helper_pdu_verify_pause_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
671 void *param)
672 {
673 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
674 line);
675 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP,
676 "Not a LL_PAUSE_ENC_RSP.\nCalled at %s:%d\n", file, line);
677 }
678
helper_node_verify_enc_refresh(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)679 void helper_node_verify_enc_refresh(const char *file, uint32_t line, struct node_rx_pdu *rx,
680 void *param)
681 {
682 zassert_equal(rx->hdr.type, NODE_RX_TYPE_ENC_REFRESH,
683 "Not an ENC_REFRESH node.\nCalled at %s:%d\n", file, line);
684 }
685
helper_pdu_verify_reject_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)686 void helper_pdu_verify_reject_ind(const char *file, uint32_t line, struct pdu_data *pdu,
687 void *param)
688 {
689 struct pdu_data_llctrl_reject_ind *p = param;
690
691 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
692 line);
693 zassert_equal(pdu->len,
694 offsetof(struct pdu_data_llctrl, reject_ind) +
695 sizeof(struct pdu_data_llctrl_reject_ind),
696 "Wrong length.\nCalled at %s:%d\n", file, line);
697 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_REJECT_IND,
698 "Not a LL_REJECT_IND.\nCalled at %s:%d\n", file, line);
699 zassert_equal(pdu->llctrl.reject_ind.error_code, p->error_code,
700 "Error code mismatch.\nCalled at %s:%d\n", file, line);
701 }
702
helper_pdu_verify_reject_ext_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)703 void helper_pdu_verify_reject_ext_ind(const char *file, uint32_t line, struct pdu_data *pdu,
704 void *param)
705 {
706 struct pdu_data_llctrl_reject_ext_ind *p = param;
707
708 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
709 line);
710 zassert_equal(pdu->len,
711 offsetof(struct pdu_data_llctrl, reject_ext_ind) +
712 sizeof(struct pdu_data_llctrl_reject_ext_ind),
713 "Wrong length.\nCalled at %s:%d\n", file, line);
714 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND,
715 "Not a LL_REJECT_EXT_IND.\nCalled at %s:%d\n", file, line);
716 zassert_equal(pdu->llctrl.reject_ext_ind.reject_opcode, p->reject_opcode,
717 "Reject opcode mismatch.\nCalled at %s:%d\n", file, line);
718 zassert_equal(pdu->llctrl.reject_ext_ind.error_code, p->error_code,
719 "Error code mismatch.\nCalled at %s:%d\n", file, line);
720 }
721
helper_pdu_verify_phy_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)722 void helper_pdu_verify_phy_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
723 {
724 struct pdu_data_llctrl_phy_req *p = param;
725
726 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
727 line);
728 zassert_equal(pdu->len,
729 offsetof(struct pdu_data_llctrl, phy_req) +
730 sizeof(struct pdu_data_llctrl_phy_req),
731 "Wrong length.\nCalled at %s:%d\n", file, line);
732 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PHY_REQ,
733 "Not a LL_PHY_REQ.\nCalled at %s:%d\n", file, line);
734 zassert_equal(pdu->llctrl.phy_req.rx_phys, p->rx_phys,
735 "rx phys mismatch.\nCalled at %s:%d\n", file, line);
736 zassert_equal(pdu->llctrl.phy_req.tx_phys, p->tx_phys,
737 "tx phys mismatch.\nCalled at %s:%d\n", file, line);
738 }
739
helper_pdu_verify_phy_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)740 void helper_pdu_verify_phy_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
741 {
742 struct pdu_data_llctrl_phy_rsp *p = param;
743
744 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
745 line);
746 zassert_equal(pdu->len,
747 offsetof(struct pdu_data_llctrl, phy_rsp) +
748 sizeof(struct pdu_data_llctrl_phy_rsp),
749 "Wrong length.\nCalled at %s:%d\n", file, line);
750 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PHY_RSP,
751 "Not a LL_PHY_RSP.\nCalled at %s:%d\n", file, line);
752 zassert_equal(pdu->llctrl.phy_rsp.rx_phys, p->rx_phys,
753 "rx phys mismatch.\nCalled at %s:%d\n", file, line);
754 zassert_equal(pdu->llctrl.phy_rsp.tx_phys, p->tx_phys,
755 "tx phys mismatch.\nCalled at %s:%d\n", file, line);
756 }
757
helper_pdu_verify_phy_update_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)758 void helper_pdu_verify_phy_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
759 void *param)
760 {
761 struct pdu_data_llctrl_phy_upd_ind *p = param;
762
763 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
764 line);
765 zassert_equal(pdu->len,
766 offsetof(struct pdu_data_llctrl, phy_upd_ind) +
767 sizeof(struct pdu_data_llctrl_phy_upd_ind),
768 "Wrong length.\nCalled at %s:%d\n", file, line);
769 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND,
770 "Not a LL_PHY_UPDATE_IND.\nCalled at %s:%d\n", file, line);
771 zassert_equal(pdu->llctrl.phy_upd_ind.instant, p->instant,
772 "instant mismatch.\nCalled at %s:%d\n", file, line);
773 zassert_equal(pdu->llctrl.phy_upd_ind.c_to_p_phy, p->c_to_p_phy,
774 "c_to_p_phy mismatch.\nCalled at %s:%d\n", file, line);
775 zassert_equal(pdu->llctrl.phy_upd_ind.p_to_c_phy, p->p_to_c_phy,
776 "p_to_c_phy mismatch.\nCalled at %s:%d\n", file, line);
777 }
778
helper_node_verify_phy_update(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)779 void helper_node_verify_phy_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
780 void *param)
781 {
782 struct node_rx_pu *pdu = (struct node_rx_pu *)rx->pdu;
783 struct node_rx_pu *p = param;
784
785 zassert_equal(rx->hdr.type, NODE_RX_TYPE_PHY_UPDATE,
786 "Not a PHY_UPDATE node.\nCalled at %s:%d\n", file, line);
787 zassert_equal(pdu->status, p->status, "Status mismatch.\nCalled at %s:%d\n", file, line);
788 }
789
helper_node_verify_peer_sca_update(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)790 void helper_node_verify_peer_sca_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
791 void *param)
792 {
793 struct node_rx_sca *pdu = (struct node_rx_sca *)rx->pdu;
794 struct node_rx_sca *p = param;
795
796 zassert_equal(rx->hdr.type, NODE_RX_TYPE_REQ_PEER_SCA_COMPLETE,
797 "Not an SCA node.\nCalled at %s:%d\n", file, line);
798 zassert_equal(pdu->status, p->status, "Status mismatch.\nCalled at %s:%d\n", file, line);
799 zassert_equal(pdu->sca, p->sca, "SCA mismatch.\nCalled at %s:%d\n", file, line);
800 }
801
helper_pdu_verify_unknown_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)802 void helper_pdu_verify_unknown_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
803 void *param)
804 {
805 struct pdu_data_llctrl_unknown_rsp *p = param;
806
807 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
808 line);
809 zassert_equal(pdu->len,
810 offsetof(struct pdu_data_llctrl, unknown_rsp) +
811 sizeof(struct pdu_data_llctrl_unknown_rsp),
812 "Wrong length.\nCalled at %s:%d\n", file, line);
813 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP,
814 "Not a LL_UNKNOWN_RSP.\nCalled at %s:%d\n", file, line);
815 zassert_equal(pdu->llctrl.unknown_rsp.type, p->type, "Type mismatch.\nCalled at %s:%d\n",
816 file, line);
817 }
818
helper_pdu_verify_conn_param_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)819 void helper_pdu_verify_conn_param_req(const char *file, uint32_t line, struct pdu_data *pdu,
820 void *param)
821 {
822 struct pdu_data_llctrl_conn_param_req *p = param;
823
824 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
825 line);
826 zassert_equal(pdu->len,
827 offsetof(struct pdu_data_llctrl, conn_param_req) +
828 sizeof(struct pdu_data_llctrl_conn_param_req),
829 "Wrong length.\nCalled at %s:%d\n", file, line);
830 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ,
831 "Not a LL_CONNECTION_PARAM_REQ.\nCalled at %s:%d\n", file, line);
832
833 zassert_equal(pdu->llctrl.conn_param_req.interval_min, p->interval_min,
834 "Interval_min mismatch.\nCalled at %s:%d\n", file, line);
835 zassert_equal(pdu->llctrl.conn_param_req.interval_max, p->interval_max,
836 "Interval_max mismatch.\nCalled at %s:%d\n", file, line);
837 zassert_equal(pdu->llctrl.conn_param_req.latency, p->latency,
838 "Latency mismatch.\nCalled at %s:%d\n", file, line);
839 zassert_equal(pdu->llctrl.conn_param_req.timeout, p->timeout,
840 "Timeout mismatch.\nCalled at %s:%d\n", file, line);
841 zassert_equal(pdu->llctrl.conn_param_req.preferred_periodicity, p->preferred_periodicity,
842 "Preferred_periodicity mismatch.\nCalled at %s:%d\n", file, line);
843 zassert_equal(pdu->llctrl.conn_param_req.reference_conn_event_count,
844 p->reference_conn_event_count,
845 "Reference_conn_event_count mismatch.\nCalled at %s:%d\n", file, line);
846 zassert_equal(pdu->llctrl.conn_param_req.offset0, p->offset0,
847 "Offset0 mismatch.\nCalled at %s:%d\n", file, line);
848 zassert_equal(pdu->llctrl.conn_param_req.offset1, p->offset1,
849 "Offset1 mismatch.\nCalled at %s:%d\n", file, line);
850 zassert_equal(pdu->llctrl.conn_param_req.offset2, p->offset2,
851 "Offset2 mismatch.\nCalled at %s:%d\n", file, line);
852 zassert_equal(pdu->llctrl.conn_param_req.offset3, p->offset3,
853 "Offset3 mismatch.\nCalled at %s:%d\n", file, line);
854 zassert_equal(pdu->llctrl.conn_param_req.offset4, p->offset4,
855 "Offset4 mismatch.\nCalled at %s:%d\n", file, line);
856 zassert_equal(pdu->llctrl.conn_param_req.offset5, p->offset5,
857 "Offset5 mismatch.\nCalled at %s:%d\n", file, line);
858 }
859
helper_pdu_verify_conn_param_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)860 void helper_pdu_verify_conn_param_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
861 void *param)
862 {
863 struct pdu_data_llctrl_conn_param_rsp *p = param;
864
865 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
866 line);
867 zassert_equal(pdu->len,
868 offsetof(struct pdu_data_llctrl, conn_param_rsp) +
869 sizeof(struct pdu_data_llctrl_conn_param_rsp),
870 "Wrong length.\nCalled at %s:%d\n", file, line);
871 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP,
872 "Not a LL_CONNECTION_PARAM_RSP.\nCalled at %s:%d\n", file, line);
873
874 zassert_equal(pdu->llctrl.conn_param_rsp.interval_min, p->interval_min,
875 "Interval_min mismatch.\nCalled at %s:%d\n", file, line);
876 zassert_equal(pdu->llctrl.conn_param_rsp.interval_max, p->interval_max,
877 "Interval_max mismatch.\nCalled at %s:%d\n", file, line);
878 zassert_equal(pdu->llctrl.conn_param_rsp.latency, p->latency,
879 "Latency mismatch.\nCalled at %s:%d\n", file, line);
880 zassert_equal(pdu->llctrl.conn_param_rsp.timeout, p->timeout,
881 "Timeout mismatch.\nCalled at %s:%d\n", file, line);
882 zassert_equal(pdu->llctrl.conn_param_rsp.preferred_periodicity, p->preferred_periodicity,
883 "Preferred_periodicity mismatch.\nCalled at %s:%d\n", file, line);
884 zassert_equal(pdu->llctrl.conn_param_rsp.reference_conn_event_count,
885 p->reference_conn_event_count,
886 "Reference_conn_event_count mismatch.\nCalled at %s:%d\n", file, line);
887 zassert_equal(pdu->llctrl.conn_param_rsp.offset0, p->offset0,
888 "Offset0 mismatch.\nCalled at %s:%d\n", file, line);
889 zassert_equal(pdu->llctrl.conn_param_rsp.offset1, p->offset1,
890 "Offset1 mismatch.\nCalled at %s:%d\n", file, line);
891 zassert_equal(pdu->llctrl.conn_param_rsp.offset2, p->offset2,
892 "Offset2 mismatch.\nCalled at %s:%d\n", file, line);
893 zassert_equal(pdu->llctrl.conn_param_rsp.offset3, p->offset3,
894 "Offset3 mismatch.\nCalled at %s:%d\n", file, line);
895 zassert_equal(pdu->llctrl.conn_param_rsp.offset4, p->offset4,
896 "Offset4 mismatch.\nCalled at %s:%d\n", file, line);
897 zassert_equal(pdu->llctrl.conn_param_rsp.offset5, p->offset5,
898 "Offset5 mismatch.\nCalled at %s:%d\n", file, line);
899 }
900
helper_pdu_verify_conn_update_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)901 void helper_pdu_verify_conn_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
902 void *param)
903 {
904 struct pdu_data_llctrl_conn_update_ind *p = param;
905
906 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
907 line);
908 zassert_equal(pdu->len,
909 offsetof(struct pdu_data_llctrl, conn_update_ind) +
910 sizeof(struct pdu_data_llctrl_conn_update_ind),
911 "Wrong length.\nCalled at %s:%d\n", file, line);
912 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CONN_UPDATE_IND,
913 "Not a LL_CONNECTION_UPDATE_IND.\nCalled at %s:%d\n", file, line);
914 zassert_equal(pdu->llctrl.conn_update_ind.win_size, p->win_size,
915 "Win_size mismatch.\nCalled at %s:%d\n", file, line);
916 zassert_equal(pdu->llctrl.conn_update_ind.win_offset, p->win_offset,
917 "Win_offset mismatch.\nCalled at %s:%d\n", file, line);
918 zassert_equal(pdu->llctrl.conn_update_ind.latency, p->latency,
919 "Latency.\nCalled at %s:%d\n", file, line);
920 zassert_equal(pdu->llctrl.conn_update_ind.interval, p->interval,
921 "Interval mismatch.\nCalled at %s:%d\n", file, line);
922 zassert_equal(pdu->llctrl.conn_update_ind.timeout, p->timeout,
923 "Timeout mismatch.\nCalled at %s:%d\n", file, line);
924 zassert_equal(pdu->llctrl.conn_update_ind.instant, p->instant,
925 "Instant mismatch.\nCalled at %s:%d\n", file, line);
926 }
927
helper_node_verify_conn_update(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)928 void helper_node_verify_conn_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
929 void *param)
930 {
931 struct node_rx_pu *pdu = (struct node_rx_pu *)rx->pdu;
932 struct node_rx_pu *p = param;
933
934 zassert_equal(rx->hdr.type, NODE_RX_TYPE_CONN_UPDATE,
935 "Not a CONN_UPDATE node.\nCalled at %s:%d\n", file, line);
936 zassert_equal(pdu->status, p->status, "Status mismatch.\nCalled at %s:%d\n", file, line);
937 }
938
helper_pdu_verify_terminate_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)939 void helper_pdu_verify_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
940 void *param)
941 {
942 struct pdu_data_llctrl_terminate_ind *p = param;
943
944 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
945 line);
946 zassert_equal(pdu->len,
947 offsetof(struct pdu_data_llctrl, terminate_ind) +
948 sizeof(struct pdu_data_llctrl_terminate_ind),
949 "Wrong length.\nCalled at %s:%d\n", file, line);
950 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_TERMINATE_IND,
951 "Not a LL_TERMINATE_IND.\nCalled at %s:%d\n", file, line);
952 zassert_equal(pdu->llctrl.terminate_ind.error_code, p->error_code,
953 "Error code mismatch.\nCalled at %s:%d\n", file, line);
954 }
955
helper_pdu_verify_channel_map_update_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)956 void helper_pdu_verify_channel_map_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
957 void *param)
958 {
959 struct pdu_data_llctrl_chan_map_ind *p = param;
960
961 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
962 line);
963 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CHAN_MAP_IND,
964 "Not a LL_CHANNEL_MAP_UPDATE_IND.\nCalled at %s:%d ( %d %d)\n", file, line,
965 pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CHAN_MAP_IND);
966 zassert_equal(pdu->len,
967 offsetof(struct pdu_data_llctrl, chan_map_ind) +
968 sizeof(struct pdu_data_llctrl_chan_map_ind),
969 "Wrong length.\nCalled at %s:%d\n", file, line);
970 zassert_equal(pdu->llctrl.chan_map_ind.instant, p->instant,
971 "Instant mismatch.\nCalled at %s:%d\n", file, line);
972 zassert_mem_equal(pdu->llctrl.chan_map_ind.chm, p->chm, sizeof(p->chm),
973 "Channel Map mismatch.\nCalled at %s:%d\n", file, line);
974 }
975
helper_pdu_verify_length_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)976 void helper_pdu_verify_length_req(const char *file, uint32_t line, struct pdu_data *pdu,
977 void *param)
978 {
979 struct pdu_data_llctrl_length_req *p = param;
980
981 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
982 line);
983 zassert_equal(pdu->len,
984 offsetof(struct pdu_data_llctrl, length_req) +
985 sizeof(struct pdu_data_llctrl_length_req),
986 "Wrong length.\nCalled at %s:%d\n", file, line);
987 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_LENGTH_REQ,
988 "Not a LL_LENGTH_REQ.\nCalled at %s:%d\n", file, line);
989 zassert_equal(pdu->llctrl.length_req.max_rx_octets, p->max_rx_octets,
990 "max_rx_octets mismatch.\nCalled at %s:%d\n", file, line);
991 zassert_equal(pdu->llctrl.length_req.max_tx_octets, p->max_tx_octets,
992 "max_tx_octets mismatch.\nCalled at %s:%d\n", file, line);
993 zassert_equal(pdu->llctrl.length_req.max_rx_time, p->max_rx_time,
994 "max_rx_time mismatch.\nCalled at %s:%d\n", file, line);
995 zassert_equal(pdu->llctrl.length_req.max_tx_time, p->max_tx_time,
996 "max_tx_time mismatch.\nCalled at %s:%d\n", file, line);
997 }
998
helper_pdu_verify_length_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)999 void helper_pdu_verify_length_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
1000 void *param)
1001 {
1002 struct pdu_data_llctrl_length_rsp *p = param;
1003
1004 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1005 line);
1006 zassert_equal(pdu->len,
1007 offsetof(struct pdu_data_llctrl, length_rsp) +
1008 sizeof(struct pdu_data_llctrl_length_rsp),
1009 "Wrong length.\nCalled at %s:%d\n", file, line);
1010 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_LENGTH_RSP,
1011 "Not a LL_LENGTH_RSP.\nCalled at %s:%d\n", file, line);
1012 zassert_equal(pdu->llctrl.length_rsp.max_rx_octets, p->max_rx_octets,
1013 "max_rx_octets mismatch.\nCalled at %s:%d\n", file, line);
1014 zassert_equal(pdu->llctrl.length_rsp.max_tx_octets, p->max_tx_octets,
1015 "max_tx_octets mismatch.\nCalled at %s:%d\n", file, line);
1016 zassert_equal(pdu->llctrl.length_rsp.max_rx_time, p->max_rx_time,
1017 "max_rx_time mismatch.\nCalled at %s:%d\n", file, line);
1018 zassert_equal(pdu->llctrl.length_rsp.max_tx_time, p->max_tx_time,
1019 "max_tx_time mismatch.\nCalled at %s:%d\n", file, line);
1020 }
1021
helper_pdu_verify_cte_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1022 void helper_pdu_verify_cte_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1023 {
1024 struct pdu_data_llctrl_cte_req *p = param;
1025
1026 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1027 line);
1028 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CTE_REQ,
1029 "Not a LL_CTE_REQ.\nCalled at %s:%d ( %d %d)\n", file, line,
1030 pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CTE_REQ);
1031 zassert_equal(pdu->len,
1032 offsetof(struct pdu_data_llctrl, cte_req) +
1033 sizeof(struct pdu_data_llctrl_cte_req),
1034 "Wrong length.\nCalled at %s:%d\n", file, line);
1035 zassert_equal(pdu->llctrl.cte_req.min_cte_len_req, p->min_cte_len_req,
1036 "Minimal CTE length request mismatch.\nCalled at %s:%d\n", file, line);
1037 zassert_equal(pdu->llctrl.cte_req.cte_type_req, p->cte_type_req,
1038 "CTE type request mismatch.\nCalled at %s:%d\n", file, line);
1039 }
1040
helper_pdu_verify_cte_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1041 void helper_pdu_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1042 {
1043 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1044 line);
1045 zassert_equal(pdu->len,
1046 offsetof(struct pdu_data_llctrl, cte_rsp) +
1047 sizeof(struct pdu_data_llctrl_cte_rsp),
1048 "Wrong length.\nCalled at %s:%d\n", file, line);
1049 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CTE_RSP,
1050 "Not a LL_CTE_RSP.\nCalled at %s:%d\n", file, line);
1051 }
1052
helper_node_verify_cte_rsp(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)1053 void helper_node_verify_cte_rsp(const char *file, uint32_t line, struct node_rx_pdu *rx,
1054 void *param)
1055 {
1056 struct cte_conn_iq_report *p_iq_report = param;
1057 struct cte_conn_iq_report *rx_iq_report = rx->hdr.rx_ftr.iq_report;
1058
1059 zassert_equal(rx_iq_report->cte_info.time, p_iq_report->cte_info.time,
1060 "CTE Time mismatch.\nCalled at %s:%d\n", file, line);
1061 zassert_equal(rx_iq_report->local_slot_durations, p_iq_report->local_slot_durations,
1062 "Slot duration mismatch.\nCalled at %s:%d\n", file, line);
1063 zassert_equal(rx_iq_report->packet_status, p_iq_report->packet_status,
1064 "Packet status mismatch.\nCalled at %s:%d\n", file, line);
1065 zassert_equal(rx_iq_report->rssi_ant_id, p_iq_report->rssi_ant_id,
1066 "RSSI antenna id mismatch.\nCalled at %s:%d\n", file, line);
1067 zassert_equal(rx_iq_report->sample_count, p_iq_report->sample_count,
1068 "Sample count mismatch.\nCalled at %s:%d\n", file, line);
1069 zassert_equal(memcmp(rx_iq_report->sample, p_iq_report->sample, p_iq_report->sample_count),
1070 0, "IQ samples mismatch.\nCalled at %s:%d\n", file, line);
1071 }
1072
helper_pdu_ntf_verify_cte_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1073 void helper_pdu_ntf_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
1074 void *param)
1075 {
1076 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1077 line);
1078 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CTE_RSP,
1079 "Not a LL_CTE_RSP. Called at %s:%d\n", file, line);
1080 }
1081
helper_node_verify_cis_request(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)1082 void helper_node_verify_cis_request(const char *file, uint32_t line, struct node_rx_pdu *rx,
1083 void *param)
1084 {
1085 struct node_rx_conn_iso_req *p = (struct node_rx_conn_iso_req *)param;
1086 struct node_rx_conn_iso_req *pdu = (struct node_rx_conn_iso_req *)rx->pdu;
1087
1088 zassert_equal(rx->hdr.type, NODE_RX_TYPE_CIS_REQUEST,
1089 "Not a CIS_REQUEST node.\nCalled at %s:%d\n", file, line);
1090 zassert_equal(p->cig_id, pdu->cig_id,
1091 "cig_id mismatch.\nCalled at %s:%d\n", file, line);
1092 zassert_equal(p->cis_handle, pdu->cis_handle,
1093 "cis_handle mismatch.\nCalled at %s:%d\n", file, line);
1094 zassert_equal(p->cis_id, pdu->cis_id,
1095 "cis_id mismatch.\nCalled at %s:%d\n", file, line);
1096 }
1097
helper_node_verify_cis_established(const char * file,uint32_t line,struct node_rx_pdu * rx,void * param)1098 void helper_node_verify_cis_established(const char *file, uint32_t line, struct node_rx_pdu *rx,
1099 void *param)
1100 {
1101 struct node_rx_conn_iso_estab *p = (struct node_rx_conn_iso_estab *)param;
1102 struct node_rx_conn_iso_estab *pdu = (struct node_rx_conn_iso_estab *)rx->pdu;
1103
1104 zassert_equal(rx->hdr.type, NODE_RX_TYPE_CIS_ESTABLISHED,
1105 "Not a CIS_ESTABLISHED node.\nCalled at %s:%d\n", file, line);
1106 zassert_equal(p->status, pdu->status,
1107 "status mismatch.\nCalled at %s:%d\n", file, line);
1108 zassert_equal(p->cis_handle, pdu->cis_handle,
1109 "cis_handle mismatch.\nCalled at %s:%d\n", file, line);
1110 }
1111
helper_pdu_verify_cis_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1112 void helper_pdu_verify_cis_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1113 {
1114 struct pdu_data_llctrl_cis_req *p = param;
1115
1116 pdu->ll_id = PDU_DATA_LLID_CTRL;
1117 pdu->len = offsetof(struct pdu_data_llctrl, cis_req) +
1118 sizeof(struct pdu_data_llctrl_cis_req);
1119 pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_REQ;
1120
1121 zassert_equal(pdu->llctrl.cis_req.cig_id, p->cig_id,
1122 "cig_id mismatch.\nCalled at %s:%d\n", file, line);
1123 zassert_equal(pdu->llctrl.cis_req.cis_id, p->cis_id,
1124 "cis_id mismatch.\nCalled at %s:%d\n", file, line);
1125 zassert_equal(pdu->llctrl.cis_req.c_phy, p->c_phy,
1126 "c_phy mismatch.\nCalled at %s:%d\n", file, line);
1127 zassert_equal(pdu->llctrl.cis_req.p_phy, p->p_phy,
1128 "p_phy mismatch.\nCalled at %s:%d\n", file, line);
1129 zassert_equal(pdu->llctrl.cis_req.c_max_pdu, p->c_max_pdu,
1130 "c_max_pdu mismatch.\nCalled at %s:%d\n", file, line);
1131 zassert_equal(pdu->llctrl.cis_req.p_max_pdu, p->p_max_pdu,
1132 "p_max_pdu mismatch.\nCalled at %s:%d\n", file, line);
1133 zassert_equal(pdu->llctrl.cis_req.nse, p->nse,
1134 "nse mismatch.\nCalled at %s:%d\n", file, line);
1135 zassert_equal(pdu->llctrl.cis_req.p_bn, p->p_bn,
1136 "p_bn mismatch.\nCalled at %s:%d\n", file, line);
1137 zassert_equal(pdu->llctrl.cis_req.c_bn, p->c_bn,
1138 "c_bn mismatch.\nCalled at %s:%d\n", file, line);
1139 zassert_equal(pdu->llctrl.cis_req.c_ft, p->c_ft,
1140 "c_ft mismatch.\nCalled at %s:%d\n", file, line);
1141 zassert_equal(pdu->llctrl.cis_req.p_ft, p->p_ft,
1142 "p_ft mismatch.\nCalled at %s:%d\n", file, line);
1143 zassert_equal(pdu->llctrl.cis_req.iso_interval, p->iso_interval,
1144 "iso_interval mismatch.\nCalled at %s:%d\n", file, line);
1145 zassert_equal(pdu->llctrl.cis_req.conn_event_count, p->conn_event_count,
1146 "conn_event_count mismatch.\nCalled at %s:%d\n", file, line);
1147 zassert_mem_equal(pdu->llctrl.cis_req.c_max_sdu_packed, p->c_max_sdu_packed,
1148 sizeof(p->c_max_sdu_packed),
1149 "c_max_sdu_packed mismatch.\nCalled at %s:%d\n", file, line);
1150 zassert_mem_equal(pdu->llctrl.cis_req.p_max_sdu, p->p_max_sdu,
1151 sizeof(p->p_max_sdu),
1152 "p_max_sdu mismatch.\nCalled at %s:%d\n", file, line);
1153 zassert_mem_equal(pdu->llctrl.cis_req.c_sdu_interval, p->c_sdu_interval,
1154 sizeof(p->c_sdu_interval),
1155 "c_sdu_interval mismatch.\nCalled at %s:%d\n", file, line);
1156 zassert_mem_equal(pdu->llctrl.cis_req.p_sdu_interval, p->p_sdu_interval,
1157 sizeof(p->p_sdu_interval),
1158 "p_sdu_interval mismatch.\nCalled at %s:%d\n", file, line);
1159 zassert_mem_equal(pdu->llctrl.cis_req.sub_interval, p->sub_interval,
1160 sizeof(p->sub_interval),
1161 "sub_interval mismatch.\nCalled at %s:%d\n", file, line);
1162 zassert_mem_equal(pdu->llctrl.cis_req.cis_offset_min, p->cis_offset_min,
1163 sizeof(p->cis_offset_min),
1164 "cis_offset_min mismatch.\nCalled at %s:%d\n", file, line);
1165 zassert_mem_equal(pdu->llctrl.cis_req.cis_offset_max, p->cis_offset_max,
1166 sizeof(p->cis_offset_max),
1167 "cis_offset_max mismatch.\nCalled at %s:%d\n", file, line);
1168 }
1169
helper_pdu_verify_cis_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1170 void helper_pdu_verify_cis_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1171 {
1172 struct pdu_data_llctrl_cis_rsp *p = param;
1173
1174 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1175 line);
1176 zassert_equal(pdu->len,
1177 offsetof(struct pdu_data_llctrl, cis_rsp) +
1178 sizeof(struct pdu_data_llctrl_cis_rsp),
1179 "Wrong length.\nCalled at %s:%d\n", file, line);
1180 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CIS_RSP,
1181 "Not a LL_CIS_RSP.\nCalled at %s:%d\n", file, line);
1182
1183 zassert_mem_equal(pdu->llctrl.cis_rsp.cis_offset_min, p->cis_offset_min,
1184 sizeof(p->cis_offset_min),
1185 "cis_offset_min mismatch.\nCalled at %s:%d\n", file, line);
1186 zassert_mem_equal(pdu->llctrl.cis_rsp.cis_offset_max, p->cis_offset_max,
1187 sizeof(p->cis_offset_max),
1188 "cis_offset_max mismatch.\nCalled at %s:%d\n", file, line);
1189 zassert_equal(pdu->llctrl.cis_rsp.conn_event_count, p->conn_event_count,
1190 "conn_event_count mismatch.\nCalled at %s:%d\n", file, line);
1191 }
1192
helper_pdu_verify_cis_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1193 void helper_pdu_verify_cis_ind(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1194 {
1195 struct pdu_data_llctrl_cis_ind *p = param;
1196
1197 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1198 line);
1199 zassert_equal(pdu->len,
1200 offsetof(struct pdu_data_llctrl, cis_ind) +
1201 sizeof(struct pdu_data_llctrl_cis_ind),
1202 "Wrong length.\nCalled at %s:%d\n", file, line);
1203 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CIS_IND,
1204 "Not a LL_CIS_IND.\nCalled at %s:%d\n", file, line);
1205
1206 zassert_mem_equal(pdu->llctrl.cis_ind.aa, p->aa, sizeof(p->aa),
1207 "aa mismatch.\nCalled at %s:%d\n", file, line);
1208 zassert_mem_equal(pdu->llctrl.cis_ind.cis_offset, p->cis_offset, sizeof(p->cis_offset),
1209 "cis_offset mismatch.\nCalled at %s:%d\n", file, line);
1210 zassert_mem_equal(pdu->llctrl.cis_ind.cig_sync_delay, p->cig_sync_delay,
1211 sizeof(p->cig_sync_delay),
1212 "cig_sync_delay mismatch.\nCalled at %s:%d\n", file, line);
1213 zassert_mem_equal(pdu->llctrl.cis_ind.cis_sync_delay, p->cis_sync_delay,
1214 sizeof(p->cis_sync_delay),
1215 "cis_sync_delay mismatch.\nCalled at %s:%d\n", file, line);
1216 zassert_equal(pdu->llctrl.cis_ind.conn_event_count, p->conn_event_count,
1217 "conn_event_count mismatch.\nCalled at %s:%d\n", file, line);
1218 }
1219
helper_pdu_verify_cis_terminate_ind(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1220 void helper_pdu_verify_cis_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
1221 void *param)
1222 {
1223 struct pdu_data_llctrl_cis_terminate_ind *p = param;
1224
1225 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1226 line);
1227 zassert_equal(pdu->len,
1228 offsetof(struct pdu_data_llctrl, cis_terminate_ind) +
1229 sizeof(struct pdu_data_llctrl_cis_terminate_ind),
1230 "Wrong length.\nCalled at %s:%d\n", file, line);
1231 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CIS_TERMINATE_IND,
1232 "Not a LL_CIS_TERMINATE_IND.\nCalled at %s:%d\n", file, line);
1233 zassert_equal(pdu->llctrl.cis_terminate_ind.cig_id, p->cig_id,
1234 "CIG ID mismatch.\nCalled at %s:%d\n", file, line);
1235 zassert_equal(pdu->llctrl.cis_terminate_ind.cis_id, p->cis_id,
1236 "CIS ID mismatch.\nCalled at %s:%d\n", file, line);
1237 zassert_equal(pdu->llctrl.cis_terminate_ind.error_code, p->error_code,
1238 "Error code mismatch.\nCalled at %s:%d\n", file, line);
1239 }
1240
helper_pdu_verify_sca_req(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1241 void helper_pdu_verify_sca_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1242 {
1243 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1244 line);
1245 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ,
1246 "Not a LL_CLOCK_ACCURACY_REQ. Called at %s:%d\n", file, line);
1247 }
1248
helper_pdu_verify_sca_rsp(const char * file,uint32_t line,struct pdu_data * pdu,void * param)1249 void helper_pdu_verify_sca_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param)
1250 {
1251 zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file,
1252 line);
1253 zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP,
1254 "Not a LL_CLOCK_ACCURACY_RSP.\nCalled at %s:%d\n", file, line);
1255 }
1256