1 /* 2 * Copyright (c) 2020 Nordic Semiconductor ASA 3 * Copyright (c) 2020 Demant 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 /* 9 * expected features on purpose defined here 10 * to keep implementation separate from test 11 */ 12 #if defined(CONFIG_BT_CTLR_LE_ENC) 13 #define FEAT_ENCODED 0x01 14 #else 15 #define FEAT_ENCODED 0x00 16 #endif 17 18 #if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ) 19 #define FEAT_PARAM_REQ 0x02 20 #else 21 #define FEAT_PARAM_REQ 0x00 22 #endif 23 24 #if defined(CONFIG_BT_CTLR_EXT_REJ_IND) 25 #define FEAT_EXT_REJ 0x04 26 #else 27 #define FEAT_EXT_REJ 0x00 28 #endif 29 30 #if defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) 31 #define FEAT_PERIPHERAL_FREQ 0x08 32 #else 33 #define FEAT_PERIPHERAL_FREQ 0x00 34 #endif 35 36 #if defined(CONFIG_BT_CTLR_LE_PING) 37 #define FEAT_PING 0x10 38 #else 39 #define FEAT_PING 0x00 40 #endif 41 42 #if defined(CONFIG_BT_CTLR_DATA_LENGTH_MAX) 43 #define FEAT_DLE 0x20 44 #else 45 #define FEAT_DLE 0x00 46 #endif 47 48 #if defined(CONFIG_BT_CTLR_PRIVACY) 49 #define FEAT_PRIVACY 0x40 50 #else 51 #define FEAT_PRIVACY 0x00 52 #endif 53 54 #if defined(CONFIG_BT_CTLR_EXT_SCAN_FP) 55 #define FEAT_EXT_SCAN 0x80 56 #else 57 #define FEAT_EXT_SCAN 0x00 58 #endif 59 60 #if defined(CONFIG_BT_CTLR_PHY_2M) 61 #define FEAT_PHY_2M 0x100 62 #else 63 #define FEAT_PHY_2M 0x00 64 #endif 65 66 #if defined(CONFIG_BT_CTLR_SMI_TX) 67 #define FEAT_SMI_TX 0x200 68 #else 69 #define FEAT_SMI_TX 0x00 70 #endif 71 72 #if defined(CONFIG_BT_CTLR_SMI_RX) 73 #define FEAT_SMI_RX 0x400 74 #else 75 #define FEAT_SMI_RX 0x00 76 #endif 77 78 #if defined(CONFIG_BT_CTLR_PHY_CODED) 79 #define FEAT_PHY_CODED 0x800 80 #else 81 #define FEAT_PHY_CODED 0x00 82 #endif 83 84 #if defined(CONFIG_MISSING) 85 #define FEAT_EXT_ADV 0x1000 86 #else 87 #define FEAT_EXT_ADV 0x00 88 #endif 89 90 #if defined(CONFIG_MISSING) 91 #define FEAT_PER_ADV 0x2000 92 #else 93 #define FEAT_PER_ADV 0x00 94 #endif 95 96 #if defined(CONFIG_BT_CTLR_CHAN_SEL_2) 97 #define FEAT_CHAN_SEL_ALGO2 0x4000 98 #else 99 #define FEAT_CHAN_SEL_ALGO2 0x00 100 #endif 101 102 #if defined(CONFIG_MISSING) 103 #define FEAT_PWR_CLASS1 0x8000 104 #else 105 #define FEAT_PWR_CLASS1 0x00 106 #endif 107 108 #if defined(CONFIG_BT_CTLR_MIN_USED_CHAN) 109 #define FEAT_MIN_CHANN 0x10000 110 #else 111 #define FEAT_MIN_CHANN 0x00 112 #endif 113 114 #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_REQ) 115 #define FEAT_CONNECTION_CTE_REQ 0x20000 116 #else 117 #define FEAT_CONNECTION_CTE_REQ 0x00 118 #endif 119 120 #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RSP) 121 #define FEAT_CONNECTION_CTE_RSP 0x40000 122 #else 123 #define FEAT_CONNECTION_CTE_RSP 0x00 124 #endif 125 126 #if defined(CONFIG_MISSING) 127 #define FEAT_CONNECTIONLESS_CTE_TX 0x80000 128 #else 129 #define FEAT_CONNECTIONLESS_CTE_TX 0x00 130 #endif 131 132 #if defined(CONFIG_MISSING) 133 #define FEAT_CONNECTIONLESS_CTE_RX 0x100000 134 #else 135 #define FEAT_CONNECTIONLESS_CTE_RX 0x00 136 #endif 137 138 #if defined(CONFIG_BT_CTLR_DF_ANT_SWITCH_TX) 139 #define FEAT_ANT_SWITCH_CTE_TX 0x200000 140 #else 141 #define FEAT_ANT_SWITCH_CTE_TX 0x00 142 #endif 143 144 #if defined(CONFIG_BT_CTLR_DF_ANT_SWITCH_RX) 145 #define FEAT_ANT_SWITCH_CTE_RX 0x400000 146 #else 147 #define FEAT_ANT_SWITCH_CTE_RX 0x00 148 #endif 149 150 #if defined(CONFIG_BT_CTLR_DF_CTE_RX) 151 #define FEAT_RX_CTE 0x800000 152 #else 153 #define FEAT_RX_CTE 0x00 154 #endif 155 156 #if defined(CONFIG_MISSING) 157 #define FEAT_PER_ADV_SYNC_TX 0x1000000 158 #else 159 #define FEAT_PER_ADV_SYNC_TX 0x00 160 #endif 161 162 #if defined(CONFIG_MISSING) 163 #define FEAT_PER_ADV_SYNC_RX 0x2000000 164 #else 165 #define FEAT_PER_ADV_SYNC_RX 0x00 166 #endif 167 168 #if defined(CONFIG_BT_CTLR_SCA_UPDATE) 169 #define FEAT_SLEEP_UPD 0x4000000 170 #else 171 #define FEAT_SLEEP_UPD 0x00 172 #endif 173 174 #if defined(CONFIG_MISSING) 175 #define FEAT_RPK_VALID 0x8000000 176 #else 177 #define FEAT_RPK_VALID 0x00 178 #endif 179 180 #if defined(CONFIG_BT_CTLR_CENTRAL_ISO) 181 #define FEAT_ISO_CENTRAL 0x10000000 182 #else 183 #define FEAT_ISO_CENTRAL 0x00 184 #endif 185 186 #if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) 187 #define FEAT_ISO_PERIPHERAL 0x20000000 188 #else 189 #define FEAT_ISO_PERIPHERAL 0x00 190 #endif 191 192 #if defined(CONFIG_MISSING) 193 #define FEAT_ISO_BROADCAST 0x40000000 194 #else 195 #define FEAT_ISO_BROADCAST 0x00 196 #endif 197 198 #if defined(CONFIG_MISSING) 199 #define FEAT_ISO_RECEIVER 0x80000000 200 #else 201 #define FEAT_ISO_RECEIVER 0x00 202 #endif 203 204 #if defined(CONFIG_MISSING) 205 #define FEAT_ISO_CHANNELS 0x100000000 206 #else 207 #define FEAT_ISO_CHANNELS 0x00 208 #endif 209 210 #if defined(CONFIG_MISSING) 211 #define FEAT_LE_PWR_REQ 0x200000000 212 #else 213 #define FEAT_LE_PWR_REQ 0x00 214 #endif 215 216 #if defined(CONFIG_MISSING) 217 #define FEAT_LE_PWR_IND 0x400000000 218 #else 219 #define FEAT_LE_PWR_IND 0x00 220 #endif 221 222 #if defined(CONFIG_MISSING) 223 #define FEAT_LE_PATH_LOSS 0x800000000 224 #else 225 #define FEAT_LE_PATH_LOSS 0x00 226 #endif 227 228 #define DEFAULT_FEATURE \ 229 (FEAT_ENCODED | FEAT_PARAM_REQ | FEAT_EXT_REJ | FEAT_PERIPHERAL_FREQ | FEAT_PING | \ 230 FEAT_DLE | FEAT_PRIVACY | FEAT_EXT_SCAN | FEAT_PHY_2M | FEAT_SMI_TX | FEAT_SMI_RX | \ 231 FEAT_PHY_CODED | FEAT_EXT_ADV | FEAT_PER_ADV | FEAT_CHAN_SEL_ALGO2 | FEAT_PWR_CLASS1 | \ 232 FEAT_MIN_CHANN | FEAT_CONNECTION_CTE_REQ | FEAT_CONNECTION_CTE_RSP | \ 233 FEAT_ANT_SWITCH_CTE_TX | FEAT_ANT_SWITCH_CTE_RX | FEAT_RX_CTE | FEAT_PER_ADV_SYNC_TX | \ 234 FEAT_PER_ADV_SYNC_RX | FEAT_SLEEP_UPD | FEAT_RPK_VALID | FEAT_ISO_CENTRAL | \ 235 FEAT_ISO_PERIPHERAL | FEAT_ISO_BROADCAST | FEAT_ISO_RECEIVER | FEAT_ISO_CHANNELS | \ 236 FEAT_LE_PWR_REQ | FEAT_LE_PWR_IND | FEAT_LE_PATH_LOSS) 237 238 /* 239 * The following two are defined as per 240 * Core Spec V5.3 Volume 6, Part B, chapter 4.6 241 */ 242 #define EXPECTED_FEAT_EXCH_VALID 0x000000EFF787CF2F 243 #define FEAT_FILTER_OCTET0 0xFFFFFFFFFFFFFF00 244 #define COMMON_FEAT_OCTET0(x) (FEAT_FILTER_OCTET0 | ((x) & ~FEAT_FILTER_OCTET0)) 245