From f4df98ff9ef3c9ecfd045f5695a7653be3cd4e8b Mon Sep 17 00:00:00 2001 From: Kibum Kim Date: Mon, 27 Feb 2012 21:15:49 +0900 Subject: [PATCH] tizen beta release --- AUTHORS | 2 + CMakeLists.txt | 4 + LICENSE | 204 +++++ debian/bt-firmware-43xx.install.in | 4 + debian/bt-firmware-43xx.postinst | 19 + debian/changelog | 5 + debian/compat | 1 + debian/control | 21 + debian/rules | 134 ++++ packaging/bt-firmware-43xx.spec | 36 + scripts/CMakeLists.txt | 48 ++ scripts/bluetooth-address | 9 + .../broadcom/BCM4330B1_002.001.003.0221.0265.hcd | Bin 0 -> 32195 bytes scripts/broadcom/bcmtool_4330b1.c | 865 +++++++++++++++++++++ scripts/broadcom/bt-dev-end.sh.broadcom | 32 + scripts/broadcom/bt-dev-start.sh.broadcom | 57 ++ scripts/broadcom/bt-set-addr.sh.broadcom | 16 + scripts/bt-reset-env.sh | 29 + scripts/bt-stack-down.sh | 18 + scripts/bt-stack-up.sh | 31 + set-address/CMakeLists.txt | 32 + set-address/setbd.c | 283 +++++++ 22 files changed, 1850 insertions(+) create mode 100644 AUTHORS create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 debian/bt-firmware-43xx.install.in create mode 100644 debian/bt-firmware-43xx.postinst create mode 100755 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 packaging/bt-firmware-43xx.spec create mode 100755 scripts/CMakeLists.txt create mode 100755 scripts/bluetooth-address create mode 100644 scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd create mode 100644 scripts/broadcom/bcmtool_4330b1.c create mode 100755 scripts/broadcom/bt-dev-end.sh.broadcom create mode 100755 scripts/broadcom/bt-dev-start.sh.broadcom create mode 100755 scripts/broadcom/bt-set-addr.sh.broadcom create mode 100755 scripts/bt-reset-env.sh create mode 100755 scripts/bt-stack-down.sh create mode 100755 scripts/bt-stack-up.sh create mode 100644 set-address/CMakeLists.txt create mode 100644 set-address/setbd.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..71e3ece --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +HyeongBae Park +Ankur Gandhi diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..defa1dd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +ADD_SUBDIRECTORY(set-address) +ADD_SUBDIRECTORY(scripts) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a06208b --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/debian/bt-firmware-43xx.install.in b/debian/bt-firmware-43xx.install.in new file mode 100644 index 0000000..e228a1d --- /dev/null +++ b/debian/bt-firmware-43xx.install.in @@ -0,0 +1,4 @@ +@PLUGIN_PREFIX@/bin/* +@PREFIX@/bin/setbd +@PREFIX@/etc/bluetooth/* +/etc/* diff --git a/debian/bt-firmware-43xx.postinst b/debian/bt-firmware-43xx.postinst new file mode 100644 index 0000000..39af43a --- /dev/null +++ b/debian/bt-firmware-43xx.postinst @@ -0,0 +1,19 @@ +#!/bin/sh + +####################################################################### +# Rename the script files +mv ${SYSLAYER}/usr/etc/bluetooth/bt-dev-start.sh.broadcom ${SYSLAYER}/usr/etc/bluetooth/bt-dev-start.sh +mv ${SYSLAYER}/usr/etc/bluetooth/bt-dev-end.sh.broadcom ${SYSLAYER}/usr/etc/bluetooth/bt-dev-end.sh +mv /usr/etc/bluetooth/bt-set-addr.sh.broadcom /usr/etc/bluetooth/bt-set-addr.sh + +#BCM4330B1_002.001.003.0221.0265.hcd (U1 Commercial Firmware 2.3.5) +# Change File Permission +chmod 644 ${SYSLAYER}/usr/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd + + +# root case +if [ ${USER} = "root" ] +then +chown root:root ${SYSLAYER}/usr/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd + +fi diff --git a/debian/changelog b/debian/changelog new file mode 100755 index 0000000..7f8f38e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +bt-firmware-43xx (0.1.0) unstable; urgency=low + + * Initail Release + + -- DoHyun Pyun Tue, 14 Feb 2012 15:13:03 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..32b94e0 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: bt-firmware-43xx +Section: devel +Priority: optional +Maintainer: DoHyun Pyun , ChanYeol Park , Girish A J , InJun Yang +Uploaders: Sunil Behera , Syam Sidhardhan +Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-glib-1-dev, libvconf-dev +Standards-Version: 3.7.2 +Homepage: N/A + +Package: bt-firmware-43xx +Architecture: any +Section: utils +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Tools and scripts for Bluetooth stack + +Package: bt-firmware-43xx-dbg +Section: debug +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, bt-firmware-43xx (= ${Source-Version}) +Description: Tools and scripts for Bluetooth stack (unstripped) + The package contains detached debugging symbols for the binary packages diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..bc4025a --- /dev/null +++ b/debian/rules @@ -0,0 +1,134 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt +PLUGIN_PREFIX ?= /usr + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS) -fpie" LDFLAGS="$(LDFLAGS) -pie" \ + cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPLUGIN_INSTALL_PREFIX=$(PLUGIN_PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + sed -i -e "s#@PLUGIN_PREFIX@#$(PLUGIN_PREFIX)#g" $${f%.in}; \ + done + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + + + for f in `find $(CURDIR)/ -name "CMakeCache.txt"`; do \ + rm -f $${f}; \ + done + for f in `find $(CURDIR)/ -name "CMakeFiles"`; do \ + rm -rf $${f}; \ + done + for f in `find $(CURDIR)/ -name "cmake_install.cmake"`; do \ + rm -f $${f}; \ + done + for f in `find $(CURDIR)/ -name "Makefile"`; do \ + rm -f $${f}; \ + done + for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \ + rm -f $${f}; \ + done + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + rm -f scripts/BCM_FIRMWARE*.hcd + rm -f scripts/bt-dev-end.sh + rm -f scripts/bt-dev-start.sh + rm -f scripts/bt-set-addr.sh + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/wavplayer. + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + # Booting script + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d + ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S60bluetooth-address + ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S60bluetooth-address + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip --dbg-package=bt-firmware-43xx-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/packaging/bt-firmware-43xx.spec b/packaging/bt-firmware-43xx.spec new file mode 100644 index 0000000..e759818 --- /dev/null +++ b/packaging/bt-firmware-43xx.spec @@ -0,0 +1,36 @@ + +Name: bt-firmware-43xx +Summary: Tools and scripts for Bluetooth stack +Version: 0.1.0 +Release: 1 +Group: TO_BE/FILLED_IN +License: GPL +Source0: %{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(vconf) +BuildRequires: cmake + +%description +Tools and scripts for Bluetooth stack + +%prep +%setup -q + +%build +export CFLAGS+=" $CFLAGS -fpie" +export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DPLUGIN_INSTALL_PREFIX=/usr + + +%install +rm -rf %{buildroot} +%make_install + + +%files +/etc/rc.d/init.d/* +/lib/firmware/* +/usr/bin/* +/usr/etc/bluetooth/* diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100755 index 0000000..e12875e --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,48 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(bcmtool C) + +SET(SRCS_4330B1 broadcom/bcmtool_4330b1.c) + +SET(BCMTOOL_4330B1 ${PROJECT_NAME}_4330b1) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(package REQUIRED glib-2.0 dbus-glib-1) + +FOREACH(flag ${package_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") + +ADD_EXECUTABLE(${BCMTOOL_4330B1} ${SRCS_4330B1}) + +TARGET_LINK_LIBRARIES(${BCMTOOL_4330B1} ${package_LDFLAGS}) + +# install firmware +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) + +# install binary file +INSTALL(TARGETS ${BCMTOOL_4330B1} DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin) + +# install script files +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-dev-start.sh.broadcom DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-dev-end.sh.broadcom DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-set-addr.sh.broadcom DESTINATION etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-stack-up.sh DESTINATION etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-stack-down.sh DESTINATION etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-reset-env.sh DESTINATION etc/bluetooth) + +# install booting script +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-address DESTINATION /etc/rc.d/init.d) diff --git a/scripts/bluetooth-address b/scripts/bluetooth-address new file mode 100755 index 0000000..3a3a4b0 --- /dev/null +++ b/scripts/bluetooth-address @@ -0,0 +1,9 @@ +#!/bin/sh + +# +# Script for setting local Bluetooth Address during booting time +# + +if [ -x /usr/etc/bluetooth/bt-set-addr.sh ]; then + /usr/etc/bluetooth/bt-set-addr.sh & +fi diff --git a/scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd b/scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd new file mode 100644 index 0000000000000000000000000000000000000000..a8c7f302ed86f84eedbd65a64a9947947dcb2f0f GIT binary patch literal 32195 zcmd433wT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Ho8_BbnQpTpJXfQ(L;{Fr@&IIn3#j$(#wGZ$k+i%6M0qr%i&tZ<;~udM0yB^RLXt+0$G4K-M*7d zBI~rb#$Vi->WR`XW-)2H36`U_pwC2vZXG7`5(1B*Nge^Q zLn_R?d%N|LFm!A?Wet}R(sj08-h`lcNa-Vypn!94hZ!aN{4 znkrzjf#E6kp_A- z)EO9ki77blr{b@wUYN@5=sQ078;NH#Nj!z?wTw|CNL$7zNK&mWrA4jRgcNvbvTLfV z3=Yanmvu&kmN{l%`O(nRO!8dL!qgwEw&C(DyQB>D{Juw;ajW)9D$XR~SgidIWtk7A z`}aw}E}k8YR3FI91W30wLza7amzZHEayoMq@>NO-LUlf)>HvXmn(i=l1gt4L05Whg zOR7kPrAy_F+WG$=p)HN@$cA@qMU+Wp+LI_?5@^Rs@aUWwtU{3`#2Ofby<9H_0anqA z8Lr3^tF;%#j{^zpFntkFc9#JcSt(oHE|2kHWw-EURKUDGdh?@#bi}T!Ht!;Q*NHJg zs{AJTEP~BRKtFIbL+T7vxyH5Dae^`@!Rddy`;*;i&xdy~Upk#augt?x+W7Ly9QNh} z#*NzHG$Z273D#@G$ZQm+h1wq^roL+sXQA6pikaQ*{sZvJ8B!Jn(O$0&o+KJhY=z_- T5|+thN-__Poi$?y%5U_48~_0} literal 0 HcmV?d00001 diff --git a/scripts/broadcom/bcmtool_4330b1.c b/scripts/broadcom/bcmtool_4330b1.c new file mode 100644 index 0000000..6350a06 --- /dev/null +++ b/scripts/broadcom/bcmtool_4330b1.c @@ -0,0 +1,865 @@ +/***************************************************************************** +** +** Name: bcmtool.c +** +** Description: Download a patchram files for the HCD format +** +** Copyright (c) 2000-2009, Broadcom Corp., All Rights Reserved. +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define N_HCI 15 +#define HCI_UART_H4 0 +#define HCI_UART_BCSP 1 +#define HCI_UART_3WIRE 2 +#define HCI_UART_H4DS 3 +#define HCI_UART_LL 4 +#define HCIUARTSETPROTO _IOW('U', 200, int) +#define HCIUARTGETPROTO _IOR('U', 201, int) +#define HCIUARTGETDEVICE _IOR('U', 202, int) + +/* Pre baudrate change for fast download */ +#define HIGH_SPEED_PATCHRAM_DOWNLOAD TRUE + +/* Host Stack Idle Threshold */ +#define HCILP_IDLE_THRESHOLD 0x01 + +/* Host Controller Idle Threshold */ +#define HCILP_HC_IDLE_THRESHOLD 0x01 + +/* BT_WAKE Polarity - 0=Active Low, 1= Active High */ +#define HCILP_BT_WAKE_POLARITY 1 + +/* HOST_WAKE Polarity - 0=Active Low, 1= Active High */ +#define HCILP_HOST_WAKE_POLARITY 1 + +/* Local Feature */ +#define BCM_DISABLE_RF_PWRCTRL FALSE + + + + +#define RELEASE_DATE "2011.02.07" +#define DEBUG 1 + +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned long UINT32; +typedef signed long INT32; +typedef signed char INT8; +typedef signed short INT16; +typedef unsigned char BOOLEAN; + +#define FALSE 0 +#define TRUE (!FALSE) + +#define BD_ADDR_LEN 6 /* Device address length */ +typedef UINT8 BD_ADDR[BD_ADDR_LEN]; /* Device address */ + + + +#define HCI_GRP_LINK_CONTROL_CMDS (0x01 << 10) +#define HCI_GRP_LINK_POLICY_CMDS (0x02 << 10) +#define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10) +#define HCI_GRP_INFORMATIONAL_PARAMS (0x04 << 10) +#define HCI_GRP_STATUS_PARAMS (0x05 << 10) +#define HCI_GRP_TESTING_CMDS (0x06 << 10) +#define HCI_GRP_L2CAP_CMDS (0x07 << 10) +#define HCI_GRP_L2CAP_HCI_EVTS (0x08 << 10) +#define HCI_GRP_VENDOR_SPECIFIC (0x3F << 10) + + +#define HCI_RESET (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS) +#define HCI_SET_EVENT_FILTER (0x0005 | HCI_GRP_HOST_CONT_BASEBAND_CMDS) +#define HCI_READ_SCAN_ENABLE (0x0019 | HCI_GRP_HOST_CONT_BASEBAND_CMDS) +#define HCI_WRITE_SCAN_ENABLE (0x001A | HCI_GRP_HOST_CONT_BASEBAND_CMDS) + +#define HCI_READ_LOCAL_VERSION_INFO (0x0001 | HCI_GRP_INFORMATIONAL_PARAMS) +#define HCI_READ_LOCAL_FEATURES (0x0003 | HCI_GRP_INFORMATIONAL_PARAMS) + +#define HCI_ENABLE_DEV_UNDER_TEST_MODE (0x0003 | HCI_GRP_TESTING_CMDS) + +#define HCI_BRCM_SUPER_PEEK_POKE (0x000A | HCI_GRP_VENDOR_SPECIFIC) +#define VSC_WRITE_BD_ADDR (0x0001 | HCI_GRP_VENDOR_SPECIFIC) +#define VSC_HCI_CMD_SET_LOC_FEATURES_CMD (0x000B | HCI_GRP_VENDOR_SPECIFIC) +#define HCI_BRCM_UPDATE_BAUDRATE_CMD (0x0018 | HCI_GRP_VENDOR_SPECIFIC) +#define HCI_BRCM_WRITE_SCO_PCM_INT_PARAM (0x001C | HCI_GRP_VENDOR_SPECIFIC) +#define VSC_WRITE_PCM_DATA_FORMAT_PARAM (0x001E | HCI_GRP_VENDOR_SPECIFIC) +#define HCI_BRCM_WRITE_SLEEP_MODE (0x0027 | HCI_GRP_VENDOR_SPECIFIC) +#define HCI_BRCM_DOWNLOAD_MINI_DRV (0x002E | HCI_GRP_VENDOR_SPECIFIC) +#define VSC_WRITE_UART_CLOCK_SETTING (0x0045 | HCI_GRP_VENDOR_SPECIFIC) + + +#define VOICE_SETTING_MU_LAW_MD 0x0100 +#define VOICE_SETTING_LINEAR_MD 0x0060 + +#define HCI_ARM_MEM_PEEK 0x04 +#define HCI_ARM_MEM_POKE 0x05 + +#define BTUI_MAX_STRING_LENGTH_PER_LINE 255 +#define HCI_BRCM_WRITE_SLEEP_MODE_LENGTH 10 + +#define HCI_BRCM_UPDATE_BAUD_RATE_ENCODED_LENGTH 0x02 +#define HCI_BRCM_UPDATE_BAUD_RATE_UNENCODED_LENGTH 0x06 + +#define VSC_WRITE_UART_CLOCK_SETTING_LEN 1 + +/* print string with time stamp */ +#define TDEBUG0(m) if(debug_mode) {print_time();fprintf(stderr,m);} +#define TDEBUG1(m,n1) if(debug_mode) {print_time();fprintf(stderr,m,n1);} +#define TDEBUG2(m,n1,n2) if(debug_mode) {print_time();fprintf(stderr,m,n1,n2);} +#define TDEBUG3(m,n1,n2,n3) if(debug_mode) {print_time();fprintf(stderr,m,n1,n2,n3);} +#define TDEBUG4(m,n1,n2,n3,n4) if(debug_mode) {print_time();fprintf(stderr,m,n1,n2,n3,n4);} +#define TDEBUG5(m,n1,n2,n3,n4,n5) if(debug_mode) {print_time();fprintf(stderr,m,n1,n2,n3,n4,n5);} +#define TDEBUG6(m,n1,n2,n3,n4,n5,n6) if(debug_mode) {print_time();fprintf(stderr,m,n1,n2,n3,n4,n5,n6);} + +/* print just string */ +#define DEBUG0(m) if(debug_mode) {fprintf(stderr,m);} +#define DEBUG1(m,n1) if(debug_mode) {fprintf(stderr,m,n1);} +#define DEBUG2(m,n1,n2) if(debug_mode) {fprintf(stderr,m,n1,n2);} +#define DEBUG3(m,n1,n2,n3) if(debug_mode) {fprintf(stderr,m,n1,n2,n3);} +#define DEBUG4(m,n1,n2,n3,n4) if(debug_mode) {fprintf(stderr,m,n1,n2,n3,n4);} +#define DEBUG5(m,n1,n2,n3,n4,n5) if(debug_mode) {fprintf(stderr,m,n1,n2,n3,n4,n5);} +#define DEBUG6(m,n1,n2,n3,n4,n5,n6) if(debug_mode) {fprintf(stderr,m,n1,n2,n3,n4,n5,n6);} + + +#define STREAM_TO_UINT8(u8, p) {u8 = (UINT8)(*(p)); (p) += 1;} +#define STREAM_TO_UINT16(u16, p) {u16 = ((UINT16)(*(p)) + (((UINT16)(*((p) + 1))) << 8)); (p) += 2;} +#define STREAM_TO_UINT32(u32, p) {u32 = (((UINT32)(*(p))) + ((((UINT32)(*((p) + 1)))) << 8) + ((((UINT32)(*((p) + 2)))) << 16) + ((((UINT32)(*((p) + 3)))) << 24)); (p) += 4;} + +#define ROTATE_BD_ADDR(p1, p2) \ + do \ + { \ + p1[0] = p2[5]; \ + p1[1] = p2[4]; \ + p1[2] = p2[3]; \ + p1[3] = p2[2]; \ + p1[4] = p2[1]; \ + p1[5] = p2[0]; \ + } while (0) + + +UINT8 vsc_for_pcm_config[5] = {0x00, 0x00, 0x03, 0x03, 0x00}; +/* + Byte1 -- 0 for MSb first + Byte2 -- 0 Fill value + Byte3 -- 1 Fill option (0:0's, 1:1's , 2:Signed, 3:Programmable) + Byte4 -- 1 Number of fill bits + Byte5 -- 1 Right justified (0 for left justified) +*/ + +UINT8 vsc_for_sco_pcm[5] = {0x00, 0x01, 0x00, 0x01, 0x01}; +/* + Neverland : PCM, 256, short, master ,master + Volance : PCM, 256, short, master ,master + + Byte1 -- 0 for PCM 1 for UART or USB + Byte2 -- 0 : 128, 1: 256, 2:512, 3:1024, 4:2048 Khz + Byte3 -- 0 for short frame sync 1 for long frame sync + Byte4 -- 0 Clock direction 0 for same as sync 1 for opposite direction + Byte5 -- 0 for slave 1 for master +*/ + +int fd; /* HCI handle */ + +BOOLEAN debug_mode = FALSE; /* Debug Mode Enable */ + +unsigned char buffer[1024]; + +struct termios termios; + +void ChangeBaudRate(UINT32 baudrate); + + +void exit_err(UINT8 err) +{ +#if ( HIGH_SPEED_PATCHRAM_DOWNLOAD == TRUE ) + ChangeBaudRate(115200); +#endif + exit(err); +} + +void print_time(void) +{ +#if 0 + struct timespec tp; + int rs; + + rs = clock_gettime(CLOCK_REALTIME,&tp); + fprintf(stderr, "[%04d : %06d]\n", tp.tv_sec, tp.tv_nsec/1000); + return; +#endif +} + +void dump(unsigned char *out, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + if (!(i % 16)) + { + DEBUG0( "\n"); + } + DEBUG1( "%02x ", out[i]); + } + DEBUG0( "\n\n"); +} + +UINT8 SendCommand(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf) +{ + UINT8 pbuf[255] = {0,}; + UINT8 i=0; + + pbuf[0] = 0x1; + pbuf[1] = (UINT8)(opcode); + pbuf[2] = (UINT8)(opcode >>8); + pbuf[3] = param_len; + + for (i=0; i 3) + { + fprintf(stderr, "[ERR] HCI reset time expired\n"); + exit(1); + } +} + +void read_event(int fd, unsigned char *buffer) +{ + int i = 0; + int len = 3; + int count; + + while ((count = read(fd, &buffer[i], len)) < len) + { + i += count; + len -= count; + } + + i += count; + len = buffer[2]; + + while ((count = read(fd, &buffer[i], len)) < len) + { + i += count; + len -= count; + } + +#ifdef DEBUG + count += i; + + DEBUG1( "\nreceived %d", count); + dump(buffer, count); +#endif +} + +INT32 filesize (char *name) +{ + INT32 size; + int flag; + struct stat buf; + + flag = stat (name,&buf); + if (flag == -1) + return -1; + + size = buf.st_size; + return (size); +} + +void DisplayProgress(int total, int val) +{ +#if 0 + #define PROGRESS_NUM 20 + + int p; + int i; + char text[PROGRESS_NUM+2]={0,}; + + text[0]='['; + text[PROGRESS_NUM+1]=']'; + p=(val*PROGRESS_NUM)/total; + + for ( i=1; i<=p; i++) + { + text[i]='='; + } + + for ( i=p+1; i<=PROGRESS_NUM; i++) + { + text[i]=' '; + } + + + for ( i=0; i<=(PROGRESS_NUM+1); i++) + { + fprintf(stderr, "%c",text[i]); + } + + if( p >= PROGRESS_NUM) + fprintf(stderr, " %6d/%6d\n",val,total); + else + fprintf(stderr, " %6d/%6d\r",val,total); +#else + if( val == total) + fprintf(stderr, " %6d/%6d\n",val,total); + else + fprintf(stderr, " %6d/%6d\r",val,total); +#endif +} + +UINT8 DownloadPatchram( char *patchram1 ) +{ + UINT32 len; + char prm[128] ={0,}; + FILE* pFile = NULL; + + INT32 FileSize=0; + INT32 SentSize=0; + + DEBUG1( "\n%s\n", patchram1); + + /* HCI reset */ + DEBUG0( "HCI reset\n"); + SendCommand(HCI_RESET, 0, NULL); + alarm(1); + read_event(fd, buffer); + alarm(0); + +#if ( HIGH_SPEED_PATCHRAM_DOWNLOAD == TRUE ) + ChangeBaudRate(921600); +#endif + + strcpy(prm, patchram1); + + fprintf(stderr, "Download Start\n"); + + if ((pFile = fopen(prm, "r")) == NULL) + { + fprintf(stderr, "file %s could not be opened, error %d\n", prm, errno); + exit_err(1); + } + FileSize = filesize(prm); + + SendCommand(HCI_BRCM_DOWNLOAD_MINI_DRV, 0, NULL); + read_event(fd, buffer); + + usleep(50000); + + while (fread(&buffer[1], sizeof(UINT8), 3 ,pFile)) + { + buffer[0] = 0x01; + + len = buffer[3]; + + fread(&buffer[4],sizeof(UINT8),len, pFile); + + write(fd, buffer, len + 4); + + /* dispaly progress*/ + SentSize += (len + 3); + DisplayProgress(FileSize,SentSize); + /* dispaly progress*/ + + read_event(fd, buffer); + + } + fclose(pFile); + + usleep(100000); /*100ms delay */ + + tcflush(fd, TCIOFLUSH); + tcgetattr(fd, &termios); + cfmakeraw(&termios); + termios.c_cflag |= CRTSCTS; + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcflush(fd, TCIOFLUSH); + cfsetospeed(&termios, B115200); + cfsetispeed(&termios, B115200); + tcsetattr(fd, TCSANOW, &termios); + + /* Send HCI_RESET Command and process event */ + DEBUG0( "HCI reset\n"); + SendCommand(HCI_RESET, 0, NULL); + alarm(1); + read_event(fd, buffer); + alarm(0); + fprintf(stderr,"Download Complete\n"); + + return 0; +} + +void SetScanEnable(void) +{ + UINT8 scan_data[1] ; + + /* 0x00: No scan enabled */ + /* 0x01: Inquiry scan enabled | Page scan disabled */ + /* 0x02: Inquiry scan disabled | Page scan enabled */ + /* 0x03: Inquiry scan enabled | Page scan enabled */ + + scan_data[0]= 0x03; + SendCommand(HCI_WRITE_SCAN_ENABLE, 1, &scan_data[0]); + read_event(fd, buffer); +} + +void SetAudio(void) +{ + fprintf(stderr,"Write Audio parameter\n"); + + DEBUG5( "vsc_for_sco_pcm = {%d,%d,%d,%d,%d}\n", vsc_for_sco_pcm[0], + vsc_for_sco_pcm[1],vsc_for_sco_pcm[2], + vsc_for_sco_pcm[3],vsc_for_sco_pcm[4]); + + SendCommand(HCI_BRCM_WRITE_SCO_PCM_INT_PARAM, 5, (UINT8 *)vsc_for_sco_pcm); + read_event(fd, buffer); + + DEBUG5( "vsc_for_pcm_config = {%d,%d,%d,%d,%d}\n", vsc_for_pcm_config[0], + vsc_for_pcm_config[1], vsc_for_pcm_config[2], + vsc_for_pcm_config[3], vsc_for_pcm_config[4]); + + SendCommand(VSC_WRITE_PCM_DATA_FORMAT_PARAM, 5, (UINT8 *)vsc_for_pcm_config); + read_event(fd, buffer); +} + +void SetPcmConf( UINT8 p0, UINT8 p1, UINT8 p2, UINT8 p3, UINT8 p4 ) +{ + vsc_for_pcm_config[0] = p0; + vsc_for_pcm_config[1] = p1; + vsc_for_pcm_config[2] = p2; + vsc_for_pcm_config[3] = p3; + vsc_for_pcm_config[4] = p4; +} + +void SetScoConf( UINT8 p0, UINT8 p1, UINT8 p2, UINT8 p3, UINT8 p4 ) +{ + vsc_for_sco_pcm[0] = p0; + vsc_for_sco_pcm[1] = p1; + vsc_for_sco_pcm[2] = p2; + vsc_for_sco_pcm[3] = p3; + vsc_for_sco_pcm[4] = p4; +} + +void HCILP_Enable(BOOLEAN on) +{ + fprintf(stderr,"Set Low Power mode %d\n",on); + UINT8 data[HCI_BRCM_WRITE_SLEEP_MODE_LENGTH] = { + 0x01, /* Sleep Mode algorithm 1 */ + HCILP_IDLE_THRESHOLD, /* Host Idle Treshold in 300ms */ + HCILP_HC_IDLE_THRESHOLD, /* Host Controller Idle Treshold in 300ms */ /* this should be less than scan interval.*/ + HCILP_BT_WAKE_POLARITY, /* BT_WAKE Polarity - 0=Active Low, 1= Active High*/ + HCILP_HOST_WAKE_POLARITY, /* HOST_WAKE Polarity - 0=Active Low, 1= Active High */ + 0x01, /* Allow host Sleep during SCO */ + 0x01, /* Combine Sleep Mode and LPM - The device will not sleep in mode 0 if this flag is set to 1,*/ + 0x00, /* UART_TXD Tri-State : 0x00 = Do not tri-state UART_TXD in sleep mode */ + 0x00, /* NA to Mode 1 */ + 0x00, /* NA to Mode 1 */ + }; + + if(on) + { + data[0] = 0x01; + } + else + { + data[0] = 0x00; + } + + SendCommand(HCI_BRCM_WRITE_SLEEP_MODE, HCI_BRCM_WRITE_SLEEP_MODE_LENGTH, (UINT8 *)data); + read_event(fd, buffer); +} + +UINT32 uart_speed(UINT32 Speed) +{ + switch (Speed) + { + case 115200: + return B115200; + case 230400: + return B230400; + case 460800: + return B460800; + case 921600: + return B921600; + case 1000000: + return B1000000; + case 1500000: + return B1500000; + case 2000000: + return B2000000; + case 2500000: + return B2500000; + case 3000000: + return B3000000; + case 4000000: + return B4000000; + default: + return B115200; + } +} + +void ChangeBaudRate(UINT32 baudrate) +{ + UINT8 hci_data[HCI_BRCM_UPDATE_BAUD_RATE_UNENCODED_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + UINT8 uart_clock_24 = 0x2; /* 0x1 - UART Clock 48MHz, 0x2 - UART Clock 24MHz */ + UINT8 uart_clock_48 = 0x1; /* 0x1 - UART Clock 48MHz, 0x2 - UART Clock 24MHz */ + + switch(baudrate) + { + case 115200: + case 230400: + case 460800: + case 921600: + case 1000000: + case 1500000: + case 2000000: + case 2500000: + /* Write UART Clock setting of 24MHz */ + DEBUG0( "Change UART_CLOCK 24Mhz\n"); + SendCommand( VSC_WRITE_UART_CLOCK_SETTING, VSC_WRITE_UART_CLOCK_SETTING_LEN, (UINT8 *)&uart_clock_24); + read_event(fd, buffer); + break; + + case 3000000: + case 4000000: + /* Write UART Clock setting of 48MHz */ + DEBUG0( "Change UART_CLOCK 48Mh\nz"); + SendCommand( VSC_WRITE_UART_CLOCK_SETTING, VSC_WRITE_UART_CLOCK_SETTING_LEN, (UINT8 *)&uart_clock_48); + read_event(fd, buffer); + break; + + default: + fprintf(stderr,"Not Support baudrate = %ld\n", baudrate); + exit_err(1); + break; + } + + hci_data[2] = baudrate & 0xFF; + hci_data[3] = (baudrate >> 8) & 0xFF; + hci_data[4] = (baudrate >> 16) & 0xFF; + hci_data[5] = (baudrate >> 24) & 0xFF; + + DEBUG1( "Change Baudrate %ld\n",baudrate); + + SendCommand( HCI_BRCM_UPDATE_BAUDRATE_CMD, HCI_BRCM_UPDATE_BAUD_RATE_UNENCODED_LENGTH, (UINT8 *)hci_data); + read_event(fd, buffer); + + + tcflush(fd, TCIOFLUSH); + tcgetattr(fd, &termios); + cfmakeraw(&termios); + termios.c_cflag |= CRTSCTS; + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcflush(fd, TCIOFLUSH); + cfsetospeed(&termios, uart_speed(baudrate)); + cfsetispeed(&termios, uart_speed(baudrate)); + tcsetattr(fd, TCSANOW, &termios); + +} + +void EnableTestMode(void) +{ + UINT8 filter_data[] = { 0x02, 0x00, 0x02 }; + + /* bt sleep disable */ + HCILP_Enable(FALSE); + + /* Enable both Inquiry & Page Scans */ + SetScanEnable(); + + /* Set Event Filter: Enable Auto Connect */ + SendCommand( HCI_SET_EVENT_FILTER, 0x03, (UINT8 *)filter_data); + read_event(fd, buffer); + + /* Enable Device under test */ + SendCommand( HCI_ENABLE_DEV_UNDER_TEST_MODE, 0x0, NULL); + read_event(fd, buffer); + + fprintf(stderr,"Enable Device Under Test\n"); +} + +void SetLocalFeatures(void) +{ + UINT8 *data = NULL; + + DEBUG0("Read Local Feature\n"); + SendCommand(HCI_READ_LOCAL_FEATURES, 0, NULL); + read_event(fd, buffer); + + data = &buffer[7]; + +#if (BCM_DISABLE_RF_PWRCTRL == TRUE) + fprintf(stderr,"Remove Power Control\n"); + data[2] &= 0xFB; /* Power contrel */ +#endif + DEBUG0("Write Local Feature\n"); + SendCommand(VSC_HCI_CMD_SET_LOC_FEATURES_CMD, 0x08, (UINT8 *)data); + read_event(fd, buffer); +} + +void EnbleHCI(void) +{ + int i = N_HCI; + int proto = HCI_UART_H4; + + if (ioctl(fd, TIOCSETD, &i) < 0) + { + fprintf(stderr, "Can't set line discipline\n"); + return; + } + + if (ioctl(fd, HCIUARTSETPROTO, proto) < 0) + { + fprintf(stderr, "Can't set hci protocol\n"); + return; + } + fprintf(stderr, "Done setting line discpline\n"); + return; + +} +void print_usage( void ) +{ + fprintf(stderr,"\n"); + fprintf(stderr,"BRCM BT tool for Linux release %s\n",RELEASE_DATE); + fprintf(stderr,"\n"); + fprintf(stderr," Usage: bcmtool [command parameter],....\n\n"); + fprintf(stderr," -FILE Patchram file name EX) -FILE=BCM43xx_xxx.hcd\n"); + fprintf(stderr," -BAUD Set Baudrate EX) -BAUD=3000000\n"); + fprintf(stderr," -ADDR BD addr file name EX) -ADDR=.bdaddr\n"); + fprintf(stderr," -SCO Enable SCO/PCM config EX) -SCO\n"); + fprintf(stderr," -SETSCO SCO/PCM values verify EX) -SETSCO=0,1,0,1,1,0,0,3,3,0\n"); + fprintf(stderr," -LP Enable Low power EX) -LP\n"); + fprintf(stderr," -FEATURE Set local Feature EX) -FEATURE\n"); + fprintf(stderr," -DUT Enable DUT mode(do not use with -LP) EX) -DUT\n"); + fprintf(stderr," -ATTACH Attach BT controller to BlueZ stack EX) -ATTACH\n"); + fprintf(stderr," -DEBUG Debug message EX) -DEBUG\n"); + fprintf(stderr,"\n"); +} + +int main(int argc, char *argv[]) +{ + UINT8 i = 0; + + if (argc < 2) + { + print_usage(); + exit(1); + } + else + { + fprintf(stderr,"BRCM BT tool for Linux release %s\n",RELEASE_DATE); + } + + /* Open dev port */ + if ((fd = open(argv[1], O_RDWR | O_NOCTTY)) == -1) + { + fprintf(stderr, "port %s could not be opened, error %d\n", argv[1], errno); + exit(2); + } + + tcflush(fd, TCIOFLUSH); + tcgetattr(fd, &termios); + cfmakeraw(&termios); + termios.c_cflag |= CRTSCTS; + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcsetattr(fd, TCSANOW, &termios); + tcflush(fd, TCIOFLUSH); + tcflush(fd, TCIOFLUSH); + cfsetospeed(&termios, B115200); + cfsetispeed(&termios, B115200); + tcsetattr(fd, TCSANOW, &termios); + + signal(SIGALRM, expired); + + for( i=2; i /sys/class/gpio/gpio17/value +# sleep 0.1 +# echo 1 > /sys/class/gpio/gpio17/value +#fi + diff --git a/scripts/broadcom/bt-dev-start.sh.broadcom b/scripts/broadcom/bt-dev-start.sh.broadcom new file mode 100755 index 0000000..df893da --- /dev/null +++ b/scripts/broadcom/bt-dev-start.sh.broadcom @@ -0,0 +1,57 @@ +#!/bin/sh + +# +# Script for registering Broadcom UART BT device +# +PLUGIN_DIR= +BT_UART_DEVICE=/dev/ttySAC0 +BT_CHIP_TYPE=bcm2035 +BCM_TOOL=$PLUGIN_DIR/usr/bin/bcmtool_4330b1 +BCM_FIRMWARE=BCM4330B1_002.001.003.0221.0265.hcd + +BT_PLATFORM_DEFAULT_HCI_NAME="SLP2.0_BT" +UART_SPEED=921600 + +REVISION_NUM=`grep Revision /proc/cpuinfo | awk "{print \\$3}"` +REVISION_HIGH=`echo $REVISION_NUM| cut -c1-2` +REVISION_LOW=`echo $REVISION_NUM| cut -c3-` + +HARDWARE=`grep Hardware /proc/cpuinfo | awk "{print \\$3}"` + +if [ ! -e "$BT_UART_DEVICE" ] +then + mknod $BT_UART_DEVICE c 204 64 +fi + +if [ ! -e /opt/etc/.bd_addr ] +then + # Set BT address + /usr/bin/setbd +fi + +# Trun-on Bluetooth Chip +rfkill unblock bluetooth + +echo "Check for Bluetooth device status" +if (/usr/sbin/hciconfig | grep hci); then + echo "Bluetooth device is UP" + /usr/sbin/hciconfig hci0 up +else + echo "Bluetooth device is DOWN" + echo "Registering Bluetooth device" + + $BCM_TOOL $BT_UART_DEVICE -FILE=$PLUGIN_DIR/usr/etc/bluetooth/$BCM_FIRMWARE -BAUD=$UART_SPEED -ADDR=/opt/etc/.bd_addr -SETSCO=0,0,0,0,0,0,0,3,3,0 -LP > /dev/null 2>&1 + + # Attaching Broadcom device + if (/usr/sbin/hciattach $BT_UART_DEVICE -s $UART_SPEED $BT_CHIP_TYPE $UART_SPEED flow); then + sleep 0.1 + /usr/sbin/hciconfig hci0 up + /usr/sbin/hciconfig hci0 name $BT_PLATFORM_DEFAULT_HCI_NAME + /usr/sbin/hciconfig hci0 sspmode 1 + echo "HCIATTACH success" + else + echo "HCIATTACH failed" + rfkill block bluetooth + fi +fi + diff --git a/scripts/broadcom/bt-set-addr.sh.broadcom b/scripts/broadcom/bt-set-addr.sh.broadcom new file mode 100755 index 0000000..57b2d02 --- /dev/null +++ b/scripts/broadcom/bt-set-addr.sh.broadcom @@ -0,0 +1,16 @@ +#!/bin/sh + +# +# Script for setting Bluetooth Address +# + +if [ -e /opt/etc/.bd_addr ] +then + echo "Already .bd_addr exists" + exit 0 +fi + +/usr/bin/setbd + +echo "Set BT address successes" + diff --git a/scripts/bt-reset-env.sh b/scripts/bt-reset-env.sh new file mode 100755 index 0000000..2f492a3 --- /dev/null +++ b/scripts/bt-reset-env.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# BT Stack and device stop +/usr/etc/bluetooth/bt-stack-down.sh + +killall -9 hciattach + +# Remove BT files and setting +rm -rf /opt/data/bluetooth/.bt_paired +rm -rf /var/lib/bluetooth/* + +KDB=`mount | grep libsqlfs_mount | awk '{print $3}'` +if [ -d $KDB/bluetooth ] +then + rm -rf $KDB/bluetooth/* +fi +if [ -d $KDB/user/bluetooth ] +then + rm -rf $KDB/user/bluetooth/* +fi + +# Remove BT shared memory +list=`ipcs -m | awk '$1==0x0001000 {print $2}'` +for i in $list +do + ipcrm -m $i +done +ipcs -m | grep "0x00001000" | awk '{ print $2 }' + diff --git a/scripts/bt-stack-down.sh b/scripts/bt-stack-down.sh new file mode 100755 index 0000000..872aedf --- /dev/null +++ b/scripts/bt-stack-down.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# +# Script for stopping Bluetooth stack +# + +# Remove BT device +/usr/etc/bluetooth/bt-dev-end.sh + +# Kill BlueZ bluetooth stack +killall bluetoothd +killall obexd obex-client +killall bt-syspopup +killall bluetooth-share + +# result +exit 0 + diff --git a/scripts/bt-stack-up.sh b/scripts/bt-stack-up.sh new file mode 100755 index 0000000..c929e5b --- /dev/null +++ b/scripts/bt-stack-up.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# +# Script for executing Bluetooth stack +# + +# Register BT Device +/usr/etc/bluetooth/bt-dev-start.sh + +if !(/usr/sbin/hciconfig | grep hci); then + echo "Registering BT device is failed." + exit 1 +fi + +# Execute BlueZ BT stack +echo "Run bluetoothd" +/usr/sbin/bluetoothd -d +/usr/lib/obex/obexd -d --noplugin=syncevolution,pcsuite --symlinks -r /opt/share/bt-ftp +/usr/bin/bluetooth-share & +sleep 2 + +exit 0 + +# Check result +#if (dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | grep hci); then +# exit 0 +#else +# echo "Running BT stack is failed." +# exit 1 +#fi + diff --git a/set-address/CMakeLists.txt b/set-address/CMakeLists.txt new file mode 100644 index 0000000..da25e14 --- /dev/null +++ b/set-address/CMakeLists.txt @@ -0,0 +1,32 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(setbd C) + +SET(SRCS setbd.c) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(package REQUIRED glib-2.0 dbus-glib-1 vconf) + +FOREACH(flag ${package_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") +ADD_DEFINITIONS("-DDEBUG_EN") + +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${package_LDFLAGS}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) + diff --git a/set-address/setbd.c b/set-address/setbd.c new file mode 100644 index 0000000..7c4919c --- /dev/null +++ b/set-address/setbd.c @@ -0,0 +1,283 @@ +/* + * bluetooth-dev-tool + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved + * + * Contact: Hocheol Seo + * GirishAshok Joshi + * DoHyun Pyun + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef DEBUG_EN +#define APP_DBG(format, args...) printf("%s(), line[%d]: " format, __FUNCTION__, __LINE__, ##args) +#define APP_DEBUG(format, args...) printf(format, ##args) +#else +#define APP_DBG(format, args...) +#define APP_DEBUG(format, args...) +#endif + +#define BD_ADDR_FILE "/opt/etc/.bd_addr" +#define PSKEY_TEMP_FILE "/opt/etc/.bluetooth.psr" +#define PSR_FILE "/opt/etc/bluetooth/bluetooth.psr" + +#define BD_ADDR_LEN 14 +#define BD_PREFIX "0002\n" + +#define PSKEY_LEN 27 +#define PSKEY_BDADDR_PREFIX "&0001 = 0012 " + +#define READ_BD_FILE_MAX 300 + +static int success_make_bt_address_from_imei=-1; +static GMainLoop * loop; +const char *DEFAULT_IMEI="004999010640000"; +static gboolean is_default_imei=FALSE; + +int addremoveBD(char* path, char* pskey){ + FILE *fd, *new; + int ret; + char cmp[READ_BD_FILE_MAX]; + char *result; + + fd = fopen(path, "r"); + if(NULL == fd){ + APP_DBG("Error open psr file\r\n"); + return -21; + } + + new = fopen(PSKEY_TEMP_FILE, "w"); + if(NULL == new){ + APP_DBG("Error creat temp file\r\n"); + fclose(fd); + return -22; + } + + ret = fputs(pskey,new); + + while(1){ + result = fgets(cmp, READ_BD_FILE_MAX, fd); + + APP_DBG("PSR : [%s]\r\n", cmp); + + if((NULL != result) && (0 == strncmp(cmp, "&0001", 5))){ + APP_DBG("Find BD address set script\r\n"); + continue; + } + + if(NULL == result){ + APP_DBG("EOF reaches\r\n"); + fclose(fd); + fclose(new); + return 1; + } + + ret = fputs(cmp,new); + } + + return 0; +} +void makeRandomBD(unsigned char* buf){ + int ran; + int i; + unsigned int seed; + memcpy(buf, BD_PREFIX, 5); + seed = time(NULL); + for(i=5;i<14;i++){ + if(7==i){ + buf[i]='\n'; + continue; + } + ran = rand_r(&seed)%16; + if(10>ran) + ran+=0x30; + else + ran+=0x57; + buf[i]=ran; + } + APP_DEBUG("Random number is\r\n"); + for(i=0;i