├── msm8909 ├── libbt-vendor │ ├── MODULE_LICENSE_BSD │ ├── include │ │ ├── vnd_mako.txt │ │ ├── vnd_generic.txt │ │ ├── hci_smd.h │ │ ├── bt_vendor_qcom.h │ │ ├── bt_vendor_persist.h │ │ ├── hw_ar3k.h │ │ └── hci_uart.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── bt_vendor_persist.cpp │ │ ├── hci_smd.c │ │ └── hardware.c ├── Android.mk └── CleanSpec.mk ├── msm8909w_3100 ├── libbt-vendor │ ├── MODULE_LICENSE_BSD │ ├── include │ │ ├── vnd_generic.txt │ │ ├── vnd_mako.txt │ │ ├── hci_smd.h │ │ ├── bt_vendor_persist.h │ │ ├── bt_vendor_qcom.h │ │ └── hw_ar3k.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── bt_vendor_persist.cpp │ │ ├── hci_smd.c │ │ └── hardware.c └── Android.mk ├── METADATA ├── msm8996 ├── Android.mk ├── libbt-vendor │ ├── include │ │ ├── vnd_bullhead.txt │ │ ├── vnd_mako.txt │ │ ├── vnd_generic.txt │ │ ├── hci_smd.h │ │ ├── bt_vendor_qcom.h │ │ ├── bt_vendor_persist.h │ │ ├── hw_ar3k.h │ │ └── hci_uart.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── bt_vendor_persist.cpp │ │ ├── hci_smd.c │ │ └── hardware.c └── CleanSpec.mk ├── msm8992 ├── Android.mk ├── libbt-vendor │ ├── include │ │ ├── vnd_bullhead.txt │ │ ├── vnd_mako.txt │ │ ├── vnd_generic.txt │ │ ├── hci_smd.h │ │ ├── bt_vendor_qcom.h │ │ ├── bt_vendor_persist.h │ │ ├── hw_ar3k.h │ │ └── hci_uart.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── bt_vendor_persist.cpp │ │ ├── hci_smd.c │ │ └── hardware.c └── CleanSpec.mk ├── msm8960 ├── Android.mk ├── libbt-vendor │ ├── include │ │ ├── vnd_mako.txt │ │ ├── vnd_generic.txt │ │ ├── bt_vendor_qcom.h │ │ └── userial_vendor.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── userial_vendor.c │ │ ├── hardware.c │ │ └── bt_vendor_qcom.c └── CleanSpec.mk ├── msm8998 ├── Android.mk ├── libbt-vendor │ ├── include │ │ ├── vnd_mako.txt │ │ ├── vnd_generic.txt │ │ ├── hci_smd.h │ │ ├── bt_vendor_persist.h │ │ ├── bt_vendor_qcom.h │ │ └── hw_ar3k.h │ ├── vnd_buildcfg.mk │ ├── Android.mk │ └── src │ │ ├── bt_vendor_persist.cpp │ │ ├── hci_smd.c │ │ └── hardware.c └── CleanSpec.mk ├── OWNERS ├── libbt-vendor └── gen-buildcfg.sh └── Android.mk /msm8909/libbt-vendor/MODULE_LICENSE_BSD: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/MODULE_LICENSE_BSD: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /METADATA: -------------------------------------------------------------------------------- 1 | third_party { 2 | license_type: NOTICE 3 | } 4 | -------------------------------------------------------------------------------- /msm8996/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(filter msm8996,$(TARGET_BOARD_PLATFORM)),) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif 4 | -------------------------------------------------------------------------------- /msm8992/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(filter msm8994 msm8992,$(TARGET_BOARD_PLATFORM)),) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif 4 | -------------------------------------------------------------------------------- /msm8960/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(filter msm8960 msm8x27 msm8974 msm8226,$(TARGET_BOARD_PLATFORM)),) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif 4 | -------------------------------------------------------------------------------- /msm8909/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(filter msm8909,$(TARGET_BOARD_PLATFORM)),) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif # is-vendor-board-platform 4 | -------------------------------------------------------------------------------- /msm8998/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(call is-vendor-board-platform,QCOM),true) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif # is-vendor-board-platform 4 | -------------------------------------------------------------------------------- /msm8909w_3100/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(call is-vendor-board-platform,QCOM),true) 2 | include $(call all-named-subdir-makefiles,libbt-vendor) 3 | endif # is-vendor-board-platform 4 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | # Default code reviewers picked from top 3 or more developers. 2 | # Please update this list if you find better candidates. 3 | tstrudel@google.com 4 | vishwath@google.com 5 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/vnd_bullhead.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyHS0" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | QCOM_BT_SIBS_ENABLE = FALSE 4 | QCOM_BT_SOC_TYPE = 1 5 | BT_SOC_TYPE_ROME = TRUE 6 | BT_WAKE_VIA_PROC = FALSE 7 | WIFI_BT_STATUS_SYNC = FALSE 8 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/vnd_bullhead.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyHS0" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | QCOM_BT_SIBS_ENABLE = FALSE 4 | QCOM_BT_SOC_TYPE = 1 5 | BT_SOC_TYPE_ROME = TRUE 6 | BT_WAKE_VIA_PROC = FALSE 7 | WIFI_BT_STATUS_SYNC = FALSE 8 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/vnd_generic.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyO1" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/vnd_mako.txt: -------------------------------------------------------------------------------- 1 | BLUETOOTH_UART_DEVICE_PORT = "/dev/smd3" 2 | FW_PATCHFILE_LOCATION = "/vendor/firmware/" 3 | BT_WAKE_VIA_USERIAL_IOCTL = TRUE 4 | LPM_IDLE_TIMEOUT_MULTIPLE = 5 5 | SCO_USE_I2S_INTERFACE = TRUE 6 | BTVND_DBG = FALSE 7 | BTHW_DBG = TRUE 8 | VNDUSERIAL_DBG = FALSE 9 | UPIO_DBG = FALSE 10 | -------------------------------------------------------------------------------- /libbt-vendor/gen-buildcfg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ "" == "$2" ]] 4 | then 5 | echo "Usage: $0 " 6 | exit 1 7 | fi 8 | 9 | if [ ! -f "$1" ] 10 | then 11 | echo "Error: Can't find input file $1..." 12 | exit 2 13 | fi 14 | 15 | DATE=`/usr/bin/env date` 16 | BASE=`basename $2` 17 | BASE=`echo ${BASE} | tr "[:lower:]" "[:upper:]"` 18 | BASE=`echo ${BASE} | sed -e "s/\\./_/"` 19 | PROTECT="_${BASE}" 20 | 21 | echo "/* Auto-generated from $1 on ${DATE} */" > $2 22 | echo "#ifndef ${PROTECT}" >> $2 23 | echo "#define ${PROTECT}" >> $2 24 | sed -e '/^#/d' -e '/^$$/d' -e '/# Makefile only$$/d' -e 's/^/#define /' -e 's/=/ /' $1 >> $2 25 | echo "#endif" >> $2 26 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | # TODO: Find a better way to separate build configs for ADP vs non-ADP devices 3 | ifneq ($(BOARD_IS_AUTOMOTIVE),true) 4 | ifneq ($(filter msm8x27 msm8226,$(TARGET_BOARD_PLATFORM)),) 5 | include $(call all-named-subdir-makefiles,msm8960) 6 | else ifneq ($(filter msm8994,$(TARGET_BOARD_PLATFORM)),) 7 | include $(call all-named-subdir-makefiles,msm8992) 8 | else ifneq ($(filter msm8909,$(TARGET_BOARD_PLATFORM)),) 9 | ifeq ($(TARGET_SUPPORTS_QCOM_3100),true) 10 | include $(call all-named-subdir-makefiles,msm8909w_3100) 11 | else 12 | include $(call all-named-subdir-makefiles,msm8909) 13 | endif 14 | else ifneq ($(wildcard $(LOCAL_PATH)/$(TARGET_BOARD_PLATFORM)),) 15 | include $(call all-named-subdir-makefiles,$(TARGET_BOARD_PLATFORM)) 16 | endif 17 | endif 18 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | intermediates := $(local-intermediates-dir) 18 | 19 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 20 | ifeq (,$(wildcard $(SRC))) 21 | # configuration file does not exist. Use default one 22 | SRC := $(call my-dir)/include/vnd_generic.txt 23 | endif 24 | GEN := $(intermediates)/vnd_buildcfg.h 25 | TOOL := $(LOCAL_PATH)/gen-buildcfg.sh 26 | 27 | $(GEN): PRIVATE_PATH := $(call my-dir) 28 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 29 | $(GEN): $(SRC) $(TOOL) 30 | $(transform-generated-source) 31 | 32 | LOCAL_GENERATED_SOURCES += $(GEN) 33 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | intermediates := $(local-intermediates-dir) 18 | 19 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 20 | ifeq (,$(wildcard $(SRC))) 21 | # configuration file does not exist. Use default one 22 | SRC := $(call my-dir)/include/vnd_generic.txt 23 | endif 24 | GEN := $(intermediates)/vnd_buildcfg.h 25 | TOOL := $(LOCAL_PATH)/gen-buildcfg.sh 26 | 27 | $(GEN): PRIVATE_PATH := $(call my-dir) 28 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 29 | $(GEN): $(SRC) $(TOOL) 30 | $(transform-generated-source) 31 | 32 | LOCAL_GENERATED_SOURCES += $(GEN) 33 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | generated_sources := $(local-generated-sources-dir) 18 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 19 | ifeq (,$(wildcard $(SRC))) 20 | # configuration file does not exist. Use default one 21 | SRC := $(call my-dir)/include/vnd_generic.txt 22 | endif 23 | GEN := $(generated_sources)/vnd_buildcfg.h 24 | TOOL := $(TOP_DIR)hardware/broadcom/libbt/gen-buildcfg.sh 25 | 26 | $(GEN): PRIVATE_PATH := $(call my-dir) 27 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 28 | $(GEN): $(SRC) $(TOOL) 29 | $(transform-generated-source) 30 | 31 | LOCAL_GENERATED_SOURCES += $(GEN) 32 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | intermediates := $(local-intermediates-dir) 18 | 19 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 20 | ifeq (,$(wildcard $(SRC))) 21 | # configuration file does not exist. Use default one 22 | SRC := $(call my-dir)/include/vnd_generic.txt 23 | endif 24 | GEN := $(intermediates)/vnd_buildcfg.h 25 | TOOL := $(TOP_DIR)external/bluetooth/bluedroid/tools/gen-buildcfg.sh 26 | 27 | $(GEN): PRIVATE_PATH := $(call my-dir) 28 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 29 | $(GEN): $(SRC) $(TOOL) 30 | $(transform-generated-source) 31 | 32 | LOCAL_GENERATED_SOURCES += $(GEN) 33 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | intermediates := $(local-intermediates-dir) 18 | 19 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 20 | ifeq (,$(wildcard $(SRC))) 21 | # configuration file does not exist. Use default one 22 | SRC := $(call my-dir)/include/vnd_generic.txt 23 | endif 24 | GEN := $(intermediates)/vnd_buildcfg.h 25 | TOOL := $(TOP_DIR)external/bluetooth/bluedroid/tools/gen-buildcfg.sh 26 | 27 | $(GEN): PRIVATE_PATH := $(call my-dir) 28 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 29 | $(GEN): $(SRC) $(TOOL) 30 | $(transform-generated-source) 31 | 32 | LOCAL_GENERATED_SOURCES += $(GEN) 33 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/vnd_buildcfg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | intermediates := $(local-intermediates-dir) 18 | 19 | SRC := $(call my-dir)/include/$(addprefix vnd_, $(addsuffix .txt,$(basename $(TARGET_DEVICE)))) 20 | ifeq (,$(wildcard $(SRC))) 21 | # configuration file does not exist. Use default one 22 | SRC := $(call my-dir)/include/vnd_generic.txt 23 | endif 24 | GEN := $(intermediates)/vnd_buildcfg.h 25 | TOOL := $(TOP_DIR)external/bluetooth/bluedroid/tools/gen-buildcfg.sh 26 | 27 | $(GEN): PRIVATE_PATH := $(call my-dir) 28 | $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ 29 | $(GEN): $(SRC) $(TOOL) 30 | $(transform-generated-source) 31 | 32 | LOCAL_GENERATED_SOURCES += $(GEN) 33 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/hci_smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /****************************************************************************** 20 | * 21 | * Filename: hci_smd.h 22 | * 23 | * Description: Contains vendor-specific definitions used in smd controls 24 | * 25 | ******************************************************************************/ 26 | 27 | #ifndef HCI_SMD_H 28 | #define HCI_SMD_H 29 | 30 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 31 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 32 | 33 | int bt_hci_init_transport ( int *pFd ); 34 | 35 | int bt_hci_deinit_transport(int *pFd); 36 | 37 | #endif /* HCI_SMD_H */ 38 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/hci_smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /****************************************************************************** 20 | * 21 | * Filename: hci_smd.h 22 | * 23 | * Description: Contains vendor-specific definitions used in smd controls 24 | * 25 | ******************************************************************************/ 26 | 27 | #ifndef HCI_SMD_H 28 | #define HCI_SMD_H 29 | 30 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 31 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 32 | 33 | int bt_hci_init_transport ( int *pFd ); 34 | 35 | int bt_hci_deinit_transport(int *pFd); 36 | 37 | #endif /* HCI_SMD_H */ 38 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/hci_smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /****************************************************************************** 20 | * 21 | * Filename: hci_smd.h 22 | * 23 | * Description: Contains vendor-specific definitions used in smd controls 24 | * 25 | ******************************************************************************/ 26 | 27 | #ifndef HCI_SMD_H 28 | #define HCI_SMD_H 29 | 30 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 31 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 32 | 33 | int bt_hci_init_transport ( int *pFd ); 34 | 35 | int bt_hci_deinit_transport(int *pFd); 36 | 37 | #endif /* HCI_SMD_H */ 38 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/hci_smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /****************************************************************************** 20 | * 21 | * Filename: hci_smd.h 22 | * 23 | * Description: Contains vendor-specific definitions used in smd controls 24 | * 25 | ******************************************************************************/ 26 | 27 | #ifndef HCI_SMD_H 28 | #define HCI_SMD_H 29 | 30 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 31 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 32 | 33 | int bt_hci_init_transport ( int *pFd ); 34 | 35 | int bt_hci_deinit_transport(int *pFd); 36 | 37 | #endif /* HCI_SMD_H */ 38 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/hci_smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /****************************************************************************** 20 | * 21 | * Filename: hci_smd.h 22 | * 23 | * Description: Contains vendor-specific definitions used in smd controls 24 | * 25 | ******************************************************************************/ 26 | 27 | #ifndef HCI_SMD_H 28 | #define HCI_SMD_H 29 | 30 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 31 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 32 | 33 | int bt_hci_init_transport ( int *pFd ); 34 | 35 | int bt_hci_deinit_transport(int *pFd); 36 | 37 | #endif /* HCI_SMD_H */ 38 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifneq ($(BOARD_HAVE_BLUETOOTH_QCOM),) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | BDROID_DIR:= system/bt 24 | 25 | LOCAL_SRC_FILES := \ 26 | src/bt_vendor_qcom.c \ 27 | src/hardware.c \ 28 | src/userial_vendor.c 29 | 30 | LOCAL_C_INCLUDES += \ 31 | $(LOCAL_PATH)/include \ 32 | $(BDROID_DIR)/hci/include \ 33 | $(BDROID_DIR)/stack/include 34 | 35 | LOCAL_SHARED_LIBRARIES := \ 36 | libcutils \ 37 | liblog 38 | 39 | LOCAL_CFLAGS += -Wno-error 40 | LOCAL_MODULE := libbt-vendor 41 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 42 | LOCAL_LICENSE_CONDITIONS := notice 43 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 44 | LOCAL_MODULE_TAGS := optional 45 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 46 | LOCAL_MODULE_OWNER := qcom 47 | LOCAL_PROPRIETARY_MODULE := true 48 | 49 | include $(LOCAL_PATH)/vnd_buildcfg.mk 50 | 51 | include $(BUILD_SHARED_LIBRARY) 52 | 53 | endif # BOARD_HAVE_BLUETOOTH_QCOM 54 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include "bt_vendor_lib.h" 21 | #include "vnd_buildcfg.h" 22 | #include "userial_vendor.h" 23 | 24 | #ifndef FALSE 25 | #define FALSE 0 26 | #endif 27 | 28 | #ifndef TRUE 29 | #define TRUE (!FALSE) 30 | #endif 31 | 32 | // File discriptor using Transport 33 | extern int fd; 34 | 35 | extern bt_hci_transport_device_type bt_hci_transport_device; 36 | 37 | extern bt_vendor_callbacks_t *bt_vendor_cbacks; 38 | /* HW_NEED_END_WITH_HCI_RESET 39 | 40 | code implementation of sending a HCI_RESET command during the epilog 41 | process. It calls back to the callers after command complete of HCI_RESET 42 | is received. 43 | 44 | Default TRUE . 45 | */ 46 | #ifndef HW_NEED_END_WITH_HCI_RESET 47 | #define HW_NEED_END_WITH_HCI_RESET TRUE 48 | #endif 49 | 50 | #define HCI_RESET 0x0C03 51 | #define HCI_CMD_PREAMBLE_SIZE 3 52 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 53 | #define HCI_EVT_CMD_CMPL_OPCODE 3 54 | 55 | #endif /* BT_VENDOR_BRCM_H */ 56 | 57 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/include/userial_vendor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: userial_vendor.h 20 | * 21 | * Description: Contains vendor-specific definitions used in serial port 22 | * controls 23 | * 24 | ******************************************************************************/ 25 | 26 | #ifndef USERIAL_VENDOR_H 27 | #define USERIAL_VENDOR_H 28 | 29 | /* Variables to identify the platform */ 30 | /*BT HS UART TTY DEVICE */ 31 | #define BT_HS_UART_DEVICE "/dev/ttyHS0" 32 | /*BT RIVA-SMD CHANNELS */ 33 | #define APPS_RIVA_BT_ACL_CH "/dev/smd2" 34 | #define APPS_RIVA_BT_CMD_CH "/dev/smd3" 35 | 36 | typedef enum 37 | { 38 | BT_HCI_UART, 39 | BT_HCI_SMD, 40 | BT_HCI_NONE = 0xFF 41 | } bt_hci_transport_enum_type; 42 | 43 | typedef struct 44 | { 45 | /*transport type can be SMD/UART*/ 46 | bt_hci_transport_enum_type type; 47 | 48 | /*hci cmd/event packet is required to carry the Packet indicator for UART interfaces only 49 | and not required for smd */ 50 | int pkt_ind; 51 | 52 | /*transport device can be UART/SMD*/ 53 | char *name; 54 | 55 | } bt_hci_transport_device_type; 56 | 57 | bt_hci_transport_device_type bt_hci_set_transport(); 58 | 59 | int bt_hci_init_transport ( int *pFd ); 60 | 61 | int bt_hci_deinit_transport(int *pFd); 62 | 63 | #endif /* USERIAL_VENDOR_H */ 64 | 65 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include "bt_vendor_lib.h" 21 | //#include "vnd_buildcfg.h" 22 | 23 | #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 24 | #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 25 | #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 26 | 27 | #ifndef FALSE 28 | #define FALSE 0 29 | #endif 30 | 31 | #ifndef TRUE 32 | #define TRUE (!FALSE) 33 | #endif 34 | 35 | typedef enum { 36 | BT_SOC_DEFAULT = 0, 37 | BT_SOC_SMD = BT_SOC_DEFAULT, 38 | BT_SOC_ROME, 39 | BT_SOC_AR3K, 40 | /* Add chipset type here */ 41 | BT_SOC_RESERVED 42 | }bt_soc_type; 43 | 44 | 45 | extern bt_vendor_callbacks_t *bt_vendor_cbacks; 46 | /* HW_NEED_END_WITH_HCI_RESET 47 | 48 | code implementation of sending a HCI_RESET command during the epilog 49 | process. It calls back to the callers after command complete of HCI_RESET 50 | is received. 51 | 52 | Default TRUE . 53 | */ 54 | #ifndef HW_NEED_END_WITH_HCI_RESET 55 | #define HW_NEED_END_WITH_HCI_RESET TRUE 56 | #endif 57 | 58 | #define HCI_RESET 0x0C03 59 | #define HCI_CMD_PREAMBLE_SIZE 3 60 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 61 | #define HCI_EVT_CMD_CMPL_OPCODE 3 62 | 63 | #endif /* BT_VENDOR_QCOM_H */ 64 | 65 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include "bt_vendor_lib.h" 21 | //#include "vnd_buildcfg.h" 22 | 23 | 24 | #ifndef FALSE 25 | #define FALSE 0 26 | #endif 27 | 28 | #ifndef TRUE 29 | #define TRUE (!FALSE) 30 | #endif 31 | 32 | #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 33 | #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 34 | #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 35 | 36 | typedef enum { 37 | BT_SOC_DEFAULT = 0, 38 | BT_SOC_SMD = BT_SOC_DEFAULT, 39 | BT_SOC_ROME, 40 | BT_SOC_AR3K, 41 | /* Add chipset type here */ 42 | BT_SOC_RESERVED 43 | }bt_soc_type; 44 | 45 | typedef enum { 46 | BT_VND_OP_ANT_USERIAL_OPEN = 254, 47 | BT_VND_OP_ANT_USERIAL_CLOSE 48 | }ant_serial; 49 | 50 | extern bt_vendor_callbacks_t *bt_vendor_cbacks; 51 | /* HW_NEED_END_WITH_HCI_RESET 52 | 53 | code implementation of sending a HCI_RESET command during the epilog 54 | process. It calls back to the callers after command complete of HCI_RESET 55 | is received. 56 | 57 | Default TRUE . 58 | */ 59 | #ifndef HW_NEED_END_WITH_HCI_RESET 60 | #define HW_NEED_END_WITH_HCI_RESET TRUE 61 | #endif 62 | 63 | #define HCI_RESET 0x0C03 64 | #define HCI_CMD_PREAMBLE_SIZE 3 65 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 66 | #define HCI_EVT_CMD_CMPL_OPCODE 3 67 | 68 | #endif /* BT_VENDOR_QCOM_H */ 69 | 70 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include "bt_vendor_lib.h" 21 | //#include "vnd_buildcfg.h" 22 | 23 | 24 | #ifndef FALSE 25 | #define FALSE 0 26 | #endif 27 | 28 | #ifndef TRUE 29 | #define TRUE (!FALSE) 30 | #endif 31 | 32 | #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 33 | #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 34 | #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 35 | 36 | typedef enum { 37 | BT_SOC_DEFAULT = 0, 38 | BT_SOC_SMD = BT_SOC_DEFAULT, 39 | BT_SOC_ROME, 40 | BT_SOC_AR3K, 41 | /* Add chipset type here */ 42 | BT_SOC_RESERVED 43 | }bt_soc_type; 44 | 45 | typedef enum { 46 | BT_VND_OP_ANT_USERIAL_OPEN = 254, 47 | BT_VND_OP_ANT_USERIAL_CLOSE 48 | }ant_serial; 49 | 50 | extern bt_vendor_callbacks_t *bt_vendor_cbacks; 51 | /* HW_NEED_END_WITH_HCI_RESET 52 | 53 | code implementation of sending a HCI_RESET command during the epilog 54 | process. It calls back to the callers after command complete of HCI_RESET 55 | is received. 56 | 57 | Default TRUE . 58 | */ 59 | #ifndef HW_NEED_END_WITH_HCI_RESET 60 | #define HW_NEED_END_WITH_HCI_RESET TRUE 61 | #endif 62 | 63 | #define HCI_RESET 0x0C03 64 | #define HCI_CMD_PREAMBLE_SIZE 3 65 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 66 | #define HCI_EVT_CMD_CMPL_OPCODE 3 67 | 68 | #endif /* BT_VENDOR_QCOM_H */ 69 | 70 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/bt_vendor_persist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef BT_VENDOR_PERSIST_H_ 28 | #define BT_VENDOR_PERSIST_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif 34 | 35 | #include 36 | 37 | #ifdef BT_NV_SUPPORT 38 | 39 | #endif /* BT_NV_SUPPORT */ 40 | typedef unsigned char boolean; 41 | /*=========================================================================== 42 | FUNCTION bt_vendor_nv_read 43 | 44 | DESCRIPTION 45 | Helper Routine to process the nv read command 46 | 47 | DEPENDENCIES 48 | NIL 49 | 50 | RETURN VALUE 51 | RETURN VALUE 52 | FALSE = failure, else TRUE 53 | 54 | SIDE EFFECTS 55 | None 56 | 57 | ===========================================================================*/ 58 | extern uint8_t bt_vendor_nv_read 59 | ( 60 | uint8_t nv_item, 61 | uint8_t * rsp_buf 62 | ); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* BT_VENDOR_PERSIST_H_ */ 69 | 70 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/bt_vendor_persist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef BT_VENDOR_PERSIST_H_ 28 | #define BT_VENDOR_PERSIST_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif 34 | 35 | #include 36 | 37 | #ifdef BT_NV_SUPPORT 38 | 39 | #endif /* BT_NV_SUPPORT */ 40 | typedef unsigned char boolean; 41 | /*=========================================================================== 42 | FUNCTION bt_vendor_nv_read 43 | 44 | DESCRIPTION 45 | Helper Routine to process the nv read command 46 | 47 | DEPENDENCIES 48 | NIL 49 | 50 | RETURN VALUE 51 | RETURN VALUE 52 | FALSE = failure, else TRUE 53 | 54 | SIDE EFFECTS 55 | None 56 | 57 | ===========================================================================*/ 58 | extern uint8_t bt_vendor_nv_read 59 | ( 60 | uint8_t nv_item, 61 | uint8_t * rsp_buf 62 | ); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* BT_VENDOR_PERSIST_H_ */ 69 | 70 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifeq ($(BOARD_HAVE_BLUETOOTH_QCOM),true) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | BDROID_DIR:= system/bt 24 | 25 | LOCAL_SRC_FILES := \ 26 | src/bt_vendor_qcom.c \ 27 | src/hardware.c \ 28 | src/hci_uart.c \ 29 | src/hci_smd.c \ 30 | src/hw_rome.c \ 31 | src/hw_ar3k.c 32 | 33 | # if read from bt nv 34 | # src/bt_vendor_persist.cpp 35 | 36 | ifeq ($(QCOM_BT_USE_SIBS),true) 37 | LOCAL_CFLAGS += -DQCOM_BT_SIBS_ENABLE 38 | endif 39 | 40 | ifeq ($(BOARD_HAS_QCA_BT_ROME),true) 41 | LOCAL_CFLAGS += -DBT_SOC_TYPE_ROME 42 | endif 43 | 44 | LOCAL_C_INCLUDES += \ 45 | $(LOCAL_PATH)/include \ 46 | $(BDROID_DIR)/hci/include \ 47 | $(TARGET_OUT_HEADERS)/bt/hci_qcomm_init 48 | 49 | ifeq ($(BOARD_HAS_QCA_BT_AR3002), true) 50 | LOCAL_C_FLAGS := \ 51 | -DBT_WAKE_VIA_PROC 52 | endif #BOARD_HAS_QCA_BT_AR3002 53 | 54 | ifeq ($(WIFI_BT_STATUS_SYNC), true) 55 | LOCAL_CFLAGS += -DWIFI_BT_STATUS_SYNC 56 | endif #WIFI_BT_STATUS_SYNC 57 | 58 | LOCAL_SHARED_LIBRARIES := \ 59 | libcutils \ 60 | liblog 61 | 62 | 63 | # if read from bt nv 64 | # libbtnv 65 | #LOCAL_CFLAGS += -DBT_NV_SUPPORT 66 | 67 | LOCAL_CFLAGS += -Wno-error 68 | LOCAL_MODULE := libbt-vendor 69 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_not_a_contribution 70 | LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice 71 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 72 | LOCAL_MODULE_TAGS := optional 73 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 74 | LOCAL_MODULE_OWNER := qcom 75 | 76 | #LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP 77 | 78 | #include $(LOCAL_PATH)/vnd_buildcfg.mk 79 | 80 | include $(BUILD_SHARED_LIBRARY) 81 | 82 | endif # BOARD_HAVE_BLUETOOTH_QCOM 83 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/bt_vendor_persist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef BT_VENDOR_PERSIST_H_ 28 | #define BT_VENDOR_PERSIST_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif 34 | 35 | #include 36 | 37 | #ifdef BT_NV_SUPPORT 38 | 39 | #endif /* BT_NV_SUPPORT */ 40 | typedef unsigned char boolean; 41 | /*=========================================================================== 42 | FUNCTION bt_vendor_nv_read 43 | 44 | DESCRIPTION 45 | Helper Routine to process the nv read command 46 | 47 | DEPENDENCIES 48 | NIL 49 | 50 | RETURN VALUE 51 | RETURN VALUE 52 | FALSE = failure, else TRUE 53 | 54 | SIDE EFFECTS 55 | None 56 | 57 | ===========================================================================*/ 58 | extern uint8_t bt_vendor_nv_read 59 | ( 60 | uint8_t nv_item, 61 | uint8_t * rsp_buf 62 | ); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* BT_VENDOR_PERSIST_H_ */ 69 | 70 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/bt_vendor_persist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef BT_VENDOR_PERSIST_H_ 28 | #define BT_VENDOR_PERSIST_H_ 29 | 30 | #ifdef BT_NV_SUPPORT 31 | 32 | #ifdef __cplusplus 33 | extern "C" 34 | { 35 | #endif 36 | 37 | #include 38 | 39 | //#ifdef BT_NV_SUPPORT 40 | 41 | //#endif /* BT_NV_SUPPORT */ 42 | typedef unsigned char boolean; 43 | /*=========================================================================== 44 | FUNCTION bt_vendor_nv_read 45 | 46 | DESCRIPTION 47 | Helper Routine to process the nv read command 48 | 49 | DEPENDENCIES 50 | NIL 51 | 52 | RETURN VALUE 53 | RETURN VALUE 54 | FALSE = failure, else TRUE 55 | 56 | SIDE EFFECTS 57 | None 58 | 59 | ===========================================================================*/ 60 | extern uint8_t bt_vendor_nv_read 61 | ( 62 | uint8_t nv_item, 63 | uint8_t * rsp_buf 64 | ); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* BT_NV_SUPPORT */ 71 | 72 | #endif /* BT_VENDOR_PERSIST_H_ */ 73 | 74 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/bt_vendor_persist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef BT_VENDOR_PERSIST_H_ 28 | #define BT_VENDOR_PERSIST_H_ 29 | 30 | #ifdef BT_NV_SUPPORT 31 | 32 | #ifdef __cplusplus 33 | extern "C" 34 | { 35 | #endif 36 | 37 | #include 38 | 39 | //#ifdef BT_NV_SUPPORT 40 | 41 | //#endif /* BT_NV_SUPPORT */ 42 | typedef unsigned char boolean; 43 | /*=========================================================================== 44 | FUNCTION bt_vendor_nv_read 45 | 46 | DESCRIPTION 47 | Helper Routine to process the nv read command 48 | 49 | DEPENDENCIES 50 | NIL 51 | 52 | RETURN VALUE 53 | RETURN VALUE 54 | FALSE = failure, else TRUE 55 | 56 | SIDE EFFECTS 57 | None 58 | 59 | ===========================================================================*/ 60 | extern uint8_t bt_vendor_nv_read 61 | ( 62 | uint8_t nv_item, 63 | uint8_t * rsp_buf 64 | ); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* BT_NV_SUPPORT */ 71 | 72 | #endif /* BT_VENDOR_PERSIST_H_ */ 73 | 74 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifeq ($(BOARD_HAVE_BLUETOOTH_QCOM),true) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | 24 | LOCAL_SRC_FILES := \ 25 | src/bt_vendor_qcom.c \ 26 | src/hardware.c \ 27 | src/hci_uart.c \ 28 | src/hci_smd.c \ 29 | src/hw_rome.c \ 30 | src/hw_ar3k.c \ 31 | src/bt_vendor_persist.cpp 32 | 33 | ifeq ($(QCOM_BT_USE_SIBS),true) 34 | LOCAL_CFLAGS += -DQCOM_BT_SIBS_ENABLE 35 | endif 36 | 37 | ifeq ($(BOARD_HAS_QCA_BT_ROME),true) 38 | LOCAL_CFLAGS += -DBT_SOC_TYPE_ROME 39 | endif 40 | 41 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 42 | LOCAL_CFLAGS += -DPANIC_ON_SOC_CRASH 43 | endif 44 | 45 | LOCAL_C_INCLUDES += \ 46 | $(LOCAL_PATH)/include \ 47 | external/bluetooth/bluedroid/hci/include \ 48 | system/bt/hci/include \ 49 | $(TARGET_OUT_HEADERS)/bt/hci_qcomm_init 50 | 51 | ifeq ($(BOARD_HAS_QCA_BT_AR3002), true) 52 | LOCAL_C_FLAGS := \ 53 | -DBT_WAKE_VIA_PROC 54 | endif #BOARD_HAS_QCA_BT_AR3002 55 | 56 | ifeq ($(WIFI_BT_STATUS_SYNC), true) 57 | LOCAL_CFLAGS += -DWIFI_BT_STATUS_SYNC 58 | endif #WIFI_BT_STATUS_SYNC 59 | 60 | LOCAL_SHARED_LIBRARIES := \ 61 | libcutils \ 62 | liblog \ 63 | libbtnv 64 | 65 | LOCAL_CFLAGS += -Wno-error 66 | LOCAL_MODULE := libbt-vendor 67 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_not_a_contribution 68 | LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice 69 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 70 | #LOCAL_CLANG := false 71 | LOCAL_CXX_STL := none 72 | LOCAL_MODULE_TAGS := optional 73 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 74 | LOCAL_MODULE_OWNER := qcom 75 | 76 | LOCAL_VENDOR_MODULE := true 77 | 78 | LOCAL_CFLAGS += -DBT_NV_SUPPORT 79 | 80 | ifneq ($(BOARD_ANT_WIRELESS_DEVICE),) 81 | LOCAL_CFLAGS += -DENABLE_ANT 82 | endif 83 | #LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP 84 | 85 | #include $(LOCAL_PATH)/vnd_buildcfg.mk 86 | 87 | include $(BUILD_SHARED_LIBRARY) 88 | 89 | endif # BOARD_HAVE_BLUETOOTH_QCOM 90 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifeq ($(BOARD_HAVE_BLUETOOTH_QCOM),true) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | BDROID_DIR:= system/bt 24 | 25 | LOCAL_SRC_FILES := \ 26 | src/bt_vendor_qcom.c \ 27 | src/hardware.c \ 28 | src/hci_uart.c \ 29 | src/hci_smd.c \ 30 | src/hw_rome.c \ 31 | src/hw_ar3k.c 32 | 33 | # if read from bt nv 34 | # src/bt_vendor_persist.cpp 35 | 36 | ifeq ($(QCOM_BT_USE_SIBS),true) 37 | LOCAL_CFLAGS += -DQCOM_BT_SIBS_ENABLE 38 | endif 39 | 40 | ifeq ($(BOARD_HAS_QCA_BT_ROME),true) 41 | LOCAL_CFLAGS += -DBT_SOC_TYPE_ROME 42 | endif 43 | 44 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 45 | LOCAL_CFLAGS += -DPANIC_ON_SOC_CRASH 46 | endif 47 | 48 | LOCAL_C_INCLUDES += \ 49 | $(LOCAL_PATH)/include \ 50 | external/bluetooth/bluedroid/hci/include \ 51 | system/bt/hci/include \ 52 | $(TARGET_OUT_HEADERS)/bt/hci_qcomm_init 53 | 54 | ifeq ($(BOARD_HAS_QCA_BT_AR3002), true) 55 | LOCAL_C_FLAGS := \ 56 | -DBT_WAKE_VIA_PROC 57 | endif #BOARD_HAS_QCA_BT_AR3002 58 | 59 | ifeq ($(WIFI_BT_STATUS_SYNC), true) 60 | LOCAL_CFLAGS += -DWIFI_BT_STATUS_SYNC 61 | endif #WIFI_BT_STATUS_SYNC 62 | 63 | LOCAL_SHARED_LIBRARIES := \ 64 | libcutils \ 65 | liblog 66 | 67 | 68 | # if read from bt nv 69 | # libbtnv 70 | #LOCAL_CFLAGS += -DBT_NV_SUPPORT 71 | 72 | LOCAL_CFLAGS += -Wno-error 73 | LOCAL_MODULE := libbt-vendor 74 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_not_a_contribution 75 | LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice 76 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 77 | LOCAL_MODULE_TAGS := optional 78 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 79 | LOCAL_MODULE_OWNER := qcom 80 | 81 | LOCAL_VENDOR_MODULE := true 82 | 83 | ifneq ($(BOARD_ANT_WIRELESS_DEVICE),) 84 | LOCAL_CFLAGS += -DENABLE_ANT 85 | endif 86 | #LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP 87 | 88 | #include $(LOCAL_PATH)/vnd_buildcfg.mk 89 | 90 | include $(BUILD_SHARED_LIBRARY) 91 | 92 | endif # BOARD_HAVE_BLUETOOTH_QCOM 93 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include 21 | #include "bt_vendor_lib.h" 22 | 23 | #ifndef FALSE 24 | #define FALSE 0 25 | #endif 26 | 27 | #ifndef TRUE 28 | #define TRUE (!FALSE) 29 | #endif 30 | 31 | #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 32 | #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 33 | #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 34 | 35 | typedef enum { 36 | BT_SOC_DEFAULT = 0, 37 | BT_SOC_SMD = BT_SOC_DEFAULT, 38 | BT_SOC_AR3K, 39 | BT_SOC_ROME, 40 | BT_SOC_CHEROKEE, 41 | /* Add chipset type here */ 42 | BT_SOC_RESERVED 43 | }bt_soc_type; 44 | 45 | typedef enum { 46 | BT_VND_OP_ANT_USERIAL_OPEN = 254, 47 | BT_VND_OP_ANT_USERIAL_CLOSE 48 | }ant_serial; 49 | 50 | /* HW_NEED_END_WITH_HCI_RESET 51 | 52 | code implementation of sending a HCI_RESET command during the epilog 53 | process. It calls back to the callers after command complete of HCI_RESET 54 | is received. 55 | 56 | Default TRUE . 57 | */ 58 | #ifndef HW_NEED_END_WITH_HCI_RESET 59 | #define HW_NEED_END_WITH_HCI_RESET TRUE 60 | #endif 61 | 62 | #define HCI_RESET 0x0C03 63 | #define HCI_CMD_PREAMBLE_SIZE 3 64 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 65 | #define HCI_EVT_CMD_CMPL_OPCODE 3 66 | #define BT_PWR_CNTRL_DEVICE "/dev/btpower" 67 | 68 | enum { 69 | BT_STATUS_SUCCESS = 0, 70 | BT_STATUS_FAIL, 71 | BT_STATUS_INVAL, 72 | BT_STATUS_NOMEM, 73 | BT_STATUS_PROP_FAILURE, 74 | }; 75 | #define BT_CMD_PWR_CTRL 0xbfad 76 | struct bt_qcom_struct { 77 | int fd[2]; 78 | int ant_fd; 79 | int fm_fd; 80 | bt_vendor_callbacks_t *cb; 81 | uint8_t bdaddr[6]; 82 | int soc_type; 83 | int rfkill_id; 84 | char *rfkill_state; 85 | bool enable_extldo; 86 | }; 87 | extern struct bt_qcom_struct *q; 88 | extern pthread_mutex_t q_lock; 89 | 90 | #endif /* BT_VENDOR_QCOM_H */ 91 | 92 | -------------------------------------------------------------------------------- /msm8909/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbt-vendor_intermediates) 51 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/NOTICE_FILES/src/system/vendor/lib/libbt-vendor.so.txt) 52 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libbt-vendor.so) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/vendor/lib/libbt-vendor.so) 54 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib/libbt-vendor.so) 55 | -------------------------------------------------------------------------------- /msm8960/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbt-vendor_intermediates) 51 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/NOTICE_FILES/src/system/vendor/lib/libbt-vendor.so.txt) 52 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libbt-vendor.so) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/vendor/lib/libbt-vendor.so) 54 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib/libbt-vendor.so) 55 | -------------------------------------------------------------------------------- /msm8992/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbt-vendor_intermediates) 51 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/NOTICE_FILES/src/system/vendor/lib/libbt-vendor.so.txt) 52 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libbt-vendor.so) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/vendor/lib/libbt-vendor.so) 54 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib/libbt-vendor.so) 55 | -------------------------------------------------------------------------------- /msm8996/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbt-vendor_intermediates) 51 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/NOTICE_FILES/src/system/vendor/lib/libbt-vendor.so.txt) 52 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libbt-vendor.so) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/vendor/lib/libbt-vendor.so) 54 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib/libbt-vendor.so) 55 | -------------------------------------------------------------------------------- /msm8998/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbt-vendor_intermediates) 51 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/NOTICE_FILES/src/system/vendor/lib/libbt-vendor.so.txt) 52 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libbt-vendor.so) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/vendor/lib/libbt-vendor.so) 54 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib/libbt-vendor.so) 55 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifeq ($(BOARD_HAVE_BLUETOOTH_QCOM),true) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | 24 | LOCAL_SRC_FILES := \ 25 | src/bt_vendor_qcom.c \ 26 | src/hardware.c \ 27 | src/hci_uart.c \ 28 | src/hci_smd.c \ 29 | src/hw_rome.c \ 30 | src/hw_ar3k.c \ 31 | src/bt_vendor_persist.cpp 32 | 33 | #Disable this flag in case if FM over UART support not needed 34 | ifneq ($(TARGET_SUPPORTS_WEARABLES),true) 35 | LOCAL_CFLAGS := -DFM_OVER_UART 36 | endif 37 | 38 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 39 | LOCAL_CFLAGS += -DPANIC_ON_SOC_CRASH 40 | LOCAL_CFLAGS += -DENABLE_DBG_FLAGS 41 | endif 42 | 43 | LOCAL_C_INCLUDES += \ 44 | $(LOCAL_PATH)/include \ 45 | external/bluetooth/bluedroid/hci/include \ 46 | system/bt/hci/include \ 47 | $(TARGET_OUT_HEADERS)/bt/hci_qcomm_init 48 | 49 | ifeq ($(BOARD_HAS_QCA_BT_AR3002), true) 50 | LOCAL_C_FLAGS := \ 51 | -DBT_WAKE_VIA_PROC 52 | endif #BOARD_HAS_QCA_BT_AR3002 53 | 54 | ifeq ($(WIFI_BT_STATUS_SYNC), true) 55 | LOCAL_CFLAGS += -DWIFI_BT_STATUS_SYNC 56 | endif #WIFI_BT_STATUS_SYNC 57 | 58 | LOCAL_SHARED_LIBRARIES := \ 59 | libcutils \ 60 | liblog \ 61 | libbtnv 62 | 63 | LOCAL_CFLAGS += -Wno-error 64 | LOCAL_MODULE := libbt-vendor 65 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_not_a_contribution 66 | LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice 67 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 68 | LOCAL_MODULE_TAGS := optional 69 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 70 | LOCAL_MODULE_OWNER := qcom 71 | 72 | ifdef TARGET_2ND_ARCH 73 | LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib 74 | LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 75 | else 76 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) 77 | endif 78 | 79 | LOCAL_CFLAGS += -DBT_NV_SUPPORT 80 | 81 | ifneq ($(BOARD_ANT_WIRELESS_DEVICE),) 82 | LOCAL_CFLAGS += -DENABLE_ANT 83 | endif 84 | #LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP 85 | 86 | #include $(LOCAL_PATH)/vnd_buildcfg.mk 87 | 88 | include $(BUILD_SHARED_LIBRARY) 89 | 90 | endif # BOARD_HAVE_BLUETOOTH_QCOM 91 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/bt_vendor_qcom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BT_VENDOR_QCOM_H 18 | #define BT_VENDOR_QCOM_H 19 | 20 | #include 21 | #include "bt_vendor_lib.h" 22 | 23 | #ifndef FALSE 24 | #define FALSE 0 25 | #endif 26 | 27 | #ifndef TRUE 28 | #define TRUE (!FALSE) 29 | #endif 30 | 31 | #define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 32 | #define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 33 | #define UINT32_TO_STREAM(p, u32) {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8); *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 34 | 35 | typedef enum { 36 | BT_SOC_DEFAULT = 0, 37 | BT_SOC_SMD = BT_SOC_DEFAULT, 38 | BT_SOC_AR3K, 39 | BT_SOC_ROME, 40 | BT_SOC_CHEROKEE, 41 | /* Add chipset type here */ 42 | BT_SOC_RESERVED 43 | }bt_soc_type; 44 | 45 | typedef enum { 46 | FM_VND_OP_POWER_CTRL = (unsigned int)BT_VND_OP_A2DP_OFFLOAD_STOP + 1, 47 | BT_VND_OP_FM_USERIAL_OPEN, 48 | BT_VND_OP_FM_USERIAL_CLOSE, 49 | }bt_fm_serial; 50 | 51 | typedef enum { 52 | BT_VND_OP_ANT_USERIAL_OPEN = 254, 53 | BT_VND_OP_ANT_USERIAL_CLOSE 54 | }ant_serial; 55 | 56 | /* HW_NEED_END_WITH_HCI_RESET 57 | 58 | code implementation of sending a HCI_RESET command during the epilog 59 | process. It calls back to the callers after command complete of HCI_RESET 60 | is received. 61 | 62 | Default TRUE . 63 | */ 64 | #ifndef HW_NEED_END_WITH_HCI_RESET 65 | #define HW_NEED_END_WITH_HCI_RESET TRUE 66 | #endif 67 | 68 | #define HCI_RESET 0x0C03 69 | #define HCI_CMD_PREAMBLE_SIZE 3 70 | #define HCI_EVT_CMD_CMPL_STATUS_RET_BYTE 5 71 | #define HCI_EVT_CMD_CMPL_OPCODE 3 72 | #define BT_PWR_CNTRL_DEVICE "/dev/btpower" 73 | 74 | enum { 75 | BT_STATUS_SUCCESS = 0, 76 | BT_STATUS_FAIL, 77 | BT_STATUS_INVAL, 78 | BT_STATUS_NOMEM, 79 | BT_STATUS_PROP_FAILURE, 80 | }; 81 | #define BT_CMD_PWR_CTRL 0xbfad 82 | struct bt_qcom_struct { 83 | int fd[2]; 84 | int ant_fd; 85 | int fm_fd; 86 | bt_vendor_callbacks_t *cb; 87 | uint8_t bdaddr[6]; 88 | int soc_type; 89 | int rfkill_id; 90 | char *rfkill_state; 91 | bool enable_extldo; 92 | }; 93 | extern struct bt_qcom_struct q; 94 | 95 | #endif /* BT_VENDOR_QCOM_H */ 96 | 97 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | ifeq ($(BOARD_HAVE_BLUETOOTH_QCOM),true) 20 | 21 | include $(CLEAR_VARS) 22 | 23 | 24 | LOCAL_SRC_FILES := \ 25 | src/bt_vendor_qcom.c \ 26 | src/hardware.c \ 27 | src/hci_uart.c \ 28 | src/hci_smd.c \ 29 | src/hw_rome.c \ 30 | src/hw_ar3k.c 31 | 32 | ifneq ($(TARGET_USES_AOSP),true) 33 | #Disable this flag in case if FM over UART support not needed 34 | ifeq ($(QCOM_BT_FM_OVER_UART),true) 35 | LOCAL_CFLAGS := -DFM_OVER_UART 36 | endif 37 | endif 38 | 39 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 40 | LOCAL_CFLAGS += -DPANIC_ON_SOC_CRASH 41 | LOCAL_CFLAGS += -DENABLE_DBG_FLAGS 42 | endif 43 | 44 | LOCAL_C_INCLUDES += \ 45 | $(LOCAL_PATH)/include \ 46 | external/bluetooth/bluedroid/hci/include \ 47 | system/bt/hci/include \ 48 | $(TARGET_OUT_HEADERS)/bt/hci_qcomm_init \ 49 | $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include 50 | 51 | ifeq ($(TARGET_COMPILE_WITH_MSM_KERNEL),true) 52 | LOCAL_ADDITIONAL_DEPENDENCIES += \ 53 | $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr 54 | endif 55 | 56 | ifeq ($(BOARD_HAS_QCA_BT_AR3002), true) 57 | LOCAL_C_FLAGS := \ 58 | -DBT_WAKE_VIA_PROC 59 | endif #BOARD_HAS_QCA_BT_AR3002 60 | 61 | ifeq ($(WIFI_BT_STATUS_SYNC), true) 62 | LOCAL_CFLAGS += -DWIFI_BT_STATUS_SYNC 63 | endif #WIFI_BT_STATUS_SYNC 64 | 65 | LOCAL_SHARED_LIBRARIES := \ 66 | libcutils \ 67 | liblog 68 | 69 | LOCAL_HEADER_LIBRARIES := \ 70 | libutils_headers 71 | 72 | LOCAL_MODULE := libbt-vendor 73 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_not_a_contribution 74 | LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice 75 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 76 | LOCAL_MODULE_TAGS := optional 77 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 78 | LOCAL_MODULE_OWNER := qcom 79 | 80 | LOCAL_VENDOR_MODULE := true 81 | 82 | #LOCAL_CFLAGS += -DBT_NV_SUPPORT 83 | 84 | ifneq ($(BOARD_ANT_WIRELESS_DEVICE),) 85 | LOCAL_CFLAGS += -DENABLE_ANT 86 | endif 87 | #LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP 88 | 89 | LOCAL_CFLAGS += \ 90 | -Wall \ 91 | -Werror \ 92 | -Wno-error=user-defined-warnings \ 93 | -Wno-incompatible-pointer-types-discards-qualifiers \ 94 | -Wno-unused-function \ 95 | -Wno-unused-label \ 96 | -Wno-unused-variable \ 97 | 98 | #include $(LOCAL_PATH)/vnd_buildcfg.mk 99 | 100 | include $(BUILD_SHARED_LIBRARY) 101 | 102 | endif # BOARD_HAVE_BLUETOOTH_QCOM 103 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/src/bt_vendor_persist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "bt_vendor_persist.h" 28 | 29 | #ifdef BT_NV_SUPPORT 30 | #include "bt_nv.h" 31 | #include 32 | 33 | /*=========================================================================== 34 | FUNCTION bt_vendor_nv_read 35 | 36 | DESCRIPTION 37 | Helper Routine to process the nv read command 38 | 39 | DEPENDENCIES 40 | NIL 41 | 42 | RETURN VALUE 43 | RETURN VALUE 44 | FALSE = failure, else TRUE 45 | 46 | SIDE EFFECTS 47 | None 48 | 49 | ===========================================================================*/ 50 | uint8_t bt_vendor_nv_read 51 | ( 52 | uint8_t nv_item, 53 | uint8_t * rsp_buf 54 | ) 55 | { 56 | nv_persist_item_type my_nv_item; 57 | nv_persist_stat_enum_type cmd_result; 58 | boolean result = FALSE; 59 | 60 | switch(nv_item) 61 | { 62 | case NV_BD_ADDR_I: 63 | cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item); 64 | ALOGI("CMD result: %d", cmd_result); 65 | if (NV_SUCCESS != cmd_result) 66 | { 67 | ALOGE("Failed to read BD_ADDR from NV"); 68 | /* Send fail response */ 69 | result = FALSE; 70 | } 71 | else 72 | { 73 | /* copy bytes */ 74 | rsp_buf[0] = my_nv_item.bd_addr[0]; 75 | rsp_buf[1] = my_nv_item.bd_addr[1]; 76 | rsp_buf[2] = my_nv_item.bd_addr[2]; 77 | rsp_buf[3] = my_nv_item.bd_addr[3]; 78 | rsp_buf[4] = my_nv_item.bd_addr[4]; 79 | rsp_buf[5] = my_nv_item.bd_addr[5]; 80 | 81 | ALOGI("BD address read for NV_BD_ADDR_I: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 82 | (unsigned int) my_nv_item.bd_addr[0],(unsigned int) my_nv_item.bd_addr[1], 83 | (unsigned int) my_nv_item.bd_addr[2],(unsigned int) my_nv_item.bd_addr[3], 84 | (unsigned int) my_nv_item.bd_addr[4],(unsigned int) my_nv_item.bd_addr[5]); 85 | result = TRUE; 86 | } 87 | break; 88 | } 89 | return result; 90 | } 91 | #endif /* End of BT_NV_SUPPORT */ 92 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/src/bt_vendor_persist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "bt_vendor_persist.h" 28 | 29 | #ifdef BT_NV_SUPPORT 30 | #include "bt_nv.h" 31 | #include 32 | 33 | /*=========================================================================== 34 | FUNCTION bt_vendor_nv_read 35 | 36 | DESCRIPTION 37 | Helper Routine to process the nv read command 38 | 39 | DEPENDENCIES 40 | NIL 41 | 42 | RETURN VALUE 43 | RETURN VALUE 44 | FALSE = failure, else TRUE 45 | 46 | SIDE EFFECTS 47 | None 48 | 49 | ===========================================================================*/ 50 | uint8_t bt_vendor_nv_read 51 | ( 52 | uint8_t nv_item, 53 | uint8_t * rsp_buf 54 | ) 55 | { 56 | nv_persist_item_type my_nv_item; 57 | nv_persist_stat_enum_type cmd_result; 58 | boolean result = FALSE; 59 | 60 | switch(nv_item) 61 | { 62 | case NV_BD_ADDR_I: 63 | cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item); 64 | ALOGI("CMD result: %d", cmd_result); 65 | if (NV_SUCCESS != cmd_result) 66 | { 67 | ALOGE("Failed to read BD_ADDR from NV"); 68 | /* Send fail response */ 69 | result = FALSE; 70 | } 71 | else 72 | { 73 | /* copy bytes */ 74 | rsp_buf[0] = my_nv_item.bd_addr[0]; 75 | rsp_buf[1] = my_nv_item.bd_addr[1]; 76 | rsp_buf[2] = my_nv_item.bd_addr[2]; 77 | rsp_buf[3] = my_nv_item.bd_addr[3]; 78 | rsp_buf[4] = my_nv_item.bd_addr[4]; 79 | rsp_buf[5] = my_nv_item.bd_addr[5]; 80 | 81 | ALOGI("BD address read for NV_BD_ADDR_I: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 82 | (unsigned int) my_nv_item.bd_addr[0],(unsigned int) my_nv_item.bd_addr[1], 83 | (unsigned int) my_nv_item.bd_addr[2],(unsigned int) my_nv_item.bd_addr[3], 84 | (unsigned int) my_nv_item.bd_addr[4],(unsigned int) my_nv_item.bd_addr[5]); 85 | result = TRUE; 86 | } 87 | break; 88 | } 89 | return result; 90 | } 91 | #endif /* End of BT_NV_SUPPORT */ 92 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/src/bt_vendor_persist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "bt_vendor_persist.h" 28 | 29 | #ifdef BT_NV_SUPPORT 30 | #include "bt_nv.h" 31 | #include 32 | 33 | /*=========================================================================== 34 | FUNCTION bt_vendor_nv_read 35 | 36 | DESCRIPTION 37 | Helper Routine to process the nv read command 38 | 39 | DEPENDENCIES 40 | NIL 41 | 42 | RETURN VALUE 43 | RETURN VALUE 44 | FALSE = failure, else TRUE 45 | 46 | SIDE EFFECTS 47 | None 48 | 49 | ===========================================================================*/ 50 | uint8_t bt_vendor_nv_read 51 | ( 52 | uint8_t nv_item, 53 | uint8_t * rsp_buf 54 | ) 55 | { 56 | nv_persist_item_type my_nv_item; 57 | nv_persist_stat_enum_type cmd_result; 58 | boolean result = FALSE; 59 | 60 | switch(nv_item) 61 | { 62 | case NV_BD_ADDR_I: 63 | cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item); 64 | ALOGI("CMD result: %d", cmd_result); 65 | if (NV_SUCCESS != cmd_result) 66 | { 67 | ALOGE("Failed to read BD_ADDR from NV"); 68 | /* Send fail response */ 69 | result = FALSE; 70 | } 71 | else 72 | { 73 | /* copy bytes */ 74 | rsp_buf[0] = my_nv_item.bd_addr[0]; 75 | rsp_buf[1] = my_nv_item.bd_addr[1]; 76 | rsp_buf[2] = my_nv_item.bd_addr[2]; 77 | rsp_buf[3] = my_nv_item.bd_addr[3]; 78 | rsp_buf[4] = my_nv_item.bd_addr[4]; 79 | rsp_buf[5] = my_nv_item.bd_addr[5]; 80 | 81 | ALOGI("BD address read for NV_BD_ADDR_I: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 82 | (unsigned int) my_nv_item.bd_addr[0],(unsigned int) my_nv_item.bd_addr[1], 83 | (unsigned int) my_nv_item.bd_addr[2],(unsigned int) my_nv_item.bd_addr[3], 84 | (unsigned int) my_nv_item.bd_addr[4],(unsigned int) my_nv_item.bd_addr[5]); 85 | result = TRUE; 86 | } 87 | break; 88 | } 89 | return result; 90 | } 91 | #endif /* End of BT_NV_SUPPORT */ 92 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/src/bt_vendor_persist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "bt_vendor_persist.h" 28 | 29 | #ifdef BT_NV_SUPPORT 30 | #include "bt_nv.h" 31 | #include 32 | 33 | /*=========================================================================== 34 | FUNCTION bt_vendor_nv_read 35 | 36 | DESCRIPTION 37 | Helper Routine to process the nv read command 38 | 39 | DEPENDENCIES 40 | NIL 41 | 42 | RETURN VALUE 43 | RETURN VALUE 44 | FALSE = failure, else TRUE 45 | 46 | SIDE EFFECTS 47 | None 48 | 49 | ===========================================================================*/ 50 | uint8_t bt_vendor_nv_read 51 | ( 52 | uint8_t nv_item, 53 | uint8_t * rsp_buf 54 | ) 55 | { 56 | nv_persist_item_type my_nv_item; 57 | nv_persist_stat_enum_type cmd_result; 58 | boolean result = FALSE; 59 | 60 | switch(nv_item) 61 | { 62 | case NV_BD_ADDR_I: 63 | cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item); 64 | ALOGI("CMD result: %d", cmd_result); 65 | if (NV_SUCCESS != cmd_result) 66 | { 67 | ALOGE("Failed to read BD_ADDR from NV"); 68 | /* Send fail response */ 69 | result = FALSE; 70 | } 71 | else 72 | { 73 | /* copy bytes */ 74 | rsp_buf[0] = my_nv_item.bd_addr[0]; 75 | rsp_buf[1] = my_nv_item.bd_addr[1]; 76 | rsp_buf[2] = my_nv_item.bd_addr[2]; 77 | rsp_buf[3] = my_nv_item.bd_addr[3]; 78 | rsp_buf[4] = my_nv_item.bd_addr[4]; 79 | rsp_buf[5] = my_nv_item.bd_addr[5]; 80 | 81 | ALOGI("BD address read for NV_BD_ADDR_I: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 82 | (unsigned int) my_nv_item.bd_addr[0],(unsigned int) my_nv_item.bd_addr[1], 83 | (unsigned int) my_nv_item.bd_addr[2],(unsigned int) my_nv_item.bd_addr[3], 84 | (unsigned int) my_nv_item.bd_addr[4],(unsigned int) my_nv_item.bd_addr[5]); 85 | result = TRUE; 86 | } 87 | break; 88 | } 89 | return result; 90 | } 91 | #endif /* End of BT_NV_SUPPORT */ 92 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/src/bt_vendor_persist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "bt_vendor_persist.h" 28 | 29 | #ifdef BT_NV_SUPPORT 30 | #include "bt_nv.h" 31 | #include 32 | 33 | /*=========================================================================== 34 | FUNCTION bt_vendor_nv_read 35 | 36 | DESCRIPTION 37 | Helper Routine to process the nv read command 38 | 39 | DEPENDENCIES 40 | NIL 41 | 42 | RETURN VALUE 43 | RETURN VALUE 44 | FALSE = failure, else TRUE 45 | 46 | SIDE EFFECTS 47 | None 48 | 49 | ===========================================================================*/ 50 | uint8_t bt_vendor_nv_read 51 | ( 52 | uint8_t nv_item, 53 | uint8_t * rsp_buf 54 | ) 55 | { 56 | nv_persist_item_type my_nv_item; 57 | nv_persist_stat_enum_type cmd_result; 58 | boolean result = FALSE; 59 | 60 | switch(nv_item) 61 | { 62 | case NV_BD_ADDR_I: 63 | cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item); 64 | ALOGI("CMD result: %d", cmd_result); 65 | if (NV_SUCCESS != cmd_result) 66 | { 67 | ALOGE("Failed to read BD_ADDR from NV"); 68 | /* Send fail response */ 69 | result = FALSE; 70 | } 71 | else 72 | { 73 | /* copy bytes */ 74 | rsp_buf[0] = my_nv_item.bd_addr[0]; 75 | rsp_buf[1] = my_nv_item.bd_addr[1]; 76 | rsp_buf[2] = my_nv_item.bd_addr[2]; 77 | rsp_buf[3] = my_nv_item.bd_addr[3]; 78 | rsp_buf[4] = my_nv_item.bd_addr[4]; 79 | rsp_buf[5] = my_nv_item.bd_addr[5]; 80 | 81 | ALOGI("BD address read for NV_BD_ADDR_I: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 82 | (unsigned int) my_nv_item.bd_addr[0],(unsigned int) my_nv_item.bd_addr[1], 83 | (unsigned int) my_nv_item.bd_addr[2],(unsigned int) my_nv_item.bd_addr[3], 84 | (unsigned int) my_nv_item.bd_addr[4],(unsigned int) my_nv_item.bd_addr[5]); 85 | result = TRUE; 86 | } 87 | break; 88 | } 89 | return result; 90 | } 91 | #endif /* End of BT_NV_SUPPORT */ 92 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/src/userial_vendor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: userial_vendor.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_userial_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "bt_vendor_qcom.h" 33 | #include "userial_vendor.h" 34 | 35 | bt_hci_transport_device_type bt_hci_set_transport() 36 | { 37 | int ret; 38 | char transport_type[10] = {0,}; 39 | bt_hci_transport_device_type bt_hci_transport_device; 40 | 41 | ret = property_get("ro.qualcomm.bt.hci_transport", transport_type, NULL); 42 | if(ret == 0) 43 | printf("ro.qualcomm.bt.hci_transport not set\n"); 44 | else 45 | printf("ro.qualcomm.bt.hci_transport: %s \n", transport_type); 46 | 47 | if (!strcasecmp(transport_type, "smd")) 48 | { 49 | bt_hci_transport_device.type = BT_HCI_SMD; 50 | bt_hci_transport_device.name = APPS_RIVA_BT_CMD_CH; 51 | bt_hci_transport_device.pkt_ind = 1; 52 | } 53 | else{ 54 | bt_hci_transport_device.type = BT_HCI_UART; 55 | bt_hci_transport_device.name = BT_HS_UART_DEVICE; 56 | bt_hci_transport_device.pkt_ind = 0; 57 | } 58 | 59 | return bt_hci_transport_device; 60 | } 61 | 62 | #define NUM_OF_DEVS 2 63 | static char *s_pszDevSmd[] = { 64 | "/dev/smd3", 65 | "/dev/smd2" 66 | }; 67 | 68 | int bt_hci_init_transport(int *pFd) 69 | { 70 | int i = 0; 71 | int fd; 72 | for(i=0; i < NUM_OF_DEVS; i++){ 73 | fd = bt_hci_init_transport_id(i); 74 | if(fd < 0 ){ 75 | return -1; 76 | } 77 | pFd[i] = fd; 78 | } 79 | return 0; 80 | } 81 | 82 | int bt_hci_init_transport_id (int chId ) 83 | { 84 | struct termios term; 85 | int fd = -1; 86 | int retry = 0; 87 | 88 | if(chId > 2 || chId <0) 89 | return -1; 90 | 91 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 92 | 93 | while ((-1 == fd) && (retry < 7)) { 94 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 95 | bt_hci_transport_device.name, strerror(errno)); 96 | usleep(2000000); 97 | fd = open(bt_hci_transport_device.name, (O_RDWR | O_NOCTTY)); 98 | retry++; 99 | } 100 | 101 | if (-1 == fd) 102 | { 103 | ALOGE("init_transport: Cannot open %s: %s\n", 104 | bt_hci_transport_device.name, strerror(errno)); 105 | return -1; 106 | } 107 | 108 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 109 | opened internally. Currently successful return from open doesn't 110 | ensure the smd port is successfully opened. 111 | TODO: Following sleep to be removed once SMD port is successfully 112 | opened immediately on return from the aforementioned open call */ 113 | if(BT_HCI_SMD == bt_hci_transport_device.type) 114 | usleep(500000); 115 | 116 | if (tcflush(fd, TCIOFLUSH) < 0) 117 | { 118 | ALOGE("init_uart: Cannot flush %s\n", bt_hci_transport_device.name); 119 | close(fd); 120 | return -1; 121 | } 122 | 123 | if (tcgetattr(fd, &term) < 0) 124 | { 125 | ALOGE("init_uart: Error while getting attributes\n"); 126 | close(fd); 127 | return -1; 128 | } 129 | 130 | cfmakeraw(&term); 131 | 132 | /* JN: Do I need to make flow control configurable, since 4020 cannot 133 | * disable it? 134 | */ 135 | term.c_cflag |= (CRTSCTS | CLOCAL); 136 | 137 | if (tcsetattr(fd, TCSANOW, &term) < 0) 138 | { 139 | ALOGE("init_uart: Error while getting attributes\n"); 140 | close(fd); 141 | return -1; 142 | } 143 | 144 | ALOGI("Done intiailizing UART\n"); 145 | return fd; 146 | } 147 | 148 | int bt_hci_deinit_transport(int *pFd) 149 | { 150 | close(pFd[0]); 151 | close(pFd[1]); 152 | return TRUE; 153 | } 154 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/src/hci_smd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hci_smd.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "bt_vendor_qcom.h" 33 | #include "hci_smd.h" 34 | #include 35 | #include 36 | 37 | /***************************************************************************** 38 | ** Macros & Constants 39 | *****************************************************************************/ 40 | #define NUM_OF_DEVS 2 41 | static char *s_pszDevSmd[] = { 42 | "/dev/smd3", 43 | "/dev/smd2" 44 | }; 45 | 46 | /****************************************************************************** 47 | ** Externs 48 | ******************************************************************************/ 49 | extern int is_bt_ssr_hci; 50 | 51 | 52 | /***************************************************************************** 53 | ** Functions 54 | *****************************************************************************/ 55 | 56 | int bt_hci_init_transport_id (int chId ) 57 | { 58 | struct termios term; 59 | int fd = -1; 60 | int retry = 0; 61 | char ssrvalue[92]= {'\0'}; 62 | 63 | ssrvalue[0] = '0'; 64 | if(chId >= 2 || chId <0) 65 | return -1; 66 | 67 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 68 | 69 | while ((-1 == fd) && (retry < 7)) { 70 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 71 | s_pszDevSmd[chId], strerror(errno)); 72 | usleep(2000000); 73 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 74 | retry++; 75 | } 76 | 77 | if (-1 == fd) 78 | { 79 | ALOGE("init_transport: Cannot open %s: %s\n", 80 | s_pszDevSmd[chId], strerror(errno)); 81 | return -1; 82 | } 83 | 84 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 85 | opened internally. Currently successful return from open doesn't 86 | ensure the smd port is successfully opened. 87 | TODO: Following sleep to be removed once SMD port is successfully 88 | opened immediately on return from the aforementioned open call */ 89 | 90 | property_get("bluetooth.isSSR", ssrvalue, ""); 91 | 92 | if(ssrvalue[0] == '1') 93 | { 94 | /*reset the SSR flag */ 95 | if(chId == 1) 96 | { 97 | if(property_set("bluetooth.isSSR", "0") < 0) 98 | { 99 | ALOGE("SSR: hci_smd.c:SSR case : error in setting up property new\n "); 100 | } 101 | else 102 | { 103 | ALOGE("SSR: hci_smd.c:SSR case : Reset the SSr Flag new\n "); 104 | } 105 | } 106 | ALOGE("hci_smd.c:IN SSR sleep for 500 msec New \n"); 107 | usleep(500000); 108 | } 109 | 110 | if (tcflush(fd, TCIOFLUSH) < 0) 111 | { 112 | ALOGE("init_uart: Cannot flush %s\n", s_pszDevSmd[chId]); 113 | close(fd); 114 | return -1; 115 | } 116 | 117 | if (tcgetattr(fd, &term) < 0) 118 | { 119 | ALOGE("init_uart: Error while getting attributes\n"); 120 | close(fd); 121 | return -1; 122 | } 123 | 124 | cfmakeraw(&term); 125 | 126 | /* JN: Do I need to make flow control configurable, since 4020 cannot 127 | * disable it? 128 | */ 129 | term.c_cflag |= (CRTSCTS | CLOCAL); 130 | 131 | if (tcsetattr(fd, TCSANOW, &term) < 0) 132 | { 133 | ALOGE("init_uart: Error while getting attributes\n"); 134 | close(fd); 135 | return -1; 136 | } 137 | 138 | ALOGI("Done intiailizing UART\n"); 139 | return fd; 140 | } 141 | 142 | int bt_hci_init_transport(int *pFd) 143 | { 144 | int i = 0; 145 | int fd; 146 | for(i=0; i < NUM_OF_DEVS; i++){ 147 | fd = bt_hci_init_transport_id(i); 148 | if(fd < 0 ){ 149 | return -1; 150 | } 151 | pFd[i] = fd; 152 | } 153 | return 0; 154 | } 155 | 156 | int bt_hci_deinit_transport(int *pFd) 157 | { 158 | close(pFd[0]); 159 | close(pFd[1]); 160 | return TRUE; 161 | } 162 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/src/hci_smd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hci_smd.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "bt_vendor_qcom.h" 33 | #include "hci_smd.h" 34 | #include 35 | #include 36 | 37 | /***************************************************************************** 38 | ** Macros & Constants 39 | *****************************************************************************/ 40 | #define NUM_OF_DEVS 2 41 | static char *s_pszDevSmd[] = { 42 | "/dev/smd3", 43 | "/dev/smd2" 44 | }; 45 | 46 | /****************************************************************************** 47 | ** Externs 48 | ******************************************************************************/ 49 | extern int is_bt_ssr_hci; 50 | 51 | 52 | /***************************************************************************** 53 | ** Functions 54 | *****************************************************************************/ 55 | 56 | int bt_hci_init_transport_id (int chId ) 57 | { 58 | struct termios term; 59 | int fd = -1; 60 | int retry = 0; 61 | char ssrvalue[92]= {'\0'}; 62 | 63 | ssrvalue[0] = '0'; 64 | if(chId >= 2 || chId <0) 65 | return -1; 66 | 67 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 68 | 69 | while ((-1 == fd) && (retry < 7)) { 70 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 71 | s_pszDevSmd[chId], strerror(errno)); 72 | usleep(2000000); 73 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 74 | retry++; 75 | } 76 | 77 | if (-1 == fd) 78 | { 79 | ALOGE("init_transport: Cannot open %s: %s\n", 80 | s_pszDevSmd[chId], strerror(errno)); 81 | return -1; 82 | } 83 | 84 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 85 | opened internally. Currently successful return from open doesn't 86 | ensure the smd port is successfully opened. 87 | TODO: Following sleep to be removed once SMD port is successfully 88 | opened immediately on return from the aforementioned open call */ 89 | 90 | property_get("bluetooth.isSSR", ssrvalue, ""); 91 | 92 | if(ssrvalue[0] == '1') 93 | { 94 | /*reset the SSR flag */ 95 | if(chId == 1) 96 | { 97 | if(property_set("bluetooth.isSSR", "0") < 0) 98 | { 99 | ALOGE("SSR: hci_smd.c:SSR case : error in setting up property new\n "); 100 | } 101 | else 102 | { 103 | ALOGE("SSR: hci_smd.c:SSR case : Reset the SSr Flag new\n "); 104 | } 105 | } 106 | ALOGE("hci_smd.c:IN SSR sleep for 500 msec New \n"); 107 | usleep(500000); 108 | } 109 | 110 | if (tcflush(fd, TCIOFLUSH) < 0) 111 | { 112 | ALOGE("init_uart: Cannot flush %s\n", s_pszDevSmd[chId]); 113 | close(fd); 114 | return -1; 115 | } 116 | 117 | if (tcgetattr(fd, &term) < 0) 118 | { 119 | ALOGE("init_uart: Error while getting attributes\n"); 120 | close(fd); 121 | return -1; 122 | } 123 | 124 | cfmakeraw(&term); 125 | 126 | /* JN: Do I need to make flow control configurable, since 4020 cannot 127 | * disable it? 128 | */ 129 | term.c_cflag |= (CRTSCTS | CLOCAL); 130 | 131 | if (tcsetattr(fd, TCSANOW, &term) < 0) 132 | { 133 | ALOGE("init_uart: Error while getting attributes\n"); 134 | close(fd); 135 | return -1; 136 | } 137 | 138 | ALOGI("Done intiailizing UART\n"); 139 | return fd; 140 | } 141 | 142 | int bt_hci_init_transport(int *pFd) 143 | { 144 | int i = 0; 145 | int fd; 146 | for(i=0; i < NUM_OF_DEVS; i++){ 147 | fd = bt_hci_init_transport_id(i); 148 | if(fd < 0 ){ 149 | return -1; 150 | } 151 | pFd[i] = fd; 152 | } 153 | return 0; 154 | } 155 | 156 | int bt_hci_deinit_transport(int *pFd) 157 | { 158 | close(pFd[0]); 159 | close(pFd[1]); 160 | return TRUE; 161 | } 162 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/src/hci_smd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hci_smd.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include "bt_vendor_qcom.h" 35 | #include "hci_smd.h" 36 | 37 | /***************************************************************************** 38 | ** Macros & Constants 39 | *****************************************************************************/ 40 | #define NUM_OF_DEVS 2 41 | static char *s_pszDevSmd[] = { 42 | "/dev/smd3", 43 | "/dev/smd2" 44 | }; 45 | 46 | /****************************************************************************** 47 | ** Externs 48 | ******************************************************************************/ 49 | extern int is_bt_ssr_hci; 50 | 51 | 52 | /***************************************************************************** 53 | ** Functions 54 | *****************************************************************************/ 55 | int bt_hci_init_transport_id (int chId ) 56 | { 57 | struct termios term; 58 | int fd = -1; 59 | int retry = 0; 60 | char ssrvalue[92]= {'\0'}; 61 | 62 | ssrvalue[0] = '0'; 63 | if(chId >= 2 || chId <0) 64 | return -1; 65 | 66 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 67 | 68 | while ((-1 == fd) && (retry < 7)) { 69 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 70 | s_pszDevSmd[chId], strerror(errno)); 71 | usleep(2000000); 72 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 73 | retry++; 74 | } 75 | 76 | if (-1 == fd) 77 | { 78 | ALOGE("init_transport: Cannot open %s: %s\n", 79 | s_pszDevSmd[chId], strerror(errno)); 80 | return -1; 81 | } 82 | 83 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 84 | opened internally. Currently successful return from open doesn't 85 | ensure the smd port is successfully opened. 86 | TODO: Following sleep to be removed once SMD port is successfully 87 | opened immediately on return from the aforementioned open call */ 88 | 89 | property_get("bluetooth.isSSR", ssrvalue, ""); 90 | 91 | if(ssrvalue[0] == '1') 92 | { 93 | /*reset the SSR flag */ 94 | if(chId == 1) 95 | { 96 | if(property_set("bluetooth.isSSR", "0") < 0) 97 | { 98 | ALOGE("SSR: hci_smd.c:SSR case : error in setting up property new\n "); 99 | } 100 | else 101 | { 102 | ALOGE("SSR: hci_smd.c:SSR case : Reset the SSr Flag new\n "); 103 | } 104 | } 105 | ALOGE("hci_smd.c:IN SSR sleep for 500 msec New \n"); 106 | usleep(500000); 107 | } 108 | 109 | if (tcflush(fd, TCIOFLUSH) < 0) 110 | { 111 | ALOGE("init_uart: Cannot flush %s\n", s_pszDevSmd[chId]); 112 | close(fd); 113 | return -1; 114 | } 115 | 116 | if (tcgetattr(fd, &term) < 0) 117 | { 118 | ALOGE("init_uart: Error while getting attributes\n"); 119 | close(fd); 120 | return -1; 121 | } 122 | 123 | cfmakeraw(&term); 124 | 125 | /* JN: Do I need to make flow control configurable, since 4020 cannot 126 | * disable it? 127 | */ 128 | term.c_cflag |= (CRTSCTS | CLOCAL); 129 | 130 | if (tcsetattr(fd, TCSANOW, &term) < 0) 131 | { 132 | ALOGE("init_uart: Error while getting attributes\n"); 133 | close(fd); 134 | return -1; 135 | } 136 | 137 | ALOGI("Done intiailizing UART\n"); 138 | return fd; 139 | } 140 | 141 | int bt_hci_init_transport(int *pFd) 142 | { 143 | int i = 0; 144 | int fd; 145 | for(i=0; i < NUM_OF_DEVS; i++){ 146 | fd = bt_hci_init_transport_id(i); 147 | if(fd < 0 ){ 148 | return -1; 149 | } 150 | pFd[i] = fd; 151 | } 152 | return 0; 153 | } 154 | 155 | int bt_hci_deinit_transport(int *pFd) 156 | { 157 | close(pFd[0]); 158 | close(pFd[1]); 159 | return TRUE; 160 | } 161 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/src/hci_smd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hci_smd.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include "bt_vendor_qcom.h" 28 | #include "hci_smd.h" 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | /***************************************************************************** 41 | ** Macros & Constants 42 | *****************************************************************************/ 43 | #define NUM_OF_DEVS 2 44 | static char *s_pszDevSmd[] = { 45 | "/dev/smd3", 46 | "/dev/smd2" 47 | }; 48 | 49 | /****************************************************************************** 50 | ** Externs 51 | ******************************************************************************/ 52 | extern int is_bt_ssr_hci; 53 | 54 | 55 | /***************************************************************************** 56 | ** Functions 57 | *****************************************************************************/ 58 | 59 | int bt_hci_init_transport_id (int chId ) 60 | { 61 | struct termios term; 62 | int fd = -1; 63 | int retry = 0; 64 | char ssrvalue[92]= {'\0'}; 65 | 66 | ssrvalue[0] = '0'; 67 | if(chId >= 2 || chId <0) 68 | return -1; 69 | 70 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 71 | 72 | while ((-1 == fd) && (retry < 7)) { 73 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 74 | s_pszDevSmd[chId], strerror(errno)); 75 | usleep(2000000); 76 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 77 | retry++; 78 | } 79 | 80 | if (-1 == fd) 81 | { 82 | ALOGE("init_transport: Cannot open %s: %s\n", 83 | s_pszDevSmd[chId], strerror(errno)); 84 | return -1; 85 | } 86 | 87 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 88 | opened internally. Currently successful return from open doesn't 89 | ensure the smd port is successfully opened. 90 | TODO: Following sleep to be removed once SMD port is successfully 91 | opened immediately on return from the aforementioned open call */ 92 | 93 | property_get("bluetooth.isSSR", ssrvalue, ""); 94 | 95 | if(ssrvalue[0] == '1') 96 | { 97 | /*reset the SSR flag */ 98 | if(chId == 1) 99 | { 100 | if(property_set("bluetooth.isSSR", "0") < 0) 101 | { 102 | ALOGE("SSR: hci_smd.c:SSR case : error in setting up property new\n "); 103 | } 104 | else 105 | { 106 | ALOGE("SSR: hci_smd.c:SSR case : Reset the SSr Flag new\n "); 107 | } 108 | } 109 | ALOGE("hci_smd.c:IN SSR sleep for 500 msec New \n"); 110 | usleep(500000); 111 | } 112 | 113 | if (tcflush(fd, TCIOFLUSH) < 0) 114 | { 115 | ALOGE("init_uart: Cannot flush %s\n", s_pszDevSmd[chId]); 116 | close(fd); 117 | return -1; 118 | } 119 | 120 | if (tcgetattr(fd, &term) < 0) 121 | { 122 | ALOGE("init_uart: Error while getting attributes\n"); 123 | close(fd); 124 | return -1; 125 | } 126 | 127 | cfmakeraw(&term); 128 | 129 | /* JN: Do I need to make flow control configurable, since 4020 cannot 130 | * disable it? 131 | */ 132 | term.c_cflag |= (CRTSCTS | CLOCAL); 133 | 134 | if (tcsetattr(fd, TCSANOW, &term) < 0) 135 | { 136 | ALOGE("init_uart: Error while getting attributes\n"); 137 | close(fd); 138 | return -1; 139 | } 140 | 141 | ALOGI("Done intiailizing UART\n"); 142 | return fd; 143 | } 144 | 145 | int bt_hci_init_transport(int *pFd) 146 | { 147 | int i = 0; 148 | int fd; 149 | for(i=0; i < NUM_OF_DEVS; i++){ 150 | fd = bt_hci_init_transport_id(i); 151 | if(fd < 0 ){ 152 | return -1; 153 | } 154 | pFd[i] = fd; 155 | } 156 | return 0; 157 | } 158 | 159 | int bt_hci_deinit_transport(int *pFd) 160 | { 161 | close(pFd[0]); 162 | close(pFd[1]); 163 | return TRUE; 164 | } 165 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/src/hci_smd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hci_smd.c 20 | * 21 | * Description: Contains vendor-specific userial functions 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include "bt_vendor_qcom.h" 35 | #include "hci_smd.h" 36 | #include 37 | #include 38 | #include 39 | 40 | /***************************************************************************** 41 | ** Macros & Constants 42 | *****************************************************************************/ 43 | #define NUM_OF_DEVS 2 44 | static char *s_pszDevSmd[] = { 45 | "/dev/smd3", 46 | "/dev/smd2" 47 | }; 48 | 49 | /****************************************************************************** 50 | ** Externs 51 | ******************************************************************************/ 52 | extern int is_bt_ssr_hci; 53 | 54 | 55 | /***************************************************************************** 56 | ** Functions 57 | *****************************************************************************/ 58 | 59 | int bt_hci_init_transport_id (int chId ) 60 | { 61 | struct termios term; 62 | int fd = -1; 63 | int retry = 0; 64 | char ssrvalue[92]= {'\0'}; 65 | 66 | ssrvalue[0] = '0'; 67 | if(chId >= 2 || chId <0) 68 | return -1; 69 | 70 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 71 | 72 | while ((-1 == fd) && (retry < 7)) { 73 | ALOGE("init_transport: Cannot open %s: %s\n. Retry after 2 seconds", 74 | s_pszDevSmd[chId], strerror(errno)); 75 | usleep(2000000); 76 | fd = open(s_pszDevSmd[chId], (O_RDWR | O_NOCTTY)); 77 | retry++; 78 | } 79 | 80 | if (-1 == fd) 81 | { 82 | ALOGE("init_transport: Cannot open %s: %s\n", 83 | s_pszDevSmd[chId], strerror(errno)); 84 | return -1; 85 | } 86 | 87 | /* Sleep (0.5sec) added giving time for the smd port to be successfully 88 | opened internally. Currently successful return from open doesn't 89 | ensure the smd port is successfully opened. 90 | TODO: Following sleep to be removed once SMD port is successfully 91 | opened immediately on return from the aforementioned open call */ 92 | 93 | property_get("bluetooth.isSSR", ssrvalue, ""); 94 | 95 | if(ssrvalue[0] == '1') 96 | { 97 | /*reset the SSR flag */ 98 | if(chId == 1) 99 | { 100 | if(property_set("bluetooth.isSSR", "0") < 0) 101 | { 102 | ALOGE("SSR: hci_smd.c:SSR case : error in setting up property new\n "); 103 | } 104 | else 105 | { 106 | ALOGE("SSR: hci_smd.c:SSR case : Reset the SSr Flag new\n "); 107 | } 108 | } 109 | ALOGE("hci_smd.c:IN SSR sleep for 500 msec New \n"); 110 | usleep(500000); 111 | } 112 | 113 | if (tcflush(fd, TCIOFLUSH) < 0) 114 | { 115 | ALOGE("init_uart: Cannot flush %s\n", s_pszDevSmd[chId]); 116 | close(fd); 117 | return -1; 118 | } 119 | 120 | if (tcgetattr(fd, &term) < 0) 121 | { 122 | ALOGE("init_uart: Error while getting attributes\n"); 123 | close(fd); 124 | return -1; 125 | } 126 | 127 | cfmakeraw(&term); 128 | 129 | /* JN: Do I need to make flow control configurable, since 4020 cannot 130 | * disable it? 131 | */ 132 | term.c_cflag |= (CRTSCTS | CLOCAL); 133 | 134 | if (tcsetattr(fd, TCSANOW, &term) < 0) 135 | { 136 | ALOGE("init_uart: Error while getting attributes\n"); 137 | close(fd); 138 | return -1; 139 | } 140 | 141 | ALOGI("Done intiailizing UART\n"); 142 | return fd; 143 | } 144 | 145 | int bt_hci_init_transport(int *pFd) 146 | { 147 | int i = 0; 148 | int fd; 149 | for(i=0; i < NUM_OF_DEVS; i++){ 150 | fd = bt_hci_init_transport_id(i); 151 | if(fd < 0 ){ 152 | return -1; 153 | } 154 | pFd[i] = fd; 155 | } 156 | return 0; 157 | } 158 | 159 | int bt_hci_deinit_transport(int *pFd) 160 | { 161 | close(pFd[0]); 162 | close(pFd[1]); 163 | return TRUE; 164 | } 165 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/hw_ar3k.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef HW_AR3K_H 19 | #define HW_AR3K_H 20 | 21 | /****************************************************************************** 22 | ** Constants & Macros 23 | ******************************************************************************/ 24 | #define MAX_CNT_RETRY 100 25 | 26 | #define HCI_MAX_CMD_SIZE 260 27 | #define HCI_MAX_EVENT_SIZE 260 28 | #define HCI_CHG_BAUD_CMD_OCF 0x0C 29 | #define HCI_VENDOR_CMD_OGF 0x3F 30 | #define WRITE_BDADDR_CMD_LEN 14 31 | #define WRITE_BAUD_CMD_LEN 6 32 | #define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN 33 | #define GET_VERSION_OCF 0x1E 34 | /* Byte order conversions */ 35 | #if __BYTE_ORDER == __LITTLE_ENDIAN 36 | #define htobs(d) (d) 37 | #define htobl(d) (d) 38 | #define btohs(d) (d) 39 | #define btohl(d) (d) 40 | #elif __BYTE_ORDER == __BIG_ENDIAN 41 | #define htobs(d) bswap_16(d) 42 | #define htobl(d) bswap_32(d) 43 | #define btohs(d) bswap_16(d) 44 | #define btohl(d) bswap_32(d) 45 | #else 46 | #error "Unknown byte order" 47 | #endif 48 | 49 | #define FW_PATH "/system/etc/firmware/ar3k/" 50 | 51 | #define STREAM_TO_UINT16(u16, p) \ 52 | {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 53 | #define UINT16_TO_STREAM(p, u16) \ 54 | {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 55 | #define UINT32_TO_STREAM(p, u32) \ 56 | {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8);\ 57 | *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 58 | 59 | #define MAX_TAGS 50 60 | #define PS_HDR_LEN 4 61 | #define HCI_VENDOR_CMD_OGF 0x3F 62 | #define HCI_PS_CMD_OCF 0x0B 63 | 64 | #define VERIFY_CRC 9 65 | #define PS_REGION 1 66 | #define PATCH_REGION 2 67 | #define BDADDR_FILE "ar3kbdaddr.pst" 68 | 69 | 70 | #define MAX_PATCH_CMD 244 71 | struct patch_entry { 72 | int16_t len; 73 | uint8_t data[MAX_PATCH_CMD]; 74 | }; 75 | #define HCI_UART_RAW_DEVICE 0 76 | #define HCI_COMMAND_HDR_SIZE 3 77 | #define PS_WRITE 1 78 | #define PS_RESET 2 79 | #define WRITE_PATCH 8 80 | #define ENABLE_PATCH 11 81 | 82 | #define HCI_PS_CMD_HDR_LEN 7 83 | #define HCI_CMD_MAX_LEN 258 84 | #define PS_RESET_PARAM_LEN 6 85 | #define PS_RESET_CMD_LEN (HCI_PS_CMD_HDR_LEN + PS_RESET_PARAM_LEN) 86 | 87 | #define PS_ID_MASK 0xFF 88 | 89 | 90 | #define LOCAL_NAME_BUFFER_LEN 32 91 | #define DEV_REGISTER 0x4FFC 92 | #define GET_DEV_TYPE_OCF 0x05 93 | 94 | #define HCIDEVUP _IOW('H', 201, int) 95 | #define OGF_VENDOR_CMD 0x3f 96 | #define EVT_CMD_COMPLETE_SIZE 3 97 | #define EVT_CMD_STATUS 0x0F 98 | #define EVT_CMD_STATUS_SIZE 4 99 | #define HCI_COMMAND_HDR_SIZE 3 100 | #define HCI_EVENT_HDR_SIZE 2 101 | #define HCI_EV_SUCCESS 0x00 102 | /* HCI Socket options */ 103 | #define HCI_DATA_DIR 1 104 | #define HCI_FILTER 2 105 | #define HCI_TIME_STAMP 3 106 | 107 | /* HCI CMSG flags */ 108 | #define HCI_CMSG_DIR 0x0001 109 | #define HCI_CMSG_TSTAMP 0x0002 110 | 111 | #ifndef VENDOR_LPM_PROC_NODE 112 | #define VENDOR_LPM_PROC_NODE "/sys/module/hci_uart/parameters/ath_lpm" 113 | #endif 114 | 115 | /* proc fs node for notifying write request */ 116 | #ifndef VENDOR_BTWRITE_PROC_NODE 117 | #define VENDOR_BTWRITE_PROC_NODE "/sys/module/hci_uart/parameters/ath_btwrite" 118 | #endif 119 | 120 | /****************************************************************************** 121 | ** Local type definitions 122 | ******************************************************************************/ 123 | typedef struct { 124 | uint8_t b[6]; 125 | } __attribute__((packed)) bdaddr_t; 126 | 127 | struct sockaddr_hci { 128 | sa_family_t hci_family; 129 | unsigned short hci_dev; 130 | unsigned short hci_channel; 131 | }; 132 | 133 | struct tag_info { 134 | unsigned section; 135 | unsigned line_count; 136 | unsigned char_cnt; 137 | unsigned byte_count; 138 | }; 139 | 140 | struct ps_cfg_entry { 141 | uint32_t id; 142 | uint32_t len; 143 | uint8_t *data; 144 | }; 145 | 146 | struct ps_entry_type { 147 | unsigned char type; 148 | unsigned char array; 149 | }; 150 | 151 | struct uart_t { 152 | char *type; 153 | int m_id; 154 | int p_id; 155 | int proto; 156 | int init_speed; 157 | int speed; 158 | int flags; 159 | int pm; 160 | char *bdaddr; 161 | int (*init) (int fd, struct uart_t *u, struct termios *ti); 162 | int (*post) (int fd, struct uart_t *u, struct termios *ti); 163 | }; 164 | #endif /* HW_AR3K_H */ 165 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/hw_ar3k.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef HW_AR3K_H 19 | #define HW_AR3K_H 20 | 21 | /****************************************************************************** 22 | ** Constants & Macros 23 | ******************************************************************************/ 24 | #define MAX_CNT_RETRY 100 25 | 26 | #define HCI_MAX_CMD_SIZE 260 27 | #define HCI_MAX_EVENT_SIZE 260 28 | #define HCI_CHG_BAUD_CMD_OCF 0x0C 29 | #define HCI_VENDOR_CMD_OGF 0x3F 30 | #define WRITE_BDADDR_CMD_LEN 14 31 | #define WRITE_BAUD_CMD_LEN 6 32 | #define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN 33 | #define GET_VERSION_OCF 0x1E 34 | /* Byte order conversions */ 35 | #if __BYTE_ORDER == __LITTLE_ENDIAN 36 | #define htobs(d) (d) 37 | #define htobl(d) (d) 38 | #define btohs(d) (d) 39 | #define btohl(d) (d) 40 | #elif __BYTE_ORDER == __BIG_ENDIAN 41 | #define htobs(d) bswap_16(d) 42 | #define htobl(d) bswap_32(d) 43 | #define btohs(d) bswap_16(d) 44 | #define btohl(d) bswap_32(d) 45 | #else 46 | #error "Unknown byte order" 47 | #endif 48 | 49 | #define FW_PATH "/system/etc/firmware/ar3k/" 50 | 51 | #define STREAM_TO_UINT16(u16, p) \ 52 | {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 53 | #define UINT16_TO_STREAM(p, u16) \ 54 | {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 55 | #define UINT32_TO_STREAM(p, u32) \ 56 | {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8);\ 57 | *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 58 | 59 | #define MAX_TAGS 50 60 | #define PS_HDR_LEN 4 61 | #define HCI_VENDOR_CMD_OGF 0x3F 62 | #define HCI_PS_CMD_OCF 0x0B 63 | 64 | #define VERIFY_CRC 9 65 | #define PS_REGION 1 66 | #define PATCH_REGION 2 67 | #define BDADDR_FILE "ar3kbdaddr.pst" 68 | 69 | 70 | #define MAX_PATCH_CMD 244 71 | struct patch_entry { 72 | int16_t len; 73 | uint8_t data[MAX_PATCH_CMD]; 74 | }; 75 | #define HCI_UART_RAW_DEVICE 0 76 | #define HCI_COMMAND_HDR_SIZE 3 77 | #define PS_WRITE 1 78 | #define PS_RESET 2 79 | #define WRITE_PATCH 8 80 | #define ENABLE_PATCH 11 81 | 82 | #define HCI_PS_CMD_HDR_LEN 7 83 | #define HCI_CMD_MAX_LEN 258 84 | #define PS_RESET_PARAM_LEN 6 85 | #define PS_RESET_CMD_LEN (HCI_PS_CMD_HDR_LEN + PS_RESET_PARAM_LEN) 86 | 87 | #define PS_ID_MASK 0xFF 88 | 89 | 90 | #define LOCAL_NAME_BUFFER_LEN 32 91 | #define DEV_REGISTER 0x4FFC 92 | #define GET_DEV_TYPE_OCF 0x05 93 | 94 | #define HCIDEVUP _IOW('H', 201, int) 95 | #define OGF_VENDOR_CMD 0x3f 96 | #define EVT_CMD_COMPLETE_SIZE 3 97 | #define EVT_CMD_STATUS 0x0F 98 | #define EVT_CMD_STATUS_SIZE 4 99 | #define HCI_COMMAND_HDR_SIZE 3 100 | #define HCI_EVENT_HDR_SIZE 2 101 | #define HCI_EV_SUCCESS 0x00 102 | /* HCI Socket options */ 103 | #define HCI_DATA_DIR 1 104 | #define HCI_FILTER 2 105 | #define HCI_TIME_STAMP 3 106 | 107 | /* HCI CMSG flags */ 108 | #define HCI_CMSG_DIR 0x0001 109 | #define HCI_CMSG_TSTAMP 0x0002 110 | 111 | #ifndef VENDOR_LPM_PROC_NODE 112 | #define VENDOR_LPM_PROC_NODE "/sys/module/hci_uart/parameters/ath_lpm" 113 | #endif 114 | 115 | /* proc fs node for notifying write request */ 116 | #ifndef VENDOR_BTWRITE_PROC_NODE 117 | #define VENDOR_BTWRITE_PROC_NODE "/sys/module/hci_uart/parameters/ath_btwrite" 118 | #endif 119 | 120 | /****************************************************************************** 121 | ** Local type definitions 122 | ******************************************************************************/ 123 | typedef struct { 124 | uint8_t b[6]; 125 | } __attribute__((packed)) bdaddr_t; 126 | 127 | struct sockaddr_hci { 128 | sa_family_t hci_family; 129 | unsigned short hci_dev; 130 | unsigned short hci_channel; 131 | }; 132 | 133 | struct tag_info { 134 | unsigned section; 135 | unsigned line_count; 136 | unsigned char_cnt; 137 | unsigned byte_count; 138 | }; 139 | 140 | struct ps_cfg_entry { 141 | uint32_t id; 142 | uint32_t len; 143 | uint8_t *data; 144 | }; 145 | 146 | struct ps_entry_type { 147 | unsigned char type; 148 | unsigned char array; 149 | }; 150 | 151 | struct uart_t { 152 | char *type; 153 | int m_id; 154 | int p_id; 155 | int proto; 156 | int init_speed; 157 | int speed; 158 | int flags; 159 | int pm; 160 | char *bdaddr; 161 | int (*init) (int fd, struct uart_t *u, struct termios *ti); 162 | int (*post) (int fd, struct uart_t *u, struct termios *ti); 163 | }; 164 | #endif /* HW_AR3K_H */ 165 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/hw_ar3k.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef HW_AR3K_H 19 | #define HW_AR3K_H 20 | 21 | /****************************************************************************** 22 | ** Constants & Macros 23 | ******************************************************************************/ 24 | #define MAX_CNT_RETRY 100 25 | 26 | #define HCI_MAX_CMD_SIZE 260 27 | #define HCI_MAX_EVENT_SIZE 260 28 | #define HCI_CHG_BAUD_CMD_OCF 0x0C 29 | #define HCI_VENDOR_CMD_OGF 0x3F 30 | #define WRITE_BDADDR_CMD_LEN 14 31 | #define WRITE_BAUD_CMD_LEN 6 32 | #define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN 33 | #define GET_VERSION_OCF 0x1E 34 | /* Byte order conversions */ 35 | #if __BYTE_ORDER == __LITTLE_ENDIAN 36 | #define htobs(d) (d) 37 | #define htobl(d) (d) 38 | #define btohs(d) (d) 39 | #define btohl(d) (d) 40 | #elif __BYTE_ORDER == __BIG_ENDIAN 41 | #define htobs(d) bswap_16(d) 42 | #define htobl(d) bswap_32(d) 43 | #define btohs(d) bswap_16(d) 44 | #define btohl(d) bswap_32(d) 45 | #else 46 | #error "Unknown byte order" 47 | #endif 48 | 49 | #define FW_PATH "/system/etc/firmware/ar3k/" 50 | 51 | #define STREAM_TO_UINT16(u16, p) \ 52 | {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 53 | #define UINT16_TO_STREAM(p, u16) \ 54 | {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 55 | #define UINT32_TO_STREAM(p, u32) \ 56 | {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8);\ 57 | *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 58 | 59 | #define MAX_TAGS 50 60 | #define PS_HDR_LEN 4 61 | #define HCI_VENDOR_CMD_OGF 0x3F 62 | #define HCI_PS_CMD_OCF 0x0B 63 | 64 | #define VERIFY_CRC 9 65 | #define PS_REGION 1 66 | #define PATCH_REGION 2 67 | #define BDADDR_FILE "ar3kbdaddr.pst" 68 | 69 | 70 | #define MAX_PATCH_CMD 244 71 | struct patch_entry { 72 | int16_t len; 73 | uint8_t data[MAX_PATCH_CMD]; 74 | }; 75 | #define HCI_UART_RAW_DEVICE 0 76 | #define HCI_COMMAND_HDR_SIZE 3 77 | #define PS_WRITE 1 78 | #define PS_RESET 2 79 | #define WRITE_PATCH 8 80 | #define ENABLE_PATCH 11 81 | 82 | #define HCI_PS_CMD_HDR_LEN 7 83 | #define HCI_CMD_MAX_LEN 258 84 | #define PS_RESET_PARAM_LEN 6 85 | #define PS_RESET_CMD_LEN (HCI_PS_CMD_HDR_LEN + PS_RESET_PARAM_LEN) 86 | 87 | #define PS_ID_MASK 0xFF 88 | 89 | 90 | #define LOCAL_NAME_BUFFER_LEN 32 91 | #define DEV_REGISTER 0x4FFC 92 | #define GET_DEV_TYPE_OCF 0x05 93 | 94 | #define HCIDEVUP _IOW('H', 201, int) 95 | #define OGF_VENDOR_CMD 0x3f 96 | #define EVT_CMD_COMPLETE_SIZE 3 97 | #define EVT_CMD_STATUS 0x0F 98 | #define EVT_CMD_STATUS_SIZE 4 99 | #define HCI_COMMAND_HDR_SIZE 3 100 | #define HCI_EVENT_HDR_SIZE 2 101 | #define HCI_EV_SUCCESS 0x00 102 | /* HCI Socket options */ 103 | #define HCI_DATA_DIR 1 104 | #define HCI_FILTER 2 105 | #define HCI_TIME_STAMP 3 106 | 107 | /* HCI CMSG flags */ 108 | #define HCI_CMSG_DIR 0x0001 109 | #define HCI_CMSG_TSTAMP 0x0002 110 | 111 | #ifndef VENDOR_LPM_PROC_NODE 112 | #define VENDOR_LPM_PROC_NODE "/sys/module/hci_uart/parameters/ath_lpm" 113 | #endif 114 | 115 | /* proc fs node for notifying write request */ 116 | #ifndef VENDOR_BTWRITE_PROC_NODE 117 | #define VENDOR_BTWRITE_PROC_NODE "/sys/module/hci_uart/parameters/ath_btwrite" 118 | #endif 119 | 120 | /****************************************************************************** 121 | ** Local type definitions 122 | ******************************************************************************/ 123 | typedef struct { 124 | uint8_t b[6]; 125 | } __attribute__((packed)) bdaddr_t; 126 | 127 | struct sockaddr_hci { 128 | sa_family_t hci_family; 129 | unsigned short hci_dev; 130 | unsigned short hci_channel; 131 | }; 132 | 133 | struct tag_info { 134 | unsigned section; 135 | unsigned line_count; 136 | unsigned char_cnt; 137 | unsigned byte_count; 138 | }; 139 | 140 | struct ps_cfg_entry { 141 | uint32_t id; 142 | uint32_t len; 143 | uint8_t *data; 144 | }; 145 | 146 | struct ps_entry_type { 147 | unsigned char type; 148 | unsigned char array; 149 | }; 150 | 151 | struct uart_t { 152 | char *type; 153 | int m_id; 154 | int p_id; 155 | int proto; 156 | int init_speed; 157 | int speed; 158 | int flags; 159 | int pm; 160 | char *bdaddr; 161 | int (*init) (int fd, struct uart_t *u, struct termios *ti); 162 | int (*post) (int fd, struct uart_t *u, struct termios *ti); 163 | }; 164 | #endif /* HW_AR3K_H */ 165 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/include/hw_ar3k.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef HW_AR3K_H 19 | #define HW_AR3K_H 20 | 21 | /****************************************************************************** 22 | ** Constants & Macros 23 | ******************************************************************************/ 24 | #define MAX_CNT_RETRY 100 25 | 26 | #define HCI_MAX_CMD_SIZE 260 27 | #define HCI_MAX_EVENT_SIZE 260 28 | #define HCI_CHG_BAUD_CMD_OCF 0x0C 29 | #define HCI_VENDOR_CMD_OGF 0x3F 30 | #define WRITE_BDADDR_CMD_LEN 14 31 | #define WRITE_BAUD_CMD_LEN 6 32 | #define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN 33 | #define GET_VERSION_OCF 0x1E 34 | /* Byte order conversions */ 35 | #if __BYTE_ORDER == __LITTLE_ENDIAN 36 | #define htobs(d) (d) 37 | #define htobl(d) (d) 38 | #define btohs(d) (d) 39 | #define btohl(d) (d) 40 | #elif __BYTE_ORDER == __BIG_ENDIAN 41 | #define htobs(d) bswap_16(d) 42 | #define htobl(d) bswap_32(d) 43 | #define btohs(d) bswap_16(d) 44 | #define btohl(d) bswap_32(d) 45 | #else 46 | #error "Unknown byte order" 47 | #endif 48 | 49 | #define FW_PATH "/system/etc/firmware/ar3k/" 50 | 51 | #define STREAM_TO_UINT16(u16, p) \ 52 | {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 53 | #define UINT16_TO_STREAM(p, u16) \ 54 | {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 55 | #define UINT32_TO_STREAM(p, u32) \ 56 | {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8);\ 57 | *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 58 | 59 | #define MAX_TAGS 50 60 | #define PS_HDR_LEN 4 61 | #define HCI_VENDOR_CMD_OGF 0x3F 62 | #define HCI_PS_CMD_OCF 0x0B 63 | 64 | #define VERIFY_CRC 9 65 | #define PS_REGION 1 66 | #define PATCH_REGION 2 67 | #define BDADDR_FILE "ar3kbdaddr.pst" 68 | 69 | 70 | #define MAX_PATCH_CMD 244 71 | struct patch_entry { 72 | int16_t len; 73 | uint8_t data[MAX_PATCH_CMD]; 74 | }; 75 | #define HCI_UART_RAW_DEVICE 0 76 | #define HCI_COMMAND_HDR_SIZE 3 77 | #define PS_WRITE 1 78 | #define PS_RESET 2 79 | #define WRITE_PATCH 8 80 | #define ENABLE_PATCH 11 81 | 82 | #define HCI_PS_CMD_HDR_LEN 7 83 | #define HCI_CMD_MAX_LEN 258 84 | #define PS_RESET_PARAM_LEN 6 85 | #define PS_RESET_CMD_LEN (HCI_PS_CMD_HDR_LEN + PS_RESET_PARAM_LEN) 86 | 87 | #define PS_ID_MASK 0xFF 88 | 89 | 90 | #define LOCAL_NAME_BUFFER_LEN 32 91 | #define DEV_REGISTER 0x4FFC 92 | #define GET_DEV_TYPE_OCF 0x05 93 | 94 | #define HCIDEVUP _IOW('H', 201, int) 95 | #define OGF_VENDOR_CMD 0x3f 96 | #define EVT_CMD_COMPLETE_SIZE 3 97 | #define EVT_CMD_STATUS 0x0F 98 | #define EVT_CMD_STATUS_SIZE 4 99 | #define HCI_COMMAND_HDR_SIZE 3 100 | #define HCI_EVENT_HDR_SIZE 2 101 | #define HCI_EV_SUCCESS 0x00 102 | /* HCI Socket options */ 103 | #define HCI_DATA_DIR 1 104 | #define HCI_FILTER 2 105 | #define HCI_TIME_STAMP 3 106 | 107 | /* HCI CMSG flags */ 108 | #define HCI_CMSG_DIR 0x0001 109 | #define HCI_CMSG_TSTAMP 0x0002 110 | 111 | #ifndef VENDOR_LPM_PROC_NODE 112 | #define VENDOR_LPM_PROC_NODE "/sys/module/hci_uart/parameters/ath_lpm" 113 | #endif 114 | 115 | /* proc fs node for notifying write request */ 116 | #ifndef VENDOR_BTWRITE_PROC_NODE 117 | #define VENDOR_BTWRITE_PROC_NODE "/sys/module/hci_uart/parameters/ath_btwrite" 118 | #endif 119 | 120 | /****************************************************************************** 121 | ** Local type definitions 122 | ******************************************************************************/ 123 | typedef struct { 124 | uint8_t b[6]; 125 | } __attribute__((packed)) bdaddr_t; 126 | 127 | struct sockaddr_hci { 128 | sa_family_t hci_family; 129 | unsigned short hci_dev; 130 | unsigned short hci_channel; 131 | }; 132 | 133 | struct tag_info { 134 | unsigned section; 135 | unsigned line_count; 136 | unsigned char_cnt; 137 | unsigned byte_count; 138 | }; 139 | 140 | struct ps_cfg_entry { 141 | uint32_t id; 142 | uint32_t len; 143 | uint8_t *data; 144 | }; 145 | 146 | struct ps_entry_type { 147 | unsigned char type; 148 | unsigned char array; 149 | }; 150 | 151 | struct uart_t { 152 | char *type; 153 | int m_id; 154 | int p_id; 155 | int proto; 156 | int init_speed; 157 | int speed; 158 | int flags; 159 | int pm; 160 | char *bdaddr; 161 | int (*init) (int fd, struct uart_t *u, struct termios *ti); 162 | int (*post) (int fd, struct uart_t *u, struct termios *ti); 163 | }; 164 | #endif /* HW_AR3K_H */ 165 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/include/hw_ar3k.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef HW_AR3K_H 19 | #define HW_AR3K_H 20 | 21 | #include 22 | 23 | /****************************************************************************** 24 | ** Constants & Macros 25 | ******************************************************************************/ 26 | #define MAX_CNT_RETRY 100 27 | 28 | #define HCI_MAX_CMD_SIZE 260 29 | #define HCI_MAX_EVENT_SIZE 260 30 | #define HCI_CHG_BAUD_CMD_OCF 0x0C 31 | #define HCI_VENDOR_CMD_OGF 0x3F 32 | #define WRITE_BDADDR_CMD_LEN 14 33 | #define WRITE_BAUD_CMD_LEN 6 34 | #define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN 35 | #define GET_VERSION_OCF 0x1E 36 | /* Byte order conversions */ 37 | #if __BYTE_ORDER == __LITTLE_ENDIAN 38 | #define htobs(d) (d) 39 | #define htobl(d) (d) 40 | #define btohs(d) (d) 41 | #define btohl(d) (d) 42 | #elif __BYTE_ORDER == __BIG_ENDIAN 43 | #define htobs(d) bswap_16(d) 44 | #define htobl(d) bswap_32(d) 45 | #define btohs(d) bswap_16(d) 46 | #define btohl(d) bswap_32(d) 47 | #else 48 | #error "Unknown byte order" 49 | #endif 50 | 51 | #define FW_PATH "/system/etc/firmware/ar3k/" 52 | 53 | #define STREAM_TO_UINT16(u16, p) \ 54 | {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;} 55 | #define UINT16_TO_STREAM(p, u16) \ 56 | {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} 57 | #define UINT32_TO_STREAM(p, u32) \ 58 | {*(p)++ = (uint8_t)(u32); *(p)++ = (uint8_t)((u32) >> 8);\ 59 | *(p)++ = (uint8_t)((u32) >> 16); *(p)++ = (uint8_t)((u32) >> 24);} 60 | 61 | #define MAX_TAGS 50 62 | #define PS_HDR_LEN 4 63 | #define HCI_VENDOR_CMD_OGF 0x3F 64 | #define HCI_PS_CMD_OCF 0x0B 65 | 66 | #define VERIFY_CRC 9 67 | #define PS_REGION 1 68 | #define PATCH_REGION 2 69 | #define BDADDR_FILE "ar3kbdaddr.pst" 70 | 71 | 72 | #define MAX_PATCH_CMD 244 73 | struct patch_entry { 74 | int16_t len; 75 | uint8_t data[MAX_PATCH_CMD]; 76 | }; 77 | #define HCI_UART_RAW_DEVICE 0 78 | #define HCI_COMMAND_HDR_SIZE 3 79 | #define PS_WRITE 1 80 | #define PS_RESET 2 81 | #define WRITE_PATCH 8 82 | #define ENABLE_PATCH 11 83 | 84 | #define HCI_PS_CMD_HDR_LEN 7 85 | #define HCI_CMD_MAX_LEN 258 86 | #define PS_RESET_PARAM_LEN 6 87 | #define PS_RESET_CMD_LEN (HCI_PS_CMD_HDR_LEN + PS_RESET_PARAM_LEN) 88 | 89 | #define PS_ID_MASK 0xFF 90 | 91 | 92 | #define LOCAL_NAME_BUFFER_LEN 32 93 | #define DEV_REGISTER 0x4FFC 94 | #define GET_DEV_TYPE_OCF 0x05 95 | 96 | #define HCIDEVUP _IOW('H', 201, int) 97 | #define OGF_VENDOR_CMD 0x3f 98 | #define EVT_CMD_COMPLETE_SIZE 3 99 | #define EVT_CMD_STATUS 0x0F 100 | #define EVT_CMD_STATUS_SIZE 4 101 | #define HCI_COMMAND_HDR_SIZE 3 102 | #define HCI_EVENT_HDR_SIZE 2 103 | #define HCI_EV_SUCCESS 0x00 104 | /* HCI Socket options */ 105 | #define HCI_DATA_DIR 1 106 | #define HCI_FILTER 2 107 | #define HCI_TIME_STAMP 3 108 | 109 | /* HCI CMSG flags */ 110 | #define HCI_CMSG_DIR 0x0001 111 | #define HCI_CMSG_TSTAMP 0x0002 112 | 113 | #ifndef VENDOR_LPM_PROC_NODE 114 | #define VENDOR_LPM_PROC_NODE "/sys/module/hci_uart/parameters/ath_lpm" 115 | #endif 116 | 117 | /* proc fs node for notifying write request */ 118 | #ifndef VENDOR_BTWRITE_PROC_NODE 119 | #define VENDOR_BTWRITE_PROC_NODE "/sys/module/hci_uart/parameters/ath_btwrite" 120 | #endif 121 | 122 | /****************************************************************************** 123 | ** Local type definitions 124 | ******************************************************************************/ 125 | typedef struct { 126 | uint8_t b[6]; 127 | } __attribute__((packed)) bdaddr_t; 128 | 129 | struct sockaddr_hci { 130 | sa_family_t hci_family; 131 | unsigned short hci_dev; 132 | unsigned short hci_channel; 133 | }; 134 | 135 | struct tag_info { 136 | unsigned section; 137 | unsigned line_count; 138 | unsigned char_cnt; 139 | unsigned byte_count; 140 | }; 141 | 142 | struct ps_cfg_entry { 143 | uint32_t id; 144 | uint32_t len; 145 | uint8_t *data; 146 | }; 147 | 148 | struct ps_entry_type { 149 | unsigned char type; 150 | unsigned char array; 151 | }; 152 | 153 | struct uart_t { 154 | char *type; 155 | int m_id; 156 | int p_id; 157 | int proto; 158 | int init_speed; 159 | int speed; 160 | int flags; 161 | int pm; 162 | char *bdaddr; 163 | int (*init) (int fd, struct uart_t *u, struct termios *ti); 164 | int (*post) (int fd, struct uart_t *u, struct termios *ti); 165 | }; 166 | #endif /* HW_AR3K_H */ 167 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_vendor" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include "bt_hci_bdroid.h" 42 | #include "bt_vendor_qcom.h" 43 | 44 | #define MAX_CNT_RETRY 100 45 | 46 | int hw_config(int nState) 47 | { 48 | ALOGI("Starting hciattach daemon"); 49 | char *szState[] = {"true", "false"}; 50 | char *szReqSt = NULL; 51 | 52 | if(nState == BT_VND_PWR_OFF) 53 | szReqSt = szState[1]; 54 | else 55 | szReqSt = szState[0]; 56 | 57 | ALOGI("try to set %s", szReqSt); 58 | 59 | if (property_set("bluetooth.hciattach", szReqSt) < 0){ 60 | ALOGE("Property Setting fail"); 61 | return -1; 62 | } 63 | 64 | return 0; 65 | } 66 | 67 | int readTrpState() 68 | { 69 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 70 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 71 | ALOGE("Fail to get bluetooth satus"); 72 | return FALSE; 73 | } 74 | 75 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 76 | ALOGI("bluetooth satus is on"); 77 | return TRUE; 78 | } 79 | return FALSE; 80 | } 81 | 82 | int is_hw_ready() 83 | { 84 | int i=0; 85 | char szStatus[10] = {0,}; 86 | 87 | for(i=MAX_CNT_RETRY; i>0; i--){ 88 | usleep(50*1000); 89 | //TODO :: checking routine 90 | if(readTrpState()==TRUE){ 91 | break; 92 | } 93 | } 94 | 95 | return (i==0)? FALSE:TRUE; 96 | } 97 | 98 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 99 | /******************************************************************************* 100 | ** 101 | ** Function hw_epilog_cback 102 | ** 103 | ** Description Callback function for Command Complete Events from HCI 104 | ** commands sent in epilog process. 105 | ** 106 | ** Returns None 107 | ** 108 | *******************************************************************************/ 109 | void hw_epilog_cback(void *p_mem) 110 | { 111 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 112 | char *p_name, *p_tmp; 113 | uint8_t *p, status; 114 | uint16_t opcode; 115 | 116 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 117 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 118 | STREAM_TO_UINT16(opcode,p); 119 | 120 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 121 | 122 | if (bt_vendor_cbacks) 123 | { 124 | /* Must free the RX event buffer */ 125 | bt_vendor_cbacks->dealloc(p_evt_buf); 126 | 127 | /* Once epilog process is done, must call callback to notify caller */ 128 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 129 | } 130 | } 131 | 132 | /******************************************************************************* 133 | ** 134 | ** Function hw_epilog_process 135 | ** 136 | ** Description Sample implementation of epilog process 137 | ** 138 | ** Returns None 139 | ** 140 | *******************************************************************************/ 141 | void hw_epilog_process(void) 142 | { 143 | HC_BT_HDR *p_buf = NULL; 144 | uint8_t *p; 145 | 146 | ALOGI("hw_epilog_process"); 147 | 148 | /* Sending a HCI_RESET */ 149 | if (bt_vendor_cbacks) 150 | { 151 | /* Must allocate command buffer via HC's alloc API */ 152 | p_buf = (HC_BT_HDR *) bt_vendor_cbacks->alloc(BT_HC_HDR_SIZE + \ 153 | HCI_CMD_PREAMBLE_SIZE); 154 | } 155 | 156 | if (p_buf) 157 | { 158 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 159 | p_buf->offset = 0; 160 | p_buf->layer_specific = 0; 161 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 162 | 163 | p = (uint8_t *) (p_buf + 1); 164 | UINT16_TO_STREAM(p, HCI_RESET); 165 | *p = 0; /* parameter length */ 166 | 167 | /* Send command via HC's xmit_cb API */ 168 | bt_vendor_cbacks->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 169 | } 170 | else 171 | { 172 | if (bt_vendor_cbacks) 173 | { 174 | ALOGE("vendor lib epilog process aborted [no buffer]"); 175 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_FAIL); 176 | } 177 | } 178 | } 179 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 180 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_hwcfg" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include "bt_types.h" 42 | #include "bt_hci_bdroid.h" 43 | #include "bt_vendor_qcom.h" 44 | 45 | #define MAX_CNT_RETRY 100 46 | 47 | int hw_config(int nState) 48 | { 49 | ALOGI("Starting hciattach daemon"); 50 | char *szState[] = {"true", "false"}; 51 | char *szReqSt = NULL; 52 | 53 | if(nState == BT_VND_PWR_OFF) 54 | szReqSt = szState[1]; 55 | else 56 | szReqSt = szState[0]; 57 | 58 | ALOGI("try to set %s", szReqSt); 59 | 60 | if (property_set("bluetooth.hciattach", szReqSt) < 0){ 61 | ALOGE("Property Setting fail"); 62 | return -1; 63 | } 64 | 65 | return 0; 66 | } 67 | 68 | int readTrpState() 69 | { 70 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 71 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 72 | ALOGE("Fail to get bluetooth satus"); 73 | return FALSE; 74 | } 75 | 76 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 77 | ALOGI("bluetooth satus is on"); 78 | return TRUE; 79 | } 80 | return FALSE; 81 | } 82 | 83 | int is_hw_ready() 84 | { 85 | int i=0; 86 | char szStatus[10] = {0,}; 87 | 88 | for(i=MAX_CNT_RETRY; i>0; i--){ 89 | usleep(50*1000); 90 | //TODO :: checking routine 91 | if(readTrpState()==TRUE){ 92 | break; 93 | } 94 | } 95 | 96 | return (i==0)? FALSE:TRUE; 97 | } 98 | 99 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 100 | /******************************************************************************* 101 | ** 102 | ** Function hw_epilog_cback 103 | ** 104 | ** Description Callback function for Command Complete Events from HCI 105 | ** commands sent in epilog process. 106 | ** 107 | ** Returns None 108 | ** 109 | *******************************************************************************/ 110 | void hw_epilog_cback(void *p_mem) 111 | { 112 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 113 | char *p_name, *p_tmp; 114 | uint8_t *p, status; 115 | uint16_t opcode; 116 | 117 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 118 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 119 | STREAM_TO_UINT16(opcode,p); 120 | 121 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 122 | 123 | if (bt_vendor_cbacks) 124 | { 125 | /* Must free the RX event buffer */ 126 | bt_vendor_cbacks->dealloc(p_evt_buf); 127 | 128 | /* Once epilog process is done, must call callback to notify caller */ 129 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 130 | } 131 | } 132 | 133 | /******************************************************************************* 134 | ** 135 | ** Function hw_epilog_process 136 | ** 137 | ** Description Sample implementation of epilog process 138 | ** 139 | ** Returns None 140 | ** 141 | *******************************************************************************/ 142 | void hw_epilog_process(void) 143 | { 144 | HC_BT_HDR *p_buf = NULL; 145 | uint8_t *p; 146 | 147 | ALOGI("hw_epilog_process"); 148 | 149 | /* Sending a HCI_RESET */ 150 | if (bt_vendor_cbacks) 151 | { 152 | /* Must allocate command buffer via HC's alloc API */ 153 | p_buf = (HC_BT_HDR *) bt_vendor_cbacks->alloc(BT_HC_HDR_SIZE + \ 154 | HCI_CMD_PREAMBLE_SIZE); 155 | } 156 | 157 | if (p_buf) 158 | { 159 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 160 | p_buf->offset = 0; 161 | p_buf->layer_specific = 0; 162 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 163 | 164 | p = (uint8_t *) (p_buf + 1); 165 | UINT16_TO_STREAM(p, HCI_RESET); 166 | *p = 0; /* parameter length */ 167 | 168 | /* Send command via HC's xmit_cb API */ 169 | bt_vendor_cbacks->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 170 | } 171 | else 172 | { 173 | if (bt_vendor_cbacks) 174 | { 175 | ALOGE("vendor lib epilog process aborted [no buffer]"); 176 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_FAIL); 177 | } 178 | } 179 | } 180 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 181 | 182 | 183 | -------------------------------------------------------------------------------- /msm8998/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_vendor" 28 | 29 | #include "bt_hci_bdroid.h" 30 | #include "bt_vendor_qcom.h" 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #define MAX_CNT_RETRY 100 46 | 47 | int hw_config(int nState) 48 | { 49 | char *szState[] = {"true", "false"}; 50 | char *szReqSt = NULL; 51 | char szBtSocStatus[PROPERTY_VALUE_MAX] = {'\0', }; 52 | 53 | if(nState == BT_VND_PWR_OFF) 54 | szReqSt = szState[1]; 55 | else 56 | szReqSt = szState[0]; 57 | 58 | if((property_get("bluetooth.status", szBtSocStatus, "") <= 0)) 59 | { 60 | if(nState == BT_VND_PWR_ON ) { 61 | ALOGW("Hw_config: First Time BT on after boot.Starting hciattach daemon BTStatus=%s",szBtSocStatus); 62 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 63 | { 64 | ALOGE("Hw_config: Property Setting fail"); 65 | return -1; 66 | } 67 | } 68 | } else if( !(strncmp(szBtSocStatus, "on", strlen("on")))) { 69 | //BTSOC is already on 70 | ALOGW("Hw_config: nState = %d", nState); 71 | } else { 72 | ALOGW("Hw_config: trigerring hciattach"); 73 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 74 | { 75 | ALOGE("Hw_config: Property Setting fail"); 76 | return -1; 77 | } 78 | } 79 | 80 | return 0; 81 | } 82 | 83 | int readTrpState() 84 | { 85 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 86 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 87 | ALOGE("Fail to get bluetooth status"); 88 | return FALSE; 89 | } 90 | 91 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 92 | ALOGI("bluetooth status is on"); 93 | return TRUE; 94 | } 95 | return FALSE; 96 | } 97 | 98 | int is_hw_ready() 99 | { 100 | int i=0; 101 | char szStatus[10] = {0,}; 102 | 103 | for(i=MAX_CNT_RETRY; i>0; i--){ 104 | //TODO :: checking routine 105 | if(readTrpState()==TRUE){ 106 | break; 107 | } 108 | usleep(50*1000); 109 | } 110 | return (i==0)? FALSE:TRUE; 111 | } 112 | 113 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 114 | /******************************************************************************* 115 | ** 116 | ** Function hw_epilog_cback 117 | ** 118 | ** Description Callback function for Command Complete Events from HCI 119 | ** commands sent in epilog process. 120 | ** 121 | ** Returns None 122 | ** 123 | *******************************************************************************/ 124 | void hw_epilog_cback(void *p_mem) 125 | { 126 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 127 | char *p_name, *p_tmp; 128 | uint8_t *p, status; 129 | uint16_t opcode; 130 | 131 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 132 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 133 | STREAM_TO_UINT16(opcode,p); 134 | 135 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 136 | 137 | /* Must free the RX event buffer */ 138 | q.cb->dealloc(p_evt_buf); 139 | 140 | /* Once epilog process is done, must call callback to notify caller */ 141 | q.cb->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 142 | 143 | } 144 | 145 | /******************************************************************************* 146 | ** 147 | ** Function hw_epilog_process 148 | ** 149 | ** Description Sample implementation of epilog process. This process is 150 | ** called with q_lock held and q.cb is assumed to be valid. 151 | ** 152 | ** Returns None 153 | ** 154 | *******************************************************************************/ 155 | void __hw_epilog_process(void) 156 | { 157 | HC_BT_HDR *p_buf = NULL; 158 | uint8_t *p; 159 | 160 | ALOGI("hw_epilog_process"); 161 | 162 | /* Sending a HCI_RESET */ 163 | /* Must allocate command buffer via HC's alloc API */ 164 | p_buf = (HC_BT_HDR *) q.cb->alloc(BT_HC_HDR_SIZE + HCI_CMD_PREAMBLE_SIZE); 165 | if (p_buf) 166 | { 167 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 168 | p_buf->offset = 0; 169 | p_buf->layer_specific = 0; 170 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 171 | 172 | p = (uint8_t *) (p_buf + 1); 173 | UINT16_TO_STREAM(p, HCI_RESET); 174 | *p = 0; /* parameter length */ 175 | 176 | /* Send command via HC's xmit_cb API */ 177 | q.cb->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 178 | } 179 | else 180 | { 181 | ALOGE("vendor lib epilog process aborted [no buffer]"); 182 | q.cb->epilog_cb(BT_VND_OP_RESULT_FAIL); 183 | } 184 | } 185 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 186 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_vendor" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include "bt_hci_bdroid.h" 41 | #include "bt_vendor_qcom.h" 42 | #include 43 | #define MAX_CNT_RETRY 100 44 | 45 | int hw_config(int nState) 46 | { 47 | char *szState[] = {"true", "false"}; 48 | char *szReqSt = NULL; 49 | char szBtSocStatus[PROPERTY_VALUE_MAX] = {'\0', }; 50 | 51 | if(nState == BT_VND_PWR_OFF) 52 | szReqSt = szState[1]; 53 | else 54 | szReqSt = szState[0]; 55 | 56 | if((property_get("bluetooth.status", szBtSocStatus, "") <= 0)) 57 | { 58 | if(nState == BT_VND_PWR_ON ) { 59 | ALOGW("Hw_config: First Time BT on after boot.Starting hciattach daemon BTStatus=%s",szBtSocStatus); 60 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 61 | { 62 | ALOGE("Hw_config: Property Setting fail"); 63 | return -1; 64 | } 65 | } 66 | } else if(nState == BT_VND_PWR_ON && !(strncmp(szBtSocStatus, "on", strlen("on")))) { 67 | //BTSOC is already on 68 | ALOGW("Hw_config: nState = %d", nState); 69 | } else { 70 | ALOGW("Hw_config: trigerring hciattach"); 71 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 72 | { 73 | ALOGE("Hw_config: Property Setting fail"); 74 | return -1; 75 | } 76 | } 77 | 78 | return 0; 79 | } 80 | 81 | int readTrpState() 82 | { 83 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 84 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 85 | ALOGE("Fail to get bluetooth status"); 86 | return FALSE; 87 | } 88 | 89 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 90 | ALOGI("bluetooth status is on"); 91 | return TRUE; 92 | } 93 | return FALSE; 94 | } 95 | 96 | int is_hw_ready() 97 | { 98 | int i=0; 99 | char szStatus[10] = {0,}; 100 | 101 | for(i=MAX_CNT_RETRY; i>0; i--){ 102 | //TODO :: checking routine 103 | if(readTrpState()==TRUE){ 104 | break; 105 | } 106 | usleep(50*1000); 107 | } 108 | return (i==0)? FALSE:TRUE; 109 | } 110 | 111 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 112 | /******************************************************************************* 113 | ** 114 | ** Function hw_epilog_cback 115 | ** 116 | ** Description Callback function for Command Complete Events from HCI 117 | ** commands sent in epilog process. 118 | ** 119 | ** Returns None 120 | ** 121 | *******************************************************************************/ 122 | void hw_epilog_cback(void *p_mem) 123 | { 124 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 125 | char *p_name, *p_tmp; 126 | uint8_t *p, status; 127 | uint16_t opcode; 128 | 129 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 130 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 131 | STREAM_TO_UINT16(opcode,p); 132 | 133 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 134 | 135 | if (bt_vendor_cbacks) 136 | { 137 | /* Must free the RX event buffer */ 138 | bt_vendor_cbacks->dealloc(p_evt_buf); 139 | 140 | /* Once epilog process is done, must call callback to notify caller */ 141 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 142 | } 143 | } 144 | 145 | /******************************************************************************* 146 | ** 147 | ** Function hw_epilog_process 148 | ** 149 | ** Description Sample implementation of epilog process 150 | ** 151 | ** Returns None 152 | ** 153 | *******************************************************************************/ 154 | void hw_epilog_process(void) 155 | { 156 | HC_BT_HDR *p_buf = NULL; 157 | uint8_t *p; 158 | 159 | ALOGI("hw_epilog_process"); 160 | 161 | /* Sending a HCI_RESET */ 162 | if (bt_vendor_cbacks) 163 | { 164 | /* Must allocate command buffer via HC's alloc API */ 165 | p_buf = (HC_BT_HDR *) bt_vendor_cbacks->alloc(BT_HC_HDR_SIZE + \ 166 | HCI_CMD_PREAMBLE_SIZE); 167 | } 168 | 169 | if (p_buf) 170 | { 171 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 172 | p_buf->offset = 0; 173 | p_buf->layer_specific = 0; 174 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 175 | 176 | p = (uint8_t *) (p_buf + 1); 177 | UINT16_TO_STREAM(p, HCI_RESET); 178 | *p = 0; /* parameter length */ 179 | 180 | /* Send command via HC's xmit_cb API */ 181 | bt_vendor_cbacks->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 182 | } 183 | else 184 | { 185 | if (bt_vendor_cbacks) 186 | { 187 | ALOGE("vendor lib epilog process aborted [no buffer]"); 188 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_FAIL); 189 | } 190 | } 191 | } 192 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 193 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_vendor" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "bt_hci_bdroid.h" 43 | #include "bt_vendor_qcom.h" 44 | #include 45 | #define MAX_CNT_RETRY 100 46 | 47 | int hw_config(int nState) 48 | { 49 | char *szState[] = {"true", "false"}; 50 | char *szReqSt = NULL; 51 | char szBtSocStatus[PROPERTY_VALUE_MAX] = {'\0', }; 52 | 53 | if(nState == BT_VND_PWR_OFF) 54 | szReqSt = szState[1]; 55 | else 56 | szReqSt = szState[0]; 57 | 58 | if((property_get("bluetooth.status", szBtSocStatus, "") <= 0)) 59 | { 60 | if(nState == BT_VND_PWR_ON ) { 61 | ALOGW("Hw_config: First Time BT on after boot.Starting hciattach daemon BTStatus=%s",szBtSocStatus); 62 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 63 | { 64 | ALOGE("Hw_config: Property Setting fail"); 65 | return -1; 66 | } 67 | } 68 | } else if( !(strncmp(szBtSocStatus, "on", strlen("on")))) { 69 | //BTSOC is already on 70 | ALOGW("Hw_config: nState = %d", nState); 71 | } else { 72 | ALOGW("Hw_config: trigerring hciattach"); 73 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 74 | { 75 | ALOGE("Hw_config: Property Setting fail"); 76 | return -1; 77 | } 78 | } 79 | 80 | return 0; 81 | } 82 | 83 | int readTrpState() 84 | { 85 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 86 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 87 | ALOGE("Fail to get bluetooth status"); 88 | return FALSE; 89 | } 90 | 91 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 92 | ALOGI("bluetooth status is on"); 93 | return TRUE; 94 | } 95 | return FALSE; 96 | } 97 | 98 | int is_hw_ready() 99 | { 100 | int i=0; 101 | char szStatus[10] = {0,}; 102 | 103 | for(i=MAX_CNT_RETRY; i>0; i--){ 104 | //TODO :: checking routine 105 | if(readTrpState()==TRUE){ 106 | break; 107 | } 108 | usleep(50*1000); 109 | } 110 | return (i==0)? FALSE:TRUE; 111 | } 112 | 113 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 114 | /******************************************************************************* 115 | ** 116 | ** Function hw_epilog_cback 117 | ** 118 | ** Description Callback function for Command Complete Events from HCI 119 | ** commands sent in epilog process. 120 | ** 121 | ** Returns None 122 | ** 123 | *******************************************************************************/ 124 | void hw_epilog_cback(void *p_mem) 125 | { 126 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 127 | char *p_name, *p_tmp; 128 | uint8_t *p, status; 129 | uint16_t opcode; 130 | 131 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 132 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 133 | STREAM_TO_UINT16(opcode,p); 134 | 135 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 136 | 137 | if (bt_vendor_cbacks) 138 | { 139 | /* Must free the RX event buffer */ 140 | bt_vendor_cbacks->dealloc(p_evt_buf); 141 | 142 | /* Once epilog process is done, must call callback to notify caller */ 143 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 144 | } 145 | } 146 | 147 | /******************************************************************************* 148 | ** 149 | ** Function hw_epilog_process 150 | ** 151 | ** Description Sample implementation of epilog process 152 | ** 153 | ** Returns None 154 | ** 155 | *******************************************************************************/ 156 | void hw_epilog_process(void) 157 | { 158 | HC_BT_HDR *p_buf = NULL; 159 | uint8_t *p; 160 | 161 | ALOGI("hw_epilog_process"); 162 | 163 | /* Sending a HCI_RESET */ 164 | if (bt_vendor_cbacks) 165 | { 166 | /* Must allocate command buffer via HC's alloc API */ 167 | p_buf = (HC_BT_HDR *) bt_vendor_cbacks->alloc(BT_HC_HDR_SIZE + \ 168 | HCI_CMD_PREAMBLE_SIZE); 169 | } 170 | 171 | if (p_buf) 172 | { 173 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 174 | p_buf->offset = 0; 175 | p_buf->layer_specific = 0; 176 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 177 | 178 | p = (uint8_t *) (p_buf + 1); 179 | UINT16_TO_STREAM(p, HCI_RESET); 180 | *p = 0; /* parameter length */ 181 | 182 | /* Send command via HC's xmit_cb API */ 183 | bt_vendor_cbacks->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 184 | } 185 | else 186 | { 187 | if (bt_vendor_cbacks) 188 | { 189 | ALOGE("vendor lib epilog process aborted [no buffer]"); 190 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_FAIL); 191 | } 192 | } 193 | } 194 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 195 | -------------------------------------------------------------------------------- /msm8909w_3100/libbt-vendor/src/hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: hardware.c 20 | * 21 | * Description: Contains controller-specific functions, like 22 | * firmware patch download 23 | * low power mode operations 24 | * 25 | ******************************************************************************/ 26 | 27 | #define LOG_TAG "bt_vendor" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include "bt_hci_bdroid.h" 41 | #include "bt_vendor_qcom.h" 42 | #include 43 | #define MAX_CNT_RETRY 100 44 | 45 | int hw_config(int nState) 46 | { 47 | char *szState[] = {"true", "false"}; 48 | char *szReqSt = NULL; 49 | char szBtSocStatus[PROPERTY_VALUE_MAX] = {'\0', }; 50 | 51 | if(nState == BT_VND_PWR_OFF) 52 | szReqSt = szState[1]; 53 | else 54 | szReqSt = szState[0]; 55 | 56 | if((property_get("bluetooth.status", szBtSocStatus, "") <= 0)) 57 | { 58 | if(nState == BT_VND_PWR_ON ) { 59 | ALOGW("Hw_config: First Time BT on after boot.Starting hciattach daemon BTStatus=%s",szBtSocStatus); 60 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 61 | { 62 | ALOGE("Hw_config: Property Setting fail"); 63 | return -1; 64 | } 65 | } 66 | } else if( !(strncmp(szBtSocStatus, "on", strlen("on")))) { 67 | //BTSOC is already on 68 | ALOGW("Hw_config: nState = %d", nState); 69 | } else { 70 | ALOGW("Hw_config: trigerring hciattach"); 71 | if (property_set("bluetooth.hciattach", szReqSt) < 0) 72 | { 73 | ALOGE("Hw_config: Property Setting fail"); 74 | return -1; 75 | } 76 | } 77 | 78 | return 0; 79 | } 80 | 81 | int readTrpState() 82 | { 83 | char szBtStatus[PROPERTY_VALUE_MAX] = {0, }; 84 | if(property_get("bluetooth.status", szBtStatus, "") < 0){ 85 | ALOGE("Fail to get bluetooth status"); 86 | return FALSE; 87 | } 88 | 89 | if(!strncmp(szBtStatus, "on", strlen("on"))){ 90 | ALOGI("bluetooth status is on"); 91 | return TRUE; 92 | } 93 | return FALSE; 94 | } 95 | 96 | int is_hw_ready() 97 | { 98 | int i=0; 99 | char szStatus[10] = {0,}; 100 | 101 | for(i=MAX_CNT_RETRY; i>0; i--){ 102 | //TODO :: checking routine 103 | if(readTrpState()==TRUE){ 104 | break; 105 | } 106 | usleep(50*1000); 107 | } 108 | return (i==0)? FALSE:TRUE; 109 | } 110 | 111 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 112 | /******************************************************************************* 113 | ** 114 | ** Function hw_epilog_cback 115 | ** 116 | ** Description Callback function for Command Complete Events from HCI 117 | ** commands sent in epilog process. 118 | ** 119 | ** Returns None 120 | ** 121 | *******************************************************************************/ 122 | void hw_epilog_cback(void *p_mem) 123 | { 124 | HC_BT_HDR *p_evt_buf = (HC_BT_HDR *) p_mem; 125 | char *p_name, *p_tmp; 126 | uint8_t *p, status; 127 | uint16_t opcode; 128 | 129 | status = *((uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_STATUS_RET_BYTE); 130 | p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; 131 | STREAM_TO_UINT16(opcode,p); 132 | 133 | ALOGI("%s Opcode:0x%04X Status: %d", __FUNCTION__, opcode, status); 134 | 135 | #ifdef BT_THREADLOCK_SAFE 136 | pthread_mutex_lock(&q_lock); 137 | #endif 138 | if (!q) { 139 | ALOGE("hw_epilog_cback called with NULL context"); 140 | goto out; 141 | } 142 | /* Must free the RX event buffer */ 143 | q->cb->dealloc(p_evt_buf); 144 | 145 | /* Once epilog process is done, must call callback to notify caller */ 146 | q->cb->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 147 | out: 148 | #ifdef BT_THREADLOCK_SAFE 149 | pthread_mutex_unlock(&q_lock); 150 | #endif 151 | return; 152 | } 153 | 154 | /******************************************************************************* 155 | ** 156 | ** Function hw_epilog_process 157 | ** 158 | ** Description Sample implementation of epilog process. This process is 159 | ** called with q_lock held and q->cb is assumed to be valid. 160 | ** 161 | ** Returns None 162 | ** 163 | *******************************************************************************/ 164 | void __hw_epilog_process(void) 165 | { 166 | HC_BT_HDR *p_buf = NULL; 167 | uint8_t *p; 168 | 169 | ALOGI("hw_epilog_process"); 170 | 171 | /* Sending a HCI_RESET */ 172 | /* Must allocate command buffer via HC's alloc API */ 173 | p_buf = (HC_BT_HDR *) q->cb->alloc(BT_HC_HDR_SIZE + HCI_CMD_PREAMBLE_SIZE); 174 | if (p_buf) 175 | { 176 | p_buf->event = MSG_STACK_TO_HC_HCI_CMD; 177 | p_buf->offset = 0; 178 | p_buf->layer_specific = 0; 179 | p_buf->len = HCI_CMD_PREAMBLE_SIZE; 180 | 181 | p = (uint8_t *) (p_buf + 1); 182 | UINT16_TO_STREAM(p, HCI_RESET); 183 | *p = 0; /* parameter length */ 184 | 185 | /* Send command via HC's xmit_cb API */ 186 | q->cb->xmit_cb(HCI_RESET, p_buf, hw_epilog_cback); 187 | } 188 | else 189 | { 190 | ALOGE("vendor lib epilog process aborted [no buffer]"); 191 | q->cb->epilog_cb(BT_VND_OP_RESULT_FAIL); 192 | } 193 | } 194 | #endif // (HW_NEED_END_WITH_HCI_RESET == TRUE) 195 | -------------------------------------------------------------------------------- /msm8960/libbt-vendor/src/bt_vendor_qcom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * 19 | * Filename: bt_vendor_brcm.c 20 | * 21 | * Description: Broadcom vendor specific library implementation 22 | * 23 | ******************************************************************************/ 24 | 25 | #define LOG_TAG "bt_vendor" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "bt_vendor_qcom.h" 32 | #include "userial_vendor.h" 33 | 34 | /****************************************************************************** 35 | ** Externs 36 | ******************************************************************************/ 37 | extern int hw_config(int nState); 38 | 39 | extern int is_hw_ready(); 40 | 41 | /****************************************************************************** 42 | ** Variables 43 | ******************************************************************************/ 44 | int pFd[2] = {0,}; 45 | bt_hci_transport_device_type bt_hci_transport_device; 46 | 47 | bt_vendor_callbacks_t *bt_vendor_cbacks = NULL; 48 | uint8_t vnd_local_bd_addr[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 49 | 50 | #if (HW_NEED_END_WITH_HCI_RESET == TRUE) 51 | void hw_epilog_process(void); 52 | #endif 53 | 54 | 55 | /****************************************************************************** 56 | ** Local type definitions 57 | ******************************************************************************/ 58 | 59 | 60 | /****************************************************************************** 61 | ** Functions 62 | ******************************************************************************/ 63 | 64 | /***************************************************************************** 65 | ** 66 | ** BLUETOOTH VENDOR INTERFACE LIBRARY FUNCTIONS 67 | ** 68 | *****************************************************************************/ 69 | 70 | static int init(const bt_vendor_callbacks_t* p_cb, unsigned char *local_bdaddr) 71 | { 72 | ALOGI("bt-vendor : init"); 73 | 74 | if (p_cb == NULL) 75 | { 76 | ALOGE("init failed with no user callbacks!"); 77 | return -1; 78 | } 79 | 80 | //userial_vendor_init(); 81 | //upio_init(); 82 | 83 | //vnd_load_conf(VENDOR_LIB_CONF_FILE); 84 | 85 | /* store reference to user callbacks */ 86 | bt_vendor_cbacks = (bt_vendor_callbacks_t *) p_cb; 87 | 88 | /* This is handed over from the stack */ 89 | memcpy(vnd_local_bd_addr, local_bdaddr, 6); 90 | 91 | return 0; 92 | } 93 | 94 | 95 | /** Requested operations */ 96 | static int op(bt_vendor_opcode_t opcode, void *param) 97 | { 98 | int retval = 0; 99 | int nCnt = 0; 100 | int nState = -1; 101 | 102 | ALOGV("bt-vendor : op for %d", opcode); 103 | 104 | switch(opcode) 105 | { 106 | case BT_VND_OP_POWER_CTRL: 107 | { 108 | nState = *(int *) param; 109 | retval = hw_config(nState); 110 | if(nState == BT_VND_PWR_ON 111 | && retval == 0 112 | && is_hw_ready() == TRUE){ 113 | retval = 0; 114 | } 115 | else { 116 | retval = -1; 117 | } 118 | } 119 | break; 120 | 121 | case BT_VND_OP_FW_CFG: 122 | { 123 | // call hciattach to initalize the stack 124 | if(bt_vendor_cbacks){ 125 | ALOGI("Bluetooth Firmware and smd is initialized"); 126 | bt_vendor_cbacks->fwcfg_cb(BT_VND_OP_RESULT_SUCCESS); 127 | } 128 | else{ 129 | ALOGE("Error : hci, smd initialization Error"); 130 | bt_vendor_cbacks->fwcfg_cb(BT_VND_OP_RESULT_FAIL); 131 | } 132 | } 133 | break; 134 | 135 | case BT_VND_OP_SCO_CFG: 136 | { 137 | bt_vendor_cbacks->scocfg_cb(BT_VND_OP_RESULT_SUCCESS); //dummy 138 | } 139 | break; 140 | 141 | case BT_VND_OP_USERIAL_OPEN: 142 | { 143 | if(bt_hci_init_transport(pFd) != -1){ 144 | int (*fd_array)[] = (int (*) []) param; 145 | 146 | (*fd_array)[CH_CMD] = pFd[0]; 147 | (*fd_array)[CH_EVT] = pFd[0]; 148 | (*fd_array)[CH_ACL_OUT] = pFd[1]; 149 | (*fd_array)[CH_ACL_IN] = pFd[1]; 150 | } 151 | else { 152 | retval = -1; 153 | break; 154 | } 155 | retval = 2; 156 | } 157 | break; 158 | 159 | case BT_VND_OP_USERIAL_CLOSE: 160 | { 161 | bt_hci_deinit_transport(pFd); 162 | } 163 | break; 164 | 165 | case BT_VND_OP_GET_LPM_IDLE_TIMEOUT: 166 | break; 167 | 168 | case BT_VND_OP_LPM_SET_MODE: 169 | { 170 | bt_vendor_cbacks->lpm_cb(BT_VND_OP_RESULT_SUCCESS); //dummy 171 | } 172 | break; 173 | 174 | case BT_VND_OP_LPM_WAKE_SET_STATE: 175 | break; 176 | case BT_VND_OP_EPILOG: 177 | { 178 | #if (HW_NEED_END_WITH_HCI_RESET == FALSE) 179 | if (bt_vendor_cbacks) 180 | { 181 | bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); 182 | } 183 | #else 184 | hw_epilog_process(); 185 | #endif 186 | } 187 | break; 188 | } 189 | 190 | return retval; 191 | } 192 | 193 | /** Closes the interface */ 194 | static void cleanup( void ) 195 | { 196 | ALOGI("cleanup"); 197 | 198 | //upio_cleanup(); 199 | 200 | bt_vendor_cbacks = NULL; 201 | } 202 | 203 | // Entry point of DLib 204 | const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = { 205 | sizeof(bt_vendor_interface_t), 206 | init, 207 | op, 208 | cleanup 209 | }; 210 | -------------------------------------------------------------------------------- /msm8909/libbt-vendor/include/hci_uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * Not a Contribution. 4 | * Copyright (C) 2009-2012 Broadcom Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef HCI_UART_H 20 | #define HCI_UART_H 21 | 22 | /* Variables to identify the platform */ 23 | /*BT HS UART TTY DEVICE */ 24 | #define BT_HS_UART_DEVICE "/dev/ttyHS0" 25 | 26 | /**** baud rates ****/ 27 | #define USERIAL_BAUD_300 0 28 | #define USERIAL_BAUD_600 1 29 | #define USERIAL_BAUD_1200 2 30 | #define USERIAL_BAUD_2400 3 31 | #define USERIAL_BAUD_9600 4 32 | #define USERIAL_BAUD_19200 5 33 | #define USERIAL_BAUD_57600 6 34 | #define USERIAL_BAUD_115200 7 35 | #define USERIAL_BAUD_230400 8 36 | #define USERIAL_BAUD_460800 9 37 | #define USERIAL_BAUD_921600 10 38 | #define USERIAL_BAUD_1M 11 39 | #define USERIAL_BAUD_1_5M 12 40 | #define USERIAL_BAUD_2M 13 41 | #define USERIAL_BAUD_3M 14 42 | #define USERIAL_BAUD_4M 15 43 | #define USERIAL_BAUD_AUTO 16 44 | 45 | /**** Data Format ****/ 46 | /* Stop Bits */ 47 | #define USERIAL_STOPBITS_1 1 48 | #define USERIAL_STOPBITS_1_5 (1<<1) 49 | #define USERIAL_STOPBITS_2 (1<<2) 50 | 51 | /* Parity Bits */ 52 | #define USERIAL_PARITY_NONE (1<<3) 53 | #define USERIAL_PARITY_EVEN (1<<4) 54 | #define USERIAL_PARITY_ODD (1<<5) 55 | 56 | /* Data Bits */ 57 | #define USERIAL_DATABITS_5 (1<<6) 58 | #define USERIAL_DATABITS_6 (1<<7) 59 | #define USERIAL_DATABITS_7 (1<<8) 60 | #define USERIAL_DATABITS_8 (1<<9) 61 | 62 | /* HCI Packet types */ 63 | #define HCI_COMMAND_PKT 0x01 64 | #define HCI_ACLDATA_PKT 0x02 65 | #define HCI_SCODATA_PKT 0x03 66 | #define HCI_EVENT_PKT 0x04 67 | #define HCI_VENDOR_PKT 0xff 68 | 69 | /* HCI Command/Event Opcode */ 70 | #define HCI_RESET 0x0C03 71 | #define EVT_CMD_COMPLETE 0x0E 72 | 73 | /* Command opcode pack/unpack */ 74 | #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10)) 75 | 76 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 77 | /* These are the ioctl values used for bt_wake ioctl via UART driver. you may 78 | * need to redefine them on you platform! 79 | * Logically they need to be unique and not colide with existing uart ioctl's. 80 | */ 81 | #ifndef USERIAL_IOCTL_BT_WAKE_ASSERT 82 | #define USERIAL_IOCTL_BT_WAKE_ASSERT 0x8003 83 | #endif 84 | #ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT 85 | #define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004 86 | #endif 87 | #ifndef USERIAL_IOCTL_BT_WAKE_GET_ST 88 | #define USERIAL_IOCTL_BT_WAKE_GET_ST 0x8005 89 | #endif 90 | #endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 91 | 92 | /* UART CLOCK IOCTLS*/ 93 | #define USERIAL_OP_CLK_ON 0x5441 94 | #define USERIAL_OP_CLK_OFF 0x5442 95 | #define USERIAL_OP_CLK_STATE 0x5443 96 | /****************************************************************************** 97 | ** Type definitions 98 | ******************************************************************************/ 99 | 100 | /* Structure used to configure serial port during open */ 101 | typedef struct 102 | { 103 | uint16_t fmt; /* Data format */ 104 | uint8_t baud; /* Baud rate */ 105 | } tUSERIAL_CFG; 106 | 107 | typedef enum { 108 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 109 | USERIAL_OP_ASSERT_BT_WAKE, 110 | USERIAL_OP_DEASSERT_BT_WAKE, 111 | USERIAL_OP_GET_BT_WAKE_STATE, 112 | #endif 113 | USERIAL_OP_FLOW_ON, 114 | USERIAL_OP_FLOW_OFF, 115 | USERIAL_OP_NOP, 116 | } userial_vendor_ioctl_op_t; 117 | 118 | /* UPIO signals */ 119 | enum { 120 | UPIO_BT_WAKE = 0, 121 | UPIO_HOST_WAKE, 122 | UPIO_LPM_MODE, 123 | UPIO_MAX_COUNT 124 | }; 125 | 126 | /* UPIO assertion/deassertion */ 127 | enum { 128 | UPIO_UNKNOWN = 0, 129 | UPIO_DEASSERT, 130 | UPIO_ASSERT 131 | }; 132 | 133 | #define VND_PORT_NAME_MAXLEN 256 134 | 135 | /* vendor serial control block */ 136 | typedef struct 137 | { 138 | int fd; /* fd to Bluetooth device */ 139 | struct termios termios; /* serial terminal of BT port */ 140 | char port_name[VND_PORT_NAME_MAXLEN]; 141 | } vnd_userial_cb_t; 142 | 143 | typedef struct { 144 | uint8_t ncmd; 145 | uint16_t opcode; 146 | } __attribute__ ((packed)) evt_cmd_complete; 147 | 148 | typedef struct { 149 | uint8_t status; 150 | uint8_t ncmd; 151 | uint16_t opcode; 152 | } __attribute__ ((packed)) evt_cmd_status; 153 | 154 | typedef struct { 155 | uint16_t opcode; 156 | uint8_t plen; 157 | } __attribute__ ((packed)) hci_command_hdr; 158 | 159 | typedef struct { 160 | uint8_t evt; 161 | uint8_t plen; 162 | } __attribute__ ((packed)) hci_event_hdr; 163 | 164 | /****************************************************************************** 165 | ** Extern 166 | ******************************************************************************/ 167 | extern vnd_userial_cb_t vnd_userial; 168 | 169 | 170 | /******************************************************************************* 171 | ** 172 | ** Function userial_vendor_init 173 | ** 174 | ** Description Initialize userial vendor-specific control block 175 | ** 176 | ** Returns None 177 | ** 178 | *******************************************************************************/ 179 | void userial_vendor_init(void); 180 | 181 | /******************************************************************************* 182 | ** 183 | ** Function userial_vendor_open 184 | ** 185 | ** Description Open the serial port with the given configuration 186 | ** 187 | ** Returns device fd 188 | ** 189 | *******************************************************************************/ 190 | int userial_vendor_open(tUSERIAL_CFG *p_cfg); 191 | 192 | /******************************************************************************* 193 | ** 194 | ** Function userial_vendor_close 195 | ** 196 | ** Description Conduct vendor-specific close work 197 | ** 198 | ** Returns None 199 | ** 200 | *******************************************************************************/ 201 | void userial_vendor_close(void); 202 | 203 | /******************************************************************************* 204 | ** 205 | ** Function userial_vendor_set_baud 206 | ** 207 | ** Description Set new baud rate 208 | ** 209 | ** Returns None 210 | ** 211 | *******************************************************************************/ 212 | void userial_vendor_set_baud(uint8_t userial_baud); 213 | 214 | /******************************************************************************* 215 | ** 216 | ** Function userial_vendor_ioctl 217 | ** 218 | ** Description ioctl inteface 219 | ** 220 | ** Returns int error 221 | ** 222 | *******************************************************************************/ 223 | int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data); 224 | 225 | /******************************************************************************* 226 | ** 227 | ** Function read_hci_event 228 | ** 229 | ** Description Read HCI event during vendor initialization 230 | ** 231 | ** Returns int: size to read 232 | ** 233 | *******************************************************************************/ 234 | int read_hci_event(int fd, unsigned char* buf, int size); 235 | 236 | #endif /* HCI_UART_H */ 237 | -------------------------------------------------------------------------------- /msm8992/libbt-vendor/include/hci_uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * Not a Contribution. 4 | * Copyright (C) 2009-2012 Broadcom Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef HCI_UART_H 20 | #define HCI_UART_H 21 | 22 | /* Variables to identify the platform */ 23 | /*BT HS UART TTY DEVICE */ 24 | #define BT_HS_UART_DEVICE "/dev/ttyHS0" 25 | 26 | /**** baud rates ****/ 27 | #define USERIAL_BAUD_300 0 28 | #define USERIAL_BAUD_600 1 29 | #define USERIAL_BAUD_1200 2 30 | #define USERIAL_BAUD_2400 3 31 | #define USERIAL_BAUD_9600 4 32 | #define USERIAL_BAUD_19200 5 33 | #define USERIAL_BAUD_57600 6 34 | #define USERIAL_BAUD_115200 7 35 | #define USERIAL_BAUD_230400 8 36 | #define USERIAL_BAUD_460800 9 37 | #define USERIAL_BAUD_921600 10 38 | #define USERIAL_BAUD_1M 11 39 | #define USERIAL_BAUD_1_5M 12 40 | #define USERIAL_BAUD_2M 13 41 | #define USERIAL_BAUD_3M 14 42 | #define USERIAL_BAUD_4M 15 43 | #define USERIAL_BAUD_AUTO 16 44 | 45 | /**** Data Format ****/ 46 | /* Stop Bits */ 47 | #define USERIAL_STOPBITS_1 1 48 | #define USERIAL_STOPBITS_1_5 (1<<1) 49 | #define USERIAL_STOPBITS_2 (1<<2) 50 | 51 | /* Parity Bits */ 52 | #define USERIAL_PARITY_NONE (1<<3) 53 | #define USERIAL_PARITY_EVEN (1<<4) 54 | #define USERIAL_PARITY_ODD (1<<5) 55 | 56 | /* Data Bits */ 57 | #define USERIAL_DATABITS_5 (1<<6) 58 | #define USERIAL_DATABITS_6 (1<<7) 59 | #define USERIAL_DATABITS_7 (1<<8) 60 | #define USERIAL_DATABITS_8 (1<<9) 61 | 62 | /* HCI Packet types */ 63 | #define HCI_COMMAND_PKT 0x01 64 | #define HCI_ACLDATA_PKT 0x02 65 | #define HCI_SCODATA_PKT 0x03 66 | #define HCI_EVENT_PKT 0x04 67 | #define HCI_VENDOR_PKT 0xff 68 | 69 | /* HCI Command/Event Opcode */ 70 | #define HCI_RESET 0x0C03 71 | #define EVT_CMD_COMPLETE 0x0E 72 | 73 | /* Command opcode pack/unpack */ 74 | #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10)) 75 | 76 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 77 | /* These are the ioctl values used for bt_wake ioctl via UART driver. you may 78 | * need to redefine them on you platform! 79 | * Logically they need to be unique and not colide with existing uart ioctl's. 80 | */ 81 | #ifndef USERIAL_IOCTL_BT_WAKE_ASSERT 82 | #define USERIAL_IOCTL_BT_WAKE_ASSERT 0x8003 83 | #endif 84 | #ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT 85 | #define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004 86 | #endif 87 | #ifndef USERIAL_IOCTL_BT_WAKE_GET_ST 88 | #define USERIAL_IOCTL_BT_WAKE_GET_ST 0x8005 89 | #endif 90 | #endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 91 | 92 | /* UART CLOCK IOCTLS*/ 93 | #define USERIAL_OP_CLK_ON 0x5441 94 | #define USERIAL_OP_CLK_OFF 0x5442 95 | #define USERIAL_OP_CLK_STATE 0x5443 96 | /****************************************************************************** 97 | ** Type definitions 98 | ******************************************************************************/ 99 | 100 | /* Structure used to configure serial port during open */ 101 | typedef struct 102 | { 103 | uint16_t fmt; /* Data format */ 104 | uint8_t baud; /* Baud rate */ 105 | } tUSERIAL_CFG; 106 | 107 | typedef enum { 108 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 109 | USERIAL_OP_ASSERT_BT_WAKE, 110 | USERIAL_OP_DEASSERT_BT_WAKE, 111 | USERIAL_OP_GET_BT_WAKE_STATE, 112 | #endif 113 | USERIAL_OP_FLOW_ON, 114 | USERIAL_OP_FLOW_OFF, 115 | USERIAL_OP_NOP, 116 | } userial_vendor_ioctl_op_t; 117 | 118 | /* UPIO signals */ 119 | enum { 120 | UPIO_BT_WAKE = 0, 121 | UPIO_HOST_WAKE, 122 | UPIO_LPM_MODE, 123 | UPIO_MAX_COUNT 124 | }; 125 | 126 | /* UPIO assertion/deassertion */ 127 | enum { 128 | UPIO_UNKNOWN = 0, 129 | UPIO_DEASSERT, 130 | UPIO_ASSERT 131 | }; 132 | 133 | #define VND_PORT_NAME_MAXLEN 256 134 | 135 | /* vendor serial control block */ 136 | typedef struct 137 | { 138 | int fd; /* fd to Bluetooth device */ 139 | struct termios termios; /* serial terminal of BT port */ 140 | char port_name[VND_PORT_NAME_MAXLEN]; 141 | } vnd_userial_cb_t; 142 | 143 | typedef struct { 144 | uint8_t ncmd; 145 | uint16_t opcode; 146 | } __attribute__ ((packed)) evt_cmd_complete; 147 | 148 | typedef struct { 149 | uint8_t status; 150 | uint8_t ncmd; 151 | uint16_t opcode; 152 | } __attribute__ ((packed)) evt_cmd_status; 153 | 154 | typedef struct { 155 | uint16_t opcode; 156 | uint8_t plen; 157 | } __attribute__ ((packed)) hci_command_hdr; 158 | 159 | typedef struct { 160 | uint8_t evt; 161 | uint8_t plen; 162 | } __attribute__ ((packed)) hci_event_hdr; 163 | 164 | /****************************************************************************** 165 | ** Extern 166 | ******************************************************************************/ 167 | extern vnd_userial_cb_t vnd_userial; 168 | 169 | 170 | /******************************************************************************* 171 | ** 172 | ** Function userial_vendor_init 173 | ** 174 | ** Description Initialize userial vendor-specific control block 175 | ** 176 | ** Returns None 177 | ** 178 | *******************************************************************************/ 179 | void userial_vendor_init(void); 180 | 181 | /******************************************************************************* 182 | ** 183 | ** Function userial_vendor_open 184 | ** 185 | ** Description Open the serial port with the given configuration 186 | ** 187 | ** Returns device fd 188 | ** 189 | *******************************************************************************/ 190 | int userial_vendor_open(tUSERIAL_CFG *p_cfg); 191 | 192 | /******************************************************************************* 193 | ** 194 | ** Function userial_vendor_close 195 | ** 196 | ** Description Conduct vendor-specific close work 197 | ** 198 | ** Returns None 199 | ** 200 | *******************************************************************************/ 201 | void userial_vendor_close(void); 202 | 203 | /******************************************************************************* 204 | ** 205 | ** Function userial_vendor_set_baud 206 | ** 207 | ** Description Set new baud rate 208 | ** 209 | ** Returns None 210 | ** 211 | *******************************************************************************/ 212 | void userial_vendor_set_baud(uint8_t userial_baud); 213 | 214 | /******************************************************************************* 215 | ** 216 | ** Function userial_vendor_ioctl 217 | ** 218 | ** Description ioctl inteface 219 | ** 220 | ** Returns int error 221 | ** 222 | *******************************************************************************/ 223 | int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data); 224 | 225 | /******************************************************************************* 226 | ** 227 | ** Function read_hci_event 228 | ** 229 | ** Description Read HCI event during vendor initialization 230 | ** 231 | ** Returns int: size to read 232 | ** 233 | *******************************************************************************/ 234 | int read_hci_event(int fd, unsigned char* buf, int size); 235 | 236 | #endif /* HCI_UART_H */ 237 | -------------------------------------------------------------------------------- /msm8996/libbt-vendor/include/hci_uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 3 | * Not a Contribution. 4 | * Copyright (C) 2009-2012 Broadcom Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef HCI_UART_H 20 | #define HCI_UART_H 21 | 22 | /* Variables to identify the platform */ 23 | /*BT HS UART TTY DEVICE */ 24 | #define BT_HS_UART_DEVICE "/dev/ttyHS0" 25 | 26 | /**** baud rates ****/ 27 | #define USERIAL_BAUD_300 0 28 | #define USERIAL_BAUD_600 1 29 | #define USERIAL_BAUD_1200 2 30 | #define USERIAL_BAUD_2400 3 31 | #define USERIAL_BAUD_9600 4 32 | #define USERIAL_BAUD_19200 5 33 | #define USERIAL_BAUD_57600 6 34 | #define USERIAL_BAUD_115200 7 35 | #define USERIAL_BAUD_230400 8 36 | #define USERIAL_BAUD_460800 9 37 | #define USERIAL_BAUD_921600 10 38 | #define USERIAL_BAUD_1M 11 39 | #define USERIAL_BAUD_1_5M 12 40 | #define USERIAL_BAUD_2M 13 41 | #define USERIAL_BAUD_3M 14 42 | #define USERIAL_BAUD_4M 15 43 | #define USERIAL_BAUD_AUTO 16 44 | 45 | /**** Data Format ****/ 46 | /* Stop Bits */ 47 | #define USERIAL_STOPBITS_1 1 48 | #define USERIAL_STOPBITS_1_5 (1<<1) 49 | #define USERIAL_STOPBITS_2 (1<<2) 50 | 51 | /* Parity Bits */ 52 | #define USERIAL_PARITY_NONE (1<<3) 53 | #define USERIAL_PARITY_EVEN (1<<4) 54 | #define USERIAL_PARITY_ODD (1<<5) 55 | 56 | /* Data Bits */ 57 | #define USERIAL_DATABITS_5 (1<<6) 58 | #define USERIAL_DATABITS_6 (1<<7) 59 | #define USERIAL_DATABITS_7 (1<<8) 60 | #define USERIAL_DATABITS_8 (1<<9) 61 | 62 | /* HCI Packet types */ 63 | #define HCI_COMMAND_PKT 0x01 64 | #define HCI_ACLDATA_PKT 0x02 65 | #define HCI_SCODATA_PKT 0x03 66 | #define HCI_EVENT_PKT 0x04 67 | #define HCI_VENDOR_PKT 0xff 68 | 69 | /* HCI Command/Event Opcode */ 70 | #define HCI_RESET 0x0C03 71 | #define EVT_CMD_COMPLETE 0x0E 72 | 73 | /* Command opcode pack/unpack */ 74 | #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10)) 75 | 76 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 77 | /* These are the ioctl values used for bt_wake ioctl via UART driver. you may 78 | * need to redefine them on you platform! 79 | * Logically they need to be unique and not colide with existing uart ioctl's. 80 | */ 81 | #ifndef USERIAL_IOCTL_BT_WAKE_ASSERT 82 | #define USERIAL_IOCTL_BT_WAKE_ASSERT 0x8003 83 | #endif 84 | #ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT 85 | #define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004 86 | #endif 87 | #ifndef USERIAL_IOCTL_BT_WAKE_GET_ST 88 | #define USERIAL_IOCTL_BT_WAKE_GET_ST 0x8005 89 | #endif 90 | #endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 91 | 92 | /* UART CLOCK IOCTLS*/ 93 | #define USERIAL_OP_CLK_ON 0x5441 94 | #define USERIAL_OP_CLK_OFF 0x5442 95 | #define USERIAL_OP_CLK_STATE 0x5443 96 | /****************************************************************************** 97 | ** Type definitions 98 | ******************************************************************************/ 99 | 100 | /* Structure used to configure serial port during open */ 101 | typedef struct 102 | { 103 | uint16_t fmt; /* Data format */ 104 | uint8_t baud; /* Baud rate */ 105 | } tUSERIAL_CFG; 106 | 107 | typedef enum { 108 | #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) 109 | USERIAL_OP_ASSERT_BT_WAKE, 110 | USERIAL_OP_DEASSERT_BT_WAKE, 111 | USERIAL_OP_GET_BT_WAKE_STATE, 112 | #endif 113 | USERIAL_OP_FLOW_ON, 114 | USERIAL_OP_FLOW_OFF, 115 | USERIAL_OP_NOP, 116 | } userial_vendor_ioctl_op_t; 117 | 118 | /* UPIO signals */ 119 | enum { 120 | UPIO_BT_WAKE = 0, 121 | UPIO_HOST_WAKE, 122 | UPIO_LPM_MODE, 123 | UPIO_MAX_COUNT 124 | }; 125 | 126 | /* UPIO assertion/deassertion */ 127 | enum { 128 | UPIO_UNKNOWN = 0, 129 | UPIO_DEASSERT, 130 | UPIO_ASSERT 131 | }; 132 | 133 | #define VND_PORT_NAME_MAXLEN 256 134 | 135 | /* vendor serial control block */ 136 | typedef struct 137 | { 138 | int fd; /* fd to Bluetooth device */ 139 | struct termios termios; /* serial terminal of BT port */ 140 | char port_name[VND_PORT_NAME_MAXLEN]; 141 | } vnd_userial_cb_t; 142 | 143 | typedef struct { 144 | uint8_t ncmd; 145 | uint16_t opcode; 146 | } __attribute__ ((packed)) evt_cmd_complete; 147 | 148 | typedef struct { 149 | uint8_t status; 150 | uint8_t ncmd; 151 | uint16_t opcode; 152 | } __attribute__ ((packed)) evt_cmd_status; 153 | 154 | typedef struct { 155 | uint16_t opcode; 156 | uint8_t plen; 157 | } __attribute__ ((packed)) hci_command_hdr; 158 | 159 | typedef struct { 160 | uint8_t evt; 161 | uint8_t plen; 162 | } __attribute__ ((packed)) hci_event_hdr; 163 | 164 | /****************************************************************************** 165 | ** Extern 166 | ******************************************************************************/ 167 | extern vnd_userial_cb_t vnd_userial; 168 | 169 | 170 | /******************************************************************************* 171 | ** 172 | ** Function userial_vendor_init 173 | ** 174 | ** Description Initialize userial vendor-specific control block 175 | ** 176 | ** Returns None 177 | ** 178 | *******************************************************************************/ 179 | void userial_vendor_init(void); 180 | 181 | /******************************************************************************* 182 | ** 183 | ** Function userial_vendor_open 184 | ** 185 | ** Description Open the serial port with the given configuration 186 | ** 187 | ** Returns device fd 188 | ** 189 | *******************************************************************************/ 190 | int userial_vendor_open(tUSERIAL_CFG *p_cfg); 191 | 192 | /******************************************************************************* 193 | ** 194 | ** Function userial_vendor_close 195 | ** 196 | ** Description Conduct vendor-specific close work 197 | ** 198 | ** Returns None 199 | ** 200 | *******************************************************************************/ 201 | void userial_vendor_close(void); 202 | 203 | /******************************************************************************* 204 | ** 205 | ** Function userial_vendor_set_baud 206 | ** 207 | ** Description Set new baud rate 208 | ** 209 | ** Returns None 210 | ** 211 | *******************************************************************************/ 212 | void userial_vendor_set_baud(uint8_t userial_baud); 213 | 214 | /******************************************************************************* 215 | ** 216 | ** Function userial_vendor_ioctl 217 | ** 218 | ** Description ioctl inteface 219 | ** 220 | ** Returns int error 221 | ** 222 | *******************************************************************************/ 223 | int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data); 224 | 225 | /******************************************************************************* 226 | ** 227 | ** Function read_hci_event 228 | ** 229 | ** Description Read HCI event during vendor initialization 230 | ** 231 | ** Returns int: size to read 232 | ** 233 | *******************************************************************************/ 234 | int read_hci_event(int fd, unsigned char* buf, int size); 235 | 236 | #endif /* HCI_UART_H */ 237 | --------------------------------------------------------------------------------