blob: d7d3503f2daca164003dd151c4774c26a1920273
1 | /****************************************************************************** |
2 | * |
3 | * Copyright (C) 2009-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 | /****************************************************************************** |
20 | * |
21 | * Filename: bt_vendor_brcm.h |
22 | * |
23 | * Description: A wrapper header file of bt_vendor_lib.h |
24 | * |
25 | * Contains definitions specific for interfacing with Broadcom |
26 | * Bluetooth chipsets |
27 | * |
28 | ******************************************************************************/ |
29 | |
30 | #ifndef BT_VENDOR_BRCM_H |
31 | #define BT_VENDOR_BRCM_H |
32 | |
33 | #include "bt_vendor_lib.h" |
34 | #include "vnd_buildcfg.h" |
35 | |
36 | /****************************************************************************** |
37 | ** Constants & Macros |
38 | ******************************************************************************/ |
39 | |
40 | #ifndef FALSE |
41 | #define FALSE 0 |
42 | #endif |
43 | |
44 | #ifndef TRUE |
45 | #define TRUE (!FALSE) |
46 | #endif |
47 | |
48 | #ifndef VENDOR_LIB_RUNTIME_TUNING_ENABLED |
49 | #define VENDOR_LIB_RUNTIME_TUNING_ENABLED FALSE |
50 | #endif |
51 | |
52 | /* Run-time configuration file */ |
53 | #ifndef VENDOR_LIB_CONF_FILE |
54 | #define VENDOR_LIB_CONF_FILE "/etc/bluetooth/bt_vendor.conf" |
55 | #endif |
56 | |
57 | /* Device port name where Bluetooth controller attached */ |
58 | #ifndef BLUETOOTH_UART_DEVICE_PORT |
59 | #define BLUETOOTH_UART_DEVICE_PORT "/dev/ttyS1" /* maguro */ |
60 | #endif |
61 | |
62 | /* Location of firmware patch files */ |
63 | #ifndef FW_PATCHFILE_LOCATION |
64 | #define FW_PATCHFILE_LOCATION "/etc/bluetooth/" /* maguro */ |
65 | #endif |
66 | |
67 | #ifndef UART_TARGET_BAUD_RATE |
68 | #define UART_TARGET_BAUD_RATE 2000000 |
69 | #endif |
70 | |
71 | /* The millisecond delay pauses on HCI transport after firmware patches |
72 | * were downloaded. This gives some time for firmware to restart with |
73 | * patches before host attempts to send down any HCI commands. |
74 | * |
75 | * Note: It has been discovered that BCM43241B0 needs at least 200ms |
76 | * settlement delay in here. Without the delay, a Hardware Error event |
77 | * from BCM43241B0 had been seen in HCI upstream path right after the |
78 | * host sent the HCI_VSC_SET_BDADDR commad to the controller at higher |
79 | * baud. |
80 | */ |
81 | #ifndef FW_PATCH_SETTLEMENT_DELAY_MS |
82 | #define FW_PATCH_SETTLEMENT_DELAY_MS 200 |
83 | #endif |
84 | |
85 | /* The Bluetooth Device Aaddress source switch: |
86 | * |
87 | * -FALSE- (default value) |
88 | * Get the factory BDADDR from device's file system. Normally the BDADDR is |
89 | * stored in the location pointed by the PROPERTY_BT_BDADDR_PATH (defined in |
90 | * btif_common.h file) property. |
91 | * |
92 | * -TRUE- |
93 | * If the Bluetooth Controller has equipped with a non-volatile memory (such |
94 | * as BCM4330's OTP memory), the factory BDADDR can be stored in there and |
95 | * retrieved by the stack while enabling BT. |
96 | * !!! WARNING !!! Make sure that the OTP feature has been enabled in the |
97 | * firmware patchram (.hcd) file. |
98 | */ |
99 | #ifndef USE_CONTROLLER_BDADDR |
100 | #define USE_CONTROLLER_BDADDR FALSE |
101 | #endif |
102 | |
103 | /* sleep mode |
104 | |
105 | 0: disable |
106 | 1: UART with Host wake/BT wake out of band signals |
107 | */ |
108 | #ifndef LPM_SLEEP_MODE |
109 | #define LPM_SLEEP_MODE 1 |
110 | #endif |
111 | |
112 | /* Host Stack Idle Threshold in 300ms or 25ms |
113 | |
114 | In sleep mode 1, this is the number of firmware loops executed with no |
115 | activity before the Host wake line is deasserted. Activity includes HCI |
116 | traffic excluding certain sleep mode commands and the presence of SCO |
117 | connections if the "Allow Host Sleep During SCO" flag is not set to 1. |
118 | Each count of this parameter is roughly equivalent to 300ms or 25ms. |
119 | */ |
120 | #ifndef LPM_IDLE_THRESHOLD |
121 | #define LPM_IDLE_THRESHOLD 1 |
122 | #endif |
123 | |
124 | /* Host Controller Idle Threshold in 300ms or 25ms |
125 | |
126 | This is the number of firmware loops executed with no activity before the |
127 | HC is considered idle. Depending on the mode, HC may then attempt to sleep. |
128 | Activity includes HCI traffic excluding certain sleep mode commands and |
129 | the presence of ACL/SCO connections. |
130 | */ |
131 | #ifndef LPM_HC_IDLE_THRESHOLD |
132 | #define LPM_HC_IDLE_THRESHOLD 1 |
133 | #endif |
134 | |
135 | /* BT_WAKE Polarity - 0=Active Low, 1= Active High */ |
136 | #ifndef LPM_BT_WAKE_POLARITY |
137 | #define LPM_BT_WAKE_POLARITY 1 /* maguro */ |
138 | #endif |
139 | |
140 | /* HOST_WAKE Polarity - 0=Active Low, 1= Active High */ |
141 | #ifndef LPM_HOST_WAKE_POLARITY |
142 | #define LPM_HOST_WAKE_POLARITY 1 /* maguro */ |
143 | #endif |
144 | |
145 | /* LPM_ALLOW_HOST_SLEEP_DURING_SCO |
146 | |
147 | When this flag is set to 0, the host is not allowed to sleep while |
148 | an SCO is active. In sleep mode 1, the device will keep the host |
149 | wake line asserted while an SCO is active. |
150 | When this flag is set to 1, the host can sleep while an SCO is active. |
151 | This flag should only be set to 1 if SCO traffic is directed to the PCM |
152 | interface. |
153 | */ |
154 | #ifndef LPM_ALLOW_HOST_SLEEP_DURING_SCO |
155 | #define LPM_ALLOW_HOST_SLEEP_DURING_SCO 1 |
156 | #endif |
157 | |
158 | /* LPM_COMBINE_SLEEP_MODE_AND_LPM |
159 | |
160 | In Mode 0, always set byte 7 to 0. In sleep mode 1, device always |
161 | requires permission to sleep between scans / periodic inquiries regardless |
162 | of the setting of this byte. In sleep mode 1, if byte is set, device must |
163 | have "permission" to sleep during the low power modes of sniff, hold, and |
164 | park. If byte is not set, device can sleep without permission during these |
165 | modes. Permission to sleep in Mode 1 is obtained if the BT_WAKE signal is |
166 | not asserted. |
167 | */ |
168 | #ifndef LPM_COMBINE_SLEEP_MODE_AND_LPM |
169 | #define LPM_COMBINE_SLEEP_MODE_AND_LPM 1 |
170 | #endif |
171 | |
172 | /* LPM_ENABLE_UART_TXD_TRI_STATE |
173 | |
174 | When set to 0, the device will not tristate its UART TX line before going |
175 | to sleep. |
176 | When set to 1, the device will tristate its UART TX line before going to |
177 | sleep. |
178 | */ |
179 | #ifndef LPM_ENABLE_UART_TXD_TRI_STATE |
180 | #define LPM_ENABLE_UART_TXD_TRI_STATE 0 |
181 | #endif |
182 | |
183 | /* LPM_PULSED_HOST_WAKE |
184 | */ |
185 | #ifndef LPM_PULSED_HOST_WAKE |
186 | #define LPM_PULSED_HOST_WAKE 0 |
187 | #endif |
188 | |
189 | /* LPM_IDLE_TIMEOUT_MULTIPLE |
190 | |
191 | The multiple factor of host stack idle threshold in 300ms/25ms |
192 | */ |
193 | #ifndef LPM_IDLE_TIMEOUT_MULTIPLE |
194 | #define LPM_IDLE_TIMEOUT_MULTIPLE 10 |
195 | #endif |
196 | |
197 | /* BT_WAKE_VIA_USERIAL_IOCTL |
198 | |
199 | Use userial ioctl function to control BT_WAKE signal |
200 | */ |
201 | #ifndef BT_WAKE_VIA_USERIAL_IOCTL |
202 | #define BT_WAKE_VIA_USERIAL_IOCTL FALSE |
203 | #endif |
204 | |
205 | |
206 | /* SCO_CFG_INCLUDED |
207 | |
208 | Do SCO configuration by default. If the firmware patch had been embedded |
209 | with desired SCO configuration, set this FALSE to bypass configuration |
210 | from host software. |
211 | */ |
212 | #ifndef SCO_CFG_INCLUDED |
213 | #define SCO_CFG_INCLUDED TRUE |
214 | #endif |
215 | |
216 | #ifndef SCO_USE_I2S_INTERFACE |
217 | #define SCO_USE_I2S_INTERFACE FALSE |
218 | #endif |
219 | |
220 | #if (SCO_USE_I2S_INTERFACE == TRUE) |
221 | #define SCO_I2SPCM_PARAM_SIZE 4 |
222 | |
223 | /* SCO_I2SPCM_IF_MODE - 0=Disable, 1=Enable */ |
224 | #ifndef SCO_I2SPCM_IF_MODE |
225 | #define SCO_I2SPCM_IF_MODE 1 |
226 | #endif |
227 | |
228 | /* SCO_I2SPCM_IF_ROLE - 0=Slave, 1=Master */ |
229 | #ifndef SCO_I2SPCM_IF_ROLE |
230 | #define SCO_I2SPCM_IF_ROLE 1 |
231 | #endif |
232 | |
233 | /* SCO_I2SPCM_IF_SAMPLE_RATE |
234 | |
235 | 0 : 8K |
236 | 1 : 16K |
237 | 2 : 4K |
238 | */ |
239 | #ifndef SCO_I2SPCM_IF_SAMPLE_RATE |
240 | #define SCO_I2SPCM_IF_SAMPLE_RATE 0 |
241 | #endif |
242 | |
243 | /* SCO_I2SPCM_IF_CLOCK_RATE |
244 | |
245 | 0 : 128K |
246 | 1 : 256K |
247 | 2 : 512K |
248 | 3 : 1024K |
249 | 4 : 2048K |
250 | */ |
251 | #ifndef SCO_I2SPCM_IF_CLOCK_RATE |
252 | #define SCO_I2SPCM_IF_CLOCK_RATE 1 |
253 | #endif |
254 | #endif // SCO_USE_I2S_INTERFACE |
255 | |
256 | |
257 | #define SCO_PCM_PARAM_SIZE 5 |
258 | |
259 | /* SCO_PCM_ROUTING |
260 | |
261 | 0 : PCM |
262 | 1 : Transport |
263 | 2 : Codec |
264 | 3 : I2S |
265 | */ |
266 | #ifndef SCO_PCM_ROUTING |
267 | #define SCO_PCM_ROUTING 0 |
268 | #endif |
269 | |
270 | /* SCO_PCM_IF_CLOCK_RATE |
271 | |
272 | 0 : 128K |
273 | 1 : 256K |
274 | 2 : 512K |
275 | 3 : 1024K |
276 | 4 : 2048K |
277 | */ |
278 | #ifndef SCO_PCM_IF_CLOCK_RATE |
279 | #define SCO_PCM_IF_CLOCK_RATE 4 |
280 | #endif |
281 | |
282 | /* SCO_PCM_IF_FRAME_TYPE - 0=Short, 1=Long */ |
283 | #ifndef SCO_PCM_IF_FRAME_TYPE |
284 | #define SCO_PCM_IF_FRAME_TYPE 0 |
285 | #endif |
286 | |
287 | /* SCO_PCM_IF_SYNC_MODE - 0=Slave, 1=Master */ |
288 | #ifndef SCO_PCM_IF_SYNC_MODE |
289 | #define SCO_PCM_IF_SYNC_MODE 0 |
290 | #endif |
291 | |
292 | /* SCO_PCM_IF_CLOCK_MODE - 0=Slave, 1=Master */ |
293 | #ifndef SCO_PCM_IF_CLOCK_MODE |
294 | #define SCO_PCM_IF_CLOCK_MODE 0 |
295 | #endif |
296 | |
297 | #define PCM_DATA_FORMAT_PARAM_SIZE 5 |
298 | |
299 | /* PCM_DATA_FMT_SHIFT_MODE |
300 | |
301 | 0 : MSB first |
302 | 1 : LSB first |
303 | */ |
304 | #ifndef PCM_DATA_FMT_SHIFT_MODE |
305 | #define PCM_DATA_FMT_SHIFT_MODE 0 |
306 | #endif |
307 | |
308 | /* PCM_DATA_FMT_FILL_BITS |
309 | |
310 | Specifies the value with which to fill unused bits |
311 | if Fill_Method is set to programmable |
312 | */ |
313 | #ifndef PCM_DATA_FMT_FILL_BITS |
314 | #define PCM_DATA_FMT_FILL_BITS 0 |
315 | #endif |
316 | |
317 | /* PCM_DATA_FMT_FILL_METHOD |
318 | |
319 | 0 : 0's |
320 | 1 : 1's |
321 | 2 : Signed |
322 | 3 : Programmable |
323 | */ |
324 | #ifndef PCM_DATA_FMT_FILL_METHOD |
325 | #define PCM_DATA_FMT_FILL_METHOD 3 |
326 | #endif |
327 | |
328 | /* PCM_DATA_FMT_FILL_NUM |
329 | |
330 | Specifies the number of bits to be filled |
331 | */ |
332 | #ifndef PCM_DATA_FMT_FILL_NUM |
333 | #define PCM_DATA_FMT_FILL_NUM 3 |
334 | #endif |
335 | |
336 | /* PCM_DATA_FMT_JUSTIFY_MODE |
337 | |
338 | 0 : Left justify (fill data shifted out last) |
339 | 1 : Right justify (fill data shifted out first) |
340 | */ |
341 | #ifndef PCM_DATA_FMT_JUSTIFY_MODE |
342 | #define PCM_DATA_FMT_JUSTIFY_MODE 0 |
343 | #endif |
344 | |
345 | /****************************************************************************** |
346 | ** Extern variables and functions |
347 | ******************************************************************************/ |
348 | |
349 | extern bt_vendor_callbacks_t *bt_vendor_cbacks; |
350 | |
351 | #endif /* BT_VENDOR_BRCM_H */ |
352 | |
353 |