mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-25 09:02:30 +00:00
windows-winusb-intel: new port for windows-winusb & Intel Wireless 8260 / 8265 Controllers
This commit is contained in:
parent
7eac9e2200
commit
f61339ea81
@ -65,6 +65,7 @@ No build server | [posix-h5-bcm](https://github.com/bluekitchen/btstack/tree/dev
|
|||||||
No build server | [libusb-intel](https://github.com/bluekitchen/btstack/tree/develop/port/libusb-inttel) | Unix-based system with Intel Wireless 8260/8265 Controller
|
No build server | [libusb-intel](https://github.com/bluekitchen/btstack/tree/develop/port/libusb-inttel) | Unix-based system with Intel Wireless 8260/8265 Controller
|
||||||
No build server | [windows-h4](https://github.com/bluekitchen/btstack/tree/develop/port/windows-h4) | Win32-based system connected to Bluetooth module via serial port
|
No build server | [windows-h4](https://github.com/bluekitchen/btstack/tree/develop/port/windows-h4) | Win32-based system connected to Bluetooth module via serial port
|
||||||
No build server | [windows-winusb](https://github.com/bluekitchen/btstack/tree/develop/port/windows-winusb) | Win32-based system with dedicated USB Bluetooth dongle
|
No build server | [windows-winusb](https://github.com/bluekitchen/btstack/tree/develop/port/windows-winusb) | Win32-based system with dedicated USB Bluetooth dongle
|
||||||
|
No build server | [windows-winusb-intel](https://github.com/bluekitchen/btstack/tree/develop/port/windows-winusb-intel) | Win32-based system with Intel Wireless 8260/8265 Controller
|
||||||
No build server | [raspi](https://github.com/bluekitchen/btstack/tree/develop/port/raspi) | Raspberry Pi 3 or Raspberry Pi Zero W with built-in BCM4343 Bluetooth/Wifi Controller
|
No build server | [raspi](https://github.com/bluekitchen/btstack/tree/develop/port/raspi) | Raspberry Pi 3 or Raspberry Pi Zero W with built-in BCM4343 Bluetooth/Wifi Controller
|
||||||
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/port-daemon-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/port-daemon-develop) | [daemon](https://github.com/bluekitchen/btstack/tree/develop/port/daemon) | TCP and Unix domain named socket client-server architecture supporting multiple clients
|
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/port-daemon-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/port-daemon-develop) | [daemon](https://github.com/bluekitchen/btstack/tree/develop/port/daemon) | TCP and Unix domain named socket client-server architecture supporting multiple clients
|
||||||
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/java-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/java-develop) | [java](https://github.com/bluekitchen/btstack/tree/develop/platform/daemon/binding/java) | Java wrapper for daemon
|
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/java-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/java-develop) | [java](https://github.com/bluekitchen/btstack/tree/develop/platform/daemon/binding/java) | Java wrapper for daemon
|
||||||
|
39
port/windows-winusb-intel/.gitignore
vendored
Normal file
39
port/windows-winusb-intel/.gitignore
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
ancs_client_demo
|
||||||
|
ancs_client_demo.h
|
||||||
|
ble_central_test
|
||||||
|
ble_peripheral_test
|
||||||
|
bnep_test
|
||||||
|
classic_test
|
||||||
|
gap_dedicated_bonding
|
||||||
|
gap_inquiry
|
||||||
|
gap_inquiry_and_bond
|
||||||
|
gap_le_advertisements
|
||||||
|
gap_le_advertisements
|
||||||
|
gatt_battery_query
|
||||||
|
gatt_browser
|
||||||
|
hfp_ag_demo
|
||||||
|
hfp_hf_demo
|
||||||
|
hsp_ag_demo
|
||||||
|
hsp_hs_demo
|
||||||
|
l2cap_test
|
||||||
|
le_counter
|
||||||
|
le_counter.h
|
||||||
|
le_streamer
|
||||||
|
le_streamer
|
||||||
|
le_streamer.h
|
||||||
|
led_counter
|
||||||
|
panu_demo
|
||||||
|
profile.h
|
||||||
|
sdp_bnep_query
|
||||||
|
sdp_general_query
|
||||||
|
sdp_rfcomm_query
|
||||||
|
sm_pairing_central
|
||||||
|
sm_pairing_peripheral
|
||||||
|
sm_pairing_peripheral.h
|
||||||
|
spp_and_le_counter
|
||||||
|
spp_and_le_counter.h
|
||||||
|
spp_counter
|
||||||
|
spp_streamer
|
||||||
|
spp_streamer
|
||||||
|
sco_input*
|
||||||
|
sco_output*
|
39
port/windows-winusb-intel/Makefile
Normal file
39
port/windows-winusb-intel/Makefile
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Makefile for windows WinUSB based examples
|
||||||
|
BTSTACK_ROOT = ../..
|
||||||
|
|
||||||
|
CORE += main.c btstack_stdin_windows.c
|
||||||
|
|
||||||
|
COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_fs.c btstack_link_key_db_fs.c wav_util.c
|
||||||
|
COMMON += btstack_chipset_intel_firmware.c
|
||||||
|
|
||||||
|
include ${BTSTACK_ROOT}/example/Makefile.inc
|
||||||
|
include ${BTSTACK_ROOT}/chipset/intel/Makefile.inc
|
||||||
|
|
||||||
|
# CC = gcc-fsf-4.9
|
||||||
|
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpedantic
|
||||||
|
# CFLAGS += -Werror
|
||||||
|
|
||||||
|
CFLAGS += -I${BTSTACK_ROOT}/platform/windows \
|
||||||
|
-I${BTSTACK_ROOT}/platform/posix \
|
||||||
|
-I${BTSTACK_ROOT}/chipset/intel \
|
||||||
|
-I${BTSTACK_ROOT}/platform/embedded \
|
||||||
|
-I${BTSTACK_ROOT}/3rd-party/tinydir
|
||||||
|
|
||||||
|
VPATH += ${BTSTACK_ROOT}/platform/embedded
|
||||||
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
||||||
|
VPATH += ${BTSTACK_ROOT}/platform/windows
|
||||||
|
VPATH += ${BTSTACK_ROOT}/chipset/csr
|
||||||
|
VPATH += ${BTSTACK_ROOT}/chipset/intel
|
||||||
|
|
||||||
|
# use pkg-config for portaudio
|
||||||
|
# CFLAGS += $(shell pkg-config portaudio-2.0 --cflags) -DHAVE_PORTAUDIO
|
||||||
|
# LDFLAGS += $(shell pkg-config portaudio-2.0 --libs)
|
||||||
|
# hard coded flags for portaudio in /usr/local/lib
|
||||||
|
# CFLAGS += -I/usr/local/include -DHAVE_PORTAUDIO
|
||||||
|
# LDFLAGS += -L/sw/lib -lportaudio -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,Carbon
|
||||||
|
|
||||||
|
LDFLAGS += -lsetupapi -lwinusb
|
||||||
|
|
||||||
|
clean: clean-intel
|
||||||
|
|
||||||
|
all: all-intel ${EXAMPLES}
|
43
port/windows-winusb-intel/README.md
Normal file
43
port/windows-winusb-intel/README.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# BTstack port for Windows Systems with Intel Wireless 8260/8265 Controllers
|
||||||
|
|
||||||
|
Same as port/windows-winusb, but customized for Intel Wireless 8260 and 8265 Controllers.
|
||||||
|
These controller require firmware upload and configuration to work. Firmware and config is downloaded from the Linux firmware repository.
|
||||||
|
|
||||||
|
## Access to Bluetooth USB Dongle with Zadig
|
||||||
|
|
||||||
|
To allow libusb or WinUSB to access an USB Bluetooth dongle, you need to install a special device driver to make it accessible to user space processes.
|
||||||
|
|
||||||
|
It works like this:
|
||||||
|
|
||||||
|
- Download [Zadig](http://zadig.akeo.ie)
|
||||||
|
- Start Zadig
|
||||||
|
- Select Options -> “List all devices”
|
||||||
|
- Select USB Bluetooth dongle in the big pull down list
|
||||||
|
- Select WinUSB (libusb) in the right pull pull down list
|
||||||
|
- Select “Replace Driver”
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
|
||||||
|
The port requires a Unix-like toolchain. We successfully used [mingw-w64](https://mingw-w64.org/doku.php) to compile and run the examples. mingw64-w64 is based on [MinGW](mingw.org), which '...provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs.'
|
||||||
|
|
||||||
|
We've used the Msys2 package available from the [downloads page](https://mingw-w64.org/doku.php/download) on Windows 10, 64-bit and use the MSYS2 MinGW 32-bit start menu item to compile 32-bit binaries that run on both 32/64-bit systems.
|
||||||
|
|
||||||
|
In the MSYS2 shell, you can install git, python, and, winpty with pacman:
|
||||||
|
|
||||||
|
$ pacman -S git
|
||||||
|
$ pacman -S python
|
||||||
|
$ pacman -S winpty
|
||||||
|
|
||||||
|
## Compilation
|
||||||
|
|
||||||
|
With mingw64-w64 installed, just go to the port/windows-winusb directory and run make
|
||||||
|
|
||||||
|
$ cd btstack/port/windows-winusb
|
||||||
|
$ make
|
||||||
|
|
||||||
|
## Console Output
|
||||||
|
|
||||||
|
When running the examples in the MSYS2 shell, the console input (via btstack_stdin_support) doesn't work. It works in the older MSYS and also the regular CMD.exe environment. Another option is to install WinPTY and then start the example via WinPTY like this:
|
||||||
|
|
||||||
|
$ winpty ./spp_and_le_counter.exe
|
||||||
|
|
33
port/windows-winusb-intel/btstack_config.h
Normal file
33
port/windows-winusb-intel/btstack_config.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// btstack_config.h for libusb port
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __BTSTACK_CONFIG
|
||||||
|
#define __BTSTACK_CONFIG
|
||||||
|
|
||||||
|
// Port related features
|
||||||
|
#define HAVE_MALLOC
|
||||||
|
#define HAVE_POSIX_FILE_IO
|
||||||
|
#define HAVE_BTSTACK_STDIN
|
||||||
|
#define HAVE_POSIX_TIME
|
||||||
|
|
||||||
|
// BTstack features that can be enabled
|
||||||
|
#define ENABLE_BLE
|
||||||
|
#define ENABLE_CLASSIC
|
||||||
|
#define ENABLE_HFP_WIDE_BAND_SPEECH
|
||||||
|
#define ENABLE_LE_CENTRAL
|
||||||
|
#define ENABLE_LE_PERIPHERAL
|
||||||
|
#define ENABLE_LE_SECURE_CONNECTIONS
|
||||||
|
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
|
||||||
|
#define ENABLE_LE_DATA_CHANNELS
|
||||||
|
#define ENABLE_LE_DATA_LENGTH_EXTENSION
|
||||||
|
#define ENABLE_LOG_ERROR
|
||||||
|
#define ENABLE_LOG_INFO
|
||||||
|
#define ENABLE_SCO_OVER_HCI
|
||||||
|
#define ENABLE_SDP_DES_DUMP
|
||||||
|
|
||||||
|
// BTstack configuration. buffers, sizes, ...
|
||||||
|
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||||
|
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
|
||||||
|
|
||||||
|
#endif
|
198
port/windows-winusb-intel/main.c
Normal file
198
port/windows-winusb-intel/main.c
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 BlueKitchen GmbH
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the copyright holders nor the names of
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
* 4. Any redistribution, use, or modification is done solely for
|
||||||
|
* personal benefit and not for any commercial purpose or for
|
||||||
|
* monetary gain.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
||||||
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||||
|
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Please inquire about commercial licensing options at
|
||||||
|
* contact@bluekitchen-gmbh.com
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __BTSTACK_FILE__ "main.c"
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
//
|
||||||
|
// minimal setup for HCI code
|
||||||
|
//
|
||||||
|
// *****************************************************************************
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include "btstack_config.h"
|
||||||
|
|
||||||
|
#include "btstack_debug.h"
|
||||||
|
#include "btstack_event.h"
|
||||||
|
#include "btstack_link_key_db_fs.h"
|
||||||
|
#include "btstack_memory.h"
|
||||||
|
#include "btstack_run_loop.h"
|
||||||
|
#include "btstack_run_loop_windows.h"
|
||||||
|
#include "hal_led.h"
|
||||||
|
#include "hci.h"
|
||||||
|
#include "hci_dump.h"
|
||||||
|
#include "btstack_stdin.h"
|
||||||
|
#include "btstack_chipset_intel_firmware.h"
|
||||||
|
|
||||||
|
int btstack_main(int argc, const char * argv[]);
|
||||||
|
|
||||||
|
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||||
|
static int main_argc;
|
||||||
|
static const char ** main_argv;
|
||||||
|
static const hci_transport_t * transport;
|
||||||
|
|
||||||
|
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
|
if (packet_type != HCI_EVENT_PACKET) return;
|
||||||
|
if (hci_event_packet_get_type(packet) != BTSTACK_EVENT_STATE) return;
|
||||||
|
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) return;
|
||||||
|
bd_addr_t addr;
|
||||||
|
gap_local_bd_addr(addr);
|
||||||
|
printf("BTstack up and running at %s\n", bd_addr_to_str(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sigint_handler(int param){
|
||||||
|
UNUSED(param);
|
||||||
|
|
||||||
|
printf("CTRL-C - SIGINT received, shutting down..\n");
|
||||||
|
log_info("sigint_handler: shutting down");
|
||||||
|
|
||||||
|
// reset anyway
|
||||||
|
btstack_stdin_reset();
|
||||||
|
|
||||||
|
// power down
|
||||||
|
hci_power_control(HCI_POWER_OFF);
|
||||||
|
hci_close();
|
||||||
|
log_info("Good bye, see you.\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int led_state = 0;
|
||||||
|
void hal_led_toggle(void){
|
||||||
|
led_state = 1 - led_state;
|
||||||
|
printf("LED State %u\n", led_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void intel_firmware_done(int result){
|
||||||
|
|
||||||
|
printf("Done %x\n", result);
|
||||||
|
|
||||||
|
// close
|
||||||
|
transport->close();
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
// init HCI
|
||||||
|
hci_init(transport, NULL);
|
||||||
|
|
||||||
|
#ifdef ENABLE_CLASSIC
|
||||||
|
hci_set_link_key_db(btstack_link_key_db_fs_instance());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// inform about BTstack state
|
||||||
|
hci_event_callback_registration.callback = &packet_handler;
|
||||||
|
hci_add_event_handler(&hci_event_callback_registration);
|
||||||
|
|
||||||
|
// setup app
|
||||||
|
btstack_main(main_argc, main_argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define USB_MAX_PATH_LEN 7
|
||||||
|
int main(int argc, const char * argv[]){
|
||||||
|
|
||||||
|
// Prevent stdout buffering
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
|
main_argc = argc;
|
||||||
|
main_argv = argv;
|
||||||
|
|
||||||
|
printf("BTstack/windows-winusb booting up\n");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int usb_path_len = 0;
|
||||||
|
uint8_t usb_path[USB_MAX_PATH_LEN];
|
||||||
|
if (argc >= 3 && strcmp(argv[1], "-u") == 0){
|
||||||
|
// parse command line options for "-u 11:22:33"
|
||||||
|
const char * port_str = argv[2];
|
||||||
|
printf("Specified USB Path: ");
|
||||||
|
while (1){
|
||||||
|
char * delimiter;
|
||||||
|
int port = strtol(port_str, &delimiter, 16);
|
||||||
|
usb_path[usb_path_len] = port;
|
||||||
|
usb_path_len++;
|
||||||
|
printf("%02x ", port);
|
||||||
|
if (!delimiter) break;
|
||||||
|
if (*delimiter != ':' && *delimiter != '-') break;
|
||||||
|
port_str = delimiter+1;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// GET STARTED with BTstack ///
|
||||||
|
btstack_memory_init();
|
||||||
|
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
|
||||||
|
|
||||||
|
// if (usb_path_len){
|
||||||
|
// hci_transport_usb_set_path(usb_path_len, usb_path);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
char pklg_path[100];
|
||||||
|
strcpy(pklg_path, "hci_dump");
|
||||||
|
#if 0
|
||||||
|
if (usb_path_len){
|
||||||
|
strcat(pklg_path, "_");
|
||||||
|
strcat(pklg_path, argv[2]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
strcat(pklg_path, ".pklg");
|
||||||
|
printf("Packet Log: %s\n", pklg_path);
|
||||||
|
hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
|
||||||
|
#else
|
||||||
|
hci_dump_open(NULL, HCI_DUMP_STDOUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// handle CTRL-c
|
||||||
|
signal(SIGINT, sigint_handler);
|
||||||
|
|
||||||
|
// setup USB Transport
|
||||||
|
transport = hci_transport_usb_instance();
|
||||||
|
btstack_chipset_intel_download_firmware(hci_transport_usb_instance(), &intel_firmware_done);
|
||||||
|
|
||||||
|
// go
|
||||||
|
btstack_run_loop_execute();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -4,15 +4,17 @@ BTSTACK_ROOT = ../..
|
|||||||
CORE += main.c btstack_stdin_windows.c
|
CORE += main.c btstack_stdin_windows.c
|
||||||
|
|
||||||
COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_fs.c btstack_link_key_db_fs.c wav_util.c
|
COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_fs.c btstack_link_key_db_fs.c wav_util.c
|
||||||
|
COMMON += btstack_chipset_intel_firmware.c
|
||||||
|
|
||||||
include ${BTSTACK_ROOT}/example/Makefile.inc
|
include ${BTSTACK_ROOT}/example/Makefile.inc
|
||||||
|
|
||||||
# CC = gcc-fsf-4.9
|
# CC = gcc-fsf-4.9
|
||||||
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror
|
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpedantic
|
||||||
# CFLAGS += -Werror
|
# CFLAGS += -Werror
|
||||||
|
|
||||||
CFLAGS += -I${BTSTACK_ROOT}/platform/windows \
|
CFLAGS += -I${BTSTACK_ROOT}/platform/windows \
|
||||||
-I${BTSTACK_ROOT}/platform/posix \
|
-I${BTSTACK_ROOT}/platform/posix \
|
||||||
|
-I${BTSTACK_ROOT}/chipset/intel \
|
||||||
-I${BTSTACK_ROOT}/platform/embedded \
|
-I${BTSTACK_ROOT}/platform/embedded \
|
||||||
-I${BTSTACK_ROOT}/3rd-party/tinydir
|
-I${BTSTACK_ROOT}/3rd-party/tinydir
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ VPATH += ${BTSTACK_ROOT}/platform/embedded
|
|||||||
VPATH += ${BTSTACK_ROOT}/platform/posix
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
||||||
VPATH += ${BTSTACK_ROOT}/platform/windows
|
VPATH += ${BTSTACK_ROOT}/platform/windows
|
||||||
VPATH += ${BTSTACK_ROOT}/chipset/csr
|
VPATH += ${BTSTACK_ROOT}/chipset/csr
|
||||||
|
VPATH += ${BTSTACK_ROOT}/chipset/intel
|
||||||
|
|
||||||
# use pkg-config for portaudio
|
# use pkg-config for portaudio
|
||||||
# CFLAGS += $(shell pkg-config portaudio-2.0 --cflags) -DHAVE_PORTAUDIO
|
# CFLAGS += $(shell pkg-config portaudio-2.0 --cflags) -DHAVE_PORTAUDIO
|
||||||
|
@ -61,10 +61,14 @@
|
|||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
#include "hci_dump.h"
|
#include "hci_dump.h"
|
||||||
#include "btstack_stdin.h"
|
#include "btstack_stdin.h"
|
||||||
|
#include "btstack_chipset_intel_firmware.h"
|
||||||
|
|
||||||
int btstack_main(int argc, const char * argv[]);
|
int btstack_main(int argc, const char * argv[]);
|
||||||
|
|
||||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||||
|
static int main_argc;
|
||||||
|
static const char ** main_argv;
|
||||||
|
static const hci_transport_t * transport;
|
||||||
|
|
||||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
if (packet_type != HCI_EVENT_PACKET) return;
|
if (packet_type != HCI_EVENT_PACKET) return;
|
||||||
@ -98,12 +102,39 @@ void hal_led_toggle(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void intel_firmware_done(int result){
|
||||||
|
|
||||||
|
printf("Done %x\n", result);
|
||||||
|
|
||||||
|
// close
|
||||||
|
transport->close();
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
// init HCI
|
||||||
|
hci_init(transport, NULL);
|
||||||
|
|
||||||
|
#ifdef ENABLE_CLASSIC
|
||||||
|
hci_set_link_key_db(btstack_link_key_db_fs_instance());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// inform about BTstack state
|
||||||
|
hci_event_callback_registration.callback = &packet_handler;
|
||||||
|
hci_add_event_handler(&hci_event_callback_registration);
|
||||||
|
|
||||||
|
// setup app
|
||||||
|
btstack_main(main_argc, main_argv);
|
||||||
|
}
|
||||||
|
|
||||||
#define USB_MAX_PATH_LEN 7
|
#define USB_MAX_PATH_LEN 7
|
||||||
int main(int argc, const char * argv[]){
|
int main(int argc, const char * argv[]){
|
||||||
|
|
||||||
// Prevent stdout buffering
|
// Prevent stdout buffering
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
|
main_argc = argc;
|
||||||
|
main_argv = argv;
|
||||||
|
|
||||||
printf("BTstack/windows-winusb booting up\n");
|
printf("BTstack/windows-winusb booting up\n");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -153,22 +184,12 @@ int main(int argc, const char * argv[]){
|
|||||||
hci_dump_open(NULL, HCI_DUMP_STDOUT);
|
hci_dump_open(NULL, HCI_DUMP_STDOUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init HCI
|
|
||||||
hci_init(hci_transport_usb_instance(), NULL);
|
|
||||||
|
|
||||||
#ifdef ENABLE_CLASSIC
|
|
||||||
hci_set_link_key_db(btstack_link_key_db_fs_instance());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// inform about BTstack state
|
|
||||||
hci_event_callback_registration.callback = &packet_handler;
|
|
||||||
hci_add_event_handler(&hci_event_callback_registration);
|
|
||||||
|
|
||||||
// handle CTRL-c
|
// handle CTRL-c
|
||||||
signal(SIGINT, sigint_handler);
|
signal(SIGINT, sigint_handler);
|
||||||
|
|
||||||
// setup app
|
// setup USB Transport
|
||||||
btstack_main(argc, argv);
|
transport = hci_transport_usb_instance();
|
||||||
|
btstack_chipset_intel_download_firmware(hci_transport_usb_instance(), &intel_firmware_done);
|
||||||
|
|
||||||
// go
|
// go
|
||||||
btstack_run_loop_execute();
|
btstack_run_loop_execute();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user