1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 #ifndef GKI_TARGET_H 19 #define GKI_TARGET_H 20 21 #ifdef BUILDCFG 22 #include "buildcfg.h" 23 #endif 24 25 #include "data_types.h" 26 27 /* Operating System Selection */ 28 #ifndef BTE_SIM_APP 29 #define _GKI_ARM 30 #define _GKI_STANDALONE 31 #else 32 #define _BT_WIN32 33 #endif 34 35 /* define prefix for exporting APIs from libraries */ 36 #define EXPORT_API 37 38 #ifndef BTE_BSE_WRAPPER 39 #ifdef BTE_SIM_APP 40 #undef EXPORT_API 41 #define EXPORT_API __declspec(dllexport) 42 #endif 43 #endif 44 45 #define GKI_API EXPORT_API 46 #define UDRV_API EXPORT_API 47 48 49 /****************************************************************************** 50 ** 51 ** Task configuration 52 ** 53 ******************************************************************************/ 54 55 /* Definitions of task IDs for inter-task messaging */ 56 #ifndef MMI_TASK 57 #define MMI_TASK 0 58 #endif 59 60 #ifndef HCISU_TASK 61 #define HCISU_TASK 1 62 #endif 63 64 #ifndef NCIT_TASK 65 #define NCIT_TASK 2 66 #endif 67 68 #ifndef NFC_TASK 69 #define NFC_TASK 3 70 #endif 71 72 #ifndef BTU_TASK 73 #define BTU_TASK 4 74 #endif 75 76 /* BTE Application, Sample Apps, or Serial port Demo based on JP3 and JP4 setting) */ 77 #ifndef BTE_APPL_TASK 78 #define BTE_APPL_TASK 5 79 #endif 80 81 #ifndef DEV_MGR_TASK 82 #define DEV_MGR_TASK 6 83 #endif 84 85 #ifndef ISE_SCR_TASK 86 #define ISE_SCR_TASK 7 87 #endif 88 89 #ifndef UCODEC_TASK 90 #define UCODEC_TASK 8 91 #endif 92 93 #ifndef RPCT_TASK 94 #define RPCT_TASK 9 95 #endif 96 97 #ifndef UNV_TASK 98 #define UNV_TASK 10 99 #endif 100 101 #ifndef BTE_IDLE_TASK 102 #define BTE_IDLE_TASK 11 103 #endif 104 105 #ifndef UIPC_TASK 106 #define UIPC_TASK 12 107 #endif 108 109 #ifndef HCISU_AMP_TASK 110 #define HCISU_AMP_TASK 13 111 #endif 112 113 114 /* The number of GKI tasks in the software system. */ 115 #ifndef GKI_MAX_TASKS 116 #define GKI_MAX_TASKS 14 117 #endif 118 119 /****************************************************************************** 120 ** 121 ** Timer configuration 122 ** 123 ******************************************************************************/ 124 125 /* The number of GKI timers in the software system. */ 126 #ifndef GKI_NUM_TIMERS 127 #define GKI_NUM_TIMERS 3 128 #endif 129 130 /* A conversion value for translating ticks to calculate GKI timer. */ 131 #ifndef TICKS_PER_SEC 132 #define TICKS_PER_SEC 100 133 #endif 134 135 /* delay in ticks before stopping system tick. */ 136 #ifndef GKI_DELAY_STOP_SYS_TICK 137 #define GKI_DELAY_STOP_SYS_TICK 10 138 #endif 139 140 /****************************************************************************** 141 ** 142 ** Buffer configuration 143 ** 144 ******************************************************************************/ 145 146 /* TRUE if GKI uses dynamic buffers. */ 147 #ifndef GKI_USE_DYNAMIC_BUFFERS 148 #define GKI_USE_DYNAMIC_BUFFERS FALSE 149 #endif 150 151 /* The size of the buffers in pool 0. */ 152 #ifndef GKI_BUF0_SIZE 153 #define GKI_BUF0_SIZE 64 154 #endif 155 156 /* The number of buffers in buffer pool 0. */ 157 #ifndef GKI_BUF0_MAX 158 #define GKI_BUF0_MAX 48 159 #endif 160 161 /* The ID of buffer pool 0. */ 162 #ifndef GKI_POOL_ID_0 163 #define GKI_POOL_ID_0 0 164 #endif 165 166 /* The size of the buffers in pool 1. */ 167 #ifndef GKI_BUF1_SIZE 168 #define GKI_BUF1_SIZE 128 169 #endif 170 171 /* The number of buffers in buffer pool 1. */ 172 #ifndef GKI_BUF1_MAX 173 #define GKI_BUF1_MAX 26 174 #endif 175 176 /* The ID of buffer pool 1. */ 177 #ifndef GKI_POOL_ID_1 178 #define GKI_POOL_ID_1 1 179 #endif 180 181 /* The size of the buffers in pool 2. */ 182 #ifndef GKI_BUF2_SIZE 183 #define GKI_BUF2_SIZE 660 184 #endif 185 186 /* The number of buffers in buffer pool 2. */ 187 #ifndef GKI_BUF2_MAX 188 #define GKI_BUF2_MAX 45 189 #endif 190 191 /* The ID of buffer pool 2. */ 192 #ifndef GKI_POOL_ID_2 193 #define GKI_POOL_ID_2 2 194 #endif 195 196 /* The size of the buffers in pool 3. */ 197 #ifndef GKI_BUF3_SIZE 198 #define GKI_BUF3_SIZE 2500 199 #endif 200 201 /* The number of buffers in buffer pool 3. */ 202 #ifndef GKI_BUF3_MAX 203 #define GKI_BUF3_MAX 30 204 #endif 205 206 /* The ID of buffer pool 3. */ 207 #ifndef GKI_POOL_ID_3 208 #define GKI_POOL_ID_3 3 209 #endif 210 211 /* The size of the largest PUBLIC fixed buffer in system. */ 212 #ifndef GKI_MAX_BUF_SIZE 213 #define GKI_MAX_BUF_SIZE GKI_BUF3_SIZE 214 #endif 215 216 /* The pool ID of the largest PUBLIC fixed buffer in system. */ 217 #ifndef GKI_MAX_BUF_SIZE_POOL_ID 218 #define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_3 219 #endif 220 221 /* RESERVED buffer pool for OBX */ 222 /* Ideally there should be 1 buffer for each instance for RX data, and some number 223 of TX buffers based on active instances. OBX will only use these if packet size 224 requires it. In most cases the large packets are used in only one direction so 225 the other direction will use smaller buffers. 226 Devices with small amount of RAM should limit the number of active obex objects. 227 */ 228 /* The size of the buffers in pool 4. */ 229 #ifndef GKI_BUF4_SIZE 230 #define GKI_BUF4_SIZE 0x2000 231 #endif 232 233 /* The number of buffers in buffer pool 4. */ 234 #ifndef GKI_BUF4_MAX 235 #define GKI_BUF4_MAX (OBX_NUM_SERVERS + OBX_NUM_CLIENTS) 236 #endif 237 238 /* The ID of buffer pool 4. */ 239 #ifndef GKI_POOL_ID_4 240 #define GKI_POOL_ID_4 4 241 #endif 242 243 /* The number of fixed GKI buffer pools. 244 If L2CAP_FCR_INCLUDED is FALSE, Pool ID 5 is unnecessary 245 If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7 246 If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8 247 If GATT_SERVER_ENABLED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9 248 */ 249 #ifndef GKI_NUM_FIXED_BUF_POOLS 250 #define GKI_NUM_FIXED_BUF_POOLS 9 251 #endif 252 253 /* The buffer pool usage mask. */ 254 #ifndef GKI_DEF_BUFPOOL_PERM_MASK 255 #define GKI_DEF_BUFPOOL_PERM_MASK 0xfff0 256 #endif 257 258 /* The number of fixed and dynamic buffer pools. 259 If L2CAP_FCR_INCLUDED is FALSE, Pool ID 4 is unnecessary */ 260 #ifndef GKI_NUM_TOTAL_BUF_POOLS 261 #define GKI_NUM_TOTAL_BUF_POOLS 10 262 #endif 263 264 /* The following is intended to be a reserved pool for L2CAP 265 Flow control and retransmissions and intentionally kept out 266 of order */ 267 268 /* The number of buffers in buffer pool 5. */ 269 #ifndef GKI_BUF5_MAX 270 #define GKI_BUF5_MAX 64 271 #endif 272 273 /* The ID of buffer pool 5. */ 274 #ifndef GKI_POOL_ID_5 275 #define GKI_POOL_ID_5 5 276 #endif 277 278 /* The size of the buffers in pool 5 279 ** Special pool used by l2cap retransmissions only. This size based on segment 280 ** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI 281 ** header. 13 bytes of max headers allows us a 339 payload max. (in btui_app.txt) 282 ** Note: 748 used for insight scriptwrapper with CAT-2 scripts. 283 */ 284 #ifndef GKI_BUF5_SIZE 285 #define GKI_BUF5_SIZE 748 286 #endif 287 288 /* The buffer corruption check flag. */ 289 #ifndef GKI_ENABLE_BUF_CORRUPTION_CHECK 290 #define GKI_ENABLE_BUF_CORRUPTION_CHECK TRUE 291 #endif 292 293 /* The GKI severe error macro. */ 294 #ifndef GKI_SEVERE 295 #define GKI_SEVERE(code) 296 #endif 297 298 /* TRUE if GKI includes debug functionality. */ 299 #ifndef GKI_DEBUG 300 #define GKI_DEBUG FALSE 301 #endif 302 303 /* Maximum number of exceptions logged. */ 304 #ifndef GKI_MAX_EXCEPTION 305 #define GKI_MAX_EXCEPTION 8 306 #endif 307 308 /* Maximum number of chars stored for each exception message. */ 309 #ifndef GKI_MAX_EXCEPTION_MSGLEN 310 #define GKI_MAX_EXCEPTION_MSGLEN 64 311 #endif 312 313 #ifndef GKI_SEND_MSG_FROM_ISR 314 #define GKI_SEND_MSG_FROM_ISR FALSE 315 #endif 316 317 318 /* The following is intended to be a reserved pool for SCO 319 over HCI data and intentionally kept out of order */ 320 321 /* The ID of buffer pool 6. */ 322 #ifndef GKI_POOL_ID_6 323 #define GKI_POOL_ID_6 6 324 #endif 325 326 /* The size of the buffers in pool 6, 327 BUF_SIZE = max SCO data 255 + sizeof(BT_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */ 328 #ifndef GKI_BUF6_SIZE 329 #define GKI_BUF6_SIZE 268 330 #endif 331 332 /* The number of buffers in buffer pool 6. */ 333 #ifndef GKI_BUF6_MAX 334 #define GKI_BUF6_MAX 60 335 #endif 336 337 338 /* The following pool is a dedicated pool for HDP 339 If a shared pool is more desirable then 340 1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID 341 2. make sure that the shared pool size is larger than 9472 342 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since 343 POOL ID 7 is not needed 344 */ 345 346 /* The ID of buffer pool 7. */ 347 #ifndef GKI_POOL_ID_7 348 #define GKI_POOL_ID_7 7 349 #endif 350 351 /* The size of the buffers in pool 7 */ 352 #ifndef GKI_BUF7_SIZE 353 #define GKI_BUF7_SIZE 9472 354 #endif 355 356 /* The number of buffers in buffer pool 7. */ 357 #ifndef GKI_BUF7_MAX 358 #define GKI_BUF7_MAX 2 359 #endif 360 361 /* The following pool is a dedicated pool for GATT 362 If a shared pool is more desirable then 363 1. set GATT_DB_POOL_ID to the desired Gki Pool ID 364 2. make sure that the shared pool size fit a common GATT database needs 365 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since 366 POOL ID 8 is not needed 367 */ 368 369 /* The ID of buffer pool 8. */ 370 #ifndef GKI_POOL_ID_8 371 #define GKI_POOL_ID_8 8 372 #endif 373 374 /* The size of the buffers in pool 8 */ 375 #ifndef GKI_BUF8_SIZE 376 #define GKI_BUF8_SIZE 128 377 #endif 378 379 /* The number of buffers in buffer pool 8. */ 380 #ifndef GKI_BUF8_MAX 381 #define GKI_BUF8_MAX 30 382 #endif 383 384 #if defined(GKI_DEBUG) && (GKI_DEBUG == TRUE) 385 #ifdef LOG_TAG 386 #undef LOG_TAG 387 #endif 388 #define LOG_TAG "GKI_LINUX" 389 /* GKI Trace Macros */ 390 #define GKI_TRACE_0(m) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m) 391 #define GKI_TRACE_1(m,p1) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1) 392 #define GKI_TRACE_2(m,p1,p2) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2) 393 #define GKI_TRACE_3(m,p1,p2,p3) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3) 394 #define GKI_TRACE_4(m,p1,p2,p3,p4) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4) 395 #define GKI_TRACE_5(m,p1,p2,p3,p4,p5) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4,p5) 396 #define GKI_TRACE_6(m,p1,p2,p3,p4,p5,p6) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2,p3,p4,p5,p6) 397 #else 398 #define GKI_TRACE_0(m) 399 #define GKI_TRACE_1(m,p1) 400 #define GKI_TRACE_2(m,p1,p2) 401 #define GKI_TRACE_3(m,p1,p2,p3) 402 #define GKI_TRACE_4(m,p1,p2,p3,p4) 403 #define GKI_TRACE_5(m,p1,p2,p3,p4,p5) 404 #define GKI_TRACE_6(m,p1,p2,p3,p4,p5,p6) 405 406 #endif 407 408 #define GKI_TRACE_ERROR_0(m) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m) 409 #define GKI_TRACE_ERROR_1(m,p1) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1) 410 #define GKI_TRACE_ERROR_2(m,p1,p2) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2) 411 #define GKI_TRACE_ERROR_3(m,p1,p2,p3) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3) 412 #define GKI_TRACE_ERROR_4(m,p1,p2,p3,p4) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4) 413 #define GKI_TRACE_ERROR_5(m,p1,p2,p3,p4,p5) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4,p5) 414 #define GKI_TRACE_ERROR_6(m,p1,p2,p3,p4,p5,p6) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2,p3,p4,p5,p6) 415 416 #ifdef __cplusplus 417 extern "C" 418 { 419 #endif 420 421 EXPORT_API extern void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...); 422 423 #ifdef __cplusplus 424 } 425 #endif 426 427 #endif /* GKI_TARGET_H */ 428