1 /* 2 * Copyright (c) 2018-2019 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 feature_unmask_features(struct ll_conn * conn,uint64_t ll_feat_mask)7static inline void feature_unmask_features(struct ll_conn *conn, uint64_t ll_feat_mask) 8 { 9 conn->llcp.fex.features_used &= ~ll_feat_mask; 10 } 11 feature_le_encryption(struct ll_conn * conn)12static inline bool feature_le_encryption(struct ll_conn *conn) 13 { 14 #if defined(CONFIG_BT_CTLR_LE_ENC) 15 return (conn->llcp.fex.features_used & LL_FEAT_BIT_ENC) != 0; 16 #else 17 return 0; 18 #endif 19 } 20 feature_conn_param_req(struct ll_conn * conn)21static inline bool feature_conn_param_req(struct ll_conn *conn) 22 { 23 #if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ) 24 return (conn->llcp.fex.features_used & LL_FEAT_BIT_CONN_PARAM_REQ) != 0; 25 #else 26 return 0; 27 #endif 28 } 29 feature_ext_rej_ind(struct ll_conn * conn)30static inline bool feature_ext_rej_ind(struct ll_conn *conn) 31 { 32 #if defined(CONFIG_BT_CTLR_EXT_REJ_IND) 33 return (conn->llcp.fex.features_used & LL_FEAT_BIT_EXT_REJ_IND) != 0; 34 #else 35 return 0; 36 #endif 37 } 38 feature_periph_feat_req(struct ll_conn * conn)39static inline bool feature_periph_feat_req(struct ll_conn *conn) 40 { 41 #if defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) 42 return (conn->llcp.fex.features_used & LL_FEAT_BIT_PER_INIT_FEAT_XCHG) != 0; 43 #else 44 return 0; 45 #endif 46 } 47 feature_le_ping(struct ll_conn * conn)48static inline bool feature_le_ping(struct ll_conn *conn) 49 { 50 #if defined(CONFIG_BT_CTLR_LE_PING) 51 return (conn->llcp.fex.features_used & LL_FEAT_BIT_PING) != 0; 52 #else 53 return 0; 54 #endif 55 } 56 feature_dle(struct ll_conn * conn)57static inline bool feature_dle(struct ll_conn *conn) 58 { 59 #if defined(CONFIG_BT_CTLR_DATA_LENGTH) 60 return (conn->llcp.fex.features_used & LL_FEAT_BIT_DLE) != 0; 61 #else 62 return 0; 63 #endif 64 } 65 feature_privacy(struct ll_conn * conn)66static inline bool feature_privacy(struct ll_conn *conn) 67 { 68 #if defined(CONFIG_BT_CTLR_PRIVACY) 69 return (conn->llcp.fex.features_used & LL_FEAT_BIT_PRIVACY) != 0; 70 #else 71 return 0; 72 #endif 73 } 74 feature_ext_scan(struct ll_conn * conn)75static inline bool feature_ext_scan(struct ll_conn *conn) 76 { 77 #if defined(CONFIG_BT_CTLR_EXT_SCAN_FP) 78 return (conn->llcp.fex.features_used & LL_FEAT_BIT_EXT_SCAN) != 0; 79 #else 80 return 0; 81 #endif 82 } 83 feature_chan_sel_2(struct ll_conn * conn)84static inline bool feature_chan_sel_2(struct ll_conn *conn) 85 { 86 #if defined(CONFIG_BT_CTLR_CHAN_SEL_2) 87 return (conn->llcp.fex.features_used & LL_FEAT_BIT_CHAN_SEL_2) != 0; 88 #else 89 return 0; 90 #endif 91 } 92 feature_min_used_chan(struct ll_conn * conn)93static inline bool feature_min_used_chan(struct ll_conn *conn) 94 { 95 #if defined(CONFIG_BT_CTLR_MIN_USED_CHAN) 96 return (conn->llcp.fex.features_used & LL_FEAT_BIT_MIN_USED_CHAN) != 0; 97 #else 98 return 0; 99 #endif 100 } 101 feature_phy_2m(struct ll_conn * conn)102static inline bool feature_phy_2m(struct ll_conn *conn) 103 { 104 #if defined(CONFIG_BT_CTLR_PHY_2M) 105 return (conn->llcp.fex.features_used & LL_FEAT_BIT_PHY_2M) != 0; 106 #else 107 return 0; 108 #endif 109 } 110 feature_phy_coded(struct ll_conn * conn)111static inline bool feature_phy_coded(struct ll_conn *conn) 112 { 113 #if defined(CONFIG_BT_CTLR_PHY_CODED) 114 return (conn->llcp.fex.features_used & LL_FEAT_BIT_PHY_CODED) != 0; 115 #else 116 return 0; 117 #endif 118 } 119 feature_cte_req(struct ll_conn * conn)120static inline bool feature_cte_req(struct ll_conn *conn) 121 { 122 #if defined(CONFIG_BT_CTLR_DF) && defined(CONFIG_BT_CTLR_DF_CONN_CTE_REQ) 123 return (conn->llcp.fex.features_used & LL_FEAT_BIT_CONNECTION_CTE_REQ) != 0; 124 #else 125 return 0; 126 #endif 127 } 128 feature_sca(struct ll_conn * conn)129static inline bool feature_sca(struct ll_conn *conn) 130 { 131 #if defined(CONFIG_BT_CTLR_SCA_UPDATE) 132 return (conn->llcp.fex.features_used & LL_FEAT_BIT_SCA_UPDATE) != 0; 133 #else 134 return 0; 135 #endif 136 } 137 138 /* 139 * for asymmetric features we can check either if we support it 140 * or if the peer supports it 141 */ feature_smi_rx(void)142static inline bool feature_smi_rx(void) 143 { 144 return LL_FEAT_BIT_SMI_RX != 0; 145 } 146 feature_peer_smi_rx(struct ll_conn * conn)147static inline bool feature_peer_smi_rx(struct ll_conn *conn) 148 { 149 return (conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_SMI_RX)) != 0; 150 } 151 feature_smi_tx(void)152static inline bool feature_smi_tx(void) 153 { 154 return LL_FEAT_BIT_SMI_TX != 0; 155 } 156 feature_peer_smi_tx(struct ll_conn * conn)157static inline bool feature_peer_smi_tx(struct ll_conn *conn) 158 { 159 return (conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_SMI_TX)) != 0; 160 } 161 feature_peer_iso_central(struct ll_conn * conn)162static inline bool feature_peer_iso_central(struct ll_conn *conn) 163 { 164 return (conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_CIS_CENTRAL)) != 0; 165 } 166 feature_iso_central(struct ll_conn * conn)167static inline bool feature_iso_central(struct ll_conn *conn) 168 { 169 return LL_FEAT_BIT_CIS_CENTRAL != 0; 170 } 171 feature_peer_iso_peripheral(struct ll_conn * conn)172static inline bool feature_peer_iso_peripheral(struct ll_conn *conn) 173 { 174 return (conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_CIS_PERIPHERAL)) != 0; 175 } 176 feature_iso_peripheral(struct ll_conn * conn)177static inline bool feature_iso_peripheral(struct ll_conn *conn) 178 { 179 return LL_FEAT_BIT_CIS_PERIPHERAL != 0; 180 } 181 182 /* 183 * The following features are not yet defined in KConfig and do 184 * not have a bitfield defined in ll_feat.h 185 * ext_adv 186 * per_adv 187 * pwr_class1 188 * min_chann 189 * ant_sw_CTE_tx 190 * ant_sw_CTE_rx 191 * tone_ext 192 * per_adv_sync_tx 193 * per_adv_sync_rx 194 * rpk_valid 195 * iso_central 196 * iso_periph 197 * iso_broadcast 198 * iso_receiver 199 * iso_channels 200 * le_pwr_req 201 * le_pwr_ind 202 * le_path_loss 203 */ 204