Bluetooth: Controller: Use a common ISO_PDU node rx type
Refactor implementation to use a single common ISO PDU node rx type for ISO Synchronized Receiver. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
2d781ddfb2
commit
f6fd4444b6
6 changed files with 56 additions and 56 deletions
|
@ -6444,22 +6444,6 @@ static void le_big_sync_established(struct pdu_data *pdu,
|
|||
}
|
||||
}
|
||||
|
||||
static void le_sync_iso_pdu(struct pdu_data *pdu,
|
||||
struct node_rx_pdu *node_rx,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
/* If HCI datapath pass to ISO AL here */
|
||||
const struct lll_sync_iso_stream *stream;
|
||||
struct isoal_pdu_rx isoal_rx;
|
||||
isoal_status_t err;
|
||||
|
||||
stream = ull_sync_iso_stream_get(node_rx->hdr.handle);
|
||||
isoal_rx.meta = &node_rx->hdr.rx_iso_meta;
|
||||
isoal_rx.pdu = (void *)node_rx->pdu;
|
||||
err = isoal_rx_pdu_recombine(stream->dp->sink_hdl, &isoal_rx);
|
||||
LL_ASSERT(err == ISOAL_STATUS_OK || err == ISOAL_STATUS_ERR_SDU_ALLOC);
|
||||
}
|
||||
|
||||
static void le_big_sync_lost(struct pdu_data *pdu,
|
||||
struct node_rx_pdu *node_rx,
|
||||
struct net_buf *buf)
|
||||
|
@ -6923,10 +6907,6 @@ static void encode_control(struct node_rx_pdu *node_rx,
|
|||
le_big_sync_established(pdu_data, node_rx, buf);
|
||||
break;
|
||||
|
||||
case NODE_RX_TYPE_SYNC_ISO_PDU:
|
||||
le_sync_iso_pdu(pdu_data, node_rx, buf);
|
||||
break;
|
||||
|
||||
case NODE_RX_TYPE_SYNC_ISO_LOST:
|
||||
le_big_sync_lost(pdu_data, node_rx, buf);
|
||||
break;
|
||||
|
@ -7418,7 +7398,6 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
|
|||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
__fallthrough;
|
||||
case NODE_RX_TYPE_SYNC_ISO:
|
||||
case NODE_RX_TYPE_SYNC_ISO_PDU:
|
||||
case NODE_RX_TYPE_SYNC_ISO_LOST:
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
||||
|
@ -7460,10 +7439,10 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
|
|||
#endif /* CONFIG_BT_CTLR_PHY */
|
||||
return HCI_CLASS_EVT_CONNECTION;
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
case NODE_RX_TYPE_ISO_PDU:
|
||||
return HCI_CLASS_ISO_DATA;
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO || CONFIG_BT_CTLR_CONN_ISO */
|
||||
|
||||
#if CONFIG_BT_CTLR_USER_EVT_RANGE > 0
|
||||
case NODE_RX_TYPE_USER_START ... NODE_RX_TYPE_USER_END - 1:
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_hci_driver
|
||||
#include "common/log.h"
|
||||
#include "hal/debug.h"
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/memq.h"
|
||||
|
@ -44,21 +45,24 @@
|
|||
#include "ll_sw/pdu.h"
|
||||
#include "ll_sw/lll.h"
|
||||
#include "lll/lll_df_types.h"
|
||||
#include "ll_sw/lll_sync_iso.h"
|
||||
#include "ll_sw/lll_conn.h"
|
||||
#include "ll_sw/lll_conn_iso.h"
|
||||
|
||||
#include "ll_sw/isoal.h"
|
||||
|
||||
#include "ll_sw/ull_iso_types.h"
|
||||
#include "ll_sw/ull_conn_iso_types.h"
|
||||
|
||||
#include "ll_sw/ull_iso_internal.h"
|
||||
#include "ll_sw/ull_sync_iso_internal.h"
|
||||
#include "ll_sw/ull_conn_internal.h"
|
||||
#include "ll_sw/ull_conn_iso_internal.h"
|
||||
|
||||
#include "ll.h"
|
||||
|
||||
#include "isoal.h"
|
||||
#include "ull_iso_types.h"
|
||||
#include "lll_conn_iso.h"
|
||||
#include "ull_conn_iso_types.h"
|
||||
#include "ull_iso_internal.h"
|
||||
#include "ull_conn_internal.h"
|
||||
#include "ull_conn_iso_internal.h"
|
||||
|
||||
#include "hci_internal.h"
|
||||
|
||||
#include "hal/debug.h"
|
||||
|
||||
static K_SEM_DEFINE(sem_prio_recv, 0, K_SEM_MAX_LIMIT);
|
||||
static K_FIFO_DEFINE(recv_fifo);
|
||||
|
||||
|
@ -325,17 +329,15 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx,
|
|||
#endif
|
||||
#if defined(CONFIG_BT_CTLR_ISO)
|
||||
case HCI_CLASS_ISO_DATA: {
|
||||
#if defined(CONFIG_BT_CTLR_CONN_ISO) || defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
#if defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
uint8_t handle = node_rx->hdr.handle;
|
||||
struct ll_iso_stream_hdr *hdr = NULL;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
if (IS_CIS_HANDLE(handle)) {
|
||||
struct ll_conn_iso_stream *cis =
|
||||
ll_conn_iso_stream_get(handle);
|
||||
hdr = &cis->hdr;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ll_iso_datapath *dp = hdr->datapath_out;
|
||||
isoal_sink_handle_t sink = dp->sink_hdl;
|
||||
|
@ -353,10 +355,23 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx,
|
|||
|
||||
LL_ASSERT(err == ISOAL_STATUS_OK); /* TODO handle err */
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CTLR_CONN_ISO */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
const struct lll_sync_iso_stream *stream;
|
||||
struct isoal_pdu_rx isoal_rx;
|
||||
isoal_status_t err;
|
||||
|
||||
stream = ull_sync_iso_stream_get(node_rx->hdr.handle);
|
||||
isoal_rx.meta = &node_rx->hdr.rx_iso_meta;
|
||||
isoal_rx.pdu = (void *)node_rx->pdu;
|
||||
err = isoal_rx_pdu_recombine(stream->dp->sink_hdl, &isoal_rx);
|
||||
LL_ASSERT(err == ISOAL_STATUS_OK ||
|
||||
err == ISOAL_STATUS_ERR_SDU_ALLOC);
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CTLR_ISO */
|
||||
|
||||
default:
|
||||
LL_ASSERT(0);
|
||||
|
|
|
@ -263,7 +263,6 @@ enum node_rx_type {
|
|||
NODE_RX_TYPE_SYNC_LOST,
|
||||
NODE_RX_TYPE_SYNC_CHM_COMPLETE,
|
||||
NODE_RX_TYPE_SYNC_ISO,
|
||||
NODE_RX_TYPE_SYNC_ISO_PDU,
|
||||
NODE_RX_TYPE_SYNC_ISO_LOST,
|
||||
NODE_RX_TYPE_EXT_ADV_TERMINATE,
|
||||
NODE_RX_TYPE_BIG_COMPLETE,
|
||||
|
|
|
@ -481,7 +481,7 @@ static void isr_rx(void *param)
|
|||
|
||||
ull_pdu_rx_alloc();
|
||||
|
||||
node_rx->hdr.type = NODE_RX_TYPE_SYNC_ISO_PDU;
|
||||
node_rx->hdr.type = NODE_RX_TYPE_ISO_PDU;
|
||||
node_rx->hdr.handle = lll->stream_handle[bis_idx];
|
||||
|
||||
iso_meta = &node_rx->hdr.rx_iso_meta;
|
||||
|
|
|
@ -1139,7 +1139,6 @@ void ll_rx_dequeue(void)
|
|||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
/* fall through */
|
||||
case NODE_RX_TYPE_SYNC_ISO:
|
||||
case NODE_RX_TYPE_SYNC_ISO_PDU:
|
||||
case NODE_RX_TYPE_SYNC_ISO_LOST:
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
||||
|
@ -1330,9 +1329,6 @@ void ll_rx_mem_release(void **node_rx)
|
|||
case NODE_RX_TYPE_EXT_CODED_REPORT:
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
|
||||
case NODE_RX_TYPE_SYNC_REPORT:
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
case NODE_RX_TYPE_SYNC_ISO_PDU:
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
||||
#endif /* CONFIG_BT_CTLR_ADV_EXT */
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
@ -2495,9 +2491,6 @@ static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
|
|||
|
||||
#if defined(CONFIG_BT_OBSERVER)
|
||||
case NODE_RX_TYPE_REPORT:
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
case NODE_RX_TYPE_SYNC_ISO_PDU:
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
|
||||
|
|
|
@ -277,7 +277,7 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
|
|||
sync_iso = ull_sync_iso_by_stream_get(stream_handle);
|
||||
lll_iso = &sync_iso->lll;
|
||||
|
||||
role = 1; /* FIXME: Set role from LLL struct */
|
||||
role = 1U; /* FIXME: Set role from LLL struct */
|
||||
burst_number = lll_iso->bn;
|
||||
sdu_interval = lll_iso->sdu_interval;
|
||||
iso_interval = lll_iso->iso_interval;
|
||||
|
@ -306,14 +306,22 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
|
|||
sdu_alloc, sdu_emit, sdu_write,
|
||||
&sink_handle);
|
||||
} else {
|
||||
ull_iso_datapath_release(dp);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
stream->dp = dp;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
|
||||
dp->sink_hdl = sink_handle;
|
||||
isoal_sink_enable(sink_handle);
|
||||
} else {
|
||||
ull_iso_datapath_release(dp);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
|
@ -322,15 +330,16 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
|
|||
|
||||
uint8_t ll_remove_iso_path(uint16_t handle, uint8_t path_dir)
|
||||
{
|
||||
struct ll_iso_datapath *dp;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
struct ll_conn_iso_stream *cis = NULL;
|
||||
struct ll_iso_stream_hdr *hdr = NULL;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_ISO)
|
||||
if (IS_CIS_HANDLE(handle)) {
|
||||
cis = ll_conn_iso_stream_get(handle);
|
||||
hdr = &cis->hdr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the Host issues this command with a Connection_Handle that does not exist
|
||||
* or is not for a CIS or a BIS, the Controller shall return the error code Unknown
|
||||
|
@ -340,37 +349,42 @@ uint8_t ll_remove_iso_path(uint16_t handle, uint8_t path_dir)
|
|||
return BT_HCI_ERR_UNKNOWN_CONN_ID;
|
||||
}
|
||||
|
||||
struct ll_iso_datapath *dp;
|
||||
|
||||
if (path_dir == BT_HCI_DATAPATH_DIR_HOST_TO_CTLR) {
|
||||
dp = hdr->datapath_in;
|
||||
if (dp) {
|
||||
hdr->datapath_in = NULL;
|
||||
mem_release(dp, &datapath_free);
|
||||
ull_iso_datapath_release(dp);
|
||||
}
|
||||
} else if (path_dir == BT_HCI_DATAPATH_DIR_CTLR_TO_HOST) {
|
||||
dp = hdr->datapath_out;
|
||||
if (dp) {
|
||||
hdr->datapath_out = NULL;
|
||||
mem_release(dp, &datapath_free);
|
||||
ull_iso_datapath_release(dp);
|
||||
}
|
||||
} else {
|
||||
/* Reserved for future use */
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_CONN_ISO */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
struct lll_sync_iso_stream *stream;
|
||||
uint16_t stream_handle;
|
||||
|
||||
if (path_dir != BT_HCI_DATAPATH_DIR_CTLR_TO_HOST) {
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
stream = ull_sync_iso_stream_get(handle);
|
||||
if (handle < BT_CTLR_SYNC_ISO_STREAM_HANDLE_BASE) {
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
stream_handle = handle - BT_CTLR_SYNC_ISO_STREAM_HANDLE_BASE;
|
||||
|
||||
stream = ull_sync_iso_stream_get(stream_handle);
|
||||
dp = stream->dp;
|
||||
if (dp) {
|
||||
stream->dp = NULL;
|
||||
mem_release(dp, &datapath_free);
|
||||
ull_iso_datapath_release(dp);
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue