summaryrefslogtreecommitdiff
path: root/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_supp_cmd.c
blob: cae9eb7dd158123dca67534aad7e3dd0434e7bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#include <stdint.h>
#include <string.h>

#include "nimble/ble.h"
#include "nimble/nimble_opt.h"
#include "nimble/hci_common.h"
#include "controller/ble_ll.h"
#include "controller/ble_ll_hci.h"

/* Octet 0 */
#define BLE_SUPP_CMD_DISCONNECT             (1 << 5)
#define BLE_LL_SUPP_CMD_OCTET_0             (BLE_SUPP_CMD_DISCONNECT)

/* Octet 5 */
#define BLE_SUPP_CMD_SET_EVENT_MASK         (1 << 6)
#define BLE_LL_SUPP_CMD_OCTET_5             (BLE_SUPP_CMD_SET_EVENT_MASK)

/* Octet 10 */
#define BLE_SUPP_CMD_RD_TX_PWR              (0 << 2)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_CTRL_TO_HOST_FLOW_CONTROL)
#define BLE_SUPP_CMD_SET_CTRL_TO_HOST_FLOW  (1 << 5)
#define BLE_SUPP_CMD_HOST_BUFFER_SIZE       (1 << 6)
#define BLE_SUPP_CMD_HOST_NUM_COMP_PACKETS  (1 << 7)
#else
#define BLE_SUPP_CMD_SET_CTRL_TO_HOST_FLOW  (0 << 5)
#define BLE_SUPP_CMD_HOST_BUFFER_SIZE       (0 << 6)
#define BLE_SUPP_CMD_HOST_NUM_COMP_PACKETS  (0 << 7)
#endif
#define BLE_LL_SUPP_CMD_OCTET_10            \
(                                           \
    BLE_SUPP_CMD_RD_TX_PWR              |   \
    BLE_SUPP_CMD_SET_CTRL_TO_HOST_FLOW  |   \
    BLE_SUPP_CMD_HOST_BUFFER_SIZE       |   \
    BLE_SUPP_CMD_HOST_NUM_COMP_PACKETS      \
)

/* Octet 14 */
#define BLE_SUPP_CMD_RD_LOC_VER             (1 << 3)
#define BLE_SUPP_CMD_RD_LOC_SUPP_FEAT       (1 << 5)
#define BLE_LL_SUPP_CMD_OCTET_14            \
(                                           \
    BLE_SUPP_CMD_RD_LOC_VER         |       \
    BLE_SUPP_CMD_RD_LOC_SUPP_FEAT           \
)

/* Octet 15 */
#define BLE_SUPP_CMD_RD_BD_ADDR             (1 << 1)
#define BLE_SUPP_CMD_RD_RSSI                (1 << 5)

#define BLE_LL_SUPP_CMD_OCTET_15            \
(                                           \
    BLE_SUPP_CMD_RD_BD_ADDR         |       \
    BLE_SUPP_CMD_RD_RSSI                    \
)

/* Octet 25 */
#define BLE_SUPP_CMD_LE_SET_EV_MASK         (1 << 0)
#define BLE_SUPP_CMD_LE_RD_BUF_SIZE         (1 << 1)
#define BLE_SUPP_CMD_LE_RD_LOC_FEAT         (1 << 2)
#define BLE_SUPP_CMD_LE_SET_RAND_ADDR       (1 << 4)
#define BLE_SUPP_CMD_LE_SET_ADV_PARAMS      (1 << 5)
#define BLE_SUPP_CMD_LE_SET_ADV_TX_PWR      (1 << 6)
#define BLE_SUPP_CMD_LE_SET_ADV_DATA        (1 << 7)

#define BLE_LL_SUPP_CMD_OCTET_25            \
(                                           \
    BLE_SUPP_CMD_LE_SET_EV_MASK     |       \
    BLE_SUPP_CMD_LE_RD_BUF_SIZE     |       \
    BLE_SUPP_CMD_LE_RD_LOC_FEAT     |       \
    BLE_SUPP_CMD_LE_SET_RAND_ADDR   |       \
    BLE_SUPP_CMD_LE_SET_ADV_PARAMS  |       \
    BLE_SUPP_CMD_LE_SET_ADV_TX_PWR  |       \
    BLE_SUPP_CMD_LE_SET_ADV_DATA            \
)

/* Octet 26 */
#define BLE_SUPP_CMD_LE_SET_SCAN_RSP_DATA   (1 << 0)
#define BLE_SUPP_CMD_LE_SET_ADV_ENABLE      (1 << 1)
#define BLE_SUPP_CMD_LE_SET_SCAN_PARAMS     (1 << 2)
#define BLE_SUPP_CMD_LE_SET_SCAN_ENABLE     (1 << 3)
#define BLE_SUPP_CMD_LE_CREATE_CONN         (1 << 4)
#define BLE_SUPP_CMD_LE_CREATE_CONN_CANCEL  (1 << 5)
#define BLE_SUPP_CMD_LE_RD_WHITELIST_SIZE   (1 << 6)
#define BLE_SUPP_CMD_LE_CLR_WHITELIST       (1 << 7)

#define BLE_LL_SUPP_CMD_OCTET_26            \
(                                           \
    BLE_SUPP_CMD_LE_SET_SCAN_RSP_DATA   |   \
    BLE_SUPP_CMD_LE_SET_ADV_ENABLE      |   \
    BLE_SUPP_CMD_LE_SET_SCAN_PARAMS     |   \
    BLE_SUPP_CMD_LE_SET_SCAN_ENABLE     |   \
    BLE_SUPP_CMD_LE_CREATE_CONN         |   \
    BLE_SUPP_CMD_LE_CREATE_CONN_CANCEL  |   \
    BLE_SUPP_CMD_LE_RD_WHITELIST_SIZE   |   \
    BLE_SUPP_CMD_LE_CLR_WHITELIST           \
)

/* Octet 27 */
#define BLE_SUPP_CMD_LE_ADD_DEV_WHITELIST   (1 << 0)
#define BLE_SUPP_CMD_LE_RMV_DEV_WHITELIST   (1 << 1)
#define BLE_SUPP_CMD_LE_CONN_UPDATE         (1 << 2)
#define BLE_SUPP_CMD_LE_SET_HOST_CHAN_CLASS (1 << 3)
#define BLE_SUPP_CMD_LE_RD_CHAN_MAP         (1 << 4)
#define BLE_SUPP_CMD_LE_RD_REM_USED_FEAT    (1 << 5)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
#define BLE_SUPP_CMD_LE_ENCRYPT             (1 << 6)
#else
#define BLE_SUPP_CMD_LE_ENCRYPT             (0 << 6)
#endif
#define BLE_SUPP_CMD_LE_RAND                (1 << 7)

#define BLE_LL_SUPP_CMD_OCTET_27            \
(                                           \
    BLE_SUPP_CMD_LE_ENCRYPT             |   \
    BLE_SUPP_CMD_LE_RAND                |   \
    BLE_SUPP_CMD_LE_ADD_DEV_WHITELIST   |   \
    BLE_SUPP_CMD_LE_RMV_DEV_WHITELIST   |   \
    BLE_SUPP_CMD_LE_CONN_UPDATE         |   \
    BLE_SUPP_CMD_LE_SET_HOST_CHAN_CLASS |   \
    BLE_SUPP_CMD_LE_RD_CHAN_MAP         |   \
    BLE_SUPP_CMD_LE_RD_REM_USED_FEAT        \
)

/* Octet 28 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
#define BLE_SUPP_CMD_LE_START_ENCRYPT       (1 << 0)
#define BLE_SUPP_CMD_LE_LTK_REQ_REPLY       (1 << 1)
#define BLE_SUPP_CMD_LE_LTK_REQ_NEG_REPLY   (1 << 2)
#else
#define BLE_SUPP_CMD_LE_START_ENCRYPT       (0 << 0)
#define BLE_SUPP_CMD_LE_LTK_REQ_REPLY       (0 << 1)
#define BLE_SUPP_CMD_LE_LTK_REQ_NEG_REPLY   (0 << 2)
#endif
#define BLE_SUPP_CMD_LE_READ_SUPP_STATES    (1 << 3)

#if MYNEWT_VAL(BLE_LL_DTM)
#define BLE_SUPP_CMD_LE_RX_TEST             (1 << 4)
#define BLE_SUPP_CMD_LE_TX_TEST             (1 << 5)
#define BLE_SUPP_CMD_LE_TEST_END            (1 << 6)

#else
#define BLE_SUPP_CMD_LE_RX_TEST             (0 << 4)
#define BLE_SUPP_CMD_LE_TX_TEST             (0 << 5)
#define BLE_SUPP_CMD_LE_TEST_END            (0 << 6)
#endif

#define BLE_LL_SUPP_CMD_OCTET_28            \
(                                           \
    BLE_SUPP_CMD_LE_START_ENCRYPT       |   \
    BLE_SUPP_CMD_LE_LTK_REQ_REPLY       |   \
    BLE_SUPP_CMD_LE_LTK_REQ_NEG_REPLY   |   \
    BLE_SUPP_CMD_LE_READ_SUPP_STATES    |   \
    BLE_SUPP_CMD_LE_RX_TEST             |   \
    BLE_SUPP_CMD_LE_TX_TEST             |   \
    BLE_SUPP_CMD_LE_TEST_END                \
)

/* Octet 33 */
#define BLE_SUPP_CMD_LE_REM_CONN_PRR        (1 << 4)
#define BLE_SUPP_CMD_LE_REM_CONN_PRNR       (1 << 5)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_DATA_LEN_EXT)
#define BLE_SUPP_CMD_LE_SET_DATALEN         (1 << 6)
#define BLE_SUPP_CMD_LE_RD_SUGG_DATALEN     (1 << 7)
#else
#define BLE_SUPP_CMD_LE_SET_DATALEN         (0 << 6)
#define BLE_SUPP_CMD_LE_RD_SUGG_DATALEN     (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_33            \
(                                           \
    BLE_SUPP_CMD_LE_REM_CONN_PRR        |   \
    BLE_SUPP_CMD_LE_REM_CONN_PRNR       |   \
    BLE_SUPP_CMD_LE_SET_DATALEN         |   \
    BLE_SUPP_CMD_LE_RD_SUGG_DATALEN         \
)

/* Octet 34 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_DATA_LEN_EXT)
#define BLE_SUPP_CMD_LE_WR_SUGG_DATALEN     (1 << 0)
#else
#define BLE_SUPP_CMD_LE_WR_SUGG_DATALEN     (0 << 0)
#endif
#define BLE_SUPP_CMD_LE_READ_LOCAL_P256_PK  (0 << 1)
#define BLE_SUPP_CMD_LE_GENERATE_DH_KEY     (0 << 2)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
#define BLE_SUPP_CMD_LE_ADD_RESOLV_LIST     (1 << 3)
#define BLE_SUPP_CMD_LE_REMOVE_RESOLV_LIST  (1 << 4)
#define BLE_SUPP_CMD_LE_CLEAR_RESOLV_LIST   (1 << 5)
#define BLE_SUPP_CMD_LE_RD_RESOLV_SIZE      (1 << 6)
#define BLE_SUPP_CMD_LE_RD_PEER_RESV_ADDR   (1 << 7)
#else
#define BLE_SUPP_CMD_LE_ADD_RESOLV_LIST     (0 << 3)
#define BLE_SUPP_CMD_LE_REMOVE_RESOLV_LIST  (0 << 4)
#define BLE_SUPP_CMD_LE_CLEAR_RESOLV_LIST   (0 << 5)
#define BLE_SUPP_CMD_LE_RD_RESOLV_SIZE      (0 << 6)
#define BLE_SUPP_CMD_LE_RD_PEER_RESV_ADDR   (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_34            \
(                                           \
    BLE_SUPP_CMD_LE_WR_SUGG_DATALEN     |   \
    BLE_SUPP_CMD_LE_READ_LOCAL_P256_PK  |   \
    BLE_SUPP_CMD_LE_GENERATE_DH_KEY     |   \
    BLE_SUPP_CMD_LE_ADD_RESOLV_LIST     |   \
    BLE_SUPP_CMD_LE_REMOVE_RESOLV_LIST  |   \
    BLE_SUPP_CMD_LE_CLEAR_RESOLV_LIST   |   \
    BLE_SUPP_CMD_LE_RD_RESOLV_SIZE      |   \
    BLE_SUPP_CMD_LE_RD_PEER_RESV_ADDR       \
)

/* Octet 35 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
#define BLE_SUPP_CMD_LE_RD_LOCAL_RESV_ADDR  (1 << 0)
#define BLE_SUPP_CMD_LE_SET_ADDR_RES_EN     (1 << 1)
#define BLE_SUPP_CMD_LE_SET_RESV_ADDR_TMO   (1 << 2)
#else
#define BLE_SUPP_CMD_LE_RD_LOCAL_RESV_ADDR  (0 << 0)
#define BLE_SUPP_CMD_LE_SET_ADDR_RES_EN     (0 << 1)
#define BLE_SUPP_CMD_LE_SET_RESV_ADDR_TMO   (0 << 2)
#endif
#define BLE_SUPP_CMD_LE_RD_MAX_DATALEN      (1 << 3)
#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
#define BLE_SUPP_CMD_LE_READ_PHY            (1 << 4)
#define BLE_SUPP_CMD_LE_SET_DEFAULT_PHY     (1 << 5)
#define BLE_SUPP_CMD_LE_SET_PHY             (1 << 6)
#else
#define BLE_SUPP_CMD_LE_READ_PHY            (0 << 4)
#define BLE_SUPP_CMD_LE_SET_DEFAULT_PHY     (0 << 5)
#define BLE_SUPP_CMD_LE_SET_PHY             (0 << 6)
#endif

#if MYNEWT_VAL(BLE_LL_DTM)
#define BLE_SUPP_CMD_LE_ENHANCED_RX_TEST    (1 << 7)
#else
#define BLE_SUPP_CMD_LE_ENHANCED_RX_TEST    (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_35            \
(                                           \
    BLE_SUPP_CMD_LE_RD_LOCAL_RESV_ADDR  |   \
    BLE_SUPP_CMD_LE_SET_ADDR_RES_EN     |   \
    BLE_SUPP_CMD_LE_SET_RESV_ADDR_TMO   |   \
    BLE_SUPP_CMD_LE_RD_MAX_DATALEN      |   \
    BLE_SUPP_CMD_LE_READ_PHY            |   \
    BLE_SUPP_CMD_LE_SET_DEFAULT_PHY     |   \
    BLE_SUPP_CMD_LE_SET_PHY             |   \
    BLE_SUPP_CMD_LE_ENHANCED_RX_TEST        \
)

/* Octet 36 */
#if MYNEWT_VAL(BLE_LL_DTM)
#define BLE_SUPP_CMD_LE_ENHANCED_TX_TEST    (1 << 0)
#else
#define BLE_SUPP_CMD_LE_ENHANCED_TX_TEST    (0 << 0)
#endif

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
#define BLE_SUPP_CMD_LE_SET_ADVS_RAND_ADDR  (1 << 1)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_PARAM   (1 << 2)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_DATA    (1 << 3)
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_RSP    (1 << 4)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_ENABLE  (1 << 5)
#define BLE_SUPP_CMD_LE_RD_MAX_ADV_DATA_LEN (1 << 6)
#define BLE_SUPP_CMD_LE_RD_NUM_SUPP_ADVS    (1 << 7)
#else
#define BLE_SUPP_CMD_LE_SET_ADVS_RAND_ADDR  (0 << 1)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_PARAM   (0 << 2)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_DATA    (0 << 3)
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_RSP    (0 << 4)
#define BLE_SUPP_CMD_LE_SET_EXT_ADV_ENABLE  (0 << 5)
#define BLE_SUPP_CMD_LE_RD_MAX_ADV_DATA_LEN (0 << 6)
#define BLE_SUPP_CMD_LE_RD_NUM_SUPP_ADVS    (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_36            \
(                                           \
    BLE_SUPP_CMD_LE_ENHANCED_TX_TEST    |   \
    BLE_SUPP_CMD_LE_SET_ADVS_RAND_ADDR  |   \
    BLE_SUPP_CMD_LE_SET_EXT_ADV_PARAM   |   \
    BLE_SUPP_CMD_LE_SET_EXT_ADV_DATA    |   \
    BLE_SUPP_CMD_LE_SET_EXT_SCAN_RSP    |   \
    BLE_SUPP_CMD_LE_SET_EXT_ADV_ENABLE  |   \
    BLE_SUPP_CMD_LE_RD_MAX_ADV_DATA_LEN |   \
    BLE_SUPP_CMD_LE_RD_NUM_SUPP_ADVS        \
)

/* Octet 37 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
#define BLE_SUPP_CMD_LE_REMOVE_ADVS         (1 << 0)
#define BLE_SUPP_CMD_LE_CLEAR_ADVS          (1 << 1)
#else
#define BLE_SUPP_CMD_LE_REMOVE_ADVS         (0 << 0)
#define BLE_SUPP_CMD_LE_CLEAR_ADVS          (0 << 1)
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV)
#define BLE_SUPP_CMD_LE_SET_PADV_PARAM      (1 << 2)
#define BLE_SUPP_CMD_LE_SET_PADV_DATA       (1 << 3)
#define BLE_SUPP_CMD_LE_SET_PADV_ENABLE     (1 << 4)
#else
#define BLE_SUPP_CMD_LE_SET_PADV_PARAM      (0 << 2)
#define BLE_SUPP_CMD_LE_SET_PADV_DATA       (0 << 3)
#define BLE_SUPP_CMD_LE_SET_PADV_ENABLE     (0 << 4)
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_PARAM  (1 << 5)
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_ENABLE (1 << 6)
#define BLE_SUPP_CMD_LE_EXT_CREATE_CONN     (1 << 7)
#else
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_PARAM  (0 << 5)
#define BLE_SUPP_CMD_LE_SET_EXT_SCAN_ENABLE (0 << 6)
#define BLE_SUPP_CMD_LE_EXT_CREATE_CONN     (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_37            \
(                                           \
    BLE_SUPP_CMD_LE_REMOVE_ADVS         |   \
    BLE_SUPP_CMD_LE_CLEAR_ADVS          |   \
    BLE_SUPP_CMD_LE_SET_PADV_PARAM      |   \
    BLE_SUPP_CMD_LE_SET_PADV_DATA       |   \
    BLE_SUPP_CMD_LE_SET_PADV_ENABLE     |   \
    BLE_SUPP_CMD_LE_SET_EXT_SCAN_PARAM  |   \
    BLE_SUPP_CMD_LE_SET_EXT_SCAN_ENABLE |   \
    BLE_SUPP_CMD_LE_EXT_CREATE_CONN         \
)

/* Octet 38 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV)
#define BLE_SUPP_CMD_LE_PADV_CREATE_SYNC    (1 << 0)
#define BLE_SUPP_CMD_LE_PADV_CREATE_SYNC_C  (1 << 1)
#define BLE_SUPP_CMD_LE_PADV_TERMINATE_SYNC (1 << 2)
#define BLE_SUPP_CMD_LE_ADD_PADV_LIST       (1 << 3)
#define BLE_SUPP_CMD_LE_REMOVE_PADV_LIST    (1 << 4)
#define BLE_SUPP_CMD_LE_CLEAR_PADV_LIST     (1 << 5)
#define BLE_SUPP_CMD_LE_RD_PADV_LIST_SIZE   (1 << 6)
#else
#define BLE_SUPP_CMD_LE_PADV_CREATE_SYNC    (0 << 0)
#define BLE_SUPP_CMD_LE_PADV_CREATE_SYNC_C  (0 << 1)
#define BLE_SUPP_CMD_LE_PADV_TERMINATE_SYNC (0 << 2)
#define BLE_SUPP_CMD_LE_ADD_PADV_LIST       (0 << 3)
#define BLE_SUPP_CMD_LE_REMOVE_PADV_LIST    (0 << 4)
#define BLE_SUPP_CMD_LE_CLEAR_PADV_LIST     (0 << 5)
#define BLE_SUPP_CMD_LE_RD_PADV_LIST_SIZE   (0 << 6)
#endif
#define BLE_SUPP_CMD_LE_RD_TX_POWER         (1 << 7)

#define BLE_LL_SUPP_CMD_OCTET_38            \
(                                           \
    BLE_SUPP_CMD_LE_PADV_CREATE_SYNC    |   \
    BLE_SUPP_CMD_LE_PADV_CREATE_SYNC_C  |   \
    BLE_SUPP_CMD_LE_PADV_TERMINATE_SYNC |   \
    BLE_SUPP_CMD_LE_ADD_PADV_LIST       |   \
    BLE_SUPP_CMD_LE_REMOVE_PADV_LIST    |   \
    BLE_SUPP_CMD_LE_CLEAR_PADV_LIST     |   \
    BLE_SUPP_CMD_LE_RD_PADV_LIST_SIZE   |   \
    BLE_SUPP_CMD_LE_RD_TX_POWER             \
)

/* Octet 39 */
#define BLE_SUPP_CMD_LE_RD_RF_PATH_COMP     (1 << 0)
#define BLE_SUPP_CMD_LE_WR_RF_PATH_COMP     (1 << 1)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
#define BLE_SUPP_CMD_LE_SET_PRIVACY_MODE    (1 << 2)
#else
#define BLE_SUPP_CMD_LE_SET_PRIVACY_MODE    (0 << 2)
#endif

#define BLE_LL_SUPP_CMD_OCTET_39            \
(                                           \
    BLE_SUPP_CMD_LE_RD_RF_PATH_COMP     |   \
    BLE_SUPP_CMD_LE_WR_RF_PATH_COMP     |   \
    BLE_SUPP_CMD_LE_SET_PRIVACY_MODE        \
)

/* Octet 40 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV) && MYNEWT_VAL(BLE_VERSION) >= 51
#define BLE_SUPP_CMD_LE_PADV_RECV_ENABLE (1 << 5)
#else
#define BLE_SUPP_CMD_LE_PADV_RECV_ENABLE (0 << 5)
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
#define BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER (1 << 6)
#define BLE_SUPP_CMD_LE_PADV_SET_INFO_TRANSFER (1 << 7)
#else
#define BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER (0 << 6)
#define BLE_SUPP_CMD_LE_PADV_SET_INFO_TRANSFER (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_40             \
(                                            \
    BLE_SUPP_CMD_LE_PADV_RECV_ENABLE       | \
    BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER     | \
    BLE_SUPP_CMD_LE_PADV_SET_INFO_TRANSFER   \
)

/* Octet 41 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
#define BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER_PARAMS (1 << 0)
#define BLE_SUPP_CMD_LE_PADV_DEFAULT_SYNC_TRANSFER_PARAMS (1 << 1)
#else
#define BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER_PARAMS (0 << 0)
#define BLE_SUPP_CMD_LE_PADV_DEFAULT_SYNC_TRANSFER_PARAMS (0 << 1)
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#define BLE_SUPP_CMD_LE_READ_BUF_SIZE_V2    (1 << 5)
#define BLE_SUPP_CMD_LE_READ_ISO_TX_SYNC    (1 << 6)
#define BLE_SUPP_CMD_LE_SET_CIG_PARAM       (1 << 7)
#else
#define BLE_SUPP_CMD_LE_READ_BUF_SIZE_V2    (0 << 5)
#define BLE_SUPP_CMD_LE_READ_ISO_TX_SYNC    (0 << 6)
#define BLE_SUPP_CMD_LE_SET_CIG_PARAM       (0 << 7)
#endif

#define BLE_LL_SUPP_CMD_OCTET_41                        \
(                                                       \
    BLE_SUPP_CMD_LE_PADV_SYNC_TRANSFER_PARAMS         | \
    BLE_SUPP_CMD_LE_PADV_DEFAULT_SYNC_TRANSFER_PARAMS | \
    BLE_SUPP_CMD_LE_READ_BUF_SIZE_V2                  | \
    BLE_SUPP_CMD_LE_READ_ISO_TX_SYNC                  | \
    BLE_SUPP_CMD_LE_SET_CIG_PARAM                       \
)

/* Octet 42 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#define BLE_SUPP_CMD_LE_SET_CIG_PARAM_TEST  (1 << 0)
#define BLE_SUPP_CMD_LE_CREATE_CIS          (1 << 1)
#define BLE_SUPP_CMD_LE_REMOVE_CIG          (1 << 2)
#define BLE_SUPP_CMD_LE_ACCEPT_CIS_REQ      (1 << 3)
#define BLE_SUPP_CMD_LE_REJECT_CIS_REQ      (1 << 4)
#define BLE_SUPP_CMD_LE_CREATE_BIG          (1 << 5)
#define BLE_SUPP_CMD_LE_CREATE_BIG_TEST     (1 << 6)
#define BLE_SUPP_CMD_LE_TERMINATE_BIG       (1 << 7)
#else
#define BLE_SUPP_CMD_LE_SET_CIG_PARAM_TEST  (0 << 0)
#define BLE_SUPP_CMD_LE_CREATE_CIS          (0 << 1)
#define BLE_SUPP_CMD_LE_REMOVE_CIG          (0 << 2)
#define BLE_SUPP_CMD_LE_ACCEPT_CIS_REQ      (0 << 3)
#define BLE_SUPP_CMD_LE_REJECT_CIS_REQ      (0 << 4)
#define BLE_SUPP_CMD_LE_CREATE_BIG          (0 << 5)
#define BLE_SUPP_CMD_LE_CREATE_BIG_TEST     (0 << 6)
#define BLE_SUPP_CMD_LE_TERMINATE_BIG       (0 << 7)
#endif
#define BLE_LL_SUPP_CMD_OCTET_42         \
(                                        \
    BLE_SUPP_CMD_LE_SET_CIG_PARAM_TEST | \
    BLE_SUPP_CMD_LE_CREATE_CIS         | \
    BLE_SUPP_CMD_LE_REMOVE_CIG         | \
    BLE_SUPP_CMD_LE_ACCEPT_CIS_REQ     | \
    BLE_SUPP_CMD_LE_REJECT_CIS_REQ     | \
    BLE_SUPP_CMD_LE_CREATE_BIG         | \
    BLE_SUPP_CMD_LE_CREATE_BIG_TEST    | \
    BLE_SUPP_CMD_LE_TERMINATE_BIG        \
)

/* Octet 43 */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_SCA_UPDATE)
#define BLE_SUPP_CMD_LE_REQUEST_PEER_SCA (1 << 2)
#else
#define BLE_SUPP_CMD_LE_REQUEST_PEER_SCA (0 << 0)
#endif
#define BLE_LL_SUPP_CMD_OCTET_43                        \
(                                                       \
    BLE_SUPP_CMD_LE_REQUEST_PEER_SCA  \
)

/* Octet 44 */
#if MYNEWT_VAL(BLE_VERSION) >= 52
#define BLE_SUPP_CMD_LE_SET_HOST_FEATURE (1 << 0)
#else
#define BLE_SUPP_CMD_LE_SET_HOST_FEATURE (0 << 0)
#endif
#define BLE_LL_SUPP_CMD_OCTET_44                        \
(                                                       \
    BLE_SUPP_CMD_LE_SET_HOST_FEATURE  \
)

/* Defines the array of supported commands */
const uint8_t g_ble_ll_supp_cmds[BLE_LL_SUPP_CMD_LEN] =
{
    BLE_LL_SUPP_CMD_OCTET_0,            /* Octet 0 */
    0,
    0,
    0,
    0,
    BLE_LL_SUPP_CMD_OCTET_5,
    0,
    0,
    0,                                  /* Octet 8 */
    0,
    BLE_LL_SUPP_CMD_OCTET_10,
    0,
    0,
    0,
    BLE_LL_SUPP_CMD_OCTET_14,
    BLE_LL_SUPP_CMD_OCTET_15,
    0,                                  /* Octet 16 */
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,                                 /* Octet 24 */
    BLE_LL_SUPP_CMD_OCTET_25,
    BLE_LL_SUPP_CMD_OCTET_26,
    BLE_LL_SUPP_CMD_OCTET_27,
    BLE_LL_SUPP_CMD_OCTET_28,
    0,
    0,
    0,
    0,                                  /* Octet 32 */
    BLE_LL_SUPP_CMD_OCTET_33,
    BLE_LL_SUPP_CMD_OCTET_34,
    BLE_LL_SUPP_CMD_OCTET_35,
    BLE_LL_SUPP_CMD_OCTET_36,
    BLE_LL_SUPP_CMD_OCTET_37,
    BLE_LL_SUPP_CMD_OCTET_38,
    BLE_LL_SUPP_CMD_OCTET_39,
    BLE_LL_SUPP_CMD_OCTET_40,           /* Octet 40 */
    BLE_LL_SUPP_CMD_OCTET_41,
    BLE_LL_SUPP_CMD_OCTET_42,
    BLE_LL_SUPP_CMD_OCTET_43,
    BLE_LL_SUPP_CMD_OCTET_44,
};