From e2d80b699055c86395c7729237e08c261eae6687 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 21 Sep 2019 08:07:21 -0600 Subject: [PATCH] wireless/bluetooth/bt_hcicore.c: Bluetooth firmware download logic of commit 05bbbec3e12c0798e46bc4505063aa373ba46867 breaks all bluetooth builds. This commit fixes that by making that firmware download configurable. It is disabled by default so that all of the pre-existing configurations will continue to build. --- wireless/bluetooth/Kconfig | 14 ++++++++++++++ wireless/bluetooth/bt_hcicore.c | 9 +-------- wireless/bluetooth/bt_hcicore.h | 7 +++++++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/wireless/bluetooth/Kconfig b/wireless/bluetooth/Kconfig index c1cc691791..bbbb098e86 100644 --- a/wireless/bluetooth/Kconfig +++ b/wireless/bluetooth/Kconfig @@ -54,6 +54,20 @@ menuconfig WIRELESS_BLUETOOTH if WIRELESS_BLUETOOTH +config BLUETOOTH_FIRMWARE_DOWNLOAD + bool "Generic firmware download" + default n + ---help--- + Enables support for generic firmware download in the MAC layer. Do + not enable this option if no download is required OR if the download + if performed by the Bluetooth HCI layer. + + If this option is selected, then your board-specific code must + provide the firmware data via: + + const uint8_t bt_firmware_hcd[]; + const long int bt_firmware_len; + config BLUETOOTH_MAX_CONN int "Maximum number of simultaneous connections" default 1 diff --git a/wireless/bluetooth/bt_hcicore.c b/wireless/bluetooth/bt_hcicore.c index 698fd8e5df..7421ae071e 100644 --- a/wireless/bluetooth/bt_hcicore.c +++ b/wireless/bluetooth/bt_hcicore.c @@ -83,8 +83,6 @@ #define TIMEOUT_SEC 2 #define TIMEOUT_NSEC 500 * 1024 * 1024 -#define BT_FIRMWARE_UPLOAD /* REVISIT: Should be a Kconfig option? */ - /**************************************************************************** * Public Data ****************************************************************************/ @@ -97,11 +95,6 @@ struct bt_dev_s g_btdev; -#ifdef BT_FIRMWARE_UPLOAD -extern const uint8_t bt_firmware_hcd[]; -const long int bt_firmware_len; -#endiuf - /**************************************************************************** * Private Data ****************************************************************************/ @@ -1207,7 +1200,7 @@ static void le_read_buffer_size_complete(FAR struct bt_buf_s *buf) * ****************************************************************************/ -#ifdef BT_FIRMWARE_UPLOAD +#ifdef CONFIG_BLUETOOTH_FIRMWARE_DOWNLOAD static int bt_check_fw_upload(void) { uint8_t *rp = (uint8_t *)bt_firmware_hcd; diff --git a/wireless/bluetooth/bt_hcicore.h b/wireless/bluetooth/bt_hcicore.h index b4f8302db7..95f28ab152 100644 --- a/wireless/bluetooth/bt_hcicore.h +++ b/wireless/bluetooth/bt_hcicore.h @@ -166,6 +166,13 @@ typedef CODE void bt_le_scan_cb_t(FAR const bt_addr_le_t *addr, int8_t rssi, extern struct bt_dev_s g_btdev; +#ifdef CONFIG_BLUETOOTH_FIRMWARE_DOWNLOAD +/* Location and size of HCI firmware download */ + +extern const uint8_t bt_firmware_hcd[]; +extern const long int bt_firmware_len; +#endif + /**************************************************************************** * Inline Functions ****************************************************************************/