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