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 2022/03/17 10:50:29 UTC

[mynewt-nimble] 19/22: nimble/test: Update for new transport

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 d7e5d6fc35748b1e97d51e5aa3b263ca48d22dfb
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Mar 10 11:21:18 2022 +0100

    nimble/test: Update for new transport
---
 nimble/controller/test/syscfg.yml           |  1 -
 nimble/host/test/pkg.yml                    |  3 +++
 nimble/host/test/src/ble_hs_hci_test.c      |  4 ++--
 nimble/host/test/src/ble_hs_test_util.c     | 23 ++++++++++++-----------
 nimble/host/test/src/ble_hs_test_util_hci.c |  6 ++----
 nimble/host/test/src/ble_os_test.c          |  1 -
 nimble/host/test/syscfg.yml                 |  2 +-
 7 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/nimble/controller/test/syscfg.yml b/nimble/controller/test/syscfg.yml
index 4448a0e..6edad43 100644
--- a/nimble/controller/test/syscfg.yml
+++ b/nimble/controller/test/syscfg.yml
@@ -23,4 +23,3 @@ syscfg.vals:
     MCU_TIMER_POLLER_PRIO: 1
     MCU_UART_POLLER_PRIO: 2
     NATIVE_SOCKETS_PRIO: 3
-    BLE_HCI_TRANSPORT: ram
diff --git a/nimble/host/test/pkg.yml b/nimble/host/test/pkg.yml
index cb5d97c..1698043 100644
--- a/nimble/host/test/pkg.yml
+++ b/nimble/host/test/pkg.yml
@@ -32,3 +32,6 @@ pkg.deps.SELFTEST:
     - "@apache-mynewt-core/sys/log/full"
     - "@apache-mynewt-core/sys/stats/stub"
     - nimble/transport
+
+pkg.apis:
+    - ble_driver
diff --git a/nimble/host/test/src/ble_hs_hci_test.c b/nimble/host/test/src/ble_hs_hci_test.c
index 5f72742..8dd7c77 100644
--- a/nimble/host/test/src/ble_hs_hci_test.c
+++ b/nimble/host/test/src/ble_hs_hci_test.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <string.h>
 #include "nimble/hci_common.h"
-#include "nimble/ble_hci_trans.h"
+#include "nimble/transport.h"
 #include "ble_hs_test.h"
 #include "testutil/testutil.h"
 #include "ble_hs_test_util.h"
@@ -34,7 +34,7 @@ TEST_CASE_SELF(ble_hs_hci_test_event_bad)
     int rc;
 
     /*** Invalid event code. */
-    buf = ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
+    buf = ble_transport_alloc_evt(0);
     TEST_ASSERT_FATAL(buf != NULL);
 
     buf[0] = 0xff;
diff --git a/nimble/host/test/src/ble_hs_test_util.c b/nimble/host/test/src/ble_hs_test_util.c
index 5ee17e7..6a83816 100644
--- a/nimble/host/test/src/ble_hs_test_util.c
+++ b/nimble/host/test/src/ble_hs_test_util.c
@@ -24,11 +24,9 @@
 #include "testutil/testutil.h"
 #include "nimble/ble.h"
 #include "nimble/hci_common.h"
-#include "nimble/ble_hci_trans.h"
 #include "host/ble_hs_adv.h"
 #include "host/ble_hs_id.h"
 #include "store/config/ble_store_config.h"
-#include "transport/ram/ble_hci_ram.h"
 #include "ble_hs_test_util.h"
 
 /* Our global device address. */
@@ -1850,18 +1848,18 @@ ble_hs_test_util_assert_mbufs_freed(
     TEST_ASSERT(count == ble_hs_test_util_num_mbufs());
 }
 
-static int
-ble_hs_test_util_pkt_txed(struct os_mbuf *om, void *arg)
+int
+ble_transport_to_ll_acl(struct os_mbuf *om)
 {
     ble_hs_test_util_prev_tx_enqueue(om);
     return 0;
 }
 
-static int
-ble_hs_test_util_hci_txed(uint8_t *cmdbuf, void *arg)
+int
+ble_transport_to_ll_cmd(void *buf)
 {
-    ble_hs_test_util_hci_out_enqueue(cmdbuf);
-    ble_hci_trans_buf_free(cmdbuf);
+    ble_hs_test_util_hci_out_enqueue(buf);
+    ble_transport_free(buf);
     return 0;
 }
 
@@ -2003,9 +2001,6 @@ ble_hs_test_util_init_no_sysinit_no_start(void)
 
     ble_hs_hci_set_phony_ack_cb(NULL);
 
-    ble_hci_trans_cfg_ll(ble_hs_test_util_hci_txed, NULL,
-                         ble_hs_test_util_pkt_txed, NULL);
-
     ble_hs_test_util_hci_ack_set_startup();
 
     ble_hs_enabled_state = BLE_HS_ENABLED_STATE_OFF;
@@ -2046,3 +2041,9 @@ ble_hs_test_util_init(void)
     /* Clear random address. */
     ble_hs_id_rnd_reset();
 }
+
+void
+ble_transport_ll_init(void)
+{
+    /* nothing here */
+}
\ No newline at end of file
diff --git a/nimble/host/test/src/ble_hs_test_util_hci.c b/nimble/host/test/src/ble_hs_test_util_hci.c
index a53c5d9..e8054c2 100644
--- a/nimble/host/test/src/ble_hs_test_util_hci.c
+++ b/nimble/host/test/src/ble_hs_test_util_hci.c
@@ -20,7 +20,6 @@
 #include "testutil/testutil.h"
 #include "nimble/ble.h"
 #include "nimble/hci_common.h"
-#include "transport/ram/ble_hci_ram.h"
 #include "ble_hs_test_util.h"
 
 #define BLE_HCI_EVENT_CMD_COMPLETE_HDR_LEN  (5)
@@ -522,14 +521,13 @@ ble_hs_test_util_hci_rx_evt(uint8_t *evt)
     totlen = BLE_HCI_EVENT_HDR_LEN + evt[1];
     TEST_ASSERT_FATAL(totlen <= UINT8_MAX + BLE_HCI_EVENT_HDR_LEN);
 
-    evbuf = ble_hci_trans_buf_alloc(
-        BLE_HCI_TRANS_BUF_EVT_LO);
+    evbuf = ble_transport_alloc_evt(1);
     TEST_ASSERT_FATAL(evbuf != NULL);
 
     memcpy(evbuf, evt, totlen);
 
     if (os_started()) {
-        rc = ble_hci_trans_ll_evt_tx(evbuf);
+        rc = ble_transport_to_hs_evt(evbuf);
     } else {
         rc = ble_hs_hci_evt_process((void *)evbuf);
     }
diff --git a/nimble/host/test/src/ble_os_test.c b/nimble/host/test/src/ble_os_test.c
index fa57571..6588c67 100644
--- a/nimble/host/test/src/ble_os_test.c
+++ b/nimble/host/test/src/ble_os_test.c
@@ -21,7 +21,6 @@
 #include "os/os.h"
 #include "testutil/testutil.h"
 #include "nimble/hci_common.h"
-#include "nimble/ble_hci_trans.h"
 #include "ble_hs_test.h"
 #include "host/ble_gap.h"
 #include "ble_hs_test_util.h"
diff --git a/nimble/host/test/syscfg.yml b/nimble/host/test/syscfg.yml
index 45bc638..031b6c8 100644
--- a/nimble/host/test/syscfg.yml
+++ b/nimble/host/test/syscfg.yml
@@ -29,4 +29,4 @@ syscfg.vals:
     CONFIG_FCB: 1
     BLE_VERSION: 52
     BLE_L2CAP_ENHANCED_COC: 1
-    BLE_HCI_TRANSPORT: ram
+    BLE_TRANSPORT_LL: custom