7146c7ad9cc677bc888f96c4bb01946fe9cbb7b4
1 /******************************************************************************
3 * Copyright (C) 2009-2012 Realtek Corporation
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ******************************************************************************/
19 /******************************************************************************
21 * Filename: bt_vendor_rtk.h
23 * Description: A wrapper header file of bt_vendor_lib.h
25 * Contains definitions specific for interfacing with Realtek
28 ******************************************************************************/
30 #ifndef BT_VENDOR_RTK_H
31 #define BT_VENDOR_RTK_H
33 #include "bt_vendor_lib.h"
34 #include "vnd_buildcfg.h"
35 #include "rtk_btsnoop_net.h"
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <sys/ioctl.h>
47 #include <sys/epoll.h>
48 #include <sys/eventfd.h>
51 #include <cutils/properties.h>
54 /******************************************************************************
56 ******************************************************************************/
57 #define RTKBT_TRANS_H4 0x20
58 #define RTKBT_TRANS_H5 0x10
59 #define RTKBT_TRANS_UART 0x01
60 #define RTKBT_TRANS_USB 0x20
72 #define BTVND_DBG TRUE
75 #if (BTVND_DBG == TRUE)
76 #define BTVNDDBG(param, ...) {ALOGD(param, ## __VA_ARGS__);}
78 #define BTVNDDBG(param, ...) {}
82 /* Device port name where Bluetooth controller attached */
83 #ifndef BLUETOOTH_UART_DEVICE_PORT
84 #define BLUETOOTH_UART_DEVICE_PORT "/dev/ttyO1" /* maguro */
87 /* Location of firmware patch files */
88 #ifndef FW_PATCHFILE_LOCATION
89 #define FW_PATCHFILE_LOCATION "/vendor/etc/firmware/" /* maguro */
92 #ifndef UART_TARGET_BAUD_RATE
93 #define UART_TARGET_BAUD_RATE 3000000
98 /* The Bluetooth Device Aaddress source switch:
100 * -FALSE- (default value)
101 * Get the factory BDADDR from device's file system. Normally the BDADDR is
102 * stored in the location pointed by the PROPERTY_BT_BDADDR_PATH (defined in
103 * btif_common.h file) property.
106 * If the Bluetooth Controller has equipped with a non-volatile memory (such
107 * as BCM4330's OTP memory), the factory BDADDR can be stored in there and
108 * retrieved by the stack while enabling BT.
109 * !!! WARNING !!! Make sure that the OTP feature has been enabled in the
110 * firmware patchram (.hcd) file.
112 #ifndef USE_CONTROLLER_BDADDR
113 #define USE_CONTROLLER_BDADDR FALSE
119 1: UART with Host wake/BT wake out of band signals
121 #ifndef LPM_SLEEP_MODE
122 #define LPM_SLEEP_MODE 1
125 /* Host Stack Idle Threshold in 300ms or 25ms
127 In sleep mode 1, this is the number of firmware loops executed with no
128 activity before the Host wake line is deasserted. Activity includes HCI
129 traffic excluding certain sleep mode commands and the presence of SCO
130 connections if the "Allow Host Sleep During SCO" flag is not set to 1.
131 Each count of this parameter is roughly equivalent to 300ms or 25ms.
133 #ifndef LPM_IDLE_THRESHOLD
134 #define LPM_IDLE_THRESHOLD 1
137 /* Host Controller Idle Threshold in 300ms or 25ms
139 This is the number of firmware loops executed with no activity before the
140 HC is considered idle. Depending on the mode, HC may then attempt to sleep.
141 Activity includes HCI traffic excluding certain sleep mode commands and
142 the presence of ACL/SCO connections.
144 #ifndef LPM_HC_IDLE_THRESHOLD
145 #define LPM_HC_IDLE_THRESHOLD 1
148 /* BT_WAKE Polarity - 0=Active Low, 1= Active High */
149 #ifndef LPM_BT_WAKE_POLARITY
150 #define LPM_BT_WAKE_POLARITY 1 /* maguro */
153 /* HOST_WAKE Polarity - 0=Active Low, 1= Active High */
154 #ifndef LPM_HOST_WAKE_POLARITY
155 #define LPM_HOST_WAKE_POLARITY 1 /* maguro */
158 /* LPM_ALLOW_HOST_SLEEP_DURING_SCO
160 When this flag is set to 0, the host is not allowed to sleep while
161 an SCO is active. In sleep mode 1, the device will keep the host
162 wake line asserted while an SCO is active.
163 When this flag is set to 1, the host can sleep while an SCO is active.
164 This flag should only be set to 1 if SCO traffic is directed to the PCM
167 #ifndef LPM_ALLOW_HOST_SLEEP_DURING_SCO
168 #define LPM_ALLOW_HOST_SLEEP_DURING_SCO 1
171 /* LPM_COMBINE_SLEEP_MODE_AND_LPM
173 In Mode 0, always set byte 7 to 0. In sleep mode 1, device always
174 requires permission to sleep between scans / periodic inquiries regardless
175 of the setting of this byte. In sleep mode 1, if byte is set, device must
176 have "permission" to sleep during the low power modes of sniff, hold, and
177 park. If byte is not set, device can sleep without permission during these
178 modes. Permission to sleep in Mode 1 is obtained if the BT_WAKE signal is
181 #ifndef LPM_COMBINE_SLEEP_MODE_AND_LPM
182 #define LPM_COMBINE_SLEEP_MODE_AND_LPM 1
185 /* LPM_ENABLE_UART_TXD_TRI_STATE
187 When set to 0, the device will not tristate its UART TX line before going
189 When set to 1, the device will tristate its UART TX line before going to
192 #ifndef LPM_ENABLE_UART_TXD_TRI_STATE
193 #define LPM_ENABLE_UART_TXD_TRI_STATE 0
196 /* LPM_PULSED_HOST_WAKE
198 #ifndef LPM_PULSED_HOST_WAKE
199 #define LPM_PULSED_HOST_WAKE 0
202 /* LPM_IDLE_TIMEOUT_MULTIPLE
204 The multiple factor of host stack idle threshold in 300ms/25ms
206 #ifndef LPM_IDLE_TIMEOUT_MULTIPLE
207 #define LPM_IDLE_TIMEOUT_MULTIPLE 10
210 /* BT_WAKE_VIA_USERIAL_IOCTL
212 Use userial ioctl function to control BT_WAKE signal
214 #ifndef BT_WAKE_VIA_USERIAL_IOCTL
215 #define BT_WAKE_VIA_USERIAL_IOCTL FALSE
220 LPM & BT_WAKE control through PROC nodes
222 #ifndef BT_WAKE_VIA_PROC
223 #define BT_WAKE_VIA_PROC FALSE
226 /* HW_END_WITH_HCI_RESET
228 Sample code implementation of sending a HCI_RESET command during the epilog
229 process. It calls back to the callers after command complete of HCI_RESET
232 #ifndef HW_END_WITH_HCI_RESET
233 #define HW_END_WITH_HCI_RESET FALSE
236 /******************************************************************************
237 ** Extern variables and functions
238 ******************************************************************************/
240 extern bt_vendor_callbacks_t
*bt_vendor_cbacks
;
242 #endif /* BT_VENDOR_RTK_H */