aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-12-03 18:50:18 -0800
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-12-03 18:50:18 -0800
commitf1d8d47da2edec723693c51300d1bd20f605501f (patch)
treeb22c3f4fc58819dbebeb17948a5dbb10220da490
parentd2f7b475c484e56b6d9fa38855cc128604f9a3a2 (diff)
parenta74f63454afdc757091c8d1e9c837354ac35a819 (diff)
downloadwpan-f1d8d47da2edec723693c51300d1bd20f605501f.tar.gz
Merge "wpan: Adds vendor library for TI's WiLink chipsets"
-rw-r--r--bluedroid_wilink/Android.mk40
-rw-r--r--bluedroid_wilink/libbt-vendor-ti.c107
-rw-r--r--ti-wpan-products.mk5
3 files changed, 150 insertions, 2 deletions
diff --git a/bluedroid_wilink/Android.mk b/bluedroid_wilink/Android.mk
new file mode 100644
index 0000000..a8009b9
--- /dev/null
+++ b/bluedroid_wilink/Android.mk
@@ -0,0 +1,40 @@
+#
+# Copyright 2001-2012 Texas Instruments, Inc. - http://www.ti.com/
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+BLUEDROID_PATH := external/bluetooth/bluedroid/
+include $(CLEAR_VARS)
+
+LOCAL_C_INCLUDES :=\
+ $(BLUEDROID_PATH)/hci/include
+
+LOCAL_CFLAGS:= -g -c -W -Wall -O2 -D_POSIX_SOURCE
+
+LOCAL_SRC_FILES += libbt-vendor-ti.c
+
+LOCAL_SHARED_LIBRARIES := \
+ libnativehelper \
+ libcutils \
+ libutils \
+ liblog
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libbt-vendor
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(ANDROID_PRODUCT_OUT)/system/vendor/lib
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/bluedroid_wilink/libbt-vendor-ti.c b/bluedroid_wilink/libbt-vendor-ti.c
new file mode 100644
index 0000000..a1eb81a
--- /dev/null
+++ b/bluedroid_wilink/libbt-vendor-ti.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2001-2012 Texas Instruments, Inc. - http://www.ti.com/
+ *
+ * Bluetooth Vendor Library for TI's WiLink Chipsets
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <dlfcn.h>
+#include <utils/Log.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <bt_vendor_lib.h>
+#include <bt_hci_lib.h>
+#include <bt_hci_bdroid.h>
+#include <utils.h>
+
+bt_vendor_callbacks_t *bt_vendor_cbacks = NULL;
+unsigned int hci_tty_fd = -1;
+void hw_config_cback(HC_BT_HDR *p_evt_buf);
+
+/*******************************************************************************
+ *
+ * Function hw_config_cback
+ *
+ * Description Callback function for controller configuration
+ *
+ * Returns None
+ *
+ * *******************************************************************************/
+void hw_config_cback(HC_BT_HDR *p_evt_buf)
+{
+ ALOGI("hw_config_cback");
+}
+
+int ti_init(const bt_vendor_callbacks_t* p_cb, unsigned char *local_bdaddr) {
+ ALOGI("vendor Init");
+
+ if (p_cb == NULL)
+ {
+ ALOGE("init failed with no user callbacks!");
+ return BT_HC_STATUS_FAIL;
+ }
+
+ bt_vendor_cbacks = (bt_vendor_callbacks_t *) p_cb;
+
+ return 0;
+}
+void ti_cleanup(void) {
+ ALOGI("vendor cleanup");
+
+ bt_vendor_cbacks = NULL;
+}
+int ti_op(bt_vendor_opcode_t opcode, void **param) {
+ int fd;
+ int *fd_array = (int (*)[]) param;
+
+ ALOGI("vendor op - %d", opcode);
+ switch(opcode)
+ {
+ case BT_VND_OP_USERIAL_OPEN:
+ fd = open("/dev/hci_tty", O_RDWR);
+ if (fd < 0) {
+ ALOGE(" Can't open hci_tty");
+ return -1;
+ }
+ fd_array[CH_CMD] = fd;
+ hci_tty_fd = fd; /* for userial_close op */
+ return 1; /* CMD/EVT/ACL on same fd */
+ case BT_VND_OP_USERIAL_CLOSE:
+ close(hci_tty_fd);
+ return 0;
+ /* Since new stack expects fwcfg_cb we are returning SUCCESS here
+ * in actual, firmware download is already happened when /dev/hci_tty
+ * opened.
+ */
+ case BT_VND_OP_FW_CFG:
+ bt_vendor_cbacks->fwcfg_cb(BT_VND_OP_RESULT_SUCCESS);
+ return 0;
+ default:
+ break;
+ }
+
+ return 0;
+}
+const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = {
+ .init = ti_init,
+ .op = ti_op,
+ .cleanup = ti_cleanup,
+};
+
+int main()
+{
+ return 0;
+}
diff --git a/ti-wpan-products.mk b/ti-wpan-products.mk
index d7b8e6a..7f79a85 100644
--- a/ti-wpan-products.mk
+++ b/ti-wpan-products.mk
@@ -10,7 +10,8 @@ PRODUCT_PACKAGES += uim-sysfs \
FmService \
libfmradio \
fmradioif \
- com.ti.fm.fmradioif.xml
+ com.ti.fm.fmradioif.xml \
+ libbt-vendor
#copy firmware
PRODUCT_COPY_FILES += \
@@ -25,4 +26,4 @@ PRODUCT_COPY_FILES += \
device/ti/proprietary-open/wl12xx/wpan/fmradio/fm_rx_init_1273.2.bts:system/etc/firmware/fm_rx_init_1273.2.bts \
device/ti/proprietary-open/wl12xx/wpan/fmradio/fm_tx_init_1273.2.bts:system/etc/firmware/fm_tx_init_1273.2.bts \
device/ti/proprietary-open/wl12xx/wpan/fmradio/fm_tx_ch8_1273.1.bts:system/etc/firmware/fm_tx_ch8_1273.1.bts \
- device/ti/proprietary-open/wl12xx/wpan/fmradio/fm_tx_ch8_1273.2.bts:system/etc/firmware/fm_tx_ch8_1273.2.bts
+ device/ti/proprietary-open/wl12xx/wpan/fmradio/fm_tx_ch8_1273.2.bts:system/etc/firmware/fm_tx_ch8_1273.2.bts \ No newline at end of file