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