1 /** 2 **************************************************************************************** 3 * 4 * @file rwble_hl_config.h 5 * 6 * @brief Configuration of the BLE protocol stack (max number of supported connections, 7 * type of partitioning, etc.) 8 * 9 * Copyright (C) RivieraWaves 2009-2016 10 * 11 * 12 **************************************************************************************** 13 */ 14 15 #ifndef RWBLE_HL_CONFIG_H_ 16 #define RWBLE_HL_CONFIG_H_ 17 18 /** 19 **************************************************************************************** 20 * @addtogroup ROOT 21 * @{ 22 * @name BLE stack configuration 23 * @{ 24 **************************************************************************************** 25 */ 26 27 #include "rwble_hl_error.h" 28 29 /******************************************************************************************/ 30 /* ------------------------- BLE PARTITIONING -------------------------------------*/ 31 /******************************************************************************************/ 32 33 34 /******************************************************************************************/ 35 /* -------------------------- INTERFACES ----------------------------------------*/ 36 /******************************************************************************************/ 37 38 39 #if BLE_APP_PRESENT 40 #define APP_MAIN_TASK TASK_APP 41 #else // BLE_APP_PRESENT 42 #define APP_MAIN_TASK TASK_AHI 43 #endif // BLE_APP_PRESENT 44 45 // Host Controller Interface (Host side) 46 #define BLEHL_HCIH_ITF HCIH_ITF 47 48 /******************************************************************************************/ 49 /* -------------------------- COEX SETUP ----------------------------------------*/ 50 /******************************************************************************************/ 51 52 ///WLAN coex 53 #define BLEHL_WLAN_COEX RW_WLAN_COEX 54 ///WLAN test mode 55 #define BLEHL_WLAN_COEX_TEST RW_WLAN_COEX_TEST 56 57 /******************************************************************************************/ 58 /* -------------------------- HOST MODULES ----------------------------------------*/ 59 /******************************************************************************************/ 60 61 #define BLE_GAPM 1 62 #if (BLE_CENTRAL || BLE_PERIPHERAL) 63 #define BLE_GAPC 1 64 #define BLE_GAPC_HEAP_ENV_SIZE (sizeof(struct gapc_env_tag) + KE_HEAP_MEM_RESERVED) 65 #else //(BLE_CENTRAL || BLE_PERIPHERAL) 66 #define BLE_GAPC 0 67 #define BLE_GAPC_HEAP_ENV_SIZE 0 68 #endif //(BLE_CENTRAL || BLE_PERIPHERAL) 69 70 #if (BLE_CENTRAL || BLE_PERIPHERAL) 71 #define BLE_L2CM 1 72 #define BLE_L2CC 1 73 #define BLE_ATTM 1 74 #define BLE_GATTM 1 75 #define BLE_GATTC 1 76 #define BLE_GATTC_HEAP_ENV_SIZE (sizeof(struct gattc_env_tag) + KE_HEAP_MEM_RESERVED) 77 #define BLE_L2CC_HEAP_ENV_SIZE (sizeof(struct l2cc_env_tag) + KE_HEAP_MEM_RESERVED) 78 #else //(BLE_CENTRAL || BLE_PERIPHERAL) 79 #define BLE_L2CM 0 80 #define BLE_L2CC 0 81 #define BLE_ATTC 0 82 #define BLE_ATTS 0 83 #define BLE_ATTM 0 84 #define BLE_GATTM 0 85 #define BLE_GATTC 0 86 #define BLE_GATTC_HEAP_ENV_SIZE 0 87 #define BLE_L2CC_HEAP_ENV_SIZE 0 88 #endif //(BLE_CENTRAL || BLE_PERIPHERAL) 89 90 #define BLE_SMPM 1 91 #if (BLE_CENTRAL || BLE_PERIPHERAL) 92 #define BLE_SMPC 1 93 #else //(BLE_CENTRAL || BLE_PERIPHERAL) 94 #define BLE_SMPC 0 95 #endif //(BLE_CENTRAL || BLE_PERIPHERAL) 96 97 98 /******************************************************************************************/ 99 /* -------------------------- ATT DB ----------------------------------------*/ 100 /******************************************************************************************/ 101 102 //ATT DB,Testing and Qualification related flags 103 #if (BLE_CENTRAL || BLE_PERIPHERAL) 104 /// Support of External DB Management 105 #if defined(CFG_EXT_DB) 106 #define BLE_EXT_ATT_DB 1 107 #else 108 #define BLE_EXT_ATT_DB 0 109 #endif // defined(CFG_EXT_DB) 110 #else 111 #define BLE_EXT_ATT_DB 0 112 #endif // (BLE_CENTRAL || BLE_PERIPHERAL) 113 /******************************************************************************************/ 114 /* -------------------------- PROFILES ----------------------------------------*/ 115 /******************************************************************************************/ 116 #ifdef CFG_PRF 117 #define BLE_PROFILES (1) 118 /// Number of Profile tasks managed by GAP manager. 119 #define BLE_NB_PROFILES (CFG_NB_PRF) 120 #include "rwprf_config.h" 121 #else 122 #define BLE_PROFILES (0) 123 #define BLE_NB_PROFILES (0) 124 #endif // CFG_PRF 125 126 127 #ifndef BLE_ATTS 128 #if (BLE_CENTRAL || BLE_PERIPHERAL || defined(CFG_ATTS)) 129 #define BLE_ATTS 1 130 #else 131 #define BLE_ATTS 0 132 #endif // (BLE_CENTRAL || BLE_PERIPHERAL || defined(CFG_ATTS)) 133 #endif // BLE_ATTS 134 135 136 #ifndef BLE_ATTC 137 #if (BLE_CENTRAL || defined(CFG_ATTC)) 138 #define BLE_ATTC 1 139 #else 140 #define BLE_ATTC 0 141 #endif // (BLE_CENTRAL || defined(CFG_ATTC)) 142 #endif // BLE_ATTC 143 144 #ifndef BLE_LECB 145 #if (BLE_CENTRAL || BLE_PERIPHERAL) 146 #define BLE_LECB 0//1 147 #else 148 #define BLE_LECB 0 149 #endif // (BLE_CENTRAL || defined(CFG_ATTC)) 150 #endif // BLE_ATTC 151 152 153 /// Attribute Server 154 #if (BLE_ATTS) 155 #define BLE_ATTS 1 156 #else 157 #define BLE_ATTS 0 158 #endif //(BLE_ATTS) 159 160 161 /// Size of the heap 162 #if (BLE_CENTRAL || BLE_PERIPHERAL) 163 /// some heap must be reserved for attribute database 164 #if (BLE_ATTS || BLE_ATTC) 165 #define BLEHL_HEAP_DB_SIZE 512//(1024)// (3072) by bottle 166 #else 167 #define BLEHL_HEAP_DB_SIZE (0) 168 #endif /* (BLE_ATTS || BLE_ATTC) */ 169 170 #define BLEHL_HEAP_MSG_SIZE (256 + 256 * BLE_CONNECTION_MAX) 171 #else 172 #define BLEHL_HEAP_MSG_SIZE (256) 173 #define BLEHL_HEAP_DB_SIZE (0) 174 #endif /* #if (BLE_CENTRAL || BLE_PERIPHERAL) */ 175 176 177 178 179 /// Number of BLE HL tasks 180 #define BLEHL_TASK_SIZE BLE_HOST_TASK_SIZE + BLE_PRF_TASK_SIZE 181 182 /// Size of environment variable needed on BLE Host Stack for one link 183 #define BLEHL_HEAP_ENV_SIZE ( BLE_GAPC_HEAP_ENV_SIZE + \ 184 BLE_GATTC_HEAP_ENV_SIZE + \ 185 BLE_L2CC_HEAP_ENV_SIZE) 186 187 188 189 190 191 192 193 /* 194 * DEFINES - Mandatory for BLE Host Layers 195 **************************************************************************************** 196 */ 197 /// Maximum time to remain advertising when in the Limited 198 /// Discover able mode: TGAP(lim_adv_timeout) 199 /// required value: 180s: (18000 for ke timer) 200 #define GAP_TMR_LIM_ADV_TIMEOUT 0x4650 201 202 /// Minimum time to perform scanning when performing 203 /// the General Discovery procedure: TGAP(gen_disc_scan_min) 204 /// recommended value: 10.24s: (1024 for ke timer) 205 #define GAP_TMR_GEN_DISC_SCAN 0x0300 206 207 /// Minimum time to perform scanning when performing the 208 /// Limited Discovery procedure: TGAP(lim_disc_scan_min) 209 /// recommended value: 10.24s: (1024 for ke timer) 210 #define GAP_TMR_LIM_DISC_SCAN 0x0300 211 212 /// Minimum time interval between private address change 213 /// TGAP(private_addr_int) 214 /// recommended value: 15 minutes; 0x01F4 for PTS 215 /// 0x3A98 is 150 seconds; 0xEA60 is 10 minutes 216 #define GAP_TMR_PRIV_ADDR_INT 0x3A98 217 218 219 /// Timer used in connection parameter update procedure 220 /// TGAP(conn_param_timeout) 221 /// recommended value: 30 s: (3000 for ke timer) / *10ms 222 #define GAP_TMR_CONN_PARAM_TIMEOUT 0x0BB8 223 224 /// Timer used in LE credit based connection procedure 225 /// TGAP(lecb_conn_timeout) 226 /// recommended value: 30 s: (3000 for ke timer) 227 #define GAP_TMR_LECB_CONN_TIMEOUT 0x0BB8 228 229 /// Timer used in LE credit based disconnection procedure 230 /// TGAP(lecb_disconn_timeout) 231 /// recommended value: 30 s: (3000 for ke timer) 232 #define GAP_TMR_LECB_DISCONN_TIMEOUT 0x0BB8 233 234 /// Maximal authorized MTU value 235 #define GAP_MAX_LE_MTU (517) 236 237 /// Maximum GAP device name size 238 #define GAP_MAX_NAME_SIZE (0x20) 239 240 /// Maximum Transmission Unit 241 #define ATT_DEFAULT_MTU (23) 242 /// 30 seconds transaction timer 243 #define ATT_TRANS_RTX (0x0BB8) 244 /// Acceptable encryption key size - strict access 245 #define ATT_SEC_ENC_KEY_SIZE (0x10) 246 247 /// Maximum attribute value length 248 #define ATT_MAX_VALUE (GAP_MAX_LE_MTU) 249 250 251 /// @} BLE stack configuration 252 /// @} ROOT 253 254 #endif // RWBLE_HL_CONFIG_H_ 255