blob: 2ecc21e7678af1885f14adaf5491670f953b6772 [file] [log] [blame]
Wink Saville0c04d592012-09-25 05:49:13 -07001/******************************************************************************
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/ttyO1" /* maguro */
60#endif
61
62/* Location of firmware patch files */
63#ifndef FW_PATCHFILE_LOCATION
64#define FW_PATCHFILE_LOCATION "/vendor/firmware/" /* maguro */
65#endif
66
67#ifndef UART_TARGET_BAUD_RATE
68#define UART_TARGET_BAUD_RATE 3000000
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 0
83#endif
84
85/* sleep mode
86
87 0: disable
88 1: UART with Host wake/BT wake out of band signals
89*/
90#ifndef LPM_SLEEP_MODE
91#define LPM_SLEEP_MODE 1
92#endif
93
94/* Host Stack Idle Threshold in 300ms or 25ms
95
96 In sleep mode 1, this is the number of firmware loops executed with no
97 activity before the Host wake line is deasserted. Activity includes HCI
98 traffic excluding certain sleep mode commands and the presence of SCO
99 connections if the "Allow Host Sleep During SCO" flag is not set to 1.
100 Each count of this parameter is roughly equivalent to 300ms or 25ms.
101*/
102#ifndef LPM_IDLE_THRESHOLD
103#define LPM_IDLE_THRESHOLD 1
104#endif
105
106/* Host Controller Idle Threshold in 300ms or 25ms
107
108 This is the number of firmware loops executed with no activity before the
109 HC is considered idle. Depending on the mode, HC may then attempt to sleep.
110 Activity includes HCI traffic excluding certain sleep mode commands and
111 the presence of ACL/SCO connections.
112*/
113#ifndef LPM_HC_IDLE_THRESHOLD
114#define LPM_HC_IDLE_THRESHOLD 1
115#endif
116
117/* BT_WAKE Polarity - 0=Active Low, 1= Active High */
118#ifndef LPM_BT_WAKE_POLARITY
119#define LPM_BT_WAKE_POLARITY 1 /* maguro */
120#endif
121
122/* HOST_WAKE Polarity - 0=Active Low, 1= Active High */
123#ifndef LPM_HOST_WAKE_POLARITY
124#define LPM_HOST_WAKE_POLARITY 1 /* maguro */
125#endif
126
127/* LPM_ALLOW_HOST_SLEEP_DURING_SCO
128
129 When this flag is set to 0, the host is not allowed to sleep while
130 an SCO is active. In sleep mode 1, the device will keep the host
131 wake line asserted while an SCO is active.
132 When this flag is set to 1, the host can sleep while an SCO is active.
133 This flag should only be set to 1 if SCO traffic is directed to the PCM
134 interface.
135*/
136#ifndef LPM_ALLOW_HOST_SLEEP_DURING_SCO
137#define LPM_ALLOW_HOST_SLEEP_DURING_SCO 1
138#endif
139
140/* LPM_COMBINE_SLEEP_MODE_AND_LPM
141
142 In Mode 0, always set byte 7 to 0. In sleep mode 1, device always
143 requires permission to sleep between scans / periodic inquiries regardless
144 of the setting of this byte. In sleep mode 1, if byte is set, device must
145 have "permission" to sleep during the low power modes of sniff, hold, and
146 park. If byte is not set, device can sleep without permission during these
147 modes. Permission to sleep in Mode 1 is obtained if the BT_WAKE signal is
148 not asserted.
149*/
150#ifndef LPM_COMBINE_SLEEP_MODE_AND_LPM
151#define LPM_COMBINE_SLEEP_MODE_AND_LPM 1
152#endif
153
154/* LPM_ENABLE_UART_TXD_TRI_STATE
155
156 When set to 0, the device will not tristate its UART TX line before going
157 to sleep.
158 When set to 1, the device will tristate its UART TX line before going to
159 sleep.
160*/
161#ifndef LPM_ENABLE_UART_TXD_TRI_STATE
162#define LPM_ENABLE_UART_TXD_TRI_STATE 0
163#endif
164
165/* LPM_PULSED_HOST_WAKE
166*/
167#ifndef LPM_PULSED_HOST_WAKE
168#define LPM_PULSED_HOST_WAKE 0
169#endif
170
171/* LPM_IDLE_TIMEOUT_MULTIPLE
172
173 The multiple factor of host stack idle threshold in 300ms/25ms
174*/
175#ifndef LPM_IDLE_TIMEOUT_MULTIPLE
176#define LPM_IDLE_TIMEOUT_MULTIPLE 10
177#endif
178
179/* BT_WAKE_VIA_USERIAL_IOCTL
180
181 Use userial ioctl function to control BT_WAKE signal
182*/
183#ifndef BT_WAKE_VIA_USERIAL_IOCTL
184#define BT_WAKE_VIA_USERIAL_IOCTL FALSE
185#endif
186
187
188/* SCO_CFG_INCLUDED
189
190 Do SCO configuration by default. If the firmware patch had been embedded
191 with desired SCO configuration, set this FALSE to bypass configuration
192 from host software.
193*/
194#ifndef SCO_CFG_INCLUDED
195#define SCO_CFG_INCLUDED TRUE
196#endif
197
198#ifndef SCO_USE_I2S_INTERFACE
199#define SCO_USE_I2S_INTERFACE FALSE
200#endif
201
202#if (SCO_USE_I2S_INTERFACE == TRUE)
203#define SCO_I2SPCM_PARAM_SIZE 4
204
205/* SCO_I2SPCM_IF_MODE - 0=Disable, 1=Enable */
206#ifndef SCO_I2SPCM_IF_MODE
207#define SCO_I2SPCM_IF_MODE 1
208#endif
209
210/* SCO_I2SPCM_IF_ROLE - 0=Slave, 1=Master */
211#ifndef SCO_I2SPCM_IF_ROLE
212#define SCO_I2SPCM_IF_ROLE 1
213#endif
214
215/* SCO_I2SPCM_IF_SAMPLE_RATE
216
217 0 : 8K
218 1 : 16K
219 2 : 4K
220*/
221#ifndef SCO_I2SPCM_IF_SAMPLE_RATE
222#define SCO_I2SPCM_IF_SAMPLE_RATE 0
223#endif
224
225/* SCO_I2SPCM_IF_CLOCK_RATE
226
227 0 : 128K
228 1 : 256K
229 2 : 512K
230 3 : 1024K
231 4 : 2048K
232*/
233#ifndef SCO_I2SPCM_IF_CLOCK_RATE
234#define SCO_I2SPCM_IF_CLOCK_RATE 1
235#endif
236#endif // SCO_USE_I2S_INTERFACE
237
238
239#define SCO_PCM_PARAM_SIZE 5
240
241/* SCO_PCM_ROUTING
242
243 0 : PCM
244 1 : Transport
245 2 : Codec
246 3 : I2S
247*/
248#ifndef SCO_PCM_ROUTING
249#define SCO_PCM_ROUTING 0
250#endif
251
252/* SCO_PCM_IF_CLOCK_RATE
253
254 0 : 128K
255 1 : 256K
256 2 : 512K
257 3 : 1024K
258 4 : 2048K
259*/
260#ifndef SCO_PCM_IF_CLOCK_RATE
261#define SCO_PCM_IF_CLOCK_RATE 4
262#endif
263
264/* SCO_PCM_IF_FRAME_TYPE - 0=Short, 1=Long */
265#ifndef SCO_PCM_IF_FRAME_TYPE
266#define SCO_PCM_IF_FRAME_TYPE 0
267#endif
268
269/* SCO_PCM_IF_SYNC_MODE - 0=Slave, 1=Master */
270#ifndef SCO_PCM_IF_SYNC_MODE
271#define SCO_PCM_IF_SYNC_MODE 0
272#endif
273
274/* SCO_PCM_IF_CLOCK_MODE - 0=Slave, 1=Master */
275#ifndef SCO_PCM_IF_CLOCK_MODE
276#define SCO_PCM_IF_CLOCK_MODE 0
277#endif
278
279#define PCM_DATA_FORMAT_PARAM_SIZE 5
280
281/* PCM_DATA_FMT_SHIFT_MODE
282
283 0 : MSB first
284 1 : LSB first
285*/
286#ifndef PCM_DATA_FMT_SHIFT_MODE
287#define PCM_DATA_FMT_SHIFT_MODE 0
288#endif
289
290/* PCM_DATA_FMT_FILL_BITS
291
292 Specifies the value with which to fill unused bits
293 if Fill_Method is set to programmable
294*/
295#ifndef PCM_DATA_FMT_FILL_BITS
296#define PCM_DATA_FMT_FILL_BITS 0
297#endif
298
299/* PCM_DATA_FMT_FILL_METHOD
300
301 0 : 0's
302 1 : 1's
303 2 : Signed
304 3 : Programmable
305*/
306#ifndef PCM_DATA_FMT_FILL_METHOD
307#define PCM_DATA_FMT_FILL_METHOD 3
308#endif
309
310/* PCM_DATA_FMT_FILL_NUM
311
312 Specifies the number of bits to be filled
313*/
314#ifndef PCM_DATA_FMT_FILL_NUM
315#define PCM_DATA_FMT_FILL_NUM 3
316#endif
317
318/* PCM_DATA_FMT_JUSTIFY_MODE
319
320 0 : Left justify (fill data shifted out last)
321 1 : Right justify (fill data shifted out first)
322*/
323#ifndef PCM_DATA_FMT_JUSTIFY_MODE
324#define PCM_DATA_FMT_JUSTIFY_MODE 0
325#endif
326
327/******************************************************************************
328** Extern variables and functions
329******************************************************************************/
330
331extern bt_vendor_callbacks_t *bt_vendor_cbacks;
332
333#endif /* BT_VENDOR_BRCM_H */
334