From a82be4f1570a8eee42e04b243dd861286b24dc5f Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Tue, 8 Feb 2022 12:44:41 +0100 Subject: [PATCH] nimble: Allow to define offset for HCI VS commands This allows to tune starting offset for NimBLE VS HCI commands. --- nimble/include/nimble/hci_common.h | 4 ++-- nimble/syscfg.yml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nimble/include/nimble/hci_common.h b/nimble/include/nimble/hci_common.h index e4830833b..32d06b60f 100644 --- a/nimble/include/nimble/hci_common.h +++ b/nimble/include/nimble/hci_common.h @@ -1063,7 +1063,7 @@ struct ble_hci_le_set_host_feat_cp { /* --- Vendor specific commands (OGF 0x003F) */ /* Read Random Static Address */ -#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (0x0001) +#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0001)) struct ble_hci_vs_rd_static_addr_rp { uint8_t addr[6]; } __attribute__((packed)); @@ -1071,7 +1071,7 @@ struct ble_hci_vs_rd_static_addr_rp { /* Set default transmit power. Actual selected TX power is returned * in reply. Setting 0xff restores controller reset default. */ -#define BLE_HCI_OCF_VS_SET_TX_PWR (0x0002) +#define BLE_HCI_OCF_VS_SET_TX_PWR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0002)) struct ble_hci_vs_set_tx_pwr_cp { int8_t tx_power; } __attribute__((packed)); diff --git a/nimble/syscfg.yml b/nimble/syscfg.yml index 0e87c0647..2d2d32927 100644 --- a/nimble/syscfg.yml +++ b/nimble/syscfg.yml @@ -101,6 +101,13 @@ syscfg.defs: Enables support for NimBLE specific vendor HCI commands value: 0 + BLE_HCI_VS_OCF_OFFSET: + description: > + This defines starting offset for NimBLE specific vendor HCI commands. + Purpose of this is to improve compatibility with other custom + implementations. + value: 0 + # Allow periodic sync transfer only if 5.1 or higher syscfg.restrictions: - "'BLE_PERIODIC_ADV_SYNC_TRANSFER == 0' || 'BLE_VERSION >= 51'"