mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-19 07:29:54 +00:00
nimble/startup: Read local HCI version on startup
X-Original-Commit: 3dd9d11c8ab9638503ede80cdd08ed4296d91e46
This commit is contained in:
@@ -37,6 +37,7 @@ static uint8_t *ble_hs_hci_ack;
|
||||
static uint16_t ble_hs_hci_buf_sz;
|
||||
static uint8_t ble_hs_hci_max_pkts;
|
||||
static uint32_t ble_hs_hci_sup_feat;
|
||||
static uint8_t ble_hs_hci_version;
|
||||
|
||||
/**
|
||||
* The number of available ACL transmit buffers on the controller. This
|
||||
@@ -546,6 +547,18 @@ ble_hs_hci_get_le_supported_feat(void)
|
||||
return ble_hs_hci_sup_feat;
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_hci_set_hci_version(uint8_t hci_version)
|
||||
{
|
||||
ble_hs_hci_version = hci_version;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
ble_hs_hci_get_hci_version(void)
|
||||
{
|
||||
return ble_hs_hci_version;
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_hci_init(void)
|
||||
{
|
||||
|
||||
@@ -80,6 +80,8 @@ void ble_hs_hci_init(void);
|
||||
|
||||
void ble_hs_hci_set_le_supported_feat(uint32_t feat);
|
||||
uint32_t ble_hs_hci_get_le_supported_feat(void);
|
||||
void ble_hs_hci_set_hci_version(uint8_t hci_version);
|
||||
uint8_t ble_hs_hci_get_hci_version(void);
|
||||
|
||||
#if MYNEWT_VAL(BLE_HS_PHONY_HCI_ACKS)
|
||||
typedef int ble_hs_hci_phony_ack_fn(uint8_t *ack, int ack_buf_len);
|
||||
|
||||
@@ -23,6 +23,33 @@
|
||||
#include "host/ble_hs_hci.h"
|
||||
#include "ble_hs_priv.h"
|
||||
|
||||
static int
|
||||
ble_hs_startup_le_read_local_ver_tx(void)
|
||||
{
|
||||
uint8_t ack_params[BLE_HCI_RD_LOC_VER_INFO_RSPLEN];
|
||||
uint8_t ack_params_len;
|
||||
uint8_t hci_version;
|
||||
int rc;
|
||||
|
||||
rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_INFO_PARAMS,
|
||||
BLE_HCI_OCF_IP_RD_LOCAL_VER),
|
||||
NULL,0, ack_params, sizeof ack_params,
|
||||
&ack_params_len);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ack_params_len != BLE_HCI_RD_LOC_VER_INFO_RSPLEN) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
/* For now we are interested only in HCI Version */
|
||||
hci_version = ack_params[0];
|
||||
ble_hs_hci_set_hci_version(hci_version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ble_hs_startup_le_read_sup_f_tx(void)
|
||||
{
|
||||
@@ -251,6 +278,11 @@ ble_hs_startup_go(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_startup_le_read_local_ver_tx();
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* XXX: Read local supported commands. */
|
||||
/* XXX: Read local supported features. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user