LCOV - code coverage report
Current view: top level - zephyr/bluetooth - hci_types.h Hit Total Coverage
Test: new.info Lines: 12 2919 0.4 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           0 : /* hci.h - Bluetooth Host Control Interface types */
       2             : 
       3             : /*
       4             :  * Copyright (c) 2015-2016 Intel Corporation
       5             :  * Copyright (c) 2023 Nordic Semiconductor ASA
       6             :  *
       7             :  * SPDX-License-Identifier: Apache-2.0
       8             :  */
       9             : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_
      10             : #define ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_
      11             : 
      12             : #include <stdbool.h>
      13             : #include <stdint.h>
      14             : #include <string.h>
      15             : 
      16             : #include <zephyr/toolchain.h>
      17             : #include <zephyr/types.h>
      18             : #include <zephyr/sys/util.h>
      19             : #include <zephyr/bluetooth/addr.h>
      20             : 
      21             : #ifdef __cplusplus
      22             : extern "C" {
      23             : #endif
      24             : 
      25             : /* Bluetooth spec v5.4 Vol 4, Part A Table 2.1: HCI packet indicators
      26             :  * The following definitions are intended for use with the UART Transport Layer and
      27             :  * may be reused with other transport layers if desired.
      28             :  */
      29           0 : #define BT_HCI_H4_NONE                  0x00    /* None of the known packet types */
      30           0 : #define BT_HCI_H4_CMD                   0x01    /* HCI Command packet */
      31           0 : #define BT_HCI_H4_ACL                   0x02    /* HCI ACL Data packet */
      32           0 : #define BT_HCI_H4_SCO                   0x03    /* HCI Synchronous Data packet */
      33           0 : #define BT_HCI_H4_EVT                   0x04    /* HCI Event packet */
      34           0 : #define BT_HCI_H4_ISO                   0x05    /* HCI ISO Data packet */
      35             : 
      36           0 : #define BT_HCI_OWN_ADDR_PUBLIC          0x00
      37           0 : #define BT_HCI_OWN_ADDR_RANDOM          0x01
      38           0 : #define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC   0x02
      39           0 : #define BT_HCI_OWN_ADDR_RPA_OR_RANDOM   0x03
      40           0 : #define BT_HCI_OWN_ADDR_RPA_MASK        0x02
      41             : 
      42           0 : #define BT_HCI_PEER_ADDR_RPA_UNRESOLVED 0xfe
      43           0 : #define BT_HCI_PEER_ADDR_ANONYMOUS      0xff
      44             : 
      45           0 : #define BT_ENC_KEY_SIZE_MIN             0x07
      46           0 : #define BT_ENC_KEY_SIZE_MAX             0x10
      47             : 
      48           0 : #define BT_HCI_ADV_HANDLE_INVALID       0xff
      49           0 : #define BT_HCI_SYNC_HANDLE_INVALID      0xffff
      50           0 : #define BT_HCI_PAWR_SUBEVENT_MAX        128
      51             : 
      52             : /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.3 HCI Synchronous Data Packets */
      53           0 : struct bt_hci_sco_hdr {
      54           0 :         uint16_t handle; /* 12 bit handle, 2 bit Packet Status Flag, 1 bit RFU */
      55           0 :         uint8_t  len;
      56             : } __packed;
      57           0 : #define BT_HCI_SCO_HDR_SIZE             3
      58             : 
      59             : /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.4 HCI Event Packet */
      60           0 : struct bt_hci_evt_hdr {
      61           0 :         uint8_t  evt;
      62           0 :         uint8_t  len;
      63             : } __packed;
      64           0 : #define BT_HCI_EVT_HDR_SIZE             2
      65             : 
      66           0 : #define BT_ACL_START_NO_FLUSH           0x00
      67           0 : #define BT_ACL_CONT                     0x01
      68           0 : #define BT_ACL_START                    0x02
      69           0 : #define BT_ACL_COMPLETE                 0x03
      70             : 
      71           0 : #define BT_ACL_POINT_TO_POINT           0x00
      72           0 : #define BT_ACL_BROADCAST                0x01
      73             : 
      74           0 : #define BT_ACL_HANDLE_MASK              BIT_MASK(12)
      75             : 
      76           0 : #define bt_acl_handle(h)                ((h) & BT_ACL_HANDLE_MASK)
      77           0 : #define bt_acl_flags(h)                 ((h) >> 12)
      78           0 : #define bt_acl_flags_pb(f)              ((f) & BIT_MASK(2))
      79           0 : #define bt_acl_flags_bc(f)              ((f) >> 2)
      80           0 : #define bt_acl_handle_pack(h, f)        ((h) | ((f) << 12))
      81             : 
      82             : /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.2 ACL Data Packets */
      83           0 : struct bt_hci_acl_hdr {
      84           0 :         uint16_t handle;
      85           0 :         uint16_t len;
      86             : } __packed;
      87           0 : #define BT_HCI_ACL_HDR_SIZE             4
      88             : 
      89           0 : #define BT_ISO_START                    0x00
      90           0 : #define BT_ISO_CONT                     0x01
      91           0 : #define BT_ISO_SINGLE                   0x02
      92           0 : #define BT_ISO_END                      0x03
      93             : 
      94           0 : #define bt_iso_handle(h)                ((h) & 0x0fff)
      95           0 : #define bt_iso_flags(h)                 ((h) >> 12)
      96           0 : #define bt_iso_flags_pb(f)              ((f) & 0x0003)
      97           0 : #define bt_iso_flags_ts(f)              (((f) >> 2) & 0x0001)
      98           0 : #define bt_iso_pack_flags(pb, ts) \
      99             :         (((pb) & 0x0003) | (((ts) & 0x0001) << 2))
     100           0 : #define bt_iso_handle_pack(h, pb, ts) \
     101             :         ((h) | (bt_iso_pack_flags(pb, ts) << 12))
     102           0 : #define bt_iso_hdr_len(h)                ((h) & BIT_MASK(14))
     103             : 
     104           0 : #define BT_ISO_DATA_VALID                0x00
     105           0 : #define BT_ISO_DATA_INVALID              0x01
     106           0 : #define BT_ISO_DATA_NOP                  0x02
     107             : 
     108           0 : #define bt_iso_pkt_len(h)                ((h) & BIT_MASK(12))
     109           0 : #define bt_iso_pkt_flags(h)              ((h) >> 14)
     110           0 : #define bt_iso_pkt_len_pack(h, f)        (((h) & BIT_MASK(12)) | ((f) << 14))
     111             : 
     112           0 : struct bt_hci_iso_sdu_hdr {
     113           0 :         uint16_t sn;
     114           0 :         uint16_t slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */
     115             : } __packed;
     116           0 : #define BT_HCI_ISO_SDU_HDR_SIZE          4
     117             : 
     118           0 : struct bt_hci_iso_sdu_ts_hdr {
     119           0 :         uint32_t ts;
     120           0 :         struct bt_hci_iso_sdu_hdr sdu;
     121             : } __packed;
     122           0 : #define BT_HCI_ISO_SDU_TS_HDR_SIZE       8
     123             : 
     124             : /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.5 HCI ISO Data Packets */
     125           0 : struct bt_hci_iso_hdr {
     126           0 :         uint16_t handle; /* 12 bit handle, 2 bit PB flags, 1 bit TS_Flag, 1 bit RFU */
     127           0 :         uint16_t len; /* 14 bits, 2 bits RFU */
     128             : } __packed;
     129           0 : #define BT_HCI_ISO_HDR_SIZE             4
     130             : 
     131             : /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.1 HCI Command Packet */
     132           0 : struct bt_hci_cmd_hdr {
     133           0 :         uint16_t opcode;
     134           0 :         uint8_t  param_len;
     135             : } __packed;
     136           0 : #define BT_HCI_CMD_HDR_SIZE             3
     137             : 
     138             : /* Supported Commands */
     139           0 : #define BT_CMD_TEST(cmd, octet, bit)            (cmd[octet] & BIT(bit))
     140           0 : #define BT_CMD_LE_STATES(cmd)                   BT_CMD_TEST(cmd, 28, 3)
     141             : 
     142           0 : #define BT_FEAT_TEST(feat, page, octet, bit)    (feat[page][octet] & BIT(bit))
     143             : 
     144           0 : #define BT_FEAT_BREDR(feat)                     !BT_FEAT_TEST(feat, 0, 4, 5)
     145           0 : #define BT_FEAT_LE(feat)                        BT_FEAT_TEST(feat, 0, 4, 6)
     146           0 : #define BT_FEAT_EXT_FEATURES(feat)              BT_FEAT_TEST(feat, 0, 7, 7)
     147           0 : #define BT_FEAT_HOST_SSP(feat)                  BT_FEAT_TEST(feat, 1, 0, 0)
     148           0 : #define BT_FEAT_SC(feat)                        BT_FEAT_TEST(feat, 2, 1, 0)
     149             : 
     150           0 : #define BT_FEAT_LMP_SCO_CAPABLE(feat)           BT_FEAT_TEST(feat, 0, 1, 3)
     151           0 : #define BT_FEAT_LMP_ESCO_CAPABLE(feat)          BT_FEAT_TEST(feat, 0, 3, 7)
     152           0 : #define BT_FEAT_HV2_PKT(feat)                   BT_FEAT_TEST(feat, 0, 1, 4)
     153           0 : #define BT_FEAT_HV3_PKT(feat)                   BT_FEAT_TEST(feat, 0, 1, 5)
     154           0 : #define BT_FEAT_EV4_PKT(feat)                   BT_FEAT_TEST(feat, 0, 4, 0)
     155           0 : #define BT_FEAT_EV5_PKT(feat)                   BT_FEAT_TEST(feat, 0, 4, 1)
     156           0 : #define BT_FEAT_2EV3_PKT(feat)                  BT_FEAT_TEST(feat, 0, 5, 5)
     157           0 : #define BT_FEAT_3EV3_PKT(feat)                  BT_FEAT_TEST(feat, 0, 5, 6)
     158           0 : #define BT_FEAT_3SLOT_PKT(feat)                 BT_FEAT_TEST(feat, 0, 5, 7)
     159             : 
     160             : /* LE features */
     161           0 : #define BT_LE_FEAT_BIT_ENC                      0
     162           0 : #define BT_LE_FEAT_BIT_CONN_PARAM_REQ           1
     163           0 : #define BT_LE_FEAT_BIT_EXT_REJ_IND              2
     164           0 : #define BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG       3
     165           0 : #define BT_LE_FEAT_BIT_PING                     4
     166           0 : #define BT_LE_FEAT_BIT_DLE                      5
     167           0 : #define BT_LE_FEAT_BIT_PRIVACY                  6
     168           0 : #define BT_LE_FEAT_BIT_EXT_SCAN                 7
     169           0 : #define BT_LE_FEAT_BIT_PHY_2M                   8
     170           0 : #define BT_LE_FEAT_BIT_SMI_TX                   9
     171           0 : #define BT_LE_FEAT_BIT_SMI_RX                   10
     172           0 : #define BT_LE_FEAT_BIT_PHY_CODED                11
     173           0 : #define BT_LE_FEAT_BIT_EXT_ADV                  12
     174           0 : #define BT_LE_FEAT_BIT_PER_ADV                  13
     175           0 : #define BT_LE_FEAT_BIT_CHAN_SEL_ALGO_2          14
     176           0 : #define BT_LE_FEAT_BIT_PWR_CLASS_1              15
     177           0 : #define BT_LE_FEAT_BIT_MIN_USED_CHAN_PROC       16
     178           0 : #define BT_LE_FEAT_BIT_CONN_CTE_REQ             17
     179           0 : #define BT_LE_FEAT_BIT_CONN_CTE_RESP            18
     180           0 : #define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX    19
     181           0 : #define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX    20
     182           0 : #define BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD        21
     183           0 : #define BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA        22
     184           0 : #define BT_LE_FEAT_BIT_RX_CTE                   23
     185           0 : #define BT_LE_FEAT_BIT_PAST_SEND                24
     186           0 : #define BT_LE_FEAT_BIT_PAST_RECV                25
     187           0 : #define BT_LE_FEAT_BIT_SCA_UPDATE               26
     188           0 : #define BT_LE_FEAT_BIT_REMOTE_PUB_KEY_VALIDATE  27
     189           0 : #define BT_LE_FEAT_BIT_CIS_CENTRAL              28
     190           0 : #define BT_LE_FEAT_BIT_CIS_PERIPHERAL           29
     191           0 : #define BT_LE_FEAT_BIT_ISO_BROADCASTER          30
     192           0 : #define BT_LE_FEAT_BIT_SYNC_RECEIVER            31
     193           0 : #define BT_LE_FEAT_BIT_ISO_CHANNELS             32
     194           0 : #define BT_LE_FEAT_BIT_PWR_CTRL_REQ             33
     195           0 : #define BT_LE_FEAT_BIT_PWR_CHG_IND              34
     196           0 : #define BT_LE_FEAT_BIT_PATH_LOSS_MONITOR        35
     197           0 : #define BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP         36
     198           0 : #define BT_LE_FEAT_BIT_CONN_SUBRATING           37
     199           0 : #define BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP 38
     200           0 : #define BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION   39
     201             : 
     202           0 : #define BT_LE_FEAT_BIT_PAWR_ADVERTISER          43
     203           0 : #define BT_LE_FEAT_BIT_PAWR_SCANNER             44
     204             : 
     205           0 : #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING         46
     206           0 : #define BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST    47
     207             : 
     208           0 : #define BT_LE_FEAT_TEST(feat, n)                (feat[(n) >> 3] & \
     209             :                                                  BIT((n) & 7))
     210             : 
     211           0 : #define BT_FEAT_LE_ENCR(feat)                     BT_LE_FEAT_TEST(feat, \
     212             :                                                   BT_LE_FEAT_BIT_ENC)
     213           0 : #define BT_FEAT_LE_CONN_PARAM_REQ_PROC(feat)      BT_LE_FEAT_TEST(feat, \
     214             :                                                   BT_LE_FEAT_BIT_CONN_PARAM_REQ)
     215           0 : #define BT_FEAT_LE_PER_INIT_FEAT_XCHG(feat)       BT_LE_FEAT_TEST(feat, \
     216             :                                                   BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG)
     217           0 : #define BT_FEAT_LE_DLE(feat)                      BT_LE_FEAT_TEST(feat, \
     218             :                                                   BT_LE_FEAT_BIT_DLE)
     219           0 : #define BT_FEAT_LE_PHY_2M(feat)                   BT_LE_FEAT_TEST(feat, \
     220             :                                                   BT_LE_FEAT_BIT_PHY_2M)
     221           0 : #define BT_FEAT_LE_PHY_CODED(feat)                BT_LE_FEAT_TEST(feat, \
     222             :                                                   BT_LE_FEAT_BIT_PHY_CODED)
     223           0 : #define BT_FEAT_LE_PRIVACY(feat)                  BT_LE_FEAT_TEST(feat, \
     224             :                                                   BT_LE_FEAT_BIT_PRIVACY)
     225           0 : #define BT_FEAT_LE_EXT_ADV(feat)                  BT_LE_FEAT_TEST(feat, \
     226             :                                                   BT_LE_FEAT_BIT_EXT_ADV)
     227           0 : #define BT_FEAT_LE_EXT_PER_ADV(feat)              BT_LE_FEAT_TEST(feat, \
     228             :                                                   BT_LE_FEAT_BIT_PER_ADV)
     229           0 : #define BT_FEAT_LE_CONNECTION_CTE_REQ(feat)       BT_LE_FEAT_TEST(feat, \
     230             :                                                   BT_LE_FEAT_BIT_CONN_CTE_REQ)
     231           0 : #define BT_FEAT_LE_CONNECTION_CTE_RESP(feat)      BT_LE_FEAT_TEST(feat, \
     232             :                                                   BT_LE_FEAT_BIT_CONN_CTE_RESP)
     233           0 : #define BT_FEAT_LE_CONNECTIONLESS_CTE_TX(feat)    BT_LE_FEAT_TEST(feat, \
     234             :                                                   BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX)
     235           0 : #define BT_FEAT_LE_CONNECTIONLESS_CTE_RX(feat)    BT_LE_FEAT_TEST(feat, \
     236             :                                                   BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX)
     237           0 : #define BT_FEAT_LE_ANT_SWITCH_TX_AOD(feat)        BT_LE_FEAT_TEST(feat, \
     238             :                                                   BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD)
     239           0 : #define BT_FEAT_LE_ANT_SWITCH_RX_AOA(feat)        BT_LE_FEAT_TEST(feat, \
     240             :                                                   BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA)
     241           0 : #define BT_FEAT_LE_RX_CTE(feat)                   BT_LE_FEAT_TEST(feat, \
     242             :                                                   BT_LE_FEAT_BIT_RX_CTE)
     243           0 : #define BT_FEAT_LE_PAST_SEND(feat)                BT_LE_FEAT_TEST(feat, \
     244             :                                                   BT_LE_FEAT_BIT_PAST_SEND)
     245           0 : #define BT_FEAT_LE_PAST_RECV(feat)                BT_LE_FEAT_TEST(feat, \
     246             :                                                   BT_LE_FEAT_BIT_PAST_RECV)
     247           0 : #define BT_FEAT_LE_CIS_CENTRAL(feat)              BT_LE_FEAT_TEST(feat, \
     248             :                                                   BT_LE_FEAT_BIT_CIS_CENTRAL)
     249           0 : #define BT_FEAT_LE_CIS_PERIPHERAL(feat)           BT_LE_FEAT_TEST(feat, \
     250             :                                                   BT_LE_FEAT_BIT_CIS_PERIPHERAL)
     251           0 : #define BT_FEAT_LE_ISO_BROADCASTER(feat)          BT_LE_FEAT_TEST(feat, \
     252             :                                                   BT_LE_FEAT_BIT_ISO_BROADCASTER)
     253           0 : #define BT_FEAT_LE_SYNC_RECEIVER(feat)            BT_LE_FEAT_TEST(feat, \
     254             :                                                   BT_LE_FEAT_BIT_SYNC_RECEIVER)
     255           0 : #define BT_FEAT_LE_ISO_CHANNELS(feat)             BT_LE_FEAT_TEST(feat, \
     256             :                                                   BT_LE_FEAT_BIT_ISO_CHANNELS)
     257           0 : #define BT_FEAT_LE_PWR_CTRL_REQ(feat)             BT_LE_FEAT_TEST(feat, \
     258             :                                                   BT_LE_FEAT_BIT_PWR_CTRL_REQ)
     259           0 : #define BT_FEAT_LE_PWR_CHG_IND(feat)              BT_LE_FEAT_TEST(feat, \
     260             :                                                   BT_LE_FEAT_BIT_PWR_CHG_IND)
     261           0 : #define BT_FEAT_LE_PATH_LOSS_MONITOR(feat)        BT_LE_FEAT_TEST(feat, \
     262             :                                                   BT_LE_FEAT_BIT_PATH_LOSS_MONITOR)
     263           0 : #define BT_FEAT_LE_PER_ADV_ADI_SUPP(feat)         BT_LE_FEAT_TEST(feat, \
     264             :                                                   BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP)
     265           0 : #define BT_FEAT_LE_CONN_SUBRATING(feat)           BT_LE_FEAT_TEST(feat, \
     266             :                                                   BT_LE_FEAT_BIT_CONN_SUBRATING)
     267           0 : #define BT_FEAT_LE_CONN_SUBRATING_HOST_SUPP(feat) BT_LE_FEAT_TEST(feat, \
     268             :                                                   BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP)
     269           0 : #define BT_FEAT_LE_CHANNEL_CLASSIFICATION(feat)   BT_LE_FEAT_TEST(feat, \
     270             :                                                   BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION)
     271           0 : #define BT_FEAT_LE_PAWR_ADVERTISER(feat)          BT_LE_FEAT_TEST(feat, \
     272             :                                                   BT_LE_FEAT_BIT_PAWR_ADVERTISER)
     273           0 : #define BT_FEAT_LE_PAWR_SCANNER(feat)             BT_LE_FEAT_TEST(feat, \
     274             :                                                   BT_LE_FEAT_BIT_PAWR_SCANNER)
     275           0 : #define BT_FEAT_LE_CHANNEL_SOUNDING(feat)         BT_LE_FEAT_TEST(feat, \
     276             :                                                   BT_LE_FEAT_BIT_CHANNEL_SOUNDING)
     277           0 : #define BT_FEAT_LE_CHANNEL_SOUNDING_HOST(feat)    BT_LE_FEAT_TEST(feat, \
     278             :                                                   BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST)
     279             : 
     280           0 : #define BT_FEAT_LE_CIS(feat)            (BT_FEAT_LE_CIS_CENTRAL(feat) | \
     281             :                                         BT_FEAT_LE_CIS_PERIPHERAL(feat))
     282           0 : #define BT_FEAT_LE_BIS(feat)            (BT_FEAT_LE_ISO_BROADCASTER(feat) | \
     283             :                                         BT_FEAT_LE_SYNC_RECEIVER(feat))
     284           0 : #define BT_FEAT_LE_ISO(feat)            (BT_FEAT_LE_CIS(feat) | \
     285             :                                         BT_FEAT_LE_BIS(feat))
     286             : 
     287             : /* LE States. See Core_v5.4, Vol 4, Part E, Section 7.8.27 */
     288           0 : #define BT_LE_STATES_PER_CONN_ADV(states)     (states & BIT64_MASK(38))
     289             : 
     290             : #if defined(CONFIG_BT_SCAN_AND_INITIATE_IN_PARALLEL)
     291             : /* Both passive and active scanner can be run in parallel with initiator. */
     292             : #define BT_LE_STATES_SCAN_INIT(states) ((states) & BIT64_MASK(22) && \
     293             :                                         (states) & BIT64_MASK(23))
     294             : 
     295             : #else
     296           0 : #define BT_LE_STATES_SCAN_INIT(states)  0
     297             : #endif
     298             : 
     299             : /* Bonding/authentication types */
     300           0 : #define BT_HCI_NO_BONDING                       0x00
     301           0 : #define BT_HCI_NO_BONDING_MITM                  0x01
     302           0 : #define BT_HCI_DEDICATED_BONDING                0x02
     303           0 : #define BT_HCI_DEDICATED_BONDING_MITM           0x03
     304           0 : #define BT_HCI_GENERAL_BONDING                  0x04
     305           0 : #define BT_HCI_GENERAL_BONDING_MITM             0x05
     306             : 
     307             : /*
     308             :  * MITM protection is enabled in SSP authentication requirements octet when
     309             :  * LSB bit is set.
     310             :  */
     311           0 : #define BT_MITM                                 0x01
     312             : 
     313             : /* I/O capabilities */
     314           0 : #define BT_IO_DISPLAY_ONLY                      0x00
     315           0 : #define BT_IO_DISPLAY_YESNO                     0x01
     316           0 : #define BT_IO_KEYBOARD_ONLY                     0x02
     317           0 : #define BT_IO_NO_INPUT_OUTPUT                   0x03
     318             : 
     319             : /* SCO packet types */
     320           0 : #define HCI_PKT_TYPE_HV1                        0x0020
     321           0 : #define HCI_PKT_TYPE_HV2                        0x0040
     322           0 : #define HCI_PKT_TYPE_HV3                        0x0080
     323             : 
     324             : /* eSCO packet types */
     325           0 : #define HCI_PKT_TYPE_SCO_HV1                    0x0001
     326           0 : #define HCI_PKT_TYPE_SCO_HV2                    0x0002
     327           0 : #define HCI_PKT_TYPE_SCO_HV3                    0x0004
     328           0 : #define HCI_PKT_TYPE_ESCO_EV3                   0x0008
     329           0 : #define HCI_PKT_TYPE_ESCO_EV4                   0x0010
     330           0 : #define HCI_PKT_TYPE_ESCO_EV5                   0x0020
     331           0 : #define HCI_PKT_TYPE_ESCO_2EV3                  0x0040
     332           0 : #define HCI_PKT_TYPE_ESCO_3EV3                  0x0080
     333           0 : #define HCI_PKT_TYPE_ESCO_2EV5                  0x0100
     334           0 : #define HCI_PKT_TYPE_ESCO_3EV5                  0x0200
     335             : 
     336             : 
     337           0 : #define ESCO_PKT_MASK                           (HCI_PKT_TYPE_SCO_HV1 | \
     338             :                                                  HCI_PKT_TYPE_SCO_HV2 | \
     339             :                                                  HCI_PKT_TYPE_SCO_HV3 | \
     340             :                                                  HCI_PKT_TYPE_ESCO_EV3 | \
     341             :                                                  HCI_PKT_TYPE_ESCO_EV4 | \
     342             :                                                  HCI_PKT_TYPE_ESCO_EV5)
     343           0 : #define SCO_PKT_MASK                            (HCI_PKT_TYPE_SCO_HV1 | \
     344             :                                                  HCI_PKT_TYPE_SCO_HV2 | \
     345             :                                                  HCI_PKT_TYPE_SCO_HV3)
     346           0 : #define EDR_ESCO_PKT_MASK                       (HCI_PKT_TYPE_ESCO_2EV3 | \
     347             :                                                  HCI_PKT_TYPE_ESCO_3EV3 | \
     348             :                                                  HCI_PKT_TYPE_ESCO_2EV5 | \
     349             :                                                  HCI_PKT_TYPE_ESCO_3EV5)
     350             : 
     351             : /* HCI BR/EDR link types */
     352           0 : #define BT_HCI_SCO                              0x00
     353           0 : #define BT_HCI_ACL                              0x01
     354           0 : #define BT_HCI_ESCO                             0x02
     355             : 
     356             : /* OpCode Group Fields */
     357           0 : #define BT_OGF_LINK_CTRL                        0x01
     358           0 : #define BT_OGF_BASEBAND                         0x03
     359           0 : #define BT_OGF_INFO                             0x04
     360           0 : #define BT_OGF_STATUS                           0x05
     361           0 : #define BT_OGF_LE                               0x08
     362           0 : #define BT_OGF_VS                               0x3f
     363             : 
     364             : /* Construct OpCode from OGF and OCF */
     365           0 : #define BT_OP(ogf, ocf)                         ((ocf) | ((ogf) << 10))
     366             : 
     367             : /* Invalid opcode */
     368           0 : #define BT_OP_NOP                               0x0000
     369             : 
     370             : /* Obtain OGF from OpCode */
     371           0 : #define BT_OGF(opcode)                          (((opcode) >> 10) & BIT_MASK(6))
     372             : /* Obtain OCF from OpCode */
     373           0 : #define BT_OCF(opcode)                          ((opcode) & BIT_MASK(10))
     374             : 
     375           0 : #define BT_HCI_OP_INQUIRY                       BT_OP(BT_OGF_LINK_CTRL, 0x0001) /* 0x0401 */
     376           0 : struct bt_hci_op_inquiry {
     377           0 :         uint8_t lap[3];
     378           0 :         uint8_t length;
     379           0 :         uint8_t num_rsp;
     380             : } __packed;
     381             : 
     382           0 : #define BT_HCI_OP_INQUIRY_CANCEL                BT_OP(BT_OGF_LINK_CTRL, 0x0002) /* 0x0402 */
     383             : 
     384           0 : #define BT_HCI_OP_CONNECT                       BT_OP(BT_OGF_LINK_CTRL, 0x0005) /* 0x0405 */
     385           0 : struct bt_hci_cp_connect {
     386           0 :         bt_addr_t bdaddr;
     387           0 :         uint16_t  packet_type;
     388           0 :         uint8_t   pscan_rep_mode;
     389           0 :         uint8_t   reserved;
     390           0 :         uint16_t  clock_offset;
     391           0 :         uint8_t   allow_role_switch;
     392             : } __packed;
     393             : 
     394           0 : #define BT_HCI_OP_DISCONNECT                    BT_OP(BT_OGF_LINK_CTRL, 0x0006) /* 0x0406 */
     395           0 : struct bt_hci_cp_disconnect {
     396           0 :         uint16_t handle;
     397           0 :         uint8_t  reason;
     398             : } __packed;
     399             : 
     400           0 : #define BT_HCI_OP_CONNECT_CANCEL                BT_OP(BT_OGF_LINK_CTRL, 0x0008) /* 0x0408 */
     401           0 : struct bt_hci_cp_connect_cancel {
     402           0 :         bt_addr_t bdaddr;
     403             : } __packed;
     404           0 : struct bt_hci_rp_connect_cancel {
     405           0 :         uint8_t   status;
     406           0 :         bt_addr_t bdaddr;
     407             : } __packed;
     408             : 
     409           0 : #define BT_HCI_OP_ACCEPT_CONN_REQ               BT_OP(BT_OGF_LINK_CTRL, 0x0009) /* 0x0409 */
     410           0 : struct bt_hci_cp_accept_conn_req {
     411           0 :         bt_addr_t bdaddr;
     412           0 :         uint8_t   role;
     413             : } __packed;
     414             : 
     415           0 : #define BT_HCI_OP_SETUP_SYNC_CONN               BT_OP(BT_OGF_LINK_CTRL, 0x0028) /* 0x0428 */
     416           0 : struct bt_hci_cp_setup_sync_conn {
     417           0 :         uint16_t  handle;
     418           0 :         uint32_t  tx_bandwidth;
     419           0 :         uint32_t  rx_bandwidth;
     420           0 :         uint16_t  max_latency;
     421           0 :         uint16_t  content_format;
     422           0 :         uint8_t   retrans_effort;
     423           0 :         uint16_t  pkt_type;
     424             : } __packed;
     425             : 
     426           0 : #define BT_HCI_OP_ACCEPT_SYNC_CONN_REQ          BT_OP(BT_OGF_LINK_CTRL, 0x0029) /* 0x0429 */
     427           0 : struct bt_hci_cp_accept_sync_conn_req {
     428           0 :         bt_addr_t bdaddr;
     429           0 :         uint32_t  tx_bandwidth;
     430           0 :         uint32_t  rx_bandwidth;
     431           0 :         uint16_t  max_latency;
     432           0 :         uint16_t  content_format;
     433           0 :         uint8_t   retrans_effort;
     434           0 :         uint16_t  pkt_type;
     435             : } __packed;
     436             : 
     437           0 : #define BT_HCI_OP_REJECT_CONN_REQ               BT_OP(BT_OGF_LINK_CTRL, 0x000a) /* 0x040a */
     438           0 : struct bt_hci_cp_reject_conn_req {
     439           0 :         bt_addr_t bdaddr;
     440           0 :         uint8_t   reason;
     441             : } __packed;
     442             : 
     443           0 : #define BT_HCI_OP_LINK_KEY_REPLY                BT_OP(BT_OGF_LINK_CTRL, 0x000b) /* 0x040b */
     444           0 : struct bt_hci_cp_link_key_reply {
     445           0 :         bt_addr_t bdaddr;
     446           0 :         uint8_t   link_key[16];
     447             : } __packed;
     448             : 
     449           0 : #define BT_HCI_OP_LINK_KEY_NEG_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x000c) /* 0x040c */
     450           0 : struct bt_hci_cp_link_key_neg_reply {
     451           0 :         bt_addr_t bdaddr;
     452             : } __packed;
     453             : 
     454           0 : #define BT_HCI_OP_PIN_CODE_REPLY                BT_OP(BT_OGF_LINK_CTRL, 0x000d) /* 0x040d */
     455           0 : struct bt_hci_cp_pin_code_reply {
     456           0 :         bt_addr_t bdaddr;
     457           0 :         uint8_t   pin_len;
     458           0 :         uint8_t   pin_code[16];
     459             : } __packed;
     460           0 : struct bt_hci_rp_pin_code_reply {
     461           0 :         uint8_t      status;
     462           0 :         bt_addr_t bdaddr;
     463             : } __packed;
     464             : 
     465           0 : #define BT_HCI_OP_PIN_CODE_NEG_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x000e) /* 0x040e */
     466           0 : struct bt_hci_cp_pin_code_neg_reply {
     467           0 :         bt_addr_t bdaddr;
     468             : } __packed;
     469           0 : struct bt_hci_rp_pin_code_neg_reply {
     470           0 :         uint8_t   status;
     471           0 :         bt_addr_t bdaddr;
     472             : } __packed;
     473             : 
     474           0 : #define BT_HCI_OP_AUTH_REQUESTED                BT_OP(BT_OGF_LINK_CTRL, 0x0011) /* 0x0411 */
     475           0 : struct bt_hci_cp_auth_requested {
     476           0 :         uint16_t handle;
     477             : } __packed;
     478             : 
     479           0 : #define BT_HCI_OP_SET_CONN_ENCRYPT              BT_OP(BT_OGF_LINK_CTRL, 0x0013) /* 0x0413 */
     480           0 : struct bt_hci_cp_set_conn_encrypt {
     481           0 :         uint16_t handle;
     482           0 :         uint8_t  encrypt;
     483             : } __packed;
     484             : 
     485           0 : #define BT_HCI_OP_REMOTE_NAME_REQUEST           BT_OP(BT_OGF_LINK_CTRL, 0x0019) /* 0x0419 */
     486           0 : struct bt_hci_cp_remote_name_request {
     487           0 :         bt_addr_t bdaddr;
     488           0 :         uint8_t   pscan_rep_mode;
     489           0 :         uint8_t   reserved;
     490           0 :         uint16_t  clock_offset;
     491             : } __packed;
     492             : 
     493           0 : #define BT_HCI_OP_REMOTE_NAME_CANCEL            BT_OP(BT_OGF_LINK_CTRL, 0x001a) /* 0x041a */
     494           0 : struct bt_hci_cp_remote_name_cancel {
     495           0 :         bt_addr_t bdaddr;
     496             : } __packed;
     497           0 : struct bt_hci_rp_remote_name_cancel {
     498           0 :         uint8_t   status;
     499           0 :         bt_addr_t bdaddr;
     500             : } __packed;
     501             : 
     502           0 : #define BT_HCI_OP_READ_REMOTE_FEATURES          BT_OP(BT_OGF_LINK_CTRL, 0x001b) /* 0x041b */
     503           0 : struct bt_hci_cp_read_remote_features {
     504           0 :         uint16_t handle;
     505             : } __packed;
     506             : 
     507           0 : #define BT_HCI_OP_READ_REMOTE_EXT_FEATURES      BT_OP(BT_OGF_LINK_CTRL, 0x001c) /* 0x041c */
     508           0 : struct bt_hci_cp_read_remote_ext_features {
     509           0 :         uint16_t handle;
     510           0 :         uint8_t  page;
     511             : } __packed;
     512             : 
     513           0 : #define BT_HCI_OP_READ_REMOTE_VERSION_INFO      BT_OP(BT_OGF_LINK_CTRL, 0x001d) /* 0x041d */
     514           0 : struct bt_hci_cp_read_remote_version_info {
     515           0 :         uint16_t handle;
     516             : } __packed;
     517             : 
     518           0 : #define BT_HCI_OP_IO_CAPABILITY_REPLY           BT_OP(BT_OGF_LINK_CTRL, 0x002b) /* 0x042b */
     519           0 : struct bt_hci_cp_io_capability_reply {
     520           0 :         bt_addr_t bdaddr;
     521           0 :         uint8_t   capability;
     522           0 :         uint8_t   oob_data;
     523           0 :         uint8_t   authentication;
     524             : } __packed;
     525             : 
     526           0 : #define BT_HCI_OP_USER_CONFIRM_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x002c) /* 0x042c */
     527           0 : #define BT_HCI_OP_USER_CONFIRM_NEG_REPLY        BT_OP(BT_OGF_LINK_CTRL, 0x002d) /* 0x042d */
     528           0 : struct bt_hci_cp_user_confirm_reply {
     529           0 :         bt_addr_t bdaddr;
     530             : } __packed;
     531           0 : struct bt_hci_rp_user_confirm_reply {
     532           0 :         uint8_t   status;
     533           0 :         bt_addr_t bdaddr;
     534             : } __packed;
     535             : 
     536           0 : #define BT_HCI_OP_USER_PASSKEY_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x002e) /* 0x042e */
     537           0 : struct bt_hci_cp_user_passkey_reply {
     538           0 :         bt_addr_t bdaddr;
     539           0 :         uint32_t  passkey;
     540             : } __packed;
     541             : 
     542           0 : #define BT_HCI_OP_USER_PASSKEY_NEG_REPLY        BT_OP(BT_OGF_LINK_CTRL, 0x002f) /* 0x042f */
     543           0 : struct bt_hci_cp_user_passkey_neg_reply {
     544           0 :         bt_addr_t bdaddr;
     545             : } __packed;
     546             : 
     547           0 : #define BT_HCI_OP_IO_CAPABILITY_NEG_REPLY       BT_OP(BT_OGF_LINK_CTRL, 0x0034) /* 0x0434 */
     548           0 : struct bt_hci_cp_io_capability_neg_reply {
     549           0 :         bt_addr_t bdaddr;
     550           0 :         uint8_t   reason;
     551             : } __packed;
     552             : 
     553           0 : #define BT_HCI_OP_SET_EVENT_MASK                BT_OP(BT_OGF_BASEBAND, 0x0001) /* 0x0c01 */
     554           0 : struct bt_hci_cp_set_event_mask {
     555           0 :         uint8_t  events[8];
     556             : } __packed;
     557             : 
     558           0 : #define BT_HCI_OP_RESET                         BT_OP(BT_OGF_BASEBAND, 0x0003) /* 0x0c03 */
     559             : 
     560           0 : #define BT_HCI_OP_WRITE_LOCAL_NAME              BT_OP(BT_OGF_BASEBAND, 0x0013) /* 0x0c13 */
     561           0 : struct bt_hci_write_local_name {
     562           0 :         uint8_t local_name[248];
     563             : } __packed;
     564             : 
     565           0 : #define BT_HCI_OP_READ_CONN_ACCEPT_TIMEOUT      BT_OP(BT_OGF_BASEBAND, 0x0015) /* 0x0c15 */
     566           0 : struct bt_hci_rp_read_conn_accept_timeout {
     567           0 :         uint8_t  status;
     568           0 :         uint16_t conn_accept_timeout;
     569             : } __packed;
     570             : 
     571           0 : #define BT_HCI_OP_WRITE_CONN_ACCEPT_TIMEOUT     BT_OP(BT_OGF_BASEBAND, 0x0016) /* 0x0c16 */
     572           0 : struct bt_hci_cp_write_conn_accept_timeout {
     573           0 :         uint16_t conn_accept_timeout;
     574             : } __packed;
     575             : 
     576           0 : struct bt_hci_rp_write_conn_accept_timeout {
     577           0 :         uint8_t  status;
     578             : } __packed;
     579             : 
     580           0 : #define BT_HCI_OP_WRITE_PAGE_TIMEOUT            BT_OP(BT_OGF_BASEBAND, 0x0018) /* 0x0c18 */
     581             : 
     582           0 : #define BT_HCI_OP_WRITE_SCAN_ENABLE             BT_OP(BT_OGF_BASEBAND, 0x001a) /* 0x0c1a */
     583           0 : #define BT_BREDR_SCAN_DISABLED                  0x00
     584           0 : #define BT_BREDR_SCAN_INQUIRY                   0x01
     585           0 : #define BT_BREDR_SCAN_PAGE                      0x02
     586             : 
     587           0 : #define BT_COD(major_service, major_device, minor_device)                         \
     588             :         (((uint32_t)major_service << 13) | ((uint32_t)major_device << 8) |            \
     589             :          ((uint32_t)minor_device << 2))
     590           0 : #define BT_COD_VALID(cod) ((0 == (cod[0] & (BIT(0) | BIT(1)))) ? true : false)
     591           0 : #define BT_COD_MAJOR_SERVICE_CLASSES(cod)                                         \
     592             :         ((((uint32_t)cod[2] & 0xFF) >> 5) | (((uint32_t)cod[1] & 0xD0) >> 5))
     593           0 : #define BT_COD_MAJOR_DEVICE_CLASS(cod) ((((uint32_t)cod[1]) & 0x1FUL))
     594           0 : #define BT_COD_MINOR_DEVICE_CLASS(cod) (((((uint32_t)cod[0]) & 0xFF) >> 2))
     595             : 
     596           0 : #define BT_COD_MAJOR_MISC           0x00
     597           0 : #define BT_COD_MAJOR_COMPUTER       0x01
     598           0 : #define BT_COD_MAJOR_PHONE          0x02
     599           0 : #define BT_COD_MAJOR_LAN_NETWORK_AP 0x03
     600           0 : #define BT_COD_MAJOR_AUDIO_VIDEO    0x04
     601           0 : #define BT_COD_MAJOR_PERIPHERAL     0x05
     602           0 : #define BT_COD_MAJOR_IMAGING        0x06
     603           0 : #define BT_COD_MAJOR_WEARABLE       0x07
     604           0 : #define BT_COD_MAJOR_TOY            0x08
     605           0 : #define BT_COD_MAJOR_HEALTH         0x09
     606           0 : #define BT_COD_MAJOR_UNCATEGORIZED  0x1F
     607             : 
     608             : /* Minor Device Class field - Computer Major Class */
     609           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_UNCATEGORIZED         0x00
     610           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_DESKTOP               0x01
     611           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_SERVER_CLASS_COMPUTER 0x02
     612           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_LAPTOP                0x03
     613           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_HANDHELD_PC_PDA       0x04
     614           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_PALM_SIZE_PC_PDA      0x05
     615           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_WEARABLE_COMPUTER     0x06
     616           0 : #define BT_COD_MAJOR_COMPUTER_MINOR_TABLET                0x07
     617             : 
     618             : /* Minor Device Class field - Phone Major Class */
     619           0 : #define BT_COD_MAJOR_PHONE_MINOR_UNCATEGORIZED             0x00
     620           0 : #define BT_COD_MAJOR_PHONE_MINOR_CELLULAR                  0x01
     621           0 : #define BT_COD_MAJOR_PHONE_MINOR_CORDLESS                  0x02
     622           0 : #define BT_COD_MAJOR_PHONE_MINOR_SMARTPHONE                0x03
     623           0 : #define BT_COD_MAJOR_PHONE_MINOR_WIRED_MODEM_VOICE_GATEWAY 0x04
     624           0 : #define BT_COD_MAJOR_PHONE_MINOR_ISDN                      0x05
     625             : 
     626             : /* Minor Device Class field - Audio/Video Major Class */
     627           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_UNCATEGORIZED             0x00
     628           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_WEARABLE_HEADSET          0x01
     629           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HANDS_FREE                0x02
     630           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_RFU                       0x03
     631           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_MICROPHONE                0x04
     632           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_LOUDSPEAKER               0x05
     633           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HEADPHONES                0x06
     634           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_PORTABLE_AUDIO            0x07
     635           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_CAR_AUDIO                 0x08
     636           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_SET_TOP_BOX               0x09
     637           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HIFI_AUDIO                0x0A
     638           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VCR                       0x0B
     639           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_CAMERA              0x0C
     640           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_CAMCORDER                 0x0D
     641           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_MONITOR             0x0E
     642           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_DISPLAY_LOUDSPEAKER 0x0F
     643           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_CONFERENCING        0x10
     644           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_RFU2                      0x11
     645           0 : #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_GAME_TOY                  0x12
     646             : 
     647           0 : #define BT_HCI_OP_WRITE_CLASS_OF_DEVICE         BT_OP(BT_OGF_BASEBAND, 0x0024) /* 0x0c24 */
     648           0 : struct bt_hci_cp_write_class_of_device {
     649           0 :         uint8_t  class_of_device[3];
     650             : } __packed;
     651             : 
     652           0 : #define BT_TX_POWER_LEVEL_CURRENT               0x00
     653           0 : #define BT_TX_POWER_LEVEL_MAX                   0x01
     654           0 : #define BT_HCI_OP_READ_TX_POWER_LEVEL           BT_OP(BT_OGF_BASEBAND, 0x002d) /* 0x0c2d */
     655           0 : struct bt_hci_cp_read_tx_power_level {
     656           0 :         uint16_t handle;
     657           0 :         uint8_t  type;
     658             : } __packed;
     659             : 
     660           0 : struct bt_hci_rp_read_tx_power_level {
     661           0 :         uint8_t  status;
     662           0 :         uint16_t handle;
     663           0 :         int8_t   tx_power_level;
     664             : } __packed;
     665             : 
     666           0 : #define BT_HCI_LE_TX_POWER_PHY_1M               0x01
     667           0 : #define BT_HCI_LE_TX_POWER_PHY_2M               0x02
     668           0 : #define BT_HCI_LE_TX_POWER_PHY_CODED_S8         0x03
     669           0 : #define BT_HCI_LE_TX_POWER_PHY_CODED_S2         0x04
     670           0 : #define BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL    BT_OP(BT_OGF_LE, 0x0076) /* 0x2076 */
     671           0 : struct bt_hci_cp_le_read_tx_power_level {
     672           0 :         uint16_t handle;
     673           0 :         uint8_t  phy;
     674             : } __packed;
     675             : 
     676           0 : struct bt_hci_rp_le_read_tx_power_level {
     677           0 :         uint8_t  status;
     678           0 :         uint16_t handle;
     679           0 :         uint8_t  phy;
     680           0 :         int8_t   current_tx_power_level;
     681           0 :         int8_t   max_tx_power_level;
     682             : } __packed;
     683             : 
     684           0 : #define BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL BT_OP(BT_OGF_LE, 0x0077) /* 0x2077 */
     685             : 
     686           0 : #define BT_HCI_LE_TX_POWER_REPORT_DISABLE       0x00
     687           0 : #define BT_HCI_LE_TX_POWER_REPORT_ENABLE        0x01
     688           0 : #define BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE BT_OP(BT_OGF_LE, 0x007A) /* 0x207A */
     689           0 : struct bt_hci_cp_le_set_tx_power_report_enable {
     690           0 :         uint16_t handle;
     691           0 :         uint8_t  local_enable;
     692           0 :         uint8_t  remote_enable;
     693             : } __packed;
     694             : 
     695           0 : struct bt_hci_cp_le_set_path_loss_reporting_parameters {
     696           0 :         uint16_t handle;
     697           0 :         uint8_t  high_threshold;
     698           0 :         uint8_t  high_hysteresis;
     699           0 :         uint8_t  low_threshold;
     700           0 :         uint8_t  low_hysteresis;
     701           0 :         uint16_t min_time_spent;
     702             : } __packed;
     703             : 
     704           0 : struct bt_hci_cp_le_set_path_loss_reporting_enable {
     705           0 :         uint16_t handle;
     706           0 :         uint8_t  enable;
     707             : } __packed;
     708             : 
     709           0 : #define BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_PARAMETERS BT_OP(BT_OGF_LE, 0x0078) /* 0x2078 */
     710             : 
     711           0 : #define BT_HCI_LE_PATH_LOSS_REPORTING_DISABLE       0x00
     712           0 : #define BT_HCI_LE_PATH_LOSS_REPORTING_ENABLE        0x01
     713           0 : #define BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_ENABLE BT_OP(BT_OGF_LE, 0x0079) /* 0x2079 */
     714             : 
     715           0 : struct bt_hci_cp_le_set_default_subrate {
     716           0 :         uint16_t subrate_min;
     717           0 :         uint16_t subrate_max;
     718           0 :         uint16_t max_latency;
     719           0 :         uint16_t continuation_number;
     720           0 :         uint16_t supervision_timeout;
     721             : } __packed;
     722             : 
     723           0 : struct bt_hci_cp_le_subrate_request {
     724           0 :         uint16_t handle;
     725           0 :         uint16_t subrate_min;
     726           0 :         uint16_t subrate_max;
     727           0 :         uint16_t max_latency;
     728           0 :         uint16_t continuation_number;
     729           0 :         uint16_t supervision_timeout;
     730             : } __packed;
     731             : 
     732           0 : #define BT_HCI_OP_LE_SET_DEFAULT_SUBRATE BT_OP(BT_OGF_LE, 0x007D) /* 0x207D */
     733           0 : #define BT_HCI_OP_LE_SUBRATE_REQUEST     BT_OP(BT_OGF_LE, 0x007E) /* 0x207E */
     734             : 
     735           0 : #define BT_HCI_CTL_TO_HOST_FLOW_DISABLE         0x00
     736           0 : #define BT_HCI_CTL_TO_HOST_FLOW_ENABLE          0x01
     737           0 : #define BT_HCI_OP_SET_CTL_TO_HOST_FLOW          BT_OP(BT_OGF_BASEBAND, 0x0031) /* 0x0c31 */
     738           0 : struct bt_hci_cp_set_ctl_to_host_flow {
     739           0 :         uint8_t  flow_enable;
     740             : } __packed;
     741             : 
     742           0 : #define BT_HCI_OP_HOST_BUFFER_SIZE              BT_OP(BT_OGF_BASEBAND, 0x0033) /* 0x0c33 */
     743           0 : struct bt_hci_cp_host_buffer_size {
     744           0 :         uint16_t acl_mtu;
     745           0 :         uint8_t  sco_mtu;
     746           0 :         uint16_t acl_pkts;
     747           0 :         uint16_t sco_pkts;
     748             : } __packed;
     749             : 
     750           0 : struct bt_hci_handle_count {
     751           0 :         uint16_t handle;
     752           0 :         uint16_t count;
     753             : } __packed;
     754             : 
     755           0 : #define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS    BT_OP(BT_OGF_BASEBAND, 0x0035) /* 0x0c35 */
     756           0 : struct bt_hci_cp_host_num_completed_packets {
     757           0 :         uint8_t  num_handles;
     758           0 :         struct bt_hci_handle_count h[0];
     759             : } __packed;
     760             : 
     761           0 : #define BT_HCI_OP_WRITE_INQUIRY_MODE            BT_OP(BT_OGF_BASEBAND, 0x0045) /* 0x0c45 */
     762           0 : struct bt_hci_cp_write_inquiry_mode {
     763           0 :         uint8_t  mode;
     764             : } __packed;
     765             : 
     766           0 : #define BT_HCI_OP_WRITE_SSP_MODE                BT_OP(BT_OGF_BASEBAND, 0x0056) /* 0x0c56 */
     767           0 : struct bt_hci_cp_write_ssp_mode {
     768           0 :         uint8_t mode;
     769             : } __packed;
     770             : 
     771           0 : #define BT_HCI_OP_SET_EVENT_MASK_PAGE_2         BT_OP(BT_OGF_BASEBAND, 0x0063) /* 0x0c63 */
     772           0 : struct bt_hci_cp_set_event_mask_page_2 {
     773           0 :         uint8_t  events_page_2[8];
     774             : } __packed;
     775             : 
     776           0 : #define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP         BT_OP(BT_OGF_BASEBAND, 0x006d) /* 0x0c6d */
     777           0 : struct bt_hci_cp_write_le_host_supp {
     778           0 :         uint8_t  le;
     779           0 :         uint8_t  simul;
     780             : } __packed;
     781             : 
     782           0 : #define BT_HCI_OP_WRITE_SC_HOST_SUPP            BT_OP(BT_OGF_BASEBAND, 0x007a) /* 0x0c7a */
     783           0 : struct bt_hci_cp_write_sc_host_supp {
     784           0 :         uint8_t  sc_support;
     785             : } __packed;
     786             : 
     787           0 : #define BT_HCI_OP_READ_AUTH_PAYLOAD_TIMEOUT     BT_OP(BT_OGF_BASEBAND, 0x007b) /* 0x0c7b */
     788           0 : struct bt_hci_cp_read_auth_payload_timeout {
     789           0 :         uint16_t handle;
     790             : } __packed;
     791             : 
     792           0 : struct bt_hci_rp_read_auth_payload_timeout {
     793           0 :         uint8_t  status;
     794           0 :         uint16_t handle;
     795           0 :         uint16_t auth_payload_timeout;
     796             : } __packed;
     797             : 
     798           0 : #define BT_HCI_OP_WRITE_AUTH_PAYLOAD_TIMEOUT    BT_OP(BT_OGF_BASEBAND, 0x007c) /* 0x0c7c */
     799           0 : struct bt_hci_cp_write_auth_payload_timeout {
     800           0 :         uint16_t handle;
     801           0 :         uint16_t auth_payload_timeout;
     802             : } __packed;
     803             : 
     804           0 : struct bt_hci_rp_write_auth_payload_timeout {
     805           0 :         uint8_t  status;
     806           0 :         uint16_t handle;
     807             : } __packed;
     808             : 
     809           0 : #define BT_HCI_OP_CONFIGURE_DATA_PATH           BT_OP(BT_OGF_BASEBAND, 0x0083) /* 0x0c83 */
     810           0 : struct bt_hci_cp_configure_data_path {
     811           0 :         uint8_t  data_path_dir;
     812           0 :         uint8_t  data_path_id;
     813           0 :         uint8_t  vs_config_len;
     814           0 :         uint8_t  vs_config[0];
     815             : } __packed;
     816             : 
     817           0 : struct bt_hci_rp_configure_data_path {
     818           0 :         uint8_t  status;
     819             : } __packed;
     820             : 
     821             : /* HCI version from Assigned Numbers */
     822           0 : #define BT_HCI_VERSION_1_0B                     0
     823           0 : #define BT_HCI_VERSION_1_1                      1
     824           0 : #define BT_HCI_VERSION_1_2                      2
     825           0 : #define BT_HCI_VERSION_2_0                      3
     826           0 : #define BT_HCI_VERSION_2_1                      4
     827           0 : #define BT_HCI_VERSION_3_0                      5
     828           0 : #define BT_HCI_VERSION_4_0                      6
     829           0 : #define BT_HCI_VERSION_4_1                      7
     830           0 : #define BT_HCI_VERSION_4_2                      8
     831           0 : #define BT_HCI_VERSION_5_0                      9
     832           0 : #define BT_HCI_VERSION_5_1                      10
     833           0 : #define BT_HCI_VERSION_5_2                      11
     834           0 : #define BT_HCI_VERSION_5_3                      12
     835           0 : #define BT_HCI_VERSION_5_4                      13
     836           0 : #define BT_HCI_VERSION_6_0                      14
     837             : 
     838           0 : #define BT_HCI_OP_READ_LOCAL_VERSION_INFO       BT_OP(BT_OGF_INFO, 0x0001) /* 0x1001 */
     839           0 : struct bt_hci_rp_read_local_version_info {
     840           0 :         uint8_t  status;
     841           0 :         uint8_t  hci_version;
     842           0 :         uint16_t hci_revision;
     843           0 :         uint8_t  lmp_version;
     844           0 :         uint16_t manufacturer;
     845           0 :         uint16_t lmp_subversion;
     846             : } __packed;
     847             : 
     848           0 : #define BT_HCI_OP_READ_SUPPORTED_COMMANDS       BT_OP(BT_OGF_INFO, 0x0002) /* 0x1002 */
     849           0 : struct bt_hci_rp_read_supported_commands {
     850           0 :         uint8_t  status;
     851           0 :         uint8_t  commands[64];
     852             : } __packed;
     853             : 
     854           0 : #define BT_HCI_OP_READ_LOCAL_EXT_FEATURES       BT_OP(BT_OGF_INFO, 0x0004) /* 0x1004 */
     855           0 : struct bt_hci_cp_read_local_ext_features {
     856           0 :         uint8_t page;
     857             : };
     858           0 : struct bt_hci_rp_read_local_ext_features {
     859           0 :         uint8_t  status;
     860           0 :         uint8_t  page;
     861           0 :         uint8_t  max_page;
     862           0 :         uint8_t  ext_features[8];
     863             : } __packed;
     864             : 
     865           0 : #define BT_HCI_OP_READ_LOCAL_FEATURES           BT_OP(BT_OGF_INFO, 0x0003) /* 0x1003 */
     866           0 : struct bt_hci_rp_read_local_features {
     867           0 :         uint8_t  status;
     868           0 :         uint8_t  features[8];
     869             : } __packed;
     870             : 
     871           0 : #define BT_HCI_OP_READ_BUFFER_SIZE              BT_OP(BT_OGF_INFO, 0x0005) /* 0x1005 */
     872           0 : struct bt_hci_rp_read_buffer_size {
     873           0 :         uint8_t  status;
     874           0 :         uint16_t acl_max_len;
     875           0 :         uint8_t  sco_max_len;
     876           0 :         uint16_t acl_max_num;
     877           0 :         uint16_t sco_max_num;
     878             : } __packed;
     879             : 
     880           0 : #define BT_HCI_OP_READ_BD_ADDR                  BT_OP(BT_OGF_INFO, 0x0009) /* 0x1009 */
     881           0 : struct bt_hci_rp_read_bd_addr {
     882           0 :         uint8_t   status;
     883           0 :         bt_addr_t bdaddr;
     884             : } __packed;
     885             : 
     886             : /* logic transport type bits as returned when reading supported codecs */
     887           0 : #define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_ACL BIT(0)
     888           0 : #define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_SCO BIT(1)
     889           0 : #define BT_HCI_CODEC_TRANSPORT_MASK_LE_CIS    BIT(2)
     890           0 : #define BT_HCI_CODEC_TRANSPORT_MASK_LE_BIS    BIT(3)
     891             : 
     892             : /* logic transport types for reading codec capabilities and controller delays */
     893           0 : #define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_ACL 0x00
     894           0 : #define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_SCO 0x01
     895           0 : #define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_CIS    0x02
     896           0 : #define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_BIS    0x03
     897             : 
     898             : /* audio datapath directions */
     899           0 : #define BT_HCI_DATAPATH_DIR_HOST_TO_CTLR 0x00
     900           0 : #define BT_HCI_DATAPATH_DIR_CTLR_TO_HOST 0x01
     901             : 
     902             : /* audio datapath IDs */
     903           0 : #define BT_HCI_DATAPATH_ID_HCI      0x00
     904           0 : #define BT_HCI_DATAPATH_ID_VS       0x01
     905           0 : #define BT_HCI_DATAPATH_ID_VS_END   0xfe
     906             : 
     907             : /* coding format assigned numbers, used for codec IDs */
     908           0 : #define BT_HCI_CODING_FORMAT_ULAW_LOG    0x00
     909           0 : #define BT_HCI_CODING_FORMAT_ALAW_LOG    0x01
     910           0 : #define BT_HCI_CODING_FORMAT_CVSD        0x02
     911           0 : #define BT_HCI_CODING_FORMAT_TRANSPARENT 0x03
     912           0 : #define BT_HCI_CODING_FORMAT_LINEAR_PCM  0x04
     913           0 : #define BT_HCI_CODING_FORMAT_MSBC        0x05
     914           0 : #define BT_HCI_CODING_FORMAT_LC3         0x06
     915           0 : #define BT_HCI_CODING_FORMAT_G729A       0x07
     916           0 : #define BT_HCI_CODING_FORMAT_VS          0xFF
     917             : 
     918             : 
     919           0 : #define BT_HCI_OP_READ_CODECS                   BT_OP(BT_OGF_INFO, 0x000b) /* 0x100b */
     920           0 : struct bt_hci_std_codec_info {
     921           0 :         uint8_t codec_id;
     922             : } __packed;
     923           0 : struct bt_hci_std_codecs {
     924           0 :         uint8_t num_codecs;
     925           0 :         struct bt_hci_std_codec_info codec_info[0];
     926             : } __packed;
     927           0 : struct bt_hci_vs_codec_info {
     928           0 :         uint16_t company_id;
     929           0 :         uint16_t codec_id;
     930             : } __packed;
     931           0 : struct bt_hci_vs_codecs {
     932           0 :         uint8_t num_codecs;
     933           0 :         struct bt_hci_vs_codec_info codec_info[0];
     934             : } __packed;
     935           0 : struct bt_hci_rp_read_codecs {
     936           0 :         uint8_t status;
     937             :         /* other fields filled in dynamically */
     938           0 :         uint8_t codecs[0];
     939             : } __packed;
     940             : 
     941           0 : #define BT_HCI_OP_READ_CODECS_V2                BT_OP(BT_OGF_INFO, 0x000d) /* 0x100d */
     942           0 : struct bt_hci_std_codec_info_v2 {
     943           0 :         uint8_t codec_id;
     944           0 :         uint8_t transports; /* bitmap */
     945             : } __packed;
     946           0 : struct bt_hci_std_codecs_v2 {
     947           0 :         uint8_t num_codecs;
     948           0 :         struct bt_hci_std_codec_info_v2 codec_info[0];
     949             : } __packed;
     950           0 : struct bt_hci_vs_codec_info_v2 {
     951           0 :         uint16_t company_id;
     952           0 :         uint16_t codec_id;
     953           0 :         uint8_t transports; /* bitmap */
     954             : } __packed;
     955           0 : struct bt_hci_vs_codecs_v2 {
     956           0 :         uint8_t num_codecs;
     957           0 :         struct bt_hci_vs_codec_info_v2 codec_info[0];
     958             : } __packed;
     959           0 : struct bt_hci_rp_read_codecs_v2 {
     960           0 :         uint8_t status;
     961             :         /* other fields filled in dynamically */
     962           0 :         uint8_t codecs[0];
     963             : } __packed;
     964             : 
     965           0 : struct bt_hci_cp_codec_id {
     966           0 :         uint8_t coding_format;
     967           0 :         uint16_t company_id;
     968           0 :         uint16_t vs_codec_id;
     969             : } __packed;
     970             : 
     971           0 : #define BT_HCI_OP_READ_CODEC_CAPABILITIES       BT_OP(BT_OGF_INFO, 0x000e) /* 0x100e */
     972           0 : struct bt_hci_cp_read_codec_capabilities {
     973           0 :         struct bt_hci_cp_codec_id codec_id;
     974           0 :         uint8_t transport;
     975           0 :         uint8_t direction;
     976             : } __packed;
     977           0 : struct bt_hci_codec_capability_info {
     978           0 :         uint8_t length;
     979           0 :         uint8_t data[0];
     980             : } __packed;
     981           0 : struct bt_hci_rp_read_codec_capabilities {
     982           0 :         uint8_t status;
     983           0 :         uint8_t num_capabilities;
     984             :         /* other fields filled in dynamically */
     985           0 :         uint8_t capabilities[0];
     986             : } __packed;
     987             : 
     988           0 : #define BT_HCI_OP_READ_CTLR_DELAY               BT_OP(BT_OGF_INFO, 0x000f) /* 0x100f */
     989           0 : struct bt_hci_cp_read_ctlr_delay {
     990           0 :         struct bt_hci_cp_codec_id codec_id;
     991           0 :         uint8_t transport;
     992           0 :         uint8_t direction;
     993           0 :         uint8_t codec_config_len;
     994           0 :         uint8_t codec_config[0];
     995             : } __packed;
     996           0 : struct bt_hci_rp_read_ctlr_delay {
     997           0 :         uint8_t status;
     998           0 :         uint8_t min_ctlr_delay[3];
     999           0 :         uint8_t max_ctlr_delay[3];
    1000             : } __packed;
    1001             : 
    1002           0 : #define BT_HCI_OP_READ_RSSI                     BT_OP(BT_OGF_STATUS, 0x0005) /* 0x1405 */
    1003           0 : struct bt_hci_cp_read_rssi {
    1004           0 :         uint16_t handle;
    1005             : } __packed;
    1006           0 : struct bt_hci_rp_read_rssi {
    1007           0 :         uint8_t  status;
    1008           0 :         uint16_t handle;
    1009           0 :         int8_t   rssi;
    1010             : } __packed;
    1011             : 
    1012           0 : #define BT_HCI_ENCRYPTION_KEY_SIZE_MIN          7
    1013           0 : #define BT_HCI_ENCRYPTION_KEY_SIZE_MAX          16
    1014             : 
    1015           0 : #define BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE      BT_OP(BT_OGF_STATUS, 0x0008) /* 0x1408 */
    1016           0 : struct bt_hci_cp_read_encryption_key_size {
    1017           0 :         uint16_t handle;
    1018             : } __packed;
    1019           0 : struct bt_hci_rp_read_encryption_key_size {
    1020           0 :         uint8_t  status;
    1021           0 :         uint16_t handle;
    1022           0 :         uint8_t  key_size;
    1023             : } __packed;
    1024             : 
    1025             : /* BLE */
    1026             : 
    1027           0 : #define BT_HCI_OP_LE_SET_EVENT_MASK             BT_OP(BT_OGF_LE, 0x0001) /* 0x2001 */
    1028           0 : struct bt_hci_cp_le_set_event_mask {
    1029           0 :         uint8_t events[8];
    1030             : } __packed;
    1031             : 
    1032           0 : #define BT_HCI_OP_LE_READ_BUFFER_SIZE           BT_OP(BT_OGF_LE, 0x0002) /* 0x2002 */
    1033           0 : struct bt_hci_rp_le_read_buffer_size {
    1034           0 :         uint8_t  status;
    1035           0 :         uint16_t le_max_len;
    1036           0 :         uint8_t  le_max_num;
    1037             : } __packed;
    1038             : 
    1039           0 : #define BT_HCI_OP_LE_READ_LOCAL_FEATURES        BT_OP(BT_OGF_LE, 0x0003) /* 0x2003 */
    1040           0 : struct bt_hci_rp_le_read_local_features {
    1041           0 :         uint8_t  status;
    1042           0 :         uint8_t  features[8];
    1043             : } __packed;
    1044             : 
    1045           0 : #define BT_HCI_OP_LE_SET_RANDOM_ADDRESS         BT_OP(BT_OGF_LE, 0x0005) /* 0x2005 */
    1046           0 : struct bt_hci_cp_le_set_random_address {
    1047           0 :         bt_addr_t bdaddr;
    1048             : } __packed;
    1049             : 
    1050           0 : #define BT_HCI_ADV_IND                          0x00
    1051           0 : #define BT_HCI_ADV_DIRECT_IND                   0x01
    1052           0 : #define BT_HCI_ADV_SCAN_IND                     0x02
    1053           0 : #define BT_HCI_ADV_NONCONN_IND                  0x03
    1054           0 : #define BT_HCI_ADV_DIRECT_IND_LOW_DUTY          0x04
    1055           0 : #define BT_HCI_ADV_SCAN_RSP                     0x04
    1056             : 
    1057           0 : #define BT_LE_ADV_INTERVAL_MIN                  0x0020
    1058           0 : #define BT_LE_ADV_INTERVAL_MAX                  0x4000
    1059           0 : #define BT_LE_ADV_INTERVAL_DEFAULT              0x0800
    1060             : 
    1061           0 : #define BT_LE_ADV_CHAN_MAP_CHAN_37              0x01
    1062           0 : #define BT_LE_ADV_CHAN_MAP_CHAN_38              0x02
    1063           0 : #define BT_LE_ADV_CHAN_MAP_CHAN_39              0x04
    1064           0 : #define BT_LE_ADV_CHAN_MAP_ALL                  0x07
    1065             : 
    1066           0 : #define BT_LE_ADV_FP_NO_FILTER                  0x00
    1067           0 : #define BT_LE_ADV_FP_FILTER_SCAN_REQ            0x01
    1068           0 : #define BT_LE_ADV_FP_FILTER_CONN_IND            0x02
    1069           0 : #define BT_LE_ADV_FP_FILTER_BOTH                0x03
    1070             : 
    1071           0 : #define BT_HCI_OP_LE_SET_ADV_PARAM              BT_OP(BT_OGF_LE, 0x0006) /* 0x2006 */
    1072           0 : struct bt_hci_cp_le_set_adv_param {
    1073           0 :         uint16_t     min_interval;
    1074           0 :         uint16_t     max_interval;
    1075           0 :         uint8_t      type;
    1076           0 :         uint8_t      own_addr_type;
    1077           0 :         bt_addr_le_t direct_addr;
    1078           0 :         uint8_t      channel_map;
    1079           0 :         uint8_t      filter_policy;
    1080             : } __packed;
    1081             : 
    1082           0 : #define BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER     BT_OP(BT_OGF_LE, 0x0007) /* 0x2007 */
    1083           0 : struct bt_hci_rp_le_read_chan_tx_power {
    1084           0 :         uint8_t status;
    1085           0 :         int8_t  tx_power_level;
    1086             : } __packed;
    1087             : 
    1088           0 : #define BT_HCI_OP_LE_SET_ADV_DATA               BT_OP(BT_OGF_LE, 0x0008) /* 0x2008 */
    1089           0 : struct bt_hci_cp_le_set_adv_data {
    1090           0 :         uint8_t  len;
    1091           0 :         uint8_t  data[31];
    1092             : } __packed;
    1093             : 
    1094           0 : #define BT_HCI_OP_LE_SET_SCAN_RSP_DATA          BT_OP(BT_OGF_LE, 0x0009) /* 0x2009 */
    1095           0 : struct bt_hci_cp_le_set_scan_rsp_data {
    1096           0 :         uint8_t  len;
    1097           0 :         uint8_t  data[31];
    1098             : } __packed;
    1099             : 
    1100           0 : #define BT_HCI_LE_ADV_DISABLE                   0x00
    1101           0 : #define BT_HCI_LE_ADV_ENABLE                    0x01
    1102             : 
    1103           0 : #define BT_HCI_OP_LE_SET_ADV_ENABLE             BT_OP(BT_OGF_LE, 0x000a) /* 0x200a */
    1104           0 : struct bt_hci_cp_le_set_adv_enable {
    1105           0 :         uint8_t  enable;
    1106             : } __packed;
    1107             : 
    1108             : /* Scan types */
    1109           0 : #define BT_HCI_OP_LE_SET_SCAN_PARAM             BT_OP(BT_OGF_LE, 0x000b) /* 0x200b */
    1110           0 : #define BT_HCI_LE_SCAN_PASSIVE                  0x00
    1111           0 : #define BT_HCI_LE_SCAN_ACTIVE                   0x01
    1112             : 
    1113           0 : #define BT_HCI_LE_SCAN_FP_BASIC_NO_FILTER       0x00
    1114           0 : #define BT_HCI_LE_SCAN_FP_BASIC_FILTER          0x01
    1115           0 : #define BT_HCI_LE_SCAN_FP_EXT_NO_FILTER         0x02
    1116           0 : #define BT_HCI_LE_SCAN_FP_EXT_FILTER            0x03
    1117             : 
    1118           0 : struct bt_hci_cp_le_set_scan_param {
    1119           0 :         uint8_t  scan_type;
    1120           0 :         uint16_t interval;
    1121           0 :         uint16_t window;
    1122           0 :         uint8_t  addr_type;
    1123           0 :         uint8_t  filter_policy;
    1124             : } __packed;
    1125             : 
    1126           0 : #define BT_HCI_OP_LE_SET_SCAN_ENABLE            BT_OP(BT_OGF_LE, 0x000c) /* 0x200c */
    1127             : 
    1128           0 : #define BT_HCI_LE_SCAN_DISABLE                  0x00
    1129           0 : #define BT_HCI_LE_SCAN_ENABLE                   0x01
    1130             : 
    1131           0 : #define BT_HCI_LE_SCAN_FILTER_DUP_DISABLE       0x00
    1132           0 : #define BT_HCI_LE_SCAN_FILTER_DUP_ENABLE        0x01
    1133             : 
    1134           0 : struct bt_hci_cp_le_set_scan_enable {
    1135           0 :         uint8_t  enable;
    1136           0 :         uint8_t  filter_dup;
    1137             : } __packed;
    1138             : 
    1139           0 : #define BT_HCI_OP_LE_CREATE_CONN                BT_OP(BT_OGF_LE, 0x000d) /* 0x200d */
    1140             : 
    1141           0 : #define BT_HCI_LE_CREATE_CONN_FP_NO_FILTER      0x00
    1142           0 : #define BT_HCI_LE_CREATE_CONN_FP_FILTER         0x01
    1143             : 
    1144           0 : struct bt_hci_cp_le_create_conn {
    1145           0 :         uint16_t     scan_interval;
    1146           0 :         uint16_t     scan_window;
    1147           0 :         uint8_t      filter_policy;
    1148           0 :         bt_addr_le_t peer_addr;
    1149           0 :         uint8_t      own_addr_type;
    1150           0 :         uint16_t     conn_interval_min;
    1151           0 :         uint16_t     conn_interval_max;
    1152           0 :         uint16_t     conn_latency;
    1153           0 :         uint16_t     supervision_timeout;
    1154           0 :         uint16_t     min_ce_len;
    1155           0 :         uint16_t     max_ce_len;
    1156             : } __packed;
    1157             : 
    1158           0 : #define BT_HCI_OP_LE_CREATE_CONN_CANCEL         BT_OP(BT_OGF_LE, 0x000e) /* 0x200e */
    1159             : 
    1160           0 : #define BT_HCI_OP_LE_READ_FAL_SIZE               BT_OP(BT_OGF_LE, 0x000f) /* 0x200f */
    1161           0 : struct bt_hci_rp_le_read_fal_size {
    1162           0 :         uint8_t  status;
    1163           0 :         uint8_t  fal_size;
    1164             : } __packed;
    1165             : 
    1166           0 : #define BT_HCI_OP_LE_CLEAR_FAL                   BT_OP(BT_OGF_LE, 0x0010) /* 0x2010 */
    1167             : 
    1168           0 : #define BT_HCI_OP_LE_ADD_DEV_TO_FAL              BT_OP(BT_OGF_LE, 0x0011) /* 0x2011 */
    1169           0 : struct bt_hci_cp_le_add_dev_to_fal {
    1170           0 :         bt_addr_le_t  addr;
    1171             : } __packed;
    1172             : 
    1173           0 : #define BT_HCI_OP_LE_REM_DEV_FROM_FAL            BT_OP(BT_OGF_LE, 0x0012) /* 0x2012 */
    1174           0 : struct bt_hci_cp_le_rem_dev_from_fal {
    1175           0 :         bt_addr_le_t  addr;
    1176             : } __packed;
    1177             : 
    1178           0 : #define BT_HCI_OP_LE_CONN_UPDATE                BT_OP(BT_OGF_LE, 0x0013) /* 0x2013 */
    1179           0 : struct hci_cp_le_conn_update {
    1180           0 :         uint16_t handle;
    1181           0 :         uint16_t conn_interval_min;
    1182           0 :         uint16_t conn_interval_max;
    1183           0 :         uint16_t conn_latency;
    1184           0 :         uint16_t supervision_timeout;
    1185           0 :         uint16_t min_ce_len;
    1186           0 :         uint16_t max_ce_len;
    1187             : } __packed;
    1188             : 
    1189           0 : #define BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF      BT_OP(BT_OGF_LE, 0x0014) /* 0x2014 */
    1190           0 : struct bt_hci_cp_le_set_host_chan_classif {
    1191           0 :         uint8_t  ch_map[5];
    1192             : } __packed;
    1193             : 
    1194           0 : #define BT_HCI_OP_LE_READ_CHAN_MAP              BT_OP(BT_OGF_LE, 0x0015) /* 0x2015 */
    1195           0 : struct bt_hci_cp_le_read_chan_map {
    1196           0 :         uint16_t handle;
    1197             : } __packed;
    1198           0 : struct bt_hci_rp_le_read_chan_map {
    1199           0 :         uint8_t  status;
    1200           0 :         uint16_t handle;
    1201           0 :         uint8_t  ch_map[5];
    1202             : } __packed;
    1203             : 
    1204           0 : #define BT_HCI_OP_LE_READ_REMOTE_FEATURES       BT_OP(BT_OGF_LE, 0x0016) /* 0x2016 */
    1205           0 : struct bt_hci_cp_le_read_remote_features {
    1206           0 :         uint16_t  handle;
    1207             : } __packed;
    1208             : 
    1209           0 : #define BT_HCI_OP_LE_ENCRYPT                    BT_OP(BT_OGF_LE, 0x0017) /* 0x2017 */
    1210           0 : struct bt_hci_cp_le_encrypt {
    1211           0 :         uint8_t  key[16];
    1212           0 :         uint8_t  plaintext[16];
    1213             : } __packed;
    1214           0 : struct bt_hci_rp_le_encrypt {
    1215           0 :         uint8_t  status;
    1216           0 :         uint8_t  enc_data[16];
    1217             : } __packed;
    1218             : 
    1219           0 : #define BT_HCI_OP_LE_RAND                       BT_OP(BT_OGF_LE, 0x0018) /* 0x2018 */
    1220           0 : struct bt_hci_rp_le_rand {
    1221           0 :         uint8_t  status;
    1222           0 :         uint8_t  rand[8];
    1223             : } __packed;
    1224             : 
    1225           0 : #define BT_HCI_OP_LE_START_ENCRYPTION           BT_OP(BT_OGF_LE, 0x0019) /* 0x2019 */
    1226           0 : struct bt_hci_cp_le_start_encryption {
    1227           0 :         uint16_t handle;
    1228           0 :         uint64_t rand;
    1229           0 :         uint16_t ediv;
    1230           0 :         uint8_t  ltk[16];
    1231             : } __packed;
    1232             : 
    1233           0 : #define BT_HCI_OP_LE_LTK_REQ_REPLY              BT_OP(BT_OGF_LE, 0x001a) /* 0x201a */
    1234           0 : struct bt_hci_cp_le_ltk_req_reply {
    1235           0 :         uint16_t handle;
    1236           0 :         uint8_t  ltk[16];
    1237             : } __packed;
    1238           0 : struct bt_hci_rp_le_ltk_req_reply {
    1239           0 :         uint8_t  status;
    1240           0 :         uint16_t handle;
    1241             : } __packed;
    1242             : 
    1243           0 : #define BT_HCI_OP_LE_LTK_REQ_NEG_REPLY          BT_OP(BT_OGF_LE, 0x001b) /* 0x201b */
    1244           0 : struct bt_hci_cp_le_ltk_req_neg_reply {
    1245           0 :         uint16_t handle;
    1246             : } __packed;
    1247           0 : struct bt_hci_rp_le_ltk_req_neg_reply {
    1248           0 :         uint8_t  status;
    1249           0 :         uint16_t handle;
    1250             : } __packed;
    1251             : 
    1252           0 : #define BT_HCI_OP_LE_READ_SUPP_STATES           BT_OP(BT_OGF_LE, 0x001c) /* 0x201c */
    1253           0 : struct bt_hci_rp_le_read_supp_states {
    1254           0 :         uint8_t  status;
    1255           0 :         uint8_t  le_states[8];
    1256             : } __packed;
    1257             : 
    1258           0 : #define BT_HCI_OP_LE_RX_TEST                    BT_OP(BT_OGF_LE, 0x001d) /* 0x201d */
    1259           0 : struct bt_hci_cp_le_rx_test {
    1260           0 :         uint8_t  rx_ch;
    1261             : } __packed;
    1262             : 
    1263           0 : #define BT_HCI_TEST_PKT_PAYLOAD_PRBS9           0x00
    1264           0 : #define BT_HCI_TEST_PKT_PAYLOAD_11110000        0x01
    1265           0 : #define BT_HCI_TEST_PKT_PAYLOAD_10101010        0x02
    1266           0 : #define BT_HCI_TEST_PKT_PAYLOAD_PRBS15          0x03
    1267           0 : #define BT_HCI_TEST_PKT_PAYLOAD_11111111        0x04
    1268           0 : #define BT_HCI_TEST_PKT_PAYLOAD_00000000        0x05
    1269           0 : #define BT_HCI_TEST_PKT_PAYLOAD_00001111        0x06
    1270           0 : #define BT_HCI_TEST_PKT_PAYLOAD_01010101        0x07
    1271             : 
    1272           0 : #define BT_HCI_OP_LE_TX_TEST                    BT_OP(BT_OGF_LE, 0x001e) /* 0x201e */
    1273           0 : struct bt_hci_cp_le_tx_test {
    1274           0 :         uint8_t  tx_ch;
    1275           0 :         uint8_t  test_data_len;
    1276           0 :         uint8_t  pkt_payload;
    1277             : } __packed;
    1278             : 
    1279           0 : #define BT_HCI_OP_LE_TEST_END                   BT_OP(BT_OGF_LE, 0x001f) /* 0x201f */
    1280           0 : struct bt_hci_rp_le_test_end {
    1281           0 :         uint8_t  status;
    1282           0 :         uint16_t rx_pkt_count;
    1283             : } __packed;
    1284             : 
    1285           0 : #define BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY       BT_OP(BT_OGF_LE, 0x0020) /* 0x2020 */
    1286           0 : struct bt_hci_cp_le_conn_param_req_reply {
    1287           0 :         uint16_t handle;
    1288           0 :         uint16_t interval_min;
    1289           0 :         uint16_t interval_max;
    1290           0 :         uint16_t latency;
    1291           0 :         uint16_t timeout;
    1292           0 :         uint16_t min_ce_len;
    1293           0 :         uint16_t max_ce_len;
    1294             : } __packed;
    1295           0 : struct bt_hci_rp_le_conn_param_req_reply {
    1296           0 :         uint8_t  status;
    1297           0 :         uint16_t handle;
    1298             : } __packed;
    1299             : 
    1300           0 : #define BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY   BT_OP(BT_OGF_LE, 0x0021) /* 0x2021 */
    1301           0 : struct bt_hci_cp_le_conn_param_req_neg_reply {
    1302           0 :         uint16_t handle;
    1303           0 :         uint8_t  reason;
    1304             : } __packed;
    1305           0 : struct bt_hci_rp_le_conn_param_req_neg_reply {
    1306           0 :         uint8_t  status;
    1307           0 :         uint16_t handle;
    1308             : } __packed;
    1309             : 
    1310           0 : #define BT_HCI_OP_LE_SET_DATA_LEN               BT_OP(BT_OGF_LE, 0x0022) /* 0x2022 */
    1311           0 : struct bt_hci_cp_le_set_data_len {
    1312           0 :         uint16_t handle;
    1313           0 :         uint16_t tx_octets;
    1314           0 :         uint16_t tx_time;
    1315             : } __packed;
    1316           0 : struct bt_hci_rp_le_set_data_len {
    1317           0 :         uint8_t  status;
    1318           0 :         uint16_t handle;
    1319             : } __packed;
    1320             : 
    1321           0 : #define BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN      BT_OP(BT_OGF_LE, 0x0023) /* 0x2023 */
    1322           0 : struct bt_hci_rp_le_read_default_data_len {
    1323           0 :         uint8_t  status;
    1324           0 :         uint16_t max_tx_octets;
    1325           0 :         uint16_t max_tx_time;
    1326             : } __packed;
    1327             : 
    1328           0 : #define BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN     BT_OP(BT_OGF_LE, 0x0024) /* 0x2024 */
    1329           0 : struct bt_hci_cp_le_write_default_data_len {
    1330           0 :         uint16_t max_tx_octets;
    1331           0 :         uint16_t max_tx_time;
    1332             : } __packed;
    1333             : 
    1334           0 : #define BT_HCI_OP_LE_P256_PUBLIC_KEY            BT_OP(BT_OGF_LE, 0x0025) /* 0x2025 */
    1335             : 
    1336           0 : #define BT_HCI_OP_LE_GENERATE_DHKEY             BT_OP(BT_OGF_LE, 0x0026) /* 0x2026 */
    1337           0 : struct bt_hci_cp_le_generate_dhkey {
    1338           0 :         uint8_t key[64];
    1339             : } __packed;
    1340             : 
    1341             : 
    1342           0 : #define BT_HCI_OP_LE_GENERATE_DHKEY_V2          BT_OP(BT_OGF_LE, 0x005e) /* 0x205e */
    1343             : 
    1344           0 : #define BT_HCI_LE_KEY_TYPE_GENERATED            0x00
    1345           0 : #define BT_HCI_LE_KEY_TYPE_DEBUG                0x01
    1346             : 
    1347           0 : struct bt_hci_cp_le_generate_dhkey_v2 {
    1348           0 :         uint8_t key[64];
    1349           0 :         uint8_t key_type;
    1350             : } __packed;
    1351             : 
    1352             : 
    1353           0 : #define BT_HCI_OP_LE_ADD_DEV_TO_RL              BT_OP(BT_OGF_LE, 0x0027) /* 0x2027 */
    1354           0 : struct bt_hci_cp_le_add_dev_to_rl {
    1355           0 :         bt_addr_le_t  peer_id_addr;
    1356           0 :         uint8_t       peer_irk[16];
    1357           0 :         uint8_t       local_irk[16];
    1358             : } __packed;
    1359             : 
    1360           0 : #define BT_HCI_OP_LE_REM_DEV_FROM_RL            BT_OP(BT_OGF_LE, 0x0028) /* 0x2028 */
    1361           0 : struct bt_hci_cp_le_rem_dev_from_rl {
    1362           0 :         bt_addr_le_t  peer_id_addr;
    1363             : } __packed;
    1364             : 
    1365           0 : #define BT_HCI_OP_LE_CLEAR_RL                   BT_OP(BT_OGF_LE, 0x0029) /* 0x2029 */
    1366             : 
    1367           0 : #define BT_HCI_OP_LE_READ_RL_SIZE               BT_OP(BT_OGF_LE, 0x002a) /* 0x202a */
    1368           0 : struct bt_hci_rp_le_read_rl_size {
    1369           0 :         uint8_t  status;
    1370           0 :         uint8_t  rl_size;
    1371             : } __packed;
    1372             : 
    1373           0 : #define BT_HCI_OP_LE_READ_PEER_RPA              BT_OP(BT_OGF_LE, 0x002b) /* 0x202b */
    1374           0 : struct bt_hci_cp_le_read_peer_rpa {
    1375           0 :         bt_addr_le_t  peer_id_addr;
    1376             : } __packed;
    1377           0 : struct bt_hci_rp_le_read_peer_rpa {
    1378           0 :         uint8_t    status;
    1379           0 :         bt_addr_t  peer_rpa;
    1380             : } __packed;
    1381             : 
    1382           0 : #define BT_HCI_OP_LE_READ_LOCAL_RPA             BT_OP(BT_OGF_LE, 0x002c) /* 0x202c */
    1383           0 : struct bt_hci_cp_le_read_local_rpa {
    1384           0 :         bt_addr_le_t  peer_id_addr;
    1385             : } __packed;
    1386           0 : struct bt_hci_rp_le_read_local_rpa {
    1387           0 :         uint8_t    status;
    1388           0 :         bt_addr_t  local_rpa;
    1389             : } __packed;
    1390             : 
    1391           0 : #define BT_HCI_ADDR_RES_DISABLE                 0x00
    1392           0 : #define BT_HCI_ADDR_RES_ENABLE                  0x01
    1393             : 
    1394           0 : #define BT_HCI_OP_LE_SET_ADDR_RES_ENABLE        BT_OP(BT_OGF_LE, 0x002d) /* 0x202d */
    1395           0 : struct bt_hci_cp_le_set_addr_res_enable {
    1396           0 :         uint8_t  enable;
    1397             : } __packed;
    1398             : 
    1399           0 : #define BT_HCI_OP_LE_SET_RPA_TIMEOUT            BT_OP(BT_OGF_LE, 0x002e) /* 0x202e */
    1400           0 : struct bt_hci_cp_le_set_rpa_timeout {
    1401           0 :         uint16_t rpa_timeout;
    1402             : } __packed;
    1403             : 
    1404             : /* All limits according to BT Core spec 5.4 [Vol 4, Part E, 7.8.46] */
    1405           0 : #define BT_HCI_LE_MAX_TX_OCTETS_MIN             0x001B
    1406           0 : #define BT_HCI_LE_MAX_TX_OCTETS_MAX             0x00FB
    1407           0 : #define BT_HCI_LE_MAX_RX_OCTETS_MIN             0x001B
    1408           0 : #define BT_HCI_LE_MAX_RX_OCTETS_MAX             0x00FB
    1409             : 
    1410           0 : #define BT_HCI_LE_MAX_TX_TIME_MIN               0x0148
    1411           0 : #define BT_HCI_LE_MAX_TX_TIME_MAX               0x4290
    1412           0 : #define BT_HCI_LE_MAX_RX_TIME_MIN               0x0148
    1413           0 : #define BT_HCI_LE_MAX_RX_TIME_MAX               0x4290
    1414             : 
    1415           0 : #define BT_HCI_OP_LE_READ_MAX_DATA_LEN          BT_OP(BT_OGF_LE, 0x002f) /* 0x202f */
    1416           0 : struct bt_hci_rp_le_read_max_data_len {
    1417           0 :         uint8_t  status;
    1418           0 :         uint16_t max_tx_octets;
    1419           0 :         uint16_t max_tx_time;
    1420           0 :         uint16_t max_rx_octets;
    1421           0 :         uint16_t max_rx_time;
    1422             : } __packed;
    1423             : 
    1424           0 : #define BT_HCI_LE_PHY_1M                        0x01
    1425           0 : #define BT_HCI_LE_PHY_2M                        0x02
    1426           0 : #define BT_HCI_LE_PHY_CODED                     0x03
    1427             : 
    1428           0 : #define BT_HCI_OP_LE_READ_PHY                   BT_OP(BT_OGF_LE, 0x0030) /* 0x2030 */
    1429           0 : struct bt_hci_cp_le_read_phy {
    1430           0 :         uint16_t handle;
    1431             : } __packed;
    1432           0 : struct bt_hci_rp_le_read_phy {
    1433           0 :         uint8_t  status;
    1434           0 :         uint16_t handle;
    1435           0 :         uint8_t  tx_phy;
    1436           0 :         uint8_t  rx_phy;
    1437             : } __packed;
    1438             : 
    1439           0 : #define BT_HCI_LE_PHY_TX_ANY                    BIT(0)
    1440           0 : #define BT_HCI_LE_PHY_RX_ANY                    BIT(1)
    1441             : 
    1442           0 : #define BT_HCI_LE_PHY_PREFER_1M                 BIT(0)
    1443           0 : #define BT_HCI_LE_PHY_PREFER_2M                 BIT(1)
    1444           0 : #define BT_HCI_LE_PHY_PREFER_CODED              BIT(2)
    1445             : 
    1446           0 : #define BT_HCI_OP_LE_SET_DEFAULT_PHY            BT_OP(BT_OGF_LE, 0x0031) /* 0x2031 */
    1447           0 : struct bt_hci_cp_le_set_default_phy {
    1448           0 :         uint8_t all_phys;
    1449           0 :         uint8_t tx_phys;
    1450           0 :         uint8_t rx_phys;
    1451             : } __packed;
    1452             : 
    1453           0 : #define BT_HCI_LE_PHY_CODED_ANY                 0x00
    1454           0 : #define BT_HCI_LE_PHY_CODED_S2                  0x01
    1455           0 : #define BT_HCI_LE_PHY_CODED_S8                  0x02
    1456             : 
    1457           0 : #define BT_HCI_OP_LE_SET_PHY                    BT_OP(BT_OGF_LE, 0x0032) /* 0x2032 */
    1458           0 : struct bt_hci_cp_le_set_phy {
    1459           0 :         uint16_t  handle;
    1460           0 :         uint8_t   all_phys;
    1461           0 :         uint8_t   tx_phys;
    1462           0 :         uint8_t   rx_phys;
    1463           0 :         uint16_t  phy_opts;
    1464             : } __packed;
    1465             : 
    1466           0 : #define BT_HCI_LE_MOD_INDEX_STANDARD            0x00
    1467           0 : #define BT_HCI_LE_MOD_INDEX_STABLE              0x01
    1468             : 
    1469           0 : #define BT_HCI_LE_RX_PHY_1M                     0x01
    1470           0 : #define BT_HCI_LE_RX_PHY_2M                     0x02
    1471           0 : #define BT_HCI_LE_RX_PHY_CODED                  0x03
    1472             : 
    1473           0 : #define BT_HCI_OP_LE_ENH_RX_TEST                BT_OP(BT_OGF_LE, 0x0033) /* 0x2033 */
    1474           0 : struct bt_hci_cp_le_enh_rx_test {
    1475           0 :         uint8_t  rx_ch;
    1476           0 :         uint8_t  phy;
    1477           0 :         uint8_t  mod_index;
    1478             : } __packed;
    1479             : 
    1480           0 : #define BT_HCI_LE_TX_PHY_1M                     0x01
    1481           0 : #define BT_HCI_LE_TX_PHY_2M                     0x02
    1482           0 : #define BT_HCI_LE_TX_PHY_CODED_S8               0x03
    1483           0 : #define BT_HCI_LE_TX_PHY_CODED_S2               0x04
    1484             : 
    1485           0 : #define BT_HCI_OP_LE_ENH_TX_TEST                BT_OP(BT_OGF_LE, 0x0034) /* 0x2034 */
    1486           0 : struct bt_hci_cp_le_enh_tx_test {
    1487           0 :         uint8_t  tx_ch;
    1488           0 :         uint8_t  test_data_len;
    1489           0 :         uint8_t  pkt_payload;
    1490           0 :         uint8_t  phy;
    1491             : } __packed;
    1492             : 
    1493           0 : #define BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR    BT_OP(BT_OGF_LE, 0x0035) /* 0x2035 */
    1494           0 : struct bt_hci_cp_le_set_adv_set_random_addr {
    1495           0 :         uint8_t   handle;
    1496           0 :         bt_addr_t bdaddr;
    1497             : } __packed;
    1498             : 
    1499           0 : #define BT_HCI_LE_ADV_PROP_CONN                 BIT(0)
    1500           0 : #define BT_HCI_LE_ADV_PROP_SCAN                 BIT(1)
    1501           0 : #define BT_HCI_LE_ADV_PROP_DIRECT               BIT(2)
    1502           0 : #define BT_HCI_LE_ADV_PROP_HI_DC_CONN           BIT(3)
    1503           0 : #define BT_HCI_LE_ADV_PROP_LEGACY               BIT(4)
    1504           0 : #define BT_HCI_LE_ADV_PROP_ANON                 BIT(5)
    1505           0 : #define BT_HCI_LE_ADV_PROP_TX_POWER             BIT(6)
    1506             : 
    1507           0 : #define BT_HCI_LE_PRIM_ADV_INTERVAL_MIN         0x000020
    1508           0 : #define BT_HCI_LE_PRIM_ADV_INTERVAL_MAX         0xFFFFFF
    1509             : 
    1510           0 : #define BT_HCI_LE_ADV_SCAN_REQ_ENABLE  1
    1511           0 : #define BT_HCI_LE_ADV_SCAN_REQ_DISABLE 0
    1512             : 
    1513           0 : #define BT_HCI_LE_ADV_TX_POWER_NO_PREF 0x7F
    1514             : 
    1515           0 : #define BT_HCI_LE_ADV_HANDLE_MAX       0xEF
    1516             : 
    1517           0 : #define BT_HCI_LE_EXT_ADV_SID_INVALID  0xFF
    1518             : 
    1519           0 : #define BT_HCI_OP_LE_SET_EXT_ADV_PARAM          BT_OP(BT_OGF_LE, 0x0036) /* 0x2036 */
    1520           0 : struct bt_hci_cp_le_set_ext_adv_param {
    1521           0 :         uint8_t      handle;
    1522           0 :         uint16_t     props;
    1523           0 :         uint8_t      prim_min_interval[3];
    1524           0 :         uint8_t      prim_max_interval[3];
    1525           0 :         uint8_t      prim_channel_map;
    1526           0 :         uint8_t      own_addr_type;
    1527           0 :         bt_addr_le_t peer_addr;
    1528           0 :         uint8_t      filter_policy;
    1529           0 :         int8_t       tx_power;
    1530           0 :         uint8_t      prim_adv_phy;
    1531           0 :         uint8_t      sec_adv_max_skip;
    1532           0 :         uint8_t      sec_adv_phy;
    1533           0 :         uint8_t      sid;
    1534           0 :         uint8_t      scan_req_notify_enable;
    1535             : } __packed;
    1536           0 : struct bt_hci_rp_le_set_ext_adv_param {
    1537           0 :         uint8_t status;
    1538           0 :         int8_t  tx_power;
    1539             : } __packed;
    1540             : 
    1541           0 : #define BT_HCI_LE_EXT_ADV_OP_INTERM_FRAG        0x00
    1542           0 : #define BT_HCI_LE_EXT_ADV_OP_FIRST_FRAG         0x01
    1543           0 : #define BT_HCI_LE_EXT_ADV_OP_LAST_FRAG          0x02
    1544           0 : #define BT_HCI_LE_EXT_ADV_OP_COMPLETE_DATA      0x03
    1545           0 : #define BT_HCI_LE_EXT_ADV_OP_UNCHANGED_DATA     0x04
    1546             : 
    1547           0 : #define BT_HCI_LE_EXT_ADV_FRAG_ENABLED          0x00
    1548           0 : #define BT_HCI_LE_EXT_ADV_FRAG_DISABLED         0x01
    1549             : 
    1550           0 : #define BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN          251
    1551             : 
    1552           0 : #define BT_HCI_OP_LE_SET_EXT_ADV_DATA           BT_OP(BT_OGF_LE, 0x0037) /* 0x2037 */
    1553           0 : struct bt_hci_cp_le_set_ext_adv_data {
    1554           0 :         uint8_t  handle;
    1555           0 :         uint8_t  op;
    1556           0 :         uint8_t  frag_pref;
    1557           0 :         uint8_t  len;
    1558           0 :         uint8_t  data[0];
    1559             : } __packed;
    1560             : 
    1561           0 : #define BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA      BT_OP(BT_OGF_LE, 0x0038) /* 0x2038 */
    1562           0 : struct bt_hci_cp_le_set_ext_scan_rsp_data {
    1563           0 :         uint8_t  handle;
    1564           0 :         uint8_t  op;
    1565           0 :         uint8_t  frag_pref;
    1566           0 :         uint8_t  len;
    1567           0 :         uint8_t  data[0];
    1568             : } __packed;
    1569             : 
    1570           0 : #define BT_HCI_OP_LE_SET_EXT_ADV_ENABLE         BT_OP(BT_OGF_LE, 0x0039) /* 0x2039 */
    1571           0 : struct bt_hci_ext_adv_set {
    1572           0 :         uint8_t  handle;
    1573           0 :         uint16_t duration;
    1574           0 :         uint8_t  max_ext_adv_evts;
    1575             : } __packed;
    1576             : 
    1577           0 : struct bt_hci_cp_le_set_ext_adv_enable {
    1578           0 :         uint8_t  enable;
    1579           0 :         uint8_t  set_num;
    1580           0 :         struct bt_hci_ext_adv_set s[0];
    1581             : } __packed;
    1582             : 
    1583           0 : #define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN      BT_OP(BT_OGF_LE, 0x003a) /* 0x203a */
    1584           0 : struct bt_hci_rp_le_read_max_adv_data_len {
    1585           0 :         uint8_t  status;
    1586           0 :         uint16_t max_adv_data_len;
    1587             : } __packed;
    1588             : 
    1589           0 : #define BT_HCI_OP_LE_READ_NUM_ADV_SETS          BT_OP(BT_OGF_LE, 0x003b) /* 0x203b */
    1590           0 : struct bt_hci_rp_le_read_num_adv_sets {
    1591           0 :         uint8_t  status;
    1592           0 :         uint8_t  num_sets;
    1593             : } __packed;
    1594             : 
    1595           0 : #define BT_HCI_OP_LE_REMOVE_ADV_SET             BT_OP(BT_OGF_LE, 0x003c) /* 0x203c */
    1596           0 : struct bt_hci_cp_le_remove_adv_set {
    1597           0 :         uint8_t  handle;
    1598             : } __packed;
    1599             : 
    1600           0 : #define BT_HCI_OP_CLEAR_ADV_SETS                BT_OP(BT_OGF_LE, 0x003d) /* 0x203d */
    1601             : 
    1602           0 : #define BT_HCI_LE_PER_ADV_INTERVAL_MIN          0x0006
    1603           0 : #define BT_HCI_LE_PER_ADV_INTERVAL_MAX          0xFFFF
    1604             : 
    1605           0 : #define BT_HCI_OP_LE_SET_PER_ADV_PARAM          BT_OP(BT_OGF_LE, 0x003e) /* 0x203e */
    1606           0 : struct bt_hci_cp_le_set_per_adv_param {
    1607           0 :         uint8_t  handle;
    1608           0 :         uint16_t min_interval;
    1609           0 :         uint16_t max_interval;
    1610           0 :         uint16_t props;
    1611             : } __packed;
    1612             : 
    1613           0 : #define BT_HCI_LE_PER_ADV_OP_INTERM_FRAG        0x00
    1614           0 : #define BT_HCI_LE_PER_ADV_OP_FIRST_FRAG         0x01
    1615           0 : #define BT_HCI_LE_PER_ADV_OP_LAST_FRAG          0x02
    1616           0 : #define BT_HCI_LE_PER_ADV_OP_COMPLETE_DATA      0x03
    1617             : 
    1618           0 : #define BT_HCI_LE_PER_ADV_FRAG_MAX_LEN          252
    1619             : 
    1620           0 : #define BT_HCI_OP_LE_SET_PER_ADV_DATA           BT_OP(BT_OGF_LE, 0x003f) /* 0x203f */
    1621           0 : struct bt_hci_cp_le_set_per_adv_data {
    1622           0 :         uint8_t  handle;
    1623           0 :         uint8_t  op;
    1624           0 :         uint8_t  len;
    1625           0 :         uint8_t  data[0];
    1626             : } __packed;
    1627             : 
    1628           0 : #define BT_HCI_LE_SET_PER_ADV_ENABLE_ENABLE     BIT(0)
    1629           0 : #define BT_HCI_LE_SET_PER_ADV_ENABLE_ADI        BIT(1)
    1630             : 
    1631           0 : #define BT_HCI_OP_LE_SET_PER_ADV_ENABLE         BT_OP(BT_OGF_LE, 0x0040) /* 0x2040 */
    1632           0 : struct bt_hci_cp_le_set_per_adv_enable {
    1633           0 :         uint8_t  enable;
    1634           0 :         uint8_t  handle;
    1635             : } __packed;
    1636             : 
    1637           0 : #define BT_HCI_OP_LE_SET_EXT_SCAN_PARAM         BT_OP(BT_OGF_LE, 0x0041) /* 0x2041 */
    1638           0 : struct bt_hci_ext_scan_phy {
    1639           0 :         uint8_t  type;
    1640           0 :         uint16_t interval;
    1641           0 :         uint16_t window;
    1642             : } __packed;
    1643             : 
    1644           0 : #define BT_HCI_LE_EXT_SCAN_PHY_1M               BIT(0)
    1645           0 : #define BT_HCI_LE_EXT_SCAN_PHY_2M               BIT(1)
    1646           0 : #define BT_HCI_LE_EXT_SCAN_PHY_CODED            BIT(2)
    1647             : 
    1648           0 : struct bt_hci_cp_le_set_ext_scan_param {
    1649           0 :         uint8_t  own_addr_type;
    1650           0 :         uint8_t  filter_policy;
    1651           0 :         uint8_t  phys;
    1652           0 :         struct bt_hci_ext_scan_phy p[0];
    1653             : } __packed;
    1654             : 
    1655             : /* Extends BT_HCI_LE_SCAN_FILTER_DUP */
    1656           0 : #define BT_HCI_LE_EXT_SCAN_FILTER_DUP_ENABLE_RESET  0x02
    1657             : 
    1658           0 : #define BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE        BT_OP(BT_OGF_LE, 0x0042) /* 0x2042 */
    1659           0 : struct bt_hci_cp_le_set_ext_scan_enable {
    1660           0 :         uint8_t  enable;
    1661           0 :         uint8_t  filter_dup;
    1662           0 :         uint16_t duration;
    1663           0 :         uint16_t period;
    1664             : } __packed;
    1665             : 
    1666           0 : #define BT_HCI_OP_LE_EXT_CREATE_CONN            BT_OP(BT_OGF_LE, 0x0043) /* 0x2043 */
    1667           0 : #define BT_HCI_OP_LE_EXT_CREATE_CONN_V2         BT_OP(BT_OGF_LE, 0x0085) /* 0x2085 */
    1668           0 : struct bt_hci_ext_conn_phy {
    1669           0 :         uint16_t scan_interval;
    1670           0 :         uint16_t scan_window;
    1671           0 :         uint16_t conn_interval_min;
    1672           0 :         uint16_t conn_interval_max;
    1673           0 :         uint16_t conn_latency;
    1674           0 :         uint16_t supervision_timeout;
    1675           0 :         uint16_t min_ce_len;
    1676           0 :         uint16_t max_ce_len;
    1677             : } __packed;
    1678             : 
    1679           0 : struct bt_hci_cp_le_ext_create_conn {
    1680           0 :         uint8_t      filter_policy;
    1681           0 :         uint8_t      own_addr_type;
    1682           0 :         bt_addr_le_t peer_addr;
    1683           0 :         uint8_t      phys;
    1684           0 :         struct bt_hci_ext_conn_phy p[0];
    1685             : } __packed;
    1686             : 
    1687           0 : struct bt_hci_cp_le_ext_create_conn_v2 {
    1688           0 :         uint8_t      adv_handle;
    1689           0 :         uint8_t      subevent;
    1690           0 :         uint8_t      filter_policy;
    1691           0 :         uint8_t      own_addr_type;
    1692           0 :         bt_addr_le_t peer_addr;
    1693           0 :         uint8_t      phys;
    1694           0 :         struct bt_hci_ext_conn_phy p[0];
    1695             : } __packed;
    1696             : 
    1697           0 : #define BT_HCI_OP_LE_SET_PER_ADV_SUBEVENT_DATA  BT_OP(BT_OGF_LE, 0x0082) /* 0x2082 */
    1698           0 : struct bt_hci_cp_le_set_pawr_subevent_data_element {
    1699           0 :         uint8_t subevent;
    1700           0 :         uint8_t response_slot_start;
    1701           0 :         uint8_t response_slot_count;
    1702           0 :         uint8_t subevent_data_length;
    1703           0 :         uint8_t subevent_data[0];
    1704             : } __packed;
    1705             : 
    1706           0 : struct bt_hci_cp_le_set_pawr_subevent_data {
    1707           0 :         uint8_t adv_handle;
    1708           0 :         uint8_t num_subevents;
    1709           0 :         struct bt_hci_cp_le_set_pawr_subevent_data_element subevents[0];
    1710             : } __packed;
    1711             : 
    1712             : 
    1713           0 : #define BT_HCI_OP_LE_SET_PER_ADV_RESPONSE_DATA  BT_OP(BT_OGF_LE, 0x0083) /* 0x2083 */
    1714           0 : struct bt_hci_cp_le_set_pawr_response_data {
    1715           0 :         uint16_t sync_handle;
    1716           0 :         uint16_t request_event;
    1717           0 :         uint8_t  request_subevent;
    1718           0 :         uint8_t  response_subevent;
    1719           0 :         uint8_t  response_slot;
    1720           0 :         uint8_t  response_data_length;
    1721           0 :         uint8_t  response_data[0];
    1722             : } __packed;
    1723             : 
    1724           0 : #define BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT  BT_OP(BT_OGF_LE, 0x0084) /* 0x2084 */
    1725           0 : struct bt_hci_cp_le_set_pawr_sync_subevent {
    1726           0 :         uint16_t sync_handle;
    1727           0 :         uint16_t periodic_adv_properties;
    1728           0 :         uint8_t  num_subevents;
    1729           0 :         uint8_t  subevents[0];
    1730             : } __packed;
    1731             : 
    1732             : 
    1733           0 : #define BT_HCI_OP_LE_SET_PER_ADV_PARAM_V2       BT_OP(BT_OGF_LE, 0x0086) /* 0x2086 */
    1734           0 : struct bt_hci_cp_le_set_per_adv_param_v2 {
    1735           0 :         uint8_t  handle;
    1736           0 :         uint16_t min_interval;
    1737           0 :         uint16_t max_interval;
    1738           0 :         uint16_t props;
    1739           0 :         uint8_t  num_subevents;
    1740           0 :         uint8_t  subevent_interval;
    1741           0 :         uint8_t  response_slot_delay;
    1742           0 :         uint8_t  response_slot_spacing;
    1743           0 :         uint8_t  num_response_slots;
    1744             : } __packed;
    1745             : 
    1746             : 
    1747           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST               BIT(0)
    1748           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED       BIT(1)
    1749           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE       BIT(2)
    1750             : 
    1751           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING     0
    1752           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOA           BIT(0)
    1753           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_1US       BIT(1)
    1754           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_2US       BIT(2)
    1755           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_CTE           BIT(3)
    1756           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ONLY_CTE         BIT(4)
    1757             : /* Constants to check correctness of CTE type */
    1758           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS 5
    1759           0 : #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE \
    1760             :         (~BIT_MASK(BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS))
    1761             : 
    1762           0 : #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC        BT_OP(BT_OGF_LE, 0x0044) /* 0x2044 */
    1763           0 : struct bt_hci_cp_le_per_adv_create_sync {
    1764           0 :         uint8_t      options;
    1765           0 :         uint8_t      sid;
    1766           0 :         bt_addr_le_t addr;
    1767           0 :         uint16_t     skip;
    1768           0 :         uint16_t     sync_timeout;
    1769           0 :         uint8_t      cte_type;
    1770             : } __packed;
    1771             : 
    1772           0 : #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL BT_OP(BT_OGF_LE, 0x0045) /* 0x2045 */
    1773             : 
    1774           0 : #define BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC     BT_OP(BT_OGF_LE, 0x0046) /* 0x2046 */
    1775           0 : struct bt_hci_cp_le_per_adv_terminate_sync {
    1776           0 :         uint16_t handle;
    1777             : } __packed;
    1778             : 
    1779           0 : #define BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST    BT_OP(BT_OGF_LE, 0x0047) /* 0x2047 */
    1780           0 : struct bt_hci_cp_le_add_dev_to_per_adv_list {
    1781           0 :         bt_addr_le_t addr;
    1782           0 :         uint8_t      sid;
    1783             : } __packed;
    1784             : 
    1785           0 : #define BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST  BT_OP(BT_OGF_LE, 0x0048) /* 0x2048 */
    1786           0 : struct bt_hci_cp_le_rem_dev_from_per_adv_list {
    1787           0 :         bt_addr_le_t addr;
    1788           0 :         uint8_t      sid;
    1789             : } __packed;
    1790             : 
    1791           0 : #define BT_HCI_OP_LE_CLEAR_PER_ADV_LIST         BT_OP(BT_OGF_LE, 0x0049) /* 0x2049 */
    1792             : 
    1793           0 : #define BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE     BT_OP(BT_OGF_LE, 0x004a) /* 0x204a */
    1794           0 : struct bt_hci_rp_le_read_per_adv_list_size {
    1795           0 :         uint8_t  status;
    1796           0 :         uint8_t  list_size;
    1797             : } __packed;
    1798             : 
    1799           0 : #define BT_HCI_OP_LE_READ_TX_POWER              BT_OP(BT_OGF_LE, 0x004b) /* 0x204b */
    1800           0 : struct bt_hci_rp_le_read_tx_power {
    1801           0 :         uint8_t status;
    1802           0 :         int8_t  min_tx_power;
    1803           0 :         int8_t  max_tx_power;
    1804             : } __packed;
    1805             : 
    1806           0 : #define BT_HCI_OP_LE_READ_RF_PATH_COMP          BT_OP(BT_OGF_LE, 0x004c) /* 0x204c */
    1807           0 : struct bt_hci_rp_le_read_rf_path_comp {
    1808           0 :         uint8_t status;
    1809           0 :         int16_t tx_path_comp;
    1810           0 :         int16_t rx_path_comp;
    1811             : } __packed;
    1812             : 
    1813           0 : #define BT_HCI_OP_LE_WRITE_RF_PATH_COMP         BT_OP(BT_OGF_LE, 0x004d) /* 0x204d */
    1814           0 : struct bt_hci_cp_le_write_rf_path_comp {
    1815           0 :         int16_t  tx_path_comp;
    1816           0 :         int16_t  rx_path_comp;
    1817             : } __packed;
    1818             : 
    1819           0 : #define BT_HCI_LE_PRIVACY_MODE_NETWORK          0x00
    1820           0 : #define BT_HCI_LE_PRIVACY_MODE_DEVICE           0x01
    1821             : 
    1822           0 : #define BT_HCI_OP_LE_SET_PRIVACY_MODE           BT_OP(BT_OGF_LE, 0x004e) /* 0x204e */
    1823           0 : struct bt_hci_cp_le_set_privacy_mode {
    1824           0 :         bt_addr_le_t id_addr;
    1825           0 :         uint8_t         mode;
    1826             : } __packed;
    1827             : 
    1828           0 : #define BT_HCI_LE_TEST_CTE_DISABLED             0x00
    1829           0 : #define BT_HCI_LE_TEST_CTE_TYPE_ANY             0x00
    1830           0 : #define BT_HCI_LE_TEST_SLOT_DURATION_ANY        0x00
    1831           0 : #define BT_HCI_LE_TEST_SWITCH_PATTERN_LEN_ANY   0x00
    1832             : 
    1833           0 : #define BT_HCI_OP_LE_RX_TEST_V3                 BT_OP(BT_OGF_LE, 0x004f) /* 0x204f */
    1834           0 : struct bt_hci_cp_le_rx_test_v3 {
    1835           0 :         uint8_t  rx_ch;
    1836           0 :         uint8_t  phy;
    1837           0 :         uint8_t  mod_index;
    1838           0 :         uint8_t  expected_cte_len;
    1839           0 :         uint8_t  expected_cte_type;
    1840           0 :         uint8_t  slot_durations;
    1841           0 :         uint8_t  switch_pattern_len;
    1842           0 :         uint8_t  ant_ids[0];
    1843             : } __packed;
    1844             : 
    1845           0 : #define BT_HCI_OP_LE_TX_TEST_V3                 BT_OP(BT_OGF_LE, 0x0050) /* 0x2050 */
    1846             : 
    1847           0 : struct bt_hci_cp_le_tx_test_v3 {
    1848           0 :         uint8_t  tx_ch;
    1849           0 :         uint8_t  test_data_len;
    1850           0 :         uint8_t  pkt_payload;
    1851           0 :         uint8_t  phy;
    1852           0 :         uint8_t  cte_len;
    1853           0 :         uint8_t  cte_type;
    1854           0 :         uint8_t  switch_pattern_len;
    1855           0 :         uint8_t  ant_ids[0];
    1856             : } __packed;
    1857             : 
    1858             : /* Min and max Constant Tone Extension length in 8us units */
    1859           0 : #define BT_HCI_LE_CTE_LEN_MIN                  0x2
    1860           0 : #define BT_HCI_LE_CTE_LEN_MAX                  0x14
    1861             : 
    1862           0 : #define BT_HCI_LE_AOA_CTE                      0x0
    1863           0 : #define BT_HCI_LE_AOD_CTE_1US                  0x1
    1864           0 : #define BT_HCI_LE_AOD_CTE_2US                  0x2
    1865           0 : #define BT_HCI_LE_NO_CTE                       0xFF
    1866             : 
    1867           0 : #define BT_HCI_LE_CTE_COUNT_MIN                0x1
    1868           0 : #define BT_HCI_LE_CTE_COUNT_MAX                0x10
    1869             : 
    1870           0 : #define BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS      BT_OP(BT_OGF_LE, 0x0051) /* 0x2051 */
    1871           0 : struct bt_hci_cp_le_set_cl_cte_tx_params {
    1872           0 :         uint8_t handle;
    1873           0 :         uint8_t cte_len;
    1874           0 :         uint8_t cte_type;
    1875           0 :         uint8_t cte_count;
    1876           0 :         uint8_t switch_pattern_len;
    1877           0 :         uint8_t ant_ids[0];
    1878             : } __packed;
    1879             : 
    1880           0 : #define BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE      BT_OP(BT_OGF_LE, 0x0052) /* 0x2052 */
    1881           0 : struct bt_hci_cp_le_set_cl_cte_tx_enable {
    1882           0 :         uint8_t handle;
    1883           0 :         uint8_t cte_enable;
    1884             : } __packed;
    1885             : 
    1886           0 : #define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US   0x1
    1887           0 : #define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US   0x2
    1888             : 
    1889           0 : #define BT_HCI_LE_SAMPLE_CTE_ALL               0x0
    1890           0 : #define BT_HCI_LE_SAMPLE_CTE_COUNT_MIN         0x1
    1891           0 : #define BT_HCI_LE_SAMPLE_CTE_COUNT_MAX         0x10
    1892             : 
    1893           0 : #define BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE BT_OP(BT_OGF_LE, 0x0053) /* 0x2053 */
    1894           0 : struct bt_hci_cp_le_set_cl_cte_sampling_enable {
    1895           0 :         uint16_t sync_handle;
    1896           0 :         uint8_t  sampling_enable;
    1897           0 :         uint8_t  slot_durations;
    1898           0 :         uint8_t  max_sampled_cte;
    1899           0 :         uint8_t  switch_pattern_len;
    1900           0 :         uint8_t  ant_ids[0];
    1901             : } __packed;
    1902             : 
    1903           0 : struct bt_hci_rp_le_set_cl_cte_sampling_enable {
    1904           0 :         uint8_t  status;
    1905           0 :         uint16_t sync_handle;
    1906             : } __packed;
    1907             : 
    1908           0 : #define BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS BT_OP(BT_OGF_LE, 0x0054) /* 0x2054 */
    1909           0 : struct bt_hci_cp_le_set_conn_cte_rx_params {
    1910           0 :         uint16_t handle;
    1911           0 :         uint8_t  sampling_enable;
    1912           0 :         uint8_t  slot_durations;
    1913           0 :         uint8_t  switch_pattern_len;
    1914           0 :         uint8_t  ant_ids[0];
    1915             : } __packed;
    1916             : 
    1917           0 : struct bt_hci_rp_le_set_conn_cte_rx_params {
    1918           0 :         uint8_t  status;
    1919           0 :         uint16_t handle;
    1920             : } __packed;
    1921             : 
    1922           0 : #define BT_HCI_LE_AOA_CTE_RSP                   BIT(0)
    1923           0 : #define BT_HCI_LE_AOD_CTE_RSP_1US               BIT(1)
    1924           0 : #define BT_HCI_LE_AOD_CTE_RSP_2US               BIT(2)
    1925             : 
    1926           0 : #define BT_HCI_LE_SWITCH_PATTERN_LEN_MIN        0x2
    1927           0 : #define BT_HCI_LE_SWITCH_PATTERN_LEN_MAX        0x4B
    1928             : 
    1929           0 : #define BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS     BT_OP(BT_OGF_LE, 0x0055) /* 0x2055 */
    1930           0 : struct bt_hci_cp_le_set_conn_cte_tx_params {
    1931           0 :         uint16_t handle;
    1932           0 :         uint8_t  cte_types;
    1933           0 :         uint8_t  switch_pattern_len;
    1934           0 :         uint8_t  ant_ids[0];
    1935             : } __packed;
    1936             : 
    1937           0 : struct bt_hci_rp_le_set_conn_cte_tx_params {
    1938           0 :         uint8_t  status;
    1939           0 :         uint16_t handle;
    1940             : } __packed;
    1941             : 
    1942             : /* Interval between consecutive CTE request procedure starts in number of connection events. */
    1943           0 : #define BT_HCI_REQUEST_CTE_ONCE                0x0
    1944           0 : #define BT_HCI_REQUEST_CTE_INTERVAL_MIN        0x1
    1945           0 : #define BT_HCI_REQUEST_CTE_INTERVAL_MAX        0xFFFF
    1946             : 
    1947           0 : #define BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE       BT_OP(BT_OGF_LE, 0x0056) /* 0x2056 */
    1948           0 : struct bt_hci_cp_le_conn_cte_req_enable {
    1949           0 :         uint16_t handle;
    1950           0 :         uint8_t  enable;
    1951           0 :         uint16_t cte_request_interval;
    1952           0 :         uint8_t  requested_cte_length;
    1953           0 :         uint8_t  requested_cte_type;
    1954             : } __packed;
    1955             : 
    1956           0 : struct bt_hci_rp_le_conn_cte_req_enable {
    1957           0 :         uint8_t  status;
    1958           0 :         uint16_t handle;
    1959             : } __packed;
    1960             : 
    1961           0 : #define BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE       BT_OP(BT_OGF_LE, 0x0057) /* 0x2057 */
    1962           0 : struct bt_hci_cp_le_conn_cte_rsp_enable {
    1963           0 :         uint16_t handle;
    1964           0 :         uint8_t  enable;
    1965             : } __packed;
    1966             : 
    1967           0 : struct bt_hci_rp_le_conn_cte_rsp_enable {
    1968           0 :         uint8_t  status;
    1969           0 :         uint16_t handle;
    1970             : } __packed;
    1971             : 
    1972           0 : #define BT_HCI_LE_1US_AOD_TX                    BIT(0)
    1973           0 : #define BT_HCI_LE_1US_AOD_RX                    BIT(1)
    1974           0 : #define BT_HCI_LE_1US_AOA_RX                    BIT(2)
    1975             : 
    1976           0 : #define BT_HCI_LE_NUM_ANT_MIN                   0x1
    1977           0 : #define BT_HCI_LE_NUM_ANT_MAX                   0x4B
    1978             : 
    1979           0 : #define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MIN    0x2
    1980           0 : #define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MAX    0x4B
    1981             : 
    1982           0 : #define BT_HCI_LE_MAX_CTE_LEN_MIN               0x2
    1983           0 : #define BT_HCI_LE_MAX_CTE_LEN_MAX               0x14
    1984             : 
    1985           0 : #define BT_HCI_OP_LE_READ_ANT_INFO              BT_OP(BT_OGF_LE, 0x0058) /* 0x2058 */
    1986           0 : struct bt_hci_rp_le_read_ant_info {
    1987           0 :         uint8_t status;
    1988           0 :         uint8_t switch_sample_rates;
    1989           0 :         uint8_t num_ant;
    1990           0 :         uint8_t max_switch_pattern_len;
    1991           0 :         uint8_t max_cte_len;
    1992             : };
    1993             : 
    1994           0 : #define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE           BIT(0)
    1995           0 : #define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_FILTER_DUPLICATE BIT(1)
    1996             : 
    1997           0 : #define BT_HCI_OP_LE_SET_PER_ADV_RECV_ENABLE     BT_OP(BT_OGF_LE, 0x0059) /* 0x2059 */
    1998           0 : struct bt_hci_cp_le_set_per_adv_recv_enable {
    1999           0 :         uint16_t handle;
    2000           0 :         uint8_t  enable;
    2001             : } __packed;
    2002             : 
    2003           0 : #define BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER      BT_OP(BT_OGF_LE, 0x005a) /* 0x205a */
    2004           0 : struct bt_hci_cp_le_per_adv_sync_transfer {
    2005           0 :         uint16_t conn_handle;
    2006           0 :         uint16_t service_data;
    2007           0 :         uint16_t sync_handle;
    2008             : } __packed;
    2009             : 
    2010           0 : struct bt_hci_rp_le_per_adv_sync_transfer {
    2011           0 :         uint8_t  status;
    2012           0 :         uint16_t conn_handle;
    2013             : } __packed;
    2014             : 
    2015           0 : #define BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER  BT_OP(BT_OGF_LE, 0x005b) /* 0x205b */
    2016           0 : struct bt_hci_cp_le_per_adv_set_info_transfer {
    2017           0 :         uint16_t conn_handle;
    2018           0 :         uint16_t service_data;
    2019           0 :         uint8_t  adv_handle;
    2020             : } __packed;
    2021             : 
    2022           0 : struct bt_hci_rp_le_per_adv_set_info_transfer {
    2023           0 :         uint8_t  status;
    2024           0 :         uint16_t conn_handle;
    2025             : } __packed;
    2026             : 
    2027           0 : #define BT_HCI_LE_PAST_MODE_NO_SYNC                0x00
    2028           0 : #define BT_HCI_LE_PAST_MODE_NO_REPORTS             0x01
    2029           0 : #define BT_HCI_LE_PAST_MODE_SYNC                   0x02
    2030           0 : #define BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES 0x03
    2031             : 
    2032           0 : #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOA           BIT(0)
    2033           0 : #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_1US       BIT(1)
    2034           0 : #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_2US       BIT(2)
    2035           0 : #define BT_HCI_LE_PAST_CTE_TYPE_NO_CTE           BIT(3)
    2036           0 : #define BT_HCI_LE_PAST_CTE_TYPE_ONLY_CTE         BIT(4)
    2037             : 
    2038           0 : #define BT_HCI_OP_LE_PAST_PARAM                 BT_OP(BT_OGF_LE, 0x005c) /* 0x205c */
    2039           0 : struct bt_hci_cp_le_past_param {
    2040           0 :         uint16_t conn_handle;
    2041           0 :         uint8_t  mode;
    2042           0 :         uint16_t skip;
    2043           0 :         uint16_t timeout;
    2044           0 :         uint8_t  cte_type;
    2045             : } __packed;
    2046             : 
    2047           0 : struct bt_hci_rp_le_past_param {
    2048           0 :         uint8_t  status;
    2049           0 :         uint16_t conn_handle;
    2050             : } __packed;
    2051             : 
    2052           0 : #define BT_HCI_OP_LE_DEFAULT_PAST_PARAM         BT_OP(BT_OGF_LE, 0x005d) /* 0x205d */
    2053           0 : struct bt_hci_cp_le_default_past_param {
    2054           0 :         uint8_t  mode;
    2055           0 :         uint16_t skip;
    2056           0 :         uint16_t timeout;
    2057           0 :         uint8_t  cte_type;
    2058             : } __packed;
    2059             : 
    2060           0 : struct bt_hci_rp_le_default_past_param {
    2061           0 :         uint8_t  status;
    2062             : } __packed;
    2063             : 
    2064           0 : #define BT_HCI_OP_LE_READ_BUFFER_SIZE_V2        BT_OP(BT_OGF_LE, 0x0060) /* 0x2060 */
    2065           0 : struct bt_hci_rp_le_read_buffer_size_v2 {
    2066           0 :         uint8_t  status;
    2067           0 :         uint16_t acl_max_len;
    2068           0 :         uint8_t  acl_max_num;
    2069           0 :         uint16_t iso_max_len;
    2070           0 :         uint8_t  iso_max_num;
    2071             : } __packed;
    2072             : 
    2073           0 : #define BT_HCI_OP_LE_READ_ISO_TX_SYNC           BT_OP(BT_OGF_LE, 0x0061) /* 0x2061 */
    2074           0 : struct bt_hci_cp_le_read_iso_tx_sync {
    2075           0 :         uint16_t handle;
    2076             : } __packed;
    2077             : 
    2078           0 : struct bt_hci_rp_le_read_iso_tx_sync {
    2079           0 :         uint8_t  status;
    2080           0 :         uint16_t handle;
    2081           0 :         uint16_t seq;
    2082           0 :         uint32_t timestamp;
    2083           0 :         uint8_t  offset[3];
    2084             : } __packed;
    2085             : 
    2086           0 : #define BT_HCI_ISO_CIG_ID_MAX                   0xFE
    2087           0 : #define BT_HCI_ISO_CIS_COUNT_MAX                0x1F
    2088           0 : #define BT_HCI_ISO_SDU_INTERVAL_MIN             0x0000FF
    2089           0 : #define BT_HCI_ISO_SDU_INTERVAL_MAX             0x0FFFFF
    2090           0 : #define BT_HCI_ISO_WORST_CASE_SCA_VALID_MASK    0x07
    2091           0 : #define BT_HCI_ISO_PACKING_VALID_MASK           0x01
    2092           0 : #define BT_HCI_ISO_FRAMING_VALID_MASK           0x01
    2093           0 : #define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MIN    0x0005
    2094           0 : #define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MAX    0x0FA0
    2095           0 : #define BT_HCI_ISO_CIS_ID_VALID_MAX             0xEF
    2096           0 : #define BT_HCI_ISO_MAX_SDU_VALID_MASK           0x0FFF
    2097           0 : #define BT_HCI_ISO_PHY_VALID_MASK               0x07
    2098           0 : #define BT_HCI_ISO_INTERVAL_MIN                 0x0004
    2099           0 : #define BT_HCI_ISO_INTERVAL_MAX                 0x0C80
    2100             : 
    2101           0 : #define BT_HCI_OP_LE_SET_CIG_PARAMS             BT_OP(BT_OGF_LE, 0x0062) /* 0x2062 */
    2102           0 : struct bt_hci_cis_params {
    2103           0 :         uint8_t  cis_id;
    2104           0 :         uint16_t c_sdu;
    2105           0 :         uint16_t p_sdu;
    2106           0 :         uint8_t  c_phy;
    2107           0 :         uint8_t  p_phy;
    2108           0 :         uint8_t  c_rtn;
    2109           0 :         uint8_t  p_rtn;
    2110             : } __packed;
    2111             : 
    2112           0 : struct bt_hci_cp_le_set_cig_params {
    2113           0 :         uint8_t  cig_id;
    2114           0 :         uint8_t  c_interval[3];
    2115           0 :         uint8_t  p_interval[3];
    2116           0 :         uint8_t  sca;
    2117           0 :         uint8_t  packing;
    2118           0 :         uint8_t  framing;
    2119           0 :         uint16_t c_latency;
    2120           0 :         uint16_t p_latency;
    2121           0 :         uint8_t  num_cis;
    2122           0 :         struct bt_hci_cis_params cis[0];
    2123             : } __packed;
    2124             : 
    2125           0 : struct bt_hci_rp_le_set_cig_params {
    2126           0 :         uint8_t  status;
    2127           0 :         uint8_t  cig_id;
    2128           0 :         uint8_t  num_handles;
    2129           0 :         uint16_t handle[0];
    2130             : } __packed;
    2131             : 
    2132           0 : #define BT_HCI_OP_LE_SET_CIG_PARAMS_TEST        BT_OP(BT_OGF_LE, 0x0063) /* 0x2063 */
    2133           0 : struct bt_hci_cis_params_test {
    2134           0 :         uint8_t  cis_id;
    2135           0 :         uint8_t  nse;
    2136           0 :         uint16_t c_sdu;
    2137           0 :         uint16_t p_sdu;
    2138           0 :         uint16_t c_pdu;
    2139           0 :         uint16_t p_pdu;
    2140           0 :         uint8_t  c_phy;
    2141           0 :         uint8_t  p_phy;
    2142           0 :         uint8_t  c_bn;
    2143           0 :         uint8_t  p_bn;
    2144             : } __packed;
    2145             : 
    2146           0 : struct bt_hci_cp_le_set_cig_params_test {
    2147           0 :         uint8_t  cig_id;
    2148           0 :         uint8_t  c_interval[3];
    2149           0 :         uint8_t  p_interval[3];
    2150           0 :         uint8_t  c_ft;
    2151           0 :         uint8_t  p_ft;
    2152           0 :         uint16_t iso_interval;
    2153           0 :         uint8_t  sca;
    2154           0 :         uint8_t  packing;
    2155           0 :         uint8_t  framing;
    2156           0 :         uint8_t  num_cis;
    2157           0 :         struct bt_hci_cis_params_test cis[0];
    2158             : } __packed;
    2159             : 
    2160           0 : struct bt_hci_rp_le_set_cig_params_test {
    2161           0 :         uint8_t  status;
    2162           0 :         uint8_t  cig_id;
    2163           0 :         uint8_t  num_handles;
    2164           0 :         uint16_t handle[0];
    2165             : } __packed;
    2166             : 
    2167           0 : #define BT_HCI_OP_LE_CREATE_CIS                 BT_OP(BT_OGF_LE, 0x0064) /* 0x2064 */
    2168           0 : struct bt_hci_cis {
    2169           0 :         uint16_t  cis_handle;
    2170           0 :         uint16_t  acl_handle;
    2171             : } __packed;
    2172             : 
    2173           0 : struct bt_hci_cp_le_create_cis {
    2174           0 :         uint8_t  num_cis;
    2175           0 :         struct bt_hci_cis cis[0];
    2176             : } __packed;
    2177             : 
    2178           0 : #define BT_HCI_OP_LE_REMOVE_CIG                 BT_OP(BT_OGF_LE, 0x0065) /* 0x2065 */
    2179           0 : struct bt_hci_cp_le_remove_cig {
    2180           0 :         uint8_t  cig_id;
    2181             : } __packed;
    2182             : 
    2183           0 : struct bt_hci_rp_le_remove_cig {
    2184           0 :         uint8_t  status;
    2185           0 :         uint8_t  cig_id;
    2186             : } __packed;
    2187             : 
    2188           0 : #define BT_HCI_OP_LE_ACCEPT_CIS                 BT_OP(BT_OGF_LE, 0x0066) /* 0x2066 */
    2189           0 : struct bt_hci_cp_le_accept_cis {
    2190           0 :         uint16_t handle;
    2191             : } __packed;
    2192             : 
    2193           0 : #define BT_HCI_OP_LE_REJECT_CIS                 BT_OP(BT_OGF_LE, 0x0067) /* 0x2067 */
    2194           0 : struct bt_hci_cp_le_reject_cis {
    2195           0 :         uint16_t handle;
    2196           0 :         uint8_t  reason;
    2197             : } __packed;
    2198             : 
    2199           0 : struct bt_hci_rp_le_reject_cis {
    2200           0 :         uint8_t  status;
    2201           0 :         uint16_t handle;
    2202             : } __packed;
    2203             : 
    2204           0 : #define BT_HCI_OP_LE_CREATE_BIG                 BT_OP(BT_OGF_LE, 0x0068) /* 0x2068 */
    2205           0 : struct bt_hci_cp_le_create_big {
    2206           0 :         uint8_t  big_handle;
    2207           0 :         uint8_t  adv_handle;
    2208           0 :         uint8_t  num_bis;
    2209           0 :         uint8_t  sdu_interval[3];
    2210           0 :         uint16_t max_sdu;
    2211           0 :         uint16_t max_latency;
    2212           0 :         uint8_t  rtn;
    2213           0 :         uint8_t  phy;
    2214           0 :         uint8_t  packing;
    2215           0 :         uint8_t  framing;
    2216           0 :         uint8_t  encryption;
    2217           0 :         uint8_t  bcode[16];
    2218             : } __packed;
    2219             : 
    2220           0 : #define BT_HCI_OP_LE_CREATE_BIG_TEST            BT_OP(BT_OGF_LE, 0x0069) /* 0x2069 */
    2221           0 : struct bt_hci_cp_le_create_big_test {
    2222           0 :         uint8_t  big_handle;
    2223           0 :         uint8_t  adv_handle;
    2224           0 :         uint8_t  num_bis;
    2225           0 :         uint8_t  sdu_interval[3];
    2226           0 :         uint16_t iso_interval;
    2227           0 :         uint8_t  nse;
    2228           0 :         uint16_t max_sdu;
    2229           0 :         uint16_t max_pdu;
    2230           0 :         uint8_t  phy;
    2231           0 :         uint8_t  packing;
    2232           0 :         uint8_t  framing;
    2233           0 :         uint8_t  bn;
    2234           0 :         uint8_t  irc;
    2235           0 :         uint8_t  pto;
    2236           0 :         uint8_t  encryption;
    2237           0 :         uint8_t  bcode[16];
    2238             : } __packed;
    2239             : 
    2240           0 : #define BT_HCI_OP_LE_TERMINATE_BIG              BT_OP(BT_OGF_LE, 0x006a) /* 0x206a */
    2241           0 : struct bt_hci_cp_le_terminate_big {
    2242           0 :         uint8_t  big_handle;
    2243           0 :         uint8_t  reason;
    2244             : } __packed;
    2245             : 
    2246           0 : #define BT_HCI_OP_LE_BIG_CREATE_SYNC            BT_OP(BT_OGF_LE, 0x006b) /* 0x206b */
    2247           0 : struct bt_hci_cp_le_big_create_sync {
    2248           0 :         uint8_t  big_handle;
    2249           0 :         uint16_t sync_handle;
    2250           0 :         uint8_t  encryption;
    2251           0 :         uint8_t  bcode[16];
    2252           0 :         uint8_t  mse;
    2253           0 :         uint16_t sync_timeout;
    2254           0 :         uint8_t  num_bis;
    2255           0 :         uint8_t  bis[0];
    2256             : } __packed;
    2257             : 
    2258           0 : #define BT_HCI_OP_LE_BIG_TERMINATE_SYNC         BT_OP(BT_OGF_LE, 0x006c) /* 0x206c */
    2259           0 : struct bt_hci_cp_le_big_terminate_sync {
    2260           0 :         uint8_t  big_handle;
    2261             : } __packed;
    2262             : 
    2263           0 : struct bt_hci_rp_le_big_terminate_sync {
    2264           0 :         uint8_t  status;
    2265           0 :         uint8_t  big_handle;
    2266             : } __packed;
    2267             : 
    2268           0 : #define BT_HCI_OP_LE_REQ_PEER_SC                BT_OP(BT_OGF_LE, 0x006d) /* 0x206d */
    2269           0 : struct bt_hci_cp_le_req_peer_sca {
    2270           0 :         uint16_t handle;
    2271             : } __packed;
    2272             : 
    2273           0 : #define BT_HCI_OP_LE_SETUP_ISO_PATH             BT_OP(BT_OGF_LE, 0x006e) /* 0x206e */
    2274           0 : struct bt_hci_cp_le_setup_iso_path {
    2275           0 :         uint16_t handle;
    2276           0 :         uint8_t  path_dir;
    2277           0 :         uint8_t  path_id;
    2278           0 :         struct bt_hci_cp_codec_id codec_id;
    2279           0 :         uint8_t  controller_delay[3];
    2280           0 :         uint8_t  codec_config_len;
    2281           0 :         uint8_t  codec_config[0];
    2282             : } __packed;
    2283             : 
    2284           0 : struct bt_hci_rp_le_setup_iso_path {
    2285           0 :         uint8_t  status;
    2286           0 :         uint16_t handle;
    2287             : } __packed;
    2288             : 
    2289           0 : #define BT_HCI_OP_LE_REMOVE_ISO_PATH            BT_OP(BT_OGF_LE, 0x006f) /* 0x206f */
    2290           0 : struct bt_hci_cp_le_remove_iso_path {
    2291           0 :         uint16_t handle;
    2292           0 :         uint8_t  path_dir;
    2293             : } __packed;
    2294             : 
    2295           0 : struct bt_hci_rp_le_remove_iso_path {
    2296           0 :         uint8_t  status;
    2297           0 :         uint16_t handle;
    2298             : } __packed;
    2299             : 
    2300           0 : #define BT_HCI_ISO_TEST_ZERO_SIZE_SDU     0
    2301           0 : #define BT_HCI_ISO_TEST_VARIABLE_SIZE_SDU 1
    2302           0 : #define BT_HCI_ISO_TEST_MAX_SIZE_SDU      2
    2303             : 
    2304           0 : #define BT_HCI_OP_LE_ISO_TRANSMIT_TEST          BT_OP(BT_OGF_LE, 0x0070) /* 0x2070 */
    2305           0 : struct bt_hci_cp_le_iso_transmit_test {
    2306           0 :         uint16_t handle;
    2307           0 :         uint8_t  payload_type;
    2308             : } __packed;
    2309             : 
    2310           0 : struct bt_hci_rp_le_iso_transmit_test {
    2311           0 :         uint8_t  status;
    2312           0 :         uint16_t handle;
    2313             : } __packed;
    2314             : 
    2315           0 : #define BT_HCI_OP_LE_ISO_RECEIVE_TEST           BT_OP(BT_OGF_LE, 0x0071) /* 0x2071 */
    2316           0 : struct bt_hci_cp_le_iso_receive_test {
    2317           0 :         uint16_t handle;
    2318           0 :         uint8_t  payload_type;
    2319             : } __packed;
    2320             : 
    2321           0 : struct bt_hci_rp_le_iso_receive_test {
    2322           0 :         uint8_t  status;
    2323           0 :         uint16_t handle;
    2324             : } __packed;
    2325             : 
    2326           0 : #define BT_HCI_OP_LE_ISO_READ_TEST_COUNTERS     BT_OP(BT_OGF_LE, 0x0072) /* 0x2072 */
    2327           0 : struct bt_hci_cp_le_read_test_counters {
    2328           0 :         uint16_t handle;
    2329             : } __packed;
    2330             : 
    2331           0 : struct bt_hci_rp_le_read_test_counters {
    2332           0 :         uint8_t  status;
    2333           0 :         uint16_t handle;
    2334           0 :         uint32_t received_cnt;
    2335           0 :         uint32_t missed_cnt;
    2336           0 :         uint32_t failed_cnt;
    2337             : } __packed;
    2338             : 
    2339           0 : #define BT_HCI_OP_LE_ISO_TEST_END               BT_OP(BT_OGF_LE, 0x0073) /* 0x2073 */
    2340           0 : struct bt_hci_cp_le_iso_test_end {
    2341           0 :         uint16_t handle;
    2342             : } __packed;
    2343             : 
    2344           0 : struct bt_hci_rp_le_iso_test_end {
    2345           0 :         uint8_t  status;
    2346           0 :         uint16_t handle;
    2347           0 :         uint32_t received_cnt;
    2348           0 :         uint32_t missed_cnt;
    2349           0 :         uint32_t failed_cnt;
    2350             : } __packed;
    2351             : 
    2352           0 : #define BT_HCI_OP_LE_SET_HOST_FEATURE           BT_OP(BT_OGF_LE, 0x0074) /* 0x2074 */
    2353           0 : struct bt_hci_cp_le_set_host_feature {
    2354           0 :         uint8_t  bit_number;
    2355           0 :         uint8_t  bit_value;
    2356             : } __packed;
    2357             : 
    2358           0 : struct bt_hci_rp_le_set_host_feature {
    2359           0 :         uint8_t  status;
    2360             : } __packed;
    2361             : 
    2362           0 : #define BT_HCI_OP_LE_READ_ISO_LINK_QUALITY      BT_OP(BT_OGF_LE, 0x0075) /* 0x2075 */
    2363           0 : struct bt_hci_cp_le_read_iso_link_quality {
    2364           0 :         uint16_t handle;
    2365             : } __packed;
    2366             : 
    2367           0 : struct bt_hci_rp_le_read_iso_link_quality {
    2368           0 :         uint8_t  status;
    2369           0 :         uint16_t handle;
    2370           0 :         uint32_t tx_unacked_packets;
    2371           0 :         uint32_t tx_flushed_packets;
    2372           0 :         uint32_t tx_last_subevent_packets;
    2373           0 :         uint32_t retransmitted_packets;
    2374           0 :         uint32_t crc_error_packets;
    2375           0 :         uint32_t rx_unreceived_packets;
    2376           0 :         uint32_t duplicate_packets;
    2377             : } __packed;
    2378             : 
    2379           0 : #define BT_HCI_OP_LE_TX_TEST_V4                 BT_OP(BT_OGF_LE, 0x007B) /* 0x207B */
    2380             : 
    2381           0 : struct bt_hci_cp_le_tx_test_v4 {
    2382           0 :         uint8_t  tx_ch;
    2383           0 :         uint8_t  test_data_len;
    2384           0 :         uint8_t  pkt_payload;
    2385           0 :         uint8_t  phy;
    2386           0 :         uint8_t  cte_len;
    2387           0 :         uint8_t  cte_type;
    2388           0 :         uint8_t  switch_pattern_len;
    2389           0 :         uint8_t  ant_ids[0];
    2390             : } __packed;
    2391             : 
    2392           0 : #define BT_HCI_TX_TEST_POWER_MIN -0x7F
    2393           0 : #define BT_HCI_TX_TEST_POWER_MAX 0x14
    2394             : 
    2395           0 : #define BT_HCI_TX_TEST_POWER_MIN_SET 0x7E
    2396           0 : #define BT_HCI_TX_TEST_POWER_MAX_SET 0x7F
    2397             : 
    2398             : /* Helper structure for Tx power parameter in the HCI Tx Test v4 command.
    2399             :  * Previous parameter of this command is variable size so having separated structure
    2400             :  * for this parameter helps in command parameters unpacking.
    2401             :  */
    2402           0 : struct bt_hci_cp_le_tx_test_v4_tx_power {
    2403           0 :         int8_t tx_power;
    2404             : } __packed;
    2405             : 
    2406           0 : #define BT_HCI_OP_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES BT_OP(BT_OGF_LE, 0x0089) /* 0x2089 */
    2407             : 
    2408           0 : struct bt_hci_rp_le_read_local_supported_capabilities {
    2409           0 :         uint8_t  status;
    2410           0 :         uint8_t  num_config_supported;
    2411           0 :         uint16_t max_consecutive_procedures_supported;
    2412           0 :         uint8_t  num_antennas_supported;
    2413           0 :         uint8_t  max_antenna_paths_supported;
    2414           0 :         uint8_t  roles_supported;
    2415           0 :         uint8_t  modes_supported;
    2416           0 :         uint8_t  rtt_capability;
    2417           0 :         uint8_t  rtt_aa_only_n;
    2418           0 :         uint8_t  rtt_sounding_n;
    2419           0 :         uint8_t  rtt_random_payload_n;
    2420           0 :         uint16_t nadm_sounding_capability;
    2421           0 :         uint16_t nadm_random_capability;
    2422           0 :         uint8_t  cs_sync_phys_supported;
    2423           0 :         uint16_t subfeatures_supported;
    2424           0 :         uint16_t t_ip1_times_supported;
    2425           0 :         uint16_t t_ip2_times_supported;
    2426           0 :         uint16_t t_fcs_times_supported;
    2427           0 :         uint16_t t_pm_times_supported;
    2428           0 :         uint8_t  t_sw_time_supported;
    2429           0 :         uint8_t  tx_snr_capability;
    2430             : } __packed;
    2431             : 
    2432           0 : #define BT_HCI_OP_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES BT_OP(BT_OGF_LE, 0x008A) /* 0x208A */
    2433             : 
    2434           0 : struct bt_hci_cp_le_read_remote_supported_capabilities {
    2435           0 :         uint16_t handle;
    2436             : } __packed;
    2437             : 
    2438           0 : #define BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES \
    2439             :         BT_OP(BT_OGF_LE, 0x008B) /* 0x208B */
    2440             : 
    2441           0 : struct bt_hci_cp_le_write_cached_remote_supported_capabilities {
    2442           0 :         uint16_t handle;
    2443           0 :         uint8_t  num_config_supported;
    2444           0 :         uint16_t max_consecutive_procedures_supported;
    2445           0 :         uint8_t  num_antennas_supported;
    2446           0 :         uint8_t  max_antenna_paths_supported;
    2447           0 :         uint8_t  roles_supported;
    2448           0 :         uint8_t  modes_supported;
    2449           0 :         uint8_t  rtt_capability;
    2450           0 :         uint8_t  rtt_aa_only_n;
    2451           0 :         uint8_t  rtt_sounding_n;
    2452           0 :         uint8_t  rtt_random_payload_n;
    2453           0 :         uint16_t nadm_sounding_capability;
    2454           0 :         uint16_t nadm_random_capability;
    2455           0 :         uint8_t  cs_sync_phys_supported;
    2456           0 :         uint16_t subfeatures_supported;
    2457           0 :         uint16_t t_ip1_times_supported;
    2458           0 :         uint16_t t_ip2_times_supported;
    2459           0 :         uint16_t t_fcs_times_supported;
    2460           0 :         uint16_t t_pm_times_supported;
    2461           0 :         uint8_t  t_sw_time_supported;
    2462           0 :         uint8_t  tx_snr_capability;
    2463             : } __packed;
    2464             : 
    2465           0 : #define BT_HCI_OP_LE_CS_SECURITY_ENABLE BT_OP(BT_OGF_LE, 0x008C) /* 0x208C */
    2466             : 
    2467           0 : struct bt_hci_cp_le_security_enable {
    2468           0 :         uint16_t handle;
    2469             : } __packed;
    2470             : 
    2471           0 : #define BT_HCI_OP_LE_CS_SET_DEFAULT_SETTINGS BT_OP(BT_OGF_LE, 0x008D) /* 0x208D */
    2472             : 
    2473           0 : #define BT_HCI_OP_LE_CS_INITIATOR_ROLE_MASK BIT(0)
    2474           0 : #define BT_HCI_OP_LE_CS_REFLECTOR_ROLE_MASK BIT(1)
    2475             : 
    2476           0 : #define BT_HCI_OP_LE_CS_MIN_MAX_TX_POWER -127
    2477           0 : #define BT_HCI_OP_LE_CS_MAX_MAX_TX_POWER 20
    2478             : 
    2479           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_ONE   0x01
    2480           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_TWO   0x02
    2481           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_THREE 0x03
    2482           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_FOUR  0x04
    2483           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_REP   0xFE
    2484           0 : #define BT_HCI_OP_LE_CS_ANTENNA_SEL_NONE  0xFF
    2485             : 
    2486           0 : struct bt_hci_cp_le_cs_set_default_settings {
    2487           0 :         uint16_t handle;
    2488           0 :         uint8_t  role_enable;
    2489           0 :         uint8_t  cs_sync_antenna_selection;
    2490           0 :         int8_t   max_tx_power;
    2491             : } __packed;
    2492             : 
    2493           0 : #define BT_HCI_OP_LE_CS_READ_REMOTE_FAE_TABLE BT_OP(BT_OGF_LE, 0x008E) /* 0x208E */
    2494             : 
    2495           0 : struct bt_hci_cp_le_read_remote_fae_table {
    2496           0 :         uint16_t handle;
    2497             : } __packed;
    2498             : 
    2499           0 : #define BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_FAE_TABLE BT_OP(BT_OGF_LE, 0x008F) /* 0x208F */
    2500             : 
    2501           0 : struct bt_hci_cp_le_write_cached_remote_fae_table {
    2502           0 :         uint16_t handle;
    2503           0 :         int8_t   remote_fae_table[72];
    2504             : } __packed;
    2505             : 
    2506           0 : #define BT_HCI_OP_LE_CS_SET_CHANNEL_CLASSIFICATION BT_OP(BT_OGF_LE, 0x0092) /* 0x2092 */
    2507             : 
    2508           0 : #define BT_HCI_OP_LE_CS_SET_PROCEDURE_PARAMETERS BT_OP(BT_OGF_LE, 0x0093) /* 0x2093 */
    2509             : 
    2510           0 : #define BT_HCI_OP_LE_CS_PROCEDURE_PHY_1M       0x01
    2511           0 : #define BT_HCI_OP_LE_CS_PROCEDURE_PHY_2M       0x02
    2512           0 : #define BT_HCI_OP_LE_CS_PROCEDURE_PHY_CODED_S8 0x03
    2513           0 : #define BT_HCI_OP_LE_CS_PROCEDURE_PHY_CODED_S2 0x04
    2514             : 
    2515           0 : struct bt_hci_cp_le_set_procedure_parameters {
    2516           0 :         uint16_t handle;
    2517           0 :         uint8_t  config_id;
    2518           0 :         uint16_t max_procedure_len;
    2519           0 :         uint16_t min_procedure_interval;
    2520           0 :         uint16_t max_procedure_interval;
    2521           0 :         uint16_t max_procedure_count;
    2522           0 :         uint8_t  min_subevent_len[3];
    2523           0 :         uint8_t  max_subevent_len[3];
    2524           0 :         uint8_t  tone_antenna_config_selection;
    2525           0 :         uint8_t  phy;
    2526           0 :         uint8_t  tx_power_delta;
    2527           0 :         uint8_t  preferred_peer_antenna;
    2528           0 :         uint8_t  snr_control_initiator;
    2529           0 :         uint8_t  snr_control_reflector;
    2530             : } __packed;
    2531             : 
    2532           0 : #define BT_HCI_OP_LE_CS_PROCEDURE_ENABLE BT_OP(BT_OGF_LE, 0x0094) /* 0x2094 */
    2533             : 
    2534           0 : #define BT_HCI_OP_LE_CS_PROCEDURES_DISABLED 0x00
    2535           0 : #define BT_HCI_OP_LE_CS_PROCEDURES_ENABLED  0x01
    2536             : 
    2537           0 : struct bt_hci_cp_le_procedure_enable {
    2538           0 :         uint16_t handle;
    2539           0 :         uint8_t  config_id;
    2540           0 :         uint8_t  enable;
    2541             : } __packed;
    2542             : 
    2543           0 : #define BT_HCI_OP_LE_CS_TEST BT_OP(BT_OGF_LE, 0x0095) /* 0x2095 */
    2544             : 
    2545           0 : #define BT_HCI_OP_LE_CS_MAIN_MODE_1 0x1
    2546           0 : #define BT_HCI_OP_LE_CS_MAIN_MODE_2 0x2
    2547           0 : #define BT_HCI_OP_LE_CS_MAIN_MODE_3 0x3
    2548             : 
    2549           0 : #define BT_HCI_OP_LE_CS_SUB_MODE_1 0x1
    2550           0 : #define BT_HCI_OP_LE_CS_SUB_MODE_2 0x2
    2551           0 : #define BT_HCI_OP_LE_CS_SUB_MODE_3 0x3
    2552           0 : #define BT_HCI_OP_LE_CS_SUB_MODE_UNUSED 0xFF
    2553             : 
    2554           0 : #define BT_HCI_OP_LE_CS_INITIATOR_ROLE 0x0
    2555           0 : #define BT_HCI_OP_LE_CS_REFLECTOR_ROLE 0x1
    2556             : 
    2557           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_AA_ONLY     0x0
    2558           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_SOUND 0x1
    2559           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_SOUND 0x2
    2560           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_RAND  0x3
    2561           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_64BIT_RAND  0x4
    2562           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_RAND  0x5
    2563           0 : #define BT_HCI_OP_LE_CS_RTT_TYPE_128BIT_RAND 0x6
    2564             : 
    2565           0 : #define BT_HCI_OP_LE_CS_CS_SYNC_1M     0x1
    2566           0 : #define BT_HCI_OP_LE_CS_CS_SYNC_2M     0x2
    2567           0 : #define BT_HCI_OP_LE_CS_CS_SYNC_2M_2BT 0x3
    2568             : 
    2569           0 : #define BT_HCI_OP_LE_CS_TEST_MINIMIZE_TX_POWER 0x7E
    2570           0 : #define BT_HCI_OP_LE_CS_TEST_MAXIMIZE_TX_POWER 0x7F
    2571             : 
    2572           0 : #define BT_HCI_OP_LE_CS_ACI_0 0x0
    2573           0 : #define BT_HCI_OP_LE_CS_ACI_1 0x1
    2574           0 : #define BT_HCI_OP_LE_CS_ACI_2 0x2
    2575           0 : #define BT_HCI_OP_LE_CS_ACI_3 0x3
    2576           0 : #define BT_HCI_OP_LE_CS_ACI_4 0x4
    2577           0 : #define BT_HCI_OP_LE_CS_ACI_5 0x5
    2578           0 : #define BT_HCI_OP_LE_CS_ACI_6 0x6
    2579           0 : #define BT_HCI_OP_LE_CS_ACI_7 0x7
    2580             : 
    2581           0 : #define BT_HCI_OP_LE_CS_SNR_18 0x0
    2582           0 : #define BT_HCI_OP_LE_CS_SNR_21 0x1
    2583           0 : #define BT_HCI_OP_LE_CS_SNR_24 0x2
    2584           0 : #define BT_HCI_OP_LE_CS_SNR_27 0x3
    2585           0 : #define BT_HCI_OP_LE_CS_SNR_30 0x4
    2586           0 : #define BT_HCI_OP_LE_CS_SNR_NOT_USED 0xFF
    2587             : 
    2588           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_0_MASK BIT(0)
    2589           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_2_MASK BIT(2)
    2590           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_3_MASK BIT(3)
    2591           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_4_MASK BIT(4)
    2592           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_5_MASK BIT(5)
    2593           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_6_MASK BIT(6)
    2594           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_7_MASK BIT(7)
    2595           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_8_MASK BIT(8)
    2596           0 : #define BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_10_MASK BIT(10)
    2597             : 
    2598           0 : #define BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3B 0x0
    2599           0 : #define BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3C 0x1
    2600             : 
    2601           0 : #define BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_HAT 0x0
    2602           0 : #define BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_X   0x1
    2603             : 
    2604           0 : #define BT_HCI_OP_LE_CS_TEST_TONE_EXT_NONE 0x0
    2605           0 : #define BT_HCI_OP_LE_CS_TEST_TONE_EXT_INIT 0x1
    2606           0 : #define BT_HCI_OP_LE_CS_TEST_TONE_EXT_REFL 0x2
    2607           0 : #define BT_HCI_OP_LE_CS_TEST_TONE_EXT_BOTH 0x3
    2608           0 : #define BT_HCI_OP_LE_CS_TEST_TONE_EXT_REPEAT 0x4
    2609             : 
    2610           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_00 0x0
    2611           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_01 0x1
    2612           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_02 0x2
    2613           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_03 0x3
    2614           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_04 0x4
    2615           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_05 0x5
    2616           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_06 0x6
    2617           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_07 0x7
    2618           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_08 0x8
    2619           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_09 0x9
    2620           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_10 0xA
    2621           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_11 0xB
    2622           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_12 0xC
    2623           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_13 0xD
    2624           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_14 0xE
    2625           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_15 0xF
    2626           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_16 0x10
    2627           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_17 0x11
    2628           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_18 0x12
    2629           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_19 0x13
    2630           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_20 0x14
    2631           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_21 0x15
    2632           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_22 0x16
    2633           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_23 0x17
    2634           0 : #define BT_HCI_OP_LE_CS_TEST_AP_INDEX_LOOP 0xFF
    2635             : 
    2636           0 : #define BT_HCI_OP_LE_CS_TEST_SS_MARKER_2_POSITION_NOT_PRESENT 0xFF
    2637             : 
    2638           0 : #define BT_HCI_OP_LE_CS_TEST_SS_MARKER_VAL_0011 0x0
    2639           0 : #define BT_HCI_OP_LE_CS_TEST_SS_MARKER_VAL_1100 0x1
    2640           0 : #define BT_HCI_OP_LE_CS_TEST_SS_MARKER_VAL_LOOP 0x2
    2641             : 
    2642           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_PRBS9    0x00
    2643           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_11110000 0x01
    2644           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_10101010 0x02
    2645           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_PRBS15   0x03
    2646           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_11111111 0x04
    2647           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_00000000 0x05
    2648           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_00001111 0x06
    2649           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_01010101 0x07
    2650           0 : #define BT_HCI_OP_LE_CS_TEST_PAYLOAD_USER     0x80
    2651             : 
    2652           0 : struct bt_hci_op_le_cs_test {
    2653           0 :         uint8_t  main_mode_type;
    2654           0 :         uint8_t  sub_mode_type;
    2655           0 :         uint8_t  main_mode_repetition;
    2656           0 :         uint8_t  mode_0_steps;
    2657           0 :         uint8_t  role;
    2658           0 :         uint8_t  rtt_type;
    2659           0 :         uint8_t  cs_sync_phy;
    2660           0 :         uint8_t  cs_sync_antenna_selection;
    2661           0 :         uint8_t  subevent_len[3];
    2662           0 :         uint16_t subevent_interval;
    2663           0 :         uint8_t  max_num_subevents;
    2664           0 :         uint8_t  transmit_power_level;
    2665           0 :         uint8_t  t_ip1_time;
    2666           0 :         uint8_t  t_ip2_time;
    2667           0 :         uint8_t  t_fcs_time;
    2668           0 :         uint8_t  t_pm_time;
    2669           0 :         uint8_t  t_sw_time;
    2670           0 :         uint8_t  tone_antenna_config_selection;
    2671           0 :         uint8_t  reserved;
    2672           0 :         uint8_t  snr_control_initiator;
    2673           0 :         uint8_t  snr_control_reflector;
    2674           0 :         uint16_t drbg_nonce;
    2675           0 :         uint8_t  channel_map_repetition;
    2676           0 :         uint16_t override_config;
    2677           0 :         uint8_t  override_parameters_length;
    2678           0 :         uint8_t  override_parameters_data[];
    2679             : } __packed;
    2680             : 
    2681           0 : #define BT_HCI_OP_LE_CS_CREATE_CONFIG BT_OP(BT_OGF_LE, 0x0090) /* 0x2090 */
    2682             : 
    2683           0 : struct bt_hci_cp_le_cs_create_config {
    2684           0 :         uint16_t handle;
    2685           0 :         uint8_t  config_id;
    2686           0 :         uint8_t  create_context;
    2687           0 :         uint8_t  main_mode_type;
    2688           0 :         uint8_t  sub_mode_type;
    2689           0 :         uint8_t  min_main_mode_steps;
    2690           0 :         uint8_t  max_main_mode_steps;
    2691           0 :         uint8_t  main_mode_repetition;
    2692           0 :         uint8_t  mode_0_steps;
    2693           0 :         uint8_t  role;
    2694           0 :         uint8_t  rtt_type;
    2695           0 :         uint8_t  cs_sync_phy;
    2696           0 :         uint8_t  channel_map[10];
    2697           0 :         uint8_t  channel_map_repetition;
    2698           0 :         uint8_t  channel_selection_type;
    2699           0 :         uint8_t  ch3c_shape;
    2700           0 :         uint8_t  ch3c_jump;
    2701           0 :         uint8_t  reserved;
    2702             : } __packed;
    2703             : 
    2704           0 : #define BT_HCI_OP_LE_CS_REMOVE_CONFIG BT_OP(BT_OGF_LE, 0x0091) /* 0x2091 */
    2705             : 
    2706           0 : struct bt_hci_cp_le_cs_remove_config {
    2707           0 :         uint16_t handle;
    2708           0 :         uint8_t  config_id;
    2709             : } __packed;
    2710             : 
    2711           0 : #define BT_HCI_OP_LE_CS_TEST_END BT_OP(BT_OGF_LE, 0x0096) /* 0x2096 */
    2712             : 
    2713             : /* Event definitions */
    2714             : 
    2715           0 : #define BT_HCI_EVT_UNKNOWN                      0x00
    2716           0 : #define BT_HCI_EVT_VENDOR                       0xff
    2717             : 
    2718           0 : #define BT_HCI_EVT_INQUIRY_COMPLETE             0x01
    2719           0 : struct bt_hci_evt_inquiry_complete {
    2720           0 :         uint8_t status;
    2721             : } __packed;
    2722             : 
    2723           0 : #define BT_HCI_EVT_CONN_COMPLETE                0x03
    2724           0 : struct bt_hci_evt_conn_complete {
    2725           0 :         uint8_t   status;
    2726           0 :         uint16_t  handle;
    2727           0 :         bt_addr_t bdaddr;
    2728           0 :         uint8_t   link_type;
    2729           0 :         uint8_t   encr_enabled;
    2730             : } __packed;
    2731             : 
    2732           0 : #define BT_HCI_EVT_CONN_REQUEST                 0x04
    2733           0 : struct bt_hci_evt_conn_request {
    2734           0 :         bt_addr_t bdaddr;
    2735           0 :         uint8_t   dev_class[3];
    2736           0 :         uint8_t   link_type;
    2737             : } __packed;
    2738             : 
    2739           0 : #define BT_HCI_EVT_DISCONN_COMPLETE             0x05
    2740           0 : struct bt_hci_evt_disconn_complete {
    2741           0 :         uint8_t  status;
    2742           0 :         uint16_t handle;
    2743           0 :         uint8_t  reason;
    2744             : } __packed;
    2745             : 
    2746           0 : #define BT_HCI_EVT_AUTH_COMPLETE                0x06
    2747           0 : struct bt_hci_evt_auth_complete {
    2748           0 :         uint8_t  status;
    2749           0 :         uint16_t handle;
    2750             : } __packed;
    2751             : 
    2752           0 : #define BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE     0x07
    2753           0 : struct bt_hci_evt_remote_name_req_complete {
    2754           0 :         uint8_t   status;
    2755           0 :         bt_addr_t bdaddr;
    2756           0 :         uint8_t   name[248];
    2757             : } __packed;
    2758             : 
    2759           0 : #define BT_HCI_EVT_ENCRYPT_CHANGE               0x08
    2760           0 : struct bt_hci_evt_encrypt_change {
    2761           0 :         uint8_t  status;
    2762           0 :         uint16_t handle;
    2763           0 :         uint8_t  encrypt;
    2764             : } __packed;
    2765             : 
    2766           0 : #define BT_HCI_EVT_REMOTE_FEATURES              0x0b
    2767           0 : struct bt_hci_evt_remote_features {
    2768           0 :         uint8_t  status;
    2769           0 :         uint16_t handle;
    2770           0 :         uint8_t  features[8];
    2771             : } __packed;
    2772             : 
    2773           0 : #define BT_HCI_EVT_REMOTE_VERSION_INFO          0x0c
    2774           0 : struct bt_hci_evt_remote_version_info {
    2775           0 :         uint8_t  status;
    2776           0 :         uint16_t handle;
    2777           0 :         uint8_t  version;
    2778           0 :         uint16_t manufacturer;
    2779           0 :         uint16_t subversion;
    2780             : } __packed;
    2781             : 
    2782           0 : #define BT_HCI_EVT_CMD_COMPLETE                 0x0e
    2783           0 : struct bt_hci_evt_cmd_complete {
    2784           0 :         uint8_t  ncmd;
    2785           0 :         uint16_t opcode;
    2786             : } __packed;
    2787             : 
    2788           0 : struct bt_hci_evt_cc_status {
    2789           0 :         uint8_t  status;
    2790             : } __packed;
    2791             : 
    2792           0 : #define BT_HCI_EVT_CMD_STATUS                   0x0f
    2793           0 : struct bt_hci_evt_cmd_status {
    2794           0 :         uint8_t  status;
    2795           0 :         uint8_t  ncmd;
    2796           0 :         uint16_t opcode;
    2797             : } __packed;
    2798             : 
    2799           0 : #define BT_HCI_EVT_HARDWARE_ERROR               0x10
    2800           0 : struct bt_hci_evt_hardware_error {
    2801           0 :         uint8_t  hardware_code;
    2802             : } __packed;
    2803             : 
    2804           0 : #define BT_HCI_EVT_ROLE_CHANGE                  0x12
    2805           0 : struct bt_hci_evt_role_change {
    2806           0 :         uint8_t   status;
    2807           0 :         bt_addr_t bdaddr;
    2808           0 :         uint8_t   role;
    2809             : } __packed;
    2810             : 
    2811           0 : #define BT_HCI_EVT_NUM_COMPLETED_PACKETS        0x13
    2812           0 : struct bt_hci_evt_num_completed_packets {
    2813           0 :         uint8_t  num_handles;
    2814           0 :         struct bt_hci_handle_count h[0];
    2815             : } __packed;
    2816             : 
    2817           0 : #define BT_HCI_EVT_PIN_CODE_REQ                 0x16
    2818           0 : struct bt_hci_evt_pin_code_req {
    2819           0 :         bt_addr_t bdaddr;
    2820             : } __packed;
    2821             : 
    2822           0 : #define BT_HCI_EVT_LINK_KEY_REQ                 0x17
    2823           0 : struct bt_hci_evt_link_key_req {
    2824           0 :         bt_addr_t bdaddr;
    2825             : } __packed;
    2826             : 
    2827             : /* Link Key types */
    2828           0 : #define BT_LK_COMBINATION                       0x00
    2829           0 : #define BT_LK_LOCAL_UNIT                        0x01
    2830           0 : #define BT_LK_REMOTE_UNIT                       0x02
    2831           0 : #define BT_LK_DEBUG_COMBINATION                 0x03
    2832           0 : #define BT_LK_UNAUTH_COMBINATION_P192           0x04
    2833           0 : #define BT_LK_AUTH_COMBINATION_P192             0x05
    2834           0 : #define BT_LK_CHANGED_COMBINATION               0x06
    2835           0 : #define BT_LK_UNAUTH_COMBINATION_P256           0x07
    2836           0 : #define BT_LK_AUTH_COMBINATION_P256             0x08
    2837             : 
    2838           0 : #define BT_HCI_EVT_LINK_KEY_NOTIFY              0x18
    2839           0 : struct bt_hci_evt_link_key_notify {
    2840           0 :         bt_addr_t bdaddr;
    2841           0 :         uint8_t   link_key[16];
    2842           0 :         uint8_t   key_type;
    2843             : } __packed;
    2844             : 
    2845             : /* Overflow link types */
    2846           0 : #define BT_OVERFLOW_LINK_SYNCH                  0x00
    2847           0 : #define BT_OVERFLOW_LINK_ACL                    0x01
    2848           0 : #define BT_OVERFLOW_LINK_ISO                    0x02
    2849             : 
    2850           0 : #define BT_HCI_EVT_DATA_BUF_OVERFLOW            0x1a
    2851           0 : struct bt_hci_evt_data_buf_overflow {
    2852           0 :         uint8_t  link_type;
    2853             : } __packed;
    2854             : 
    2855           0 : #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI     0x22
    2856           0 : struct bt_hci_evt_inquiry_result_with_rssi {
    2857           0 :         bt_addr_t addr;
    2858           0 :         uint8_t   pscan_rep_mode;
    2859           0 :         uint8_t   reserved;
    2860           0 :         uint8_t   cod[3];
    2861           0 :         uint16_t  clock_offset;
    2862           0 :         int8_t    rssi;
    2863             : } __packed;
    2864             : 
    2865           0 : #define BT_HCI_EVT_REMOTE_EXT_FEATURES          0x23
    2866           0 : struct bt_hci_evt_remote_ext_features {
    2867           0 :         uint8_t  status;
    2868           0 :         uint16_t handle;
    2869           0 :         uint8_t  page;
    2870           0 :         uint8_t  max_page;
    2871           0 :         uint8_t  features[8];
    2872             : } __packed;
    2873             : 
    2874           0 : #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED_V2 0x24
    2875           0 : struct bt_hci_evt_le_per_adv_sync_established_v2 {
    2876           0 :         uint8_t      status;
    2877           0 :         uint16_t     handle;
    2878           0 :         uint8_t      sid;
    2879           0 :         bt_addr_le_t adv_addr;
    2880           0 :         uint8_t      phy;
    2881           0 :         uint16_t     interval;
    2882           0 :         uint8_t      clock_accuracy;
    2883           0 :         uint8_t      num_subevents;
    2884           0 :         uint8_t      subevent_interval;
    2885           0 :         uint8_t      response_slot_delay;
    2886           0 :         uint8_t      response_slot_spacing;
    2887             : } __packed;
    2888             : 
    2889           0 : #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT_V2 0x25
    2890           0 : struct bt_hci_evt_le_per_advertising_report_v2 {
    2891           0 :         uint16_t handle;
    2892           0 :         int8_t   tx_power;
    2893           0 :         int8_t   rssi;
    2894           0 :         uint8_t  cte_type;
    2895           0 :         uint16_t periodic_event_counter;
    2896           0 :         uint8_t  subevent;
    2897           0 :         uint8_t  data_status;
    2898           0 :         uint8_t  length;
    2899           0 :         uint8_t  data[0];
    2900             : } __packed;
    2901             : 
    2902           0 : #define BT_HCI_EVT_LE_PAST_RECEIVED_V2 0x26
    2903           0 : struct bt_hci_evt_le_past_received_v2 {
    2904           0 :         uint8_t      status;
    2905           0 :         uint16_t     conn_handle;
    2906           0 :         uint16_t     service_data;
    2907           0 :         uint16_t     sync_handle;
    2908           0 :         uint8_t      adv_sid;
    2909           0 :         bt_addr_le_t addr;
    2910           0 :         uint8_t      phy;
    2911           0 :         uint16_t     interval;
    2912           0 :         uint8_t      clock_accuracy;
    2913           0 :         uint8_t      num_subevents;
    2914           0 :         uint8_t      subevent_interval;
    2915           0 :         uint8_t      response_slot_delay;
    2916           0 :         uint8_t      response_slot_spacing;
    2917             : } __packed;
    2918             : 
    2919           0 : #define BT_HCI_EVT_LE_PER_ADV_SUBEVENT_DATA_REQUEST 0x27
    2920           0 : struct bt_hci_evt_le_per_adv_subevent_data_request {
    2921           0 :         uint8_t adv_handle;
    2922           0 :         uint8_t subevent_start;
    2923           0 :         uint8_t subevent_data_count;
    2924             : } __packed;
    2925             : 
    2926           0 : #define BT_HCI_EVT_LE_PER_ADV_RESPONSE_REPORT 0x28
    2927             : 
    2928           0 : struct bt_hci_evt_le_per_adv_response {
    2929           0 :         int8_t  tx_power;
    2930           0 :         int8_t  rssi;
    2931           0 :         uint8_t cte_type;
    2932           0 :         uint8_t response_slot;
    2933           0 :         uint8_t data_status;
    2934           0 :         uint8_t data_length;
    2935           0 :         uint8_t data[0];
    2936             : } __packed;
    2937             : 
    2938           0 : struct bt_hci_evt_le_per_adv_response_report {
    2939           0 :         uint8_t adv_handle;
    2940           0 :         uint8_t subevent;
    2941           0 :         uint8_t tx_status;
    2942           0 :         uint8_t num_responses;
    2943           0 :         struct bt_hci_evt_le_per_adv_response responses[0];
    2944             : } __packed;
    2945             : 
    2946           0 : #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE_V2 0x29
    2947           0 : struct bt_hci_evt_le_enh_conn_complete_v2 {
    2948           0 :         uint8_t      status;
    2949           0 :         uint16_t     handle;
    2950           0 :         uint8_t      role;
    2951           0 :         bt_addr_le_t peer_addr;
    2952           0 :         bt_addr_t    local_rpa;
    2953           0 :         bt_addr_t    peer_rpa;
    2954           0 :         uint16_t     interval;
    2955           0 :         uint16_t     latency;
    2956           0 :         uint16_t     supv_timeout;
    2957           0 :         uint8_t      clock_accuracy;
    2958           0 :         uint8_t      adv_handle;
    2959           0 :         uint16_t     sync_handle;
    2960             : } __packed;
    2961             : 
    2962           0 : #define BT_HCI_EVT_SYNC_CONN_COMPLETE           0x2c
    2963           0 : struct bt_hci_evt_sync_conn_complete {
    2964           0 :         uint8_t    status;
    2965           0 :         uint16_t   handle;
    2966           0 :         bt_addr_t  bdaddr;
    2967           0 :         uint8_t    link_type;
    2968           0 :         uint8_t    tx_interval;
    2969           0 :         uint8_t    retansmission_window;
    2970           0 :         uint16_t   rx_pkt_length;
    2971           0 :         uint16_t   tx_pkt_length;
    2972           0 :         uint8_t    air_mode;
    2973             : } __packed;
    2974             : 
    2975           0 : #define BT_HCI_EVT_EXTENDED_INQUIRY_RESULT      0x2f
    2976           0 : struct bt_hci_evt_extended_inquiry_result {
    2977           0 :         uint8_t    num_reports;
    2978           0 :         bt_addr_t  addr;
    2979           0 :         uint8_t    pscan_rep_mode;
    2980           0 :         uint8_t    reserved;
    2981           0 :         uint8_t    cod[3];
    2982           0 :         uint16_t   clock_offset;
    2983           0 :         int8_t     rssi;
    2984           0 :         uint8_t    eir[240];
    2985             : } __packed;
    2986             : 
    2987           0 : #define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30
    2988           0 : struct bt_hci_evt_encrypt_key_refresh_complete {
    2989           0 :         uint8_t  status;
    2990           0 :         uint16_t handle;
    2991             : } __packed;
    2992             : 
    2993           0 : #define BT_HCI_EVT_IO_CAPA_REQ                  0x31
    2994           0 : struct bt_hci_evt_io_capa_req {
    2995           0 :         bt_addr_t bdaddr;
    2996             : } __packed;
    2997             : 
    2998           0 : #define BT_HCI_EVT_IO_CAPA_RESP                 0x32
    2999           0 : struct bt_hci_evt_io_capa_resp {
    3000           0 :         bt_addr_t bdaddr;
    3001           0 :         uint8_t   capability;
    3002           0 :         uint8_t   oob_data;
    3003           0 :         uint8_t   authentication;
    3004             : } __packed;
    3005             : 
    3006           0 : #define BT_HCI_EVT_USER_CONFIRM_REQ             0x33
    3007           0 : struct bt_hci_evt_user_confirm_req {
    3008           0 :         bt_addr_t bdaddr;
    3009           0 :         uint32_t  passkey;
    3010             : } __packed;
    3011             : 
    3012           0 : #define BT_HCI_EVT_USER_PASSKEY_REQ             0x34
    3013           0 : struct bt_hci_evt_user_passkey_req {
    3014           0 :         bt_addr_t bdaddr;
    3015             : } __packed;
    3016             : 
    3017           0 : #define BT_HCI_EVT_SSP_COMPLETE                 0x36
    3018           0 : struct bt_hci_evt_ssp_complete {
    3019           0 :         uint8_t   status;
    3020           0 :         bt_addr_t bdaddr;
    3021             : } __packed;
    3022             : 
    3023           0 : #define BT_HCI_EVT_USER_PASSKEY_NOTIFY          0x3b
    3024           0 : struct bt_hci_evt_user_passkey_notify {
    3025           0 :         bt_addr_t bdaddr;
    3026           0 :         uint32_t  passkey;
    3027             : } __packed;
    3028             : 
    3029           0 : #define BT_HCI_EVT_LE_META_EVENT                0x3e
    3030           0 : struct bt_hci_evt_le_meta_event {
    3031           0 :         uint8_t  subevent;
    3032             : } __packed;
    3033             : 
    3034           0 : #define BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP     0x57
    3035           0 : struct bt_hci_evt_auth_payload_timeout_exp {
    3036           0 :         uint16_t handle;
    3037             : } __packed;
    3038             : 
    3039           0 : #define BT_HCI_ROLE_CENTRAL                     0x00
    3040           0 : #define BT_HCI_ROLE_PERIPHERAL                  0x01
    3041             : 
    3042           0 : #define BT_HCI_EVT_LE_CONN_COMPLETE             0x01
    3043           0 : struct bt_hci_evt_le_conn_complete {
    3044           0 :         uint8_t      status;
    3045           0 :         uint16_t     handle;
    3046           0 :         uint8_t      role;
    3047           0 :         bt_addr_le_t peer_addr;
    3048           0 :         uint16_t     interval;
    3049           0 :         uint16_t     latency;
    3050           0 :         uint16_t     supv_timeout;
    3051           0 :         uint8_t      clock_accuracy;
    3052             : } __packed;
    3053             : 
    3054           0 : #define BT_HCI_LE_RSSI_NOT_AVAILABLE            0x7F
    3055             : 
    3056           0 : #define BT_HCI_EVT_LE_ADVERTISING_REPORT        0x02
    3057           0 : struct bt_hci_evt_le_advertising_info {
    3058           0 :         uint8_t      evt_type;
    3059           0 :         bt_addr_le_t addr;
    3060           0 :         uint8_t      length;
    3061           0 :         uint8_t      data[0];
    3062             : } __packed;
    3063           0 : struct bt_hci_evt_le_advertising_report {
    3064           0 :         uint8_t num_reports;
    3065           0 :         struct bt_hci_evt_le_advertising_info adv_info[0];
    3066             : } __packed;
    3067             : 
    3068             : /** All limits according to BT Core Spec v5.4 [Vol 4, Part E]. */
    3069           1 : #define BT_HCI_LE_INTERVAL_MIN           0x0006
    3070           0 : #define BT_HCI_LE_INTERVAL_MAX           0x0c80
    3071           0 : #define BT_HCI_LE_PERIPHERAL_LATENCY_MAX 0x01f3
    3072           0 : #define BT_HCI_LE_SUPERVISON_TIMEOUT_MIN 0x000a
    3073           0 : #define BT_HCI_LE_SUPERVISON_TIMEOUT_MAX 0x0c80
    3074             : 
    3075           0 : #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE      0x03
    3076           0 : struct bt_hci_evt_le_conn_update_complete {
    3077           0 :         uint8_t  status;
    3078           0 :         uint16_t handle;
    3079           0 :         uint16_t interval;
    3080           0 :         uint16_t latency;
    3081           0 :         uint16_t supv_timeout;
    3082             : } __packed;
    3083             : 
    3084           0 : #define BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE      0x04
    3085           0 : struct bt_hci_evt_le_remote_feat_complete {
    3086           0 :         uint8_t  status;
    3087           0 :         uint16_t handle;
    3088           0 :         uint8_t  features[8];
    3089             : } __packed;
    3090             : 
    3091           0 : #define BT_HCI_EVT_LE_LTK_REQUEST               0x05
    3092           0 : struct bt_hci_evt_le_ltk_request {
    3093           0 :         uint16_t handle;
    3094           0 :         uint64_t rand;
    3095           0 :         uint16_t ediv;
    3096             : } __packed;
    3097             : 
    3098           0 : #define BT_HCI_EVT_LE_CONN_PARAM_REQ            0x06
    3099           0 : struct bt_hci_evt_le_conn_param_req {
    3100           0 :         uint16_t handle;
    3101           0 :         uint16_t interval_min;
    3102           0 :         uint16_t interval_max;
    3103           0 :         uint16_t latency;
    3104           0 :         uint16_t timeout;
    3105             : } __packed;
    3106             : 
    3107           0 : #define BT_HCI_EVT_LE_DATA_LEN_CHANGE           0x07
    3108           0 : struct bt_hci_evt_le_data_len_change {
    3109           0 :         uint16_t handle;
    3110           0 :         uint16_t max_tx_octets;
    3111           0 :         uint16_t max_tx_time;
    3112           0 :         uint16_t max_rx_octets;
    3113           0 :         uint16_t max_rx_time;
    3114             : } __packed;
    3115             : 
    3116           0 : #define BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE  0x08
    3117           0 : struct bt_hci_evt_le_p256_public_key_complete {
    3118           0 :         uint8_t status;
    3119           0 :         uint8_t key[64];
    3120             : } __packed;
    3121             : 
    3122           0 : #define BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE   0x09
    3123           0 : struct bt_hci_evt_le_generate_dhkey_complete {
    3124           0 :         uint8_t status;
    3125           0 :         uint8_t dhkey[32];
    3126             : } __packed;
    3127             : 
    3128           0 : #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE         0x0a
    3129           0 : struct bt_hci_evt_le_enh_conn_complete {
    3130           0 :         uint8_t      status;
    3131           0 :         uint16_t     handle;
    3132           0 :         uint8_t      role;
    3133           0 :         bt_addr_le_t peer_addr;
    3134           0 :         bt_addr_t    local_rpa;
    3135           0 :         bt_addr_t    peer_rpa;
    3136           0 :         uint16_t     interval;
    3137           0 :         uint16_t     latency;
    3138           0 :         uint16_t     supv_timeout;
    3139           0 :         uint8_t      clock_accuracy;
    3140             : } __packed;
    3141             : 
    3142           0 : #define BT_HCI_EVT_LE_DIRECT_ADV_REPORT         0x0b
    3143           0 : struct bt_hci_evt_le_direct_adv_info {
    3144           0 :         uint8_t      evt_type;
    3145           0 :         bt_addr_le_t addr;
    3146           0 :         bt_addr_le_t dir_addr;
    3147           0 :         int8_t       rssi;
    3148             : } __packed;
    3149           0 : struct bt_hci_evt_le_direct_adv_report {
    3150           0 :         uint8_t num_reports;
    3151           0 :         struct bt_hci_evt_le_direct_adv_info direct_adv_info[0];
    3152             : } __packed;
    3153             : 
    3154           0 : #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE       0x0c
    3155           0 : struct bt_hci_evt_le_phy_update_complete {
    3156           0 :         uint8_t  status;
    3157           0 :         uint16_t handle;
    3158           0 :         uint8_t  tx_phy;
    3159           0 :         uint8_t  rx_phy;
    3160             : } __packed;
    3161             : 
    3162           0 : #define BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT    0x0d
    3163             : 
    3164           0 : #define BT_HCI_LE_ADV_EVT_TYPE_CONN                 BIT(0)
    3165           0 : #define BT_HCI_LE_ADV_EVT_TYPE_SCAN                 BIT(1)
    3166           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DIRECT               BIT(2)
    3167           0 : #define BT_HCI_LE_ADV_EVT_TYPE_SCAN_RSP             BIT(3)
    3168           0 : #define BT_HCI_LE_ADV_EVT_TYPE_LEGACY               BIT(4)
    3169             : 
    3170           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS(ev_type) (((ev_type) >> 5) & 0x03)
    3171           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_COMPLETE   0
    3172           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_PARTIAL    1
    3173           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_INCOMPLETE 2
    3174           0 : #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_RX_FAILED  0xFF
    3175             : 
    3176           0 : struct bt_hci_evt_le_ext_advertising_info {
    3177           0 :         uint16_t     evt_type;
    3178           0 :         bt_addr_le_t addr;
    3179           0 :         uint8_t      prim_phy;
    3180           0 :         uint8_t      sec_phy;
    3181           0 :         uint8_t      sid;
    3182           0 :         int8_t       tx_power;
    3183           0 :         int8_t       rssi;
    3184           0 :         uint16_t     interval;
    3185           0 :         bt_addr_le_t direct_addr;
    3186           0 :         uint8_t      length;
    3187           0 :         uint8_t      data[0];
    3188             : } __packed;
    3189           0 : struct bt_hci_evt_le_ext_advertising_report {
    3190           0 :         uint8_t num_reports;
    3191           0 :         struct bt_hci_evt_le_ext_advertising_info adv_info[0];
    3192             : } __packed;
    3193             : 
    3194           0 : #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED  0x0e
    3195           0 : struct bt_hci_evt_le_per_adv_sync_established {
    3196           0 :         uint8_t      status;
    3197           0 :         uint16_t     handle;
    3198           0 :         uint8_t      sid;
    3199           0 :         bt_addr_le_t adv_addr;
    3200           0 :         uint8_t      phy;
    3201           0 :         uint16_t     interval;
    3202           0 :         uint8_t      clock_accuracy;
    3203             : } __packed;
    3204             : 
    3205           0 : #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT    0x0f
    3206           0 : struct bt_hci_evt_le_per_advertising_report {
    3207           0 :         uint16_t handle;
    3208           0 :         int8_t   tx_power;
    3209           0 :         int8_t   rssi;
    3210           0 :         uint8_t  cte_type;
    3211           0 :         uint8_t  data_status;
    3212           0 :         uint8_t  length;
    3213           0 :         uint8_t  data[0];
    3214             : } __packed;
    3215             : 
    3216           0 : #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST         0x10
    3217           0 : struct bt_hci_evt_le_per_adv_sync_lost {
    3218           0 :         uint16_t handle;
    3219             : } __packed;
    3220             : 
    3221           0 : #define BT_HCI_EVT_LE_SCAN_TIMEOUT              0x11
    3222             : 
    3223           0 : #define BT_HCI_EVT_LE_ADV_SET_TERMINATED        0x12
    3224           0 : struct bt_hci_evt_le_adv_set_terminated {
    3225           0 :         uint8_t  status;
    3226           0 :         uint8_t  adv_handle;
    3227           0 :         uint16_t conn_handle;
    3228           0 :         uint8_t  num_completed_ext_adv_evts;
    3229             : } __packed;
    3230             : 
    3231           0 : #define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED         0x13
    3232           0 : struct bt_hci_evt_le_scan_req_received {
    3233           0 :         uint8_t      handle;
    3234           0 :         bt_addr_le_t addr;
    3235             : } __packed;
    3236             : 
    3237           0 : #define BT_HCI_LE_CHAN_SEL_ALGO_1               0x00
    3238           0 : #define BT_HCI_LE_CHAN_SEL_ALGO_2               0x01
    3239             : 
    3240           0 : #define BT_HCI_EVT_LE_CHAN_SEL_ALGO             0x14
    3241           0 : struct bt_hci_evt_le_chan_sel_algo {
    3242           0 :         uint16_t handle;
    3243           0 :         uint8_t  chan_sel_algo;
    3244             : } __packed;
    3245             : 
    3246           0 : #define BT_HCI_LE_CTE_CRC_OK                    0x0
    3247           0 : #define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_TIME    0x1
    3248           0 : #define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_OTHER   0x2
    3249           0 : #define BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES    0xFF
    3250             : 
    3251           0 : #define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MIN    0x9
    3252           0 : #define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MAX    0x52
    3253             : 
    3254           0 : #define BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE    0x80
    3255             : 
    3256           0 : #define BT_HCI_EVT_LE_CONNECTIONLESS_IQ_REPORT  0x15
    3257           0 : struct bt_hci_le_iq_sample {
    3258           0 :         int8_t i;
    3259           0 :         int8_t q;
    3260             : };
    3261             : 
    3262           0 : struct bt_hci_evt_le_connectionless_iq_report {
    3263           0 :         uint16_t sync_handle;
    3264           0 :         uint8_t  chan_idx;
    3265           0 :         int16_t  rssi;
    3266           0 :         uint8_t  rssi_ant_id;
    3267           0 :         uint8_t  cte_type;
    3268           0 :         uint8_t  slot_durations;
    3269           0 :         uint8_t  packet_status;
    3270           0 :         uint16_t per_evt_counter;
    3271           0 :         uint8_t  sample_count;
    3272           0 :         struct bt_hci_le_iq_sample sample[0];
    3273             : } __packed;
    3274             : 
    3275           0 : #define BT_HCI_EVT_LE_CONNECTION_IQ_REPORT      0x16
    3276           0 : struct bt_hci_evt_le_connection_iq_report {
    3277           0 :         uint16_t conn_handle;
    3278           0 :         uint8_t  rx_phy;
    3279           0 :         uint8_t  data_chan_idx;
    3280           0 :         int16_t  rssi;
    3281           0 :         uint8_t  rssi_ant_id;
    3282           0 :         uint8_t  cte_type;
    3283           0 :         uint8_t  slot_durations;
    3284           0 :         uint8_t  packet_status;
    3285           0 :         uint16_t conn_evt_counter;
    3286           0 :         uint8_t  sample_count;
    3287           0 :         struct bt_hci_le_iq_sample sample[0];
    3288             : } __packed;
    3289             : 
    3290           0 : #define BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE  0x0
    3291             : 
    3292           0 : #define BT_HCI_EVT_LE_CTE_REQUEST_FAILED       0x17
    3293           0 : struct bt_hci_evt_le_cte_req_failed {
    3294             :         /* According to BT 5.3 Core Spec the status field may have following
    3295             :          * values:
    3296             :          * - BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE when received LL_CTE_RSP_PDU without CTE.
    3297             :          * - Other Controller error code for peer rejected request.
    3298             :          */
    3299           0 :         uint8_t  status;
    3300           0 :         uint16_t conn_handle;
    3301             : } __packed;
    3302             : 
    3303           0 : #define BT_HCI_EVT_LE_PAST_RECEIVED                0x18
    3304           0 : struct bt_hci_evt_le_past_received {
    3305           0 :         uint8_t      status;
    3306           0 :         uint16_t     conn_handle;
    3307           0 :         uint16_t     service_data;
    3308           0 :         uint16_t     sync_handle;
    3309           0 :         uint8_t      adv_sid;
    3310           0 :         bt_addr_le_t addr;
    3311           0 :         uint8_t      phy;
    3312           0 :         uint16_t     interval;
    3313           0 :         uint8_t      clock_accuracy;
    3314             : } __packed;
    3315             : 
    3316           0 : #define BT_HCI_EVT_LE_CIS_ESTABLISHED           0x19
    3317           0 : struct bt_hci_evt_le_cis_established {
    3318           0 :         uint8_t  status;
    3319           0 :         uint16_t conn_handle;
    3320           0 :         uint8_t  cig_sync_delay[3];
    3321           0 :         uint8_t  cis_sync_delay[3];
    3322           0 :         uint8_t  c_latency[3];
    3323           0 :         uint8_t  p_latency[3];
    3324           0 :         uint8_t  c_phy;
    3325           0 :         uint8_t  p_phy;
    3326           0 :         uint8_t  nse;
    3327           0 :         uint8_t  c_bn;
    3328           0 :         uint8_t  p_bn;
    3329           0 :         uint8_t  c_ft;
    3330           0 :         uint8_t  p_ft;
    3331           0 :         uint16_t c_max_pdu;
    3332           0 :         uint16_t p_max_pdu;
    3333           0 :         uint16_t interval;
    3334             : } __packed;
    3335             : 
    3336           0 : #define BT_HCI_EVT_LE_CIS_REQ                   0x1a
    3337           0 : struct bt_hci_evt_le_cis_req {
    3338           0 :         uint16_t acl_handle;
    3339           0 :         uint16_t cis_handle;
    3340           0 :         uint8_t  cig_id;
    3341           0 :         uint8_t  cis_id;
    3342             : } __packed;
    3343             : 
    3344           0 : #define BT_HCI_EVT_LE_BIG_COMPLETE              0x1b
    3345           0 : struct bt_hci_evt_le_big_complete {
    3346           0 :         uint8_t  status;
    3347           0 :         uint8_t  big_handle;
    3348           0 :         uint8_t  sync_delay[3];
    3349           0 :         uint8_t  latency[3];
    3350           0 :         uint8_t  phy;
    3351           0 :         uint8_t  nse;
    3352           0 :         uint8_t  bn;
    3353           0 :         uint8_t  pto;
    3354           0 :         uint8_t  irc;
    3355           0 :         uint16_t max_pdu;
    3356           0 :         uint16_t iso_interval;
    3357           0 :         uint8_t  num_bis;
    3358           0 :         uint16_t handle[0];
    3359             : } __packed;
    3360             : 
    3361           0 : #define BT_HCI_EVT_LE_BIG_TERMINATE             0x1c
    3362           0 : struct bt_hci_evt_le_big_terminate {
    3363           0 :         uint8_t  big_handle;
    3364           0 :         uint8_t  reason;
    3365             : } __packed;
    3366             : 
    3367           0 : #define BT_HCI_EVT_LE_BIG_SYNC_ESTABLISHED      0x1d
    3368           0 : struct bt_hci_evt_le_big_sync_established {
    3369           0 :         uint8_t  status;
    3370           0 :         uint8_t  big_handle;
    3371           0 :         uint8_t  latency[3];
    3372           0 :         uint8_t  nse;
    3373           0 :         uint8_t  bn;
    3374           0 :         uint8_t  pto;
    3375           0 :         uint8_t  irc;
    3376           0 :         uint16_t max_pdu;
    3377           0 :         uint16_t iso_interval;
    3378           0 :         uint8_t  num_bis;
    3379           0 :         uint16_t handle[0];
    3380             : } __packed;
    3381             : 
    3382           0 : #define BT_HCI_EVT_LE_BIG_SYNC_LOST             0x1e
    3383           0 : struct bt_hci_evt_le_big_sync_lost {
    3384           0 :         uint8_t  big_handle;
    3385           0 :         uint8_t  reason;
    3386             : } __packed;
    3387             : 
    3388           0 : #define BT_HCI_EVT_LE_REQ_PEER_SCA_COMPLETE     0x1f
    3389           0 : struct bt_hci_evt_le_req_peer_sca_complete {
    3390           0 :         uint8_t  status;
    3391           0 :         uint16_t handle;
    3392           0 :         uint8_t  sca;
    3393             : } __packed;
    3394             : 
    3395           0 : #define BT_HCI_LE_ZONE_ENTERED_LOW      0x0
    3396           0 : #define BT_HCI_LE_ZONE_ENTERED_MIDDLE   0x1
    3397           0 : #define BT_HCI_LE_ZONE_ENTERED_HIGH     0x2
    3398           0 : #define BT_HCI_LE_PATH_LOSS_UNAVAILABLE 0xFF
    3399             : 
    3400           0 : #define BT_HCI_EVT_LE_PATH_LOSS_THRESHOLD                   0x20
    3401           0 : struct bt_hci_evt_le_path_loss_threshold {
    3402           0 :         uint16_t handle;
    3403           0 :         uint8_t  current_path_loss;
    3404           0 :         uint8_t  zone_entered;
    3405             : } __packed;
    3406             : 
    3407             : /** Reason for Transmit power reporting.
    3408             :  */
    3409             : /* Local Transmit power changed. */
    3410           1 : #define BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED         0x00
    3411             : /* Remote Transmit power changed. */
    3412           0 : #define BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED        0x01
    3413             : /* HCI_LE_Read_Remote_Transmit_Power_Level command completed. */
    3414           0 : #define BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED 0x02
    3415             : 
    3416           0 : #define BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT     0x21
    3417           0 : struct bt_hci_evt_le_transmit_power_report {
    3418           0 :         uint8_t  status;
    3419           0 :         uint16_t handle;
    3420           0 :         uint8_t  reason;
    3421           0 :         uint8_t  phy;
    3422           0 :         int8_t   tx_power_level;
    3423           0 :         uint8_t  tx_power_level_flag;
    3424           0 :         int8_t   delta;
    3425             : } __packed;
    3426             : 
    3427           0 : #define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT        0x22
    3428           0 : struct bt_hci_evt_le_biginfo_adv_report {
    3429           0 :         uint16_t sync_handle;
    3430           0 :         uint8_t  num_bis;
    3431           0 :         uint8_t  nse;
    3432           0 :         uint16_t iso_interval;
    3433           0 :         uint8_t  bn;
    3434           0 :         uint8_t  pto;
    3435           0 :         uint8_t  irc;
    3436           0 :         uint16_t max_pdu;
    3437           0 :         uint8_t  sdu_interval[3];
    3438           0 :         uint16_t max_sdu;
    3439           0 :         uint8_t  phy;
    3440           0 :         uint8_t  framing;
    3441           0 :         uint8_t  encryption;
    3442             : } __packed;
    3443             : 
    3444             : /** All limits according to BT Core Spec v5.4 [Vol 4, Part E]. */
    3445           1 : #define BT_HCI_LE_SUBRATE_FACTOR_MIN   0x0001
    3446           0 : #define BT_HCI_LE_SUBRATE_FACTOR_MAX   0x01f4
    3447           0 : #define BT_HCI_LE_CONTINUATION_NUM_MAX 0x01f3
    3448             : 
    3449           0 : #define BT_HCI_EVT_LE_SUBRATE_CHANGE            0x23
    3450           0 : struct bt_hci_evt_le_subrate_change {
    3451           0 :         uint8_t  status;
    3452           0 :         uint16_t handle;
    3453           0 :         uint16_t subrate_factor;
    3454           0 :         uint16_t peripheral_latency;
    3455           0 :         uint16_t continuation_number;
    3456           0 :         uint16_t supervision_timeout;
    3457             : } __packed;
    3458             : 
    3459           0 : #define BT_HCI_EVT_LE_CIS_ESTABLISHED_V2 0x2a
    3460           0 : struct bt_hci_evt_le_cis_established_v2 {
    3461           0 :         uint8_t  status;
    3462           0 :         uint16_t conn_handle;
    3463           0 :         uint8_t  cig_sync_delay[3];
    3464           0 :         uint8_t  cis_sync_delay[3];
    3465           0 :         uint8_t  c_latency[3];
    3466           0 :         uint8_t  p_latency[3];
    3467           0 :         uint8_t  c_phy;
    3468           0 :         uint8_t  p_phy;
    3469           0 :         uint8_t  nse;
    3470           0 :         uint8_t  c_bn;
    3471           0 :         uint8_t  p_bn;
    3472           0 :         uint8_t  c_ft;
    3473           0 :         uint8_t  p_ft;
    3474           0 :         uint16_t c_max_pdu;
    3475           0 :         uint16_t p_max_pdu;
    3476           0 :         uint16_t interval;
    3477           0 :         uint8_t  sub_interval[3];
    3478           0 :         uint16_t c_max_sdu;
    3479           0 :         uint16_t p_max_sdu;
    3480           0 :         uint8_t  c_sdu_interval[3];
    3481           0 :         uint8_t  p_sdu_interval[3];
    3482           0 :         uint8_t  framing;
    3483             : } __packed;
    3484             : 
    3485           0 : #define BT_HCI_LE_CS_INITIATOR_ROLE_MASK BIT(0)
    3486           0 : #define BT_HCI_LE_CS_REFLECTOR_ROLE_MASK BIT(1)
    3487             : 
    3488           0 : #define BT_HCI_LE_CS_MODES_SUPPORTED_MODE_3_MASK BIT(0)
    3489             : 
    3490           0 : #define BT_HCI_LE_CS_RTT_AA_ONLY_N_10NS_MASK        BIT(0)
    3491           0 : #define BT_HCI_LE_CS_RTT_SOUNDING_N_10NS_MASK       BIT(1)
    3492           0 : #define BT_HCI_LE_CS_RTT_RANDOM_PAYLOAD_N_10NS_MASK BIT(2)
    3493             : 
    3494           0 : #define BT_HCI_LE_CS_NADM_SOUNDING_CAPABILITY_PHASE_BASED_MASK BIT(0)
    3495           0 : #define BT_HCI_LE_CS_NADM_RANDOM_CAPABILITY_PHASE_BASED_MASK BIT(0)
    3496             : 
    3497           0 : #define BT_HCI_LE_CS_SYNC_PHYS_2M_MASK BIT(1)
    3498           0 : #define BT_HCI_LE_CS_SYNC_PHYS_2M_2BT_MASK BIT(2)
    3499             : 
    3500           0 : #define BT_HCI_LE_CS_SUBFEATURE_NO_TX_FAE_MASK BIT(1)
    3501           0 : #define BT_HCI_LE_CS_SUBFEATURE_CHSEL_ALG_3C_MASK BIT(2)
    3502           0 : #define BT_HCI_LE_CS_SUBFEATURE_PBR_FROM_RTT_SOUNDING_SEQ_MASK BIT(3)
    3503             : 
    3504           0 : #define BT_HCI_LE_CS_T_IP1_TIME_10US_MASK BIT(0)
    3505           0 : #define BT_HCI_LE_CS_T_IP1_TIME_20US_MASK BIT(1)
    3506           0 : #define BT_HCI_LE_CS_T_IP1_TIME_30US_MASK BIT(2)
    3507           0 : #define BT_HCI_LE_CS_T_IP1_TIME_40US_MASK BIT(3)
    3508           0 : #define BT_HCI_LE_CS_T_IP1_TIME_50US_MASK BIT(4)
    3509           0 : #define BT_HCI_LE_CS_T_IP1_TIME_60US_MASK BIT(5)
    3510           0 : #define BT_HCI_LE_CS_T_IP1_TIME_80US_MASK BIT(6)
    3511             : 
    3512           0 : #define BT_HCI_LE_CS_T_IP2_TIME_10US_MASK BIT(0)
    3513           0 : #define BT_HCI_LE_CS_T_IP2_TIME_20US_MASK BIT(1)
    3514           0 : #define BT_HCI_LE_CS_T_IP2_TIME_30US_MASK BIT(2)
    3515           0 : #define BT_HCI_LE_CS_T_IP2_TIME_40US_MASK BIT(3)
    3516           0 : #define BT_HCI_LE_CS_T_IP2_TIME_50US_MASK BIT(4)
    3517           0 : #define BT_HCI_LE_CS_T_IP2_TIME_60US_MASK BIT(5)
    3518           0 : #define BT_HCI_LE_CS_T_IP2_TIME_80US_MASK BIT(6)
    3519             : 
    3520           0 : #define BT_HCI_LE_CS_T_FCS_TIME_15US_MASK   BIT(0)
    3521           0 : #define BT_HCI_LE_CS_T_FCS_TIME_20US_MASK   BIT(1)
    3522           0 : #define BT_HCI_LE_CS_T_FCS_TIME_30US_MASK   BIT(2)
    3523           0 : #define BT_HCI_LE_CS_T_FCS_TIME_40US_MASK   BIT(3)
    3524           0 : #define BT_HCI_LE_CS_T_FCS_TIME_50US_MASK   BIT(4)
    3525           0 : #define BT_HCI_LE_CS_T_FCS_TIME_60US_MASK   BIT(5)
    3526           0 : #define BT_HCI_LE_CS_T_FCS_TIME_80US_MASK   BIT(6)
    3527           0 : #define BT_HCI_LE_CS_T_FCS_TIME_100US_MASK  BIT(7)
    3528           0 : #define BT_HCI_LE_CS_T_FCS_TIME_1200US_MASK BIT(8)
    3529             : 
    3530           0 : #define BT_HCI_LE_CS_T_PM_TIME_10US_MASK BIT(0)
    3531           0 : #define BT_HCI_LE_CS_T_PM_TIME_20US_MASK BIT(1)
    3532             : 
    3533           0 : #define BT_HCI_LE_CS_TX_SNR_CAPABILITY_18DB_MASK BIT(0)
    3534           0 : #define BT_HCI_LE_CS_TX_SNR_CAPABILITY_21DB_MASK BIT(1)
    3535           0 : #define BT_HCI_LE_CS_TX_SNR_CAPABILITY_24DB_MASK BIT(2)
    3536           0 : #define BT_HCI_LE_CS_TX_SNR_CAPABILITY_27DB_MASK BIT(3)
    3537           0 : #define BT_HCI_LE_CS_TX_SNR_CAPABILITY_30DB_MASK BIT(4)
    3538             : 
    3539           0 : #define BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE 0x2C
    3540           0 : struct bt_hci_evt_le_cs_read_remote_supported_capabilities_complete {
    3541           0 :         uint8_t  status;
    3542           0 :         uint16_t conn_handle;
    3543           0 :         uint8_t  num_config_supported;
    3544           0 :         uint16_t max_consecutive_procedures_supported;
    3545           0 :         uint8_t  num_antennas_supported;
    3546           0 :         uint8_t  max_antenna_paths_supported;
    3547           0 :         uint8_t  roles_supported;
    3548           0 :         uint8_t  modes_supported;
    3549           0 :         uint8_t  rtt_capability;
    3550           0 :         uint8_t  rtt_aa_only_n;
    3551           0 :         uint8_t  rtt_sounding_n;
    3552           0 :         uint8_t  rtt_random_payload_n;
    3553           0 :         uint16_t nadm_sounding_capability;
    3554           0 :         uint16_t nadm_random_capability;
    3555           0 :         uint8_t  cs_sync_phys_supported;
    3556           0 :         uint16_t subfeatures_supported;
    3557           0 :         uint16_t t_ip1_times_supported;
    3558           0 :         uint16_t t_ip2_times_supported;
    3559           0 :         uint16_t t_fcs_times_supported;
    3560           0 :         uint16_t t_pm_times_supported;
    3561           0 :         uint8_t  t_sw_time_supported;
    3562           0 :         uint8_t  tx_snr_capability;
    3563             : } __packed;
    3564             : 
    3565           0 : #define BT_HCI_EVT_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE 0x2D
    3566           0 : struct bt_hci_evt_le_cs_read_remote_fae_table_complete {
    3567           0 :         uint8_t  status;
    3568           0 :         uint16_t conn_handle;
    3569           0 :         int8_t   remote_fae_table[72];
    3570             : } __packed;
    3571             : 
    3572           0 : #define BT_HCI_LE_CS_CONFIG_ACTION_REMOVED 0x00
    3573           0 : #define BT_HCI_LE_CS_CONFIG_ACTION_CREATED 0x01
    3574             : 
    3575           0 : #define BT_HCI_EVT_LE_CS_SECURITY_ENABLE_COMPLETE 0x2E
    3576           0 : struct bt_hci_evt_le_cs_security_enable_complete {
    3577           0 :         uint8_t  status;
    3578           0 :         uint16_t handle;
    3579             : } __packed;
    3580             : 
    3581           0 : #define BT_HCI_EVT_LE_CS_CONFIG_COMPLETE 0x2F
    3582           0 : struct bt_hci_evt_le_cs_config_complete {
    3583           0 :         uint8_t  status;
    3584           0 :         uint16_t handle;
    3585           0 :         uint8_t  config_id;
    3586           0 :         uint8_t  action;
    3587           0 :         uint8_t  main_mode_type;
    3588           0 :         uint8_t  sub_mode_type;
    3589           0 :         uint8_t  min_main_mode_steps;
    3590           0 :         uint8_t  max_main_mode_steps;
    3591           0 :         uint8_t  main_mode_repetition;
    3592           0 :         uint8_t  mode_0_steps;
    3593           0 :         uint8_t  role;
    3594           0 :         uint8_t  rtt_type;
    3595           0 :         uint8_t  cs_sync_phy;
    3596           0 :         uint8_t  channel_map[10];
    3597           0 :         uint8_t  channel_map_repetition;
    3598           0 :         uint8_t  channel_selection_type;
    3599           0 :         uint8_t  ch3c_shape;
    3600           0 :         uint8_t  ch3c_jump;
    3601           0 :         uint8_t  reserved;
    3602           0 :         uint8_t  t_ip1_time;
    3603           0 :         uint8_t  t_ip2_time;
    3604           0 :         uint8_t  t_fcs_time;
    3605           0 :         uint8_t  t_pm_time;
    3606             : } __packed;
    3607             : 
    3608           0 : #define BT_HCI_LE_CS_TEST_CONN_HANDLE 0x0FFF
    3609             : 
    3610           0 : #define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_COMPLETE 0x0
    3611           0 : #define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL  0x1
    3612           0 : #define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_ABORTED  0xF
    3613             : 
    3614           0 : #define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_COMPLETE 0x0
    3615           0 : #define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL  0x1
    3616           0 : #define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED  0xF
    3617             : 
    3618           0 : #define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_NO_ABORT                     0x0
    3619           0 : #define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST 0x1
    3620           0 : #define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_TOO_FEW_CHANNELS             0x2
    3621           0 : #define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_CHMAP_INSTANT_PASSED         0x3
    3622           0 : #define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_UNSPECIFIED                  0xF
    3623             : 
    3624           0 : #define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_ABORT                     0x0
    3625           0 : #define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST 0x1
    3626           0 : #define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_CS_SYNC_RECEIVED          0x2
    3627           0 : #define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_SCHED_CONFLICT               0x3
    3628           0 : #define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_UNSPECIFIED                  0xF
    3629             : 
    3630           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_IGNORED 0x00
    3631           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_1       0x01
    3632           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_2       0x02
    3633           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_3       0x03
    3634           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_4       0x04
    3635             : 
    3636           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_FREQ_COMPENSATION_NOT_AVAILABLE 0xC000
    3637             : 
    3638           0 : #define BT_HCI_LE_CS_SUBEVENT_RESULT_PCT_NOT_AVAILABLE 0xFFFFFFFF
    3639             : 
    3640           0 : #define BT_HCI_LE_CS_REF_POWER_LEVEL_UNAVAILABLE 0x7F
    3641             : 
    3642           0 : #define BT_HCI_LE_CS_PCT_I_MASK 0x000FFF
    3643           0 : #define BT_HCI_LE_CS_PCT_Q_MASK 0xFFF000
    3644             : 
    3645           0 : #define BT_HCI_LE_CS_TONE_QUALITY_HIGH        0x0
    3646           0 : #define BT_HCI_LE_CS_TONE_QUALITY_MED         0x1
    3647           0 : #define BT_HCI_LE_CS_TONE_QUALITY_LOW         0x2
    3648           0 : #define BT_HCI_LE_CS_TONE_QUALITY_UNAVAILABLE 0x3
    3649             : 
    3650           0 : #define BT_HCI_LE_CS_NOT_TONE_EXT_SLOT              0x0
    3651           0 : #define BT_HCI_LE_CS_TONE_EXT_SLOT_EXT_NOT_EXPECTED 0x1
    3652           0 : #define BT_HCI_LE_CS_TONE_EXT_SLOT_EXT_EXPECTED     0x2
    3653             : 
    3654           0 : #define BT_HCI_LE_CS_TIME_DIFFERENCE_NOT_AVAILABLE ((int16_t)0x8000)
    3655             : 
    3656           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_EXT_UNLIKELY  0x00
    3657           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_VERY_UNLIKELY 0x01
    3658           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_UNLIKELY      0x02
    3659           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_POSSIBLE      0x03
    3660           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_LIKELY        0x04
    3661           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_VERY_LIKELY   0x05
    3662           0 : #define BT_HCI_LE_CS_PACKET_NADM_ATTACK_EXT_LIKELY    0x06
    3663           0 : #define BT_HCI_LE_CS_PACKET_NADM_UNKNOWN              0xFF
    3664             : 
    3665           0 : #define BT_HCI_LE_CS_PACKET_QUALITY_AA_CHECK_SUCCESSFUL       0x0
    3666           0 : #define BT_HCI_LE_CS_PACKET_QUALITY_AA_CHECK_BIT_ERRORS_FOUND 0x1
    3667           0 : #define BT_HCI_LE_CS_PACKET_QUALITY_AA_CHECK_AA_NOT_FOUND     0x2
    3668             : 
    3669           0 : #define BT_HCI_LE_CS_PACKET_RSSI_NOT_AVAILABLE 0x7F
    3670             : 
    3671           0 : #define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT 0x31
    3672             : /** Subevent result step data format: Mode 0 Initiator  */
    3673           1 : struct bt_hci_le_cs_step_data_mode_0_initiator {
    3674             : #ifdef CONFIG_LITTLE_ENDIAN
    3675             :         uint8_t  packet_quality_aa_check: 4;
    3676             :         uint8_t  packet_quality_bit_errors: 4;
    3677             : #else
    3678           0 :         uint8_t  packet_quality_bit_errors: 4;
    3679           0 :         uint8_t  packet_quality_aa_check: 4;
    3680             : #endif /* CONFIG_LITTLE_ENDIAN */
    3681           0 :         uint8_t  packet_rssi;
    3682           0 :         uint8_t  packet_antenna;
    3683           0 :         uint16_t measured_freq_offset;
    3684             : } __packed;
    3685             : 
    3686             : /** Subevent result step data format: Mode 0 Reflector  */
    3687           1 : struct bt_hci_le_cs_step_data_mode_0_reflector {
    3688             : #ifdef CONFIG_LITTLE_ENDIAN
    3689             :         uint8_t packet_quality_aa_check: 4;
    3690             :         uint8_t packet_quality_bit_errors: 4;
    3691             : #else
    3692           0 :         uint8_t packet_quality_bit_errors: 4;
    3693           0 :         uint8_t packet_quality_aa_check: 4;
    3694             : #endif /* CONFIG_LITTLE_ENDIAN */
    3695           0 :         uint8_t packet_rssi;
    3696           0 :         uint8_t packet_antenna;
    3697             : } __packed;
    3698             : 
    3699             : /** Subevent result step data format: Mode 1  */
    3700           1 : struct bt_hci_le_cs_step_data_mode_1 {
    3701             : #ifdef CONFIG_LITTLE_ENDIAN
    3702             :         uint8_t packet_quality_aa_check: 4;
    3703             :         uint8_t packet_quality_bit_errors: 4;
    3704             : #else
    3705           0 :         uint8_t packet_quality_bit_errors: 4;
    3706           0 :         uint8_t packet_quality_aa_check: 4;
    3707             : #endif /* CONFIG_LITTLE_ENDIAN */
    3708           0 :         uint8_t packet_nadm;
    3709           0 :         uint8_t packet_rssi;
    3710             :         union {
    3711           0 :                 int16_t toa_tod_initiator;
    3712           0 :                 int16_t tod_toa_reflector;
    3713           0 :         };
    3714           0 :         uint8_t packet_antenna;
    3715             : } __packed;
    3716             : 
    3717             : /** Subevent result step data format: Mode 1 with sounding sequence RTT support */
    3718           1 : struct bt_hci_le_cs_step_data_mode_1_ss_rtt {
    3719             : #ifdef CONFIG_LITTLE_ENDIAN
    3720             :         uint8_t packet_quality_aa_check: 4;
    3721             :         uint8_t packet_quality_bit_errors: 4;
    3722             : #else
    3723           0 :         uint8_t packet_quality_bit_errors: 4;
    3724           0 :         uint8_t packet_quality_aa_check: 4;
    3725             : #endif /* CONFIG_LITTLE_ENDIAN */
    3726           0 :         uint8_t packet_nadm;
    3727           0 :         uint8_t packet_rssi;
    3728             :         union {
    3729           0 :                 int16_t toa_tod_initiator;
    3730           0 :                 int16_t tod_toa_reflector;
    3731           0 :         };
    3732           0 :         uint8_t packet_antenna;
    3733           0 :         uint8_t packet_pct1[4];
    3734           0 :         uint8_t packet_pct2[4];
    3735             : } __packed;
    3736             : 
    3737             : 
    3738             : /** Format for per-antenna path step data in modes 2 and 3 */
    3739           1 : struct bt_hci_le_cs_step_data_tone_info {
    3740           0 :         uint8_t phase_correction_term[3];
    3741             : #ifdef CONFIG_LITTLE_ENDIAN
    3742             :         uint8_t quality_indicator: 4;
    3743             :         uint8_t extension_indicator: 4;
    3744             : #else
    3745           0 :         uint8_t extension_indicator: 4;
    3746           0 :         uint8_t quality_indicator: 4;
    3747             : #endif /* CONFIG_LITTLE_ENDIAN */
    3748             : } __packed;
    3749             : 
    3750             : /** Subevent result step data format: Mode 2 */
    3751           1 : struct bt_hci_le_cs_step_data_mode_2 {
    3752           0 :         uint8_t antenna_permutation_index;
    3753           0 :         struct bt_hci_le_cs_step_data_tone_info tone_info[];
    3754             : } __packed;
    3755             : 
    3756             : /** Subevent result step data format: Mode 3 */
    3757           1 : struct bt_hci_le_cs_step_data_mode_3 {
    3758             : #ifdef CONFIG_LITTLE_ENDIAN
    3759             :         uint8_t packet_quality_aa_check: 4;
    3760             :         uint8_t packet_quality_bit_errors: 4;
    3761             : #else
    3762           0 :         uint8_t packet_quality_bit_errors: 4;
    3763           0 :         uint8_t packet_quality_aa_check: 4;
    3764             : #endif /* CONFIG_LITTLE_ENDIAN */
    3765           0 :         uint8_t packet_nadm;
    3766           0 :         uint8_t packet_rssi;
    3767             :         union {
    3768           0 :                 int16_t toa_tod_initiator;
    3769           0 :                 int16_t tod_toa_reflector;
    3770           0 :         };
    3771           0 :         uint8_t packet_antenna;
    3772           0 :         uint8_t antenna_permutation_index;
    3773           0 :         struct bt_hci_le_cs_step_data_tone_info tone_info[];
    3774             : } __packed;
    3775             : 
    3776             : /** Subevent result step data format: Mode 3 with sounding sequence RTT support */
    3777           1 : struct bt_hci_le_cs_step_data_mode_3_ss_rtt {
    3778             : #ifdef CONFIG_LITTLE_ENDIAN
    3779             :         uint8_t packet_quality_aa_check: 4;
    3780             :         uint8_t packet_quality_bit_errors: 4;
    3781             : #else
    3782           0 :         uint8_t packet_quality_bit_errors: 4;
    3783           0 :         uint8_t packet_quality_aa_check: 4;
    3784             : #endif /* CONFIG_LITTLE_ENDIAN */
    3785           0 :         uint8_t packet_nadm;
    3786           0 :         uint8_t packet_rssi;
    3787             :         union {
    3788           0 :                 int16_t toa_tod_initiator;
    3789           0 :                 int16_t tod_toa_reflector;
    3790           0 :         };
    3791           0 :         uint8_t packet_antenna;
    3792           0 :         uint8_t packet_pct1[4];
    3793           0 :         uint8_t packet_pct2[4];
    3794           0 :         uint8_t antenna_permutation_index;
    3795           0 :         struct bt_hci_le_cs_step_data_tone_info tone_info[];
    3796             : } __packed;
    3797             : 
    3798           0 : struct bt_hci_evt_le_cs_subevent_result_step {
    3799           0 :         uint8_t step_mode;
    3800           0 :         uint8_t step_channel;
    3801           0 :         uint8_t step_data_length;
    3802           0 :         uint8_t step_data[];
    3803             : } __packed;
    3804             : 
    3805           0 : struct bt_hci_evt_le_cs_subevent_result {
    3806           0 :         uint16_t conn_handle;
    3807           0 :         uint8_t  config_id;
    3808           0 :         uint16_t start_acl_conn_event_counter;
    3809           0 :         uint16_t procedure_counter;
    3810           0 :         uint16_t frequency_compensation;
    3811           0 :         uint8_t  reference_power_level;
    3812           0 :         uint8_t  procedure_done_status;
    3813           0 :         uint8_t  subevent_done_status;
    3814             : #ifdef CONFIG_LITTLE_ENDIAN
    3815             :         uint8_t  procedure_abort_reason: 4;
    3816             :         uint8_t  subevent_abort_reason: 4;
    3817             : #else
    3818           0 :         uint8_t  subevent_abort_reason: 4;
    3819           0 :         uint8_t  procedure_abort_reason: 4;
    3820             : #endif /* CONFIG_LITTLE_ENDIAN */
    3821           0 :         uint8_t  num_antenna_paths;
    3822           0 :         uint8_t  num_steps_reported;
    3823           0 :         uint8_t  steps[];
    3824             : } __packed;
    3825             : 
    3826           0 : #define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT_CONTINUE 0x32
    3827             : 
    3828           0 : struct bt_hci_evt_le_cs_subevent_result_continue {
    3829           0 :         uint16_t conn_handle;
    3830           0 :         uint8_t  config_id;
    3831           0 :         uint8_t  procedure_done_status;
    3832           0 :         uint8_t  subevent_done_status;
    3833             : #ifdef CONFIG_LITTLE_ENDIAN
    3834             :         uint8_t  procedure_abort_reason: 4;
    3835             :         uint8_t  subevent_abort_reason: 4;
    3836             : #else
    3837           0 :         uint8_t  subevent_abort_reason: 4;
    3838           0 :         uint8_t  procedure_abort_reason: 4;
    3839             : #endif /* CONFIG_LITTLE_ENDIAN */
    3840           0 :         uint8_t  num_antenna_paths;
    3841           0 :         uint8_t  num_steps_reported;
    3842           0 :         uint8_t  steps[];
    3843             : } __packed;
    3844             : 
    3845           0 : #define BT_HCI_EVT_LE_CS_TEST_END_COMPLETE 0x33
    3846           0 : struct bt_hci_evt_le_cs_test_end_complete {
    3847           0 :         uint8_t status;
    3848             : } __packed;
    3849             : 
    3850           0 : #define BT_HCI_EVT_LE_CS_PROCEDURE_ENABLE_COMPLETE 0x30
    3851           0 : struct bt_hci_evt_le_cs_procedure_enable_complete {
    3852           0 :         uint8_t  status;
    3853           0 :         uint16_t handle;
    3854           0 :         uint8_t  config_id;
    3855           0 :         uint8_t  state;
    3856           0 :         uint8_t  tone_antenna_config_selection;
    3857           0 :         uint8_t  selected_tx_power;
    3858           0 :         uint8_t  subevent_len[3];
    3859           0 :         uint8_t  subevents_per_event;
    3860           0 :         uint16_t subevent_interval;
    3861           0 :         uint16_t event_interval;
    3862           0 :         uint16_t procedure_interval;
    3863           0 :         uint16_t procedure_count;
    3864           0 :         uint16_t max_procedure_len;
    3865             : } __packed;
    3866             : 
    3867             : /* Event mask bits */
    3868             : 
    3869           0 : #define BT_EVT_BIT(n) (1ULL << (n))
    3870             : 
    3871           0 : #define BT_EVT_MASK_INQUIRY_COMPLETE             BT_EVT_BIT(0)
    3872           0 : #define BT_EVT_MASK_CONN_COMPLETE                BT_EVT_BIT(2)
    3873           0 : #define BT_EVT_MASK_CONN_REQUEST                 BT_EVT_BIT(3)
    3874           0 : #define BT_EVT_MASK_DISCONN_COMPLETE             BT_EVT_BIT(4)
    3875           0 : #define BT_EVT_MASK_AUTH_COMPLETE                BT_EVT_BIT(5)
    3876           0 : #define BT_EVT_MASK_REMOTE_NAME_REQ_COMPLETE     BT_EVT_BIT(6)
    3877           0 : #define BT_EVT_MASK_ENCRYPT_CHANGE               BT_EVT_BIT(7)
    3878           0 : #define BT_EVT_MASK_REMOTE_FEATURES              BT_EVT_BIT(10)
    3879           0 : #define BT_EVT_MASK_REMOTE_VERSION_INFO          BT_EVT_BIT(11)
    3880           0 : #define BT_EVT_MASK_HARDWARE_ERROR               BT_EVT_BIT(15)
    3881           0 : #define BT_EVT_MASK_ROLE_CHANGE                  BT_EVT_BIT(17)
    3882           0 : #define BT_EVT_MASK_PIN_CODE_REQ                 BT_EVT_BIT(21)
    3883           0 : #define BT_EVT_MASK_LINK_KEY_REQ                 BT_EVT_BIT(22)
    3884           0 : #define BT_EVT_MASK_LINK_KEY_NOTIFY              BT_EVT_BIT(23)
    3885           0 : #define BT_EVT_MASK_DATA_BUFFER_OVERFLOW         BT_EVT_BIT(25)
    3886           0 : #define BT_EVT_MASK_INQUIRY_RESULT_WITH_RSSI     BT_EVT_BIT(33)
    3887           0 : #define BT_EVT_MASK_REMOTE_EXT_FEATURES          BT_EVT_BIT(34)
    3888           0 : #define BT_EVT_MASK_SYNC_CONN_COMPLETE           BT_EVT_BIT(43)
    3889           0 : #define BT_EVT_MASK_EXTENDED_INQUIRY_RESULT      BT_EVT_BIT(46)
    3890           0 : #define BT_EVT_MASK_ENCRYPT_KEY_REFRESH_COMPLETE BT_EVT_BIT(47)
    3891           0 : #define BT_EVT_MASK_IO_CAPA_REQ                  BT_EVT_BIT(48)
    3892           0 : #define BT_EVT_MASK_IO_CAPA_RESP                 BT_EVT_BIT(49)
    3893           0 : #define BT_EVT_MASK_USER_CONFIRM_REQ             BT_EVT_BIT(50)
    3894           0 : #define BT_EVT_MASK_USER_PASSKEY_REQ             BT_EVT_BIT(51)
    3895           0 : #define BT_EVT_MASK_SSP_COMPLETE                 BT_EVT_BIT(53)
    3896           0 : #define BT_EVT_MASK_USER_PASSKEY_NOTIFY          BT_EVT_BIT(58)
    3897           0 : #define BT_EVT_MASK_LE_META_EVENT                BT_EVT_BIT(61)
    3898             : 
    3899             : /* Page 2 */
    3900           0 : #define BT_EVT_MASK_NUM_COMPLETE_DATA_BLOCKS     BT_EVT_BIT(8)
    3901           0 : #define BT_EVT_MASK_TRIGG_CLOCK_CAPTURE          BT_EVT_BIT(14)
    3902           0 : #define BT_EVT_MASK_SYNCH_TRAIN_COMPLETE         BT_EVT_BIT(15)
    3903           0 : #define BT_EVT_MASK_SYNCH_TRAIN_RX               BT_EVT_BIT(16)
    3904           0 : #define BT_EVT_MASK_CL_PER_BC_RX                 BT_EVT_BIT(17)
    3905           0 : #define BT_EVT_MASK_CL_PER_BC_TIMEOUT            BT_EVT_BIT(18)
    3906           0 : #define BT_EVT_MASK_TRUNC_PAGE_COMPLETE          BT_EVT_BIT(19)
    3907           0 : #define BT_EVT_MASK_PER_PAGE_RSP_TIMEOUT         BT_EVT_BIT(20)
    3908           0 : #define BT_EVT_MASK_CL_PER_BC_CH_MAP_CHANGE      BT_EVT_BIT(21)
    3909           0 : #define BT_EVT_MASK_INQUIRY_RSP_NOT              BT_EVT_BIT(22)
    3910           0 : #define BT_EVT_MASK_AUTH_PAYLOAD_TIMEOUT_EXP     BT_EVT_BIT(23)
    3911           0 : #define BT_EVT_MASK_SAM_STATUS_CHANGE            BT_EVT_BIT(24)
    3912             : 
    3913           0 : #define BT_EVT_MASK_LE_CONN_COMPLETE             BT_EVT_BIT(0)
    3914           0 : #define BT_EVT_MASK_LE_ADVERTISING_REPORT        BT_EVT_BIT(1)
    3915           0 : #define BT_EVT_MASK_LE_CONN_UPDATE_COMPLETE      BT_EVT_BIT(2)
    3916           0 : #define BT_EVT_MASK_LE_REMOTE_FEAT_COMPLETE      BT_EVT_BIT(3)
    3917           0 : #define BT_EVT_MASK_LE_LTK_REQUEST               BT_EVT_BIT(4)
    3918           0 : #define BT_EVT_MASK_LE_CONN_PARAM_REQ            BT_EVT_BIT(5)
    3919           0 : #define BT_EVT_MASK_LE_DATA_LEN_CHANGE           BT_EVT_BIT(6)
    3920           0 : #define BT_EVT_MASK_LE_P256_PUBLIC_KEY_COMPLETE  BT_EVT_BIT(7)
    3921           0 : #define BT_EVT_MASK_LE_GENERATE_DHKEY_COMPLETE   BT_EVT_BIT(8)
    3922           0 : #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE         BT_EVT_BIT(9)
    3923           0 : #define BT_EVT_MASK_LE_DIRECT_ADV_REPORT         BT_EVT_BIT(10)
    3924           0 : #define BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE       BT_EVT_BIT(11)
    3925           0 : #define BT_EVT_MASK_LE_EXT_ADVERTISING_REPORT    BT_EVT_BIT(12)
    3926           0 : #define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED  BT_EVT_BIT(13)
    3927           0 : #define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT    BT_EVT_BIT(14)
    3928           0 : #define BT_EVT_MASK_LE_PER_ADV_SYNC_LOST         BT_EVT_BIT(15)
    3929           0 : #define BT_EVT_MASK_LE_SCAN_TIMEOUT              BT_EVT_BIT(16)
    3930           0 : #define BT_EVT_MASK_LE_ADV_SET_TERMINATED        BT_EVT_BIT(17)
    3931           0 : #define BT_EVT_MASK_LE_SCAN_REQ_RECEIVED         BT_EVT_BIT(18)
    3932           0 : #define BT_EVT_MASK_LE_CHAN_SEL_ALGO             BT_EVT_BIT(19)
    3933           0 : #define BT_EVT_MASK_LE_CONNECTIONLESS_IQ_REPORT  BT_EVT_BIT(20)
    3934           0 : #define BT_EVT_MASK_LE_CONNECTION_IQ_REPORT      BT_EVT_BIT(21)
    3935           0 : #define BT_EVT_MASK_LE_CTE_REQUEST_FAILED        BT_EVT_BIT(22)
    3936           0 : #define BT_EVT_MASK_LE_PAST_RECEIVED             BT_EVT_BIT(23)
    3937           0 : #define BT_EVT_MASK_LE_CIS_ESTABLISHED           BT_EVT_BIT(24)
    3938           0 : #define BT_EVT_MASK_LE_CIS_REQ                   BT_EVT_BIT(25)
    3939           0 : #define BT_EVT_MASK_LE_BIG_COMPLETE              BT_EVT_BIT(26)
    3940           0 : #define BT_EVT_MASK_LE_BIG_TERMINATED            BT_EVT_BIT(27)
    3941           0 : #define BT_EVT_MASK_LE_BIG_SYNC_ESTABLISHED      BT_EVT_BIT(28)
    3942           0 : #define BT_EVT_MASK_LE_BIG_SYNC_LOST             BT_EVT_BIT(29)
    3943           0 : #define BT_EVT_MASK_LE_REQ_PEER_SCA_COMPLETE     BT_EVT_BIT(30)
    3944           0 : #define BT_EVT_MASK_LE_PATH_LOSS_THRESHOLD       BT_EVT_BIT(31)
    3945           0 : #define BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING  BT_EVT_BIT(32)
    3946           0 : #define BT_EVT_MASK_LE_BIGINFO_ADV_REPORT        BT_EVT_BIT(33)
    3947           0 : #define BT_EVT_MASK_LE_SUBRATE_CHANGE            BT_EVT_BIT(34)
    3948             : 
    3949           0 : #define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED_V2 BT_EVT_BIT(35)
    3950           0 : #define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT_V2   BT_EVT_BIT(36)
    3951           0 : #define BT_EVT_MASK_LE_PAST_RECEIVED_V2            BT_EVT_BIT(37)
    3952           0 : #define BT_EVT_MASK_LE_PER_ADV_SUBEVENT_DATA_REQ   BT_EVT_BIT(38)
    3953           0 : #define BT_EVT_MASK_LE_PER_ADV_RESPONSE_REPORT     BT_EVT_BIT(39)
    3954           0 : #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE_V2        BT_EVT_BIT(40)
    3955           0 : #define BT_EVT_MASK_LE_CIS_ESTABLISHED_V2          BT_EVT_BIT(41)
    3956             : 
    3957           0 : #define BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE BT_EVT_BIT(43)
    3958           0 : #define BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE              BT_EVT_BIT(44)
    3959           0 : #define BT_EVT_MASK_LE_CS_SECURITY_ENABLE_COMPLETE                    BT_EVT_BIT(45)
    3960           0 : #define BT_EVT_MASK_LE_CS_CONFIG_COMPLETE                             BT_EVT_BIT(46)
    3961           0 : #define BT_EVT_MASK_LE_CS_PROCEDURE_ENABLE_COMPLETE                   BT_EVT_BIT(47)
    3962           0 : #define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT                             BT_EVT_BIT(48)
    3963           0 : #define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT_CONTINUE                    BT_EVT_BIT(49)
    3964           0 : #define BT_EVT_MASK_LE_CS_TEST_END_COMPLETE                           BT_EVT_BIT(50)
    3965             : 
    3966             : /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */
    3967           1 : #define BT_HCI_ERR_SUCCESS                      0x00
    3968           0 : #define BT_HCI_ERR_UNKNOWN_CMD                  0x01
    3969           0 : #define BT_HCI_ERR_UNKNOWN_CONN_ID              0x02
    3970           0 : #define BT_HCI_ERR_HW_FAILURE                   0x03
    3971           0 : #define BT_HCI_ERR_PAGE_TIMEOUT                 0x04
    3972           0 : #define BT_HCI_ERR_AUTH_FAIL                    0x05
    3973           0 : #define BT_HCI_ERR_PIN_OR_KEY_MISSING           0x06
    3974           0 : #define BT_HCI_ERR_MEM_CAPACITY_EXCEEDED        0x07
    3975           0 : #define BT_HCI_ERR_CONN_TIMEOUT                 0x08
    3976           0 : #define BT_HCI_ERR_CONN_LIMIT_EXCEEDED          0x09
    3977           0 : #define BT_HCI_ERR_SYNC_CONN_LIMIT_EXCEEDED     0x0a
    3978           0 : #define BT_HCI_ERR_CONN_ALREADY_EXISTS          0x0b
    3979           0 : #define BT_HCI_ERR_CMD_DISALLOWED               0x0c
    3980           0 : #define BT_HCI_ERR_INSUFFICIENT_RESOURCES       0x0d
    3981           0 : #define BT_HCI_ERR_INSUFFICIENT_SECURITY        0x0e
    3982           0 : #define BT_HCI_ERR_BD_ADDR_UNACCEPTABLE         0x0f
    3983           0 : #define BT_HCI_ERR_CONN_ACCEPT_TIMEOUT          0x10
    3984           0 : #define BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL     0x11
    3985           0 : #define BT_HCI_ERR_INVALID_PARAM                0x12
    3986           0 : #define BT_HCI_ERR_REMOTE_USER_TERM_CONN        0x13
    3987           0 : #define BT_HCI_ERR_REMOTE_LOW_RESOURCES         0x14
    3988           0 : #define BT_HCI_ERR_REMOTE_POWER_OFF             0x15
    3989           0 : #define BT_HCI_ERR_LOCALHOST_TERM_CONN          0x16
    3990           0 : #define BT_HCI_ERR_REPEATED_ATTEMPTS            0x17
    3991           0 : #define BT_HCI_ERR_PAIRING_NOT_ALLOWED          0x18
    3992           0 : #define BT_HCI_ERR_UNKNOWN_LMP_PDU              0x19
    3993           0 : #define BT_HCI_ERR_UNSUPP_REMOTE_FEATURE        0x1a
    3994           0 : #define BT_HCI_ERR_SCO_OFFSET_REJECTED          0x1b
    3995           0 : #define BT_HCI_ERR_SCO_INTERVAL_REJECTED        0x1c
    3996           0 : #define BT_HCI_ERR_SCO_AIR_MODE_REJECTED        0x1d
    3997           0 : #define BT_HCI_ERR_INVALID_LL_PARAM             0x1e
    3998           0 : #define BT_HCI_ERR_UNSPECIFIED                  0x1f
    3999           0 : #define BT_HCI_ERR_UNSUPP_LL_PARAM_VAL          0x20
    4000           0 : #define BT_HCI_ERR_ROLE_CHANGE_NOT_ALLOWED      0x21
    4001           0 : #define BT_HCI_ERR_LL_RESP_TIMEOUT              0x22
    4002           0 : #define BT_HCI_ERR_LL_PROC_COLLISION            0x23
    4003           0 : #define BT_HCI_ERR_LMP_PDU_NOT_ALLOWED          0x24
    4004           0 : #define BT_HCI_ERR_ENC_MODE_NOT_ACCEPTABLE      0x25
    4005           0 : #define BT_HCI_ERR_LINK_KEY_CANNOT_BE_CHANGED   0x26
    4006           0 : #define BT_HCI_ERR_REQUESTED_QOS_NOT_SUPPORTED  0x27
    4007           0 : #define BT_HCI_ERR_INSTANT_PASSED               0x28
    4008           0 : #define BT_HCI_ERR_PAIRING_NOT_SUPPORTED        0x29
    4009           0 : #define BT_HCI_ERR_DIFF_TRANS_COLLISION         0x2a
    4010           0 : #define BT_HCI_ERR_QOS_UNACCEPTABLE_PARAM       0x2c
    4011           0 : #define BT_HCI_ERR_QOS_REJECTED                 0x2d
    4012           0 : #define BT_HCI_ERR_CHAN_ASSESS_NOT_SUPPORTED    0x2e
    4013           0 : #define BT_HCI_ERR_INSUFF_SECURITY              0x2f
    4014           0 : #define BT_HCI_ERR_PARAM_OUT_OF_MANDATORY_RANGE 0x30
    4015           0 : #define BT_HCI_ERR_ROLE_SWITCH_PENDING          0x32
    4016           0 : #define BT_HCI_ERR_RESERVED_SLOT_VIOLATION      0x34
    4017           0 : #define BT_HCI_ERR_ROLE_SWITCH_FAILED           0x35
    4018           0 : #define BT_HCI_ERR_EXT_INQ_RESP_TOO_LARGE       0x36
    4019           0 : #define BT_HCI_ERR_SIMPLE_PAIR_NOT_SUPP_BY_HOST 0x37
    4020           0 : #define BT_HCI_ERR_HOST_BUSY_PAIRING            0x38
    4021           0 : #define BT_HCI_ERR_CONN_REJECTED_DUE_TO_NO_CHAN 0x39
    4022           0 : #define BT_HCI_ERR_CONTROLLER_BUSY              0x3a
    4023           0 : #define BT_HCI_ERR_UNACCEPT_CONN_PARAM          0x3b
    4024           0 : #define BT_HCI_ERR_ADV_TIMEOUT                  0x3c
    4025           0 : #define BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL         0x3d
    4026           0 : #define BT_HCI_ERR_CONN_FAIL_TO_ESTAB           0x3e
    4027           0 : #define BT_HCI_ERR_MAC_CONN_FAILED              0x3f
    4028           0 : #define BT_HCI_ERR_CLOCK_ADJUST_REJECTED        0x40
    4029           0 : #define BT_HCI_ERR_SUBMAP_NOT_DEFINED           0x41
    4030           0 : #define BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER       0x42
    4031           0 : #define BT_HCI_ERR_LIMIT_REACHED                0x43
    4032           0 : #define BT_HCI_ERR_OP_CANCELLED_BY_HOST         0x44
    4033           0 : #define BT_HCI_ERR_PACKET_TOO_LONG              0x45
    4034           0 : #define BT_HCI_ERR_TOO_LATE                     0x46
    4035           0 : #define BT_HCI_ERR_TOO_EARLY                    0x47
    4036             : 
    4037             : #ifdef __cplusplus
    4038             : }
    4039             : #endif
    4040             : 
    4041             : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_ */

Generated by: LCOV version 1.14