The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 21 | #define GKI_TRACE(fmt, ...) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 22 | |
| 23 | /****************************************************************************** |
| 24 | ** |
| 25 | ** Task configuration |
| 26 | ** |
| 27 | ******************************************************************************/ |
| 28 | |
| 29 | /* Definitions of task IDs for inter-task messaging */ |
| 30 | #ifndef BTU_TASK |
| 31 | #define BTU_TASK 0 |
| 32 | #endif |
| 33 | |
| 34 | #ifndef BTIF_TASK |
| 35 | #define BTIF_TASK 1 |
| 36 | #endif |
| 37 | |
| 38 | #ifndef A2DP_MEDIA_TASK |
| 39 | #define A2DP_MEDIA_TASK 2 |
| 40 | #endif |
| 41 | |
| 42 | /* The number of GKI tasks in the software system. */ |
| 43 | #ifndef GKI_MAX_TASKS |
| 44 | #define GKI_MAX_TASKS 3 |
| 45 | #endif |
| 46 | |
| 47 | /****************************************************************************** |
| 48 | ** |
| 49 | ** Timer configuration |
| 50 | ** |
| 51 | ******************************************************************************/ |
| 52 | |
| 53 | /* The number of GKI timers in the software system. */ |
| 54 | #ifndef GKI_NUM_TIMERS |
Chris Manton | 0aee331 | 2014-06-12 12:52:33 -0700 | [diff] [blame] | 55 | #define GKI_NUM_TIMERS 4 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 56 | #endif |
| 57 | |
| 58 | /* A conversion value for translating ticks to calculate GKI timer. */ |
| 59 | #ifndef TICKS_PER_SEC |
| 60 | #define TICKS_PER_SEC 100 |
| 61 | #endif |
| 62 | |
| 63 | /************************************************************************ |
| 64 | ** Utility macros converting ticks to time with user define OS ticks per sec |
| 65 | **/ |
| 66 | #ifndef GKI_MS_TO_TICKS |
| 67 | #define GKI_MS_TO_TICKS(x) ((x) / (1000 / TICKS_PER_SEC)) |
| 68 | #endif |
| 69 | |
| 70 | #ifndef GKI_SECS_TO_TICKS |
| 71 | #define GKI_SECS_TO_TICKS(x) ((x) * (TICKS_PER_SEC)) |
| 72 | #endif |
| 73 | |
| 74 | #ifndef GKI_TICKS_TO_MS |
| 75 | #define GKI_TICKS_TO_MS(x) ((x) * 1000 / TICKS_PER_SEC) |
| 76 | #endif |
| 77 | |
| 78 | #ifndef GKI_TICKS_TO_SECS |
| 79 | #define GKI_TICKS_TO_SECS(x) ((x) / TICKS_PER_SEC) |
| 80 | #endif |
| 81 | |
| 82 | |
| 83 | |
| 84 | /* TICK per second from OS (OS dependent change this macro accordingly to various OS) */ |
| 85 | #ifndef OS_TICKS_PER_SEC |
| 86 | #define OS_TICKS_PER_SEC 1000 |
| 87 | #endif |
| 88 | |
| 89 | /************************************************************************ |
| 90 | ** Utility macros converting ticks to time with user define OS ticks per sec |
| 91 | **/ |
| 92 | |
| 93 | #ifndef GKI_OS_TICKS_TO_MS |
| 94 | #define GKI_OS_TICKS_TO_MS(x) ((x) * 1000 / OS_TICKS_PER_SEC) |
| 95 | #endif |
| 96 | |
| 97 | |
| 98 | #ifndef GKI_OS_TICKS_TO_SECS |
| 99 | #define GKI_OS_TICKS_TO_SECS(x) ((x) / OS_TICKS_PER_SEC)) |
| 100 | #endif |
| 101 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 102 | /****************************************************************************** |
| 103 | ** |
| 104 | ** Buffer configuration |
| 105 | ** |
| 106 | ******************************************************************************/ |
| 107 | |
| 108 | /* TRUE if GKI uses dynamic buffers. */ |
| 109 | #ifndef GKI_USE_DYNAMIC_BUFFERS |
| 110 | #define GKI_USE_DYNAMIC_BUFFERS FALSE |
| 111 | #endif |
| 112 | |
| 113 | /* The size of the buffers in pool 0. */ |
| 114 | #ifndef GKI_BUF0_SIZE |
| 115 | #define GKI_BUF0_SIZE 64 |
| 116 | #endif |
| 117 | |
| 118 | /* The number of buffers in buffer pool 0. */ |
| 119 | #ifndef GKI_BUF0_MAX |
Zach Johnson | e0a13a3 | 2014-11-13 13:55:32 -0800 | [diff] [blame] | 120 | #define GKI_BUF0_MAX 96 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 121 | #endif |
| 122 | |
| 123 | /* The ID of buffer pool 0. */ |
| 124 | #ifndef GKI_POOL_ID_0 |
| 125 | #define GKI_POOL_ID_0 0 |
| 126 | #endif |
| 127 | |
| 128 | /* The size of the buffers in pool 1. */ |
| 129 | #ifndef GKI_BUF1_SIZE |
| 130 | #define GKI_BUF1_SIZE 288 |
| 131 | #endif |
| 132 | |
| 133 | /* The number of buffers in buffer pool 1. */ |
| 134 | #ifndef GKI_BUF1_MAX |
Zach Johnson | e0a13a3 | 2014-11-13 13:55:32 -0800 | [diff] [blame] | 135 | #define GKI_BUF1_MAX 52 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 136 | #endif |
| 137 | |
| 138 | /* The ID of buffer pool 1. */ |
| 139 | #ifndef GKI_POOL_ID_1 |
| 140 | #define GKI_POOL_ID_1 1 |
| 141 | #endif |
| 142 | |
| 143 | /* The size of the buffers in pool 2. */ |
| 144 | #ifndef GKI_BUF2_SIZE |
| 145 | #define GKI_BUF2_SIZE 660 |
| 146 | #endif |
| 147 | |
| 148 | /* The number of buffers in buffer pool 2. */ |
| 149 | #ifndef GKI_BUF2_MAX |
Zach Johnson | e0a13a3 | 2014-11-13 13:55:32 -0800 | [diff] [blame] | 150 | #define GKI_BUF2_MAX 90 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 151 | #endif |
| 152 | |
| 153 | /* The ID of buffer pool 2. */ |
| 154 | #ifndef GKI_POOL_ID_2 |
| 155 | #define GKI_POOL_ID_2 2 |
| 156 | #endif |
| 157 | |
| 158 | /* The size of the buffers in pool 3. */ |
| 159 | #ifndef GKI_BUF3_SIZE |
| 160 | #define GKI_BUF3_SIZE (4096+16) |
| 161 | #endif |
| 162 | |
| 163 | /* The number of buffers in buffer pool 3. */ |
| 164 | #ifndef GKI_BUF3_MAX |
Zach Johnson | e0a13a3 | 2014-11-13 13:55:32 -0800 | [diff] [blame] | 165 | #define GKI_BUF3_MAX 400 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 166 | #endif |
| 167 | |
| 168 | /* The ID of buffer pool 3. */ |
| 169 | #ifndef GKI_POOL_ID_3 |
| 170 | #define GKI_POOL_ID_3 3 |
| 171 | #endif |
| 172 | |
| 173 | /* The size of the largest PUBLIC fixed buffer in system. */ |
| 174 | #ifndef GKI_MAX_BUF_SIZE |
| 175 | #define GKI_MAX_BUF_SIZE GKI_BUF3_SIZE |
| 176 | #endif |
| 177 | |
| 178 | /* The pool ID of the largest PUBLIC fixed buffer in system. */ |
| 179 | #ifndef GKI_MAX_BUF_SIZE_POOL_ID |
| 180 | #define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_3 |
| 181 | #endif |
| 182 | |
Zach Johnson | 8e90de4 | 2014-10-20 15:40:01 -0700 | [diff] [blame] | 183 | /* Pool 4 is unused */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 184 | /* The size of the buffers in pool 4. */ |
| 185 | #ifndef GKI_BUF4_SIZE |
| 186 | #define GKI_BUF4_SIZE (8080+26) |
| 187 | #endif |
| 188 | |
| 189 | /* The number of buffers in buffer pool 4. */ |
| 190 | #ifndef GKI_BUF4_MAX |
Zach Johnson | 8e90de4 | 2014-10-20 15:40:01 -0700 | [diff] [blame] | 191 | #define GKI_BUF4_MAX 0 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 192 | #endif |
| 193 | |
| 194 | /* The ID of buffer pool 4. */ |
| 195 | #ifndef GKI_POOL_ID_4 |
| 196 | #define GKI_POOL_ID_4 4 |
| 197 | #endif |
| 198 | |
| 199 | /* The number of fixed GKI buffer pools. |
| 200 | eL2CAP requires Pool ID 5 |
| 201 | If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7 |
| 202 | If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8 |
| 203 | If BLE_INCLUDED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9 |
| 204 | POOL_ID 9 is a public pool meant for large buffer needs such as SDP_DB |
| 205 | */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 206 | #ifndef GKI_NUM_FIXED_BUF_POOLS |
| 207 | #define GKI_NUM_FIXED_BUF_POOLS 10 |
| 208 | #endif |
| 209 | |
| 210 | /* The buffer pool usage mask. */ |
| 211 | #ifndef GKI_DEF_BUFPOOL_PERM_MASK |
| 212 | /* Setting POOL_ID 9 as a public pool meant for large buffers such as SDP_DB */ |
| 213 | #define GKI_DEF_BUFPOOL_PERM_MASK 0xfdf0 |
| 214 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 215 | |
| 216 | /* The number of fixed and dynamic buffer pools */ |
| 217 | #ifndef GKI_NUM_TOTAL_BUF_POOLS |
| 218 | #define GKI_NUM_TOTAL_BUF_POOLS 10 |
| 219 | #endif |
| 220 | |
| 221 | /* The following is intended to be a reserved pool for L2CAP |
| 222 | Flow control and retransmissions and intentionally kept out |
| 223 | of order */ |
| 224 | |
| 225 | /* The number of buffers in buffer pool 5. */ |
| 226 | #ifndef GKI_BUF5_MAX |
| 227 | #define GKI_BUF5_MAX 64 |
| 228 | #endif |
| 229 | |
| 230 | /* The ID of buffer pool 5. */ |
| 231 | #ifndef GKI_POOL_ID_5 |
| 232 | #define GKI_POOL_ID_5 5 |
| 233 | #endif |
| 234 | |
| 235 | /* The size of the buffers in pool 5 |
| 236 | ** Special pool used by l2cap retransmissions only. This size based on segment |
| 237 | ** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI |
| 238 | ** header. 13 bytes of max headers allows us a 339 payload max. (in btui_app.txt) |
| 239 | ** Note: 748 used for insight scriptwrapper with CAT-2 scripts. |
| 240 | */ |
| 241 | #ifndef GKI_BUF5_SIZE |
| 242 | #define GKI_BUF5_SIZE 748 |
| 243 | #endif |
| 244 | |
| 245 | /* The buffer corruption check flag. */ |
| 246 | #ifndef GKI_ENABLE_BUF_CORRUPTION_CHECK |
| 247 | #define GKI_ENABLE_BUF_CORRUPTION_CHECK TRUE |
| 248 | #endif |
| 249 | |
| 250 | /* The GKI severe error macro. */ |
| 251 | #ifndef GKI_SEVERE |
| 252 | #define GKI_SEVERE(code) |
| 253 | #endif |
| 254 | |
| 255 | /* TRUE if GKI includes debug functionality. */ |
| 256 | #ifndef GKI_DEBUG |
| 257 | #define GKI_DEBUG FALSE |
| 258 | #endif |
| 259 | |
| 260 | /* Maximum number of exceptions logged. */ |
| 261 | #ifndef GKI_MAX_EXCEPTION |
| 262 | #define GKI_MAX_EXCEPTION 8 |
| 263 | #endif |
| 264 | |
| 265 | /* Maximum number of chars stored for each exception message. */ |
| 266 | #ifndef GKI_MAX_EXCEPTION_MSGLEN |
| 267 | #define GKI_MAX_EXCEPTION_MSGLEN 64 |
| 268 | #endif |
| 269 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 270 | /* The following is intended to be a reserved pool for SCO |
| 271 | over HCI data and intentionally kept out of order */ |
| 272 | |
| 273 | /* The ID of buffer pool 6. */ |
| 274 | #ifndef GKI_POOL_ID_6 |
| 275 | #define GKI_POOL_ID_6 6 |
| 276 | #endif |
| 277 | |
| 278 | /* The size of the buffers in pool 6, |
| 279 | BUF_SIZE = max SCO data 255 + sizeof(BT_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */ |
| 280 | #ifndef GKI_BUF6_SIZE |
| 281 | #define GKI_BUF6_SIZE 268 |
| 282 | #endif |
| 283 | |
| 284 | /* The number of buffers in buffer pool 6. */ |
| 285 | #ifndef GKI_BUF6_MAX |
| 286 | #define GKI_BUF6_MAX 60 |
| 287 | #endif |
| 288 | |
| 289 | |
| 290 | /* The following pool is a dedicated pool for HDP |
| 291 | If a shared pool is more desirable then |
| 292 | 1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID |
| 293 | 2. make sure that the shared pool size is larger than 9472 |
| 294 | 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since |
| 295 | POOL ID 7 is not needed |
| 296 | */ |
| 297 | |
| 298 | /* The ID of buffer pool 7. */ |
| 299 | #ifndef GKI_POOL_ID_7 |
| 300 | #define GKI_POOL_ID_7 7 |
| 301 | #endif |
| 302 | |
| 303 | /* The size of the buffers in pool 7 */ |
| 304 | #ifndef GKI_BUF7_SIZE |
Priti Aghera | c8a9f43 | 2013-05-22 13:25:58 -0700 | [diff] [blame] | 305 | #define GKI_BUF7_SIZE (10240 + 24) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 306 | #endif |
| 307 | |
| 308 | /* The number of buffers in buffer pool 7. */ |
| 309 | #ifndef GKI_BUF7_MAX |
| 310 | #define GKI_BUF7_MAX 2 |
| 311 | #endif |
| 312 | |
| 313 | /* The following pool is a dedicated pool for GATT |
| 314 | If a shared pool is more desirable then |
| 315 | 1. set GATT_DB_POOL_ID to the desired Gki Pool ID |
| 316 | 2. make sure that the shared pool size fit a common GATT database needs |
| 317 | 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since |
| 318 | POOL ID 8 is not needed |
| 319 | */ |
| 320 | |
| 321 | /* The ID of buffer pool 8. */ |
| 322 | #ifndef GKI_POOL_ID_8 |
| 323 | #define GKI_POOL_ID_8 8 |
| 324 | #endif |
| 325 | |
| 326 | /* The size of the buffers in pool 8 */ |
| 327 | #ifndef GKI_BUF8_SIZE |
| 328 | #define GKI_BUF8_SIZE 128 |
| 329 | #endif |
| 330 | |
| 331 | /* The number of buffers in buffer pool 8. */ |
| 332 | #ifndef GKI_BUF8_MAX |
| 333 | #define GKI_BUF8_MAX 30 |
| 334 | #endif |
| 335 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 336 | /* The following pool is meant for large allocations such as SDP_DB */ |
| 337 | #ifndef GKI_POOL_ID_9 |
| 338 | #define GKI_POOL_ID_9 9 |
| 339 | #endif |
| 340 | |
| 341 | #ifndef GKI_BUF9_SIZE |
| 342 | #define GKI_BUF9_SIZE 8192 |
| 343 | #endif |
| 344 | |
| 345 | #ifndef GKI_BUF9_MAX |
| 346 | #define GKI_BUF9_MAX 5 |
| 347 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 348 | |
Sharvil Nanavati | 414328a | 2014-09-06 20:09:11 -0700 | [diff] [blame] | 349 | void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 350 | |
| 351 | #endif /* GKI_TARGET_H */ |