You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2021/11/23 08:11:09 UTC

[mynewt-nimble] branch master updated (3fe2fd9 -> b8ddf0f)

This is an automated email from the ASF dual-hosted git repository.

andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


    from 3fe2fd9  Revert "l2cap: implement echo request-response procedure"
     new 89ac670  nimble/ll: Use 'vs' for vendor specific HCI consistently
     new b8ddf0f  nimble/ll: Add support for vs hci commands registration

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/controller/include/controller/ble_ll.h      |   2 +-
 nimble/controller/include/controller/ble_ll_ctrl.h |   6 +-
 nimble/controller/include/controller/ble_ll_hci.h  |  18 ++++
 nimble/controller/src/ble_ll.c                     |   5 +
 nimble/controller/src/ble_ll_ctrl.c                |  10 +-
 nimble/controller/src/ble_ll_hci.c                 |  44 +-------
 nimble/controller/src/ble_ll_hci_ev.c              |  14 +--
 .../src/ble_ll_hci_priv.h}                         |  19 ++--
 nimble/controller/src/ble_ll_hci_vs.c              | 119 +++++++++++++++++++++
 nimble/controller/syscfg.yml                       |  13 ++-
 nimble/include/nimble/hci_common.h                 |   4 +-
 11 files changed, 182 insertions(+), 72 deletions(-)
 copy nimble/{host/include/host/ble_monitor.h => controller/src/ble_ll_hci_priv.h} (75%)
 create mode 100644 nimble/controller/src/ble_ll_hci_vs.c

[mynewt-nimble] 02/02: nimble/ll: Add support for vs hci commands registration

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit b8ddf0fe06dfc7c717d183c9202eab2283421d06
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Nov 5 11:42:06 2021 +0100

    nimble/ll: Add support for vs hci commands registration
    
    This adds API to allow registration of custom HCI VS commands.
---
 nimble/controller/include/controller/ble_ll_hci.h |  18 ++++
 nimble/controller/src/ble_ll.c                    |   5 +
 nimble/controller/src/ble_ll_hci.c                |  44 +-------
 nimble/controller/src/ble_ll_hci_priv.h           |  37 +++++++
 nimble/controller/src/ble_ll_hci_vs.c             | 119 ++++++++++++++++++++++
 nimble/controller/syscfg.yml                      |   5 +
 6 files changed, 186 insertions(+), 42 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll_hci.h b/nimble/controller/include/controller/ble_ll_hci.h
index 6a9e48e..9f3fc95 100644
--- a/nimble/controller/include/controller/ble_ll_hci.h
+++ b/nimble/controller/include/controller/ble_ll_hci.h
@@ -43,6 +43,20 @@ extern const uint8_t g_ble_ll_supp_cmds[BLE_LL_SUPP_CMD_LEN];
 
 typedef void (*ble_ll_hci_post_cmd_complete_cb)(void);
 
+#if MYNEWT_VAL(BLE_HCI_VS)
+typedef int (* ble_ll_hci_vs_cb_t)(uint16_t ocf,
+                                   const uint8_t *cmdbuf, uint8_t cmdlen,
+                                   uint8_t *rspbuf, uint8_t *rsplen);
+
+#define BLE_LL_HCI_VS_CMD(_ocf, _cb)    { .ocf = (_ocf), .cb = (_cb) }
+
+struct ble_ll_hci_vs_cmd {
+    uint16_t ocf;
+    ble_ll_hci_vs_cb_t cb;
+    SLIST_ENTRY(ble_ll_hci_vs_cmd) link;
+};
+#endif
+
 /* Initialize LL HCI */
 void ble_ll_hci_init(void);
 
@@ -68,6 +82,10 @@ bool ble_ll_hci_adv_mode_ext(void);
 /* Get TX power compensation rounded to integer dB */
 int8_t ble_ll_get_tx_pwr_compensation(void);
 
+#if MYNEWT_VAL(BLE_HCI_VS)
+void ble_ll_hci_vs_register(struct ble_ll_hci_vs_cmd *cmds, uint32_t num_cmds);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 5305e16..16c2242 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -45,6 +45,7 @@
 #include "controller/ble_ll_trace.h"
 #include "controller/ble_ll_sync.h"
 #include "ble_ll_conn_priv.h"
+#include "ble_ll_hci_priv.h"
 #include "ble_ll_priv.h"
 
 #if MYNEWT_VAL(BLE_LL_DTM)
@@ -1731,6 +1732,10 @@ ble_ll_init(void)
     ble_ll_dtm_init();
 #endif
 
+#if MYNEWT_VAL(BLE_HCI_VS)
+    ble_ll_hci_vs_init();
+#endif
+
 #if MYNEWT
     /* Initialize the LL task */
     os_task_init(&g_ble_ll_task, "ble_ll", ble_ll_task, NULL,
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index c2603c9..0e92939 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -36,6 +36,7 @@
 #include "controller/ble_ll_iso.h"
 #include "ble_ll_priv.h"
 #include "ble_ll_conn_priv.h"
+#include "ble_ll_hci_priv.h"
 
 #if MYNEWT_VAL(BLE_LL_DTM)
 #include "ble_ll_dtm_priv.h"
@@ -1525,47 +1526,6 @@ ble_ll_hci_status_params_cmd_proc(const uint8_t *cmdbuf, uint8_t len,
     return rc;
 }
 
-#if MYNEWT_VAL(BLE_HCI_VS)
-static int
-ble_ll_hci_vs_rd_static_addr(uint8_t *rspbuf, uint8_t *rsplen)
-{
-    struct ble_hci_vs_rd_static_addr_rp *rsp = (void *) rspbuf;
-    ble_addr_t addr;
-
-    if (ble_hw_get_static_addr(&addr) < 0) {
-        return BLE_ERR_UNSPECIFIED;
-    }
-
-    memcpy(rsp->addr, addr.val, sizeof(rsp->addr));
-
-    *rsplen = sizeof(*rsp);
-    return BLE_ERR_SUCCESS;
-}
-
-static int
-ble_ll_hci_vs_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf,
-                       uint8_t *rspbuf, uint8_t *rsplen)
-{
-    int rc;
-
-    /* Assume error; if all pass rc gets set to 0 */
-    rc = BLE_ERR_INV_HCI_CMD_PARMS;
-
-    switch (ocf) {
-    case BLE_HCI_OCF_VS_RD_STATIC_ADDR:
-        if (len == 0) {
-            rc = ble_ll_hci_vs_rd_static_addr(rspbuf, rsplen);
-        }
-        break;
-    default:
-        rc = BLE_ERR_UNKNOWN_HCI_CMD;
-        break;
-    }
-
-    return rc;
-}
-#endif
-
 /**
  * Called to process an HCI command from the host.
  *
@@ -1625,7 +1585,7 @@ ble_ll_hci_cmd_proc(struct ble_npl_event *ev)
     case BLE_HCI_OGF_LE:
         rc = ble_ll_hci_le_cmd_proc(cmd->data, cmd->length, ocf, rspbuf, &rsplen, &post_cb);
         break;
-#if MYNEWT_VAL(BLE_HCI_VS)
+#if MYNEWT_VAL(BLE_LL_HCI_VS)
     case BLE_HCI_OGF_VENDOR:
         rc = ble_ll_hci_vs_cmd_proc(cmd->data, cmd->length, ocf, rspbuf, &rsplen);
         break;
diff --git a/nimble/controller/src/ble_ll_hci_priv.h b/nimble/controller/src/ble_ll_hci_priv.h
new file mode 100644
index 0000000..f289dc1
--- /dev/null
+++ b/nimble/controller/src/ble_ll_hci_priv.h
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_LL_HCI_PRIV_
+#define H_BLE_LL_HCI_PRIV_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if MYNEWT_VAL(BLE_HCI_VS)
+void ble_ll_hci_vs_init(void);
+int ble_ll_hci_vs_cmd_proc(const uint8_t *cmdbuf, uint8_t cmdlen, uint16_t ocf,
+                           uint8_t *rspbuf, uint8_t *rsplen);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_BLE_LL_HCI_ */
diff --git a/nimble/controller/src/ble_ll_hci_vs.c b/nimble/controller/src/ble_ll_hci_vs.c
new file mode 100644
index 0000000..8903525
--- /dev/null
+++ b/nimble/controller/src/ble_ll_hci_vs.c
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "syscfg/syscfg.h"
+#include "controller/ble_ll.h"
+#include "controller/ble_ll_hci.h"
+#include "controller/ble_hw.h"
+
+#if MYNEWT_VAL(BLE_LL_HCI_VS)
+
+SLIST_HEAD(ble_ll_hci_vs_list, ble_ll_hci_vs_cmd);
+static struct ble_ll_hci_vs_list g_ble_ll_hci_vs_list;
+
+static int
+ble_ll_hci_vs_rd_static_addr(uint16_t ocf,
+                             const uint8_t *cmdbuf, uint8_t cmdlen,
+                             uint8_t *rspbuf, uint8_t *rsplen)
+{
+    struct ble_hci_vs_rd_static_addr_rp *rsp = (void *) rspbuf;
+    ble_addr_t addr;
+
+    if (cmdlen != 0) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
+    }
+
+    if (ble_hw_get_static_addr(&addr) < 0) {
+        return BLE_ERR_UNSPECIFIED;
+    }
+
+    memcpy(rsp->addr, addr.val, sizeof(rsp->addr));
+
+    *rsplen = sizeof(*rsp);
+
+    return BLE_ERR_SUCCESS;
+}
+
+static struct ble_ll_hci_vs_cmd g_ble_ll_hci_vs_cmds[] = {
+    BLE_LL_HCI_VS_CMD(BLE_HCI_OCF_VS_RD_STATIC_ADDR,
+                      ble_ll_hci_vs_rd_static_addr),
+};
+
+static struct ble_ll_hci_vs_cmd *
+ble_ll_hci_vs_find_by_ocf(uint16_t ocf)
+{
+    struct ble_ll_hci_vs_cmd *entry;
+
+    entry = SLIST_FIRST(&g_ble_ll_hci_vs_list);
+    while (entry) {
+        if (entry->ocf == ocf) {
+            return entry;
+        }
+
+        entry = SLIST_NEXT(entry, link);
+    }
+
+    return NULL;
+}
+
+int
+ble_ll_hci_vs_cmd_proc(const uint8_t *cmdbuf, uint8_t cmdlen, uint16_t ocf,
+                       uint8_t *rspbuf, uint8_t *rsplen)
+{
+    struct ble_ll_hci_vs_cmd *cmd;
+    int rc;
+
+    cmd = ble_ll_hci_vs_find_by_ocf(ocf);
+    if (!cmd) {
+        rc = BLE_ERR_UNKNOWN_HCI_CMD;
+    } else {
+        rc = cmd->cb(ocf, cmdbuf, cmdlen, rspbuf, rsplen);
+    }
+
+    return rc;
+}
+
+void
+ble_ll_hci_vs_register(struct ble_ll_hci_vs_cmd *cmds, uint32_t num_cmds)
+{
+    uint32_t i;
+
+    /* Assume all cmds are registered early on init, so just assert in case of
+     * invalid request since it means something is wrong with the code itself.
+     */
+
+    for (i = 0; i < num_cmds; i++, cmds++) {
+        BLE_LL_ASSERT(cmds->cb != NULL);
+        BLE_LL_ASSERT(ble_ll_hci_vs_find_by_ocf(cmds->ocf) == NULL);
+
+        SLIST_INSERT_HEAD(&g_ble_ll_hci_vs_list, cmds, link);
+    }
+}
+
+void
+ble_ll_hci_vs_init(void)
+{
+    SLIST_INIT(&g_ble_ll_hci_vs_list);
+
+    ble_ll_hci_vs_register(g_ble_ll_hci_vs_cmds,
+                           ARRAY_SIZE(g_ble_ll_hci_vs_cmds));
+}
+
+#endif
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index d60e18f..d799e1c 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -348,6 +348,11 @@ syscfg.defs:
              depending on specified HCI command length.
         value: 0
 
+    BLE_LL_HCI_VS:
+        description: >
+            Enables support for vendor-specific HCI commands.
+        value: MYNEWT_VAL(BLE_HCI_VS)
+
     BLE_LL_HCI_VS_EVENT_ON_ASSERT:
         description: >
             This options enables controller to send a vendor-specific event on

[mynewt-nimble] 01/02: nimble/ll: Use 'vs' for vendor specific HCI consistently

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 89ac67032e382a0c9a92b0798d1e877d252f6f00
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Nov 9 15:03:54 2021 +0100

    nimble/ll: Use 'vs' for vendor specific HCI consistently
---
 nimble/controller/include/controller/ble_ll.h      |  2 +-
 nimble/controller/include/controller/ble_ll_ctrl.h |  6 +++---
 nimble/controller/src/ble_ll_ctrl.c                | 10 ++++++----
 nimble/controller/src/ble_ll_hci_ev.c              | 14 +++++++-------
 nimble/controller/syscfg.yml                       |  8 ++++++--
 nimble/include/nimble/hci_common.h                 |  4 ++--
 6 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index 5568834..dfda8cf 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -48,7 +48,7 @@ extern "C" {
         if (hal_debugger_connected()) { \
             assert(0);\
         } else {\
-            ble_ll_hci_ev_send_vendor_err(__FILE__, __LINE__); \
+            ble_ll_hci_ev_send_vs_assert(__FILE__, __LINE__); \
             while(1) {}\
         }\
     }
diff --git a/nimble/controller/include/controller/ble_ll_ctrl.h b/nimble/controller/include/controller/ble_ll_ctrl.h
index bd38e58..62e1a53 100644
--- a/nimble/controller/include/controller/ble_ll_ctrl.h
+++ b/nimble/controller/include/controller/ble_ll_ctrl.h
@@ -315,9 +315,9 @@ int ble_ll_hci_ev_phy_update(struct ble_ll_conn_sm *connsm, uint8_t status);
 void ble_ll_calc_session_key(struct ble_ll_conn_sm *connsm);
 void ble_ll_ctrl_phy_update_proc_complete(struct ble_ll_conn_sm *connsm);
 void ble_ll_ctrl_initiate_dle(struct ble_ll_conn_sm *connsm);
-void ble_ll_hci_ev_send_vendor_err(const char *file, uint32_t line);
-void ble_ll_hci_ev_send_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
-                                   void *pdu, size_t length);
+void ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line);
+void ble_ll_hci_ev_send_vs_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
+                                      void *pdu, size_t length);
 
 uint8_t ble_ll_ctrl_phy_tx_transition_get(uint8_t phy_mask);
 uint8_t ble_ll_ctrl_phy_from_phy_mask(uint8_t phy_mask);
diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index b6c6036..94d73a9 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -2469,8 +2469,9 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om)
     opcode = dptr[2];
 
 #if MYNEWT_VAL(BLE_LL_HCI_LLCP_TRACE)
-    ble_ll_hci_ev_send_llcp_trace(0x03, connsm->conn_handle, connsm->event_cntr,
-                                  &dptr[2], len);
+    ble_ll_hci_ev_send_vs_llcp_trace(0x03, connsm->conn_handle,
+                                     connsm->event_cntr,
+                                     &dptr[2], len);
 #endif
 
     /*
@@ -2803,8 +2804,9 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
     uint8_t opcode;
 
 #if MYNEWT_VAL(BLE_LL_HCI_LLCP_TRACE)
-    ble_ll_hci_ev_send_llcp_trace(0x04, connsm->conn_handle, connsm->event_cntr,
-                                  txpdu->om_data, txpdu->om_len);
+    ble_ll_hci_ev_send_vs_llcp_trace(0x04, connsm->conn_handle,
+                                     connsm->event_cntr,
+                                     txpdu->om_data, txpdu->om_len);
 #endif
 
     rc = 0;
diff --git a/nimble/controller/src/ble_ll_hci_ev.c b/nimble/controller/src/ble_ll_hci_ev.c
index ccbb1aa..9d6c39e 100644
--- a/nimble/controller/src/ble_ll_hci_ev.c
+++ b/nimble/controller/src/ble_ll_hci_ev.c
@@ -493,9 +493,9 @@ ble_ll_hci_ev_sca_update(struct ble_ll_conn_sm *connsm, uint8_t status,
 #endif
 
 void
-ble_ll_hci_ev_send_vendor_err(const char *file, uint32_t line)
+ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line)
 {
-    struct ble_hci_ev_vendor_debug *ev;
+    struct ble_hci_ev_vs_debug *ev;
     struct ble_hci_ev *hci_ev;
     unsigned int str_len;
     bool skip = true;
@@ -510,7 +510,7 @@ ble_ll_hci_ev_send_vendor_err(const char *file, uint32_t line)
 
     hci_ev = (void *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
     if (hci_ev) {
-        hci_ev->opcode = BLE_HCI_EVCODE_VENDOR_DEBUG;
+        hci_ev->opcode = BLE_HCI_EVCODE_VS_DEBUG;
         hci_ev->length = sizeof(*ev);
         ev = (void *) hci_ev->data;
 
@@ -554,15 +554,15 @@ ble_ll_hci_ev_send_vendor_err(const char *file, uint32_t line)
 
 #if MYNEWT_VAL(BLE_LL_HCI_LLCP_TRACE)
 void
-ble_ll_hci_ev_send_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
-                              void *pdu, size_t length)
+ble_ll_hci_ev_send_vs_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
+                                 void *pdu, size_t length)
 {
-    struct ble_hci_ev_vendor_debug *ev;
+    struct ble_hci_ev_vs_debug *ev;
     struct ble_hci_ev *hci_ev;
 
     hci_ev = (void *)ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_LO);
     if (hci_ev) {
-        hci_ev->opcode = BLE_HCI_EVCODE_VENDOR_DEBUG;
+        hci_ev->opcode = BLE_HCI_EVCODE_VS_DEBUG;
         hci_ev->length = sizeof(*ev) + 8 + length;
         ev = (void *) hci_ev->data;
 
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index de6e688..d60e18f 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -348,7 +348,7 @@ syscfg.defs:
              depending on specified HCI command length.
         value: 0
 
-    BLE_LL_VND_EVENT_ON_ASSERT:
+    BLE_LL_HCI_VS_EVENT_ON_ASSERT:
         description: >
             This options enables controller to send a vendor-specific event on
             an assertion in controller code. The event contains file name and
@@ -438,6 +438,10 @@ syscfg.defs:
         description: use BLE_LL_SCA instead
         value: 60
         deprecated: 1
+    BLE_LL_VND_EVENT_ON_ASSERT:
+        description: use BLE_LL_HCI_VS_EVENT_ON_ASSERT
+        value: 0
+        deprecated: 1
 
 # defunct settings (to be removed eventually)
     BLE_DEVICE:
@@ -466,7 +470,7 @@ syscfg.vals.BLE_LL_CFG_FEAT_LL_EXT_ADV:
 # Enable vendor event on assert in standalone build to make failed assertions in
 # controller code visible when connected to external host
 syscfg.vals.!BLE_HOST:
-    BLE_LL_VND_EVENT_ON_ASSERT: 1
+    BLE_LL_HCI_VS_EVENT_ON_ASSERT: 1
 
 syscfg.restrictions:
     - OS_CPUTIME_FREQ == 32768
diff --git a/nimble/include/nimble/hci_common.h b/nimble/include/nimble/hci_common.h
index 9acb762..b6f9869 100644
--- a/nimble/include/nimble/hci_common.h
+++ b/nimble/include/nimble/hci_common.h
@@ -1446,8 +1446,8 @@ struct ble_hci_ev_auth_pyld_tmo {
 
 #define BLE_HCI_EVCODE_SAM_STATUS_CHG       (0x58)
 
-#define BLE_HCI_EVCODE_VENDOR_DEBUG         (0xFF)
-struct ble_hci_ev_vendor_debug {
+#define BLE_HCI_EVCODE_VS_DEBUG             (0xFF)
+struct ble_hci_ev_vs_debug {
     uint8_t id;
     uint8_t data[0];
 } __attribute__((packed));