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 
19 #pragma once
20 
21 /******************************************************************************
22 **
23 ** Buffer configuration
24 **
25 ******************************************************************************/
26 
27 /* The size of the buffers in pool 0. */
28 #ifndef GKI_BUF0_SIZE
29 #define GKI_BUF0_SIZE               64
30 #endif
31 
32 /* The number of buffers in buffer pool 0. */
33 #ifndef GKI_BUF0_MAX
34 #define GKI_BUF0_MAX                96
35 #endif
36 
37 /* The ID of buffer pool 0. */
38 #ifndef GKI_POOL_ID_0
39 #define GKI_POOL_ID_0               0
40 #endif
41 
42 /* The size of the buffers in pool 1. */
43 #ifndef GKI_BUF1_SIZE
44 #define GKI_BUF1_SIZE               288
45 #endif
46 
47 /* The number of buffers in buffer pool 1. */
48 #ifndef GKI_BUF1_MAX
49 #define GKI_BUF1_MAX                52
50 #endif
51 
52 /* The ID of buffer pool 1. */
53 #ifndef GKI_POOL_ID_1
54 #define GKI_POOL_ID_1               1
55 #endif
56 
57 /* The size of the buffers in pool 2. */
58 #ifndef GKI_BUF2_SIZE
59 #define GKI_BUF2_SIZE               660
60 #endif
61 
62 /* The number of buffers in buffer pool 2. */
63 #ifndef GKI_BUF2_MAX
64 #define GKI_BUF2_MAX                90
65 #endif
66 
67 /* The ID of buffer pool 2. */
68 #ifndef GKI_POOL_ID_2
69 #define GKI_POOL_ID_2               2
70 #endif
71 
72 /* The size of the buffers in pool 3. */
73 #ifndef GKI_BUF3_SIZE
74 #define GKI_BUF3_SIZE               (4096+16)
75 #endif
76 
77 /* The number of buffers in buffer pool 3. */
78 #ifndef GKI_BUF3_MAX
79 #define GKI_BUF3_MAX                400
80 #endif
81 
82 /* The ID of buffer pool 3. */
83 #ifndef GKI_POOL_ID_3
84 #define GKI_POOL_ID_3               3
85 #endif
86 
87 /* The size of the largest PUBLIC fixed buffer in system. */
88 #ifndef GKI_MAX_BUF_SIZE
89 #define GKI_MAX_BUF_SIZE            GKI_BUF3_SIZE
90 #endif
91 
92 /* The pool ID of the largest PUBLIC fixed buffer in system. */
93 #ifndef GKI_MAX_BUF_SIZE_POOL_ID
94 #define GKI_MAX_BUF_SIZE_POOL_ID    GKI_POOL_ID_3
95 #endif
96 
97 /* Pool 4 is used for BluetoothSocket L2CAP connections */
98 /* The size of the buffers in pool 4. */
99 #ifndef GKI_BUF4_SIZE
100 #define GKI_BUF4_SIZE               (8080+26)
101 #endif
102 
103 /* The number of buffers in buffer pool 4. */
104 #ifndef GKI_BUF4_MAX
105 #define GKI_BUF4_MAX                (OBX_NUM_SERVERS + OBX_NUM_CLIENTS)
106 #endif
107 
108 /* The ID of buffer pool 4. */
109 #ifndef GKI_POOL_ID_4
110 #define GKI_POOL_ID_4               4
111 #endif
112 
113 /* The number of fixed GKI buffer pools.
114 eL2CAP requires Pool ID 5
115 If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7
116 If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8
117 If BLE_INCLUDED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9
118 POOL_ID 9 is a public pool meant for large buffer needs such as SDP_DB
119 */
120 #ifndef GKI_NUM_FIXED_BUF_POOLS
121 #define GKI_NUM_FIXED_BUF_POOLS     10
122 #endif
123 
124 /* The buffer pool usage mask. */
125 #ifndef GKI_DEF_BUFPOOL_PERM_MASK
126 /* Setting POOL_ID 9 as a public pool meant for large buffers such as SDP_DB */
127 #define GKI_DEF_BUFPOOL_PERM_MASK   0xfdf0
128 #endif
129 
130 /* The following is intended to be a reserved pool for L2CAP
131 Flow control and retransmissions and intentionally kept out
132 of order */
133 
134 /* The number of buffers in buffer pool 5. */
135 #ifndef GKI_BUF5_MAX
136 #define GKI_BUF5_MAX                64
137 #endif
138 
139 /* The ID of buffer pool 5. */
140 #ifndef GKI_POOL_ID_5
141 #define GKI_POOL_ID_5               5
142 #endif
143 
144 /* The size of the buffers in pool 5
145 ** Special pool used by L2CAP retransmissions only.  This size based on segment
146 ** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI
147 ** header.  13 bytes of max headers allows us a 339 payload max. (in btui_app.txt)
148 ** Note: 748 used for insight scriptwrapper with CAT-2 scripts.
149 */
150 #ifndef GKI_BUF5_SIZE
151 #define GKI_BUF5_SIZE               748
152 #endif
153 
154 /* The following is intended to be a reserved pool for SCO
155 over HCI data and intentionally kept out of order */
156 
157 /* The ID of buffer pool 6. */
158 #ifndef GKI_POOL_ID_6
159 #define GKI_POOL_ID_6               6
160 #endif
161 
162 /* The size of the buffers in pool 6,
163   BUF_SIZE = max SCO data 255 + sizeof(BT_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */
164 #ifndef GKI_BUF6_SIZE
165 #define GKI_BUF6_SIZE               268
166 #endif
167 
168 /* The number of buffers in buffer pool 6. */
169 #ifndef GKI_BUF6_MAX
170 #define GKI_BUF6_MAX                60
171 #endif
172 
173 
174 /* The following pool is a dedicated pool for HDP
175    If a shared pool is more desirable then
176    1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID
177    2. make sure that the shared pool size is larger than 9472
178    3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
179       POOL ID 7 is not needed
180 */
181 
182 /* The ID of buffer pool 7. */
183 #ifndef GKI_POOL_ID_7
184 #define GKI_POOL_ID_7               7
185 #endif
186 
187 /* The size of the buffers in pool 7 */
188 #ifndef GKI_BUF7_SIZE
189 #define GKI_BUF7_SIZE               (10240 + 24)
190 #endif
191 
192 /* The number of buffers in buffer pool 7. */
193 #ifndef GKI_BUF7_MAX
194 #define GKI_BUF7_MAX                2
195 #endif
196 
197 /* The following pool is a dedicated pool for GATT
198    If a shared pool is more desirable then
199    1. set GATT_DB_POOL_ID to the desired Gki Pool ID
200    2. make sure that the shared pool size fit a common GATT database needs
201    3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
202       POOL ID 8 is not needed
203 */
204 
205 /* The ID of buffer pool 8. */
206 #ifndef GKI_POOL_ID_8
207 #define GKI_POOL_ID_8               8
208 #endif
209 
210 /* The size of the buffers in pool 8 */
211 #ifndef GKI_BUF8_SIZE
212 #define GKI_BUF8_SIZE               128
213 #endif
214 
215 /* The number of buffers in buffer pool 8. */
216 #ifndef GKI_BUF8_MAX
217 #define GKI_BUF8_MAX                30
218 #endif
219 
220 /* The following pool is  meant for large allocations such as SDP_DB */
221 #ifndef GKI_POOL_ID_9
222 #define GKI_POOL_ID_9              9
223 #endif
224 
225 #ifndef GKI_BUF9_SIZE
226 #define GKI_BUF9_SIZE            8192
227 #endif
228 
229 #ifndef GKI_BUF9_MAX
230 #define GKI_BUF9_MAX           5
231 #endif
232 
233 /* The number of fixed and dynamic buffer pools */
234 #ifndef GKI_NUM_TOTAL_BUF_POOLS
235 #define GKI_NUM_TOTAL_BUF_POOLS     10
236 #endif
237 
238 void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
239