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 2023/06/09 07:49:20 UTC
[mynewt-nimble] 01/09: nimble/ll: Cleanup transport handlers
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 2a566fa86fa859d1dc749d0d7d3e71bde8ee44c5
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jan 31 14:51:41 2023 +0100
nimble/ll: Cleanup transport handlers
ble_ll_hci seems like a good place for rx functions to be declared.
Also they do not need extra arg parameter as it's never used. And add
ISO handler as well.
---
nimble/controller/include/controller/ble_ll_hci.h | 4 ++++
nimble/controller/src/ble_ll.c | 10 ++++++--
nimble/controller/src/ble_ll_conn_priv.h | 3 ---
nimble/controller/src/ble_ll_hci.c | 28 +++++++++++------------
4 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/nimble/controller/include/controller/ble_ll_hci.h b/nimble/controller/include/controller/ble_ll_hci.h
index ff668050..6fef1f7b 100644
--- a/nimble/controller/include/controller/ble_ll_hci.h
+++ b/nimble/controller/include/controller/ble_ll_hci.h
@@ -57,6 +57,10 @@ struct ble_ll_hci_vs_cmd {
/* Initialize LL HCI */
void ble_ll_hci_init(void);
+int ble_ll_hci_cmd_rx(uint8_t *cmdbuf);
+int ble_ll_hci_acl_rx(struct os_mbuf *om);
+int ble_ll_hci_iso_rx(struct os_mbuf *om);
+
/* Used to determine if the LE event is enabled/disabled */
bool ble_ll_hci_is_le_event_enabled(unsigned int subev);
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index ed1795be..a1bbe63b 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1966,13 +1966,19 @@ ble_ll_init(void)
int
ble_transport_to_ll_cmd_impl(void *buf)
{
- return ble_ll_hci_cmd_rx(buf, NULL);
+ return ble_ll_hci_cmd_rx(buf);
}
int
ble_transport_to_ll_acl_impl(struct os_mbuf *om)
{
- return ble_ll_hci_acl_rx(om, NULL);
+ return ble_ll_hci_acl_rx(om);
+}
+
+int
+ble_transport_to_ll_iso_impl(struct os_mbuf *om)
+{
+ return ble_ll_hci_iso_rx(om);
}
void
diff --git a/nimble/controller/src/ble_ll_conn_priv.h b/nimble/controller/src/ble_ll_conn_priv.h
index a3e1cc4b..954a2766 100644
--- a/nimble/controller/src/ble_ll_conn_priv.h
+++ b/nimble/controller/src/ble_ll_conn_priv.h
@@ -260,9 +260,6 @@ int ble_ll_conn_set_data_len(struct ble_ll_conn_sm *connsm,
void ble_ll_conn_itvl_to_ticks(uint32_t itvl,
uint32_t *itvl_ticks, uint8_t *itvl_usecs);
-int ble_ll_hci_cmd_rx(uint8_t *cmd, void *arg);
-int ble_ll_hci_acl_rx(struct os_mbuf *om, void *arg);
-
int ble_ll_conn_hci_le_rd_phy(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rsp, uint8_t *rsplen);
int ble_ll_conn_hci_le_set_phy(const uint8_t *cmdbuf, uint8_t len);
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index 0f92654b..6e3f0afa 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -1895,19 +1895,8 @@ send_cc_cs:
BLE_LL_DEBUG_GPIO(HCI_CMD, 0);
}
-/**
- * Sends an HCI command to the controller. On success, the supplied buffer is
- * relinquished to the controller task. On failure, the caller must free the
- * buffer.
- *
- * @param cmd A flat buffer containing the HCI command to
- * send.
- *
- * @return 0 on success;
- * BLE_ERR_MEM_CAPACITY on HCI buffer exhaustion.
- */
int
-ble_ll_hci_cmd_rx(uint8_t *cmdbuf, void *arg)
+ble_ll_hci_cmd_rx(uint8_t *cmdbuf)
{
struct ble_npl_event *ev;
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_CTRL_TO_HOST_FLOW_CONTROL)
@@ -1948,9 +1937,8 @@ ble_ll_hci_cmd_rx(uint8_t *cmdbuf, void *arg)
return 0;
}
-/* Send ACL data from host to contoller */
int
-ble_ll_hci_acl_rx(struct os_mbuf *om, void *arg)
+ble_ll_hci_acl_rx(struct os_mbuf *om)
{
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
ble_ll_acl_data_in(om);
@@ -1961,6 +1949,18 @@ ble_ll_hci_acl_rx(struct os_mbuf *om, void *arg)
return 0;
}
+int
+ble_ll_hci_iso_rx(struct os_mbuf *om)
+{
+#if MYNEWT_VAL(BLE_LL_ISO)
+ /* FIXME send to isoal... */
+ os_mbuf_free_chain(om);
+#else
+ os_mbuf_free_chain(om);
+#endif
+ return 0;
+}
+
/**
* Initalize the LL HCI.
*