blob: b66b30a5d2b6352cb264fad3fa4a9aa41a6e96e6 [file] [log] [blame]
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -08001/******************************************************************************
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
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -080035/******************************************************************************
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 setting) */
63#ifndef BTE_APPL_TASK
64#define BTE_APPL_TASK 5
65#endif
66
67#ifndef DEV_MGR_TASK
68#define DEV_MGR_TASK 6
69#endif
70
71#ifndef ISE_SCR_TASK
72#define ISE_SCR_TASK 7
73#endif
74
75#ifndef UCODEC_TASK
76#define UCODEC_TASK 8
77#endif
78
79#ifndef RPCT_TASK
80#define RPCT_TASK 9
81#endif
82
83#ifndef UNV_TASK
84#define UNV_TASK 10
85#endif
86
87#ifndef BTE_IDLE_TASK
88#define BTE_IDLE_TASK 11
89#endif
90
91#ifndef UIPC_TASK
92#define UIPC_TASK 12
93#endif
94
95#ifndef HCISU_AMP_TASK
96#define HCISU_AMP_TASK 13
97#endif
98
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/* TRUE if GKI uses dynamic buffers. */
133#ifndef GKI_USE_DYNAMIC_BUFFERS
134#define GKI_USE_DYNAMIC_BUFFERS FALSE
135#endif
136
137/* The size of the buffers in pool 0. */
138#ifndef GKI_BUF0_SIZE
139#define GKI_BUF0_SIZE 64
140#endif
141
142/* The number of buffers in buffer pool 0. */
143#ifndef GKI_BUF0_MAX
144#define GKI_BUF0_MAX 48
145#endif
146
147/* The ID of buffer pool 0. */
148#ifndef GKI_POOL_ID_0
149#define GKI_POOL_ID_0 0
150#endif
151
152/* The size of the buffers in pool 1. */
153#ifndef GKI_BUF1_SIZE
154#define GKI_BUF1_SIZE 128
155#endif
156
157/* The number of buffers in buffer pool 1. */
158#ifndef GKI_BUF1_MAX
159#define GKI_BUF1_MAX 26
160#endif
161
162/* The ID of buffer pool 1. */
163#ifndef GKI_POOL_ID_1
164#define GKI_POOL_ID_1 1
165#endif
166
167/* The size of the buffers in pool 2. */
168#ifndef GKI_BUF2_SIZE
169#define GKI_BUF2_SIZE 660
170#endif
171
172/* The number of buffers in buffer pool 2. */
173#ifndef GKI_BUF2_MAX
174#define GKI_BUF2_MAX 45
175#endif
176
177/* The ID of buffer pool 2. */
178#ifndef GKI_POOL_ID_2
179#define GKI_POOL_ID_2 2
180#endif
181
182/* The size of the buffers in pool 3. */
183#ifndef GKI_BUF3_SIZE
184#define GKI_BUF3_SIZE 2500
185#endif
186
187/* The number of buffers in buffer pool 3. */
188#ifndef GKI_BUF3_MAX
189#define GKI_BUF3_MAX 30
190#endif
191
192/* The ID of buffer pool 3. */
193#ifndef GKI_POOL_ID_3
194#define GKI_POOL_ID_3 3
195#endif
196
197/* The size of the largest PUBLIC fixed buffer in system. */
198#ifndef GKI_MAX_BUF_SIZE
199#define GKI_MAX_BUF_SIZE GKI_BUF3_SIZE
200#endif
201
202/* The pool ID of the largest PUBLIC fixed buffer in system. */
203#ifndef GKI_MAX_BUF_SIZE_POOL_ID
204#define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_3
205#endif
206
207/* RESERVED buffer pool for OBX */
208/* Ideally there should be 1 buffer for each instance for RX data, and some number
209of TX buffers based on active instances. OBX will only use these if packet size
210requires it. In most cases the large packets are used in only one direction so
211the other direction will use smaller buffers.
212Devices with small amount of RAM should limit the number of active obex objects.
213*/
214/* The size of the buffers in pool 4. */
215#ifndef GKI_BUF4_SIZE
216#define GKI_BUF4_SIZE 0x2000
217#endif
218
219/* The number of buffers in buffer pool 4. */
220#ifndef GKI_BUF4_MAX
Andre Eisenbachf7a43fd2016-10-18 03:00:52 -0700221#define GKI_BUF4_MAX 96 /* (OBX_NUM_SERVERS + OBX_NUM_CLIENTS) */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800222#endif
223
224/* The ID of buffer pool 4. */
225#ifndef GKI_POOL_ID_4
226#define GKI_POOL_ID_4 4
227#endif
228
229/* The number of fixed GKI buffer pools.
230If L2CAP_FCR_INCLUDED is FALSE, Pool ID 5 is unnecessary
231If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7
232If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8
233If GATT_SERVER_ENABLED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9
234*/
235#ifndef GKI_NUM_FIXED_BUF_POOLS
236#define GKI_NUM_FIXED_BUF_POOLS 9
237#endif
238
239/* The buffer pool usage mask. */
240#ifndef GKI_DEF_BUFPOOL_PERM_MASK
241#define GKI_DEF_BUFPOOL_PERM_MASK 0xfff0
242#endif
243
244/* The number of fixed and dynamic buffer pools.
245If L2CAP_FCR_INCLUDED is FALSE, Pool ID 4 is unnecessary */
246#ifndef GKI_NUM_TOTAL_BUF_POOLS
247#define GKI_NUM_TOTAL_BUF_POOLS 10
248#endif
249
250/* The following is intended to be a reserved pool for L2CAP
251Flow control and retransmissions and intentionally kept out
252of order */
253
254/* The number of buffers in buffer pool 5. */
255#ifndef GKI_BUF5_MAX
256#define GKI_BUF5_MAX 64
257#endif
258
259/* The ID of buffer pool 5. */
260#ifndef GKI_POOL_ID_5
261#define GKI_POOL_ID_5 5
262#endif
263
264/* The size of the buffers in pool 5
265** Special pool used by l2cap retransmissions only. This size based on segment
266** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI
267** header. 13 bytes of max headers allows us a 339 payload max. (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/* TRUE if GKI includes debug functionality. */
285#ifndef GKI_DEBUG
286#define GKI_DEBUG FALSE
287#endif
288
289/* Maximum number of exceptions logged. */
290#ifndef GKI_MAX_EXCEPTION
291#define GKI_MAX_EXCEPTION 8
292#endif
293
294/* Maximum number of chars stored for each exception message. */
295#ifndef GKI_MAX_EXCEPTION_MSGLEN
296#define GKI_MAX_EXCEPTION_MSGLEN 64
297#endif
298
299#ifndef GKI_SEND_MSG_FROM_ISR
300#define GKI_SEND_MSG_FROM_ISR FALSE
301#endif
302
303
304/* The following is intended to be a reserved pool for SCO
305over HCI data and intentionally kept out of order */
306
307/* The ID of buffer pool 6. */
308#ifndef GKI_POOL_ID_6
309#define GKI_POOL_ID_6 6
310#endif
311
312/* The size of the buffers in pool 6,
Ruchi Kandoi0a736882017-01-09 15:43:14 -0800313 BUF_SIZE = max SCO data 255 + sizeof(NFC_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800314#ifndef GKI_BUF6_SIZE
315#define GKI_BUF6_SIZE 268
316#endif
317
318/* The number of buffers in buffer pool 6. */
319#ifndef GKI_BUF6_MAX
320#define GKI_BUF6_MAX 60
321#endif
322
323
324/* The following pool is a dedicated pool for HDP
325 If a shared pool is more desirable then
326 1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID
327 2. make sure that the shared pool size is larger than 9472
328 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
329 POOL ID 7 is not needed
330*/
331
332/* The ID of buffer pool 7. */
333#ifndef GKI_POOL_ID_7
334#define GKI_POOL_ID_7 7
335#endif
336
337/* The size of the buffers in pool 7 */
338#ifndef GKI_BUF7_SIZE
339#define GKI_BUF7_SIZE 9472
340#endif
341
342/* The number of buffers in buffer pool 7. */
343#ifndef GKI_BUF7_MAX
344#define GKI_BUF7_MAX 2
345#endif
346
347/* The following pool is a dedicated pool for GATT
348 If a shared pool is more desirable then
349 1. set GATT_DB_POOL_ID to the desired Gki Pool ID
350 2. make sure that the shared pool size fit a common GATT database needs
351 3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
352 POOL ID 8 is not needed
353*/
354
355/* The ID of buffer pool 8. */
356#ifndef GKI_POOL_ID_8
357#define GKI_POOL_ID_8 8
358#endif
359
360/* The size of the buffers in pool 8 */
361#ifndef GKI_BUF8_SIZE
362#define GKI_BUF8_SIZE 128
363#endif
364
365/* The number of buffers in buffer pool 8. */
366#ifndef GKI_BUF8_MAX
367#define GKI_BUF8_MAX 30
368#endif
369
Ruchi Kandoi303fec12016-12-14 13:22:38 -0800370#if (GKI_DEBUG == TRUE)
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800371#ifdef LOG_TAG
372#undef LOG_TAG
373#endif
374#define LOG_TAG "GKI_LINUX"
375/* GKI Trace Macros */
376#define GKI_TRACE_0(m) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m)
377#define GKI_TRACE_1(m,p1) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1)
378#define GKI_TRACE_2(m,p1,p2) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_GENERIC,m,p1,p2)
379#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)
380#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)
381#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)
382#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)
383#else
384#define GKI_TRACE_0(m)
385#define GKI_TRACE_1(m,p1)
386#define GKI_TRACE_2(m,p1,p2)
387#define GKI_TRACE_3(m,p1,p2,p3)
388#define GKI_TRACE_4(m,p1,p2,p3,p4)
389#define GKI_TRACE_5(m,p1,p2,p3,p4,p5)
390#define GKI_TRACE_6(m,p1,p2,p3,p4,p5,p6)
391
392#endif
393
394#define GKI_TRACE_ERROR_0(m) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m)
395#define GKI_TRACE_ERROR_1(m,p1) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1)
396#define GKI_TRACE_ERROR_2(m,p1,p2) LogMsg(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR,m,p1,p2)
397#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)
398#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)
399#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)
400#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)
401
402#ifdef __cplusplus
403extern "C"
404{
405#endif
406
Ruchi Kandoi4182dab2017-01-10 13:25:53 -0800407extern void LogMsg (uint32_t trace_set_mask, const char *fmt_str, ...);
The Android Open Source Projecte9df6ba2012-12-13 14:55:37 -0800408
409#ifdef __cplusplus
410}
411#endif
412
413#endif /* GKI_TARGET_H */