Skip to content

Commit

Permalink
Merge branch 'fix/bt_support' into 'feature/esp_as_mcu_host'
Browse files Browse the repository at this point in the history
fix/bt_support Fix building BT with IDF master

See merge request app-frameworks/esp_hosted!468
  • Loading branch information
mantriyogesh committed Jul 30, 2024
2 parents ece0ff9 + 92bd3b7 commit ac58906
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 6 additions & 0 deletions host/drivers/bt/vhci_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ void hci_drv_show_configuration(void)
* - HCI_H4_xxx type should be set in esp_payload_header.hci_pkt_type
*/

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
void ble_transport_ll_init(void)
{
}
#endif

int ble_transport_to_ll_acl_impl(struct os_mbuf *om)
{
// TODO: zerocopy version
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.0.8"
version: "0.0.9"
description: ESP-Hosted provides driver such that any host can re-use ESP chipset as Wi-Fi or Bluetooth co-processor.
url: https://github.com/espressif/esp-hosted/tree/feature/esp_as_mcu_host
examples:
Expand Down
15 changes: 9 additions & 6 deletions slave/main/slave_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len)
}

static esp_vhci_host_callback_t vhci_host_cb = {
controller_rcv_pkt_ready,
host_rcv_pkt
.notify_host_send_available = controller_rcv_pkt_ready,
.notify_host_recv = host_rcv_pkt
};

void process_hci_rx_pkt(uint8_t *payload, uint16_t payload_len) {
Expand Down Expand Up @@ -413,6 +413,8 @@ void init_uart(void)

#if BLUETOOTH_HCI
#if SOC_ESP_NIMBLE_CONTROLLER

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
#include "nimble/ble_hci_trans.h"

typedef enum {
Expand All @@ -425,8 +427,8 @@ typedef enum {
/* Host-to-controller command. */
#define BLE_HCI_TRANS_BUF_CMD 3

/* ACL_DATA_MBUF_LEADINGSPCAE: The leadingspace in user info header for ACL data */
#define ACL_DATA_MBUF_LEADINGSPCAE 4
/* ACL_DATA_MBUF_LEADINGSPACE: The leadingspace in user info header for ACL data */
#define ACL_DATA_MBUF_LEADINGSPACE 4

void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
{
Expand All @@ -443,7 +445,7 @@ void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
}

if (*(data) == DATA_TYPE_ACL) {
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPCAE);
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPACE);
assert(om);
os_mbuf_append(om, &data[1], len - 1);
ble_hci_trans_hs_acl_tx(om);
Expand Down Expand Up @@ -482,6 +484,7 @@ ble_hs_rx_data(struct os_mbuf *om, void *arg)
os_mbuf_free_chain(om);
return 0;
}
#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)

#endif
#endif
Expand Down Expand Up @@ -516,7 +519,7 @@ esp_err_t initialise_bluetooth(void)
#if BLUETOOTH_HCI
esp_err_t ret = ESP_OK;

#if SOC_ESP_NIMBLE_CONTROLLER
#if SOC_ESP_NIMBLE_CONTROLLER && (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0))
ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hs_hci_rx_evt,NULL,
(ble_hci_trans_rx_acl_fn *)ble_hs_rx_data,NULL);
#else
Expand Down

0 comments on commit ac58906

Please sign in to comment.