Bluetooth: drivers: Remove unmaintained B91 HCI driver
The driver isn't currently buildable due to "west blobs" support never having been added for hal_telink. Furthermore, even if the blob dependency is manually made available it turns out the code has bitrotten to the point where it doesn't build anymore. This situation has continued for several years without anyone taking action, so I think it's safe to assume this is unmaintained and should be removed. Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
This commit is contained in:
parent
202c16008f
commit
f48a57b2a8
6 changed files with 1 additions and 272 deletions
|
@ -6,22 +6,6 @@ if BOARD_TLSR9518ADK80D
|
|||
config SOC_FLASH_TELINK_B91
|
||||
default y if FLASH
|
||||
|
||||
if BT
|
||||
|
||||
# BLE Controller SDK from hal_telink requires
|
||||
# Telink's toolchain with FPU support
|
||||
config FPU
|
||||
default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "zephyr"
|
||||
|
||||
config BT_HCI_ACL_FLOW_CONTROL
|
||||
default n
|
||||
|
||||
choice BT_HCI_BUS_TYPE
|
||||
default BT_B91
|
||||
endchoice
|
||||
|
||||
endif # BT
|
||||
|
||||
# Workaround for not being able to have commas in macro arguments
|
||||
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ if(CONFIG_BT_HCI_IPC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_B91 hci_b91.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_AIROC cyw43xxx.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_ESP32 hci_esp32.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_H4 h4.c)
|
||||
|
|
|
@ -97,11 +97,6 @@ config BT_ESP32
|
|||
help
|
||||
Espressif HCI bluetooth interface
|
||||
|
||||
config BT_B91
|
||||
bool "Telink B91 HCI driver"
|
||||
help
|
||||
Telink B91 HCI bluetooth interface
|
||||
|
||||
config BT_PSOC6_BLESS
|
||||
bool "PSOC6 BLESS driver"
|
||||
select BT_HCI_SETUP
|
||||
|
|
|
@ -1,248 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Telink Semiconductor (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/bluetooth/hci.h>
|
||||
|
||||
#include <zephyr/sys/byteorder.h>
|
||||
#include <zephyr/drivers/bluetooth/hci_driver.h>
|
||||
|
||||
#include <b91_bt.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_hci_driver_b91);
|
||||
|
||||
#define HCI_BT_B91_TIMEOUT K_MSEC(2000)
|
||||
|
||||
static K_SEM_DEFINE(hci_send_sem, 1, 1);
|
||||
|
||||
static bool is_hci_event_discardable(const uint8_t *evt_data)
|
||||
{
|
||||
uint8_t evt_type = evt_data[0];
|
||||
|
||||
switch (evt_type) {
|
||||
#if defined(CONFIG_BT_CLASSIC)
|
||||
case BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI:
|
||||
case BT_HCI_EVT_EXTENDED_INQUIRY_RESULT:
|
||||
return true;
|
||||
#endif
|
||||
case BT_HCI_EVT_LE_META_EVENT: {
|
||||
uint8_t subevt_type = evt_data[sizeof(struct bt_hci_evt_hdr)];
|
||||
|
||||
switch (subevt_type) {
|
||||
case BT_HCI_EVT_LE_ADVERTISING_REPORT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static struct net_buf *bt_b91_evt_recv(uint8_t *data, size_t len)
|
||||
{
|
||||
bool discardable;
|
||||
struct bt_hci_evt_hdr hdr;
|
||||
struct net_buf *buf;
|
||||
size_t buf_tailroom;
|
||||
|
||||
if (len < sizeof(hdr)) {
|
||||
LOG_ERR("Not enough data for event header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
discardable = is_hci_event_discardable(data);
|
||||
|
||||
memcpy((void *)&hdr, data, sizeof(hdr));
|
||||
data += sizeof(hdr);
|
||||
len -= sizeof(hdr);
|
||||
|
||||
if (len != hdr.len) {
|
||||
LOG_ERR("Event payload length is not correct");
|
||||
return NULL;
|
||||
}
|
||||
LOG_DBG("len %u", hdr.len);
|
||||
|
||||
buf = bt_buf_get_evt(hdr.evt, discardable, K_NO_WAIT);
|
||||
if (!buf) {
|
||||
if (discardable) {
|
||||
LOG_DBG("Discardable buffer pool full, ignoring event");
|
||||
} else {
|
||||
LOG_ERR("No available event buffers!");
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
net_buf_add_mem(buf, &hdr, sizeof(hdr));
|
||||
|
||||
buf_tailroom = net_buf_tailroom(buf);
|
||||
if (buf_tailroom < len) {
|
||||
LOG_ERR("Not enough space in buffer %zu/%zu", len, buf_tailroom);
|
||||
net_buf_unref(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net_buf_add_mem(buf, data, len);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static struct net_buf *bt_b91_acl_recv(uint8_t *data, size_t len)
|
||||
{
|
||||
struct bt_hci_acl_hdr hdr;
|
||||
struct net_buf *buf;
|
||||
size_t buf_tailroom;
|
||||
|
||||
if (len < sizeof(hdr)) {
|
||||
LOG_ERR("Not enough data for ACL header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_NO_WAIT);
|
||||
if (buf) {
|
||||
memcpy((void *)&hdr, data, sizeof(hdr));
|
||||
data += sizeof(hdr);
|
||||
len -= sizeof(hdr);
|
||||
} else {
|
||||
LOG_ERR("No available ACL buffers!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (len != sys_le16_to_cpu(hdr.len)) {
|
||||
LOG_ERR("ACL payload length is not correct");
|
||||
net_buf_unref(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net_buf_add_mem(buf, &hdr, sizeof(hdr));
|
||||
buf_tailroom = net_buf_tailroom(buf);
|
||||
if (buf_tailroom < len) {
|
||||
LOG_ERR("Not enough space in buffer %zu/%zu", len, buf_tailroom);
|
||||
net_buf_unref(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LOG_DBG("len %u", len);
|
||||
net_buf_add_mem(buf, data, len);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void hci_b91_host_rcv_pkt(uint8_t *data, uint16_t len)
|
||||
{
|
||||
uint8_t pkt_indicator;
|
||||
struct net_buf *buf;
|
||||
|
||||
LOG_HEXDUMP_DBG(data, len, "host packet data:");
|
||||
|
||||
pkt_indicator = *data++;
|
||||
len -= sizeof(pkt_indicator);
|
||||
|
||||
switch (pkt_indicator) {
|
||||
case BT_HCI_H4_EVT:
|
||||
buf = bt_b91_evt_recv(data, len);
|
||||
break;
|
||||
|
||||
case BT_HCI_H4_ACL:
|
||||
buf = bt_b91_acl_recv(data, len);
|
||||
break;
|
||||
|
||||
default:
|
||||
buf = NULL;
|
||||
LOG_ERR("Unknown HCI type %u", pkt_indicator);
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
LOG_DBG("Calling bt_recv(%p)", buf);
|
||||
bt_recv(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void hci_b91_controller_rcv_pkt_ready(void)
|
||||
{
|
||||
k_sem_give(&hci_send_sem);
|
||||
}
|
||||
|
||||
static b91_bt_host_callback_t vhci_host_cb = {
|
||||
.host_send_available = hci_b91_controller_rcv_pkt_ready,
|
||||
.host_read_packet = hci_b91_host_rcv_pkt
|
||||
};
|
||||
|
||||
static int bt_b91_send(struct net_buf *buf)
|
||||
{
|
||||
int err = 0;
|
||||
uint8_t type;
|
||||
|
||||
LOG_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len);
|
||||
|
||||
switch (bt_buf_get_type(buf)) {
|
||||
case BT_BUF_ACL_OUT:
|
||||
type = BT_HCI_H4_ACL;
|
||||
break;
|
||||
|
||||
case BT_BUF_CMD:
|
||||
type = BT_HCI_H4_CMD;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERR("Unknown type %u", bt_buf_get_type(buf));
|
||||
goto done;
|
||||
}
|
||||
|
||||
LOG_HEXDUMP_DBG(buf->data, buf->len, "Final HCI buffer:");
|
||||
|
||||
if (k_sem_take(&hci_send_sem, HCI_BT_B91_TIMEOUT) == 0) {
|
||||
b91_bt_host_send_packet(type, buf->data, buf->len);
|
||||
} else {
|
||||
LOG_ERR("Send packet timeout error");
|
||||
err = -ETIMEDOUT;
|
||||
}
|
||||
|
||||
done:
|
||||
net_buf_unref(buf);
|
||||
k_sem_give(&hci_send_sem);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int hci_b91_open(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = b91_bt_controller_init();
|
||||
if (status) {
|
||||
LOG_ERR("Bluetooth controller init failed %d", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
b91_bt_host_callback_register(&vhci_host_cb);
|
||||
|
||||
LOG_DBG("B91 BT started");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct bt_hci_driver drv = {
|
||||
.name = "BT B91",
|
||||
.open = hci_b91_open,
|
||||
.send = bt_b91_send,
|
||||
.bus = BT_HCI_DRIVER_BUS_IPM,
|
||||
#if defined(CONFIG_BT_DRIVER_QUIRK_NO_AUTO_DLE)
|
||||
.quirks = BT_QUIRK_NO_AUTO_DLE,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int bt_b91_init(void)
|
||||
{
|
||||
|
||||
bt_hci_driver_register(&drv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(bt_b91_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
|
@ -53,7 +53,6 @@ config BT_HCI_TX_STACK_SIZE
|
|||
default 768 if BT_CTLR && BT_LL_SW_SPLIT
|
||||
default 512 if BT_USERCHAN
|
||||
default 640 if BT_STM32_IPM
|
||||
default 1024 if BT_B91
|
||||
# Even if no driver is selected the following default is still
|
||||
# needed e.g. for unit tests. This default will also server as
|
||||
# the worst-case stack size if an out-of-tree controller is used.
|
||||
|
|
2
west.yml
2
west.yml
|
@ -239,7 +239,7 @@ manifest:
|
|||
groups:
|
||||
- hal
|
||||
- name: hal_telink
|
||||
revision: 38573af589173259801ae6c2b34b7d4c9e626746
|
||||
revision: 4226c7fc17d5a34e557d026d428fc766191a0800
|
||||
path: modules/hal/telink
|
||||
groups:
|
||||
- hal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue